diff --git a/.eslintcache b/.eslintcache deleted file mode 100644 index cd44813307..0000000000 --- a/.eslintcache +++ /dev/null @@ -1 +0,0 @@ -[{"/home/tempuser-z687wq/run/codegen-output/cloudflare/cloudflare-node/src/resources/ai/to-markdown.ts":"1"},{"size":1733,"mtime":1759266822909}] \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 5637fc3e0e..3eb9dff55c 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 1822 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-ca8fbfa82d19dca400ec61b8c93392de1acd157860e435419f9a5e9ec8c586e0.yml -openapi_spec_hash: 77d55c70bc3824ac61bd056e2319ee18 -config_hash: 107e0f1f8a98b007260b319226b88b3c +configured_endpoints: 1940 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-d3b3813ba8fb0b5303cfad8fcbd363941c494711e4cce61069553692b664774f.yml +openapi_spec_hash: 4f467a53fd61500db4f7561dcfaaa088 +config_hash: 7820d7177150dfa66fc3f3f0c2eb8705 diff --git a/api.md b/api.md index 7ffb0aa433..0a6bb46dc5 100644 --- a/api.md +++ b/api.md @@ -124,6 +124,32 @@ Methods: - client.accounts.logs.audit.list({ ...params }) -> AuditListResponsesCursorPaginationAfter +# Organizations + +Types: + +- Organization +- OrganizationDeleteResponse + +Methods: + +- client.organizations.create({ ...params }) -> Organization +- client.organizations.update(organizationId, { ...params }) -> Organization +- client.organizations.list({ ...params }) -> OrganizationsSinglePage +- client.organizations.delete(organizationId) -> OrganizationDeleteResponse +- client.organizations.get(organizationId) -> Organization + +## OrganizationProfile + +Types: + +- OrganizationProfile + +Methods: + +- client.organizations.organizationProfile.update(organizationId, { ...params }) -> void +- client.organizations.organizationProfile.get(organizationId) -> unnamed_schema_0.Result + # OriginCACertificates Types: @@ -2082,6 +2108,7 @@ Types: - Script - ScriptSetting - ScriptUpdateResponse +- ScriptListResponse - ScriptDeleteResponse - ScriptGetResponse - ScriptSearchResponse @@ -2089,7 +2116,7 @@ Types: Methods: - client.workers.scripts.update(scriptName, { ...params }) -> ScriptUpdateResponse -- client.workers.scripts.list({ ...params }) -> ScriptsSinglePage +- client.workers.scripts.list({ ...params }) -> ScriptListResponsesSinglePage - client.workers.scripts.delete(scriptName, { ...params }) -> ScriptDeleteResponse | null - client.workers.scripts.get(scriptName, { ...params }) -> string - client.workers.scripts.search({ ...params }) -> ScriptSearchResponse @@ -2253,6 +2280,7 @@ Types: Methods: - client.workers.subdomains.update({ ...params }) -> SubdomainUpdateResponse +- client.workers.subdomains.delete({ ...params }) -> void - client.workers.subdomains.get({ ...params }) -> SubdomainGetResponse ## Observability @@ -2421,6 +2449,7 @@ Types: - SubscriptionUpdateResponse - SubscriptionListResponse - SubscriptionDeleteResponse +- SubscriptionGetResponse Methods: @@ -2428,6 +2457,7 @@ Methods: - client.queues.subscriptions.update(subscriptionId, { ...params }) -> SubscriptionUpdateResponse - client.queues.subscriptions.list({ ...params }) -> SubscriptionListResponsesV4PagePaginationArray - client.queues.subscriptions.delete(subscriptionId, { ...params }) -> SubscriptionDeleteResponse +- client.queues.subscriptions.get(subscriptionId, { ...params }) -> SubscriptionGetResponse # APIGateway @@ -2436,11 +2466,10 @@ Methods: Types: - Configuration -- ConfigurationUpdateResponse Methods: -- client.apiGateway.configurations.update({ ...params }) -> ConfigurationUpdateResponse +- client.apiGateway.configurations.update({ ...params }) -> Configuration - client.apiGateway.configurations.get({ ...params }) -> Configuration ## Discovery @@ -2531,17 +2560,17 @@ Methods: Types: - Message -- PublicSchema -- SchemaUpload +- OldPublicSchema +- UserSchemaCreateResponse - UserSchemaDeleteResponse Methods: -- client.apiGateway.userSchemas.create({ ...params }) -> SchemaUpload -- client.apiGateway.userSchemas.list({ ...params }) -> PublicSchemasV4PagePaginationArray +- client.apiGateway.userSchemas.create({ ...params }) -> UserSchemaCreateResponse +- client.apiGateway.userSchemas.list({ ...params }) -> OldPublicSchemasV4PagePaginationArray - client.apiGateway.userSchemas.delete(schemaId, { ...params }) -> UserSchemaDeleteResponse -- client.apiGateway.userSchemas.edit(schemaId, { ...params }) -> PublicSchema -- client.apiGateway.userSchemas.get(schemaId, { ...params }) -> PublicSchema +- client.apiGateway.userSchemas.edit(schemaId, { ...params }) -> OldPublicSchema +- client.apiGateway.userSchemas.get(schemaId, { ...params }) -> OldPublicSchema ### Operations @@ -3919,32 +3948,41 @@ Types: - Deployment - Project - Stage +- ProjectCreateResponse +- ProjectListResponse - ProjectDeleteResponse +- ProjectEditResponse +- ProjectGetResponse - ProjectPurgeBuildCacheResponse Methods: -- client.pages.projects.create({ ...params }) -> Project -- client.pages.projects.list({ ...params }) -> DeploymentsSinglePage +- client.pages.projects.create({ ...params }) -> ProjectCreateResponse +- client.pages.projects.list({ ...params }) -> ProjectListResponsesV4PagePaginationArray - client.pages.projects.delete(projectName, { ...params }) -> ProjectDeleteResponse | null -- client.pages.projects.edit(projectName, { ...params }) -> Project -- client.pages.projects.get(projectName, { ...params }) -> Project +- client.pages.projects.edit(projectName, { ...params }) -> ProjectEditResponse +- client.pages.projects.get(projectName, { ...params }) -> ProjectGetResponse - client.pages.projects.purgeBuildCache(projectName, { ...params }) -> ProjectPurgeBuildCacheResponse | null ### Deployments Types: +- DeploymentCreateResponse +- DeploymentListResponse - DeploymentDeleteResponse +- DeploymentGetResponse +- DeploymentRetryResponse +- DeploymentRollbackResponse Methods: -- client.pages.projects.deployments.create(projectName, { ...params }) -> Deployment -- client.pages.projects.deployments.list(projectName, { ...params }) -> DeploymentsSinglePage +- client.pages.projects.deployments.create(projectName, { ...params }) -> DeploymentCreateResponse +- client.pages.projects.deployments.list(projectName, { ...params }) -> DeploymentListResponsesV4PagePaginationArray - client.pages.projects.deployments.delete(projectName, deploymentId, { ...params }) -> DeploymentDeleteResponse | null -- client.pages.projects.deployments.get(projectName, deploymentId, { ...params }) -> Deployment -- client.pages.projects.deployments.retry(projectName, deploymentId, { ...params }) -> Deployment -- client.pages.projects.deployments.rollback(projectName, deploymentId, { ...params }) -> Deployment +- client.pages.projects.deployments.get(projectName, deploymentId, { ...params }) -> DeploymentGetResponse +- client.pages.projects.deployments.retry(projectName, deploymentId, { ...params }) -> DeploymentRetryResponse +- client.pages.projects.deployments.rollback(projectName, deploymentId, { ...params }) -> DeploymentRollbackResponse #### History @@ -3970,11 +4008,11 @@ Types: Methods: -- client.pages.projects.domains.create(projectName, { ...params }) -> DomainCreateResponse | null +- client.pages.projects.domains.create(projectName, { ...params }) -> DomainCreateResponse - client.pages.projects.domains.list(projectName, { ...params }) -> DomainListResponsesSinglePage - client.pages.projects.domains.delete(projectName, domainName, { ...params }) -> DomainDeleteResponse | null -- client.pages.projects.domains.edit(projectName, domainName, { ...params }) -> DomainEditResponse | null -- client.pages.projects.domains.get(projectName, domainName, { ...params }) -> DomainGetResponse | null +- client.pages.projects.domains.edit(projectName, domainName, { ...params }) -> DomainEditResponse +- client.pages.projects.domains.get(projectName, domainName, { ...params }) -> DomainGetResponse # Registrar @@ -4346,6 +4384,24 @@ Methods: - client.alerting.policies.delete(policyId, { ...params }) -> PolicyDeleteResponse - client.alerting.policies.get(policyId, { ...params }) -> Policy +## Silences + +Types: + +- SilenceCreateResponse +- SilenceUpdateResponse +- SilenceListResponse +- SilenceDeleteResponse +- SilenceGetResponse + +Methods: + +- client.alerting.silences.create([ ...body ]) -> SilenceCreateResponse +- client.alerting.silences.update([ ...body ]) -> SilenceUpdateResponsesSinglePage +- client.alerting.silences.list({ ...params }) -> SilenceListResponsesSinglePage +- client.alerting.silences.delete(silenceId, { ...params }) -> SilenceDeleteResponse +- client.alerting.silences.get(silenceId, { ...params }) -> SilenceGetResponse + # D1 Types: @@ -4563,6 +4619,75 @@ Methods: - client.r2.superSlurper.connectivityPrecheck.source({ ...params }) -> ConnectivityPrecheckSourceResponse - client.r2.superSlurper.connectivityPrecheck.target({ ...params }) -> ConnectivityPrecheckTargetResponse +# R2DataCatalog + +Types: + +- R2DataCatalogListResponse +- R2DataCatalogEnableResponse +- R2DataCatalogGetResponse + +Methods: + +- client.r2DataCatalog.list({ ...params }) -> R2DataCatalogListResponse +- client.r2DataCatalog.disable(bucketName, { ...params }) -> void +- client.r2DataCatalog.enable(bucketName, { ...params }) -> R2DataCatalogEnableResponse +- client.r2DataCatalog.get(bucketName, { ...params }) -> R2DataCatalogGetResponse + +## MaintenanceConfigs + +Types: + +- MaintenanceConfigUpdateResponse +- MaintenanceConfigGetResponse + +Methods: + +- client.r2DataCatalog.maintenanceConfigs.update(bucketName, { ...params }) -> MaintenanceConfigUpdateResponse +- client.r2DataCatalog.maintenanceConfigs.get(bucketName, { ...params }) -> MaintenanceConfigGetResponse + +## Credentials + +Types: + +- CredentialCreateResponse + +Methods: + +- client.r2DataCatalog.credentials.create(bucketName, { ...params }) -> CredentialCreateResponse | null + +## Namespaces + +Types: + +- NamespaceListResponse + +Methods: + +- client.r2DataCatalog.namespaces.list(bucketName, { ...params }) -> NamespaceListResponse + +### Tables + +Types: + +- TableListResponse + +Methods: + +- client.r2DataCatalog.namespaces.tables.list(bucketName, namespace, { ...params }) -> TableListResponse + +#### MaintenanceConfigs + +Types: + +- MaintenanceConfigUpdateResponse +- MaintenanceConfigGetResponse + +Methods: + +- client.r2DataCatalog.namespaces.tables.maintenanceConfigs.update(bucketName, namespace, tableName, { ...params }) -> MaintenanceConfigUpdateResponse +- client.r2DataCatalog.namespaces.tables.maintenanceConfigs.get(bucketName, namespace, tableName, { ...params }) -> MaintenanceConfigGetResponse + # WorkersForPlatforms ## Dispatch @@ -5021,6 +5146,48 @@ Methods: ## Access +### AIControls + +#### Mcp + +##### Portals + +Types: + +- PortalCreateResponse +- PortalUpdateResponse +- PortalListResponse +- PortalDeleteResponse +- PortalReadResponse + +Methods: + +- client.zeroTrust.access.aiControls.mcp.portals.create({ ...params }) -> PortalCreateResponse +- client.zeroTrust.access.aiControls.mcp.portals.update(id, { ...params }) -> PortalUpdateResponse +- client.zeroTrust.access.aiControls.mcp.portals.list({ ...params }) -> PortalListResponsesV4PagePaginationArray +- client.zeroTrust.access.aiControls.mcp.portals.delete(id, { ...params }) -> PortalDeleteResponse +- client.zeroTrust.access.aiControls.mcp.portals.read(id, { ...params }) -> PortalReadResponse + +##### Servers + +Types: + +- ServerCreateResponse +- ServerUpdateResponse +- ServerListResponse +- ServerDeleteResponse +- ServerReadResponse +- ServerSyncResponse + +Methods: + +- client.zeroTrust.access.aiControls.mcp.servers.create({ ...params }) -> ServerCreateResponse +- client.zeroTrust.access.aiControls.mcp.servers.update(id, { ...params }) -> ServerUpdateResponse +- client.zeroTrust.access.aiControls.mcp.servers.list({ ...params }) -> ServerListResponsesV4PagePaginationArray +- client.zeroTrust.access.aiControls.mcp.servers.delete(id, { ...params }) -> ServerDeleteResponse +- client.zeroTrust.access.aiControls.mcp.servers.read(id, { ...params }) -> ServerReadResponse +- client.zeroTrust.access.aiControls.mcp.servers.sync(id, { ...params }) -> ServerSyncResponse + ### GatewayCA Types: @@ -5578,21 +5745,13 @@ Methods: ### Cloudflared -Types: - -- CloudflaredCreateResponse -- CloudflaredListResponse -- CloudflaredDeleteResponse -- CloudflaredEditResponse -- CloudflaredGetResponse - Methods: -- client.zeroTrust.tunnels.cloudflared.create({ ...params }) -> CloudflaredCreateResponse -- client.zeroTrust.tunnels.cloudflared.list({ ...params }) -> CloudflaredListResponsesV4PagePaginationArray -- client.zeroTrust.tunnels.cloudflared.delete(tunnelId, { ...params }) -> CloudflaredDeleteResponse -- client.zeroTrust.tunnels.cloudflared.edit(tunnelId, { ...params }) -> CloudflaredEditResponse -- client.zeroTrust.tunnels.cloudflared.get(tunnelId, { ...params }) -> CloudflaredGetResponse +- client.zeroTrust.tunnels.cloudflared.create({ ...params }) -> CloudflareTunnel +- client.zeroTrust.tunnels.cloudflared.list({ ...params }) -> CloudflareTunnelsV4PagePaginationArray +- client.zeroTrust.tunnels.cloudflared.delete(tunnelId, { ...params }) -> CloudflareTunnel +- client.zeroTrust.tunnels.cloudflared.edit(tunnelId, { ...params }) -> CloudflareTunnel +- client.zeroTrust.tunnels.cloudflared.get(tunnelId, { ...params }) -> CloudflareTunnel #### Configurations @@ -5693,25 +5852,30 @@ Types: - Dataset - DatasetArray - DatasetCreation +- DatasetCreateResponse +- DatasetUpdateResponse +- DatasetGetResponse Methods: -- client.zeroTrust.dlp.datasets.create({ ...params }) -> DatasetCreation -- client.zeroTrust.dlp.datasets.update(datasetId, { ...params }) -> Dataset +- client.zeroTrust.dlp.datasets.create({ ...params }) -> DatasetCreateResponse +- client.zeroTrust.dlp.datasets.update(datasetId, { ...params }) -> DatasetUpdateResponse - client.zeroTrust.dlp.datasets.list({ ...params }) -> DatasetsSinglePage - client.zeroTrust.dlp.datasets.delete(datasetId, { ...params }) -> void -- client.zeroTrust.dlp.datasets.get(datasetId, { ...params }) -> Dataset +- client.zeroTrust.dlp.datasets.get(datasetId, { ...params }) -> DatasetGetResponse #### Upload Types: - NewVersion +- UploadCreateResponse +- UploadEditResponse Methods: -- client.zeroTrust.dlp.datasets.upload.create(datasetId, { ...params }) -> NewVersion -- client.zeroTrust.dlp.datasets.upload.edit(datasetId, version, dataset, { ...params }) -> Dataset +- client.zeroTrust.dlp.datasets.upload.create(datasetId, { ...params }) -> UploadCreateResponse +- client.zeroTrust.dlp.datasets.upload.edit(datasetId, version, dataset, { ...params }) -> UploadEditResponse #### Versions @@ -5796,11 +5960,12 @@ Types: - ContextAwareness - Profile - SkipConfiguration +- ProfileGetResponse Methods: - client.zeroTrust.dlp.profiles.list({ ...params }) -> ProfilesSinglePage -- client.zeroTrust.dlp.profiles.get(profileId, { ...params }) -> Profile +- client.zeroTrust.dlp.profiles.get(profileId, { ...params }) -> ProfileGetResponse #### Custom @@ -5808,28 +5973,32 @@ Types: - CustomProfile - Pattern +- CustomCreateResponse +- CustomUpdateResponse - CustomDeleteResponse +- CustomGetResponse Methods: -- client.zeroTrust.dlp.profiles.custom.create({ ...params }) -> Profile -- client.zeroTrust.dlp.profiles.custom.update(profileId, { ...params }) -> Profile +- client.zeroTrust.dlp.profiles.custom.create({ ...params }) -> CustomCreateResponse +- client.zeroTrust.dlp.profiles.custom.update(profileId, { ...params }) -> CustomUpdateResponse - client.zeroTrust.dlp.profiles.custom.delete(profileId, { ...params }) -> CustomDeleteResponse | null -- client.zeroTrust.dlp.profiles.custom.get(profileId, { ...params }) -> Profile +- client.zeroTrust.dlp.profiles.custom.get(profileId, { ...params }) -> CustomGetResponse #### Predefined Types: - PredefinedProfile +- PredefinedUpdateResponse - PredefinedDeleteResponse +- PredefinedGetResponse Methods: -- client.zeroTrust.dlp.profiles.predefined.create({ ...params }) -> Profile -- client.zeroTrust.dlp.profiles.predefined.update(profileId, { ...params }) -> Profile +- client.zeroTrust.dlp.profiles.predefined.update(profileId, { ...params }) -> PredefinedUpdateResponse - client.zeroTrust.dlp.profiles.predefined.delete(profileId, { ...params }) -> PredefinedDeleteResponse | null -- client.zeroTrust.dlp.profiles.predefined.get(profileId, { ...params }) -> Profile +- client.zeroTrust.dlp.profiles.predefined.get(profileId, { ...params }) -> PredefinedGetResponse ### Limits @@ -6061,10 +6230,10 @@ Types: Methods: - client.zeroTrust.gateway.proxyEndpoints.create({ ...params }) -> ProxyEndpoint -- client.zeroTrust.gateway.proxyEndpoints.list({ ...params }) -> ProxyEndpoint +- client.zeroTrust.gateway.proxyEndpoints.list({ ...params }) -> ProxyEndpointsSinglePage - client.zeroTrust.gateway.proxyEndpoints.delete(proxyEndpointId, { ...params }) -> ProxyEndpointDeleteResponse - client.zeroTrust.gateway.proxyEndpoints.edit(proxyEndpointId, { ...params }) -> ProxyEndpoint -- client.zeroTrust.gateway.proxyEndpoints.get(proxyEndpointId, { ...params }) -> ProxyEndpointsSinglePage +- client.zeroTrust.gateway.proxyEndpoints.get(proxyEndpointId, { ...params }) -> ProxyEndpoint ### Rules @@ -6085,6 +6254,7 @@ Methods: - client.zeroTrust.gateway.rules.list({ ...params }) -> GatewayRulesSinglePage - client.zeroTrust.gateway.rules.delete(ruleId, { ...params }) -> RuleDeleteResponse - client.zeroTrust.gateway.rules.get(ruleId, { ...params }) -> GatewayRule +- client.zeroTrust.gateway.rules.listTenant({ ...params }) -> GatewayRulesSinglePage - client.zeroTrust.gateway.rules.resetExpiration(ruleId, { ...params }) -> GatewayRule ### Certificates @@ -6268,6 +6438,27 @@ Methods: - client.turnstile.widgets.get(sitekey, { ...params }) -> Widget - client.turnstile.widgets.rotateSecret(sitekey, { ...params }) -> Widget +# Connectivity + +## Directory + +### Services + +Types: + +- ServiceCreateResponse +- ServiceUpdateResponse +- ServiceListResponse +- ServiceGetResponse + +Methods: + +- client.connectivity.directory.services.create({ ...params }) -> ServiceCreateResponse +- client.connectivity.directory.services.update(serviceId, { ...params }) -> ServiceUpdateResponse +- client.connectivity.directory.services.list({ ...params }) -> ServiceListResponsesV4PagePaginationArray +- client.connectivity.directory.services.delete(serviceId, { ...params }) -> void +- client.connectivity.directory.services.get(serviceId, { ...params }) -> ServiceGetResponse + # Hyperdrive Types: @@ -6427,6 +6618,16 @@ Methods: ### Inference +Types: + +- InferenceSummaryV2Response +- InferenceTimeseriesGroupsV2Response + +Methods: + +- client.radar.ai.inference.summaryV2(dimension, { ...params }) -> InferenceSummaryV2Response +- client.radar.ai.inference.timeseriesGroupsV2(dimension, { ...params }) -> InferenceTimeseriesGroupsV2Response + #### Summary Types: @@ -6455,6 +6656,18 @@ Methods: ### Bots +Types: + +- BotSummaryV2Response +- BotTimeseriesResponse +- BotTimeseriesGroupsResponse + +Methods: + +- client.radar.ai.bots.summaryV2(dimension, { ...params }) -> BotSummaryV2Response +- client.radar.ai.bots.timeseries({ ...params }) -> BotTimeseriesResponse +- client.radar.ai.bots.timeseriesGroups(dimension, { ...params }) -> BotTimeseriesGroupsResponse + #### Summary Types: @@ -6673,11 +6886,15 @@ Methods: Types: +- DNSSummaryV2Response - DNSTimeseriesResponse +- DNSTimeseriesGroupsV2Response Methods: +- client.radar.dns.summaryV2(dimension, { ...params }) -> DNSSummaryV2Response - client.radar.dns.timeseries({ ...params }) -> DNSTimeseriesResponse +- client.radar.dns.timeseriesGroupsV2(dimension, { ...params }) -> DNSTimeseriesGroupsV2Response ### Top @@ -6752,12 +6969,16 @@ Methods: Types: - NetflowSummaryResponse +- NetflowSummaryV2Response - NetflowTimeseriesResponse +- NetflowTimeseriesGroupsResponse Methods: - client.radar.netflows.summary({ ...params }) -> NetflowSummaryResponse +- client.radar.netflows.summaryV2(dimension, { ...params }) -> NetflowSummaryV2Response - client.radar.netflows.timeseries({ ...params }) -> NetflowTimeseriesResponse +- client.radar.netflows.timeseriesGroups(dimension, { ...params }) -> NetflowTimeseriesGroupsResponse ### Top @@ -6799,11 +7020,15 @@ Methods: Types: +- AS112SummaryV2Response - AS112TimeseriesResponse +- AS112TimeseriesGroupsV2Response Methods: +- client.radar.as112.summaryV2(dimension, { ...params }) -> AS112SummaryV2Response - client.radar.as112.timeseries({ ...params }) -> AS112TimeseriesResponse +- client.radar.as112.timeseriesGroupsV2(dimension, { ...params }) -> AS112TimeseriesGroupsV2Response ### Summary @@ -6870,6 +7095,16 @@ Types: ### Routing +Types: + +- RoutingSummaryV2Response +- RoutingTimeseriesGroupsV2Response + +Methods: + +- client.radar.email.routing.summaryV2(dimension, { ...params }) -> RoutingSummaryV2Response +- client.radar.email.routing.timeseriesGroupsV2(dimension, { ...params }) -> RoutingTimeseriesGroupsV2Response + #### Summary Types: @@ -6912,6 +7147,16 @@ Methods: ### Security +Types: + +- SecuritySummaryV2Response +- SecurityTimeseriesGroupsV2Response + +Methods: + +- client.radar.email.security.summaryV2(dimension, { ...params }) -> SecuritySummaryV2Response +- client.radar.email.security.timeseriesGroupsV2(dimension, { ...params }) -> SecurityTimeseriesGroupsV2Response + #### Top ##### Tlds @@ -7012,11 +7257,15 @@ Methods: Types: +- Layer3SummaryV2Response - Layer3TimeseriesResponse +- Layer3TimeseriesGroupsV2Response Methods: +- client.radar.attacks.layer3.summaryV2(dimension, { ...params }) -> Layer3SummaryV2Response - client.radar.attacks.layer3.timeseries({ ...params }) -> Layer3TimeseriesResponse +- client.radar.attacks.layer3.timeseriesGroupsV2(dimension, { ...params }) -> Layer3TimeseriesGroupsV2Response #### Summary @@ -7092,11 +7341,15 @@ Methods: Types: +- Layer7SummaryV2Response - Layer7TimeseriesResponse +- Layer7TimeseriesGroupsV2Response Methods: +- client.radar.attacks.layer7.summaryV2(dimension, { ...params }) -> Layer7SummaryV2Response - client.radar.attacks.layer7.timeseries({ ...params }) -> Layer7TimeseriesResponse +- client.radar.attacks.layer7.timeseriesGroupsV2(dimension, { ...params }) -> Layer7TimeseriesGroupsV2Response #### Summary @@ -7218,15 +7471,31 @@ Methods: - client.radar.entities.locations.list({ ...params }) -> LocationListResponse - client.radar.entities.locations.get(location, { ...params }) -> LocationGetResponse +## Geolocations + +Types: + +- GeolocationListResponse +- GeolocationGetResponse + +Methods: + +- client.radar.geolocations.list({ ...params }) -> GeolocationListResponse +- client.radar.geolocations.get(geoId, { ...params }) -> GeolocationGetResponse + ## HTTP Types: +- HTTPSummaryV2Response - HTTPTimeseriesResponse +- HTTPTimeseriesGroupsV2Response Methods: +- client.radar.http.summaryV2(dimension, { ...params }) -> HTTPSummaryV2Response - client.radar.http.timeseries({ ...params }) -> HTTPTimeseriesResponse +- client.radar.http.timeseriesGroupsV2(dimension, { ...params }) -> HTTPTimeseriesGroupsV2Response ### Locations @@ -7602,6 +7871,16 @@ Methods: ## LeakedCredentials +Types: + +- LeakedCredentialSummaryV2Response +- LeakedCredentialTimeseriesGroupsV2Response + +Methods: + +- client.radar.leakedCredentials.summaryV2(dimension, { ...params }) -> LeakedCredentialSummaryV2Response +- client.radar.leakedCredentials.timeseriesGroupsV2(dimension, { ...params }) -> LeakedCredentialTimeseriesGroupsV2Response + ### Summary Types: @@ -7851,6 +8130,8 @@ Methods: - client.snippets.rules.list({ ...params }) -> RuleListResponsesSinglePage - client.snippets.rules.delete({ ...params }) -> RuleDeleteResponsesSinglePage +# RealtimeKit + # Calls ## SFU @@ -8305,6 +8586,26 @@ Methods: - client.iam.userGroups.members.list(userGroupId, { ...params }) -> MemberListResponsesV4PagePaginationArray - client.iam.userGroups.members.delete(userGroupId, memberId, { ...params }) -> MemberDeleteResponse +## SSO + +Types: + +- SSOCreateResponse +- SSOUpdateResponse +- SSOListResponse +- SSODeleteResponse +- SSOBeginVerificationResponse +- SSOGetResponse + +Methods: + +- client.iam.sso.create({ ...params }) -> SSOCreateResponse +- client.iam.sso.update(ssoConnectorId, { ...params }) -> SSOUpdateResponse +- client.iam.sso.list({ ...params }) -> SSOListResponsesSinglePage +- client.iam.sso.delete(ssoConnectorId, { ...params }) -> SSODeleteResponse | null +- client.iam.sso.beginVerification(ssoConnectorId, { ...params }) -> SSOBeginVerificationResponse +- client.iam.sso.get(ssoConnectorId, { ...params }) -> SSOGetResponse + # CloudConnector ## Rules @@ -8497,6 +8798,7 @@ Types: - DetectionUpdateResponse - DetectionListResponse - DetectionDeleteResponse +- DetectionGetResponse Methods: @@ -8504,18 +8806,25 @@ Methods: - client.leakedCredentialChecks.detections.update(detectionId, { ...params }) -> DetectionUpdateResponse - client.leakedCredentialChecks.detections.list({ ...params }) -> DetectionListResponsesSinglePage - client.leakedCredentialChecks.detections.delete(detectionId, { ...params }) -> DetectionDeleteResponse +- client.leakedCredentialChecks.detections.get(detectionId, { ...params }) -> DetectionGetResponse # ContentScanning Types: +- ContentScanningCreateResponse +- ContentScanningUpdateResponse - ContentScanningDisableResponse - ContentScanningEnableResponse +- ContentScanningGetResponse Methods: +- client.contentScanning.create({ ...params }) -> ContentScanningCreateResponse +- client.contentScanning.update({ ...params }) -> ContentScanningUpdateResponse - client.contentScanning.disable({ ...params }) -> ContentScanningDisableResponse - client.contentScanning.enable({ ...params }) -> ContentScanningEnableResponse +- client.contentScanning.get({ ...params }) -> ContentScanningGetResponse ## Payloads @@ -8545,11 +8854,27 @@ Methods: Types: -- AbuseReportCreateResponse +- AbuseReportCreateResponse +- AbuseReportListResponse +- AbuseReportGetResponse + +Methods: + +- client.abuseReports.create(reportParam, { ...params }) -> AbuseReportCreateResponse +- client.abuseReports.list({ ...params }) -> AbuseReportListResponsesV4PagePagination +- client.abuseReports.get(reportParam, { ...params }) -> AbuseReportGetResponse + +## Mitigations + +Types: + +- MitigationListResponse +- MitigationReviewResponse Methods: -- client.abuseReports.create(reportType, { ...params }) -> AbuseReportCreateResponse +- client.abuseReports.mitigations.list(reportId, { ...params }) -> MitigationListResponsesV4PagePagination +- client.abuseReports.mitigations.review(reportId, { ...params }) -> MitigationReviewResponsesSinglePage # AI @@ -8637,12 +8962,82 @@ Methods: Types: +- ToMarkdownSupportedResponse - ToMarkdownTransformResponse Methods: +- client.ai.toMarkdown.supported({ ...params }) -> ToMarkdownSupportedResponsesSinglePage - client.ai.toMarkdown.transform(file, { ...params }) -> ToMarkdownTransformResponsesSinglePage +# AISearch + +## Instances + +Types: + +- InstanceCreateResponse +- InstanceUpdateResponse +- InstanceListResponse +- InstanceDeleteResponse +- InstanceReadResponse +- InstanceStatsResponse + +Methods: + +- client.aiSearch.instances.create({ ...params }) -> InstanceCreateResponse +- client.aiSearch.instances.update(id, { ...params }) -> InstanceUpdateResponse +- client.aiSearch.instances.list({ ...params }) -> InstanceListResponsesV4PagePaginationArray +- client.aiSearch.instances.delete(id, { ...params }) -> InstanceDeleteResponse +- client.aiSearch.instances.read(id, { ...params }) -> InstanceReadResponse +- client.aiSearch.instances.stats(id, { ...params }) -> InstanceStatsResponse + +### Items + +Types: + +- ItemListResponse +- ItemGetResponse + +Methods: + +- client.aiSearch.instances.items.list(id, { ...params }) -> ItemListResponsesV4PagePaginationArray +- client.aiSearch.instances.items.get(id, itemId, { ...params }) -> ItemGetResponse + +### Jobs + +Types: + +- JobCreateResponse +- JobListResponse +- JobGetResponse +- JobLogsResponse + +Methods: + +- client.aiSearch.instances.jobs.create(id, { ...params }) -> JobCreateResponse +- client.aiSearch.instances.jobs.list(id, { ...params }) -> JobListResponsesV4PagePaginationArray +- client.aiSearch.instances.jobs.get(id, jobId, { ...params }) -> JobGetResponse +- client.aiSearch.instances.jobs.logs(id, jobId, { ...params }) -> JobLogsResponse + +## Tokens + +Types: + +- TokenCreateResponse +- TokenUpdateResponse +- TokenListResponse +- TokenDeleteResponse +- TokenReadResponse + +Methods: + +- client.aiSearch.tokens.create({ ...params }) -> TokenCreateResponse +- client.aiSearch.tokens.update(id, { ...params }) -> TokenUpdateResponse +- client.aiSearch.tokens.list({ ...params }) -> TokenListResponsesV4PagePaginationArray +- client.aiSearch.tokens.delete(id, { ...params }) -> TokenDeleteResponse +- client.aiSearch.tokens.read(id, { ...params }) -> TokenReadResponse + # SecurityCenter ## Insights @@ -8831,18 +9226,59 @@ Methods: Types: -- PipelineCreateResponse -- PipelineUpdateResponse -- PipelineListResponse -- PipelineGetResponse +- PipelineCreateResponse +- PipelineUpdateResponse +- PipelineListResponse +- PipelineCreateV1Response +- PipelineGetResponse +- PipelineGetV1Response +- PipelineListV1Response +- PipelineValidateSqlResponse Methods: -- client.pipelines.create({ ...params }) -> PipelineCreateResponse -- client.pipelines.update(pipelineName, { ...params }) -> PipelineUpdateResponse -- client.pipelines.list({ ...params }) -> PipelineListResponse -- client.pipelines.delete(pipelineName, { ...params }) -> void -- client.pipelines.get(pipelineName, { ...params }) -> PipelineGetResponse +- client.pipelines.create({ ...params }) -> PipelineCreateResponse +- client.pipelines.update(pipelineName, { ...params }) -> PipelineUpdateResponse +- client.pipelines.list({ ...params }) -> PipelineListResponse +- client.pipelines.delete(pipelineName, { ...params }) -> void +- client.pipelines.createV1({ ...params }) -> PipelineCreateV1Response +- client.pipelines.deleteV1(pipelineId, { ...params }) -> void +- client.pipelines.get(pipelineName, { ...params }) -> PipelineGetResponse +- client.pipelines.getV1(pipelineId, { ...params }) -> PipelineGetV1Response +- client.pipelines.listV1({ ...params }) -> PipelineListV1ResponsesV4PagePaginationArray +- client.pipelines.validateSql({ ...params }) -> PipelineValidateSqlResponse + +## Sinks + +Types: + +- SinkCreateResponse +- SinkListResponse +- SinkGetResponse + +Methods: + +- client.pipelines.sinks.create({ ...params }) -> SinkCreateResponse +- client.pipelines.sinks.list({ ...params }) -> SinkListResponsesV4PagePaginationArray +- client.pipelines.sinks.delete(sinkId, { ...params }) -> void +- client.pipelines.sinks.get(sinkId, { ...params }) -> SinkGetResponse + +## Streams + +Types: + +- StreamCreateResponse +- StreamUpdateResponse +- StreamListResponse +- StreamGetResponse + +Methods: + +- client.pipelines.streams.create({ ...params }) -> StreamCreateResponse +- client.pipelines.streams.update(streamId, { ...params }) -> StreamUpdateResponse +- client.pipelines.streams.list({ ...params }) -> StreamListResponsesV4PagePaginationArray +- client.pipelines.streams.delete(streamId, { ...params }) -> void +- client.pipelines.streams.get(streamId, { ...params }) -> StreamGetResponse # SchemaValidation @@ -8850,19 +9286,16 @@ Methods: Types: -- SchemaCreateResponse -- SchemaListResponse +- PublicSchema - SchemaDeleteResponse -- SchemaEditResponse -- SchemaGetResponse Methods: -- client.schemaValidation.schemas.create({ ...params }) -> SchemaCreateResponse -- client.schemaValidation.schemas.list({ ...params }) -> SchemaListResponsesV4PagePaginationArray +- client.schemaValidation.schemas.create({ ...params }) -> PublicSchema +- client.schemaValidation.schemas.list({ ...params }) -> PublicSchemasV4PagePaginationArray - client.schemaValidation.schemas.delete(schemaId, { ...params }) -> SchemaDeleteResponse -- client.schemaValidation.schemas.edit(schemaId, { ...params }) -> SchemaEditResponse -- client.schemaValidation.schemas.get(schemaId, { ...params }) -> SchemaGetResponse +- client.schemaValidation.schemas.edit(schemaId, { ...params }) -> PublicSchema +- client.schemaValidation.schemas.get(schemaId, { ...params }) -> PublicSchema ## Settings @@ -8895,3 +9328,48 @@ Methods: - client.schemaValidation.settings.operations.delete(operationId, { ...params }) -> OperationDeleteResponse - client.schemaValidation.settings.operations.bulkEdit({ ...params }) -> OperationBulkEditResponse - client.schemaValidation.settings.operations.get(operationId, { ...params }) -> OperationGetResponse + +# TokenValidation + +## Configuration + +Types: + +- TokenConfig +- ConfigurationDeleteResponse +- ConfigurationEditResponse + +Methods: + +- client.tokenValidation.configuration.create({ ...params }) -> TokenConfig +- client.tokenValidation.configuration.list({ ...params }) -> TokenConfigsV4PagePaginationArray +- client.tokenValidation.configuration.delete(configId, { ...params }) -> ConfigurationDeleteResponse +- client.tokenValidation.configuration.edit(configId, { ...params }) -> ConfigurationEditResponse +- client.tokenValidation.configuration.get(configId, { ...params }) -> TokenConfig + +### Credentials + +Types: + +- CredentialUpdateResponse + +Methods: + +- client.tokenValidation.configuration.credentials.update(configId, { ...params }) -> CredentialUpdateResponse + +## Rules + +Types: + +- TokenValidationRule +- RuleDeleteResponse + +Methods: + +- client.tokenValidation.rules.create({ ...params }) -> TokenValidationRule +- client.tokenValidation.rules.list({ ...params }) -> TokenValidationRulesV4PagePaginationArray +- client.tokenValidation.rules.delete(ruleId, { ...params }) -> RuleDeleteResponse +- client.tokenValidation.rules.bulkCreate([ ...body ]) -> TokenValidationRulesSinglePage +- client.tokenValidation.rules.bulkEdit([ ...body ]) -> TokenValidationRulesSinglePage +- client.tokenValidation.rules.edit(ruleId, { ...params }) -> TokenValidationRule +- client.tokenValidation.rules.get(ruleId, { ...params }) -> TokenValidationRule diff --git a/scripts/detect-breaking-changes b/scripts/detect-breaking-changes index 4580a22d2d..7b995bd05c 100755 --- a/scripts/detect-breaking-changes +++ b/scripts/detect-breaking-changes @@ -16,6 +16,8 @@ TEST_PATHS=( tests/api-resources/accounts/tokens/value.test.ts tests/api-resources/accounts/logs/logs.test.ts tests/api-resources/accounts/logs/audit.test.ts + tests/api-resources/organizations/organizations.test.ts + tests/api-resources/organizations/organization-profile.test.ts tests/api-resources/origin-ca-certificates.test.ts tests/api-resources/ips.test.ts tests/api-resources/memberships.test.ts @@ -369,6 +371,7 @@ TEST_PATHS=( tests/api-resources/alerting/destinations/webhooks.test.ts tests/api-resources/alerting/history.test.ts tests/api-resources/alerting/policies.test.ts + tests/api-resources/alerting/silences.test.ts tests/api-resources/d1/d1.test.ts tests/api-resources/d1/database.test.ts tests/api-resources/r2/r2.test.ts @@ -387,6 +390,12 @@ TEST_PATHS=( tests/api-resources/r2/super-slurper/jobs/jobs.test.ts tests/api-resources/r2/super-slurper/jobs/logs.test.ts tests/api-resources/r2/super-slurper/connectivity-precheck.test.ts + tests/api-resources/r2-data-catalog/r2-data-catalog.test.ts + tests/api-resources/r2-data-catalog/maintenance-configs.test.ts + tests/api-resources/r2-data-catalog/credentials.test.ts + tests/api-resources/r2-data-catalog/namespaces/namespaces.test.ts + tests/api-resources/r2-data-catalog/namespaces/tables/tables.test.ts + tests/api-resources/r2-data-catalog/namespaces/tables/maintenance-configs.test.ts tests/api-resources/workers-for-platforms/workers-for-platforms.test.ts tests/api-resources/workers-for-platforms/dispatch/dispatch.test.ts tests/api-resources/workers-for-platforms/dispatch/namespaces/namespaces.test.ts @@ -430,6 +439,10 @@ TEST_PATHS=( tests/api-resources/zero-trust/organizations/doh.test.ts tests/api-resources/zero-trust/seats.test.ts tests/api-resources/zero-trust/access/access.test.ts + tests/api-resources/zero-trust/access/ai-controls/ai-controls.test.ts + tests/api-resources/zero-trust/access/ai-controls/mcp/mcp.test.ts + tests/api-resources/zero-trust/access/ai-controls/mcp/portals.test.ts + tests/api-resources/zero-trust/access/ai-controls/mcp/servers.test.ts tests/api-resources/zero-trust/access/gateway-ca.test.ts tests/api-resources/zero-trust/access/infrastructure/infrastructure.test.ts tests/api-resources/zero-trust/access/infrastructure/targets.test.ts @@ -529,6 +542,9 @@ TEST_PATHS=( tests/api-resources/zero-trust/risk-scoring/integrations/references.test.ts tests/api-resources/turnstile/turnstile.test.ts tests/api-resources/turnstile/widgets.test.ts + tests/api-resources/connectivity/connectivity.test.ts + tests/api-resources/connectivity/directory/directory.test.ts + tests/api-resources/connectivity/directory/services.test.ts tests/api-resources/hyperdrive/hyperdrive.test.ts tests/api-resources/hyperdrive/configs.test.ts tests/api-resources/rum/rum.test.ts @@ -607,6 +623,7 @@ TEST_PATHS=( tests/api-resources/radar/entities/entities.test.ts tests/api-resources/radar/entities/asns.test.ts tests/api-resources/radar/entities/locations.test.ts + tests/api-resources/radar/geolocations.test.ts tests/api-resources/radar/http/http.test.ts tests/api-resources/radar/http/locations/locations.test.ts tests/api-resources/radar/http/locations/bot-class.test.ts @@ -701,6 +718,7 @@ TEST_PATHS=( tests/api-resources/iam/resource-groups.test.ts tests/api-resources/iam/user-groups/user-groups.test.ts tests/api-resources/iam/user-groups/members.test.ts + tests/api-resources/iam/sso.test.ts tests/api-resources/cloud-connector/cloud-connector.test.ts tests/api-resources/cloud-connector/rules.test.ts tests/api-resources/botnet-feed/botnet-feed.test.ts @@ -721,7 +739,8 @@ TEST_PATHS=( tests/api-resources/content-scanning/content-scanning.test.ts tests/api-resources/content-scanning/payloads.test.ts tests/api-resources/content-scanning/settings.test.ts - tests/api-resources/abuse-reports.test.ts + tests/api-resources/abuse-reports/abuse-reports.test.ts + tests/api-resources/abuse-reports/mitigations.test.ts tests/api-resources/ai/ai.test.ts tests/api-resources/ai/finetunes/finetunes.test.ts tests/api-resources/ai/finetunes/assets.test.ts @@ -731,6 +750,11 @@ TEST_PATHS=( tests/api-resources/ai/models/models.test.ts tests/api-resources/ai/models/schema.test.ts tests/api-resources/ai/to-markdown.test.ts + tests/api-resources/aisearch/aisearch.test.ts + tests/api-resources/aisearch/instances/instances.test.ts + tests/api-resources/aisearch/instances/items.test.ts + tests/api-resources/aisearch/instances/jobs.test.ts + tests/api-resources/aisearch/tokens.test.ts tests/api-resources/security-center/security-center.test.ts tests/api-resources/security-center/insights/insights.test.ts tests/api-resources/security-center/insights/class.test.ts @@ -750,11 +774,17 @@ TEST_PATHS=( tests/api-resources/secrets-store/stores/stores.test.ts tests/api-resources/secrets-store/stores/secrets.test.ts tests/api-resources/secrets-store/quota.test.ts - tests/api-resources/pipelines.test.ts + tests/api-resources/pipelines/pipelines.test.ts + tests/api-resources/pipelines/sinks.test.ts + tests/api-resources/pipelines/streams.test.ts tests/api-resources/schema-validation/schema-validation.test.ts tests/api-resources/schema-validation/schemas.test.ts tests/api-resources/schema-validation/settings/settings.test.ts tests/api-resources/schema-validation/settings/operations.test.ts + tests/api-resources/token-validation/token-validation.test.ts + tests/api-resources/token-validation/configuration/configuration.test.ts + tests/api-resources/token-validation/configuration/credentials.test.ts + tests/api-resources/token-validation/rules.test.ts tests/index.test.ts ) diff --git a/scripts/utils/upload-artifact.sh b/scripts/utils/upload-artifact.sh index 37da0aeda5..b228a8dec5 100755 --- a/scripts/utils/upload-artifact.sh +++ b/scripts/utils/upload-artifact.sh @@ -12,9 +12,11 @@ if [[ "$SIGNED_URL" == "null" ]]; then exit 1 fi -UPLOAD_RESPONSE=$(tar "${BASE_PATH:+-C$BASE_PATH}" -cz "${ARTIFACT_PATH:-dist}" | curl -v -X PUT \ +TARBALL=$(cd dist && npm pack --silent) + +UPLOAD_RESPONSE=$(curl -v -X PUT \ -H "Content-Type: application/gzip" \ - --data-binary @- "$SIGNED_URL" 2>&1) + --data-binary "@dist/$TARBALL" "$SIGNED_URL" 2>&1) if echo "$UPLOAD_RESPONSE" | grep -q "HTTP/[0-9.]* 200"; then echo -e "\033[32mUploaded build to Stainless storage.\033[0m" diff --git a/src/index.ts b/src/index.ts index e95a62b7e6..2a087d65fb 100644 --- a/src/index.ts +++ b/src/index.ts @@ -20,7 +20,6 @@ import { } from './pagination'; import * as Uploads from './uploads'; import * as API from './resources/index'; -import { AbuseReports } from './resources/abuse-reports'; import { AuditLogs } from './resources/audit-logs'; import { BotManagement } from './resources/bot-management'; import { ClientCertificates } from './resources/client-certificates'; @@ -35,15 +34,17 @@ import { Memberships } from './resources/memberships'; import { OriginCACertificates } from './resources/origin-ca-certificates'; import { OriginPostQuantumEncryption } from './resources/origin-post-quantum-encryption'; import { PageRules } from './resources/page-rules'; -import { Pipelines } from './resources/pipelines'; import { RateLimits } from './resources/rate-limits'; +import { RealtimeKit } from './resources/realtime-kit'; import { SecurityTXT } from './resources/security-txt'; import { URLNormalization } from './resources/url-normalization'; +import { AbuseReports } from './resources/abuse-reports/abuse-reports'; import { Accounts } from './resources/accounts/accounts'; import { ACM } from './resources/acm/acm'; import { Addressing } from './resources/addressing/addressing'; import { AIGateway } from './resources/ai-gateway/ai-gateway'; import { AI } from './resources/ai/ai'; +import { AISearch } from './resources/aisearch/aisearch'; import { Alerting } from './resources/alerting/alerting'; import { APIGateway } from './resources/api-gateway/api-gateway'; import { Argo } from './resources/argo/argo'; @@ -56,6 +57,7 @@ import { Calls } from './resources/calls/calls'; import { CertificateAuthorities } from './resources/certificate-authorities/certificate-authorities'; import { CloudConnector } from './resources/cloud-connector/cloud-connector'; import { CloudforceOne } from './resources/cloudforce-one/cloudforce-one'; +import { Connectivity } from './resources/connectivity/connectivity'; import { ContentScanning } from './resources/content-scanning/content-scanning'; import { CustomCertificates } from './resources/custom-certificates/custom-certificates'; import { CustomHostnames } from './resources/custom-hostnames/custom-hostnames'; @@ -83,10 +85,13 @@ import { MagicNetworkMonitoring } from './resources/magic-network-monitoring/mag import { MagicTransit } from './resources/magic-transit/magic-transit'; import { MTLSCertificates } from './resources/mtls-certificates/mtls-certificates'; import { NetworkInterconnects } from './resources/network-interconnects/network-interconnects'; +import { Organizations } from './resources/organizations/organizations'; import { OriginTLSClientAuth } from './resources/origin-tls-client-auth/origin-tls-client-auth'; import { PageShield } from './resources/page-shield/page-shield'; import { Pages } from './resources/pages/pages'; +import { Pipelines } from './resources/pipelines/pipelines'; import { Queues } from './resources/queues/queues'; +import { R2DataCatalog } from './resources/r2-data-catalog/r2-data-catalog'; import { R2 } from './resources/r2/r2'; import { Radar } from './resources/radar/radar'; import { Registrar } from './resources/registrar/registrar'; @@ -103,6 +108,7 @@ import { Spectrum } from './resources/spectrum/spectrum'; import { Speed } from './resources/speed/speed'; import { SSL } from './resources/ssl/ssl'; import { Stream } from './resources/stream/stream'; +import { TokenValidation } from './resources/token-validation/token-validation'; import { Turnstile } from './resources/turnstile/turnstile'; import { URLScanner } from './resources/url-scanner/url-scanner'; import { User } from './resources/user/user'; @@ -266,6 +272,7 @@ export class Cloudflare extends Core.APIClient { } accounts: API.Accounts = new API.Accounts(this); + organizations: API.Organizations = new API.Organizations(this); originCACertificates: API.OriginCACertificates = new API.OriginCACertificates(this); ips: API.IPs = new API.IPs(this); memberships: API.Memberships = new API.Memberships(this); @@ -326,9 +333,11 @@ export class Cloudflare extends Core.APIClient { alerting: API.Alerting = new API.Alerting(this); d1: API.D1Resource = new API.D1Resource(this); r2: API.R2 = new API.R2(this); + r2DataCatalog: API.R2DataCatalog = new API.R2DataCatalog(this); workersForPlatforms: API.WorkersForPlatforms = new API.WorkersForPlatforms(this); zeroTrust: API.ZeroTrust = new API.ZeroTrust(this); turnstile: API.Turnstile = new API.Turnstile(this); + connectivity: API.Connectivity = new API.Connectivity(this); hyperdrive: API.HyperdriveResource = new API.HyperdriveResource(this); rum: API.RUM = new API.RUM(this); vectorize: API.Vectorize = new API.Vectorize(this); @@ -341,6 +350,7 @@ export class Cloudflare extends Core.APIClient { dcvDelegation: API.DCVDelegation = new API.DCVDelegation(this); hostnames: API.Hostnames = new API.Hostnames(this); snippets: API.Snippets = new API.Snippets(this); + realtimeKit: API.RealtimeKit = new API.RealtimeKit(this); calls: API.Calls = new API.Calls(this); cloudforceOne: API.CloudforceOne = new API.CloudforceOne(this); aiGateway: API.AIGateway = new API.AIGateway(this); @@ -354,12 +364,14 @@ export class Cloudflare extends Core.APIClient { contentScanning: API.ContentScanning = new API.ContentScanning(this); abuseReports: API.AbuseReports = new API.AbuseReports(this); ai: API.AI = new API.AI(this); + aiSearch: API.AISearch = new API.AISearch(this); securityCenter: API.SecurityCenter = new API.SecurityCenter(this); browserRendering: API.BrowserRendering = new API.BrowserRendering(this); customPages: API.CustomPages = new API.CustomPages(this); secretsStore: API.SecretsStore = new API.SecretsStore(this); pipelines: API.Pipelines = new API.Pipelines(this); schemaValidation: API.SchemaValidation = new API.SchemaValidation(this); + tokenValidation: API.TokenValidation = new API.TokenValidation(this); /** * Check whether the base URL is set to its default. @@ -503,6 +515,7 @@ export class Cloudflare extends Core.APIClient { } Cloudflare.Accounts = Accounts; +Cloudflare.Organizations = Organizations; Cloudflare.OriginCACertificates = OriginCACertificates; Cloudflare.IPs = IPs; Cloudflare.Memberships = Memberships; @@ -563,9 +576,11 @@ Cloudflare.Stream = Stream; Cloudflare.Alerting = Alerting; Cloudflare.D1Resource = D1Resource; Cloudflare.R2 = R2; +Cloudflare.R2DataCatalog = R2DataCatalog; Cloudflare.WorkersForPlatforms = WorkersForPlatforms; Cloudflare.ZeroTrust = ZeroTrust; Cloudflare.Turnstile = Turnstile; +Cloudflare.Connectivity = Connectivity; Cloudflare.HyperdriveResource = HyperdriveResource; Cloudflare.RUM = RUM; Cloudflare.Vectorize = Vectorize; @@ -578,6 +593,7 @@ Cloudflare.Speed = Speed; Cloudflare.DCVDelegation = DCVDelegation; Cloudflare.Hostnames = Hostnames; Cloudflare.Snippets = Snippets; +Cloudflare.RealtimeKit = RealtimeKit; Cloudflare.Calls = Calls; Cloudflare.CloudforceOne = CloudforceOne; Cloudflare.AIGateway = AIGateway; @@ -591,12 +607,14 @@ Cloudflare.LeakedCredentialChecks = LeakedCredentialChecks; Cloudflare.ContentScanning = ContentScanning; Cloudflare.AbuseReports = AbuseReports; Cloudflare.AI = AI; +Cloudflare.AISearch = AISearch; Cloudflare.SecurityCenter = SecurityCenter; Cloudflare.BrowserRendering = BrowserRendering; Cloudflare.CustomPages = CustomPages; Cloudflare.SecretsStore = SecretsStore; Cloudflare.Pipelines = Pipelines; Cloudflare.SchemaValidation = SchemaValidation; +Cloudflare.TokenValidation = TokenValidation; export declare namespace Cloudflare { export type RequestOptions = Core.RequestOptions; @@ -636,6 +654,8 @@ export declare namespace Cloudflare { export { Accounts as Accounts }; + export { Organizations as Organizations }; + export { OriginCACertificates as OriginCACertificates }; export { IPs as IPs }; @@ -756,12 +776,16 @@ export declare namespace Cloudflare { export { R2 as R2 }; + export { R2DataCatalog as R2DataCatalog }; + export { WorkersForPlatforms as WorkersForPlatforms }; export { ZeroTrust as ZeroTrust }; export { Turnstile as Turnstile }; + export { Connectivity as Connectivity }; + export { HyperdriveResource as HyperdriveResource }; export { RUM as RUM }; @@ -786,6 +810,8 @@ export declare namespace Cloudflare { export { Snippets as Snippets }; + export { RealtimeKit as RealtimeKit }; + export { Calls as Calls }; export { CloudforceOne as CloudforceOne }; @@ -812,6 +838,8 @@ export declare namespace Cloudflare { export { AI as AI }; + export { AISearch as AISearch }; + export { SecurityCenter as SecurityCenter }; export { BrowserRendering as BrowserRendering }; @@ -824,6 +852,8 @@ export declare namespace Cloudflare { export { SchemaValidation as SchemaValidation }; + export { TokenValidation as TokenValidation }; + export type ASN = API.ASN; export type AuditLog = API.AuditLog; export type CertificateCA = API.CertificateCA; diff --git a/src/resources/abuse-reports.ts b/src/resources/abuse-reports.ts index 451e42c504..d99f32381a 100644 --- a/src/resources/abuse-reports.ts +++ b/src/resources/abuse-reports.ts @@ -1,889 +1,3 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { APIResource } from '../resource'; -import * as Core from '../core'; - -export class AbuseReports extends APIResource { - /** - * Submit the Abuse Report of a particular type - */ - create( - reportType: string, - params: AbuseReportCreateParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - const { account_id, ...body } = params; - return ( - this._client.post(`/accounts/${account_id}/abuse-reports/${reportType}`, { - body, - ...options, - }) as Core.APIPromise<{ result: AbuseReportCreateResponse }> - )._thenUnwrap((obj) => obj.result); - } -} - -/** - * The result should be 'success' for successful response - */ -export type AbuseReportCreateResponse = string; - -export type AbuseReportCreateParams = - | AbuseReportCreateParams.AbuseReportsDmcaReport - | AbuseReportCreateParams.AbuseReportsTrademarkReport - | AbuseReportCreateParams.AbuseReportsGeneralReport - | AbuseReportCreateParams.AbuseReportsPhishingReport - | AbuseReportCreateParams.AbuseReportsCsamReport - | AbuseReportCreateParams.AbuseReportsThreatReport - | AbuseReportCreateParams.AbuseReportsRegistrarWhoisReport - | AbuseReportCreateParams.AbuseReportsNcseiReport; - -export declare namespace AbuseReportCreateParams { - export interface AbuseReportsDmcaReport { - /** - * Path param: The account ID of the submitter. - */ - account_id: string; - - /** - * Body param: The abuse report type. - */ - act: 'abuse_dmca'; - - /** - * Body param: Text not exceeding 100 characters. This field may be released by - * Cloudflare to third parties such as the Lumen Database - * (https://lumendatabase.org/). - */ - address1: string; - - /** - * Body param: The name of the copyright holder. Text not exceeding 60 characters. - * This field may be released by Cloudflare to third parties such as the Lumen - * Database (https://lumendatabase.org/). - */ - agent_name: string; - - /** - * Body param: Can be `0` for false or `1` for true. Must be value: 1 for DMCA - * reports - */ - agree: 1; - - /** - * Body param: Text not exceeding 255 characters. This field may be released by - * Cloudflare to third parties such as the Lumen Database - * (https://lumendatabase.org/). - */ - city: string; - - /** - * Body param: Text not exceeding 255 characters. This field may be released by - * Cloudflare to third parties such as the Lumen Database - * (https://lumendatabase.org/). - */ - country: string; - - /** - * Body param: A valid email of the abuse reporter. This field may be released by - * Cloudflare to third parties such as the Lumen Database - * (https://lumendatabase.org/). - */ - email: string; - - /** - * Body param: Should match the value provided in `email` - */ - email2: string; - - /** - * Body param: Notification type based on the abuse type. NOTE: Copyright (DMCA) - * and Trademark reports cannot be anonymous. - */ - host_notification: 'send'; - - /** - * Body param: Text not exceeding 255 characters. This field may be released by - * Cloudflare to third parties such as the Lumen Database - * (https://lumendatabase.org/). - */ - name: string; - - /** - * Body param: Text not exceeding 255 characters. This field may be released by - * Cloudflare to third parties such as the Lumen Database - * (https://lumendatabase.org/). - */ - original_work: string; - - /** - * Body param: Notification type based on the abuse type. NOTE: Copyright (DMCA) - * and Trademark reports cannot be anonymous. - */ - owner_notification: 'send'; - - /** - * Body param: Required for DMCA reports, should be same as Name. An affirmation - * that all information in the report is true and accurate while agreeing to the - * policies of Cloudflare's abuse reports - */ - signature: string; - - /** - * Body param: Text not exceeding 255 characters. This field may be released by - * Cloudflare to third parties such as the Lumen Database - * (https://lumendatabase.org/). - */ - state: string; - - /** - * Body param: A list of valid URLs separated by ‘\n’ (new line character). The - * list of the URLs should not exceed 250 URLs. All URLs should have the same - * hostname. Each URL should be unique. This field may be released by Cloudflare to - * third parties such as the Lumen Database (https://lumendatabase.org/). - */ - urls: string; - - /** - * Body param: Any additional comments about the infringement not exceeding 2000 - * characters - */ - comments?: string; - - /** - * Body param: Text not exceeding 100 characters. This field may be released by - * Cloudflare to third parties such as the Lumen Database - * (https://lumendatabase.org/). - */ - company?: string; - - /** - * Body param: Text containing 2 characters - */ - reported_country?: string; - - /** - * Body param: Text not exceeding 255 characters - */ - reported_user_agent?: string; - - /** - * Body param: Text not exceeding 20 characters. This field may be released by - * Cloudflare to third parties such as the Lumen Database - * (https://lumendatabase.org/). - */ - tele?: string; - - /** - * Body param: Text not exceeding 255 characters - */ - title?: string; - } - - export interface AbuseReportsTrademarkReport { - /** - * Path param: The account ID of the submitter. - */ - account_id: string; - - /** - * Body param: The abuse report type. - */ - act: 'abuse_trademark'; - - /** - * Body param: A valid email of the abuse reporter. This field may be released by - * Cloudflare to third parties such as the Lumen Database - * (https://lumendatabase.org/). - */ - email: string; - - /** - * Body param: Should match the value provided in `email` - */ - email2: string; - - /** - * Body param: Notification type based on the abuse type. NOTE: Copyright (DMCA) - * and Trademark reports cannot be anonymous. - */ - host_notification: 'send'; - - /** - * Body param: A detailed description of the infringement, including any necessary - * access details and the exact steps needed to view the content, not exceeding - * 5000 characters. - */ - justification: string; - - /** - * Body param: Text not exceeding 255 characters. This field may be released by - * Cloudflare to third parties such as the Lumen Database - * (https://lumendatabase.org/). - */ - name: string; - - /** - * Body param: Notification type based on the abuse type. NOTE: Copyright (DMCA) - * and Trademark reports cannot be anonymous. - */ - owner_notification: 'send'; - - /** - * Body param: Text not exceeding 1000 characters - */ - trademark_number: string; - - /** - * Body param: Text not exceeding 1000 characters - */ - trademark_office: string; - - /** - * Body param: Text not exceeding 1000 characters - */ - trademark_symbol: string; - - /** - * Body param: A list of valid URLs separated by ‘\n’ (new line character). The - * list of the URLs should not exceed 250 URLs. All URLs should have the same - * hostname. Each URL should be unique. This field may be released by Cloudflare to - * third parties such as the Lumen Database (https://lumendatabase.org/). - */ - urls: string; - - /** - * Body param: Any additional comments about the infringement not exceeding 2000 - * characters - */ - comments?: string; - - /** - * Body param: Text not exceeding 100 characters. This field may be released by - * Cloudflare to third parties such as the Lumen Database - * (https://lumendatabase.org/). - */ - company?: string; - - /** - * Body param: Text containing 2 characters - */ - reported_country?: string; - - /** - * Body param: Text not exceeding 255 characters - */ - reported_user_agent?: string; - - /** - * Body param: Text not exceeding 20 characters. This field may be released by - * Cloudflare to third parties such as the Lumen Database - * (https://lumendatabase.org/). - */ - tele?: string; - - /** - * Body param: Text not exceeding 255 characters - */ - title?: string; - } - - export interface AbuseReportsGeneralReport { - /** - * Path param: The account ID of the submitter. - */ - account_id: string; - - /** - * Body param: The abuse report type. - */ - act: 'abuse_general'; - - /** - * Body param: A valid email of the abuse reporter. This field may be released by - * Cloudflare to third parties such as the Lumen Database - * (https://lumendatabase.org/). - */ - email: string; - - /** - * Body param: Should match the value provided in `email` - */ - email2: string; - - /** - * Body param: Notification type based on the abuse type. NOTE: Copyright (DMCA) - * and Trademark reports cannot be anonymous. - */ - host_notification: 'send' | 'send-anon'; - - /** - * Body param: A detailed description of the infringement, including any necessary - * access details and the exact steps needed to view the content, not exceeding - * 5000 characters. - */ - justification: string; - - /** - * Body param: Text not exceeding 255 characters. This field may be released by - * Cloudflare to third parties such as the Lumen Database - * (https://lumendatabase.org/). - */ - name: string; - - /** - * Body param: Notification type based on the abuse type. NOTE: Copyright (DMCA) - * and Trademark reports cannot be anonymous. - */ - owner_notification: 'send' | 'send-anon' | 'none'; - - /** - * Body param: A list of valid URLs separated by ‘\n’ (new line character). The - * list of the URLs should not exceed 250 URLs. All URLs should have the same - * hostname. Each URL should be unique. This field may be released by Cloudflare to - * third parties such as the Lumen Database (https://lumendatabase.org/). - */ - urls: string; - - /** - * Body param: Any additional comments about the infringement not exceeding 2000 - * characters - */ - comments?: string; - - /** - * Body param: Text not exceeding 100 characters. This field may be released by - * Cloudflare to third parties such as the Lumen Database - * (https://lumendatabase.org/). - */ - company?: string; - - /** - * Body param: A list of IP addresses separated by ‘\n’ (new line character). The - * list of destination IPs should not exceed 30 IP addresses. Each one of the IP - * addresses ought to be unique. - */ - destination_ips?: string; - - /** - * Body param: A comma separated list of ports and protocols e.g. 80/TCP, 22/UDP. - * The total size of the field should not exceed 2000 characters. Each individual - * port/protocol should not exceed 100 characters. The list should not have more - * than 30 unique ports and protocols. - */ - ports_protocols?: string; - - /** - * Body param: Text containing 2 characters - */ - reported_country?: string; - - /** - * Body param: Text not exceeding 255 characters - */ - reported_user_agent?: string; - - /** - * Body param: A list of IP addresses separated by ‘\n’ (new line character). The - * list of source IPs should not exceed 30 IP addresses. Each one of the IP - * addresses ought to be unique. - */ - source_ips?: string; - - /** - * Body param: Text not exceeding 20 characters. This field may be released by - * Cloudflare to third parties such as the Lumen Database - * (https://lumendatabase.org/). - */ - tele?: string; - - /** - * Body param: Text not exceeding 255 characters - */ - title?: string; - } - - export interface AbuseReportsPhishingReport { - /** - * Path param: The account ID of the submitter. - */ - account_id: string; - - /** - * Body param: The abuse report type. - */ - act: 'abuse_phishing'; - - /** - * Body param: A valid email of the abuse reporter. This field may be released by - * Cloudflare to third parties such as the Lumen Database - * (https://lumendatabase.org/). - */ - email: string; - - /** - * Body param: Should match the value provided in `email` - */ - email2: string; - - /** - * Body param: Notification type based on the abuse type. NOTE: Copyright (DMCA) - * and Trademark reports cannot be anonymous. - */ - host_notification: 'send' | 'send-anon'; - - /** - * Body param: A detailed description of the infringement, including any necessary - * access details and the exact steps needed to view the content, not exceeding - * 5000 characters. - */ - justification: string; - - /** - * Body param: Text not exceeding 255 characters. This field may be released by - * Cloudflare to third parties such as the Lumen Database - * (https://lumendatabase.org/). - */ - name: string; - - /** - * Body param: Notification type based on the abuse type. NOTE: Copyright (DMCA) - * and Trademark reports cannot be anonymous. - */ - owner_notification: 'send' | 'send-anon'; - - /** - * Body param: A list of valid URLs separated by ‘\n’ (new line character). The - * list of the URLs should not exceed 250 URLs. All URLs should have the same - * hostname. Each URL should be unique. This field may be released by Cloudflare to - * third parties such as the Lumen Database (https://lumendatabase.org/). - */ - urls: string; - - /** - * Body param: Any additional comments about the infringement not exceeding 2000 - * characters - */ - comments?: string; - - /** - * Body param: Text not exceeding 100 characters. This field may be released by - * Cloudflare to third parties such as the Lumen Database - * (https://lumendatabase.org/). - */ - company?: string; - - /** - * Body param: Text not exceeding 255 characters. This field may be released by - * Cloudflare to third parties such as the Lumen Database - * (https://lumendatabase.org/). - */ - original_work?: string; - - /** - * Body param: Text containing 2 characters - */ - reported_country?: string; - - /** - * Body param: Text not exceeding 255 characters - */ - reported_user_agent?: string; - - /** - * Body param: Text not exceeding 20 characters. This field may be released by - * Cloudflare to third parties such as the Lumen Database - * (https://lumendatabase.org/). - */ - tele?: string; - - /** - * Body param: Text not exceeding 255 characters - */ - title?: string; - } - - export interface AbuseReportsCsamReport { - /** - * Path param: The account ID of the submitter. - */ - account_id: string; - - /** - * Body param: The abuse report type. - */ - act: 'abuse_children'; - - /** - * Body param: A valid email of the abuse reporter. This field may be released by - * Cloudflare to third parties such as the Lumen Database - * (https://lumendatabase.org/). - */ - email: string; - - /** - * Body param: Should match the value provided in `email` - */ - email2: string; - - /** - * Body param: Notification type based on the abuse type. NOTE: Copyright (DMCA) - * and Trademark reports cannot be anonymous. - */ - host_notification: 'send' | 'send-anon'; - - /** - * Body param: A detailed description of the infringement, including any necessary - * access details and the exact steps needed to view the content, not exceeding - * 5000 characters. - */ - justification: string; - - /** - * Body param: Text not exceeding 255 characters. This field may be released by - * Cloudflare to third parties such as the Lumen Database - * (https://lumendatabase.org/). - */ - name: string; - - /** - * Body param: Notification type based on the abuse type. NOTE: Copyright (DMCA) - * and Trademark reports cannot be anonymous. - */ - ncmec_notification: 'send' | 'send-anon'; - - /** - * Body param: Notification type based on the abuse type. NOTE: Copyright (DMCA) - * and Trademark reports cannot be anonymous. - */ - owner_notification: 'send' | 'send-anon' | 'none'; - - /** - * Body param: A list of valid URLs separated by ‘\n’ (new line character). The - * list of the URLs should not exceed 250 URLs. All URLs should have the same - * hostname. Each URL should be unique. This field may be released by Cloudflare to - * third parties such as the Lumen Database (https://lumendatabase.org/). - */ - urls: string; - - /** - * Body param: Any additional comments about the infringement not exceeding 2000 - * characters - */ - comments?: string; - - /** - * Body param: Text not exceeding 100 characters. This field may be released by - * Cloudflare to third parties such as the Lumen Database - * (https://lumendatabase.org/). - */ - company?: string; - - /** - * Body param: Text not exceeding 255 characters. This field may be released by - * Cloudflare to third parties such as the Lumen Database - * (https://lumendatabase.org/). - */ - country?: string; - - /** - * Body param: Text containing 2 characters - */ - reported_country?: string; - - /** - * Body param: Text not exceeding 255 characters - */ - reported_user_agent?: string; - - /** - * Body param: Text not exceeding 20 characters. This field may be released by - * Cloudflare to third parties such as the Lumen Database - * (https://lumendatabase.org/). - */ - tele?: string; - - /** - * Body param: Text not exceeding 255 characters - */ - title?: string; - } - - export interface AbuseReportsThreatReport { - /** - * Path param: The account ID of the submitter. - */ - account_id: string; - - /** - * Body param: The abuse report type. - */ - act: 'abuse_threat'; - - /** - * Body param: A valid email of the abuse reporter. This field may be released by - * Cloudflare to third parties such as the Lumen Database - * (https://lumendatabase.org/). - */ - email: string; - - /** - * Body param: Should match the value provided in `email` - */ - email2: string; - - /** - * Body param: Notification type based on the abuse type. NOTE: Copyright (DMCA) - * and Trademark reports cannot be anonymous. - */ - host_notification: 'send' | 'send-anon'; - - /** - * Body param: A detailed description of the infringement, including any necessary - * access details and the exact steps needed to view the content, not exceeding - * 5000 characters. - */ - justification: string; - - /** - * Body param: Text not exceeding 255 characters. This field may be released by - * Cloudflare to third parties such as the Lumen Database - * (https://lumendatabase.org/). - */ - name: string; - - /** - * Body param: Notification type based on the abuse type. NOTE: Copyright (DMCA) - * and Trademark reports cannot be anonymous. - */ - owner_notification: 'send' | 'send-anon'; - - /** - * Body param: A list of valid URLs separated by ‘\n’ (new line character). The - * list of the URLs should not exceed 250 URLs. All URLs should have the same - * hostname. Each URL should be unique. This field may be released by Cloudflare to - * third parties such as the Lumen Database (https://lumendatabase.org/). - */ - urls: string; - - /** - * Body param: Any additional comments about the infringement not exceeding 2000 - * characters - */ - comments?: string; - - /** - * Body param: Text not exceeding 100 characters. This field may be released by - * Cloudflare to third parties such as the Lumen Database - * (https://lumendatabase.org/). - */ - company?: string; - - /** - * Body param: Text containing 2 characters - */ - reported_country?: string; - - /** - * Body param: Text not exceeding 255 characters - */ - reported_user_agent?: string; - - /** - * Body param: Text not exceeding 20 characters. This field may be released by - * Cloudflare to third parties such as the Lumen Database - * (https://lumendatabase.org/). - */ - tele?: string; - - /** - * Body param: Text not exceeding 255 characters - */ - title?: string; - } - - export interface AbuseReportsRegistrarWhoisReport { - /** - * Path param: The account ID of the submitter. - */ - account_id: string; - - /** - * Body param: The abuse report type. - */ - act: 'abuse_registrar_whois'; - - /** - * Body param: A valid email of the abuse reporter. This field may be released by - * Cloudflare to third parties such as the Lumen Database - * (https://lumendatabase.org/). - */ - email: string; - - /** - * Body param: Should match the value provided in `email` - */ - email2: string; - - /** - * Body param: Text not exceeding 255 characters. This field may be released by - * Cloudflare to third parties such as the Lumen Database - * (https://lumendatabase.org/). - */ - name: string; - - /** - * Body param: Notification type based on the abuse type. NOTE: Copyright (DMCA) - * and Trademark reports cannot be anonymous. - */ - owner_notification: 'send' | 'send-anon' | 'none'; - - /** - * Body param: A list of valid URLs separated by ‘\n’ (new line character). The - * list of the URLs should not exceed 250 URLs. All URLs should have the same - * hostname. Each URL should be unique. This field may be released by Cloudflare to - * third parties such as the Lumen Database (https://lumendatabase.org/). - */ - urls: string; - - /** - * Body param: Any additional comments about the infringement not exceeding 2000 - * characters - */ - comments?: string; - - /** - * Body param: Text not exceeding 100 characters. This field may be released by - * Cloudflare to third parties such as the Lumen Database - * (https://lumendatabase.org/). - */ - company?: string; - - /** - * Body param: Text containing 2 characters - */ - reported_country?: string; - - /** - * Body param: Text not exceeding 255 characters - */ - reported_user_agent?: string; - - /** - * Body param: Text not exceeding 20 characters. This field may be released by - * Cloudflare to third parties such as the Lumen Database - * (https://lumendatabase.org/). - */ - tele?: string; - - /** - * Body param: Text not exceeding 255 characters - */ - title?: string; - } - - export interface AbuseReportsNcseiReport { - /** - * Path param: The account ID of the submitter. - */ - account_id: string; - - /** - * Body param: The abuse report type. - */ - act: 'abuse_ncsei'; - - /** - * Body param: A valid email of the abuse reporter. This field may be released by - * Cloudflare to third parties such as the Lumen Database - * (https://lumendatabase.org/). - */ - email: string; - - /** - * Body param: Should match the value provided in `email` - */ - email2: string; - - /** - * Body param: Notification type based on the abuse type. NOTE: Copyright (DMCA) - * and Trademark reports cannot be anonymous. - */ - host_notification: 'send' | 'send-anon'; - - /** - * Body param: Text not exceeding 255 characters. This field may be released by - * Cloudflare to third parties such as the Lumen Database - * (https://lumendatabase.org/). - */ - name: string; - - /** - * Body param: If the submitter is the target of NCSEI in the URLs of the abuse - * report. - */ - ncsei_subject_representation: boolean; - - /** - * Body param: Notification type based on the abuse type. NOTE: Copyright (DMCA) - * and Trademark reports cannot be anonymous. - */ - owner_notification: 'send' | 'send-anon' | 'none'; - - /** - * Body param: A list of valid URLs separated by ‘\n’ (new line character). The - * list of the URLs should not exceed 250 URLs. All URLs should have the same - * hostname. Each URL should be unique. This field may be released by Cloudflare to - * third parties such as the Lumen Database (https://lumendatabase.org/). - */ - urls: string; - - /** - * Body param: Any additional comments about the infringement not exceeding 2000 - * characters - */ - comments?: string; - - /** - * Body param: Text not exceeding 100 characters. This field may be released by - * Cloudflare to third parties such as the Lumen Database - * (https://lumendatabase.org/). - */ - company?: string; - - /** - * Body param: Text not exceeding 255 characters. This field may be released by - * Cloudflare to third parties such as the Lumen Database - * (https://lumendatabase.org/). - */ - country?: string; - - /** - * Body param: Text containing 2 characters - */ - reported_country?: string; - - /** - * Body param: Text not exceeding 255 characters - */ - reported_user_agent?: string; - - /** - * Body param: Text not exceeding 20 characters. This field may be released by - * Cloudflare to third parties such as the Lumen Database - * (https://lumendatabase.org/). - */ - tele?: string; - - /** - * Body param: Text not exceeding 255 characters - */ - title?: string; - } -} - -export declare namespace AbuseReports { - export { - type AbuseReportCreateResponse as AbuseReportCreateResponse, - type AbuseReportCreateParams as AbuseReportCreateParams, - }; -} +export * from './abuse-reports/index'; diff --git a/src/resources/abuse-reports/abuse-reports.ts b/src/resources/abuse-reports/abuse-reports.ts new file mode 100644 index 0000000000..74df855364 --- /dev/null +++ b/src/resources/abuse-reports/abuse-reports.ts @@ -0,0 +1,1201 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../resource'; +import * as Core from '../../core'; +import * as MitigationsAPI from './mitigations'; +import { + MitigationListParams, + MitigationListResponse, + MitigationListResponsesV4PagePagination, + MitigationReviewParams, + MitigationReviewResponse, + MitigationReviewResponsesSinglePage, + Mitigations, +} from './mitigations'; +import { V4PagePagination, type V4PagePaginationParams } from '../../pagination'; + +export class AbuseReports extends APIResource { + mitigations: MitigationsAPI.Mitigations = new MitigationsAPI.Mitigations(this._client); + + /** + * Submit the Abuse Report of a particular type + */ + create( + reportParam: string, + params: AbuseReportCreateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.post(`/accounts/${account_id}/abuse-reports/${reportParam}`, { + body, + ...options, + }) as Core.APIPromise<{ result: AbuseReportCreateResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * List the abuse reports for a given account + */ + list( + params: AbuseReportListParams, + options?: Core.RequestOptions, + ): Core.PagePromise { + const { account_id, ...query } = params; + return this._client.getAPIList( + `/accounts/${account_id}/abuse-reports`, + AbuseReportListResponsesV4PagePagination, + { query, ...options }, + ); + } + + /** + * Retrieve the details of an abuse report. + */ + get( + reportParam: string, + params: AbuseReportGetParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.get(`/accounts/${account_id}/abuse-reports/${reportParam}`, options) as Core.APIPromise<{ + result: AbuseReportGetResponse; + }> + )._thenUnwrap((obj) => obj.result); + } +} + +export class AbuseReportListResponsesV4PagePagination extends V4PagePagination {} + +/** + * The result should be 'success' for successful response + */ +export type AbuseReportCreateResponse = string; + +export interface AbuseReportListResponse { + reports: Array; +} + +export namespace AbuseReportListResponse { + export interface Report { + /** + * Public facing ID of abuse report, aka abuse_rand. + */ + id: string; + + /** + * Creation date of report. Time in RFC 3339 format + * (https://www.rfc-editor.org/rfc/rfc3339.html) + */ + cdate: string; + + /** + * Domain that relates to the report. + */ + domain: string; + + /** + * A summary of the mitigations related to this report. + */ + mitigation_summary: Report.MitigationSummary; + + /** + * An enum value that represents the status of an abuse record + */ + status: 'accepted' | 'in_review'; + + /** + * The abuse report type + */ + type: 'PHISH' | 'GEN' | 'THREAT' | 'DMCA' | 'EMER' | 'TM' | 'REG_WHO' | 'NCSEI' | 'NETWORK'; + + /** + * Justification for the report. + */ + justification?: string; + + /** + * Original work / Targeted brand in the alleged abuse. + */ + original_work?: string; + + /** + * Information about the submitter of the report. + */ + submitter?: Report.Submitter; + + urls?: Array; + } + + export namespace Report { + /** + * A summary of the mitigations related to this report. + */ + export interface MitigationSummary { + /** + * How many of the reported URLs were confirmed as abusive. + */ + accepted_url_count: number; + + /** + * How many mitigations are active. + */ + active_count: number; + + /** + * Whether the report has been forwarded to an external hosting provider. + */ + external_host_notified: boolean; + + /** + * How many mitigations are under review. + */ + in_review_count: number; + + /** + * How many mitigations are pending their effective date. + */ + pending_count: number; + } + + /** + * Information about the submitter of the report. + */ + export interface Submitter { + company?: string; + + email?: string; + + name?: string; + + telephone?: string; + } + } +} + +export interface AbuseReportGetResponse { + /** + * Public facing ID of abuse report, aka abuse_rand. + */ + id: string; + + /** + * Creation date of report. Time in RFC 3339 format + * (https://www.rfc-editor.org/rfc/rfc3339.html) + */ + cdate: string; + + /** + * Domain that relates to the report. + */ + domain: string; + + /** + * A summary of the mitigations related to this report. + */ + mitigation_summary: AbuseReportGetResponse.MitigationSummary; + + /** + * An enum value that represents the status of an abuse record + */ + status: 'accepted' | 'in_review'; + + /** + * The abuse report type + */ + type: 'PHISH' | 'GEN' | 'THREAT' | 'DMCA' | 'EMER' | 'TM' | 'REG_WHO' | 'NCSEI' | 'NETWORK'; + + /** + * Justification for the report. + */ + justification?: string; + + /** + * Original work / Targeted brand in the alleged abuse. + */ + original_work?: string; + + /** + * Information about the submitter of the report. + */ + submitter?: AbuseReportGetResponse.Submitter; + + urls?: Array; +} + +export namespace AbuseReportGetResponse { + /** + * A summary of the mitigations related to this report. + */ + export interface MitigationSummary { + /** + * How many of the reported URLs were confirmed as abusive. + */ + accepted_url_count: number; + + /** + * How many mitigations are active. + */ + active_count: number; + + /** + * Whether the report has been forwarded to an external hosting provider. + */ + external_host_notified: boolean; + + /** + * How many mitigations are under review. + */ + in_review_count: number; + + /** + * How many mitigations are pending their effective date. + */ + pending_count: number; + } + + /** + * Information about the submitter of the report. + */ + export interface Submitter { + company?: string; + + email?: string; + + name?: string; + + telephone?: string; + } +} + +export type AbuseReportCreateParams = + | AbuseReportCreateParams.AbuseReportsDmcaReport + | AbuseReportCreateParams.AbuseReportsTrademarkReport + | AbuseReportCreateParams.AbuseReportsGeneralReport + | AbuseReportCreateParams.AbuseReportsPhishingReport + | AbuseReportCreateParams.AbuseReportsCsamReport + | AbuseReportCreateParams.AbuseReportsThreatReport + | AbuseReportCreateParams.AbuseReportsRegistrarWhoisReport + | AbuseReportCreateParams.AbuseReportsNcseiReport; + +export declare namespace AbuseReportCreateParams { + export interface AbuseReportsDmcaReport { + /** + * Path param: Cloudflare Account ID + */ + account_id: string; + + /** + * Body param: The report type for submitted reports. + */ + act: 'abuse_dmca'; + + /** + * Body param: Text not exceeding 100 characters. This field may be released by + * Cloudflare to third parties such as the Lumen Database + * (https://lumendatabase.org/). + */ + address1: string; + + /** + * Body param: The name of the copyright holder. Text not exceeding 60 characters. + * This field may be released by Cloudflare to third parties such as the Lumen + * Database (https://lumendatabase.org/). + */ + agent_name: string; + + /** + * Body param: Can be `0` for false or `1` for true. Must be value: 1 for DMCA + * reports + */ + agree: 1; + + /** + * Body param: Text not exceeding 255 characters. This field may be released by + * Cloudflare to third parties such as the Lumen Database + * (https://lumendatabase.org/). + */ + city: string; + + /** + * Body param: Text not exceeding 255 characters. This field may be released by + * Cloudflare to third parties such as the Lumen Database + * (https://lumendatabase.org/). + */ + country: string; + + /** + * Body param: A valid email of the abuse reporter. This field may be released by + * Cloudflare to third parties such as the Lumen Database + * (https://lumendatabase.org/). + */ + email: string; + + /** + * Body param: Should match the value provided in `email` + */ + email2: string; + + /** + * Body param: Notification type based on the abuse type. NOTE: Copyright (DMCA) + * and Trademark reports cannot be anonymous. + */ + host_notification: 'send'; + + /** + * Body param: Text not exceeding 255 characters. This field may be released by + * Cloudflare to third parties such as the Lumen Database + * (https://lumendatabase.org/). + */ + name: string; + + /** + * Body param: Text not exceeding 255 characters. This field may be released by + * Cloudflare to third parties such as the Lumen Database + * (https://lumendatabase.org/). + */ + original_work: string; + + /** + * Body param: Notification type based on the abuse type. NOTE: Copyright (DMCA) + * and Trademark reports cannot be anonymous. + */ + owner_notification: 'send'; + + /** + * Body param: Required for DMCA reports, should be same as Name. An affirmation + * that all information in the report is true and accurate while agreeing to the + * policies of Cloudflare's abuse reports + */ + signature: string; + + /** + * Body param: Text not exceeding 255 characters. This field may be released by + * Cloudflare to third parties such as the Lumen Database + * (https://lumendatabase.org/). + */ + state: string; + + /** + * Body param: A list of valid URLs separated by ‘\n’ (new line character). The + * list of the URLs should not exceed 250 URLs. All URLs should have the same + * hostname. Each URL should be unique. This field may be released by Cloudflare to + * third parties such as the Lumen Database (https://lumendatabase.org/). + */ + urls: string; + + /** + * Body param: Any additional comments about the infringement not exceeding 2000 + * characters + */ + comments?: string; + + /** + * Body param: Text not exceeding 100 characters. This field may be released by + * Cloudflare to third parties such as the Lumen Database + * (https://lumendatabase.org/). + */ + company?: string; + + /** + * Body param: Text containing 2 characters + */ + reported_country?: string; + + /** + * Body param: Text not exceeding 255 characters + */ + reported_user_agent?: string; + + /** + * Body param: Text not exceeding 20 characters. This field may be released by + * Cloudflare to third parties such as the Lumen Database + * (https://lumendatabase.org/). + */ + tele?: string; + + /** + * Body param: Text not exceeding 255 characters + */ + title?: string; + } + + export interface AbuseReportsTrademarkReport { + /** + * Path param: Cloudflare Account ID + */ + account_id: string; + + /** + * Body param: The report type for submitted reports. + */ + act: 'abuse_trademark'; + + /** + * Body param: A valid email of the abuse reporter. This field may be released by + * Cloudflare to third parties such as the Lumen Database + * (https://lumendatabase.org/). + */ + email: string; + + /** + * Body param: Should match the value provided in `email` + */ + email2: string; + + /** + * Body param: Notification type based on the abuse type. NOTE: Copyright (DMCA) + * and Trademark reports cannot be anonymous. + */ + host_notification: 'send'; + + /** + * Body param: A detailed description of the infringement, including any necessary + * access details and the exact steps needed to view the content, not exceeding + * 5000 characters. + */ + justification: string; + + /** + * Body param: Text not exceeding 255 characters. This field may be released by + * Cloudflare to third parties such as the Lumen Database + * (https://lumendatabase.org/). + */ + name: string; + + /** + * Body param: Notification type based on the abuse type. NOTE: Copyright (DMCA) + * and Trademark reports cannot be anonymous. + */ + owner_notification: 'send'; + + /** + * Body param: Text not exceeding 1000 characters + */ + trademark_number: string; + + /** + * Body param: Text not exceeding 1000 characters + */ + trademark_office: string; + + /** + * Body param: Text not exceeding 1000 characters + */ + trademark_symbol: string; + + /** + * Body param: A list of valid URLs separated by ‘\n’ (new line character). The + * list of the URLs should not exceed 250 URLs. All URLs should have the same + * hostname. Each URL should be unique. This field may be released by Cloudflare to + * third parties such as the Lumen Database (https://lumendatabase.org/). + */ + urls: string; + + /** + * Body param: Any additional comments about the infringement not exceeding 2000 + * characters + */ + comments?: string; + + /** + * Body param: Text not exceeding 100 characters. This field may be released by + * Cloudflare to third parties such as the Lumen Database + * (https://lumendatabase.org/). + */ + company?: string; + + /** + * Body param: Text containing 2 characters + */ + reported_country?: string; + + /** + * Body param: Text not exceeding 255 characters + */ + reported_user_agent?: string; + + /** + * Body param: Text not exceeding 20 characters. This field may be released by + * Cloudflare to third parties such as the Lumen Database + * (https://lumendatabase.org/). + */ + tele?: string; + + /** + * Body param: Text not exceeding 255 characters + */ + title?: string; + } + + export interface AbuseReportsGeneralReport { + /** + * Path param: Cloudflare Account ID + */ + account_id: string; + + /** + * Body param: The report type for submitted reports. + */ + act: 'abuse_general'; + + /** + * Body param: A valid email of the abuse reporter. This field may be released by + * Cloudflare to third parties such as the Lumen Database + * (https://lumendatabase.org/). + */ + email: string; + + /** + * Body param: Should match the value provided in `email` + */ + email2: string; + + /** + * Body param: Notification type based on the abuse type. NOTE: Copyright (DMCA) + * and Trademark reports cannot be anonymous. + */ + host_notification: 'send' | 'send-anon'; + + /** + * Body param: A detailed description of the infringement, including any necessary + * access details and the exact steps needed to view the content, not exceeding + * 5000 characters. + */ + justification: string; + + /** + * Body param: Text not exceeding 255 characters. This field may be released by + * Cloudflare to third parties such as the Lumen Database + * (https://lumendatabase.org/). + */ + name: string; + + /** + * Body param: Notification type based on the abuse type. NOTE: Copyright (DMCA) + * and Trademark reports cannot be anonymous. + */ + owner_notification: 'send' | 'send-anon' | 'none'; + + /** + * Body param: A list of valid URLs separated by ‘\n’ (new line character). The + * list of the URLs should not exceed 250 URLs. All URLs should have the same + * hostname. Each URL should be unique. This field may be released by Cloudflare to + * third parties such as the Lumen Database (https://lumendatabase.org/). + */ + urls: string; + + /** + * Body param: Any additional comments about the infringement not exceeding 2000 + * characters + */ + comments?: string; + + /** + * Body param: Text not exceeding 100 characters. This field may be released by + * Cloudflare to third parties such as the Lumen Database + * (https://lumendatabase.org/). + */ + company?: string; + + /** + * Body param: A list of IP addresses separated by ‘\n’ (new line character). The + * list of destination IPs should not exceed 30 IP addresses. Each one of the IP + * addresses ought to be unique. + */ + destination_ips?: string; + + /** + * Body param: A comma separated list of ports and protocols e.g. 80/TCP, 22/UDP. + * The total size of the field should not exceed 2000 characters. Each individual + * port/protocol should not exceed 100 characters. The list should not have more + * than 30 unique ports and protocols. + */ + ports_protocols?: string; + + /** + * Body param: Text containing 2 characters + */ + reported_country?: string; + + /** + * Body param: Text not exceeding 255 characters + */ + reported_user_agent?: string; + + /** + * Body param: A list of IP addresses separated by ‘\n’ (new line character). The + * list of source IPs should not exceed 30 IP addresses. Each one of the IP + * addresses ought to be unique. + */ + source_ips?: string; + + /** + * Body param: Text not exceeding 20 characters. This field may be released by + * Cloudflare to third parties such as the Lumen Database + * (https://lumendatabase.org/). + */ + tele?: string; + + /** + * Body param: Text not exceeding 255 characters + */ + title?: string; + } + + export interface AbuseReportsPhishingReport { + /** + * Path param: Cloudflare Account ID + */ + account_id: string; + + /** + * Body param: The report type for submitted reports. + */ + act: 'abuse_phishing'; + + /** + * Body param: A valid email of the abuse reporter. This field may be released by + * Cloudflare to third parties such as the Lumen Database + * (https://lumendatabase.org/). + */ + email: string; + + /** + * Body param: Should match the value provided in `email` + */ + email2: string; + + /** + * Body param: Notification type based on the abuse type. NOTE: Copyright (DMCA) + * and Trademark reports cannot be anonymous. + */ + host_notification: 'send' | 'send-anon'; + + /** + * Body param: A detailed description of the infringement, including any necessary + * access details and the exact steps needed to view the content, not exceeding + * 5000 characters. + */ + justification: string; + + /** + * Body param: Text not exceeding 255 characters. This field may be released by + * Cloudflare to third parties such as the Lumen Database + * (https://lumendatabase.org/). + */ + name: string; + + /** + * Body param: Notification type based on the abuse type. NOTE: Copyright (DMCA) + * and Trademark reports cannot be anonymous. + */ + owner_notification: 'send' | 'send-anon'; + + /** + * Body param: A list of valid URLs separated by ‘\n’ (new line character). The + * list of the URLs should not exceed 250 URLs. All URLs should have the same + * hostname. Each URL should be unique. This field may be released by Cloudflare to + * third parties such as the Lumen Database (https://lumendatabase.org/). + */ + urls: string; + + /** + * Body param: Any additional comments about the infringement not exceeding 2000 + * characters + */ + comments?: string; + + /** + * Body param: Text not exceeding 100 characters. This field may be released by + * Cloudflare to third parties such as the Lumen Database + * (https://lumendatabase.org/). + */ + company?: string; + + /** + * Body param: Text not exceeding 255 characters. This field may be released by + * Cloudflare to third parties such as the Lumen Database + * (https://lumendatabase.org/). + */ + original_work?: string; + + /** + * Body param: Text containing 2 characters + */ + reported_country?: string; + + /** + * Body param: Text not exceeding 255 characters + */ + reported_user_agent?: string; + + /** + * Body param: Text not exceeding 20 characters. This field may be released by + * Cloudflare to third parties such as the Lumen Database + * (https://lumendatabase.org/). + */ + tele?: string; + + /** + * Body param: Text not exceeding 255 characters + */ + title?: string; + } + + export interface AbuseReportsCsamReport { + /** + * Path param: Cloudflare Account ID + */ + account_id: string; + + /** + * Body param: The report type for submitted reports. + */ + act: 'abuse_children'; + + /** + * Body param: A valid email of the abuse reporter. This field may be released by + * Cloudflare to third parties such as the Lumen Database + * (https://lumendatabase.org/). + */ + email: string; + + /** + * Body param: Should match the value provided in `email` + */ + email2: string; + + /** + * Body param: Notification type based on the abuse type. NOTE: Copyright (DMCA) + * and Trademark reports cannot be anonymous. + */ + host_notification: 'send' | 'send-anon'; + + /** + * Body param: A detailed description of the infringement, including any necessary + * access details and the exact steps needed to view the content, not exceeding + * 5000 characters. + */ + justification: string; + + /** + * Body param: Text not exceeding 255 characters. This field may be released by + * Cloudflare to third parties such as the Lumen Database + * (https://lumendatabase.org/). + */ + name: string; + + /** + * Body param: Notification type based on the abuse type. NOTE: Copyright (DMCA) + * and Trademark reports cannot be anonymous. + */ + ncmec_notification: 'send' | 'send-anon'; + + /** + * Body param: Notification type based on the abuse type. NOTE: Copyright (DMCA) + * and Trademark reports cannot be anonymous. + */ + owner_notification: 'send' | 'send-anon' | 'none'; + + /** + * Body param: A list of valid URLs separated by ‘\n’ (new line character). The + * list of the URLs should not exceed 250 URLs. All URLs should have the same + * hostname. Each URL should be unique. This field may be released by Cloudflare to + * third parties such as the Lumen Database (https://lumendatabase.org/). + */ + urls: string; + + /** + * Body param: Any additional comments about the infringement not exceeding 2000 + * characters + */ + comments?: string; + + /** + * Body param: Text not exceeding 100 characters. This field may be released by + * Cloudflare to third parties such as the Lumen Database + * (https://lumendatabase.org/). + */ + company?: string; + + /** + * Body param: Text not exceeding 255 characters. This field may be released by + * Cloudflare to third parties such as the Lumen Database + * (https://lumendatabase.org/). + */ + country?: string; + + /** + * Body param: Text containing 2 characters + */ + reported_country?: string; + + /** + * Body param: Text not exceeding 255 characters + */ + reported_user_agent?: string; + + /** + * Body param: Text not exceeding 20 characters. This field may be released by + * Cloudflare to third parties such as the Lumen Database + * (https://lumendatabase.org/). + */ + tele?: string; + + /** + * Body param: Text not exceeding 255 characters + */ + title?: string; + } + + export interface AbuseReportsThreatReport { + /** + * Path param: Cloudflare Account ID + */ + account_id: string; + + /** + * Body param: The report type for submitted reports. + */ + act: 'abuse_threat'; + + /** + * Body param: A valid email of the abuse reporter. This field may be released by + * Cloudflare to third parties such as the Lumen Database + * (https://lumendatabase.org/). + */ + email: string; + + /** + * Body param: Should match the value provided in `email` + */ + email2: string; + + /** + * Body param: Notification type based on the abuse type. NOTE: Copyright (DMCA) + * and Trademark reports cannot be anonymous. + */ + host_notification: 'send' | 'send-anon'; + + /** + * Body param: A detailed description of the infringement, including any necessary + * access details and the exact steps needed to view the content, not exceeding + * 5000 characters. + */ + justification: string; + + /** + * Body param: Text not exceeding 255 characters. This field may be released by + * Cloudflare to third parties such as the Lumen Database + * (https://lumendatabase.org/). + */ + name: string; + + /** + * Body param: Notification type based on the abuse type. NOTE: Copyright (DMCA) + * and Trademark reports cannot be anonymous. + */ + owner_notification: 'send' | 'send-anon'; + + /** + * Body param: A list of valid URLs separated by ‘\n’ (new line character). The + * list of the URLs should not exceed 250 URLs. All URLs should have the same + * hostname. Each URL should be unique. This field may be released by Cloudflare to + * third parties such as the Lumen Database (https://lumendatabase.org/). + */ + urls: string; + + /** + * Body param: Any additional comments about the infringement not exceeding 2000 + * characters + */ + comments?: string; + + /** + * Body param: Text not exceeding 100 characters. This field may be released by + * Cloudflare to third parties such as the Lumen Database + * (https://lumendatabase.org/). + */ + company?: string; + + /** + * Body param: Text containing 2 characters + */ + reported_country?: string; + + /** + * Body param: Text not exceeding 255 characters + */ + reported_user_agent?: string; + + /** + * Body param: Text not exceeding 20 characters. This field may be released by + * Cloudflare to third parties such as the Lumen Database + * (https://lumendatabase.org/). + */ + tele?: string; + + /** + * Body param: Text not exceeding 255 characters + */ + title?: string; + } + + export interface AbuseReportsRegistrarWhoisReport { + /** + * Path param: Cloudflare Account ID + */ + account_id: string; + + /** + * Body param: The report type for submitted reports. + */ + act: 'abuse_registrar_whois'; + + /** + * Body param: A valid email of the abuse reporter. This field may be released by + * Cloudflare to third parties such as the Lumen Database + * (https://lumendatabase.org/). + */ + email: string; + + /** + * Body param: Should match the value provided in `email` + */ + email2: string; + + /** + * Body param: Text not exceeding 255 characters. This field may be released by + * Cloudflare to third parties such as the Lumen Database + * (https://lumendatabase.org/). + */ + name: string; + + /** + * Body param: Notification type based on the abuse type. NOTE: Copyright (DMCA) + * and Trademark reports cannot be anonymous. + */ + owner_notification: 'send' | 'send-anon' | 'none'; + + /** + * Body param: A list of valid URLs separated by ‘\n’ (new line character). The + * list of the URLs should not exceed 250 URLs. All URLs should have the same + * hostname. Each URL should be unique. This field may be released by Cloudflare to + * third parties such as the Lumen Database (https://lumendatabase.org/). + */ + urls: string; + + /** + * Body param: Any additional comments about the infringement not exceeding 2000 + * characters + */ + comments?: string; + + /** + * Body param: Text not exceeding 100 characters. This field may be released by + * Cloudflare to third parties such as the Lumen Database + * (https://lumendatabase.org/). + */ + company?: string; + + /** + * Body param: Text containing 2 characters + */ + reported_country?: string; + + /** + * Body param: Text not exceeding 255 characters + */ + reported_user_agent?: string; + + /** + * Body param: Text not exceeding 20 characters. This field may be released by + * Cloudflare to third parties such as the Lumen Database + * (https://lumendatabase.org/). + */ + tele?: string; + + /** + * Body param: Text not exceeding 255 characters + */ + title?: string; + } + + export interface AbuseReportsNcseiReport { + /** + * Path param: Cloudflare Account ID + */ + account_id: string; + + /** + * Body param: The report type for submitted reports. + */ + act: 'abuse_ncsei'; + + /** + * Body param: A valid email of the abuse reporter. This field may be released by + * Cloudflare to third parties such as the Lumen Database + * (https://lumendatabase.org/). + */ + email: string; + + /** + * Body param: Should match the value provided in `email` + */ + email2: string; + + /** + * Body param: Notification type based on the abuse type. NOTE: Copyright (DMCA) + * and Trademark reports cannot be anonymous. + */ + host_notification: 'send' | 'send-anon'; + + /** + * Body param: Text not exceeding 255 characters. This field may be released by + * Cloudflare to third parties such as the Lumen Database + * (https://lumendatabase.org/). + */ + name: string; + + /** + * Body param: If the submitter is the target of NCSEI in the URLs of the abuse + * report. + */ + ncsei_subject_representation: boolean; + + /** + * Body param: Notification type based on the abuse type. NOTE: Copyright (DMCA) + * and Trademark reports cannot be anonymous. + */ + owner_notification: 'send' | 'send-anon' | 'none'; + + /** + * Body param: A list of valid URLs separated by ‘\n’ (new line character). The + * list of the URLs should not exceed 250 URLs. All URLs should have the same + * hostname. Each URL should be unique. This field may be released by Cloudflare to + * third parties such as the Lumen Database (https://lumendatabase.org/). + */ + urls: string; + + /** + * Body param: Any additional comments about the infringement not exceeding 2000 + * characters + */ + comments?: string; + + /** + * Body param: Text not exceeding 100 characters. This field may be released by + * Cloudflare to third parties such as the Lumen Database + * (https://lumendatabase.org/). + */ + company?: string; + + /** + * Body param: Text not exceeding 255 characters. This field may be released by + * Cloudflare to third parties such as the Lumen Database + * (https://lumendatabase.org/). + */ + country?: string; + + /** + * Body param: Text containing 2 characters + */ + reported_country?: string; + + /** + * Body param: Text not exceeding 255 characters + */ + reported_user_agent?: string; + + /** + * Body param: Text not exceeding 20 characters. This field may be released by + * Cloudflare to third parties such as the Lumen Database + * (https://lumendatabase.org/). + */ + tele?: string; + + /** + * Body param: Text not exceeding 255 characters + */ + title?: string; + } +} + +export interface AbuseReportListParams extends V4PagePaginationParams { + /** + * Path param: Cloudflare Account ID + */ + account_id: string; + + /** + * Query param: Returns reports created after the specified date + */ + created_after?: string; + + /** + * Query param: Returns reports created before the specified date + */ + created_before?: string; + + /** + * Query param: Filter by domain name related to the abuse report + */ + domain?: string; + + /** + * Query param: Filter reports that have any mitigations in the given status. + */ + mitigation_status?: 'pending' | 'active' | 'in_review' | 'cancelled' | 'removed'; + + /** + * Query param: A property to sort by, followed by the order (id, cdate, domain, + * type, status) + */ + sort?: string; + + /** + * Query param: Filter by the status of the report. + */ + status?: 'accepted' | 'in_review'; + + /** + * Query param: Filter by the type of the report. + */ + type?: 'PHISH' | 'GEN' | 'THREAT' | 'DMCA' | 'EMER' | 'TM' | 'REG_WHO' | 'NCSEI' | 'NETWORK'; +} + +export interface AbuseReportGetParams { + /** + * Cloudflare Account ID + */ + account_id: string; +} + +AbuseReports.AbuseReportListResponsesV4PagePagination = AbuseReportListResponsesV4PagePagination; +AbuseReports.Mitigations = Mitigations; +AbuseReports.MitigationListResponsesV4PagePagination = MitigationListResponsesV4PagePagination; +AbuseReports.MitigationReviewResponsesSinglePage = MitigationReviewResponsesSinglePage; + +export declare namespace AbuseReports { + export { + type AbuseReportCreateResponse as AbuseReportCreateResponse, + type AbuseReportListResponse as AbuseReportListResponse, + type AbuseReportGetResponse as AbuseReportGetResponse, + AbuseReportListResponsesV4PagePagination as AbuseReportListResponsesV4PagePagination, + type AbuseReportCreateParams as AbuseReportCreateParams, + type AbuseReportListParams as AbuseReportListParams, + type AbuseReportGetParams as AbuseReportGetParams, + }; + + export { + Mitigations as Mitigations, + type MitigationListResponse as MitigationListResponse, + type MitigationReviewResponse as MitigationReviewResponse, + MitigationListResponsesV4PagePagination as MitigationListResponsesV4PagePagination, + MitigationReviewResponsesSinglePage as MitigationReviewResponsesSinglePage, + type MitigationListParams as MitigationListParams, + type MitigationReviewParams as MitigationReviewParams, + }; +} diff --git a/src/resources/abuse-reports/index.ts b/src/resources/abuse-reports/index.ts new file mode 100644 index 0000000000..ea6893efe5 --- /dev/null +++ b/src/resources/abuse-reports/index.ts @@ -0,0 +1,12 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { AbuseReports } from './abuse-reports'; +export { + MitigationListResponsesV4PagePagination, + MitigationReviewResponsesSinglePage, + Mitigations, + type MitigationListResponse, + type MitigationReviewResponse, + type MitigationListParams, + type MitigationReviewParams, +} from './mitigations'; diff --git a/src/resources/abuse-reports/mitigations.ts b/src/resources/abuse-reports/mitigations.ts new file mode 100644 index 0000000000..eae497cc57 --- /dev/null +++ b/src/resources/abuse-reports/mitigations.ts @@ -0,0 +1,208 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../resource'; +import * as Core from '../../core'; +import { SinglePage, V4PagePagination, type V4PagePaginationParams } from '../../pagination'; + +export class Mitigations extends APIResource { + /** + * List mitigations done to remediate the abuse report. + */ + list( + reportId: string, + params: MitigationListParams, + options?: Core.RequestOptions, + ): Core.PagePromise { + const { account_id, ...query } = params; + return this._client.getAPIList( + `/accounts/${account_id}/abuse-reports/${reportId}/mitigations`, + MitigationListResponsesV4PagePagination, + { query, ...options }, + ); + } + + /** + * Request a review for mitigations on an account. + */ + review( + reportId: string, + params: MitigationReviewParams, + options?: Core.RequestOptions, + ): Core.PagePromise { + const { account_id, ...body } = params; + return this._client.getAPIList( + `/accounts/${account_id}/abuse-reports/${reportId}/mitigations/appeal`, + MitigationReviewResponsesSinglePage, + { body, method: 'post', ...options }, + ); + } +} + +export class MitigationListResponsesV4PagePagination extends V4PagePagination {} + +export class MitigationReviewResponsesSinglePage extends SinglePage {} + +export interface MitigationListResponse { + mitigations: Array; +} + +export namespace MitigationListResponse { + export interface Mitigation { + /** + * ID of remediation. + */ + id: string; + + /** + * Date when the mitigation will become active. Time in RFC 3339 format + * (https://www.rfc-editor.org/rfc/rfc3339.html) + */ + effective_date: string; + + entity_id: string; + + entity_type: 'url_pattern' | 'account' | 'zone'; + + /** + * The status of a mitigation + */ + status: 'pending' | 'active' | 'in_review' | 'cancelled' | 'removed'; + + /** + * The type of mitigation + */ + type: + | 'legal_block' + | 'phishing_interstitial' + | 'network_block' + | 'rate_limit_cache' + | 'account_suspend' + | 'redirect_video_stream'; + } +} + +export interface MitigationReviewResponse { + /** + * ID of remediation. + */ + id: string; + + /** + * Date when the mitigation will become active. Time in RFC 3339 format + * (https://www.rfc-editor.org/rfc/rfc3339.html) + */ + effective_date: string; + + entity_id: string; + + entity_type: 'url_pattern' | 'account' | 'zone'; + + /** + * The status of a mitigation + */ + status: 'pending' | 'active' | 'in_review' | 'cancelled' | 'removed'; + + /** + * The type of mitigation + */ + type: + | 'legal_block' + | 'phishing_interstitial' + | 'network_block' + | 'rate_limit_cache' + | 'account_suspend' + | 'redirect_video_stream'; +} + +export interface MitigationListParams extends V4PagePaginationParams { + /** + * Path param: Cloudflare Account ID + */ + account_id: string; + + /** + * Query param: Returns mitigation that were dispatched after the given date + */ + effective_after?: string; + + /** + * Query param: Returns mitigations that were dispatched before the given date + */ + effective_before?: string; + + /** + * Query param: Filter by the type of entity the mitigation impacts. + */ + entity_type?: 'url_pattern' | 'account' | 'zone'; + + /** + * Query param: A property to sort by, followed by the order + */ + sort?: + | 'type,asc' + | 'type,desc' + | 'effective_date,asc' + | 'effective_date,desc' + | 'status,asc' + | 'status,desc' + | 'entity_type,asc' + | 'entity_type,desc'; + + /** + * Query param: Filter by the status of the mitigation. + */ + status?: 'pending' | 'active' | 'in_review' | 'cancelled' | 'removed'; + + /** + * Query param: Filter by the type of mitigation. This filter parameter can be + * specified multiple times to include multiple types of mitigations in the result + * set, e.g. ?type=rate_limit_cache&type=legal_block. + */ + type?: + | 'legal_block' + | 'phishing_interstitial' + | 'network_block' + | 'rate_limit_cache' + | 'account_suspend' + | 'redirect_video_stream'; +} + +export interface MitigationReviewParams { + /** + * Path param: Cloudflare Account ID + */ + account_id: string; + + /** + * Body param: List of mitigations to appeal. + */ + appeals: Array; +} + +export namespace MitigationReviewParams { + export interface Appeal { + /** + * ID of the mitigation to appeal. + */ + id: string; + + /** + * Reason why the customer is appealing. + */ + reason: 'removed' | 'misclassified'; + } +} + +Mitigations.MitigationListResponsesV4PagePagination = MitigationListResponsesV4PagePagination; +Mitigations.MitigationReviewResponsesSinglePage = MitigationReviewResponsesSinglePage; + +export declare namespace Mitigations { + export { + type MitigationListResponse as MitigationListResponse, + type MitigationReviewResponse as MitigationReviewResponse, + MitigationListResponsesV4PagePagination as MitigationListResponsesV4PagePagination, + MitigationReviewResponsesSinglePage as MitigationReviewResponsesSinglePage, + type MitigationListParams as MitigationListParams, + type MitigationReviewParams as MitigationReviewParams, + }; +} diff --git a/src/resources/accounts/accounts.ts b/src/resources/accounts/accounts.ts index 1f17f46efb..332d3d488d 100644 --- a/src/resources/accounts/accounts.ts +++ b/src/resources/accounts/accounts.ts @@ -175,6 +175,11 @@ export interface Account { */ created_on?: string; + /** + * Parent container details + */ + managed_by?: Account.ManagedBy; + /** * Account settings */ @@ -182,6 +187,21 @@ export interface Account { } export namespace Account { + /** + * Parent container details + */ + export interface ManagedBy { + /** + * ID of the parent Organization, if one exists + */ + parent_org_id?: string; + + /** + * Name of the parent Organization, if one exists + */ + parent_org_name?: string; + } + /** * Account settings */ @@ -257,6 +277,11 @@ export interface AccountUpdateParams { */ type: 'standard' | 'enterprise'; + /** + * Body param: Parent container details + */ + managed_by?: AccountUpdateParams.ManagedBy; + /** * Body param: Account settings */ @@ -264,6 +289,11 @@ export interface AccountUpdateParams { } export namespace AccountUpdateParams { + /** + * Parent container details + */ + export interface ManagedBy {} + /** * Account settings */ diff --git a/src/resources/accounts/logs/audit.ts b/src/resources/accounts/logs/audit.ts index 63362be091..c951fa3b1a 100644 --- a/src/resources/accounts/logs/audit.ts +++ b/src/resources/accounts/logs/audit.ts @@ -252,6 +252,11 @@ export interface AuditListParams extends CursorPaginationAfterParams { */ since: string; + /** + * Query param: + */ + id?: AuditListParams.ID; + /** * Query param: */ @@ -371,6 +376,13 @@ export interface AuditListParams extends CursorPaginationAfterParams { } export namespace AuditListParams { + export interface ID { + /** + * Filters out audit logs by their IDs. + */ + not?: Array; + } + export interface AccountName { /** * Filters out audit logs by the account name. @@ -446,7 +458,7 @@ export namespace AuditListParams { export interface AuditLogID { /** - * Filters out audit logs by their IDs. + * @deprecated Filters out audit logs by their IDs. */ not?: Array; } diff --git a/src/resources/addressing/prefixes/bgp-prefixes.ts b/src/resources/addressing/prefixes/bgp-prefixes.ts index 1945d1a5b1..f8cd80f52e 100644 --- a/src/resources/addressing/prefixes/bgp-prefixes.ts +++ b/src/resources/addressing/prefixes/bgp-prefixes.ts @@ -15,7 +15,10 @@ export class BGPPrefixes extends APIResource { * const bgpPrefix = * await client.addressing.prefixes.bgpPrefixes.create( * '2af39739cc4e3b5910c918468bb89828', - * { account_id: '258def64c72dae45f3e4c8516e2111f2' }, + * { + * account_id: '258def64c72dae45f3e4c8516e2111f2', + * cidr: '192.0.2.0/24', + * }, * ); * ``` */ @@ -196,7 +199,7 @@ export namespace BGPPrefix { on_demand_enabled?: boolean; /** - * Whether advertisement status of the prefix is locked, meaning it cannot be + * Whether the advertisement status of the prefix is locked, meaning it cannot be * changed. */ on_demand_locked?: boolean; @@ -212,7 +215,7 @@ export interface BGPPrefixCreateParams { /** * Body param: IP Prefix in Classless Inter-Domain Routing format. */ - cidr?: string; + cidr: string; } export interface BGPPrefixListParams { diff --git a/src/resources/addressing/prefixes/prefixes.ts b/src/resources/addressing/prefixes/prefixes.ts index a965d93b86..a30767d55d 100644 --- a/src/resources/addressing/prefixes/prefixes.ts +++ b/src/resources/addressing/prefixes/prefixes.ts @@ -56,9 +56,8 @@ export class Prefixes extends APIResource { * ```ts * const prefix = await client.addressing.prefixes.create({ * account_id: '258def64c72dae45f3e4c8516e2111f2', - * asn: 209242, + * asn: 13335, * cidr: '192.0.2.0/24', - * loa_document_id: 'd933b1530bc56c9953cf8ce166da8004', * }); * ``` */ @@ -200,7 +199,7 @@ export interface Prefix { /** * Autonomous System Number (ASN) the prefix will be advertised under. */ - asn?: number | null; + asn?: number; /** * IP Prefix in Classless Inter-Domain Routing format. @@ -209,11 +208,22 @@ export interface Prefix { created_at?: string; + /** + * Whether Cloudflare is allowed to generate the LOA document on behalf of the + * prefix owner. + */ + delegate_loa_creation?: boolean; + /** * Description of the prefix. */ description?: string; + /** + * State of one kind of validation for an IP prefix. + */ + irr_validation_state?: string; + /** * Identifier for the uploaded LOA document. */ @@ -236,6 +246,21 @@ export interface Prefix { * Prefix. */ on_demand_locked?: boolean; + + /** + * State of one kind of validation for an IP prefix. + */ + ownership_validation_state?: string; + + /** + * Token provided to demonstrate ownership of the prefix. + */ + ownership_validation_token?: string; + + /** + * State of one kind of validation for an IP prefix. + */ + rpki_validation_state?: string; } export interface PrefixDeleteResponse { @@ -247,8 +272,6 @@ export interface PrefixDeleteResponse { * Whether the API call was successful. */ success: true; - - result_info?: PrefixDeleteResponse.ResultInfo; } export namespace PrefixDeleteResponse { @@ -283,28 +306,6 @@ export namespace PrefixDeleteResponse { pointer?: string; } } - - export interface ResultInfo { - /** - * Total number of results for the requested service. - */ - count?: number; - - /** - * Current page within paginated list of results. - */ - page?: number; - - /** - * Number of results per page of results. - */ - per_page?: number; - - /** - * Total results available without any search parameters. - */ - total_count?: number; - } } export interface PrefixCreateParams { @@ -316,17 +317,28 @@ export interface PrefixCreateParams { /** * Body param: Autonomous System Number (ASN) the prefix will be advertised under. */ - asn: number | null; + asn: number; /** * Body param: IP Prefix in Classless Inter-Domain Routing format. */ cidr: string; + /** + * Body param: Whether Cloudflare is allowed to generate the LOA document on behalf + * of the prefix owner. + */ + delegate_loa_creation?: boolean; + + /** + * Body param: Description of the prefix. + */ + description?: string; + /** * Body param: Identifier for the uploaded LOA document. */ - loa_document_id: string | null; + loa_document_id?: string | null; } export interface PrefixListParams { diff --git a/src/resources/addressing/prefixes/service-bindings.ts b/src/resources/addressing/prefixes/service-bindings.ts index 5ef9365d41..a12783f519 100644 --- a/src/resources/addressing/prefixes/service-bindings.ts +++ b/src/resources/addressing/prefixes/service-bindings.ts @@ -7,17 +7,22 @@ import { SinglePage } from '../../../pagination'; export class ServiceBindings extends APIResource { /** * Creates a new Service Binding, routing traffic to IPs within the given CIDR to a - * service running on Cloudflare's network. **Note:** This API may only be used on - * prefixes currently configured with a Magic Transit/Cloudflare CDN/Cloudflare - * Spectrum service binding, and only allows creating upgrade service bindings for - * the Cloudflare CDN or Cloudflare Spectrum. + * service running on Cloudflare's network. **NOTE:** The first Service Binding + * created for an IP Prefix must exactly match the IP Prefix's CIDR. Subsequent + * Service Bindings may be created with a more-specific CIDR. Refer to the + * [Service Bindings Documentation](https://developers.cloudflare.com/byoip/service-bindings/) + * for compatibility details. * * @example * ```ts * const serviceBinding = * await client.addressing.prefixes.serviceBindings.create( * '2af39739cc4e3b5910c918468bb89828', - * { account_id: '258def64c72dae45f3e4c8516e2111f2' }, + * { + * account_id: '258def64c72dae45f3e4c8516e2111f2', + * cidr: '192.0.2.0/24', + * service_id: '2db684ee7ca04e159946fd05b99e1bcd', + * }, * ); * ``` */ @@ -219,13 +224,13 @@ export interface ServiceBindingCreateParams { /** * Body param: IP Prefix in Classless Inter-Domain Routing format. */ - cidr?: string; + cidr: string; /** * Body param: Identifier of a Service on the Cloudflare network. Available * services and their IDs may be found in the **List Services** endpoint. */ - service_id?: string; + service_id: string; } export interface ServiceBindingListParams { diff --git a/src/resources/ai-gateway/ai-gateway.ts b/src/resources/ai-gateway/ai-gateway.ts index 0c4c49b406..765ca9490c 100644 --- a/src/resources/ai-gateway/ai-gateway.ts +++ b/src/resources/ai-gateway/ai-gateway.ts @@ -248,6 +248,8 @@ export interface AIGatewayCreateResponse { store_id?: string | null; stripe?: AIGatewayCreateResponse.Stripe | null; + + zdr?: boolean; } export namespace AIGatewayCreateResponse { @@ -345,6 +347,8 @@ export interface AIGatewayUpdateResponse { store_id?: string | null; stripe?: AIGatewayUpdateResponse.Stripe | null; + + zdr?: boolean; } export namespace AIGatewayUpdateResponse { @@ -442,6 +446,8 @@ export interface AIGatewayListResponse { store_id?: string | null; stripe?: AIGatewayListResponse.Stripe | null; + + zdr?: boolean; } export namespace AIGatewayListResponse { @@ -539,6 +545,8 @@ export interface AIGatewayDeleteResponse { store_id?: string | null; stripe?: AIGatewayDeleteResponse.Stripe | null; + + zdr?: boolean; } export namespace AIGatewayDeleteResponse { @@ -636,6 +644,8 @@ export interface AIGatewayGetResponse { store_id?: string | null; stripe?: AIGatewayGetResponse.Stripe | null; + + zdr?: boolean; } export namespace AIGatewayGetResponse { @@ -753,6 +763,11 @@ export interface AIGatewayCreateParams { * Body param: */ logpush_public_key?: string | null; + + /** + * Body param: + */ + zdr?: boolean; } export interface AIGatewayUpdateParams { @@ -835,6 +850,11 @@ export interface AIGatewayUpdateParams { * Body param: */ stripe?: AIGatewayUpdateParams.Stripe | null; + + /** + * Body param: + */ + zdr?: boolean; } export namespace AIGatewayUpdateParams { diff --git a/src/resources/ai/ai.ts b/src/resources/ai/ai.ts index a6774c28a0..3d1778abe1 100644 --- a/src/resources/ai/ai.ts +++ b/src/resources/ai/ai.ts @@ -9,6 +9,9 @@ import { TaskListParams, TaskListResponse, TaskListResponsesSinglePage, Tasks } import * as ToMarkdownAPI from './to-markdown'; import { ToMarkdown, + ToMarkdownSupportedParams, + ToMarkdownSupportedResponse, + ToMarkdownSupportedResponsesSinglePage, ToMarkdownTransformParams, ToMarkdownTransformResponse, ToMarkdownTransformResponsesSinglePage, @@ -1063,6 +1066,7 @@ AI.TaskListResponsesSinglePage = TaskListResponsesSinglePage; AI.Models = Models; AI.ModelListResponsesV4PagePaginationArray = ModelListResponsesV4PagePaginationArray; AI.ToMarkdown = ToMarkdown; +AI.ToMarkdownSupportedResponsesSinglePage = ToMarkdownSupportedResponsesSinglePage; AI.ToMarkdownTransformResponsesSinglePage = ToMarkdownTransformResponsesSinglePage; export declare namespace AI { @@ -1099,8 +1103,11 @@ export declare namespace AI { export { ToMarkdown as ToMarkdown, + type ToMarkdownSupportedResponse as ToMarkdownSupportedResponse, type ToMarkdownTransformResponse as ToMarkdownTransformResponse, + ToMarkdownSupportedResponsesSinglePage as ToMarkdownSupportedResponsesSinglePage, ToMarkdownTransformResponsesSinglePage as ToMarkdownTransformResponsesSinglePage, + type ToMarkdownSupportedParams as ToMarkdownSupportedParams, type ToMarkdownTransformParams as ToMarkdownTransformParams, }; } diff --git a/src/resources/ai/index.ts b/src/resources/ai/index.ts index 213e475dd2..60f0842740 100644 --- a/src/resources/ai/index.ts +++ b/src/resources/ai/index.ts @@ -22,8 +22,11 @@ export { } from './models/index'; export { TaskListResponsesSinglePage, Tasks, type TaskListResponse, type TaskListParams } from './tasks'; export { + ToMarkdownSupportedResponsesSinglePage, ToMarkdownTransformResponsesSinglePage, ToMarkdown, + type ToMarkdownSupportedResponse, type ToMarkdownTransformResponse, + type ToMarkdownSupportedParams, type ToMarkdownTransformParams, } from './to-markdown'; diff --git a/src/resources/ai/to-markdown.ts b/src/resources/ai/to-markdown.ts index 8c075a3a75..319d2ea8c1 100644 --- a/src/resources/ai/to-markdown.ts +++ b/src/resources/ai/to-markdown.ts @@ -6,6 +6,21 @@ import { SinglePage } from '../../pagination'; import { type BlobLike } from '../../uploads'; export class ToMarkdown extends APIResource { + /** + * Get all converted formats supported + */ + supported( + params: ToMarkdownSupportedParams, + options?: Core.RequestOptions, + ): Core.PagePromise { + const { account_id } = params; + return this._client.getAPIList( + `/accounts/${account_id}/ai/tomarkdown/supported`, + ToMarkdownSupportedResponsesSinglePage, + options, + ); + } + /** * Convert Files into Markdown */ @@ -29,8 +44,16 @@ export class ToMarkdown extends APIResource { } } +export class ToMarkdownSupportedResponsesSinglePage extends SinglePage {} + export class ToMarkdownTransformResponsesSinglePage extends SinglePage {} +export interface ToMarkdownSupportedResponse { + extension: string; + + mimeType: string; +} + export interface ToMarkdownTransformResponse { data: string; @@ -43,6 +66,10 @@ export interface ToMarkdownTransformResponse { tokens: string; } +export interface ToMarkdownSupportedParams { + account_id: string; +} + export interface ToMarkdownTransformParams { /** * Path param: @@ -50,12 +77,16 @@ export interface ToMarkdownTransformParams { account_id: string; } +ToMarkdown.ToMarkdownSupportedResponsesSinglePage = ToMarkdownSupportedResponsesSinglePage; ToMarkdown.ToMarkdownTransformResponsesSinglePage = ToMarkdownTransformResponsesSinglePage; export declare namespace ToMarkdown { export { + type ToMarkdownSupportedResponse as ToMarkdownSupportedResponse, type ToMarkdownTransformResponse as ToMarkdownTransformResponse, + ToMarkdownSupportedResponsesSinglePage as ToMarkdownSupportedResponsesSinglePage, ToMarkdownTransformResponsesSinglePage as ToMarkdownTransformResponsesSinglePage, + type ToMarkdownSupportedParams as ToMarkdownSupportedParams, type ToMarkdownTransformParams as ToMarkdownTransformParams, }; } diff --git a/src/resources/aisearch.ts b/src/resources/aisearch.ts new file mode 100644 index 0000000000..97b1aac883 --- /dev/null +++ b/src/resources/aisearch.ts @@ -0,0 +1,3 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export * from './aisearch/index'; diff --git a/src/resources/aisearch/aisearch.ts b/src/resources/aisearch/aisearch.ts new file mode 100644 index 0000000000..38fe1486d6 --- /dev/null +++ b/src/resources/aisearch/aisearch.ts @@ -0,0 +1,79 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../resource'; +import * as TokensAPI from './tokens'; +import { + TokenCreateParams, + TokenCreateResponse, + TokenDeleteParams, + TokenDeleteResponse, + TokenListParams, + TokenListResponse, + TokenListResponsesV4PagePaginationArray, + TokenReadParams, + TokenReadResponse, + TokenUpdateParams, + TokenUpdateResponse, + Tokens, +} from './tokens'; +import * as InstancesAPI from './instances/instances'; +import { + InstanceCreateParams, + InstanceCreateResponse, + InstanceDeleteParams, + InstanceDeleteResponse, + InstanceListParams, + InstanceListResponse, + InstanceListResponsesV4PagePaginationArray, + InstanceReadParams, + InstanceReadResponse, + InstanceStatsParams, + InstanceStatsResponse, + InstanceUpdateParams, + InstanceUpdateResponse, + Instances, +} from './instances/instances'; + +export class AISearch extends APIResource { + instances: InstancesAPI.Instances = new InstancesAPI.Instances(this._client); + tokens: TokensAPI.Tokens = new TokensAPI.Tokens(this._client); +} + +AISearch.Instances = Instances; +AISearch.InstanceListResponsesV4PagePaginationArray = InstanceListResponsesV4PagePaginationArray; +AISearch.Tokens = Tokens; +AISearch.TokenListResponsesV4PagePaginationArray = TokenListResponsesV4PagePaginationArray; + +export declare namespace AISearch { + export { + Instances as Instances, + type InstanceCreateResponse as InstanceCreateResponse, + type InstanceUpdateResponse as InstanceUpdateResponse, + type InstanceListResponse as InstanceListResponse, + type InstanceDeleteResponse as InstanceDeleteResponse, + type InstanceReadResponse as InstanceReadResponse, + type InstanceStatsResponse as InstanceStatsResponse, + InstanceListResponsesV4PagePaginationArray as InstanceListResponsesV4PagePaginationArray, + type InstanceCreateParams as InstanceCreateParams, + type InstanceUpdateParams as InstanceUpdateParams, + type InstanceListParams as InstanceListParams, + type InstanceDeleteParams as InstanceDeleteParams, + type InstanceReadParams as InstanceReadParams, + type InstanceStatsParams as InstanceStatsParams, + }; + + export { + Tokens as Tokens, + type TokenCreateResponse as TokenCreateResponse, + type TokenUpdateResponse as TokenUpdateResponse, + type TokenListResponse as TokenListResponse, + type TokenDeleteResponse as TokenDeleteResponse, + type TokenReadResponse as TokenReadResponse, + TokenListResponsesV4PagePaginationArray as TokenListResponsesV4PagePaginationArray, + type TokenCreateParams as TokenCreateParams, + type TokenUpdateParams as TokenUpdateParams, + type TokenListParams as TokenListParams, + type TokenDeleteParams as TokenDeleteParams, + type TokenReadParams as TokenReadParams, + }; +} diff --git a/src/resources/aisearch/index.ts b/src/resources/aisearch/index.ts new file mode 100644 index 0000000000..f81ab35006 --- /dev/null +++ b/src/resources/aisearch/index.ts @@ -0,0 +1,33 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { AISearch } from './aisearch'; +export { + InstanceListResponsesV4PagePaginationArray, + Instances, + type InstanceCreateResponse, + type InstanceUpdateResponse, + type InstanceListResponse, + type InstanceDeleteResponse, + type InstanceReadResponse, + type InstanceStatsResponse, + type InstanceCreateParams, + type InstanceUpdateParams, + type InstanceListParams, + type InstanceDeleteParams, + type InstanceReadParams, + type InstanceStatsParams, +} from './instances/index'; +export { + TokenListResponsesV4PagePaginationArray, + Tokens, + type TokenCreateResponse, + type TokenUpdateResponse, + type TokenListResponse, + type TokenDeleteResponse, + type TokenReadResponse, + type TokenCreateParams, + type TokenUpdateParams, + type TokenListParams, + type TokenDeleteParams, + type TokenReadParams, +} from './tokens'; diff --git a/src/resources/aisearch/instances.ts b/src/resources/aisearch/instances.ts new file mode 100644 index 0000000000..e3873a7498 --- /dev/null +++ b/src/resources/aisearch/instances.ts @@ -0,0 +1,3 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export * from './instances/index'; diff --git a/src/resources/aisearch/instances/index.ts b/src/resources/aisearch/instances/index.ts new file mode 100644 index 0000000000..392d8edc2e --- /dev/null +++ b/src/resources/aisearch/instances/index.ts @@ -0,0 +1,38 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { + InstanceListResponsesV4PagePaginationArray, + Instances, + type InstanceCreateResponse, + type InstanceUpdateResponse, + type InstanceListResponse, + type InstanceDeleteResponse, + type InstanceReadResponse, + type InstanceStatsResponse, + type InstanceCreateParams, + type InstanceUpdateParams, + type InstanceListParams, + type InstanceDeleteParams, + type InstanceReadParams, + type InstanceStatsParams, +} from './instances'; +export { + ItemListResponsesV4PagePaginationArray, + Items, + type ItemListResponse, + type ItemGetResponse, + type ItemListParams, + type ItemGetParams, +} from './items'; +export { + JobListResponsesV4PagePaginationArray, + Jobs, + type JobCreateResponse, + type JobListResponse, + type JobGetResponse, + type JobLogsResponse, + type JobCreateParams, + type JobListParams, + type JobGetParams, + type JobLogsParams, +} from './jobs'; diff --git a/src/resources/aisearch/instances/instances.ts b/src/resources/aisearch/instances/instances.ts new file mode 100644 index 0000000000..a380f4aad5 --- /dev/null +++ b/src/resources/aisearch/instances/instances.ts @@ -0,0 +1,1875 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../resource'; +import * as Core from '../../../core'; +import * as ItemsAPI from './items'; +import { + ItemGetParams, + ItemGetResponse, + ItemListParams, + ItemListResponse, + ItemListResponsesV4PagePaginationArray, + Items, +} from './items'; +import * as JobsAPI from './jobs'; +import { + JobCreateParams, + JobCreateResponse, + JobGetParams, + JobGetResponse, + JobListParams, + JobListResponse, + JobListResponsesV4PagePaginationArray, + JobLogsParams, + JobLogsResponse, + Jobs, +} from './jobs'; +import * as SippyAPI from '../../r2/buckets/sippy'; +import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../../pagination'; + +export class Instances extends APIResource { + items: ItemsAPI.Items = new ItemsAPI.Items(this._client); + jobs: JobsAPI.Jobs = new JobsAPI.Jobs(this._client); + + /** + * Create new instances. + * + * @example + * ```ts + * const instance = await client.aiSearch.instances.create({ + * account_id: 'c3dc5f0b34a14ff8e1b3ec04895e1b22', + * id: 'my-ai-search', + * source: 'source', + * token_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + * type: 'r2', + * }); + * ``` + */ + create( + params: InstanceCreateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.post(`/accounts/${account_id}/ai-search/instances`, { + body, + ...options, + }) as Core.APIPromise<{ result: InstanceCreateResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Update instances. + * + * @example + * ```ts + * const instance = await client.aiSearch.instances.update( + * 'my-ai-search', + * { account_id: 'c3dc5f0b34a14ff8e1b3ec04895e1b22' }, + * ); + * ``` + */ + update( + id: string, + params: InstanceUpdateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.put(`/accounts/${account_id}/ai-search/instances/${id}`, { + body, + ...options, + }) as Core.APIPromise<{ result: InstanceUpdateResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * List instances. + * + * @example + * ```ts + * // Automatically fetches more pages as needed. + * for await (const instanceListResponse of client.aiSearch.instances.list( + * { account_id: 'c3dc5f0b34a14ff8e1b3ec04895e1b22' }, + * )) { + * // ... + * } + * ``` + */ + list( + params: InstanceListParams, + options?: Core.RequestOptions, + ): Core.PagePromise { + const { account_id, ...query } = params; + return this._client.getAPIList( + `/accounts/${account_id}/ai-search/instances`, + InstanceListResponsesV4PagePaginationArray, + { query, ...options }, + ); + } + + /** + * Delete instances. + * + * @example + * ```ts + * const instance = await client.aiSearch.instances.delete( + * 'my-ai-search', + * { account_id: 'c3dc5f0b34a14ff8e1b3ec04895e1b22' }, + * ); + * ``` + */ + delete( + id: string, + params: InstanceDeleteParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.delete(`/accounts/${account_id}/ai-search/instances/${id}`, options) as Core.APIPromise<{ + result: InstanceDeleteResponse; + }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Read instances. + * + * @example + * ```ts + * const response = await client.aiSearch.instances.read( + * 'my-ai-search', + * { account_id: 'c3dc5f0b34a14ff8e1b3ec04895e1b22' }, + * ); + * ``` + */ + read( + id: string, + params: InstanceReadParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.get(`/accounts/${account_id}/ai-search/instances/${id}`, options) as Core.APIPromise<{ + result: InstanceReadResponse; + }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Stats + * + * @example + * ```ts + * const response = await client.aiSearch.instances.stats( + * 'my-ai-search', + * { account_id: 'c3dc5f0b34a14ff8e1b3ec04895e1b22' }, + * ); + * ``` + */ + stats( + id: string, + params: InstanceStatsParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.get( + `/accounts/${account_id}/ai-search/instances/${id}/stats`, + options, + ) as Core.APIPromise<{ result: InstanceStatsResponse }> + )._thenUnwrap((obj) => obj.result); + } +} + +export class InstanceListResponsesV4PagePaginationArray extends V4PagePaginationArray {} + +export interface InstanceCreateResponse { + /** + * Use your AI Search ID. + */ + id: string; + + account_id: string; + + account_tag: string; + + created_at: string; + + internal_id: string; + + modified_at: string; + + source: string; + + token_id: string; + + type: 'r2' | 'web-crawler'; + + vectorize_name: string; + + ai_gateway_id?: string; + + ai_search_model?: + | '@cf/meta/llama-3.3-70b-instruct-fp8-fast' + | '@cf/meta/llama-3.1-8b-instruct-fast' + | '@cf/meta/llama-3.1-8b-instruct-fp8' + | '@cf/meta/llama-4-scout-17b-16e-instruct' + | '@cf/qwen/qwen3-30b-a3b-fp8' + | '@cf/deepseek-ai/deepseek-r1-distill-qwen-32b' + | '@cf/moonshotai/kimi-k2-instruct' + | 'anthropic/claude-3-7-sonnet' + | 'anthropic/claude-sonnet-4' + | 'anthropic/claude-opus-4' + | 'anthropic/claude-3-5-haiku' + | 'cerebras/qwen-3-235b-a22b-instruct' + | 'cerebras/qwen-3-235b-a22b-thinking' + | 'cerebras/llama-3.3-70b' + | 'cerebras/llama-4-maverick-17b-128e-instruct' + | 'cerebras/llama-4-scout-17b-16e-instruct' + | 'cerebras/gpt-oss-120b' + | 'google-ai-studio/gemini-2.5-flash' + | 'google-ai-studio/gemini-2.5-pro' + | 'grok/grok-4' + | 'groq/llama-3.3-70b-versatile' + | 'groq/llama-3.1-8b-instant' + | 'openai/gpt-5' + | 'openai/gpt-5-mini' + | 'openai/gpt-5-nano' + | ''; + + cache?: boolean; + + cache_threshold?: 'super_strict_match' | 'close_enough' | 'flexible_friend' | 'anything_goes'; + + chunk?: boolean; + + chunk_overlap?: number; + + chunk_size?: number; + + created_by?: string; + + embedding_model?: + | '@cf/baai/bge-m3' + | '@cf/baai/bge-large-en-v1.5' + | '@cf/google/embeddinggemma-300m' + | '@cf/qwen/qwen3-embedding-0.6b' + | 'google-ai-studio/gemini-embedding-001' + | 'openai/text-embedding-3-small' + | 'openai/text-embedding-3-large' + | ''; + + enable?: boolean; + + engine_version?: number; + + last_activity?: string; + + max_num_results?: number; + + metadata?: InstanceCreateResponse.Metadata; + + modified_by?: string; + + paused?: boolean; + + reranking?: boolean; + + reranking_model?: '@cf/baai/bge-reranker-base' | ''; + + rewrite_model?: + | '@cf/meta/llama-3.3-70b-instruct-fp8-fast' + | '@cf/meta/llama-3.1-8b-instruct-fast' + | '@cf/meta/llama-3.1-8b-instruct-fp8' + | '@cf/meta/llama-4-scout-17b-16e-instruct' + | '@cf/qwen/qwen3-30b-a3b-fp8' + | '@cf/deepseek-ai/deepseek-r1-distill-qwen-32b' + | '@cf/moonshotai/kimi-k2-instruct' + | 'anthropic/claude-3-7-sonnet' + | 'anthropic/claude-sonnet-4' + | 'anthropic/claude-opus-4' + | 'anthropic/claude-3-5-haiku' + | 'cerebras/qwen-3-235b-a22b-instruct' + | 'cerebras/qwen-3-235b-a22b-thinking' + | 'cerebras/llama-3.3-70b' + | 'cerebras/llama-4-maverick-17b-128e-instruct' + | 'cerebras/llama-4-scout-17b-16e-instruct' + | 'cerebras/gpt-oss-120b' + | 'google-ai-studio/gemini-2.5-flash' + | 'google-ai-studio/gemini-2.5-pro' + | 'grok/grok-4' + | 'groq/llama-3.3-70b-versatile' + | 'groq/llama-3.1-8b-instant' + | 'openai/gpt-5' + | 'openai/gpt-5-mini' + | 'openai/gpt-5-nano' + | ''; + + rewrite_query?: boolean; + + score_threshold?: number; + + source_params?: InstanceCreateResponse.SourceParams; + + status?: string; + + summarization?: boolean; + + summarization_model?: + | '@cf/meta/llama-3.3-70b-instruct-fp8-fast' + | '@cf/meta/llama-3.1-8b-instruct-fast' + | '@cf/meta/llama-3.1-8b-instruct-fp8' + | '@cf/meta/llama-4-scout-17b-16e-instruct' + | '@cf/qwen/qwen3-30b-a3b-fp8' + | '@cf/deepseek-ai/deepseek-r1-distill-qwen-32b' + | '@cf/moonshotai/kimi-k2-instruct' + | 'anthropic/claude-3-7-sonnet' + | 'anthropic/claude-sonnet-4' + | 'anthropic/claude-opus-4' + | 'anthropic/claude-3-5-haiku' + | 'cerebras/qwen-3-235b-a22b-instruct' + | 'cerebras/qwen-3-235b-a22b-thinking' + | 'cerebras/llama-3.3-70b' + | 'cerebras/llama-4-maverick-17b-128e-instruct' + | 'cerebras/llama-4-scout-17b-16e-instruct' + | 'cerebras/gpt-oss-120b' + | 'google-ai-studio/gemini-2.5-flash' + | 'google-ai-studio/gemini-2.5-pro' + | 'grok/grok-4' + | 'groq/llama-3.3-70b-versatile' + | 'groq/llama-3.1-8b-instant' + | 'openai/gpt-5' + | 'openai/gpt-5-mini' + | 'openai/gpt-5-nano' + | ''; + + system_prompt_ai_search?: string; + + system_prompt_index_summarization?: string; + + system_prompt_rewrite_query?: string; + + vectorize_active_namespace?: string; +} + +export namespace InstanceCreateResponse { + export interface Metadata { + created_from_aisearch_wizard?: boolean; + + worker_domain?: string; + } + + export interface SourceParams { + /** + * List of path patterns to exclude. Supports wildcards (e.g., _/admin/_, + * /private/\*_, _\private\*) + */ + exclude_items?: Array; + + /** + * List of path patterns to include. Supports wildcards (e.g., _/blog/_.html, + * /docs/\*_, _\blog\*.html) + */ + include_items?: Array; + + prefix?: string; + + r2_jurisdiction?: string; + + web_crawler?: SourceParams.WebCrawler; + } + + export namespace SourceParams { + export interface WebCrawler { + parse_options?: WebCrawler.ParseOptions; + + parse_type?: 'sitemap' | 'feed-rss'; + + store_options?: WebCrawler.StoreOptions; + } + + export namespace WebCrawler { + export interface ParseOptions { + include_headers?: { [key: string]: string }; + + include_images?: boolean; + + use_browser_rendering?: boolean; + } + + export interface StoreOptions { + storage_id: string; + + r2_jurisdiction?: string; + + storage_type?: SippyAPI.Provider; + } + } + } +} + +export interface InstanceUpdateResponse { + /** + * Use your AI Search ID. + */ + id: string; + + account_id: string; + + account_tag: string; + + created_at: string; + + internal_id: string; + + modified_at: string; + + source: string; + + token_id: string; + + type: 'r2' | 'web-crawler'; + + vectorize_name: string; + + ai_gateway_id?: string; + + ai_search_model?: + | '@cf/meta/llama-3.3-70b-instruct-fp8-fast' + | '@cf/meta/llama-3.1-8b-instruct-fast' + | '@cf/meta/llama-3.1-8b-instruct-fp8' + | '@cf/meta/llama-4-scout-17b-16e-instruct' + | '@cf/qwen/qwen3-30b-a3b-fp8' + | '@cf/deepseek-ai/deepseek-r1-distill-qwen-32b' + | '@cf/moonshotai/kimi-k2-instruct' + | 'anthropic/claude-3-7-sonnet' + | 'anthropic/claude-sonnet-4' + | 'anthropic/claude-opus-4' + | 'anthropic/claude-3-5-haiku' + | 'cerebras/qwen-3-235b-a22b-instruct' + | 'cerebras/qwen-3-235b-a22b-thinking' + | 'cerebras/llama-3.3-70b' + | 'cerebras/llama-4-maverick-17b-128e-instruct' + | 'cerebras/llama-4-scout-17b-16e-instruct' + | 'cerebras/gpt-oss-120b' + | 'google-ai-studio/gemini-2.5-flash' + | 'google-ai-studio/gemini-2.5-pro' + | 'grok/grok-4' + | 'groq/llama-3.3-70b-versatile' + | 'groq/llama-3.1-8b-instant' + | 'openai/gpt-5' + | 'openai/gpt-5-mini' + | 'openai/gpt-5-nano' + | ''; + + cache?: boolean; + + cache_threshold?: 'super_strict_match' | 'close_enough' | 'flexible_friend' | 'anything_goes'; + + chunk?: boolean; + + chunk_overlap?: number; + + chunk_size?: number; + + created_by?: string; + + embedding_model?: + | '@cf/baai/bge-m3' + | '@cf/baai/bge-large-en-v1.5' + | '@cf/google/embeddinggemma-300m' + | '@cf/qwen/qwen3-embedding-0.6b' + | 'google-ai-studio/gemini-embedding-001' + | 'openai/text-embedding-3-small' + | 'openai/text-embedding-3-large' + | ''; + + enable?: boolean; + + engine_version?: number; + + last_activity?: string; + + max_num_results?: number; + + metadata?: InstanceUpdateResponse.Metadata; + + modified_by?: string; + + paused?: boolean; + + reranking?: boolean; + + reranking_model?: '@cf/baai/bge-reranker-base' | ''; + + rewrite_model?: + | '@cf/meta/llama-3.3-70b-instruct-fp8-fast' + | '@cf/meta/llama-3.1-8b-instruct-fast' + | '@cf/meta/llama-3.1-8b-instruct-fp8' + | '@cf/meta/llama-4-scout-17b-16e-instruct' + | '@cf/qwen/qwen3-30b-a3b-fp8' + | '@cf/deepseek-ai/deepseek-r1-distill-qwen-32b' + | '@cf/moonshotai/kimi-k2-instruct' + | 'anthropic/claude-3-7-sonnet' + | 'anthropic/claude-sonnet-4' + | 'anthropic/claude-opus-4' + | 'anthropic/claude-3-5-haiku' + | 'cerebras/qwen-3-235b-a22b-instruct' + | 'cerebras/qwen-3-235b-a22b-thinking' + | 'cerebras/llama-3.3-70b' + | 'cerebras/llama-4-maverick-17b-128e-instruct' + | 'cerebras/llama-4-scout-17b-16e-instruct' + | 'cerebras/gpt-oss-120b' + | 'google-ai-studio/gemini-2.5-flash' + | 'google-ai-studio/gemini-2.5-pro' + | 'grok/grok-4' + | 'groq/llama-3.3-70b-versatile' + | 'groq/llama-3.1-8b-instant' + | 'openai/gpt-5' + | 'openai/gpt-5-mini' + | 'openai/gpt-5-nano' + | ''; + + rewrite_query?: boolean; + + score_threshold?: number; + + source_params?: InstanceUpdateResponse.SourceParams; + + status?: string; + + summarization?: boolean; + + summarization_model?: + | '@cf/meta/llama-3.3-70b-instruct-fp8-fast' + | '@cf/meta/llama-3.1-8b-instruct-fast' + | '@cf/meta/llama-3.1-8b-instruct-fp8' + | '@cf/meta/llama-4-scout-17b-16e-instruct' + | '@cf/qwen/qwen3-30b-a3b-fp8' + | '@cf/deepseek-ai/deepseek-r1-distill-qwen-32b' + | '@cf/moonshotai/kimi-k2-instruct' + | 'anthropic/claude-3-7-sonnet' + | 'anthropic/claude-sonnet-4' + | 'anthropic/claude-opus-4' + | 'anthropic/claude-3-5-haiku' + | 'cerebras/qwen-3-235b-a22b-instruct' + | 'cerebras/qwen-3-235b-a22b-thinking' + | 'cerebras/llama-3.3-70b' + | 'cerebras/llama-4-maverick-17b-128e-instruct' + | 'cerebras/llama-4-scout-17b-16e-instruct' + | 'cerebras/gpt-oss-120b' + | 'google-ai-studio/gemini-2.5-flash' + | 'google-ai-studio/gemini-2.5-pro' + | 'grok/grok-4' + | 'groq/llama-3.3-70b-versatile' + | 'groq/llama-3.1-8b-instant' + | 'openai/gpt-5' + | 'openai/gpt-5-mini' + | 'openai/gpt-5-nano' + | ''; + + system_prompt_ai_search?: string; + + system_prompt_index_summarization?: string; + + system_prompt_rewrite_query?: string; + + vectorize_active_namespace?: string; +} + +export namespace InstanceUpdateResponse { + export interface Metadata { + created_from_aisearch_wizard?: boolean; + + worker_domain?: string; + } + + export interface SourceParams { + /** + * List of path patterns to exclude. Supports wildcards (e.g., _/admin/_, + * /private/\*_, _\private\*) + */ + exclude_items?: Array; + + /** + * List of path patterns to include. Supports wildcards (e.g., _/blog/_.html, + * /docs/\*_, _\blog\*.html) + */ + include_items?: Array; + + prefix?: string; + + r2_jurisdiction?: string; + + web_crawler?: SourceParams.WebCrawler; + } + + export namespace SourceParams { + export interface WebCrawler { + parse_options?: WebCrawler.ParseOptions; + + parse_type?: 'sitemap' | 'feed-rss'; + + store_options?: WebCrawler.StoreOptions; + } + + export namespace WebCrawler { + export interface ParseOptions { + include_headers?: { [key: string]: string }; + + include_images?: boolean; + + use_browser_rendering?: boolean; + } + + export interface StoreOptions { + storage_id: string; + + r2_jurisdiction?: string; + + storage_type?: SippyAPI.Provider; + } + } + } +} + +export interface InstanceListResponse { + /** + * Use your AI Search ID. + */ + id: string; + + account_id: string; + + account_tag: string; + + created_at: string; + + internal_id: string; + + modified_at: string; + + source: string; + + token_id: string; + + type: 'r2' | 'web-crawler'; + + vectorize_name: string; + + ai_gateway_id?: string; + + ai_search_model?: + | '@cf/meta/llama-3.3-70b-instruct-fp8-fast' + | '@cf/meta/llama-3.1-8b-instruct-fast' + | '@cf/meta/llama-3.1-8b-instruct-fp8' + | '@cf/meta/llama-4-scout-17b-16e-instruct' + | '@cf/qwen/qwen3-30b-a3b-fp8' + | '@cf/deepseek-ai/deepseek-r1-distill-qwen-32b' + | '@cf/moonshotai/kimi-k2-instruct' + | 'anthropic/claude-3-7-sonnet' + | 'anthropic/claude-sonnet-4' + | 'anthropic/claude-opus-4' + | 'anthropic/claude-3-5-haiku' + | 'cerebras/qwen-3-235b-a22b-instruct' + | 'cerebras/qwen-3-235b-a22b-thinking' + | 'cerebras/llama-3.3-70b' + | 'cerebras/llama-4-maverick-17b-128e-instruct' + | 'cerebras/llama-4-scout-17b-16e-instruct' + | 'cerebras/gpt-oss-120b' + | 'google-ai-studio/gemini-2.5-flash' + | 'google-ai-studio/gemini-2.5-pro' + | 'grok/grok-4' + | 'groq/llama-3.3-70b-versatile' + | 'groq/llama-3.1-8b-instant' + | 'openai/gpt-5' + | 'openai/gpt-5-mini' + | 'openai/gpt-5-nano' + | ''; + + cache?: boolean; + + cache_threshold?: 'super_strict_match' | 'close_enough' | 'flexible_friend' | 'anything_goes'; + + chunk?: boolean; + + chunk_overlap?: number; + + chunk_size?: number; + + created_by?: string; + + embedding_model?: + | '@cf/baai/bge-m3' + | '@cf/baai/bge-large-en-v1.5' + | '@cf/google/embeddinggemma-300m' + | '@cf/qwen/qwen3-embedding-0.6b' + | 'google-ai-studio/gemini-embedding-001' + | 'openai/text-embedding-3-small' + | 'openai/text-embedding-3-large' + | ''; + + enable?: boolean; + + engine_version?: number; + + last_activity?: string; + + max_num_results?: number; + + metadata?: InstanceListResponse.Metadata; + + modified_by?: string; + + paused?: boolean; + + reranking?: boolean; + + reranking_model?: '@cf/baai/bge-reranker-base' | ''; + + rewrite_model?: + | '@cf/meta/llama-3.3-70b-instruct-fp8-fast' + | '@cf/meta/llama-3.1-8b-instruct-fast' + | '@cf/meta/llama-3.1-8b-instruct-fp8' + | '@cf/meta/llama-4-scout-17b-16e-instruct' + | '@cf/qwen/qwen3-30b-a3b-fp8' + | '@cf/deepseek-ai/deepseek-r1-distill-qwen-32b' + | '@cf/moonshotai/kimi-k2-instruct' + | 'anthropic/claude-3-7-sonnet' + | 'anthropic/claude-sonnet-4' + | 'anthropic/claude-opus-4' + | 'anthropic/claude-3-5-haiku' + | 'cerebras/qwen-3-235b-a22b-instruct' + | 'cerebras/qwen-3-235b-a22b-thinking' + | 'cerebras/llama-3.3-70b' + | 'cerebras/llama-4-maverick-17b-128e-instruct' + | 'cerebras/llama-4-scout-17b-16e-instruct' + | 'cerebras/gpt-oss-120b' + | 'google-ai-studio/gemini-2.5-flash' + | 'google-ai-studio/gemini-2.5-pro' + | 'grok/grok-4' + | 'groq/llama-3.3-70b-versatile' + | 'groq/llama-3.1-8b-instant' + | 'openai/gpt-5' + | 'openai/gpt-5-mini' + | 'openai/gpt-5-nano' + | ''; + + rewrite_query?: boolean; + + score_threshold?: number; + + source_params?: InstanceListResponse.SourceParams; + + status?: string; + + summarization?: boolean; + + summarization_model?: + | '@cf/meta/llama-3.3-70b-instruct-fp8-fast' + | '@cf/meta/llama-3.1-8b-instruct-fast' + | '@cf/meta/llama-3.1-8b-instruct-fp8' + | '@cf/meta/llama-4-scout-17b-16e-instruct' + | '@cf/qwen/qwen3-30b-a3b-fp8' + | '@cf/deepseek-ai/deepseek-r1-distill-qwen-32b' + | '@cf/moonshotai/kimi-k2-instruct' + | 'anthropic/claude-3-7-sonnet' + | 'anthropic/claude-sonnet-4' + | 'anthropic/claude-opus-4' + | 'anthropic/claude-3-5-haiku' + | 'cerebras/qwen-3-235b-a22b-instruct' + | 'cerebras/qwen-3-235b-a22b-thinking' + | 'cerebras/llama-3.3-70b' + | 'cerebras/llama-4-maverick-17b-128e-instruct' + | 'cerebras/llama-4-scout-17b-16e-instruct' + | 'cerebras/gpt-oss-120b' + | 'google-ai-studio/gemini-2.5-flash' + | 'google-ai-studio/gemini-2.5-pro' + | 'grok/grok-4' + | 'groq/llama-3.3-70b-versatile' + | 'groq/llama-3.1-8b-instant' + | 'openai/gpt-5' + | 'openai/gpt-5-mini' + | 'openai/gpt-5-nano' + | ''; + + system_prompt_ai_search?: string; + + system_prompt_index_summarization?: string; + + system_prompt_rewrite_query?: string; + + vectorize_active_namespace?: string; +} + +export namespace InstanceListResponse { + export interface Metadata { + created_from_aisearch_wizard?: boolean; + + worker_domain?: string; + } + + export interface SourceParams { + /** + * List of path patterns to exclude. Supports wildcards (e.g., _/admin/_, + * /private/\*_, _\private\*) + */ + exclude_items?: Array; + + /** + * List of path patterns to include. Supports wildcards (e.g., _/blog/_.html, + * /docs/\*_, _\blog\*.html) + */ + include_items?: Array; + + prefix?: string; + + r2_jurisdiction?: string; + + web_crawler?: SourceParams.WebCrawler; + } + + export namespace SourceParams { + export interface WebCrawler { + parse_options?: WebCrawler.ParseOptions; + + parse_type?: 'sitemap' | 'feed-rss'; + + store_options?: WebCrawler.StoreOptions; + } + + export namespace WebCrawler { + export interface ParseOptions { + include_headers?: { [key: string]: string }; + + include_images?: boolean; + + use_browser_rendering?: boolean; + } + + export interface StoreOptions { + storage_id: string; + + r2_jurisdiction?: string; + + storage_type?: SippyAPI.Provider; + } + } + } +} + +export interface InstanceDeleteResponse { + /** + * Use your AI Search ID. + */ + id: string; + + account_id: string; + + account_tag: string; + + created_at: string; + + internal_id: string; + + modified_at: string; + + source: string; + + token_id: string; + + type: 'r2' | 'web-crawler'; + + vectorize_name: string; + + ai_gateway_id?: string; + + ai_search_model?: + | '@cf/meta/llama-3.3-70b-instruct-fp8-fast' + | '@cf/meta/llama-3.1-8b-instruct-fast' + | '@cf/meta/llama-3.1-8b-instruct-fp8' + | '@cf/meta/llama-4-scout-17b-16e-instruct' + | '@cf/qwen/qwen3-30b-a3b-fp8' + | '@cf/deepseek-ai/deepseek-r1-distill-qwen-32b' + | '@cf/moonshotai/kimi-k2-instruct' + | 'anthropic/claude-3-7-sonnet' + | 'anthropic/claude-sonnet-4' + | 'anthropic/claude-opus-4' + | 'anthropic/claude-3-5-haiku' + | 'cerebras/qwen-3-235b-a22b-instruct' + | 'cerebras/qwen-3-235b-a22b-thinking' + | 'cerebras/llama-3.3-70b' + | 'cerebras/llama-4-maverick-17b-128e-instruct' + | 'cerebras/llama-4-scout-17b-16e-instruct' + | 'cerebras/gpt-oss-120b' + | 'google-ai-studio/gemini-2.5-flash' + | 'google-ai-studio/gemini-2.5-pro' + | 'grok/grok-4' + | 'groq/llama-3.3-70b-versatile' + | 'groq/llama-3.1-8b-instant' + | 'openai/gpt-5' + | 'openai/gpt-5-mini' + | 'openai/gpt-5-nano' + | ''; + + cache?: boolean; + + cache_threshold?: 'super_strict_match' | 'close_enough' | 'flexible_friend' | 'anything_goes'; + + chunk?: boolean; + + chunk_overlap?: number; + + chunk_size?: number; + + created_by?: string; + + embedding_model?: + | '@cf/baai/bge-m3' + | '@cf/baai/bge-large-en-v1.5' + | '@cf/google/embeddinggemma-300m' + | '@cf/qwen/qwen3-embedding-0.6b' + | 'google-ai-studio/gemini-embedding-001' + | 'openai/text-embedding-3-small' + | 'openai/text-embedding-3-large' + | ''; + + enable?: boolean; + + engine_version?: number; + + last_activity?: string; + + max_num_results?: number; + + metadata?: InstanceDeleteResponse.Metadata; + + modified_by?: string; + + paused?: boolean; + + reranking?: boolean; + + reranking_model?: '@cf/baai/bge-reranker-base' | ''; + + rewrite_model?: + | '@cf/meta/llama-3.3-70b-instruct-fp8-fast' + | '@cf/meta/llama-3.1-8b-instruct-fast' + | '@cf/meta/llama-3.1-8b-instruct-fp8' + | '@cf/meta/llama-4-scout-17b-16e-instruct' + | '@cf/qwen/qwen3-30b-a3b-fp8' + | '@cf/deepseek-ai/deepseek-r1-distill-qwen-32b' + | '@cf/moonshotai/kimi-k2-instruct' + | 'anthropic/claude-3-7-sonnet' + | 'anthropic/claude-sonnet-4' + | 'anthropic/claude-opus-4' + | 'anthropic/claude-3-5-haiku' + | 'cerebras/qwen-3-235b-a22b-instruct' + | 'cerebras/qwen-3-235b-a22b-thinking' + | 'cerebras/llama-3.3-70b' + | 'cerebras/llama-4-maverick-17b-128e-instruct' + | 'cerebras/llama-4-scout-17b-16e-instruct' + | 'cerebras/gpt-oss-120b' + | 'google-ai-studio/gemini-2.5-flash' + | 'google-ai-studio/gemini-2.5-pro' + | 'grok/grok-4' + | 'groq/llama-3.3-70b-versatile' + | 'groq/llama-3.1-8b-instant' + | 'openai/gpt-5' + | 'openai/gpt-5-mini' + | 'openai/gpt-5-nano' + | ''; + + rewrite_query?: boolean; + + score_threshold?: number; + + source_params?: InstanceDeleteResponse.SourceParams; + + status?: string; + + summarization?: boolean; + + summarization_model?: + | '@cf/meta/llama-3.3-70b-instruct-fp8-fast' + | '@cf/meta/llama-3.1-8b-instruct-fast' + | '@cf/meta/llama-3.1-8b-instruct-fp8' + | '@cf/meta/llama-4-scout-17b-16e-instruct' + | '@cf/qwen/qwen3-30b-a3b-fp8' + | '@cf/deepseek-ai/deepseek-r1-distill-qwen-32b' + | '@cf/moonshotai/kimi-k2-instruct' + | 'anthropic/claude-3-7-sonnet' + | 'anthropic/claude-sonnet-4' + | 'anthropic/claude-opus-4' + | 'anthropic/claude-3-5-haiku' + | 'cerebras/qwen-3-235b-a22b-instruct' + | 'cerebras/qwen-3-235b-a22b-thinking' + | 'cerebras/llama-3.3-70b' + | 'cerebras/llama-4-maverick-17b-128e-instruct' + | 'cerebras/llama-4-scout-17b-16e-instruct' + | 'cerebras/gpt-oss-120b' + | 'google-ai-studio/gemini-2.5-flash' + | 'google-ai-studio/gemini-2.5-pro' + | 'grok/grok-4' + | 'groq/llama-3.3-70b-versatile' + | 'groq/llama-3.1-8b-instant' + | 'openai/gpt-5' + | 'openai/gpt-5-mini' + | 'openai/gpt-5-nano' + | ''; + + system_prompt_ai_search?: string; + + system_prompt_index_summarization?: string; + + system_prompt_rewrite_query?: string; + + vectorize_active_namespace?: string; +} + +export namespace InstanceDeleteResponse { + export interface Metadata { + created_from_aisearch_wizard?: boolean; + + worker_domain?: string; + } + + export interface SourceParams { + /** + * List of path patterns to exclude. Supports wildcards (e.g., _/admin/_, + * /private/\*_, _\private\*) + */ + exclude_items?: Array; + + /** + * List of path patterns to include. Supports wildcards (e.g., _/blog/_.html, + * /docs/\*_, _\blog\*.html) + */ + include_items?: Array; + + prefix?: string; + + r2_jurisdiction?: string; + + web_crawler?: SourceParams.WebCrawler; + } + + export namespace SourceParams { + export interface WebCrawler { + parse_options?: WebCrawler.ParseOptions; + + parse_type?: 'sitemap' | 'feed-rss'; + + store_options?: WebCrawler.StoreOptions; + } + + export namespace WebCrawler { + export interface ParseOptions { + include_headers?: { [key: string]: string }; + + include_images?: boolean; + + use_browser_rendering?: boolean; + } + + export interface StoreOptions { + storage_id: string; + + r2_jurisdiction?: string; + + storage_type?: SippyAPI.Provider; + } + } + } +} + +export interface InstanceReadResponse { + /** + * Use your AI Search ID. + */ + id: string; + + account_id: string; + + account_tag: string; + + created_at: string; + + internal_id: string; + + modified_at: string; + + source: string; + + token_id: string; + + type: 'r2' | 'web-crawler'; + + vectorize_name: string; + + ai_gateway_id?: string; + + ai_search_model?: + | '@cf/meta/llama-3.3-70b-instruct-fp8-fast' + | '@cf/meta/llama-3.1-8b-instruct-fast' + | '@cf/meta/llama-3.1-8b-instruct-fp8' + | '@cf/meta/llama-4-scout-17b-16e-instruct' + | '@cf/qwen/qwen3-30b-a3b-fp8' + | '@cf/deepseek-ai/deepseek-r1-distill-qwen-32b' + | '@cf/moonshotai/kimi-k2-instruct' + | 'anthropic/claude-3-7-sonnet' + | 'anthropic/claude-sonnet-4' + | 'anthropic/claude-opus-4' + | 'anthropic/claude-3-5-haiku' + | 'cerebras/qwen-3-235b-a22b-instruct' + | 'cerebras/qwen-3-235b-a22b-thinking' + | 'cerebras/llama-3.3-70b' + | 'cerebras/llama-4-maverick-17b-128e-instruct' + | 'cerebras/llama-4-scout-17b-16e-instruct' + | 'cerebras/gpt-oss-120b' + | 'google-ai-studio/gemini-2.5-flash' + | 'google-ai-studio/gemini-2.5-pro' + | 'grok/grok-4' + | 'groq/llama-3.3-70b-versatile' + | 'groq/llama-3.1-8b-instant' + | 'openai/gpt-5' + | 'openai/gpt-5-mini' + | 'openai/gpt-5-nano' + | ''; + + cache?: boolean; + + cache_threshold?: 'super_strict_match' | 'close_enough' | 'flexible_friend' | 'anything_goes'; + + chunk?: boolean; + + chunk_overlap?: number; + + chunk_size?: number; + + created_by?: string; + + embedding_model?: + | '@cf/baai/bge-m3' + | '@cf/baai/bge-large-en-v1.5' + | '@cf/google/embeddinggemma-300m' + | '@cf/qwen/qwen3-embedding-0.6b' + | 'google-ai-studio/gemini-embedding-001' + | 'openai/text-embedding-3-small' + | 'openai/text-embedding-3-large' + | ''; + + enable?: boolean; + + engine_version?: number; + + last_activity?: string; + + max_num_results?: number; + + metadata?: InstanceReadResponse.Metadata; + + modified_by?: string; + + paused?: boolean; + + reranking?: boolean; + + reranking_model?: '@cf/baai/bge-reranker-base' | ''; + + rewrite_model?: + | '@cf/meta/llama-3.3-70b-instruct-fp8-fast' + | '@cf/meta/llama-3.1-8b-instruct-fast' + | '@cf/meta/llama-3.1-8b-instruct-fp8' + | '@cf/meta/llama-4-scout-17b-16e-instruct' + | '@cf/qwen/qwen3-30b-a3b-fp8' + | '@cf/deepseek-ai/deepseek-r1-distill-qwen-32b' + | '@cf/moonshotai/kimi-k2-instruct' + | 'anthropic/claude-3-7-sonnet' + | 'anthropic/claude-sonnet-4' + | 'anthropic/claude-opus-4' + | 'anthropic/claude-3-5-haiku' + | 'cerebras/qwen-3-235b-a22b-instruct' + | 'cerebras/qwen-3-235b-a22b-thinking' + | 'cerebras/llama-3.3-70b' + | 'cerebras/llama-4-maverick-17b-128e-instruct' + | 'cerebras/llama-4-scout-17b-16e-instruct' + | 'cerebras/gpt-oss-120b' + | 'google-ai-studio/gemini-2.5-flash' + | 'google-ai-studio/gemini-2.5-pro' + | 'grok/grok-4' + | 'groq/llama-3.3-70b-versatile' + | 'groq/llama-3.1-8b-instant' + | 'openai/gpt-5' + | 'openai/gpt-5-mini' + | 'openai/gpt-5-nano' + | ''; + + rewrite_query?: boolean; + + score_threshold?: number; + + source_params?: InstanceReadResponse.SourceParams; + + status?: string; + + summarization?: boolean; + + summarization_model?: + | '@cf/meta/llama-3.3-70b-instruct-fp8-fast' + | '@cf/meta/llama-3.1-8b-instruct-fast' + | '@cf/meta/llama-3.1-8b-instruct-fp8' + | '@cf/meta/llama-4-scout-17b-16e-instruct' + | '@cf/qwen/qwen3-30b-a3b-fp8' + | '@cf/deepseek-ai/deepseek-r1-distill-qwen-32b' + | '@cf/moonshotai/kimi-k2-instruct' + | 'anthropic/claude-3-7-sonnet' + | 'anthropic/claude-sonnet-4' + | 'anthropic/claude-opus-4' + | 'anthropic/claude-3-5-haiku' + | 'cerebras/qwen-3-235b-a22b-instruct' + | 'cerebras/qwen-3-235b-a22b-thinking' + | 'cerebras/llama-3.3-70b' + | 'cerebras/llama-4-maverick-17b-128e-instruct' + | 'cerebras/llama-4-scout-17b-16e-instruct' + | 'cerebras/gpt-oss-120b' + | 'google-ai-studio/gemini-2.5-flash' + | 'google-ai-studio/gemini-2.5-pro' + | 'grok/grok-4' + | 'groq/llama-3.3-70b-versatile' + | 'groq/llama-3.1-8b-instant' + | 'openai/gpt-5' + | 'openai/gpt-5-mini' + | 'openai/gpt-5-nano' + | ''; + + system_prompt_ai_search?: string; + + system_prompt_index_summarization?: string; + + system_prompt_rewrite_query?: string; + + vectorize_active_namespace?: string; +} + +export namespace InstanceReadResponse { + export interface Metadata { + created_from_aisearch_wizard?: boolean; + + worker_domain?: string; + } + + export interface SourceParams { + /** + * List of path patterns to exclude. Supports wildcards (e.g., _/admin/_, + * /private/\*_, _\private\*) + */ + exclude_items?: Array; + + /** + * List of path patterns to include. Supports wildcards (e.g., _/blog/_.html, + * /docs/\*_, _\blog\*.html) + */ + include_items?: Array; + + prefix?: string; + + r2_jurisdiction?: string; + + web_crawler?: SourceParams.WebCrawler; + } + + export namespace SourceParams { + export interface WebCrawler { + parse_options?: WebCrawler.ParseOptions; + + parse_type?: 'sitemap' | 'feed-rss'; + + store_options?: WebCrawler.StoreOptions; + } + + export namespace WebCrawler { + export interface ParseOptions { + include_headers?: { [key: string]: string }; + + include_images?: boolean; + + use_browser_rendering?: boolean; + } + + export interface StoreOptions { + storage_id: string; + + r2_jurisdiction?: string; + + storage_type?: SippyAPI.Provider; + } + } + } +} + +export interface InstanceStatsResponse { + completed?: number; + + error?: number; + + file_embed_errors?: { [key: string]: unknown }; + + index_source_errors?: { [key: string]: unknown }; + + last_activity?: string; + + queued?: number; + + running?: number; + + skipped?: number; +} + +export interface InstanceCreateParams { + /** + * Path param: + */ + account_id: string; + + /** + * Body param: Use your AI Search ID. + */ + id: string; + + /** + * Body param: + */ + source: string; + + /** + * Body param: + */ + token_id: string; + + /** + * Body param: + */ + type: 'r2' | 'web-crawler'; + + /** + * Body param: + */ + ai_gateway_id?: string; + + /** + * Body param: + */ + ai_search_model?: + | '@cf/meta/llama-3.3-70b-instruct-fp8-fast' + | '@cf/meta/llama-3.1-8b-instruct-fast' + | '@cf/meta/llama-3.1-8b-instruct-fp8' + | '@cf/meta/llama-4-scout-17b-16e-instruct' + | '@cf/qwen/qwen3-30b-a3b-fp8' + | '@cf/deepseek-ai/deepseek-r1-distill-qwen-32b' + | '@cf/moonshotai/kimi-k2-instruct' + | 'anthropic/claude-3-7-sonnet' + | 'anthropic/claude-sonnet-4' + | 'anthropic/claude-opus-4' + | 'anthropic/claude-3-5-haiku' + | 'cerebras/qwen-3-235b-a22b-instruct' + | 'cerebras/qwen-3-235b-a22b-thinking' + | 'cerebras/llama-3.3-70b' + | 'cerebras/llama-4-maverick-17b-128e-instruct' + | 'cerebras/llama-4-scout-17b-16e-instruct' + | 'cerebras/gpt-oss-120b' + | 'google-ai-studio/gemini-2.5-flash' + | 'google-ai-studio/gemini-2.5-pro' + | 'grok/grok-4' + | 'groq/llama-3.3-70b-versatile' + | 'groq/llama-3.1-8b-instant' + | 'openai/gpt-5' + | 'openai/gpt-5-mini' + | 'openai/gpt-5-nano' + | ''; + + /** + * Body param: + */ + chunk?: boolean; + + /** + * Body param: + */ + chunk_overlap?: number; + + /** + * Body param: + */ + chunk_size?: number; + + /** + * Body param: + */ + embedding_model?: + | '@cf/baai/bge-m3' + | '@cf/baai/bge-large-en-v1.5' + | '@cf/google/embeddinggemma-300m' + | '@cf/qwen/qwen3-embedding-0.6b' + | 'google-ai-studio/gemini-embedding-001' + | 'openai/text-embedding-3-small' + | 'openai/text-embedding-3-large' + | ''; + + /** + * Body param: + */ + max_num_results?: number; + + /** + * Body param: + */ + metadata?: InstanceCreateParams.Metadata; + + /** + * Body param: + */ + reranking?: boolean; + + /** + * Body param: + */ + reranking_model?: '@cf/baai/bge-reranker-base' | ''; + + /** + * Body param: + */ + rewrite_model?: + | '@cf/meta/llama-3.3-70b-instruct-fp8-fast' + | '@cf/meta/llama-3.1-8b-instruct-fast' + | '@cf/meta/llama-3.1-8b-instruct-fp8' + | '@cf/meta/llama-4-scout-17b-16e-instruct' + | '@cf/qwen/qwen3-30b-a3b-fp8' + | '@cf/deepseek-ai/deepseek-r1-distill-qwen-32b' + | '@cf/moonshotai/kimi-k2-instruct' + | 'anthropic/claude-3-7-sonnet' + | 'anthropic/claude-sonnet-4' + | 'anthropic/claude-opus-4' + | 'anthropic/claude-3-5-haiku' + | 'cerebras/qwen-3-235b-a22b-instruct' + | 'cerebras/qwen-3-235b-a22b-thinking' + | 'cerebras/llama-3.3-70b' + | 'cerebras/llama-4-maverick-17b-128e-instruct' + | 'cerebras/llama-4-scout-17b-16e-instruct' + | 'cerebras/gpt-oss-120b' + | 'google-ai-studio/gemini-2.5-flash' + | 'google-ai-studio/gemini-2.5-pro' + | 'grok/grok-4' + | 'groq/llama-3.3-70b-versatile' + | 'groq/llama-3.1-8b-instant' + | 'openai/gpt-5' + | 'openai/gpt-5-mini' + | 'openai/gpt-5-nano' + | ''; + + /** + * Body param: + */ + rewrite_query?: boolean; + + /** + * Body param: + */ + score_threshold?: number; + + /** + * Body param: + */ + source_params?: InstanceCreateParams.SourceParams; +} + +export namespace InstanceCreateParams { + export interface Metadata { + created_from_aisearch_wizard?: boolean; + + worker_domain?: string; + } + + export interface SourceParams { + /** + * List of path patterns to exclude. Supports wildcards (e.g., _/admin/_, + * /private/\*_, _\private\*) + */ + exclude_items?: Array; + + /** + * List of path patterns to include. Supports wildcards (e.g., _/blog/_.html, + * /docs/\*_, _\blog\*.html) + */ + include_items?: Array; + + prefix?: string; + + r2_jurisdiction?: string; + + web_crawler?: SourceParams.WebCrawler; + } + + export namespace SourceParams { + export interface WebCrawler { + parse_options?: WebCrawler.ParseOptions; + + parse_type?: 'sitemap' | 'feed-rss'; + + store_options?: WebCrawler.StoreOptions; + } + + export namespace WebCrawler { + export interface ParseOptions { + include_headers?: { [key: string]: string }; + + include_images?: boolean; + + use_browser_rendering?: boolean; + } + + export interface StoreOptions { + storage_id: string; + + r2_jurisdiction?: string; + + storage_type?: SippyAPI.ProviderParam; + } + } + } +} + +export interface InstanceUpdateParams { + /** + * Path param: + */ + account_id: string; + + /** + * Body param: + */ + ai_gateway_id?: string; + + /** + * Body param: + */ + ai_search_model?: + | '@cf/meta/llama-3.3-70b-instruct-fp8-fast' + | '@cf/meta/llama-3.1-8b-instruct-fast' + | '@cf/meta/llama-3.1-8b-instruct-fp8' + | '@cf/meta/llama-4-scout-17b-16e-instruct' + | '@cf/qwen/qwen3-30b-a3b-fp8' + | '@cf/deepseek-ai/deepseek-r1-distill-qwen-32b' + | '@cf/moonshotai/kimi-k2-instruct' + | 'anthropic/claude-3-7-sonnet' + | 'anthropic/claude-sonnet-4' + | 'anthropic/claude-opus-4' + | 'anthropic/claude-3-5-haiku' + | 'cerebras/qwen-3-235b-a22b-instruct' + | 'cerebras/qwen-3-235b-a22b-thinking' + | 'cerebras/llama-3.3-70b' + | 'cerebras/llama-4-maverick-17b-128e-instruct' + | 'cerebras/llama-4-scout-17b-16e-instruct' + | 'cerebras/gpt-oss-120b' + | 'google-ai-studio/gemini-2.5-flash' + | 'google-ai-studio/gemini-2.5-pro' + | 'grok/grok-4' + | 'groq/llama-3.3-70b-versatile' + | 'groq/llama-3.1-8b-instant' + | 'openai/gpt-5' + | 'openai/gpt-5-mini' + | 'openai/gpt-5-nano' + | ''; + + /** + * Body param: + */ + cache?: boolean; + + /** + * Body param: + */ + cache_threshold?: 'super_strict_match' | 'close_enough' | 'flexible_friend' | 'anything_goes'; + + /** + * Body param: + */ + chunk?: boolean; + + /** + * Body param: + */ + chunk_overlap?: number; + + /** + * Body param: + */ + chunk_size?: number; + + /** + * Body param: + */ + embedding_model?: + | '@cf/baai/bge-m3' + | '@cf/baai/bge-large-en-v1.5' + | '@cf/google/embeddinggemma-300m' + | '@cf/qwen/qwen3-embedding-0.6b' + | 'google-ai-studio/gemini-embedding-001' + | 'openai/text-embedding-3-small' + | 'openai/text-embedding-3-large' + | ''; + + /** + * Body param: + */ + max_num_results?: number; + + /** + * Body param: + */ + metadata?: InstanceUpdateParams.Metadata; + + /** + * Body param: + */ + paused?: boolean; + + /** + * Body param: + */ + reranking?: boolean; + + /** + * Body param: + */ + reranking_model?: '@cf/baai/bge-reranker-base' | ''; + + /** + * Body param: + */ + rewrite_model?: + | '@cf/meta/llama-3.3-70b-instruct-fp8-fast' + | '@cf/meta/llama-3.1-8b-instruct-fast' + | '@cf/meta/llama-3.1-8b-instruct-fp8' + | '@cf/meta/llama-4-scout-17b-16e-instruct' + | '@cf/qwen/qwen3-30b-a3b-fp8' + | '@cf/deepseek-ai/deepseek-r1-distill-qwen-32b' + | '@cf/moonshotai/kimi-k2-instruct' + | 'anthropic/claude-3-7-sonnet' + | 'anthropic/claude-sonnet-4' + | 'anthropic/claude-opus-4' + | 'anthropic/claude-3-5-haiku' + | 'cerebras/qwen-3-235b-a22b-instruct' + | 'cerebras/qwen-3-235b-a22b-thinking' + | 'cerebras/llama-3.3-70b' + | 'cerebras/llama-4-maverick-17b-128e-instruct' + | 'cerebras/llama-4-scout-17b-16e-instruct' + | 'cerebras/gpt-oss-120b' + | 'google-ai-studio/gemini-2.5-flash' + | 'google-ai-studio/gemini-2.5-pro' + | 'grok/grok-4' + | 'groq/llama-3.3-70b-versatile' + | 'groq/llama-3.1-8b-instant' + | 'openai/gpt-5' + | 'openai/gpt-5-mini' + | 'openai/gpt-5-nano' + | ''; + + /** + * Body param: + */ + rewrite_query?: boolean; + + /** + * Body param: + */ + score_threshold?: number; + + /** + * Body param: + */ + source_params?: InstanceUpdateParams.SourceParams; + + /** + * Body param: + */ + summarization?: boolean; + + /** + * Body param: + */ + summarization_model?: + | '@cf/meta/llama-3.3-70b-instruct-fp8-fast' + | '@cf/meta/llama-3.1-8b-instruct-fast' + | '@cf/meta/llama-3.1-8b-instruct-fp8' + | '@cf/meta/llama-4-scout-17b-16e-instruct' + | '@cf/qwen/qwen3-30b-a3b-fp8' + | '@cf/deepseek-ai/deepseek-r1-distill-qwen-32b' + | '@cf/moonshotai/kimi-k2-instruct' + | 'anthropic/claude-3-7-sonnet' + | 'anthropic/claude-sonnet-4' + | 'anthropic/claude-opus-4' + | 'anthropic/claude-3-5-haiku' + | 'cerebras/qwen-3-235b-a22b-instruct' + | 'cerebras/qwen-3-235b-a22b-thinking' + | 'cerebras/llama-3.3-70b' + | 'cerebras/llama-4-maverick-17b-128e-instruct' + | 'cerebras/llama-4-scout-17b-16e-instruct' + | 'cerebras/gpt-oss-120b' + | 'google-ai-studio/gemini-2.5-flash' + | 'google-ai-studio/gemini-2.5-pro' + | 'grok/grok-4' + | 'groq/llama-3.3-70b-versatile' + | 'groq/llama-3.1-8b-instant' + | 'openai/gpt-5' + | 'openai/gpt-5-mini' + | 'openai/gpt-5-nano' + | ''; + + /** + * Body param: + */ + system_prompt_ai_search?: string; + + /** + * Body param: + */ + system_prompt_index_summarization?: string; + + /** + * Body param: + */ + system_prompt_rewrite_query?: string; + + /** + * Body param: + */ + token_id?: string; +} + +export namespace InstanceUpdateParams { + export interface Metadata { + created_from_aisearch_wizard?: boolean; + + worker_domain?: string; + } + + export interface SourceParams { + /** + * List of path patterns to exclude. Supports wildcards (e.g., _/admin/_, + * /private/\*_, _\private\*) + */ + exclude_items?: Array; + + /** + * List of path patterns to include. Supports wildcards (e.g., _/blog/_.html, + * /docs/\*_, _\blog\*.html) + */ + include_items?: Array; + + prefix?: string; + + r2_jurisdiction?: string; + + web_crawler?: SourceParams.WebCrawler; + } + + export namespace SourceParams { + export interface WebCrawler { + parse_options?: WebCrawler.ParseOptions; + + parse_type?: 'sitemap' | 'feed-rss'; + + store_options?: WebCrawler.StoreOptions; + } + + export namespace WebCrawler { + export interface ParseOptions { + include_headers?: { [key: string]: string }; + + include_images?: boolean; + + use_browser_rendering?: boolean; + } + + export interface StoreOptions { + storage_id: string; + + r2_jurisdiction?: string; + + storage_type?: SippyAPI.ProviderParam; + } + } + } +} + +export interface InstanceListParams extends V4PagePaginationArrayParams { + /** + * Path param: + */ + account_id: string; + + /** + * Query param: Search by id + */ + search?: string; +} + +export interface InstanceDeleteParams { + account_id: string; +} + +export interface InstanceReadParams { + account_id: string; +} + +export interface InstanceStatsParams { + account_id: string; +} + +Instances.InstanceListResponsesV4PagePaginationArray = InstanceListResponsesV4PagePaginationArray; +Instances.Items = Items; +Instances.ItemListResponsesV4PagePaginationArray = ItemListResponsesV4PagePaginationArray; +Instances.Jobs = Jobs; +Instances.JobListResponsesV4PagePaginationArray = JobListResponsesV4PagePaginationArray; + +export declare namespace Instances { + export { + type InstanceCreateResponse as InstanceCreateResponse, + type InstanceUpdateResponse as InstanceUpdateResponse, + type InstanceListResponse as InstanceListResponse, + type InstanceDeleteResponse as InstanceDeleteResponse, + type InstanceReadResponse as InstanceReadResponse, + type InstanceStatsResponse as InstanceStatsResponse, + InstanceListResponsesV4PagePaginationArray as InstanceListResponsesV4PagePaginationArray, + type InstanceCreateParams as InstanceCreateParams, + type InstanceUpdateParams as InstanceUpdateParams, + type InstanceListParams as InstanceListParams, + type InstanceDeleteParams as InstanceDeleteParams, + type InstanceReadParams as InstanceReadParams, + type InstanceStatsParams as InstanceStatsParams, + }; + + export { + Items as Items, + type ItemListResponse as ItemListResponse, + type ItemGetResponse as ItemGetResponse, + ItemListResponsesV4PagePaginationArray as ItemListResponsesV4PagePaginationArray, + type ItemListParams as ItemListParams, + type ItemGetParams as ItemGetParams, + }; + + export { + Jobs as Jobs, + type JobCreateResponse as JobCreateResponse, + type JobListResponse as JobListResponse, + type JobGetResponse as JobGetResponse, + type JobLogsResponse as JobLogsResponse, + JobListResponsesV4PagePaginationArray as JobListResponsesV4PagePaginationArray, + type JobCreateParams as JobCreateParams, + type JobListParams as JobListParams, + type JobGetParams as JobGetParams, + type JobLogsParams as JobLogsParams, + }; +} diff --git a/src/resources/aisearch/instances/items.ts b/src/resources/aisearch/instances/items.ts new file mode 100644 index 0000000000..08a7ae9762 --- /dev/null +++ b/src/resources/aisearch/instances/items.ts @@ -0,0 +1,124 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../resource'; +import * as Core from '../../../core'; +import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../../pagination'; + +export class Items extends APIResource { + /** + * Items List. + * + * @example + * ```ts + * // Automatically fetches more pages as needed. + * for await (const itemListResponse of client.aiSearch.instances.items.list( + * 'my-ai-search', + * { account_id: 'c3dc5f0b34a14ff8e1b3ec04895e1b22' }, + * )) { + * // ... + * } + * ``` + */ + list( + id: string, + params: ItemListParams, + options?: Core.RequestOptions, + ): Core.PagePromise { + const { account_id, ...query } = params; + return this._client.getAPIList( + `/accounts/${account_id}/ai-search/instances/${id}/items`, + ItemListResponsesV4PagePaginationArray, + { query, ...options }, + ); + } + + /** + * Get Items. + * + * @example + * ```ts + * const item = await client.aiSearch.instances.items.get( + * 'my-ai-search', + * 'item_id', + * { account_id: 'c3dc5f0b34a14ff8e1b3ec04895e1b22' }, + * ); + * ``` + */ + get( + id: string, + itemId: string, + params: ItemGetParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.get( + `/accounts/${account_id}/ai-search/instances/${id}/items/${itemId}`, + options, + ) as Core.APIPromise<{ result: ItemGetResponse }> + )._thenUnwrap((obj) => obj.result); + } +} + +export class ItemListResponsesV4PagePaginationArray extends V4PagePaginationArray {} + +export interface ItemListResponse { + id: string; + + key: string; + + status: 'queued' | 'running' | 'completed' | 'error' | 'skipped'; + + error?: string; + + last_seen_at?: string; + + next_action?: string; +} + +export interface ItemGetResponse { + id: string; + + key: string; + + status: 'queued' | 'running' | 'completed' | 'error' | 'skipped'; + + error?: string; + + last_seen_at?: string; + + next_action?: string; +} + +export interface ItemListParams extends V4PagePaginationArrayParams { + /** + * Path param: + */ + account_id: string; + + /** + * Query param: + */ + search?: string; + + /** + * Query param: + */ + status?: 'queued' | 'running' | 'completed' | 'error' | 'skipped'; +} + +export interface ItemGetParams { + account_id: string; +} + +Items.ItemListResponsesV4PagePaginationArray = ItemListResponsesV4PagePaginationArray; + +export declare namespace Items { + export { + type ItemListResponse as ItemListResponse, + type ItemGetResponse as ItemGetResponse, + ItemListResponsesV4PagePaginationArray as ItemListResponsesV4PagePaginationArray, + type ItemListParams as ItemListParams, + type ItemGetParams as ItemGetParams, + }; +} diff --git a/src/resources/aisearch/instances/jobs.ts b/src/resources/aisearch/instances/jobs.ts new file mode 100644 index 0000000000..004f50b98f --- /dev/null +++ b/src/resources/aisearch/instances/jobs.ts @@ -0,0 +1,219 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../resource'; +import * as Core from '../../../core'; +import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../../pagination'; + +export class Jobs extends APIResource { + /** + * Create new job + * + * @example + * ```ts + * const job = await client.aiSearch.instances.jobs.create( + * 'my-ai-search', + * { account_id: 'c3dc5f0b34a14ff8e1b3ec04895e1b22' }, + * ); + * ``` + */ + create( + id: string, + params: JobCreateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.post( + `/accounts/${account_id}/ai-search/instances/${id}/jobs`, + options, + ) as Core.APIPromise<{ result: JobCreateResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * List Jobs + * + * @example + * ```ts + * // Automatically fetches more pages as needed. + * for await (const jobListResponse of client.aiSearch.instances.jobs.list( + * 'my-ai-search', + * { account_id: 'c3dc5f0b34a14ff8e1b3ec04895e1b22' }, + * )) { + * // ... + * } + * ``` + */ + list( + id: string, + params: JobListParams, + options?: Core.RequestOptions, + ): Core.PagePromise { + const { account_id, ...query } = params; + return this._client.getAPIList( + `/accounts/${account_id}/ai-search/instances/${id}/jobs`, + JobListResponsesV4PagePaginationArray, + { query, ...options }, + ); + } + + /** + * Get a Job Details + * + * @example + * ```ts + * const job = await client.aiSearch.instances.jobs.get( + * 'my-ai-search', + * 'job_id', + * { account_id: 'c3dc5f0b34a14ff8e1b3ec04895e1b22' }, + * ); + * ``` + */ + get( + id: string, + jobId: string, + params: JobGetParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.get( + `/accounts/${account_id}/ai-search/instances/${id}/jobs/${jobId}`, + options, + ) as Core.APIPromise<{ result: JobGetResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * List Job Logs + * + * @example + * ```ts + * const response = await client.aiSearch.instances.jobs.logs( + * 'my-ai-search', + * 'job_id', + * { account_id: 'c3dc5f0b34a14ff8e1b3ec04895e1b22' }, + * ); + * ``` + */ + logs( + id: string, + jobId: string, + params: JobLogsParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...query } = params; + return ( + this._client.get(`/accounts/${account_id}/ai-search/instances/${id}/jobs/${jobId}/logs`, { + query, + ...options, + }) as Core.APIPromise<{ result: JobLogsResponse }> + )._thenUnwrap((obj) => obj.result); + } +} + +export class JobListResponsesV4PagePaginationArray extends V4PagePaginationArray {} + +export interface JobCreateResponse { + id: string; + + source: 'user' | 'schedule'; + + end_reason?: string; + + ended_at?: string; + + last_seen_at?: string; + + started_at?: string; +} + +export interface JobListResponse { + id: string; + + source: 'user' | 'schedule'; + + end_reason?: string; + + ended_at?: string; + + last_seen_at?: string; + + started_at?: string; +} + +export interface JobGetResponse { + id: string; + + source: 'user' | 'schedule'; + + end_reason?: string; + + ended_at?: string; + + last_seen_at?: string; + + started_at?: string; +} + +export type JobLogsResponse = Array; + +export namespace JobLogsResponse { + export interface JobLogsResponseItem { + id: number; + + created_at: number; + + message: string; + + message_type: number; + } +} + +export interface JobCreateParams { + account_id: string; +} + +export interface JobListParams extends V4PagePaginationArrayParams { + /** + * Path param: + */ + account_id: string; +} + +export interface JobGetParams { + account_id: string; +} + +export interface JobLogsParams { + /** + * Path param: + */ + account_id: string; + + /** + * Query param: + */ + page?: number; + + /** + * Query param: + */ + per_page?: number; +} + +Jobs.JobListResponsesV4PagePaginationArray = JobListResponsesV4PagePaginationArray; + +export declare namespace Jobs { + export { + type JobCreateResponse as JobCreateResponse, + type JobListResponse as JobListResponse, + type JobGetResponse as JobGetResponse, + type JobLogsResponse as JobLogsResponse, + JobListResponsesV4PagePaginationArray as JobListResponsesV4PagePaginationArray, + type JobCreateParams as JobCreateParams, + type JobListParams as JobListParams, + type JobGetParams as JobGetParams, + type JobLogsParams as JobLogsParams, + }; +} diff --git a/src/resources/aisearch/tokens.ts b/src/resources/aisearch/tokens.ts new file mode 100644 index 0000000000..ba54622174 --- /dev/null +++ b/src/resources/aisearch/tokens.ts @@ -0,0 +1,332 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../resource'; +import * as Core from '../../core'; +import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../pagination'; + +export class Tokens extends APIResource { + /** + * Create new tokens. + * + * @example + * ```ts + * const token = await client.aiSearch.tokens.create({ + * account_id: 'c3dc5f0b34a14ff8e1b3ec04895e1b22', + * cf_api_id: 'cf_api_id', + * cf_api_key: 'cf_api_key', + * name: 'name', + * }); + * ``` + */ + create(params: TokenCreateParams, options?: Core.RequestOptions): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.post(`/accounts/${account_id}/ai-search/tokens`, { body, ...options }) as Core.APIPromise<{ + result: TokenCreateResponse; + }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Delete tokens. + * + * @example + * ```ts + * const token = await client.aiSearch.tokens.update( + * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + * { account_id: 'c3dc5f0b34a14ff8e1b3ec04895e1b22' }, + * ); + * ``` + */ + update( + id: string, + params: TokenUpdateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.delete(`/accounts/${account_id}/ai-search/tokens/${id}`, options) as Core.APIPromise<{ + result: TokenUpdateResponse; + }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * List tokens. + * + * @example + * ```ts + * // Automatically fetches more pages as needed. + * for await (const tokenListResponse of client.aiSearch.tokens.list( + * { account_id: 'c3dc5f0b34a14ff8e1b3ec04895e1b22' }, + * )) { + * // ... + * } + * ``` + */ + list( + params: TokenListParams, + options?: Core.RequestOptions, + ): Core.PagePromise { + const { account_id, ...query } = params; + return this._client.getAPIList( + `/accounts/${account_id}/ai-search/tokens`, + TokenListResponsesV4PagePaginationArray, + { query, ...options }, + ); + } + + /** + * Delete tokens. + * + * @example + * ```ts + * const token = await client.aiSearch.tokens.delete( + * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + * { account_id: 'c3dc5f0b34a14ff8e1b3ec04895e1b22' }, + * ); + * ``` + */ + delete( + id: string, + params: TokenDeleteParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.delete(`/accounts/${account_id}/ai-search/tokens/${id}`, options) as Core.APIPromise<{ + result: TokenDeleteResponse; + }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Delete tokens. + * + * @example + * ```ts + * const response = await client.aiSearch.tokens.read( + * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + * { account_id: 'c3dc5f0b34a14ff8e1b3ec04895e1b22' }, + * ); + * ``` + */ + read( + id: string, + params: TokenReadParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.delete(`/accounts/${account_id}/ai-search/tokens/${id}`, options) as Core.APIPromise<{ + result: TokenReadResponse; + }> + )._thenUnwrap((obj) => obj.result); + } +} + +export class TokenListResponsesV4PagePaginationArray extends V4PagePaginationArray {} + +export interface TokenCreateResponse { + id: string; + + account_id: string; + + account_tag: string; + + cf_api_id: string; + + cf_api_key: string; + + created_at: string; + + modified_at: string; + + name: string; + + created_by?: string; + + enabled?: boolean; + + legacy?: boolean; + + modified_by?: string; + + synced_at?: string; +} + +export interface TokenUpdateResponse { + id: string; + + account_id: string; + + account_tag: string; + + cf_api_id: string; + + cf_api_key: string; + + created_at: string; + + modified_at: string; + + name: string; + + created_by?: string; + + enabled?: boolean; + + legacy?: boolean; + + modified_by?: string; + + synced_at?: string; +} + +export interface TokenListResponse { + id: string; + + account_id: string; + + account_tag: string; + + cf_api_id: string; + + cf_api_key: string; + + created_at: string; + + modified_at: string; + + name: string; + + created_by?: string; + + enabled?: boolean; + + legacy?: boolean; + + modified_by?: string; + + synced_at?: string; +} + +export interface TokenDeleteResponse { + id: string; + + account_id: string; + + account_tag: string; + + cf_api_id: string; + + cf_api_key: string; + + created_at: string; + + modified_at: string; + + name: string; + + created_by?: string; + + enabled?: boolean; + + legacy?: boolean; + + modified_by?: string; + + synced_at?: string; +} + +export interface TokenReadResponse { + id: string; + + account_id: string; + + account_tag: string; + + cf_api_id: string; + + cf_api_key: string; + + created_at: string; + + modified_at: string; + + name: string; + + created_by?: string; + + enabled?: boolean; + + legacy?: boolean; + + modified_by?: string; + + synced_at?: string; +} + +export interface TokenCreateParams { + /** + * Path param: + */ + account_id: string; + + /** + * Body param: + */ + cf_api_id: string; + + /** + * Body param: + */ + cf_api_key: string; + + /** + * Body param: + */ + name: string; + + /** + * Body param: + */ + legacy?: boolean; +} + +export interface TokenUpdateParams { + account_id: string; +} + +export interface TokenListParams extends V4PagePaginationArrayParams { + /** + * Path param: + */ + account_id: string; +} + +export interface TokenDeleteParams { + account_id: string; +} + +export interface TokenReadParams { + account_id: string; +} + +Tokens.TokenListResponsesV4PagePaginationArray = TokenListResponsesV4PagePaginationArray; + +export declare namespace Tokens { + export { + type TokenCreateResponse as TokenCreateResponse, + type TokenUpdateResponse as TokenUpdateResponse, + type TokenListResponse as TokenListResponse, + type TokenDeleteResponse as TokenDeleteResponse, + type TokenReadResponse as TokenReadResponse, + TokenListResponsesV4PagePaginationArray as TokenListResponsesV4PagePaginationArray, + type TokenCreateParams as TokenCreateParams, + type TokenUpdateParams as TokenUpdateParams, + type TokenListParams as TokenListParams, + type TokenDeleteParams as TokenDeleteParams, + type TokenReadParams as TokenReadParams, + }; +} diff --git a/src/resources/alerting/alerting.ts b/src/resources/alerting/alerting.ts index 6f955cbcb8..e7d373dd1f 100644 --- a/src/resources/alerting/alerting.ts +++ b/src/resources/alerting/alerting.ts @@ -21,6 +21,22 @@ import { PolicyUpdateParams, PolicyUpdateResponse, } from './policies'; +import * as SilencesAPI from './silences'; +import { + SilenceCreateParams, + SilenceCreateResponse, + SilenceDeleteParams, + SilenceDeleteResponse, + SilenceGetParams, + SilenceGetResponse, + SilenceListParams, + SilenceListResponse, + SilenceListResponsesSinglePage, + SilenceUpdateParams, + SilenceUpdateResponse, + SilenceUpdateResponsesSinglePage, + Silences, +} from './silences'; import * as DestinationsAPI from './destinations/destinations'; import { Destinations } from './destinations/destinations'; @@ -29,6 +45,7 @@ export class Alerting extends APIResource { destinations: DestinationsAPI.Destinations = new DestinationsAPI.Destinations(this._client); history: HistoryAPI.HistoryResource = new HistoryAPI.HistoryResource(this._client); policies: PoliciesAPI.Policies = new PoliciesAPI.Policies(this._client); + silences: SilencesAPI.Silences = new SilencesAPI.Silences(this._client); } Alerting.AvailableAlerts = AvailableAlerts; @@ -37,6 +54,9 @@ Alerting.HistoryResource = HistoryResource; Alerting.HistoriesV4PagePaginationArray = HistoriesV4PagePaginationArray; Alerting.Policies = Policies; Alerting.PoliciesSinglePage = PoliciesSinglePage; +Alerting.Silences = Silences; +Alerting.SilenceUpdateResponsesSinglePage = SilenceUpdateResponsesSinglePage; +Alerting.SilenceListResponsesSinglePage = SilenceListResponsesSinglePage; export declare namespace Alerting { export { @@ -69,4 +89,20 @@ export declare namespace Alerting { type PolicyDeleteParams as PolicyDeleteParams, type PolicyGetParams as PolicyGetParams, }; + + export { + Silences as Silences, + type SilenceCreateResponse as SilenceCreateResponse, + type SilenceUpdateResponse as SilenceUpdateResponse, + type SilenceListResponse as SilenceListResponse, + type SilenceDeleteResponse as SilenceDeleteResponse, + type SilenceGetResponse as SilenceGetResponse, + SilenceUpdateResponsesSinglePage as SilenceUpdateResponsesSinglePage, + SilenceListResponsesSinglePage as SilenceListResponsesSinglePage, + type SilenceCreateParams as SilenceCreateParams, + type SilenceUpdateParams as SilenceUpdateParams, + type SilenceListParams as SilenceListParams, + type SilenceDeleteParams as SilenceDeleteParams, + type SilenceGetParams as SilenceGetParams, + }; } diff --git a/src/resources/alerting/destinations/webhooks.ts b/src/resources/alerting/destinations/webhooks.ts index 279c67d0bf..605e015ae3 100644 --- a/src/resources/alerting/destinations/webhooks.ts +++ b/src/resources/alerting/destinations/webhooks.ts @@ -35,7 +35,7 @@ export class Webhooks extends APIResource { * ```ts * const webhook = * await client.alerting.destinations.webhooks.update( - * 'b115d5ec-15c6-41ee-8b76-92c449b5227b', + * 'b115d5ec15c641ee8b7692c449b5227b', * { * account_id: '023e105f4ecef8ad9ca31a8372d0c353', * name: 'Slack Webhook', @@ -90,7 +90,7 @@ export class Webhooks extends APIResource { * ```ts * const webhook = * await client.alerting.destinations.webhooks.delete( - * 'b115d5ec-15c6-41ee-8b76-92c449b5227b', + * 'b115d5ec15c641ee8b7692c449b5227b', * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` @@ -114,7 +114,7 @@ export class Webhooks extends APIResource { * ```ts * const webhooks = * await client.alerting.destinations.webhooks.get( - * 'b115d5ec-15c6-41ee-8b76-92c449b5227b', + * 'b115d5ec15c641ee8b7692c449b5227b', * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` diff --git a/src/resources/alerting/index.ts b/src/resources/alerting/index.ts index d249a16557..e6a852484e 100644 --- a/src/resources/alerting/index.ts +++ b/src/resources/alerting/index.ts @@ -28,3 +28,18 @@ export { type PolicyDeleteParams, type PolicyGetParams, } from './policies'; +export { + SilenceUpdateResponsesSinglePage, + SilenceListResponsesSinglePage, + Silences, + type SilenceCreateResponse, + type SilenceUpdateResponse, + type SilenceListResponse, + type SilenceDeleteResponse, + type SilenceGetResponse, + type SilenceCreateParams, + type SilenceUpdateParams, + type SilenceListParams, + type SilenceDeleteParams, + type SilenceGetParams, +} from './silences'; diff --git a/src/resources/alerting/policies.ts b/src/resources/alerting/policies.ts index c2caed4005..7e22a6cc36 100644 --- a/src/resources/alerting/policies.ts +++ b/src/resources/alerting/policies.ts @@ -35,7 +35,7 @@ export class Policies extends APIResource { * @example * ```ts * const policy = await client.alerting.policies.update( - * '0da2b59e-f118-439d-8097-bdfb215203c9', + * '0da2b59ef118439d8097bdfb215203c9', * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` @@ -85,7 +85,7 @@ export class Policies extends APIResource { * @example * ```ts * const policy = await client.alerting.policies.delete( - * '0da2b59e-f118-439d-8097-bdfb215203c9', + * '0da2b59ef118439d8097bdfb215203c9', * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` @@ -105,7 +105,7 @@ export class Policies extends APIResource { * @example * ```ts * const policy = await client.alerting.policies.get( - * '0da2b59e-f118-439d-8097-bdfb215203c9', + * '0da2b59ef118439d8097bdfb215203c9', * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` @@ -211,6 +211,7 @@ export interface Policy { * possible values. */ alert_type?: + | 'abuse_report_alert' | 'access_custom_certificate_expiration_type' | 'advanced_ddos_attack_l4_alert' | 'advanced_ddos_attack_l7_alert' @@ -520,6 +521,11 @@ export interface PolicyFilter { */ tunnel_name?: Array; + /** + * Usage depends on specific alert type + */ + type?: Array; + /** * Usage depends on specific alert type */ @@ -739,6 +745,11 @@ export interface PolicyFilterParam { */ tunnel_name?: Array; + /** + * Usage depends on specific alert type + */ + type?: Array; + /** * Usage depends on specific alert type */ @@ -825,6 +836,7 @@ export interface PolicyCreateParams { * possible values. */ alert_type: + | 'abuse_report_alert' | 'access_custom_certificate_expiration_type' | 'advanced_ddos_attack_l4_alert' | 'advanced_ddos_attack_l7_alert' @@ -946,6 +958,7 @@ export interface PolicyUpdateParams { * possible values. */ alert_type?: + | 'abuse_report_alert' | 'access_custom_certificate_expiration_type' | 'advanced_ddos_attack_l4_alert' | 'advanced_ddos_attack_l7_alert' diff --git a/src/resources/alerting/silences.ts b/src/resources/alerting/silences.ts new file mode 100644 index 0000000000..eec14eeafd --- /dev/null +++ b/src/resources/alerting/silences.ts @@ -0,0 +1,374 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../resource'; +import * as Core from '../../core'; +import { SinglePage } from '../../pagination'; + +export class Silences extends APIResource { + /** + * Creates a new silence for an account. + * + * @example + * ```ts + * const silence = await client.alerting.silences.create({ + * account_id: '023e105f4ecef8ad9ca31a8372d0c353', + * body: [{}], + * }); + * ``` + */ + create(params: SilenceCreateParams, options?: Core.RequestOptions): Core.APIPromise { + const { account_id, body } = params; + return this._client.post(`/accounts/${account_id}/alerting/v3/silences`, { body: body, ...options }); + } + + /** + * Updates existing silences for an account. + * + * @example + * ```ts + * // Automatically fetches more pages as needed. + * for await (const silenceUpdateResponse of client.alerting.silences.update( + * { + * account_id: '023e105f4ecef8ad9ca31a8372d0c353', + * body: [{}], + * }, + * )) { + * // ... + * } + * ``` + */ + update( + params: SilenceUpdateParams, + options?: Core.RequestOptions, + ): Core.PagePromise { + const { account_id, body } = params; + return this._client.getAPIList( + `/accounts/${account_id}/alerting/v3/silences`, + SilenceUpdateResponsesSinglePage, + { body: body, method: 'put', ...options }, + ); + } + + /** + * Gets a list of silences for an account. + * + * @example + * ```ts + * // Automatically fetches more pages as needed. + * for await (const silenceListResponse of client.alerting.silences.list( + * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * )) { + * // ... + * } + * ``` + */ + list( + params: SilenceListParams, + options?: Core.RequestOptions, + ): Core.PagePromise { + const { account_id } = params; + return this._client.getAPIList( + `/accounts/${account_id}/alerting/v3/silences`, + SilenceListResponsesSinglePage, + options, + ); + } + + /** + * Deletes an existing silence for an account. + * + * @example + * ```ts + * const silence = await client.alerting.silences.delete( + * 'f878e90c23f44126ae3cfc399f646977', + * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * ); + * ``` + */ + delete( + silenceId: string, + params: SilenceDeleteParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return this._client.delete(`/accounts/${account_id}/alerting/v3/silences/${silenceId}`, options); + } + + /** + * Gets a specific silence for an account. + * + * @example + * ```ts + * const silence = await client.alerting.silences.get( + * 'f878e90c23f44126ae3cfc399f646977', + * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * ); + * ``` + */ + get( + silenceId: string, + params: SilenceGetParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.get( + `/accounts/${account_id}/alerting/v3/silences/${silenceId}`, + options, + ) as Core.APIPromise<{ result: SilenceGetResponse }> + )._thenUnwrap((obj) => obj.result); + } +} + +export class SilenceUpdateResponsesSinglePage extends SinglePage {} + +export class SilenceListResponsesSinglePage extends SinglePage {} + +export interface SilenceCreateResponse { + errors: Array; + + messages: Array; + + /** + * Whether the API call was successful + */ + success: true; +} + +export namespace SilenceCreateResponse { + export interface Error { + message: string; + + code?: number; + } + + export interface Message { + message: string; + + code?: number; + } +} + +export interface SilenceUpdateResponse { + /** + * Silence ID + */ + id?: string; + + /** + * When the silence was created. + */ + created_at?: string; + + /** + * When the silence ends. + */ + end_time?: string; + + /** + * The unique identifier of a notification policy + */ + policy_id?: string; + + /** + * When the silence starts. + */ + start_time?: string; + + /** + * When the silence was modified. + */ + updated_at?: string; +} + +export interface SilenceListResponse { + /** + * Silence ID + */ + id?: string; + + /** + * When the silence was created. + */ + created_at?: string; + + /** + * When the silence ends. + */ + end_time?: string; + + /** + * The unique identifier of a notification policy + */ + policy_id?: string; + + /** + * When the silence starts. + */ + start_time?: string; + + /** + * When the silence was modified. + */ + updated_at?: string; +} + +export interface SilenceDeleteResponse { + errors: Array; + + messages: Array; + + /** + * Whether the API call was successful + */ + success: true; +} + +export namespace SilenceDeleteResponse { + export interface Error { + message: string; + + code?: number; + } + + export interface Message { + message: string; + + code?: number; + } +} + +export interface SilenceGetResponse { + /** + * Silence ID + */ + id?: string; + + /** + * When the silence was created. + */ + created_at?: string; + + /** + * When the silence ends. + */ + end_time?: string; + + /** + * The unique identifier of a notification policy + */ + policy_id?: string; + + /** + * When the silence starts. + */ + start_time?: string; + + /** + * When the silence was modified. + */ + updated_at?: string; +} + +export interface SilenceCreateParams { + /** + * Path param: The account id + */ + account_id: string; + + /** + * Body param: + */ + body: Array; +} + +export namespace SilenceCreateParams { + export interface Body { + /** + * When the silence ends. + */ + end_time?: string; + + /** + * The unique identifier of a notification policy + */ + policy_id?: string; + + /** + * When the silence starts. + */ + start_time?: string; + } +} + +export interface SilenceUpdateParams { + /** + * Path param: The account id + */ + account_id: string; + + /** + * Body param: + */ + body: Array; +} + +export namespace SilenceUpdateParams { + export interface Body { + /** + * Silence ID + */ + id?: string; + + /** + * When the silence ends. + */ + end_time?: string; + + /** + * When the silence starts. + */ + start_time?: string; + } +} + +export interface SilenceListParams { + /** + * The account id + */ + account_id: string; +} + +export interface SilenceDeleteParams { + /** + * The account id + */ + account_id: string; +} + +export interface SilenceGetParams { + /** + * The account id + */ + account_id: string; +} + +Silences.SilenceUpdateResponsesSinglePage = SilenceUpdateResponsesSinglePage; +Silences.SilenceListResponsesSinglePage = SilenceListResponsesSinglePage; + +export declare namespace Silences { + export { + type SilenceCreateResponse as SilenceCreateResponse, + type SilenceUpdateResponse as SilenceUpdateResponse, + type SilenceListResponse as SilenceListResponse, + type SilenceDeleteResponse as SilenceDeleteResponse, + type SilenceGetResponse as SilenceGetResponse, + SilenceUpdateResponsesSinglePage as SilenceUpdateResponsesSinglePage, + SilenceListResponsesSinglePage as SilenceListResponsesSinglePage, + type SilenceCreateParams as SilenceCreateParams, + type SilenceUpdateParams as SilenceUpdateParams, + type SilenceListParams as SilenceListParams, + type SilenceDeleteParams as SilenceDeleteParams, + type SilenceGetParams as SilenceGetParams, + }; +} diff --git a/src/resources/api-gateway/api-gateway.ts b/src/resources/api-gateway/api-gateway.ts index 1f9fb727e9..03f4d421e0 100644 --- a/src/resources/api-gateway/api-gateway.ts +++ b/src/resources/api-gateway/api-gateway.ts @@ -6,7 +6,6 @@ import { Configuration, ConfigurationGetParams, ConfigurationUpdateParams, - ConfigurationUpdateResponse, Configurations, } from './configurations'; import * as SchemasAPI from './schemas'; @@ -44,10 +43,10 @@ import { Settings } from './settings/settings'; import * as UserSchemasAPI from './user-schemas/user-schemas'; import { Message, - PublicSchema, - PublicSchemasV4PagePaginationArray, - SchemaUpload, + OldPublicSchema, + OldPublicSchemasV4PagePaginationArray, UserSchemaCreateParams, + UserSchemaCreateResponse, UserSchemaDeleteParams, UserSchemaDeleteResponse, UserSchemaEditParams, @@ -75,14 +74,13 @@ APIGateway.OperationListResponsesV4PagePaginationArray = OperationListResponsesV APIGateway.OperationBulkCreateResponsesSinglePage = OperationBulkCreateResponsesSinglePage; APIGateway.Schemas = Schemas; APIGateway.UserSchemas = UserSchemas; -APIGateway.PublicSchemasV4PagePaginationArray = PublicSchemasV4PagePaginationArray; +APIGateway.OldPublicSchemasV4PagePaginationArray = OldPublicSchemasV4PagePaginationArray; APIGateway.ExpressionTemplate = ExpressionTemplate; export declare namespace APIGateway { export { Configurations as Configurations, type Configuration as Configuration, - type ConfigurationUpdateResponse as ConfigurationUpdateResponse, type ConfigurationUpdateParams as ConfigurationUpdateParams, type ConfigurationGetParams as ConfigurationGetParams, }; @@ -124,10 +122,10 @@ export declare namespace APIGateway { export { UserSchemas as UserSchemas, type Message as Message, - type PublicSchema as PublicSchema, - type SchemaUpload as SchemaUpload, + type OldPublicSchema as OldPublicSchema, + type UserSchemaCreateResponse as UserSchemaCreateResponse, type UserSchemaDeleteResponse as UserSchemaDeleteResponse, - PublicSchemasV4PagePaginationArray as PublicSchemasV4PagePaginationArray, + OldPublicSchemasV4PagePaginationArray as OldPublicSchemasV4PagePaginationArray, type UserSchemaCreateParams as UserSchemaCreateParams, type UserSchemaListParams as UserSchemaListParams, type UserSchemaDeleteParams as UserSchemaDeleteParams, diff --git a/src/resources/api-gateway/configurations.ts b/src/resources/api-gateway/configurations.ts index 5659e51452..8d390ae8aa 100644 --- a/src/resources/api-gateway/configurations.ts +++ b/src/resources/api-gateway/configurations.ts @@ -2,11 +2,10 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as UserSchemasAPI from './user-schemas/user-schemas'; export class Configurations extends APIResource { /** - * Set configuration properties + * Update configuration properties * * @example * ```ts @@ -19,12 +18,15 @@ export class Configurations extends APIResource { * }); * ``` */ - update( - params: ConfigurationUpdateParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - const { zone_id, ...body } = params; - return this._client.put(`/zones/${zone_id}/api_gateway/configuration`, { body, ...options }); + update(params: ConfigurationUpdateParams, options?: Core.RequestOptions): Core.APIPromise { + const { zone_id, normalize, ...body } = params; + return ( + this._client.put(`/zones/${zone_id}/api_gateway/configuration`, { + query: { normalize }, + body, + ...options, + }) as Core.APIPromise<{ result: Configuration }> + )._thenUnwrap((obj) => obj.result); } /** @@ -93,17 +95,6 @@ export namespace Configuration { } } -export interface ConfigurationUpdateResponse { - errors: UserSchemasAPI.Message; - - messages: UserSchemasAPI.Message; - - /** - * Whether the API call was successful. - */ - success: true; -} - export interface ConfigurationUpdateParams { /** * Path param: Identifier. @@ -117,6 +108,12 @@ export interface ConfigurationUpdateParams { | ConfigurationUpdateParams.APIShieldAuthIDCharacteristic | ConfigurationUpdateParams.APIShieldAuthIDCharacteristicJWTClaim >; + + /** + * Query param: Ensures that the configuration is written or retrieved in + * normalized fashion + */ + normalize?: boolean; } export namespace ConfigurationUpdateParams { @@ -164,15 +161,15 @@ export interface ConfigurationGetParams { zone_id: string; /** - * Query param: Requests information about certain properties. + * Query param: Ensures that the configuration is written or retrieved in + * normalized fashion */ - properties?: Array<'auth_id_characteristics'>; + normalize?: boolean; } export declare namespace Configurations { export { type Configuration as Configuration, - type ConfigurationUpdateResponse as ConfigurationUpdateResponse, type ConfigurationUpdateParams as ConfigurationUpdateParams, type ConfigurationGetParams as ConfigurationGetParams, }; diff --git a/src/resources/api-gateway/index.ts b/src/resources/api-gateway/index.ts index 5941af87f3..494074729b 100644 --- a/src/resources/api-gateway/index.ts +++ b/src/resources/api-gateway/index.ts @@ -4,7 +4,6 @@ export { APIGateway } from './api-gateway'; export { Configurations, type Configuration, - type ConfigurationUpdateResponse, type ConfigurationUpdateParams, type ConfigurationGetParams, } from './configurations'; @@ -16,6 +15,19 @@ export { type DiscoveryGetParams, } from './discovery/index'; export { ExpressionTemplate } from './expression-template/index'; +export { + OldPublicSchemasV4PagePaginationArray, + UserSchemas, + type Message, + type OldPublicSchema, + type UserSchemaCreateResponse, + type UserSchemaDeleteResponse, + type UserSchemaCreateParams, + type UserSchemaListParams, + type UserSchemaDeleteParams, + type UserSchemaEditParams, + type UserSchemaGetParams, +} from './user-schemas/index'; export { OperationListResponsesV4PagePaginationArray, OperationBulkCreateResponsesSinglePage, @@ -34,18 +46,5 @@ export { type OperationBulkDeleteParams, type OperationGetParams, } from './operations/index'; -export { - PublicSchemasV4PagePaginationArray, - UserSchemas, - type Message, - type PublicSchema, - type SchemaUpload, - type UserSchemaDeleteResponse, - type UserSchemaCreateParams, - type UserSchemaListParams, - type UserSchemaDeleteParams, - type UserSchemaEditParams, - type UserSchemaGetParams, -} from './user-schemas/index'; export { Schemas, type SchemaListResponse, type SchemaListParams } from './schemas'; export { Settings } from './settings/index'; diff --git a/src/resources/api-gateway/operations/schema-validation.ts b/src/resources/api-gateway/operations/schema-validation.ts index 19466e0d9f..f9f298355e 100644 --- a/src/resources/api-gateway/operations/schema-validation.ts +++ b/src/resources/api-gateway/operations/schema-validation.ts @@ -3,6 +3,9 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; +/** + * @deprecated Please use the [Schema Validation Operations Settings](https://developers.cloudflare.com/api/resources/schema_validation/subresources/settings/subresources/operations/) APIs instead + */ export class SchemaValidation extends APIResource { /** * Updates operation-level schema validation settings on the zone diff --git a/src/resources/api-gateway/settings/settings.ts b/src/resources/api-gateway/settings/settings.ts index 9c7236a309..505baddce3 100644 --- a/src/resources/api-gateway/settings/settings.ts +++ b/src/resources/api-gateway/settings/settings.ts @@ -9,6 +9,9 @@ import { SchemaValidationUpdateParams, } from './schema-validation'; +/** + * @deprecated Please use the [Schema Validation Settings](https://developers.cloudflare.com/api/resources/schema_validation/subresources/settings/) APIs instead + */ export class Settings extends APIResource { schemaValidation: SchemaValidationAPI.SchemaValidation = new SchemaValidationAPI.SchemaValidation( this._client, diff --git a/src/resources/api-gateway/user-schemas/index.ts b/src/resources/api-gateway/user-schemas/index.ts index 867f9925f7..73dd44c925 100644 --- a/src/resources/api-gateway/user-schemas/index.ts +++ b/src/resources/api-gateway/user-schemas/index.ts @@ -7,17 +7,11 @@ export { type HostListParams, } from './hosts'; export { - OperationListResponsesV4PagePaginationArray, - Operations, - type OperationListResponse, - type OperationListParams, -} from './operations'; -export { - PublicSchemasV4PagePaginationArray, + OldPublicSchemasV4PagePaginationArray, UserSchemas, type Message, - type PublicSchema, - type SchemaUpload, + type OldPublicSchema, + type UserSchemaCreateResponse, type UserSchemaDeleteResponse, type UserSchemaCreateParams, type UserSchemaListParams, @@ -25,3 +19,9 @@ export { type UserSchemaEditParams, type UserSchemaGetParams, } from './user-schemas'; +export { + OperationListResponsesV4PagePaginationArray, + Operations, + type OperationListResponse, + type OperationListParams, +} from './operations'; diff --git a/src/resources/api-gateway/user-schemas/user-schemas.ts b/src/resources/api-gateway/user-schemas/user-schemas.ts index f143c9c67d..e2e0aaf6c2 100644 --- a/src/resources/api-gateway/user-schemas/user-schemas.ts +++ b/src/resources/api-gateway/user-schemas/user-schemas.ts @@ -13,6 +13,9 @@ import { } from './operations'; import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../../pagination'; +/** + * @deprecated Please use the [Schema Validation](https://developers.cloudflare.com/api/resources/schema_validation/) APIs instead + */ export class UserSchemas extends APIResource { operations: OperationsAPI.Operations = new OperationsAPI.Operations(this._client); hosts: HostsAPI.Hosts = new HostsAPI.Hosts(this._client); @@ -22,13 +25,16 @@ export class UserSchemas extends APIResource { * * @deprecated Use [Schema Validation API](https://developers.cloudflare.com/api/resources/schema_validation/) instead. */ - create(params: UserSchemaCreateParams, options?: Core.RequestOptions): Core.APIPromise { + create( + params: UserSchemaCreateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { const { zone_id, ...body } = params; return ( this._client.post( `/zones/${zone_id}/api_gateway/user_schemas`, Core.multipartFormRequestOptions({ body, ...options }), - ) as Core.APIPromise<{ result: SchemaUpload }> + ) as Core.APIPromise<{ result: UserSchemaCreateResponse }> )._thenUnwrap((obj) => obj.result); } @@ -40,11 +46,11 @@ export class UserSchemas extends APIResource { list( params: UserSchemaListParams, options?: Core.RequestOptions, - ): Core.PagePromise { + ): Core.PagePromise { const { zone_id, ...query } = params; return this._client.getAPIList( `/zones/${zone_id}/api_gateway/user_schemas`, - PublicSchemasV4PagePaginationArray, + OldPublicSchemasV4PagePaginationArray, { query, ...options }, ); } @@ -72,13 +78,13 @@ export class UserSchemas extends APIResource { schemaId: string, params: UserSchemaEditParams, options?: Core.RequestOptions, - ): Core.APIPromise { + ): Core.APIPromise { const { zone_id, ...body } = params; return ( this._client.patch(`/zones/${zone_id}/api_gateway/user_schemas/${schemaId}`, { body, ...options, - }) as Core.APIPromise<{ result: PublicSchema }> + }) as Core.APIPromise<{ result: OldPublicSchema }> )._thenUnwrap((obj) => obj.result); } @@ -91,18 +97,18 @@ export class UserSchemas extends APIResource { schemaId: string, params: UserSchemaGetParams, options?: Core.RequestOptions, - ): Core.APIPromise { + ): Core.APIPromise { const { zone_id, ...query } = params; return ( this._client.get(`/zones/${zone_id}/api_gateway/user_schemas/${schemaId}`, { query, ...options, - }) as Core.APIPromise<{ result: PublicSchema }> + }) as Core.APIPromise<{ result: OldPublicSchema }> )._thenUnwrap((obj) => obj.result); } } -export class PublicSchemasV4PagePaginationArray extends V4PagePaginationArray {} +export class OldPublicSchemasV4PagePaginationArray extends V4PagePaginationArray {} export type Message = Array; @@ -124,7 +130,7 @@ export namespace Message { } } -export interface PublicSchema { +export interface OldPublicSchema { created_at: string; /** @@ -153,13 +159,13 @@ export interface PublicSchema { validation_enabled?: boolean; } -export interface SchemaUpload { - schema: PublicSchema; +export interface UserSchemaCreateResponse { + schema: OldPublicSchema; - upload_details?: SchemaUpload.UploadDetails; + upload_details?: UserSchemaCreateResponse.UploadDetails; } -export namespace SchemaUpload { +export namespace UserSchemaCreateResponse { export interface UploadDetails { /** * Diagnostic warning events that occurred during processing. These events are @@ -276,7 +282,7 @@ export interface UserSchemaGetParams { omit_source?: boolean; } -UserSchemas.PublicSchemasV4PagePaginationArray = PublicSchemasV4PagePaginationArray; +UserSchemas.OldPublicSchemasV4PagePaginationArray = OldPublicSchemasV4PagePaginationArray; UserSchemas.Operations = Operations; UserSchemas.OperationListResponsesV4PagePaginationArray = OperationListResponsesV4PagePaginationArray; UserSchemas.Hosts = Hosts; @@ -285,10 +291,10 @@ UserSchemas.HostListResponsesV4PagePaginationArray = HostListResponsesV4PagePagi export declare namespace UserSchemas { export { type Message as Message, - type PublicSchema as PublicSchema, - type SchemaUpload as SchemaUpload, + type OldPublicSchema as OldPublicSchema, + type UserSchemaCreateResponse as UserSchemaCreateResponse, type UserSchemaDeleteResponse as UserSchemaDeleteResponse, - PublicSchemasV4PagePaginationArray as PublicSchemasV4PagePaginationArray, + OldPublicSchemasV4PagePaginationArray as OldPublicSchemasV4PagePaginationArray, type UserSchemaCreateParams as UserSchemaCreateParams, type UserSchemaListParams as UserSchemaListParams, type UserSchemaDeleteParams as UserSchemaDeleteParams, diff --git a/src/resources/client-certificates.ts b/src/resources/client-certificates.ts index 67289dfae7..a7842e54dd 100644 --- a/src/resources/client-certificates.ts +++ b/src/resources/client-certificates.ts @@ -102,12 +102,12 @@ export class ClientCertificates extends APIResource { params: ClientCertificateEditParams, options?: Core.RequestOptions, ): Core.APIPromise { - const { zone_id } = params; + const { zone_id, ...body } = params; return ( - this._client.patch( - `/zones/${zone_id}/client_certificates/${clientCertificateId}`, - options, - ) as Core.APIPromise<{ result: ClientCertificate }> + this._client.patch(`/zones/${zone_id}/client_certificates/${clientCertificateId}`, { + body, + ...options, + }) as Core.APIPromise<{ result: ClientCertificate }> )._thenUnwrap((obj) => obj.result); } @@ -293,9 +293,14 @@ export interface ClientCertificateDeleteParams { export interface ClientCertificateEditParams { /** - * Identifier. + * Path param: Identifier. */ zone_id: string; + + /** + * Body param: + */ + reactivate?: boolean; } export interface ClientCertificateGetParams { diff --git a/src/resources/cloudforce-one/threat-events/attackers.ts b/src/resources/cloudforce-one/threat-events/attackers.ts index 8e7254e8cf..db6807ef5a 100644 --- a/src/resources/cloudforce-one/threat-events/attackers.ts +++ b/src/resources/cloudforce-one/threat-events/attackers.ts @@ -5,7 +5,7 @@ import * as Core from '../../../core'; export class Attackers extends APIResource { /** - * Lists attackers + * Lists attackers across multiple datasets * * @example * ```ts @@ -16,8 +16,8 @@ export class Attackers extends APIResource { * ``` */ list(params: AttackerListParams, options?: Core.RequestOptions): Core.APIPromise { - const { account_id } = params; - return this._client.get(`/accounts/${account_id}/cloudforce-one/events/attackers`, options); + const { account_id, ...query } = params; + return this._client.get(`/accounts/${account_id}/cloudforce-one/events/attackers`, { query, ...options }); } } @@ -35,9 +35,15 @@ export namespace AttackerListResponse { export interface AttackerListParams { /** - * Account ID. + * Path param: Account ID. */ account_id: string; + + /** + * Query param: Array of dataset IDs to query attackers from. If not provided, uses + * the default dataset. + */ + datasetIds?: Array; } export declare namespace Attackers { diff --git a/src/resources/cloudforce-one/threat-events/categories.ts b/src/resources/cloudforce-one/threat-events/categories.ts index 9b19bc008e..cd9e316204 100644 --- a/src/resources/cloudforce-one/threat-events/categories.ts +++ b/src/resources/cloudforce-one/threat-events/categories.ts @@ -31,7 +31,7 @@ export class Categories extends APIResource { } /** - * Lists categories + * Lists categories across multiple datasets * * @example * ```ts @@ -42,8 +42,11 @@ export class Categories extends APIResource { * ``` */ list(params: CategoryListParams, options?: Core.RequestOptions): Core.APIPromise { - const { account_id } = params; - return this._client.get(`/accounts/${account_id}/cloudforce-one/events/categories`, options); + const { account_id, ...query } = params; + return this._client.get(`/accounts/${account_id}/cloudforce-one/events/categories`, { + query, + ...options, + }); } /** @@ -204,9 +207,15 @@ export interface CategoryCreateParams { export interface CategoryListParams { /** - * Account ID. + * Path param: Account ID. */ account_id: string; + + /** + * Query param: Array of dataset IDs to query categories from. If not provided, + * uses the default dataset. + */ + datasetIds?: Array; } export interface CategoryDeleteParams { diff --git a/src/resources/cloudforce-one/threat-events/indicator-types.ts b/src/resources/cloudforce-one/threat-events/indicator-types.ts index 7fa1b77a16..030839110f 100644 --- a/src/resources/cloudforce-one/threat-events/indicator-types.ts +++ b/src/resources/cloudforce-one/threat-events/indicator-types.ts @@ -5,15 +5,10 @@ import * as Core from '../../../core'; export class IndicatorTypes extends APIResource { /** - * Lists all indicator types + * This Method is deprecated. Please use /events/dataset/:dataset_id/indicatorTypes + * instead. * - * @example - * ```ts - * const indicatorTypes = - * await client.cloudforceOne.threatEvents.indicatorTypes.list( - * { account_id: 'account_id' }, - * ); - * ``` + * @deprecated */ list( params: IndicatorTypeListParams, diff --git a/src/resources/cloudforce-one/threat-events/target-industries.ts b/src/resources/cloudforce-one/threat-events/target-industries.ts index 06a6f38e30..e1adaf13f9 100644 --- a/src/resources/cloudforce-one/threat-events/target-industries.ts +++ b/src/resources/cloudforce-one/threat-events/target-industries.ts @@ -5,7 +5,7 @@ import * as Core from '../../../core'; export class TargetIndustries extends APIResource { /** - * Lists all target industries + * Lists target industries across multiple datasets * * @example * ```ts @@ -19,8 +19,11 @@ export class TargetIndustries extends APIResource { params: TargetIndustryListParams, options?: Core.RequestOptions, ): Core.APIPromise { - const { account_id } = params; - return this._client.get(`/accounts/${account_id}/cloudforce-one/events/targetIndustries`, options); + const { account_id, ...query } = params; + return this._client.get(`/accounts/${account_id}/cloudforce-one/events/targetIndustries`, { + query, + ...options, + }); } } @@ -38,9 +41,15 @@ export namespace TargetIndustryListResponse { export interface TargetIndustryListParams { /** - * Account ID. + * Path param: Account ID. */ account_id: string; + + /** + * Query param: Array of dataset IDs to query target industries from. If not + * provided, uses the default dataset. + */ + datasetIds?: Array; } export declare namespace TargetIndustries { diff --git a/src/resources/cloudforce-one/threat-events/threat-events.ts b/src/resources/cloudforce-one/threat-events/threat-events.ts index 119f0b95d8..abe2131fae 100644 --- a/src/resources/cloudforce-one/threat-events/threat-events.ts +++ b/src/resources/cloudforce-one/threat-events/threat-events.ts @@ -87,7 +87,6 @@ export class ThreatEvents extends APIResource { * category: 'Domain Resolution', * date: '2022-04-01T00:00:00Z', * event: 'An attacker registered the domain domain.com', - * indicatorType: 'domain', * raw: { data: { foo: 'bar' } }, * tlp: 'amber', * }); @@ -165,7 +164,6 @@ export class ThreatEvents extends APIResource { * date: '2022-04-01T00:00:00Z', * event: * 'An attacker registered the domain domain.com', - * indicatorType: 'domain', * raw: { data: { foo: 'bar' } }, * tlp: 'amber', * }, @@ -209,15 +207,10 @@ export class ThreatEvents extends APIResource { } /** - * Reads an event + * This Method is deprecated. Please use + * /events/dataset/:dataset_id/events/:event_id instead. * - * @example - * ```ts - * const threatEvent = - * await client.cloudforceOne.threatEvents.get('event_id', { - * account_id: 'account_id', - * }); - * ``` + * @deprecated */ get( eventId: string, @@ -240,6 +233,8 @@ export interface ThreatEventCreateResponse { event: string; + hasChildren: boolean; + indicator: string; indicatorType: string; @@ -293,6 +288,8 @@ export namespace ThreatEventListResponse { event: string; + hasChildren: boolean; + indicator: string; indicatorType: string; @@ -338,9 +335,48 @@ export interface ThreatEventDeleteResponse { } /** - * Number of created bulk events + * Detailed result of bulk event creation with auto-tag management */ -export type ThreatEventBulkCreateResponse = number; +export interface ThreatEventBulkCreateResponse { + /** + * Number of events created + */ + createdEventsCount: number; + + /** + * Number of indicators created + */ + createdIndicatorsCount: number; + + /** + * Number of tags created in SoT + */ + createdTagsCount: number; + + /** + * Number of errors encountered + */ + errorCount: number; + + /** + * Array of error details + */ + errors?: Array; +} + +export namespace ThreatEventBulkCreateResponse { + export interface Error { + /** + * Error message + */ + error: string; + + /** + * Index of the event that caused the error + */ + eventIndex: number; + } +} export interface ThreatEventEditResponse { attacker: string; @@ -353,6 +389,8 @@ export interface ThreatEventEditResponse { event: string; + hasChildren: boolean; + indicator: string; indicatorType: string; @@ -403,6 +441,8 @@ export interface ThreatEventGetResponse { event: string; + hasChildren: boolean; + indicator: string; indicatorType: string; @@ -463,11 +503,6 @@ export interface ThreatEventCreateParams { */ event: string; - /** - * Body param: - */ - indicatorType: string; - /** * Body param: */ @@ -503,6 +538,17 @@ export interface ThreatEventCreateParams { */ indicator?: string; + /** + * Body param: Array of indicators for this event. Supports multiple indicators per + * event for complex scenarios. + */ + indicators?: Array; + + /** + * Body param: + */ + indicatorType?: string; + /** * Body param: */ @@ -532,6 +578,18 @@ export namespace ThreatEventCreateParams { tlp?: string; } + + export interface Indicator { + /** + * The type of indicator (e.g., DOMAIN, IP, JA3, HASH) + */ + indicatorType: string; + + /** + * The indicator value (e.g., domain name, IP address, hash) + */ + value: string; + } } export interface ThreatEventListParams { @@ -630,8 +688,6 @@ export namespace ThreatEventBulkCreateParams { event: string; - indicatorType: string; - raw: Data.Raw; tlp: string; @@ -646,6 +702,14 @@ export namespace ThreatEventBulkCreateParams { indicator?: string; + /** + * Array of indicators for this event. Supports multiple indicators per event for + * complex scenarios. + */ + indicators?: Array; + + indicatorType?: string; + insight?: string; tags?: Array; @@ -663,6 +727,18 @@ export namespace ThreatEventBulkCreateParams { tlp?: string; } + + export interface Indicator { + /** + * The type of indicator (e.g., DOMAIN, IP, JA3, HASH) + */ + indicatorType: string; + + /** + * The indicator value (e.g., domain name, IP address, hash) + */ + value: string; + } } } diff --git a/src/resources/connectivity.ts b/src/resources/connectivity.ts new file mode 100644 index 0000000000..341db75965 --- /dev/null +++ b/src/resources/connectivity.ts @@ -0,0 +1,3 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export * from './connectivity/index'; diff --git a/src/resources/connectivity/connectivity.ts b/src/resources/connectivity/connectivity.ts new file mode 100644 index 0000000000..5b5cdd89eb --- /dev/null +++ b/src/resources/connectivity/connectivity.ts @@ -0,0 +1,15 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../resource'; +import * as DirectoryAPI from './directory/directory'; +import { Directory } from './directory/directory'; + +export class Connectivity extends APIResource { + directory: DirectoryAPI.Directory = new DirectoryAPI.Directory(this._client); +} + +Connectivity.Directory = Directory; + +export declare namespace Connectivity { + export { Directory as Directory }; +} diff --git a/src/resources/connectivity/directory.ts b/src/resources/connectivity/directory.ts new file mode 100644 index 0000000000..2756bf16f7 --- /dev/null +++ b/src/resources/connectivity/directory.ts @@ -0,0 +1,3 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export * from './directory/index'; diff --git a/src/resources/connectivity/directory/directory.ts b/src/resources/connectivity/directory/directory.ts new file mode 100644 index 0000000000..2966ea7f0f --- /dev/null +++ b/src/resources/connectivity/directory/directory.ts @@ -0,0 +1,40 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../resource'; +import * as ServicesAPI from './services'; +import { + ServiceCreateParams, + ServiceCreateResponse, + ServiceDeleteParams, + ServiceGetParams, + ServiceGetResponse, + ServiceListParams, + ServiceListResponse, + ServiceListResponsesV4PagePaginationArray, + ServiceUpdateParams, + ServiceUpdateResponse, + Services, +} from './services'; + +export class Directory extends APIResource { + services: ServicesAPI.Services = new ServicesAPI.Services(this._client); +} + +Directory.Services = Services; +Directory.ServiceListResponsesV4PagePaginationArray = ServiceListResponsesV4PagePaginationArray; + +export declare namespace Directory { + export { + Services as Services, + type ServiceCreateResponse as ServiceCreateResponse, + type ServiceUpdateResponse as ServiceUpdateResponse, + type ServiceListResponse as ServiceListResponse, + type ServiceGetResponse as ServiceGetResponse, + ServiceListResponsesV4PagePaginationArray as ServiceListResponsesV4PagePaginationArray, + type ServiceCreateParams as ServiceCreateParams, + type ServiceUpdateParams as ServiceUpdateParams, + type ServiceListParams as ServiceListParams, + type ServiceDeleteParams as ServiceDeleteParams, + type ServiceGetParams as ServiceGetParams, + }; +} diff --git a/src/resources/connectivity/directory/index.ts b/src/resources/connectivity/directory/index.ts new file mode 100644 index 0000000000..2d94b5e566 --- /dev/null +++ b/src/resources/connectivity/directory/index.ts @@ -0,0 +1,16 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { Directory } from './directory'; +export { + ServiceListResponsesV4PagePaginationArray, + Services, + type ServiceCreateResponse, + type ServiceUpdateResponse, + type ServiceListResponse, + type ServiceGetResponse, + type ServiceCreateParams, + type ServiceUpdateParams, + type ServiceListParams, + type ServiceDeleteParams, + type ServiceGetParams, +} from './services'; diff --git a/src/resources/connectivity/directory/services.ts b/src/resources/connectivity/directory/services.ts new file mode 100644 index 0000000000..65079e2c04 --- /dev/null +++ b/src/resources/connectivity/directory/services.ts @@ -0,0 +1,669 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../resource'; +import * as Core from '../../../core'; +import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../../pagination'; + +export class Services extends APIResource { + /** + * Create connectivity service + * + * @example + * ```ts + * const service = + * await client.connectivity.directory.services.create({ + * account_id: '023e105f4ecef8ad9ca31a8372d0c353', + * host: { + * hostname: 'api.example.com', + * resolver_network: { + * tunnel_id: '0191dce4-9ab4-7fce-b660-8e5dec5172da', + * }, + * }, + * name: 'web-server', + * type: 'http', + * }); + * ``` + */ + create(params: ServiceCreateParams, options?: Core.RequestOptions): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.post(`/accounts/${account_id}/connectivity/directory/services`, { + body, + ...options, + }) as Core.APIPromise<{ result: ServiceCreateResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Update connectivity service + * + * @example + * ```ts + * const service = + * await client.connectivity.directory.services.update( + * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + * { + * account_id: 'account_id', + * host: { + * ipv4: '10.0.0.1', + * network: { + * tunnel_id: '0191dce4-9ab4-7fce-b660-8e5dec5172da', + * }, + * }, + * name: 'web-app', + * type: 'http', + * }, + * ); + * ``` + */ + update( + serviceId: string, + params: ServiceUpdateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.put(`/accounts/${account_id}/connectivity/directory/services/${serviceId}`, { + body, + ...options, + }) as Core.APIPromise<{ result: ServiceUpdateResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * List connectivity services + * + * @example + * ```ts + * // Automatically fetches more pages as needed. + * for await (const serviceListResponse of client.connectivity.directory.services.list( + * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * )) { + * // ... + * } + * ``` + */ + list( + params: ServiceListParams, + options?: Core.RequestOptions, + ): Core.PagePromise { + const { account_id, ...query } = params; + return this._client.getAPIList( + `/accounts/${account_id}/connectivity/directory/services`, + ServiceListResponsesV4PagePaginationArray, + { query, ...options }, + ); + } + + /** + * Delete connectivity service + * + * @example + * ```ts + * await client.connectivity.directory.services.delete( + * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + * { account_id: 'account_id' }, + * ); + * ``` + */ + delete( + serviceId: string, + params: ServiceDeleteParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return this._client.delete(`/accounts/${account_id}/connectivity/directory/services/${serviceId}`, { + ...options, + headers: { Accept: '*/*', ...options?.headers }, + }); + } + + /** + * Get connectivity service + * + * @example + * ```ts + * const service = + * await client.connectivity.directory.services.get( + * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + * { account_id: 'account_id' }, + * ); + * ``` + */ + get( + serviceId: string, + params: ServiceGetParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.get( + `/accounts/${account_id}/connectivity/directory/services/${serviceId}`, + options, + ) as Core.APIPromise<{ result: ServiceGetResponse }> + )._thenUnwrap((obj) => obj.result); + } +} + +export class ServiceListResponsesV4PagePaginationArray extends V4PagePaginationArray {} + +export interface ServiceCreateResponse { + host: + | ServiceCreateResponse.InfraIPv4Host + | ServiceCreateResponse.InfraIPv6Host + | ServiceCreateResponse.InfraDualStackHost + | ServiceCreateResponse.InfraHostnameHost; + + name: string; + + type: 'http'; + + created_at?: string; + + http_port?: number | null; + + https_port?: number | null; + + service_id?: string; + + updated_at?: string; +} + +export namespace ServiceCreateResponse { + export interface InfraIPv4Host { + ipv4: string; + + network: InfraIPv4Host.Network; + } + + export namespace InfraIPv4Host { + export interface Network { + tunnel_id: string; + } + } + + export interface InfraIPv6Host { + ipv6: string; + + network: InfraIPv6Host.Network; + } + + export namespace InfraIPv6Host { + export interface Network { + tunnel_id: string; + } + } + + export interface InfraDualStackHost { + ipv4: string; + + ipv6: string; + + network: InfraDualStackHost.Network; + } + + export namespace InfraDualStackHost { + export interface Network { + tunnel_id: string; + } + } + + export interface InfraHostnameHost { + hostname: string; + + resolver_network: InfraHostnameHost.ResolverNetwork; + } + + export namespace InfraHostnameHost { + export interface ResolverNetwork { + tunnel_id: string; + + resolver_ips?: Array | null; + } + } +} + +export interface ServiceUpdateResponse { + host: + | ServiceUpdateResponse.InfraIPv4Host + | ServiceUpdateResponse.InfraIPv6Host + | ServiceUpdateResponse.InfraDualStackHost + | ServiceUpdateResponse.InfraHostnameHost; + + name: string; + + type: 'http'; + + created_at?: string; + + http_port?: number | null; + + https_port?: number | null; + + service_id?: string; + + updated_at?: string; +} + +export namespace ServiceUpdateResponse { + export interface InfraIPv4Host { + ipv4: string; + + network: InfraIPv4Host.Network; + } + + export namespace InfraIPv4Host { + export interface Network { + tunnel_id: string; + } + } + + export interface InfraIPv6Host { + ipv6: string; + + network: InfraIPv6Host.Network; + } + + export namespace InfraIPv6Host { + export interface Network { + tunnel_id: string; + } + } + + export interface InfraDualStackHost { + ipv4: string; + + ipv6: string; + + network: InfraDualStackHost.Network; + } + + export namespace InfraDualStackHost { + export interface Network { + tunnel_id: string; + } + } + + export interface InfraHostnameHost { + hostname: string; + + resolver_network: InfraHostnameHost.ResolverNetwork; + } + + export namespace InfraHostnameHost { + export interface ResolverNetwork { + tunnel_id: string; + + resolver_ips?: Array | null; + } + } +} + +export interface ServiceListResponse { + host: + | ServiceListResponse.InfraIPv4Host + | ServiceListResponse.InfraIPv6Host + | ServiceListResponse.InfraDualStackHost + | ServiceListResponse.InfraHostnameHost; + + name: string; + + type: 'http'; + + created_at?: string; + + http_port?: number | null; + + https_port?: number | null; + + service_id?: string; + + updated_at?: string; +} + +export namespace ServiceListResponse { + export interface InfraIPv4Host { + ipv4: string; + + network: InfraIPv4Host.Network; + } + + export namespace InfraIPv4Host { + export interface Network { + tunnel_id: string; + } + } + + export interface InfraIPv6Host { + ipv6: string; + + network: InfraIPv6Host.Network; + } + + export namespace InfraIPv6Host { + export interface Network { + tunnel_id: string; + } + } + + export interface InfraDualStackHost { + ipv4: string; + + ipv6: string; + + network: InfraDualStackHost.Network; + } + + export namespace InfraDualStackHost { + export interface Network { + tunnel_id: string; + } + } + + export interface InfraHostnameHost { + hostname: string; + + resolver_network: InfraHostnameHost.ResolverNetwork; + } + + export namespace InfraHostnameHost { + export interface ResolverNetwork { + tunnel_id: string; + + resolver_ips?: Array | null; + } + } +} + +export interface ServiceGetResponse { + host: + | ServiceGetResponse.InfraIPv4Host + | ServiceGetResponse.InfraIPv6Host + | ServiceGetResponse.InfraDualStackHost + | ServiceGetResponse.InfraHostnameHost; + + name: string; + + type: 'http'; + + created_at?: string; + + http_port?: number | null; + + https_port?: number | null; + + service_id?: string; + + updated_at?: string; +} + +export namespace ServiceGetResponse { + export interface InfraIPv4Host { + ipv4: string; + + network: InfraIPv4Host.Network; + } + + export namespace InfraIPv4Host { + export interface Network { + tunnel_id: string; + } + } + + export interface InfraIPv6Host { + ipv6: string; + + network: InfraIPv6Host.Network; + } + + export namespace InfraIPv6Host { + export interface Network { + tunnel_id: string; + } + } + + export interface InfraDualStackHost { + ipv4: string; + + ipv6: string; + + network: InfraDualStackHost.Network; + } + + export namespace InfraDualStackHost { + export interface Network { + tunnel_id: string; + } + } + + export interface InfraHostnameHost { + hostname: string; + + resolver_network: InfraHostnameHost.ResolverNetwork; + } + + export namespace InfraHostnameHost { + export interface ResolverNetwork { + tunnel_id: string; + + resolver_ips?: Array | null; + } + } +} + +export interface ServiceCreateParams { + /** + * Path param: Account identifier + */ + account_id: string; + + /** + * Body param: + */ + host: + | ServiceCreateParams.InfraIPv4Host + | ServiceCreateParams.InfraIPv6Host + | ServiceCreateParams.InfraDualStackHost + | ServiceCreateParams.InfraHostnameHost; + + /** + * Body param: + */ + name: string; + + /** + * Body param: + */ + type: 'http'; + + /** + * Body param: + */ + http_port?: number | null; + + /** + * Body param: + */ + https_port?: number | null; +} + +export namespace ServiceCreateParams { + export interface InfraIPv4Host { + ipv4: string; + + network: InfraIPv4Host.Network; + } + + export namespace InfraIPv4Host { + export interface Network { + tunnel_id: string; + } + } + + export interface InfraIPv6Host { + ipv6: string; + + network: InfraIPv6Host.Network; + } + + export namespace InfraIPv6Host { + export interface Network { + tunnel_id: string; + } + } + + export interface InfraDualStackHost { + ipv4: string; + + ipv6: string; + + network: InfraDualStackHost.Network; + } + + export namespace InfraDualStackHost { + export interface Network { + tunnel_id: string; + } + } + + export interface InfraHostnameHost { + hostname: string; + + resolver_network: InfraHostnameHost.ResolverNetwork; + } + + export namespace InfraHostnameHost { + export interface ResolverNetwork { + tunnel_id: string; + + resolver_ips?: Array | null; + } + } +} + +export interface ServiceUpdateParams { + /** + * Path param: + */ + account_id: string; + + /** + * Body param: + */ + host: + | ServiceUpdateParams.InfraIPv4Host + | ServiceUpdateParams.InfraIPv6Host + | ServiceUpdateParams.InfraDualStackHost + | ServiceUpdateParams.InfraHostnameHost; + + /** + * Body param: + */ + name: string; + + /** + * Body param: + */ + type: 'http'; + + /** + * Body param: + */ + http_port?: number | null; + + /** + * Body param: + */ + https_port?: number | null; +} + +export namespace ServiceUpdateParams { + export interface InfraIPv4Host { + ipv4: string; + + network: InfraIPv4Host.Network; + } + + export namespace InfraIPv4Host { + export interface Network { + tunnel_id: string; + } + } + + export interface InfraIPv6Host { + ipv6: string; + + network: InfraIPv6Host.Network; + } + + export namespace InfraIPv6Host { + export interface Network { + tunnel_id: string; + } + } + + export interface InfraDualStackHost { + ipv4: string; + + ipv6: string; + + network: InfraDualStackHost.Network; + } + + export namespace InfraDualStackHost { + export interface Network { + tunnel_id: string; + } + } + + export interface InfraHostnameHost { + hostname: string; + + resolver_network: InfraHostnameHost.ResolverNetwork; + } + + export namespace InfraHostnameHost { + export interface ResolverNetwork { + tunnel_id: string; + + resolver_ips?: Array | null; + } + } +} + +export interface ServiceListParams extends V4PagePaginationArrayParams { + /** + * Path param: Account identifier + */ + account_id: string; + + /** + * Query param: + */ + type?: 'http' | null; +} + +export interface ServiceDeleteParams { + account_id: string; +} + +export interface ServiceGetParams { + account_id: string; +} + +Services.ServiceListResponsesV4PagePaginationArray = ServiceListResponsesV4PagePaginationArray; + +export declare namespace Services { + export { + type ServiceCreateResponse as ServiceCreateResponse, + type ServiceUpdateResponse as ServiceUpdateResponse, + type ServiceListResponse as ServiceListResponse, + type ServiceGetResponse as ServiceGetResponse, + ServiceListResponsesV4PagePaginationArray as ServiceListResponsesV4PagePaginationArray, + type ServiceCreateParams as ServiceCreateParams, + type ServiceUpdateParams as ServiceUpdateParams, + type ServiceListParams as ServiceListParams, + type ServiceDeleteParams as ServiceDeleteParams, + type ServiceGetParams as ServiceGetParams, + }; +} diff --git a/src/resources/connectivity/index.ts b/src/resources/connectivity/index.ts new file mode 100644 index 0000000000..6672dc60e6 --- /dev/null +++ b/src/resources/connectivity/index.ts @@ -0,0 +1,4 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { Connectivity } from './connectivity'; +export { Directory } from './directory/index'; diff --git a/src/resources/content-scanning/content-scanning.ts b/src/resources/content-scanning/content-scanning.ts index 18f79cbd0a..49130883ac 100644 --- a/src/resources/content-scanning/content-scanning.ts +++ b/src/resources/content-scanning/content-scanning.ts @@ -22,8 +22,67 @@ export class ContentScanning extends APIResource { payloads: PayloadsAPI.Payloads = new PayloadsAPI.Payloads(this._client); settings: SettingsAPI.Settings = new SettingsAPI.Settings(this._client); + /** + * Update the Content Scanning status. + * + * @example + * ```ts + * const contentScanning = await client.contentScanning.create( + * { + * zone_id: '023e105f4ecef8ad9ca31a8372d0c353', + * value: 'enabled', + * }, + * ); + * ``` + */ + create( + params: ContentScanningCreateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { zone_id, ...body } = params; + return ( + this._client.put(`/zones/${zone_id}/content-upload-scan/settings`, { + body, + ...options, + }) as Core.APIPromise<{ result: ContentScanningCreateResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Update the Content Scanning status. + * + * @example + * ```ts + * const contentScanning = await client.contentScanning.update( + * { + * zone_id: '023e105f4ecef8ad9ca31a8372d0c353', + * value: 'enabled', + * }, + * ); + * ``` + */ + update( + params: ContentScanningUpdateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { zone_id, ...body } = params; + return ( + this._client.put(`/zones/${zone_id}/content-upload-scan/settings`, { + body, + ...options, + }) as Core.APIPromise<{ result: ContentScanningUpdateResponse }> + )._thenUnwrap((obj) => obj.result); + } + /** * Disable Content Scanning. + * + * @example + * ```ts + * const response = await client.contentScanning.disable({ + * zone_id: '023e105f4ecef8ad9ca31a8372d0c353', + * }); + * ``` */ disable( params: ContentScanningDisableParams, @@ -39,6 +98,13 @@ export class ContentScanning extends APIResource { /** * Enable Content Scanning. + * + * @example + * ```ts + * const response = await client.contentScanning.enable({ + * zone_id: '023e105f4ecef8ad9ca31a8372d0c353', + * }); + * ``` */ enable( params: ContentScanningEnableParams, @@ -51,12 +117,103 @@ export class ContentScanning extends APIResource { }> )._thenUnwrap((obj) => obj.result); } + + /** + * Retrieve the current status of Content Scanning. + * + * @example + * ```ts + * const contentScanning = await client.contentScanning.get({ + * zone_id: '023e105f4ecef8ad9ca31a8372d0c353', + * }); + * ``` + */ + get( + params: ContentScanningGetParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { zone_id } = params; + return ( + this._client.get(`/zones/${zone_id}/content-upload-scan/settings`, options) as Core.APIPromise<{ + result: ContentScanningGetResponse; + }> + )._thenUnwrap((obj) => obj.result); + } +} + +/** + * Defines the status for Content Scanning. + */ +export interface ContentScanningCreateResponse { + /** + * Defines the last modification date (ISO 8601) of the Content Scanning status. + */ + modified?: string; + + /** + * Defines the status of Content Scanning. + */ + value?: string; +} + +/** + * Defines the status for Content Scanning. + */ +export interface ContentScanningUpdateResponse { + /** + * Defines the last modification date (ISO 8601) of the Content Scanning status. + */ + modified?: string; + + /** + * Defines the status of Content Scanning. + */ + value?: string; } export type ContentScanningDisableResponse = unknown; export type ContentScanningEnableResponse = unknown; +/** + * Defines the status for Content Scanning. + */ +export interface ContentScanningGetResponse { + /** + * Defines the last modification date (ISO 8601) of the Content Scanning status. + */ + modified?: string; + + /** + * Defines the status of Content Scanning. + */ + value?: string; +} + +export interface ContentScanningCreateParams { + /** + * Path param: Defines an identifier. + */ + zone_id: string; + + /** + * Body param: The status value for Content Scanning. + */ + value: 'enabled' | 'disabled'; +} + +export interface ContentScanningUpdateParams { + /** + * Path param: Defines an identifier. + */ + zone_id: string; + + /** + * Body param: The status value for Content Scanning. + */ + value: 'enabled' | 'disabled'; +} + export interface ContentScanningDisableParams { /** * Defines an identifier. @@ -71,6 +228,13 @@ export interface ContentScanningEnableParams { zone_id: string; } +export interface ContentScanningGetParams { + /** + * Defines an identifier. + */ + zone_id: string; +} + ContentScanning.Payloads = Payloads; ContentScanning.PayloadCreateResponsesSinglePage = PayloadCreateResponsesSinglePage; ContentScanning.PayloadListResponsesSinglePage = PayloadListResponsesSinglePage; @@ -79,10 +243,16 @@ ContentScanning.Settings = Settings; export declare namespace ContentScanning { export { + type ContentScanningCreateResponse as ContentScanningCreateResponse, + type ContentScanningUpdateResponse as ContentScanningUpdateResponse, type ContentScanningDisableResponse as ContentScanningDisableResponse, type ContentScanningEnableResponse as ContentScanningEnableResponse, + type ContentScanningGetResponse as ContentScanningGetResponse, + type ContentScanningCreateParams as ContentScanningCreateParams, + type ContentScanningUpdateParams as ContentScanningUpdateParams, type ContentScanningDisableParams as ContentScanningDisableParams, type ContentScanningEnableParams as ContentScanningEnableParams, + type ContentScanningGetParams as ContentScanningGetParams, }; export { diff --git a/src/resources/content-scanning/payloads.ts b/src/resources/content-scanning/payloads.ts index d3fad16a42..12c7fa4b8e 100644 --- a/src/resources/content-scanning/payloads.ts +++ b/src/resources/content-scanning/payloads.ts @@ -7,6 +7,24 @@ import { SinglePage } from '../../pagination'; export class Payloads extends APIResource { /** * Add custom scan expressions for Content Scanning. + * + * @example + * ```ts + * // Automatically fetches more pages as needed. + * for await (const payloadCreateResponse of client.contentScanning.payloads.create( + * { + * zone_id: '023e105f4ecef8ad9ca31a8372d0c353', + * body: [ + * { + * payload: + * 'lookup_json_string(http.request.body.raw, "file")', + * }, + * ], + * }, + * )) { + * // ... + * } + * ``` */ create( params: PayloadCreateParams, @@ -22,6 +40,16 @@ export class Payloads extends APIResource { /** * Get a list of existing custom scan expressions for Content Scanning. + * + * @example + * ```ts + * // Automatically fetches more pages as needed. + * for await (const payloadListResponse of client.contentScanning.payloads.list( + * { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * )) { + * // ... + * } + * ``` */ list( params: PayloadListParams, @@ -37,6 +65,17 @@ export class Payloads extends APIResource { /** * Delete a Content Scan Custom Expression. + * + * @example + * ```ts + * // Automatically fetches more pages as needed. + * for await (const payloadDeleteResponse of client.contentScanning.payloads.delete( + * 'a350a054caa840c9becd89c3b4f0195b', + * { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * )) { + * // ... + * } + * ``` */ delete( expressionId: string, diff --git a/src/resources/content-scanning/settings.ts b/src/resources/content-scanning/settings.ts index 8d5958e68a..4f1eaef4f5 100644 --- a/src/resources/content-scanning/settings.ts +++ b/src/resources/content-scanning/settings.ts @@ -6,6 +6,13 @@ import * as Core from '../../core'; export class Settings extends APIResource { /** * Retrieve the current status of Content Scanning. + * + * @example + * ```ts + * const setting = await client.contentScanning.settings.get({ + * zone_id: '023e105f4ecef8ad9ca31a8372d0c353', + * }); + * ``` */ get(params: SettingGetParams, options?: Core.RequestOptions): Core.APIPromise { const { zone_id } = params; diff --git a/src/resources/custom-pages.ts b/src/resources/custom-pages.ts index 6bd1b13cf7..4c861b1e41 100644 --- a/src/resources/custom-pages.ts +++ b/src/resources/custom-pages.ts @@ -24,13 +24,15 @@ export class CustomPages extends APIResource { */ update( identifier: - | 'waf_block' - | 'ip_block' - | 'country_challenge' - | '500_errors' | '1000_errors' + | '500_errors' + | 'basic_challenge' + | 'country_challenge' + | 'ip_block' | 'managed_challenge' - | 'ratelimit_block', + | 'ratelimit_block' + | 'under_attack' + | 'waf_block', params: CustomPageUpdateParams, options?: Core.RequestOptions, ): Core.APIPromise { @@ -123,36 +125,42 @@ export class CustomPages extends APIResource { */ get( identifier: - | 'waf_block' - | 'ip_block' - | 'country_challenge' - | '500_errors' | '1000_errors' + | '500_errors' + | 'basic_challenge' + | 'country_challenge' + | 'ip_block' | 'managed_challenge' - | 'ratelimit_block', + | 'ratelimit_block' + | 'under_attack' + | 'waf_block', params?: CustomPageGetParams, options?: Core.RequestOptions, ): Core.APIPromise; get( identifier: - | 'waf_block' - | 'ip_block' - | 'country_challenge' - | '500_errors' | '1000_errors' + | '500_errors' + | 'basic_challenge' + | 'country_challenge' + | 'ip_block' | 'managed_challenge' - | 'ratelimit_block', + | 'ratelimit_block' + | 'under_attack' + | 'waf_block', options?: Core.RequestOptions, ): Core.APIPromise; get( identifier: - | 'waf_block' - | 'ip_block' - | 'country_challenge' - | '500_errors' | '1000_errors' + | '500_errors' + | 'basic_challenge' + | 'country_challenge' + | 'ip_block' | 'managed_challenge' - | 'ratelimit_block', + | 'ratelimit_block' + | 'under_attack' + | 'waf_block', params: CustomPageGetParams | Core.RequestOptions = {}, options?: Core.RequestOptions, ): Core.APIPromise { diff --git a/src/resources/d1/database.ts b/src/resources/d1/database.ts index 905848c187..8489b4555e 100644 --- a/src/resources/d1/database.ts +++ b/src/resources/d1/database.ts @@ -658,6 +658,12 @@ export interface DatabaseCreateParams { */ name: string; + /** + * Body param: Specify the location to restrict the D1 database to run and store + * data. If this option is present, the location hint is ignored. + */ + jurisdiction?: 'eu' | 'fedramp'; + /** * Body param: Specify the region to create the D1 primary, if available. If this * option is omitted, the D1 will be created as close as possible to the current @@ -856,40 +862,102 @@ export declare namespace DatabaseImportParams { } } -export interface DatabaseQueryParams { - /** - * Path param: Account identifier tag. - */ - account_id: string; +export type DatabaseQueryParams = DatabaseQueryParams.D1SingleQuery | DatabaseQueryParams.MultipleQueries; - /** - * Body param: Your SQL query. Supports multiple statements, joined by semicolons, - * which will be executed as a batch. - */ - sql: string; +export declare namespace DatabaseQueryParams { + export interface D1SingleQuery { + /** + * Path param: Account identifier tag. + */ + account_id: string; - /** - * Body param: - */ - params?: Array; + /** + * Body param: Your SQL query. Supports multiple statements, joined by semicolons, + * which will be executed as a batch. + */ + sql: string; + + /** + * Body param: + */ + params?: Array; + } + + export interface MultipleQueries { + /** + * Path param: Account identifier tag. + */ + account_id: string; + + /** + * Body param: + */ + batch?: Array; + } + + export namespace MultipleQueries { + /** + * A single query with or without parameters + */ + export interface Batch { + /** + * Your SQL query. Supports multiple statements, joined by semicolons, which will + * be executed as a batch. + */ + sql: string; + + params?: Array; + } + } } -export interface DatabaseRawParams { - /** - * Path param: Account identifier tag. - */ - account_id: string; +export type DatabaseRawParams = DatabaseRawParams.D1SingleQuery | DatabaseRawParams.MultipleQueries; - /** - * Body param: Your SQL query. Supports multiple statements, joined by semicolons, - * which will be executed as a batch. - */ - sql: string; +export declare namespace DatabaseRawParams { + export interface D1SingleQuery { + /** + * Path param: Account identifier tag. + */ + account_id: string; - /** - * Body param: - */ - params?: Array; + /** + * Body param: Your SQL query. Supports multiple statements, joined by semicolons, + * which will be executed as a batch. + */ + sql: string; + + /** + * Body param: + */ + params?: Array; + } + + export interface MultipleQueries { + /** + * Path param: Account identifier tag. + */ + account_id: string; + + /** + * Body param: + */ + batch?: Array; + } + + export namespace MultipleQueries { + /** + * A single query with or without parameters + */ + export interface Batch { + /** + * Your SQL query. Supports multiple statements, joined by semicolons, which will + * be executed as a batch. + */ + sql: string; + + params?: Array; + } + } } Database.DatabaseListResponsesV4PagePaginationArray = DatabaseListResponsesV4PagePaginationArray; diff --git a/src/resources/dns/records.ts b/src/resources/dns/records.ts index 0a09cf3cb4..b3eb5c6bb2 100644 --- a/src/resources/dns/records.ts +++ b/src/resources/dns/records.ts @@ -3701,30 +3701,30 @@ export namespace Record { } export type RecordResponse = - | RecordResponse.ARecord - | RecordResponse.AAAARecord - | RecordResponse.CNAMERecord - | RecordResponse.MXRecord - | RecordResponse.NSRecord - | RecordResponse.OpenpgpkeyRecord - | RecordResponse.PTRRecord - | RecordResponse.TXTRecord - | RecordResponse.CAARecord - | RecordResponse.CERTRecord - | RecordResponse.DNSKEYRecord - | RecordResponse.DSRecord - | RecordResponse.HTTPSRecord - | RecordResponse.LOCRecord - | RecordResponse.NAPTRRecord - | RecordResponse.SMIMEARecord - | RecordResponse.SRVRecord - | RecordResponse.SSHFPRecord - | RecordResponse.SVCBRecord - | RecordResponse.TLSARecord - | RecordResponse.URIRecord; + | RecordResponse.A + | RecordResponse.AAAA + | RecordResponse.CNAME + | RecordResponse.MX + | RecordResponse.NS + | RecordResponse.Openpgpkey + | RecordResponse.PTR + | RecordResponse.TXT + | RecordResponse.CAA + | RecordResponse.CERT + | RecordResponse.DNSKEY + | RecordResponse.DS + | RecordResponse.HTTPS + | RecordResponse.LOC + | RecordResponse.NAPTR + | RecordResponse.SMIMEA + | RecordResponse.SRV + | RecordResponse.SSHFP + | RecordResponse.SVCB + | RecordResponse.TLSA + | RecordResponse.URI; export namespace RecordResponse { - export interface ARecord extends RecordsAPI.ARecord { + export interface A extends RecordsAPI.ARecord { /** * Identifier. */ @@ -3761,7 +3761,7 @@ export namespace RecordResponse { tags_modified_on?: string; } - export interface AAAARecord extends RecordsAPI.AAAARecord { + export interface AAAA extends RecordsAPI.AAAARecord { /** * Identifier. */ @@ -3798,7 +3798,7 @@ export namespace RecordResponse { tags_modified_on?: string; } - export interface CNAMERecord extends RecordsAPI.CNAMERecord { + export interface CNAME extends RecordsAPI.CNAMERecord { /** * Identifier. */ @@ -3835,7 +3835,7 @@ export namespace RecordResponse { tags_modified_on?: string; } - export interface MXRecord extends RecordsAPI.MXRecord { + export interface MX extends RecordsAPI.MXRecord { /** * Identifier. */ @@ -3872,7 +3872,7 @@ export namespace RecordResponse { tags_modified_on?: string; } - export interface NSRecord extends RecordsAPI.NSRecord { + export interface NS extends RecordsAPI.NSRecord { /** * Identifier. */ @@ -3909,7 +3909,7 @@ export namespace RecordResponse { tags_modified_on?: string; } - export interface OpenpgpkeyRecord { + export interface Openpgpkey { /** * Identifier. */ @@ -3960,7 +3960,7 @@ export namespace RecordResponse { /** * Settings for the DNS record. */ - settings: OpenpgpkeyRecord.Settings; + settings: Openpgpkey.Settings; /** * Custom tags for the DNS record. This field has no effect on DNS responses. @@ -3990,7 +3990,7 @@ export namespace RecordResponse { tags_modified_on?: string; } - export namespace OpenpgpkeyRecord { + export namespace Openpgpkey { /** * Settings for the DNS record. */ @@ -4013,7 +4013,7 @@ export namespace RecordResponse { } } - export interface PTRRecord extends RecordsAPI.PTRRecord { + export interface PTR extends RecordsAPI.PTRRecord { /** * Identifier. */ @@ -4050,7 +4050,7 @@ export namespace RecordResponse { tags_modified_on?: string; } - export interface TXTRecord extends RecordsAPI.TXTRecord { + export interface TXT extends RecordsAPI.TXTRecord { /** * Identifier. */ @@ -4087,7 +4087,7 @@ export namespace RecordResponse { tags_modified_on?: string; } - export interface CAARecord extends RecordsAPI.CAARecord { + export interface CAA extends RecordsAPI.CAARecord { /** * Identifier. */ @@ -4124,7 +4124,7 @@ export namespace RecordResponse { tags_modified_on?: string; } - export interface CERTRecord extends RecordsAPI.CERTRecord { + export interface CERT extends RecordsAPI.CERTRecord { /** * Identifier. */ @@ -4161,7 +4161,7 @@ export namespace RecordResponse { tags_modified_on?: string; } - export interface DNSKEYRecord extends RecordsAPI.DNSKEYRecord { + export interface DNSKEY extends RecordsAPI.DNSKEYRecord { /** * Identifier. */ @@ -4198,7 +4198,7 @@ export namespace RecordResponse { tags_modified_on?: string; } - export interface DSRecord extends RecordsAPI.DSRecord { + export interface DS extends RecordsAPI.DSRecord { /** * Identifier. */ @@ -4235,7 +4235,7 @@ export namespace RecordResponse { tags_modified_on?: string; } - export interface HTTPSRecord extends RecordsAPI.HTTPSRecord { + export interface HTTPS extends RecordsAPI.HTTPSRecord { /** * Identifier. */ @@ -4272,7 +4272,7 @@ export namespace RecordResponse { tags_modified_on?: string; } - export interface LOCRecord extends RecordsAPI.LOCRecord { + export interface LOC extends RecordsAPI.LOCRecord { /** * Identifier. */ @@ -4309,7 +4309,7 @@ export namespace RecordResponse { tags_modified_on?: string; } - export interface NAPTRRecord extends RecordsAPI.NAPTRRecord { + export interface NAPTR extends RecordsAPI.NAPTRRecord { /** * Identifier. */ @@ -4346,7 +4346,7 @@ export namespace RecordResponse { tags_modified_on?: string; } - export interface SMIMEARecord extends RecordsAPI.SMIMEARecord { + export interface SMIMEA extends RecordsAPI.SMIMEARecord { /** * Identifier. */ @@ -4383,7 +4383,7 @@ export namespace RecordResponse { tags_modified_on?: string; } - export interface SRVRecord extends RecordsAPI.SRVRecord { + export interface SRV extends RecordsAPI.SRVRecord { /** * Identifier. */ @@ -4420,7 +4420,7 @@ export namespace RecordResponse { tags_modified_on?: string; } - export interface SSHFPRecord extends RecordsAPI.SSHFPRecord { + export interface SSHFP extends RecordsAPI.SSHFPRecord { /** * Identifier. */ @@ -4457,7 +4457,7 @@ export namespace RecordResponse { tags_modified_on?: string; } - export interface SVCBRecord extends RecordsAPI.SVCBRecord { + export interface SVCB extends RecordsAPI.SVCBRecord { /** * Identifier. */ @@ -4494,7 +4494,7 @@ export namespace RecordResponse { tags_modified_on?: string; } - export interface TLSARecord extends RecordsAPI.TLSARecord { + export interface TLSA extends RecordsAPI.TLSARecord { /** * Identifier. */ @@ -4531,7 +4531,7 @@ export namespace RecordResponse { tags_modified_on?: string; } - export interface URIRecord extends RecordsAPI.URIRecord { + export interface URI extends RecordsAPI.URIRecord { /** * Identifier. */ diff --git a/src/resources/email-security/investigate/investigate.ts b/src/resources/email-security/investigate/investigate.ts index a15d9630ba..d9c39fe48c 100644 --- a/src/resources/email-security/investigate/investigate.ts +++ b/src/resources/email-security/investigate/investigate.ts @@ -135,6 +135,10 @@ export interface InvestigateListResponse { edf_hash?: string | null; + envelope_from?: string | null; + + envelope_to?: Array | null; + final_disposition?: | 'MALICIOUS' | 'MALICIOUS-BEC' @@ -158,6 +162,10 @@ export interface InvestigateListResponse { message_id?: string | null; + postfix_id_outbound?: string | null; + + replyto?: string | null; + sent_date?: string | null; subject?: string | null; @@ -182,7 +190,8 @@ export namespace InvestigateListResponse { | 'allowed_recipient' | 'domain_similarity' | 'domain_recency' - | 'managed_acceptable_sender'; + | 'managed_acceptable_sender' + | 'outbound_ndr'; blocklisted_message?: boolean; @@ -195,14 +204,38 @@ export namespace InvestigateListResponse { | 'allowed_recipient' | 'domain_similarity' | 'domain_recency' - | 'managed_acceptable_sender'; + | 'managed_acceptable_sender' + | 'outbound_ndr'; } export interface Finding { + attachment?: string | null; + detail?: string | null; + detection?: + | 'MALICIOUS' + | 'MALICIOUS-BEC' + | 'SUSPICIOUS' + | 'SPOOF' + | 'SPAM' + | 'BULK' + | 'ENCRYPTED' + | 'EXTERNAL' + | 'UNKNOWN' + | 'NONE' + | null; + + field?: string | null; + name?: string | null; + portion?: string | null; + + reason?: string | null; + + score?: number | null; + value?: string | null; } @@ -257,6 +290,10 @@ export interface InvestigateGetResponse { edf_hash?: string | null; + envelope_from?: string | null; + + envelope_to?: Array | null; + final_disposition?: | 'MALICIOUS' | 'MALICIOUS-BEC' @@ -280,6 +317,10 @@ export interface InvestigateGetResponse { message_id?: string | null; + postfix_id_outbound?: string | null; + + replyto?: string | null; + sent_date?: string | null; subject?: string | null; @@ -304,7 +345,8 @@ export namespace InvestigateGetResponse { | 'allowed_recipient' | 'domain_similarity' | 'domain_recency' - | 'managed_acceptable_sender'; + | 'managed_acceptable_sender' + | 'outbound_ndr'; blocklisted_message?: boolean; @@ -317,14 +359,38 @@ export namespace InvestigateGetResponse { | 'allowed_recipient' | 'domain_similarity' | 'domain_recency' - | 'managed_acceptable_sender'; + | 'managed_acceptable_sender' + | 'outbound_ndr'; } export interface Finding { + attachment?: string | null; + detail?: string | null; + detection?: + | 'MALICIOUS' + | 'MALICIOUS-BEC' + | 'SUSPICIOUS' + | 'SPOOF' + | 'SPAM' + | 'BULK' + | 'ENCRYPTED' + | 'EXTERNAL' + | 'UNKNOWN' + | 'NONE' + | null; + + field?: string | null; + name?: string | null; + portion?: string | null; + + reason?: string | null; + + score?: number | null; + value?: string | null; } @@ -355,6 +421,11 @@ export interface InvestigateListParams extends V4PagePaginationArrayParams { */ alert_id?: string; + /** + * Query param: + */ + cursor?: string; + /** * Query param: Determines if the search results will include detections or not. */ diff --git a/src/resources/email-security/settings/domains.ts b/src/resources/email-security/settings/domains.ts index 3f39ad82d4..a18128ec9f 100644 --- a/src/resources/email-security/settings/domains.ts +++ b/src/resources/email-security/settings/domains.ts @@ -400,6 +400,11 @@ export interface DomainListParams extends V4PagePaginationArrayParams { */ domain?: Array; + /** + * Query param: Filters response to domains with the provided integration ID. + */ + integration_id?: string; + /** * Query param: The field to sort by. */ diff --git a/src/resources/iam/iam.ts b/src/resources/iam/iam.ts index c8fef6d0b3..13cff578a1 100644 --- a/src/resources/iam/iam.ts +++ b/src/resources/iam/iam.ts @@ -25,6 +25,23 @@ import { ResourceGroupUpdateResponse, ResourceGroups, } from './resource-groups'; +import * as SSOAPI from './sso'; +import { + SSO, + SSOBeginVerificationParams, + SSOBeginVerificationResponse, + SSOCreateParams, + SSOCreateResponse, + SSODeleteParams, + SSODeleteResponse, + SSOGetParams, + SSOGetResponse, + SSOListParams, + SSOListResponse, + SSOListResponsesSinglePage, + SSOUpdateParams, + SSOUpdateResponse, +} from './sso'; import * as UserGroupsAPI from './user-groups/user-groups'; import { UserGroupCreateParams, @@ -47,6 +64,7 @@ export class IAM extends APIResource { ); resourceGroups: ResourceGroupsAPI.ResourceGroups = new ResourceGroupsAPI.ResourceGroups(this._client); userGroups: UserGroupsAPI.UserGroups = new UserGroupsAPI.UserGroups(this._client); + sso: SSOAPI.SSO = new SSOAPI.SSO(this._client); } IAM.PermissionGroups = PermissionGroups; @@ -55,6 +73,8 @@ IAM.ResourceGroups = ResourceGroups; IAM.ResourceGroupListResponsesSinglePage = ResourceGroupListResponsesSinglePage; IAM.UserGroups = UserGroups; IAM.UserGroupListResponsesV4PagePaginationArray = UserGroupListResponsesV4PagePaginationArray; +IAM.SSO = SSO; +IAM.SSOListResponsesSinglePage = SSOListResponsesSinglePage; export declare namespace IAM { export { @@ -95,4 +115,21 @@ export declare namespace IAM { type UserGroupDeleteParams as UserGroupDeleteParams, type UserGroupGetParams as UserGroupGetParams, }; + + export { + SSO as SSO, + type SSOCreateResponse as SSOCreateResponse, + type SSOUpdateResponse as SSOUpdateResponse, + type SSOListResponse as SSOListResponse, + type SSODeleteResponse as SSODeleteResponse, + type SSOBeginVerificationResponse as SSOBeginVerificationResponse, + type SSOGetResponse as SSOGetResponse, + SSOListResponsesSinglePage as SSOListResponsesSinglePage, + type SSOCreateParams as SSOCreateParams, + type SSOUpdateParams as SSOUpdateParams, + type SSOListParams as SSOListParams, + type SSODeleteParams as SSODeleteParams, + type SSOBeginVerificationParams as SSOBeginVerificationParams, + type SSOGetParams as SSOGetParams, + }; } diff --git a/src/resources/iam/index.ts b/src/resources/iam/index.ts index bdba3c5cd0..d4f22ccc30 100644 --- a/src/resources/iam/index.ts +++ b/src/resources/iam/index.ts @@ -23,6 +23,22 @@ export { type ResourceGroupDeleteParams, type ResourceGroupGetParams, } from './resource-groups'; +export { + SSOListResponsesSinglePage, + SSO, + type SSOCreateResponse, + type SSOUpdateResponse, + type SSOListResponse, + type SSODeleteResponse, + type SSOBeginVerificationResponse, + type SSOGetResponse, + type SSOCreateParams, + type SSOUpdateParams, + type SSOListParams, + type SSODeleteParams, + type SSOBeginVerificationParams, + type SSOGetParams, +} from './sso'; export { UserGroupListResponsesV4PagePaginationArray, UserGroups, diff --git a/src/resources/iam/permission-groups.ts b/src/resources/iam/permission-groups.ts index 7408bd79cb..3b50a9029a 100644 --- a/src/resources/iam/permission-groups.ts +++ b/src/resources/iam/permission-groups.ts @@ -48,7 +48,12 @@ export class PermissionGroups extends APIResource { options?: Core.RequestOptions, ): Core.APIPromise { const { account_id } = params; - return this._client.get(`/accounts/${account_id}/iam/permission_groups/${permissionGroupId}`, options); + return ( + this._client.get( + `/accounts/${account_id}/iam/permission_groups/${permissionGroupId}`, + options, + ) as Core.APIPromise<{ result: PermissionGroupGetResponse }> + )._thenUnwrap((obj) => obj.result); } } diff --git a/src/resources/iam/resource-groups.ts b/src/resources/iam/resource-groups.ts index 83538b9f5a..f80b49855f 100644 --- a/src/resources/iam/resource-groups.ts +++ b/src/resources/iam/resource-groups.ts @@ -30,7 +30,12 @@ export class ResourceGroups extends APIResource { options?: Core.RequestOptions, ): Core.APIPromise { const { account_id, ...body } = params; - return this._client.post(`/accounts/${account_id}/iam/resource_groups`, { body, ...options }); + return ( + this._client.post(`/accounts/${account_id}/iam/resource_groups`, { + body, + ...options, + }) as Core.APIPromise<{ result: ResourceGroupCreateResponse }> + )._thenUnwrap((obj) => obj.result); } /** @@ -51,10 +56,12 @@ export class ResourceGroups extends APIResource { options?: Core.RequestOptions, ): Core.APIPromise { const { account_id, ...body } = params; - return this._client.put(`/accounts/${account_id}/iam/resource_groups/${resourceGroupId}`, { - body, - ...options, - }); + return ( + this._client.put(`/accounts/${account_id}/iam/resource_groups/${resourceGroupId}`, { + body, + ...options, + }) as Core.APIPromise<{ result: ResourceGroupUpdateResponse }> + )._thenUnwrap((obj) => obj.result); } /** @@ -125,7 +132,12 @@ export class ResourceGroups extends APIResource { options?: Core.RequestOptions, ): Core.APIPromise { const { account_id } = params; - return this._client.get(`/accounts/${account_id}/iam/resource_groups/${resourceGroupId}`, options); + return ( + this._client.get( + `/accounts/${account_id}/iam/resource_groups/${resourceGroupId}`, + options, + ) as Core.APIPromise<{ result: ResourceGroupGetResponse }> + )._thenUnwrap((obj) => obj.result); } } @@ -136,19 +148,24 @@ export class ResourceGroupListResponsesSinglePage extends SinglePage; /** * Attributes associated to the resource group. */ - meta?: unknown; + meta?: ResourceGroupCreateResponse.Meta; /** - * A scope is a combination of scope objects which provides additional context. + * Name of the resource group. */ - scope?: ResourceGroupCreateResponse.Scope; + name?: string; } export namespace ResourceGroupCreateResponse { @@ -163,8 +180,7 @@ export namespace ResourceGroupCreateResponse { key: string; /** - * A list of scope objects for additional context. The number of Scope objects - * should not be zero. + * A list of scope objects for additional context. */ objects: Array; } @@ -182,6 +198,15 @@ export namespace ResourceGroupCreateResponse { key: string; } } + + /** + * Attributes associated to the resource group. + */ + export interface Meta { + key?: string; + + value?: string; + } } /** diff --git a/src/resources/iam/sso.ts b/src/resources/iam/sso.ts new file mode 100644 index 0000000000..ecfbfb6028 --- /dev/null +++ b/src/resources/iam/sso.ts @@ -0,0 +1,465 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../resource'; +import * as Core from '../../core'; +import { SinglePage } from '../../pagination'; + +export class SSO extends APIResource { + /** + * Initialize new SSO connector + * + * @example + * ```ts + * const sso = await client.iam.sso.create({ + * account_id: '023e105f4ecef8ad9ca31a8372d0c353', + * email_domain: 'example.com', + * }); + * ``` + */ + create(params: SSOCreateParams, options?: Core.RequestOptions): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.post(`/accounts/${account_id}/sso_connectors`, { body, ...options }) as Core.APIPromise<{ + result: SSOCreateResponse; + }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Update SSO connector state + * + * @example + * ```ts + * const sso = await client.iam.sso.update( + * '023e105f4ecef8ad9ca31a8372d0c353', + * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * ); + * ``` + */ + update( + ssoConnectorId: string, + params: SSOUpdateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.patch(`/accounts/${account_id}/sso_connectors/${ssoConnectorId}`, { + body, + ...options, + }) as Core.APIPromise<{ result: SSOUpdateResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Get all SSO connectors + * + * @example + * ```ts + * // Automatically fetches more pages as needed. + * for await (const ssoListResponse of client.iam.sso.list({ + * account_id: '023e105f4ecef8ad9ca31a8372d0c353', + * })) { + * // ... + * } + * ``` + */ + list( + params: SSOListParams, + options?: Core.RequestOptions, + ): Core.PagePromise { + const { account_id } = params; + return this._client.getAPIList( + `/accounts/${account_id}/sso_connectors`, + SSOListResponsesSinglePage, + options, + ); + } + + /** + * Delete SSO connector + * + * @example + * ```ts + * const sso = await client.iam.sso.delete( + * '023e105f4ecef8ad9ca31a8372d0c353', + * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * ); + * ``` + */ + delete( + ssoConnectorId: string, + params: SSODeleteParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.delete( + `/accounts/${account_id}/sso_connectors/${ssoConnectorId}`, + options, + ) as Core.APIPromise<{ result: SSODeleteResponse | null }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Begin SSO connector verification + * + * @example + * ```ts + * const response = await client.iam.sso.beginVerification( + * '023e105f4ecef8ad9ca31a8372d0c353', + * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * ); + * ``` + */ + beginVerification( + ssoConnectorId: string, + params: SSOBeginVerificationParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return this._client.post( + `/accounts/${account_id}/sso_connectors/${ssoConnectorId}/begin_verification`, + options, + ); + } + + /** + * Get single SSO connector + * + * @example + * ```ts + * const sso = await client.iam.sso.get( + * '023e105f4ecef8ad9ca31a8372d0c353', + * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * ); + * ``` + */ + get( + ssoConnectorId: string, + params: SSOGetParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.get( + `/accounts/${account_id}/sso_connectors/${ssoConnectorId}`, + options, + ) as Core.APIPromise<{ result: SSOGetResponse }> + )._thenUnwrap((obj) => obj.result); + } +} + +export class SSOListResponsesSinglePage extends SinglePage {} + +export interface SSOCreateResponse { + /** + * SSO Connector identifier tag. + */ + id?: string; + + /** + * Timestamp for the creation of the SSO connector + */ + created_on?: string; + + email_domain?: string; + + enabled?: boolean; + + /** + * Timestamp for the last update of the SSO connector + */ + updated_on?: string; + + /** + * Controls the display of FedRAMP language to the user during SSO login + */ + use_fedramp_language?: boolean; + + verification?: SSOCreateResponse.Verification; +} + +export namespace SSOCreateResponse { + export interface Verification { + /** + * DNS verification code. Add this entire string to the DNS TXT record of the email + * domain to validate ownership. + */ + code?: string; + + /** + * The status of the verification code from the verification process. + */ + status?: 'awaiting' | 'pending' | 'failed' | 'verified'; + } +} + +export interface SSOUpdateResponse { + /** + * SSO Connector identifier tag. + */ + id?: string; + + /** + * Timestamp for the creation of the SSO connector + */ + created_on?: string; + + email_domain?: string; + + enabled?: boolean; + + /** + * Timestamp for the last update of the SSO connector + */ + updated_on?: string; + + /** + * Controls the display of FedRAMP language to the user during SSO login + */ + use_fedramp_language?: boolean; + + verification?: SSOUpdateResponse.Verification; +} + +export namespace SSOUpdateResponse { + export interface Verification { + /** + * DNS verification code. Add this entire string to the DNS TXT record of the email + * domain to validate ownership. + */ + code?: string; + + /** + * The status of the verification code from the verification process. + */ + status?: 'awaiting' | 'pending' | 'failed' | 'verified'; + } +} + +export interface SSOListResponse { + /** + * SSO Connector identifier tag. + */ + id?: string; + + /** + * Timestamp for the creation of the SSO connector + */ + created_on?: string; + + email_domain?: string; + + enabled?: boolean; + + /** + * Timestamp for the last update of the SSO connector + */ + updated_on?: string; + + /** + * Controls the display of FedRAMP language to the user during SSO login + */ + use_fedramp_language?: boolean; + + verification?: SSOListResponse.Verification; +} + +export namespace SSOListResponse { + export interface Verification { + /** + * DNS verification code. Add this entire string to the DNS TXT record of the email + * domain to validate ownership. + */ + code?: string; + + /** + * The status of the verification code from the verification process. + */ + status?: 'awaiting' | 'pending' | 'failed' | 'verified'; + } +} + +export interface SSODeleteResponse { + /** + * Identifier + */ + id: string; +} + +export interface SSOBeginVerificationResponse { + errors: Array; + + messages: Array; + + /** + * Whether the API call was successful. + */ + success: true; +} + +export namespace SSOBeginVerificationResponse { + export interface Error { + code: number; + + message: string; + + documentation_url?: string; + + source?: Error.Source; + } + + export namespace Error { + export interface Source { + pointer?: string; + } + } + + export interface Message { + code: number; + + message: string; + + documentation_url?: string; + + source?: Message.Source; + } + + export namespace Message { + export interface Source { + pointer?: string; + } + } +} + +export interface SSOGetResponse { + /** + * SSO Connector identifier tag. + */ + id?: string; + + /** + * Timestamp for the creation of the SSO connector + */ + created_on?: string; + + email_domain?: string; + + enabled?: boolean; + + /** + * Timestamp for the last update of the SSO connector + */ + updated_on?: string; + + /** + * Controls the display of FedRAMP language to the user during SSO login + */ + use_fedramp_language?: boolean; + + verification?: SSOGetResponse.Verification; +} + +export namespace SSOGetResponse { + export interface Verification { + /** + * DNS verification code. Add this entire string to the DNS TXT record of the email + * domain to validate ownership. + */ + code?: string; + + /** + * The status of the verification code from the verification process. + */ + status?: 'awaiting' | 'pending' | 'failed' | 'verified'; + } +} + +export interface SSOCreateParams { + /** + * Path param: Account identifier tag. + */ + account_id: string; + + /** + * Body param: Email domain of the new SSO connector + */ + email_domain: string; + + /** + * Body param: Begin the verification process after creation + */ + begin_verification?: boolean; + + /** + * Body param: Controls the display of FedRAMP language to the user during SSO + * login + */ + use_fedramp_language?: boolean; +} + +export interface SSOUpdateParams { + /** + * Path param: Account identifier tag. + */ + account_id: string; + + /** + * Body param: SSO Connector enabled state + */ + enabled?: boolean; + + /** + * Body param: Controls the display of FedRAMP language to the user during SSO + * login + */ + use_fedramp_language?: boolean; +} + +export interface SSOListParams { + /** + * Account identifier tag. + */ + account_id: string; +} + +export interface SSODeleteParams { + /** + * Account identifier tag. + */ + account_id: string; +} + +export interface SSOBeginVerificationParams { + /** + * Account identifier tag. + */ + account_id: string; +} + +export interface SSOGetParams { + /** + * Account identifier tag. + */ + account_id: string; +} + +SSO.SSOListResponsesSinglePage = SSOListResponsesSinglePage; + +export declare namespace SSO { + export { + type SSOCreateResponse as SSOCreateResponse, + type SSOUpdateResponse as SSOUpdateResponse, + type SSOListResponse as SSOListResponse, + type SSODeleteResponse as SSODeleteResponse, + type SSOBeginVerificationResponse as SSOBeginVerificationResponse, + type SSOGetResponse as SSOGetResponse, + SSOListResponsesSinglePage as SSOListResponsesSinglePage, + type SSOCreateParams as SSOCreateParams, + type SSOUpdateParams as SSOUpdateParams, + type SSOListParams as SSOListParams, + type SSODeleteParams as SSODeleteParams, + type SSOBeginVerificationParams as SSOBeginVerificationParams, + type SSOGetParams as SSOGetParams, + }; +} diff --git a/src/resources/index.ts b/src/resources/index.ts index ac499e1b7f..2d83de14be 100644 --- a/src/resources/index.ts +++ b/src/resources/index.ts @@ -4,8 +4,9 @@ export * from './shared'; export { ACM } from './acm/acm'; export { AI } from './ai/ai'; export { AIGateway } from './ai-gateway/ai-gateway'; +export { AISearch } from './aisearch/aisearch'; export { APIGateway } from './api-gateway/api-gateway'; -export { AbuseReports } from './abuse-reports'; +export { AbuseReports } from './abuse-reports/abuse-reports'; export { Accounts } from './accounts/accounts'; export { Addressing } from './addressing/addressing'; export { Alerting } from './alerting/alerting'; @@ -22,6 +23,7 @@ export { CertificateAuthorities } from './certificate-authorities/certificate-au export { ClientCertificates } from './client-certificates'; export { CloudConnector } from './cloud-connector/cloud-connector'; export { CloudforceOne } from './cloudforce-one/cloudforce-one'; +export { Connectivity } from './connectivity/connectivity'; export { ContentScanning } from './content-scanning/content-scanning'; export { CustomCertificates } from './custom-certificates/custom-certificates'; export { CustomHostnames } from './custom-hostnames/custom-hostnames'; @@ -57,18 +59,21 @@ export { MagicTransit } from './magic-transit/magic-transit'; export { ManagedTransforms } from './managed-transforms'; export { Memberships } from './memberships'; export { NetworkInterconnects } from './network-interconnects/network-interconnects'; +export { Organizations } from './organizations/organizations'; 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 { PageRules } from './page-rules'; export { PageShield } from './page-shield/page-shield'; export { Pages } from './pages/pages'; -export { Pipelines } from './pipelines'; +export { Pipelines } from './pipelines/pipelines'; export { Queues } from './queues/queues'; export { R2 } from './r2/r2'; +export { R2DataCatalog } from './r2-data-catalog/r2-data-catalog'; export { RUM } from './rum/rum'; export { Radar } from './radar/radar'; export { RateLimits } from './rate-limits'; +export { RealtimeKit } from './realtime-kit'; export { Registrar } from './registrar/registrar'; export { RequestTracers } from './request-tracers/request-tracers'; export { ResourceSharing } from './resource-sharing/resource-sharing'; @@ -83,6 +88,7 @@ export { Snippets } from './snippets/snippets'; export { Spectrum } from './spectrum/spectrum'; export { Speed } from './speed/speed'; export { Stream } from './stream/stream'; +export { TokenValidation } from './token-validation/token-validation'; export { Turnstile } from './turnstile/turnstile'; export { URLNormalization } from './url-normalization'; export { URLScanner } from './url-scanner/url-scanner'; diff --git a/src/resources/intel/attack-surface-report/issues.ts b/src/resources/intel/attack-surface-report/issues.ts index 3e41e46003..a10956bec3 100644 --- a/src/resources/intel/attack-surface-report/issues.ts +++ b/src/resources/intel/attack-surface-report/issues.ts @@ -96,14 +96,16 @@ export type IssueType = | 'email_security' | 'exposed_infrastructure' | 'insecure_configuration' - | 'weak_authentication'; + | 'weak_authentication' + | 'configuration_suggestion'; export type IssueTypeParam = | 'compliance_violation' | 'email_security' | 'exposed_infrastructure' | 'insecure_configuration' - | 'weak_authentication'; + | 'weak_authentication' + | 'configuration_suggestion'; export type SeverityQueryParam = 'low' | 'moderate' | 'critical'; @@ -138,7 +140,7 @@ export namespace IssueListResponse { issue_type?: IssuesAPI.IssueType; - payload?: unknown; + payload?: Issue.Payload; resolve_link?: string; @@ -152,6 +154,17 @@ export namespace IssueListResponse { timestamp?: string; } + + export namespace Issue { + export interface Payload { + /** + * Method used to detect insight + */ + detection_method?: string; + + zone_tag?: string; + } + } } export type IssueClassResponse = Array; diff --git a/src/resources/kv/namespaces/values.ts b/src/resources/kv/namespaces/values.ts index a8de1f25b5..49566f425a 100644 --- a/src/resources/kv/namespaces/values.ts +++ b/src/resources/kv/namespaces/values.ts @@ -37,12 +37,8 @@ export class Values extends APIResource { return ( this._client.put( `/accounts/${account_id}/storage/kv/namespaces/${namespaceId}/values/${keyName}`, - Core.multipartFormRequestOptions({ - query: { expiration, expiration_ttl }, - body, - __multipartSyntax: 'json', - ...options, - }), + Core.multipartFormRequestOptions({ query: { expiration, expiration_ttl }, body, + __multipartSyntax: 'json', ...options }), ) as Core.APIPromise<{ result: ValueUpdateResponse | null }> )._thenUnwrap((obj) => obj.result); } diff --git a/src/resources/leaked-credential-checks/detections.ts b/src/resources/leaked-credential-checks/detections.ts index ca2e008bd9..5d259c7c3c 100644 --- a/src/resources/leaked-credential-checks/detections.ts +++ b/src/resources/leaked-credential-checks/detections.ts @@ -105,6 +105,32 @@ export class Detections extends APIResource { ) as Core.APIPromise<{ result: DetectionDeleteResponse }> )._thenUnwrap((obj) => obj.result); } + + /** + * Get user-defined detection pattern for Leaked Credential Checks. + * + * @example + * ```ts + * const detection = + * await client.leakedCredentialChecks.detections.get( + * '18a14bafaa8eb1df04ce683ec18c765e', + * { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * ); + * ``` + */ + get( + detectionId: string, + params: DetectionGetParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { zone_id } = params; + return ( + this._client.get( + `/zones/${zone_id}/leaked-credential-checks/detections/${detectionId}`, + options, + ) as Core.APIPromise<{ result: DetectionGetResponse }> + )._thenUnwrap((obj) => obj.result); + } } export class DetectionListResponsesSinglePage extends SinglePage {} @@ -174,6 +200,27 @@ export interface DetectionListResponse { export type DetectionDeleteResponse = unknown; +/** + * Defines a custom set of username/password expressions to match Leaked Credential + * Checks on. + */ +export interface DetectionGetResponse { + /** + * Defines the unique ID for this custom detection. + */ + id?: string; + + /** + * Defines ehe ruleset expression to use in matching the password in a request. + */ + password?: string; + + /** + * Defines the ruleset expression to use in matching the username in a request. + */ + username?: string; +} + export interface DetectionCreateParams { /** * Path param: Defines an identifier. @@ -226,6 +273,13 @@ export interface DetectionDeleteParams { zone_id: string; } +export interface DetectionGetParams { + /** + * Defines an identifier. + */ + zone_id: string; +} + Detections.DetectionListResponsesSinglePage = DetectionListResponsesSinglePage; export declare namespace Detections { @@ -234,10 +288,12 @@ export declare namespace Detections { type DetectionUpdateResponse as DetectionUpdateResponse, type DetectionListResponse as DetectionListResponse, type DetectionDeleteResponse as DetectionDeleteResponse, + type DetectionGetResponse as DetectionGetResponse, DetectionListResponsesSinglePage as DetectionListResponsesSinglePage, type DetectionCreateParams as DetectionCreateParams, type DetectionUpdateParams as DetectionUpdateParams, type DetectionListParams as DetectionListParams, type DetectionDeleteParams as DetectionDeleteParams, + type DetectionGetParams as DetectionGetParams, }; } diff --git a/src/resources/leaked-credential-checks/index.ts b/src/resources/leaked-credential-checks/index.ts index 1844848bf2..07e645f489 100644 --- a/src/resources/leaked-credential-checks/index.ts +++ b/src/resources/leaked-credential-checks/index.ts @@ -7,9 +7,11 @@ export { type DetectionUpdateResponse, type DetectionListResponse, type DetectionDeleteResponse, + type DetectionGetResponse, type DetectionCreateParams, type DetectionUpdateParams, type DetectionListParams, type DetectionDeleteParams, + type DetectionGetParams, } from './detections'; export { LeakedCredentialChecks } from './leaked-credential-checks'; diff --git a/src/resources/leaked-credential-checks/leaked-credential-checks.ts b/src/resources/leaked-credential-checks/leaked-credential-checks.ts index d8d8de90c1..124e38afea 100644 --- a/src/resources/leaked-credential-checks/leaked-credential-checks.ts +++ b/src/resources/leaked-credential-checks/leaked-credential-checks.ts @@ -8,6 +8,8 @@ import { DetectionCreateResponse, DetectionDeleteParams, DetectionDeleteResponse, + DetectionGetParams, + DetectionGetResponse, DetectionListParams, DetectionListResponse, DetectionListResponsesSinglePage, @@ -123,10 +125,12 @@ export declare namespace LeakedCredentialChecks { type DetectionUpdateResponse as DetectionUpdateResponse, type DetectionListResponse as DetectionListResponse, type DetectionDeleteResponse as DetectionDeleteResponse, + type DetectionGetResponse as DetectionGetResponse, DetectionListResponsesSinglePage as DetectionListResponsesSinglePage, type DetectionCreateParams as DetectionCreateParams, type DetectionUpdateParams as DetectionUpdateParams, type DetectionListParams as DetectionListParams, type DetectionDeleteParams as DetectionDeleteParams, + type DetectionGetParams as DetectionGetParams, }; } diff --git a/src/resources/load-balancers/monitors/monitors.ts b/src/resources/load-balancers/monitors/monitors.ts index e06f9f7ff9..5d94b47214 100644 --- a/src/resources/load-balancers/monitors/monitors.ts +++ b/src/resources/load-balancers/monitors/monitors.ts @@ -240,7 +240,7 @@ export interface Monitor { * SMTP checks. HTTP and HTTPS checks should only define the port when using a * non-standard port (HTTP: default 80, HTTPS: default 443). */ - port?: number; + port?: number | null; /** * Assign this monitor to emulate the specified zone while probing. This parameter @@ -350,7 +350,7 @@ export interface MonitorCreateParams { * TCP, UDP, and SMTP checks. HTTP and HTTPS checks should only define the port * when using a non-standard port (HTTP: default 80, HTTPS: default 443). */ - port?: number; + port?: number | null; /** * Body param: Assign this monitor to emulate the specified zone while probing. @@ -456,7 +456,7 @@ export interface MonitorUpdateParams { * TCP, UDP, and SMTP checks. HTTP and HTTPS checks should only define the port * when using a non-standard port (HTTP: default 80, HTTPS: default 443). */ - port?: number; + port?: number | null; /** * Body param: Assign this monitor to emulate the specified zone while probing. @@ -576,7 +576,7 @@ export interface MonitorEditParams { * TCP, UDP, and SMTP checks. HTTP and HTTPS checks should only define the port * when using a non-standard port (HTTP: default 80, HTTPS: default 443). */ - port?: number; + port?: number | null; /** * Body param: Assign this monitor to emulate the specified zone while probing. diff --git a/src/resources/load-balancers/monitors/previews.ts b/src/resources/load-balancers/monitors/previews.ts index 677afbce1c..c66f70ec9b 100644 --- a/src/resources/load-balancers/monitors/previews.ts +++ b/src/resources/load-balancers/monitors/previews.ts @@ -121,7 +121,7 @@ export interface PreviewCreateParams { * TCP, UDP, and SMTP checks. HTTP and HTTPS checks should only define the port * when using a non-standard port (HTTP: default 80, HTTPS: default 443). */ - port?: number; + port?: number | null; /** * Body param: Assign this monitor to emulate the specified zone while probing. diff --git a/src/resources/load-balancers/pools/health.ts b/src/resources/load-balancers/pools/health.ts index 83f9743c4e..abce788f74 100644 --- a/src/resources/load-balancers/pools/health.ts +++ b/src/resources/load-balancers/pools/health.ts @@ -206,7 +206,7 @@ export interface HealthCreateParams { * TCP, UDP, and SMTP checks. HTTP and HTTPS checks should only define the port * when using a non-standard port (HTTP: default 80, HTTPS: default 443). */ - port?: number; + port?: number | null; /** * Body param: Assign this monitor to emulate the specified zone while probing. diff --git a/src/resources/load-balancers/pools/pools.ts b/src/resources/load-balancers/pools/pools.ts index e99980c31c..dd9af71c53 100644 --- a/src/resources/load-balancers/pools/pools.ts +++ b/src/resources/load-balancers/pools/pools.ts @@ -227,7 +227,7 @@ export interface Pool { /** * Configures load shedding policies and percentages for the pool. */ - load_shedding?: LoadBalancersAPI.LoadShedding; + load_shedding?: LoadBalancersAPI.LoadShedding | null; /** * The longitude of the data center containing the origins used in this pool in @@ -286,7 +286,7 @@ export interface Pool { * Configures origin steering for the pool. Controls how origins are selected for * new sessions and traffic without session affinity. */ - origin_steering?: LoadBalancersAPI.OriginSteering; + origin_steering?: LoadBalancersAPI.OriginSteering | null; /** * The list of origins within this pool. Traffic directed at this pool is balanced @@ -339,7 +339,7 @@ export interface PoolCreateParams { /** * Body param: Configures load shedding policies and percentages for the pool. */ - load_shedding?: LoadBalancersAPI.LoadSheddingParam; + load_shedding?: LoadBalancersAPI.LoadSheddingParam | null; /** * Body param: The longitude of the data center containing the origins used in this @@ -385,7 +385,7 @@ export interface PoolCreateParams { * Body param: Configures origin steering for the pool. Controls how origins are * selected for new sessions and traffic without session affinity. */ - origin_steering?: LoadBalancersAPI.OriginSteeringParam; + origin_steering?: LoadBalancersAPI.OriginSteeringParam | null; } export interface PoolUpdateParams { @@ -434,7 +434,7 @@ export interface PoolUpdateParams { /** * Body param: Configures load shedding policies and percentages for the pool. */ - load_shedding?: LoadBalancersAPI.LoadSheddingParam; + load_shedding?: LoadBalancersAPI.LoadSheddingParam | null; /** * Body param: The longitude of the data center containing the origins used in this @@ -480,7 +480,7 @@ export interface PoolUpdateParams { * Body param: Configures origin steering for the pool. Controls how origins are * selected for new sessions and traffic without session affinity. */ - origin_steering?: LoadBalancersAPI.OriginSteeringParam; + origin_steering?: LoadBalancersAPI.OriginSteeringParam | null; } export interface PoolListParams { @@ -550,7 +550,7 @@ export interface PoolEditParams { /** * Body param: Configures load shedding policies and percentages for the pool. */ - load_shedding?: LoadBalancersAPI.LoadSheddingParam; + load_shedding?: LoadBalancersAPI.LoadSheddingParam | null; /** * Body param: The longitude of the data center containing the origins used in this @@ -602,7 +602,7 @@ export interface PoolEditParams { * Body param: Configures origin steering for the pool. Controls how origins are * selected for new sessions and traffic without session affinity. */ - origin_steering?: LoadBalancersAPI.OriginSteeringParam; + origin_steering?: LoadBalancersAPI.OriginSteeringParam | null; /** * Body param: The list of origins within this pool. Traffic directed at this pool diff --git a/src/resources/logpush/datasets/fields.ts b/src/resources/logpush/datasets/fields.ts index 3ba1f069f7..f0a2086930 100644 --- a/src/resources/logpush/datasets/fields.ts +++ b/src/resources/logpush/datasets/fields.ts @@ -26,6 +26,8 @@ export class Fields extends APIResource { | 'biso_user_actions' | 'casb_findings' | 'device_posture_results' + | 'dex_application_tests' + | 'dex_device_state_events' | 'dlp_forensic_copies' | 'dns_firewall_logs' | 'dns_logs' @@ -35,6 +37,7 @@ export class Fields extends APIResource { | 'gateway_http' | 'gateway_network' | 'http_requests' + | 'ipsec_logs' | 'magic_ids_detections' | 'nel_reports' | 'network_analytics_logs' @@ -42,6 +45,8 @@ export class Fields extends APIResource { | 'sinkhole_http_logs' | 'spectrum_events' | 'ssh_logs' + | 'warp_config_changes' + | 'warp_toggle_changes' | 'workers_trace_events' | 'zaraz_events' | 'zero_trust_network_sessions' @@ -57,6 +62,8 @@ export class Fields extends APIResource { | 'biso_user_actions' | 'casb_findings' | 'device_posture_results' + | 'dex_application_tests' + | 'dex_device_state_events' | 'dlp_forensic_copies' | 'dns_firewall_logs' | 'dns_logs' @@ -66,6 +73,7 @@ export class Fields extends APIResource { | 'gateway_http' | 'gateway_network' | 'http_requests' + | 'ipsec_logs' | 'magic_ids_detections' | 'nel_reports' | 'network_analytics_logs' @@ -73,6 +81,8 @@ export class Fields extends APIResource { | 'sinkhole_http_logs' | 'spectrum_events' | 'ssh_logs' + | 'warp_config_changes' + | 'warp_toggle_changes' | 'workers_trace_events' | 'zaraz_events' | 'zero_trust_network_sessions' @@ -87,6 +97,8 @@ export class Fields extends APIResource { | 'biso_user_actions' | 'casb_findings' | 'device_posture_results' + | 'dex_application_tests' + | 'dex_device_state_events' | 'dlp_forensic_copies' | 'dns_firewall_logs' | 'dns_logs' @@ -96,6 +108,7 @@ export class Fields extends APIResource { | 'gateway_http' | 'gateway_network' | 'http_requests' + | 'ipsec_logs' | 'magic_ids_detections' | 'nel_reports' | 'network_analytics_logs' @@ -103,6 +116,8 @@ export class Fields extends APIResource { | 'sinkhole_http_logs' | 'spectrum_events' | 'ssh_logs' + | 'warp_config_changes' + | 'warp_toggle_changes' | 'workers_trace_events' | 'zaraz_events' | 'zero_trust_network_sessions' diff --git a/src/resources/logpush/datasets/jobs.ts b/src/resources/logpush/datasets/jobs.ts index 90c7438608..e4a3921516 100644 --- a/src/resources/logpush/datasets/jobs.ts +++ b/src/resources/logpush/datasets/jobs.ts @@ -30,6 +30,8 @@ export class Jobs extends APIResource { | 'biso_user_actions' | 'casb_findings' | 'device_posture_results' + | 'dex_application_tests' + | 'dex_device_state_events' | 'dlp_forensic_copies' | 'dns_firewall_logs' | 'dns_logs' @@ -39,6 +41,7 @@ export class Jobs extends APIResource { | 'gateway_http' | 'gateway_network' | 'http_requests' + | 'ipsec_logs' | 'magic_ids_detections' | 'nel_reports' | 'network_analytics_logs' @@ -46,6 +49,8 @@ export class Jobs extends APIResource { | 'sinkhole_http_logs' | 'spectrum_events' | 'ssh_logs' + | 'warp_config_changes' + | 'warp_toggle_changes' | 'workers_trace_events' | 'zaraz_events' | 'zero_trust_network_sessions' @@ -61,6 +66,8 @@ export class Jobs extends APIResource { | 'biso_user_actions' | 'casb_findings' | 'device_posture_results' + | 'dex_application_tests' + | 'dex_device_state_events' | 'dlp_forensic_copies' | 'dns_firewall_logs' | 'dns_logs' @@ -70,6 +77,7 @@ export class Jobs extends APIResource { | 'gateway_http' | 'gateway_network' | 'http_requests' + | 'ipsec_logs' | 'magic_ids_detections' | 'nel_reports' | 'network_analytics_logs' @@ -77,6 +85,8 @@ export class Jobs extends APIResource { | 'sinkhole_http_logs' | 'spectrum_events' | 'ssh_logs' + | 'warp_config_changes' + | 'warp_toggle_changes' | 'workers_trace_events' | 'zaraz_events' | 'zero_trust_network_sessions' @@ -91,6 +101,8 @@ export class Jobs extends APIResource { | 'biso_user_actions' | 'casb_findings' | 'device_posture_results' + | 'dex_application_tests' + | 'dex_device_state_events' | 'dlp_forensic_copies' | 'dns_firewall_logs' | 'dns_logs' @@ -100,6 +112,7 @@ export class Jobs extends APIResource { | 'gateway_http' | 'gateway_network' | 'http_requests' + | 'ipsec_logs' | 'magic_ids_detections' | 'nel_reports' | 'network_analytics_logs' @@ -107,6 +120,8 @@ export class Jobs extends APIResource { | 'sinkhole_http_logs' | 'spectrum_events' | 'ssh_logs' + | 'warp_config_changes' + | 'warp_toggle_changes' | 'workers_trace_events' | 'zaraz_events' | 'zero_trust_network_sessions' diff --git a/src/resources/logpush/jobs.ts b/src/resources/logpush/jobs.ts index 4b6fba4fa1..7a267dce43 100644 --- a/src/resources/logpush/jobs.ts +++ b/src/resources/logpush/jobs.ts @@ -292,6 +292,8 @@ export interface LogpushJob { | 'biso_user_actions' | 'casb_findings' | 'device_posture_results' + | 'dex_application_tests' + | 'dex_device_state_events' | 'dlp_forensic_copies' | 'dns_firewall_logs' | 'dns_logs' @@ -301,6 +303,7 @@ export interface LogpushJob { | 'gateway_http' | 'gateway_network' | 'http_requests' + | 'ipsec_logs' | 'magic_ids_detections' | 'nel_reports' | 'network_analytics_logs' @@ -308,6 +311,8 @@ export interface LogpushJob { | 'sinkhole_http_logs' | 'spectrum_events' | 'ssh_logs' + | 'warp_config_changes' + | 'warp_toggle_changes' | 'workers_trace_events' | 'zaraz_events' | 'zero_trust_network_sessions' @@ -601,6 +606,8 @@ export interface JobCreateParams { | 'biso_user_actions' | 'casb_findings' | 'device_posture_results' + | 'dex_application_tests' + | 'dex_device_state_events' | 'dlp_forensic_copies' | 'dns_firewall_logs' | 'dns_logs' @@ -610,6 +617,7 @@ export interface JobCreateParams { | 'gateway_http' | 'gateway_network' | 'http_requests' + | 'ipsec_logs' | 'magic_ids_detections' | 'nel_reports' | 'network_analytics_logs' @@ -617,6 +625,8 @@ export interface JobCreateParams { | 'sinkhole_http_logs' | 'spectrum_events' | 'ssh_logs' + | 'warp_config_changes' + | 'warp_toggle_changes' | 'workers_trace_events' | 'zaraz_events' | 'zero_trust_network_sessions' diff --git a/src/resources/magic-transit/connectors/connectors.ts b/src/resources/magic-transit/connectors/connectors.ts index c7f3bde0de..368ca729b7 100644 --- a/src/resources/magic-transit/connectors/connectors.ts +++ b/src/resources/magic-transit/connectors/connectors.ts @@ -49,7 +49,7 @@ export class Connectors extends APIResource { } /** - * Replace Connector + * Replace Connector or Re-provision License Key * * @example * ```ts @@ -126,7 +126,7 @@ export class Connectors extends APIResource { } /** - * Edit Connector to update specific properties + * Edit Connector to update specific properties or Re-provision License Key * * @example * ```ts @@ -198,6 +198,8 @@ export interface ConnectorCreateResponse { last_heartbeat?: string; last_seen_version?: string; + + license_key?: string; } export namespace ConnectorCreateResponse { @@ -228,6 +230,8 @@ export interface ConnectorUpdateResponse { last_heartbeat?: string; last_seen_version?: string; + + license_key?: string; } export namespace ConnectorUpdateResponse { @@ -258,6 +262,8 @@ export interface ConnectorListResponse { last_heartbeat?: string; last_seen_version?: string; + + license_key?: string; } export namespace ConnectorListResponse { @@ -288,6 +294,8 @@ export interface ConnectorDeleteResponse { last_heartbeat?: string; last_seen_version?: string; + + license_key?: string; } export namespace ConnectorDeleteResponse { @@ -318,6 +326,8 @@ export interface ConnectorEditResponse { last_heartbeat?: string; last_seen_version?: string; + + license_key?: string; } export namespace ConnectorEditResponse { @@ -348,6 +358,8 @@ export interface ConnectorGetResponse { last_heartbeat?: string; last_seen_version?: string; + + license_key?: string; } export namespace ConnectorGetResponse { @@ -365,7 +377,8 @@ export interface ConnectorCreateParams { account_id: string; /** - * Body param: + * Body param: Exactly one of id, serial_number, or provision_license must be + * provided. */ device: ConnectorCreateParams.Device; @@ -396,9 +409,17 @@ export interface ConnectorCreateParams { } export namespace ConnectorCreateParams { + /** + * Exactly one of id, serial_number, or provision_license must be provided. + */ export interface Device { id?: string; + /** + * When true, create and provision a new licence key for the connector. + */ + provision_license?: boolean; + serial_number?: string; } } @@ -429,6 +450,11 @@ export interface ConnectorUpdateParams { */ notes?: string; + /** + * Body param: When true, regenerate license key for the connector. + */ + provision_license?: boolean; + /** * Body param: */ @@ -475,6 +501,11 @@ export interface ConnectorEditParams { */ notes?: string; + /** + * Body param: When true, regenerate license key for the connector. + */ + provision_license?: boolean; + /** * Body param: */ diff --git a/src/resources/magic-transit/connectors/snapshots/latest.ts b/src/resources/magic-transit/connectors/snapshots/latest.ts index 16d9eaff01..c51d9f1abe 100644 --- a/src/resources/magic-transit/connectors/snapshots/latest.ts +++ b/src/resources/magic-transit/connectors/snapshots/latest.ts @@ -72,6 +72,8 @@ export namespace LatestListResponse { */ v: string; + bonds?: Array; + /** * Count of processors/cores */ @@ -876,6 +878,21 @@ export namespace LatestListResponse { } export namespace Item { + /** + * Snapshot Bond + */ + export interface Bond { + /** + * Name of the network interface + */ + name: string; + + /** + * Current status of the network interface + */ + status: string; + } + /** * Snapshot DHCP lease */ @@ -1279,6 +1296,11 @@ export namespace LatestListResponse { * Connector identifier */ connector_id?: string; + + /** + * MTU as measured between the two ends of the tunnel + */ + probed_mtu?: number; } } } diff --git a/src/resources/magic-transit/connectors/snapshots/snapshots.ts b/src/resources/magic-transit/connectors/snapshots/snapshots.ts index 69b5c098e5..a7d1e0d815 100644 --- a/src/resources/magic-transit/connectors/snapshots/snapshots.ts +++ b/src/resources/magic-transit/connectors/snapshots/snapshots.ts @@ -123,6 +123,8 @@ export interface SnapshotGetResponse { */ v: string; + bonds?: Array; + /** * Count of processors/cores */ @@ -927,6 +929,21 @@ export interface SnapshotGetResponse { } export namespace SnapshotGetResponse { + /** + * Snapshot Bond + */ + export interface Bond { + /** + * Name of the network interface + */ + name: string; + + /** + * Current status of the network interface + */ + status: string; + } + /** * Snapshot DHCP lease */ @@ -1330,6 +1347,11 @@ export namespace SnapshotGetResponse { * Connector identifier */ connector_id?: string; + + /** + * MTU as measured between the two ends of the tunnel + */ + probed_mtu?: number; } } diff --git a/src/resources/magic-transit/ipsec-tunnels.ts b/src/resources/magic-transit/ipsec-tunnels.ts index 1318526e85..ff23a3a048 100644 --- a/src/resources/magic-transit/ipsec-tunnels.ts +++ b/src/resources/magic-transit/ipsec-tunnels.ts @@ -1616,6 +1616,11 @@ export interface IPSECTunnelCreateParams { */ bgp?: IPSECTunnelCreateParams.BGP; + /** + * Body param: + */ + custom_remote_identities?: IPSECTunnelCreateParams.CustomRemoteIdentities; + /** * Body param: The IP address assigned to the customer side of the IPsec tunnel. * Not required, but must be set for proactive traceroutes to work. @@ -1694,6 +1699,20 @@ export namespace IPSECTunnelCreateParams { md5_key?: string; } + export interface CustomRemoteIdentities { + /** + * A custom IKE ID of type FQDN that may be used to identity the IPsec tunnel. The + * generated IKE IDs can still be used even if this custom value is specified. + * + * Must be of the form `..custom.ipsec.cloudflare.com`. + * + * This custom ID does not need to be unique. Two IPsec tunnels may have the same + * custom fqdn_id. However, if another IPsec tunnel has the same value then the two + * tunnels cannot have the same cloudflare_endpoint. + */ + fqdn_id?: string; + } + export interface HealthCheck { /** * The direction of the flow of the healthcheck. Either unidirectional, where the @@ -1783,6 +1802,11 @@ export interface IPSECTunnelUpdateParams { */ bgp?: IPSECTunnelUpdateParams.BGP; + /** + * Body param: + */ + custom_remote_identities?: IPSECTunnelUpdateParams.CustomRemoteIdentities; + /** * Body param: The IP address assigned to the customer side of the IPsec tunnel. * Not required, but must be set for proactive traceroutes to work. @@ -1861,6 +1885,20 @@ export namespace IPSECTunnelUpdateParams { md5_key?: string; } + export interface CustomRemoteIdentities { + /** + * A custom IKE ID of type FQDN that may be used to identity the IPsec tunnel. The + * generated IKE IDs can still be used even if this custom value is specified. + * + * Must be of the form `..custom.ipsec.cloudflare.com`. + * + * This custom ID does not need to be unique. Two IPsec tunnels may have the same + * custom fqdn_id. However, if another IPsec tunnel has the same value then the two + * tunnels cannot have the same cloudflare_endpoint. + */ + fqdn_id?: string; + } + export interface HealthCheck { /** * The direction of the flow of the healthcheck. Either unidirectional, where the diff --git a/src/resources/organizations.ts b/src/resources/organizations.ts new file mode 100644 index 0000000000..61ddaf165e --- /dev/null +++ b/src/resources/organizations.ts @@ -0,0 +1,3 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export * from './organizations/index'; diff --git a/src/resources/organizations/index.ts b/src/resources/organizations/index.ts new file mode 100644 index 0000000000..74e4c1078f --- /dev/null +++ b/src/resources/organizations/index.ts @@ -0,0 +1,8 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { + OrganizationProfileResource, + type OrganizationProfile, + type OrganizationProfileUpdateParams, +} from './organization-profile'; +export { Organizations } from './organizations'; diff --git a/src/resources/organizations/organization-profile.ts b/src/resources/organizations/organization-profile.ts new file mode 100644 index 0000000000..c1f64836a5 --- /dev/null +++ b/src/resources/organizations/organization-profile.ts @@ -0,0 +1,65 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../resource'; +import * as Core from '../../core'; + +export class OrganizationProfileResource extends APIResource { + /** + * Modify organization profile. (Currently in Closed Beta - see + * https://developers.cloudflare.com/fundamentals/organizations/) + */ + update( + organizationId: string, + body: OrganizationProfileUpdateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + return this._client.put(`/organizations/${organizationId}/profile`, { + body, + ...options, + headers: { Accept: '*/*', ...options?.headers }, + }); + } + + /** + * Get an organizations profile if it exists. (Currently in Closed Beta - see + * https://developers.cloudflare.com/fundamentals/organizations/) + */ + get(organizationId: string, options?: Core.RequestOptions): Core.APIPromise { + return ( + this._client.get(`/organizations/${organizationId}/profile`, options) as Core.APIPromise<{ + result: unnamed_schema_0.Result; + }> + )._thenUnwrap((obj) => obj.result); + } +} + +export interface OrganizationProfile { + business_address: string; + + business_email: string; + + business_name: string; + + business_phone: string; + + external_metadata: string; +} + +export interface OrganizationProfileUpdateParams { + business_address: string; + + business_email: string; + + business_name: string; + + business_phone: string; + + external_metadata: string; +} + +export declare namespace OrganizationProfileResource { + export { + type OrganizationProfile as OrganizationProfile, + type OrganizationProfileUpdateParams as OrganizationProfileUpdateParams, + }; +} diff --git a/src/resources/organizations/organizations.ts b/src/resources/organizations/organizations.ts new file mode 100644 index 0000000000..44b26476c0 --- /dev/null +++ b/src/resources/organizations/organizations.ts @@ -0,0 +1,315 @@ +// 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 OrganizationProfileAPI from './organization-profile'; +import { + OrganizationProfile, + OrganizationProfileResource, + OrganizationProfileUpdateParams, +} from './organization-profile'; +import { SinglePage } from '../../pagination'; + +export class Organizations extends APIResource { + organizationProfile: OrganizationProfileAPI.OrganizationProfileResource = + new OrganizationProfileAPI.OrganizationProfileResource(this._client); + + /** + * Create a new organization for a user. (Currently in Closed Beta - see + * https://developers.cloudflare.com/fundamentals/organizations/) + */ + create(body: OrganizationCreateParams, options?: Core.RequestOptions): Core.APIPromise { + return ( + this._client.post('/organizations', { body, ...options }) as Core.APIPromise<{ result: Organization }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Modify organization. (Currently in Closed Beta - see + * https://developers.cloudflare.com/fundamentals/organizations/) + */ + update( + organizationId: string, + body: OrganizationUpdateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + return ( + this._client.put(`/organizations/${organizationId}`, { body, ...options }) as Core.APIPromise<{ + result: Organization; + }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Retrieve a list of organizations a particular user has access to. (Currently in + * Closed Beta - see https://developers.cloudflare.com/fundamentals/organizations/) + */ + list( + query?: OrganizationListParams, + options?: Core.RequestOptions, + ): Core.PagePromise; + list(options?: Core.RequestOptions): Core.PagePromise; + list( + query: OrganizationListParams | Core.RequestOptions = {}, + options?: Core.RequestOptions, + ): Core.PagePromise { + if (isRequestOptions(query)) { + return this.list({}, query); + } + return this._client.getAPIList('/organizations', OrganizationsSinglePage, { query, ...options }); + } + + /** + * Delete an organization. The organization MUST be empty before deleting. It must + * not contain any sub-organizations, accounts, members or users. (Currently in + * Closed Beta - see https://developers.cloudflare.com/fundamentals/organizations/) + */ + delete(organizationId: string, options?: Core.RequestOptions): Core.APIPromise { + return ( + this._client.delete(`/organizations/${organizationId}`, options) as Core.APIPromise<{ + result: OrganizationDeleteResponse; + }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Retrieve the details of a certain organization. (Currently in Closed Beta - see + * https://developers.cloudflare.com/fundamentals/organizations/) + */ + get(organizationId: string, options?: Core.RequestOptions): Core.APIPromise { + return ( + this._client.get(`/organizations/${organizationId}`, options) as Core.APIPromise<{ + result: Organization; + }> + )._thenUnwrap((obj) => obj.result); + } +} + +export class OrganizationsSinglePage extends SinglePage {} + +/** + * References an Organization in the Cloudflare data model. + */ +export interface Organization { + id: string; + + create_time: string; + + meta: Organization.Meta; + + name: string; + + parent?: Organization.Parent; + + profile?: Organization.Profile; +} + +export namespace Organization { + export interface Meta { + /** + * Enable features for Organizations. + */ + flags?: Meta.Flags; + + managed_by?: string; + + [k: string]: unknown; + } + + export namespace Meta { + /** + * Enable features for Organizations. + */ + export interface Flags { + account_creation: string; + + account_deletion: string; + + account_migration: string; + + account_mobility: string; + + sub_org_creation: string; + } + } + + export interface Parent { + id: string; + + name: string; + } + + export interface Profile { + business_address: string; + + business_email: string; + + business_name: string; + + business_phone: string; + + external_metadata: string; + } +} + +export interface OrganizationDeleteResponse { + id: string; +} + +export interface OrganizationCreateParams { + name: string; + + parent?: OrganizationCreateParams.Parent; + + profile?: OrganizationCreateParams.Profile; +} + +export namespace OrganizationCreateParams { + export interface Parent { + id: string; + } + + export interface Profile { + business_address: string; + + business_email: string; + + business_name: string; + + business_phone: string; + + external_metadata: string; + } +} + +export interface OrganizationUpdateParams { + name: string; + + parent?: OrganizationUpdateParams.Parent; + + profile?: OrganizationUpdateParams.Profile; +} + +export namespace OrganizationUpdateParams { + export interface Parent { + id: string; + } + + export interface Profile { + business_address: string; + + business_email: string; + + business_name: string; + + business_phone: string; + + external_metadata: string; + } +} + +export interface OrganizationListParams { + /** + * Only return organizations with the specified IDs (ex. id=foo&id=bar). Send + * multiple elements by repeating the query value. + */ + id?: Array; + + containing?: OrganizationListParams.Containing; + + name?: OrganizationListParams.Name; + + /** + * The amount of items to return. Defaults to 10. + */ + page_size?: number; + + /** + * An opaque token returned from the last list response that when provided will + * retrieve the next page. + * + * Parameters used to filter the retrieved list must remain in subsequent requests + * with a page token. + */ + page_token?: string; + + parent?: OrganizationListParams.Parent; +} + +export namespace OrganizationListParams { + export interface Containing { + /** + * Filter the list of organizations to the ones that contain this particular + * account. + */ + account?: string; + + /** + * Filter the list of organizations to the ones that contain this particular + * organization. + */ + organization?: string; + + /** + * Filter the list of organizations to the ones that contain this particular user. + * + * IMPORTANT: Just because an organization "contains" a user is not a + * representation of any authorization or privilege to manage any resources + * therein. An organization "containing" a user simply means the user is managed by + * that organization. + */ + user?: string; + } + + export interface Name { + /** + * (case-insensitive) Filter the list of organizations to where the name contains a + * particular string. + */ + contains?: string; + + /** + * (case-insensitive) Filter the list of organizations to where the name ends with + * a particular string. + */ + endsWith?: string; + + /** + * (case-insensitive) Filter the list of organizations to where the name starts + * with a particular string. + */ + startsWith?: string; + } + + export interface Parent { + /** + * Filter the list of organizations to the ones that are a sub-organization of the + * specified organization. + * + * "null" is a valid value to provide for this parameter. It means "where an + * organization has no parent (i.e. it is a 'root' organization)." + */ + id?: (string & {}) | 'null'; + } +} + +Organizations.OrganizationsSinglePage = OrganizationsSinglePage; +Organizations.OrganizationProfileResource = OrganizationProfileResource; + +export declare namespace Organizations { + export { + type Organization as Organization, + type OrganizationDeleteResponse as OrganizationDeleteResponse, + OrganizationsSinglePage as OrganizationsSinglePage, + type OrganizationCreateParams as OrganizationCreateParams, + type OrganizationUpdateParams as OrganizationUpdateParams, + type OrganizationListParams as OrganizationListParams, + }; + + export { + OrganizationProfileResource as OrganizationProfileResource, + type OrganizationProfile as OrganizationProfile, + type OrganizationProfileUpdateParams as OrganizationProfileUpdateParams, + }; +} diff --git a/src/resources/origin-ca-certificates.ts b/src/resources/origin-ca-certificates.ts index c60e7b1bcb..4699dbb70b 100644 --- a/src/resources/origin-ca-certificates.ts +++ b/src/resources/origin-ca-certificates.ts @@ -14,7 +14,11 @@ export class OriginCACertificates extends APIResource { * @example * ```ts * const originCACertificate = - * await client.originCACertificates.create(); + * await client.originCACertificates.create({ + * csr: '-----BEGIN CERTIFICATE REQUEST-----\nMIICxzCCAa8CAQAwSDELMAkGA1UEBhMCVVMxFjAUBgNVBAgTDVNhbiBGcmFuY2lz\nY28xCzAJBgNVBAcTAkNBMRQwEgYDVQQDEwtleGFtcGxlLm5ldDCCASIwDQYJKoZI\nhvcNAQEBBQADggEPADCCAQoCggEBALxejtu4b+jPdFeFi6OUsye8TYJQBm3WfCvL\nHu5EvijMO/4Z2TImwASbwUF7Ir8OLgH+mGlQZeqyNvGoSOMEaZVXcYfpR1hlVak8\n4GGVr+04IGfOCqaBokaBFIwzclGZbzKmLGwIQioNxGfqFm6RGYGA3be2Je2iseBc\nN8GV1wYmvYE0RR+yWweJCTJ157exyRzu7sVxaEW9F87zBQLyOnwXc64rflXslRqi\ng7F7w5IaQYOl8yvmk/jEPCAha7fkiUfEpj4N12+oPRiMvleJF98chxjD4MH39c5I\nuOslULhrWunfh7GB1jwWNA9y44H0snrf+xvoy2TcHmxvma9Eln8CAwEAAaA6MDgG\nCSqGSIb3DQEJDjErMCkwJwYDVR0RBCAwHoILZXhhbXBsZS5uZXSCD3d3dy5leGFt\ncGxlLm5ldDANBgkqhkiG9w0BAQsFAAOCAQEAcBaX6dOnI8ncARrI9ZSF2AJX+8mx\npTHY2+Y2C0VvrVDGMtbBRH8R9yMbqWtlxeeNGf//LeMkSKSFa4kbpdx226lfui8/\nauRDBTJGx2R1ccUxmLZXx4my0W5iIMxunu+kez+BDlu7bTT2io0uXMRHue4i6quH\nyc5ibxvbJMjR7dqbcanVE10/34oprzXQsJ/VmSuZNXtjbtSKDlmcpw6To/eeAJ+J\nhXykcUihvHyG4A1m2R6qpANBjnA0pHexfwM/SgfzvpbvUg0T1ubmer8BgTwCKIWs\ndcWYTthM51JIqRBfNqy4QcBnX+GY05yltEEswQI55wdiS3CjTTA67sdbcQ==\n-----END CERTIFICATE REQUEST-----', + * hostnames: ['example.com', '*.example.com'], + * request_type: 'origin-rsa', + * }); * ``` */ create( @@ -156,19 +160,19 @@ export interface OriginCACertificateCreateParams { /** * The Certificate Signing Request (CSR). Must be newline-encoded. */ - csr?: string; + csr: string; /** * Array of hostnames or wildcard names (e.g., \*.example.com) bound to the * certificate. */ - hostnames?: Array; + hostnames: Array; /** * Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), * or "keyless-certificate" (for Keyless SSL servers). */ - request_type?: Shared.CertificateRequestTypeParam; + request_type: Shared.CertificateRequestTypeParam; /** * The number of days for which the certificate should be valid. diff --git a/src/resources/pages/index.ts b/src/resources/pages/index.ts index 2b2862b5c1..06bf19b09a 100644 --- a/src/resources/pages/index.ts +++ b/src/resources/pages/index.ts @@ -1,12 +1,17 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +export { Pages } from './pages'; export { - DeploymentsSinglePage, + ProjectListResponsesV4PagePaginationArray, Projects, type Deployment, type Project, type Stage, + type ProjectCreateResponse, + type ProjectListResponse, type ProjectDeleteResponse, + type ProjectEditResponse, + type ProjectGetResponse, type ProjectPurgeBuildCacheResponse, type ProjectCreateParams, type ProjectListParams, @@ -15,4 +20,3 @@ export { type ProjectGetParams, type ProjectPurgeBuildCacheParams, } from './projects/index'; -export { Pages } from './pages'; diff --git a/src/resources/pages/pages.ts b/src/resources/pages/pages.ts index e92779690f..38d6518310 100644 --- a/src/resources/pages/pages.ts +++ b/src/resources/pages/pages.ts @@ -4,14 +4,18 @@ import { APIResource } from '../../resource'; import * as ProjectsAPI from './projects/projects'; import { Deployment, - DeploymentsSinglePage, Project, ProjectCreateParams, + ProjectCreateResponse, ProjectDeleteParams, ProjectDeleteResponse, ProjectEditParams, + ProjectEditResponse, ProjectGetParams, + ProjectGetResponse, ProjectListParams, + ProjectListResponse, + ProjectListResponsesV4PagePaginationArray, ProjectPurgeBuildCacheParams, ProjectPurgeBuildCacheResponse, Projects, @@ -23,7 +27,7 @@ export class Pages extends APIResource { } Pages.Projects = Projects; -Pages.DeploymentsSinglePage = DeploymentsSinglePage; +Pages.ProjectListResponsesV4PagePaginationArray = ProjectListResponsesV4PagePaginationArray; export declare namespace Pages { export { @@ -31,9 +35,13 @@ export declare namespace Pages { type Deployment as Deployment, type Project as Project, type Stage as Stage, + type ProjectCreateResponse as ProjectCreateResponse, + type ProjectListResponse as ProjectListResponse, type ProjectDeleteResponse as ProjectDeleteResponse, + type ProjectEditResponse as ProjectEditResponse, + type ProjectGetResponse as ProjectGetResponse, type ProjectPurgeBuildCacheResponse as ProjectPurgeBuildCacheResponse, - DeploymentsSinglePage as DeploymentsSinglePage, + ProjectListResponsesV4PagePaginationArray as ProjectListResponsesV4PagePaginationArray, type ProjectCreateParams as ProjectCreateParams, type ProjectListParams as ProjectListParams, type ProjectDeleteParams as ProjectDeleteParams, diff --git a/src/resources/pages/projects/deployments/deployments.ts b/src/resources/pages/projects/deployments/deployments.ts index 97b2b41db9..7c78088487 100644 --- a/src/resources/pages/projects/deployments/deployments.ts +++ b/src/resources/pages/projects/deployments/deployments.ts @@ -3,9 +3,9 @@ import { APIResource } from '../../../../resource'; import * as Core from '../../../../core'; import * as ProjectsAPI from '../projects'; -import { DeploymentsSinglePage } from '../projects'; import * as HistoryAPI from './history/history'; import { History } from './history/history'; +import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../../../pagination'; export class Deployments extends APIResource { history: HistoryAPI.History = new HistoryAPI.History(this._client); @@ -27,13 +27,13 @@ export class Deployments extends APIResource { projectName: string, params: DeploymentCreateParams, options?: Core.RequestOptions, - ): Core.APIPromise { + ): Core.APIPromise { const { account_id, ...body } = params; return ( this._client.post( `/accounts/${account_id}/pages/projects/${projectName}/deployments`, Core.multipartFormRequestOptions({ body, ...options }), - ) as Core.APIPromise<{ result: ProjectsAPI.Deployment }> + ) as Core.APIPromise<{ result: DeploymentCreateResponse }> )._thenUnwrap((obj) => obj.result); } @@ -43,7 +43,7 @@ export class Deployments extends APIResource { * @example * ```ts * // Automatically fetches more pages as needed. - * for await (const deployment of client.pages.projects.deployments.list( + * for await (const deploymentListResponse of client.pages.projects.deployments.list( * 'this-is-my-project-01', * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * )) { @@ -55,11 +55,11 @@ export class Deployments extends APIResource { projectName: string, params: DeploymentListParams, options?: Core.RequestOptions, - ): Core.PagePromise { + ): Core.PagePromise { const { account_id, ...query } = params; return this._client.getAPIList( `/accounts/${account_id}/pages/projects/${projectName}/deployments`, - DeploymentsSinglePage, + DeploymentListResponsesV4PagePaginationArray, { query, ...options }, ); } @@ -110,13 +110,13 @@ export class Deployments extends APIResource { deploymentId: string, params: DeploymentGetParams, options?: Core.RequestOptions, - ): Core.APIPromise { + ): Core.APIPromise { const { account_id } = params; return ( this._client.get( `/accounts/${account_id}/pages/projects/${projectName}/deployments/${deploymentId}`, options, - ) as Core.APIPromise<{ result: ProjectsAPI.Deployment }> + ) as Core.APIPromise<{ result: DeploymentGetResponse }> )._thenUnwrap((obj) => obj.result); } @@ -125,14 +125,11 @@ export class Deployments extends APIResource { * * @example * ```ts - * const deployment = + * const response = * await client.pages.projects.deployments.retry( * 'this-is-my-project-01', * '023e105f4ecef8ad9ca31a8372d0c353', - * { - * account_id: '023e105f4ecef8ad9ca31a8372d0c353', - * body: {}, - * }, + * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` */ @@ -141,13 +138,13 @@ export class Deployments extends APIResource { deploymentId: string, params: DeploymentRetryParams, options?: Core.RequestOptions, - ): Core.APIPromise { - const { account_id, body } = params; + ): Core.APIPromise { + const { account_id } = params; return ( this._client.post( `/accounts/${account_id}/pages/projects/${projectName}/deployments/${deploymentId}/retry`, - { body: body, ...options }, - ) as Core.APIPromise<{ result: ProjectsAPI.Deployment }> + options, + ) as Core.APIPromise<{ result: DeploymentRetryResponse }> )._thenUnwrap((obj) => obj.result); } @@ -157,14 +154,11 @@ export class Deployments extends APIResource { * * @example * ```ts - * const deployment = + * const response = * await client.pages.projects.deployments.rollback( * 'this-is-my-project-01', * '023e105f4ecef8ad9ca31a8372d0c353', - * { - * account_id: '023e105f4ecef8ad9ca31a8372d0c353', - * body: {}, - * }, + * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` */ @@ -173,96 +167,1579 @@ export class Deployments extends APIResource { deploymentId: string, params: DeploymentRollbackParams, options?: Core.RequestOptions, - ): Core.APIPromise { - const { account_id, body } = params; + ): Core.APIPromise { + const { account_id } = params; return ( this._client.post( `/accounts/${account_id}/pages/projects/${projectName}/deployments/${deploymentId}/rollback`, - { body: body, ...options }, - ) as Core.APIPromise<{ result: ProjectsAPI.Deployment }> + options, + ) as Core.APIPromise<{ result: DeploymentRollbackResponse }> )._thenUnwrap((obj) => obj.result); } } -export type DeploymentDeleteResponse = unknown; +export class DeploymentListResponsesV4PagePaginationArray extends V4PagePaginationArray {} -export interface DeploymentCreateParams { +export interface DeploymentCreateResponse { /** - * Path param: Identifier + * Id of the deployment. */ - account_id: string; + id: string; /** - * Body param: The branch to build the new deployment from. The `HEAD` of the - * branch will be used. If omitted, the production branch will be used by default. + * A list of alias URLs pointing to this deployment. */ - branch?: string; -} + aliases: Array | null; -export interface DeploymentListParams { /** - * Path param: Identifier + * Configs for the project build process. */ - account_id: string; + build_config: DeploymentCreateResponse.BuildConfig; /** - * Query param: What type of deployments to fetch. + * When the deployment was created. */ - env?: 'production' | 'preview'; -} + created_on: string; -export interface DeploymentDeleteParams { /** - * Identifier + * Info about what caused the deployment. */ - account_id: string; -} + deployment_trigger: DeploymentCreateResponse.DeploymentTrigger; -export interface DeploymentGetParams { /** - * Identifier + * Environment variables used for builds and Pages Functions. */ - account_id: string; + env_vars: { + [key: string]: + | DeploymentCreateResponse.PagesPlainTextEnvVar + | null + | DeploymentCreateResponse.PagesSecretTextEnvVar + | null; + } | null; + + /** + * Type of deploy. + */ + environment: 'preview' | 'production'; + + /** + * If the deployment has been skipped. + */ + is_skipped: boolean; + + /** + * The status of the deployment. + */ + latest_stage: ProjectsAPI.Stage; + + /** + * When the deployment was last modified. + */ + modified_on: string; + + /** + * Id of the project. + */ + project_id: string; + + /** + * Name of the project. + */ + project_name: string; + + /** + * Short Id (8 character) of the deployment. + */ + short_id: string; + + /** + * Configs for the project source control. + */ + source: DeploymentCreateResponse.Source; + + /** + * List of past stages. + */ + stages: Array; + + /** + * The live URL to view this deployment. + */ + url: string; + + /** + * Whether the deployment uses functions. + */ + uses_functions?: boolean | null; } -export interface DeploymentRetryParams { +export namespace DeploymentCreateResponse { /** - * Path param: Identifier + * Configs for the project build process. */ - account_id: string; + export interface BuildConfig { + /** + * The classifying tag for analytics. + */ + web_analytics_tag: string | null; + + /** + * The auth token for analytics. + */ + web_analytics_token: string | null; + + /** + * Enable build caching for the project. + */ + build_caching?: boolean | null; + + /** + * Command used to build project. + */ + build_command?: string | null; + + /** + * Assets output directory of the build. + */ + destination_dir?: string | null; + + /** + * Directory to run the command. + */ + root_dir?: string | null; + } + + /** + * Info about what caused the deployment. + */ + export interface DeploymentTrigger { + /** + * Additional info about the trigger. + */ + metadata: DeploymentTrigger.Metadata; + + /** + * What caused the deployment. + */ + type: 'github:push' | 'ad_hoc' | 'deploy_hook'; + } + + export namespace DeploymentTrigger { + /** + * Additional info about the trigger. + */ + export interface Metadata { + /** + * Where the trigger happened. + */ + branch: string; + + /** + * Whether the deployment trigger commit was dirty. + */ + commit_dirty: boolean; + + /** + * Hash of the deployment trigger commit. + */ + commit_hash: string; + + /** + * Message of the deployment trigger commit. + */ + commit_message: string; + } + } + + /** + * A plaintext environment variable. + */ + export interface PagesPlainTextEnvVar { + type: 'plain_text'; + + /** + * Environment variable value. + */ + value: string; + } /** - * Body param: + * An encrypted environment variable. */ - body: unknown; + export interface PagesSecretTextEnvVar { + type: 'secret_text'; + + /** + * Secret value. + */ + value: string; + } + + /** + * Configs for the project source control. + */ + export interface Source { + config: Source.Config; + + /** + * The source control management provider. + */ + type: 'github' | 'gitlab'; + } + + export namespace Source { + export interface Config { + /** + * The owner of the repository. + */ + owner: string; + + /** + * Whether to enable PR comments. + */ + pr_comments_enabled: boolean; + + /** + * The production branch of the repository. + */ + production_branch: string; + + /** + * The name of the repository. + */ + repo_name: string; + + /** + * @deprecated Use `production_deployments_enabled` and + * `preview_deployment_setting` for more granular control. + */ + deployments_enabled?: boolean; + + /** + * The owner ID of the repository. + */ + owner_id?: string; + + /** + * A list of paths that should be excluded from triggering a preview deployment. + * Wildcard syntax (`*`) is supported. + */ + path_excludes?: Array; + + /** + * A list of paths that should be watched to trigger a preview deployment. Wildcard + * syntax (`*`) is supported. + */ + path_includes?: Array; + + /** + * A list of branches that should not trigger a preview deployment. Wildcard syntax + * (`*`) is supported. Must be used with `preview_deployment_setting` set to + * `custom`. + */ + preview_branch_excludes?: Array; + + /** + * A list of branches that should trigger a preview deployment. Wildcard syntax + * (`*`) is supported. Must be used with `preview_deployment_setting` set to + * `custom`. + */ + preview_branch_includes?: Array; + + /** + * Controls whether commits to preview branches trigger a preview deployment. + */ + preview_deployment_setting?: 'all' | 'none' | 'custom'; + + /** + * Whether to trigger a production deployment on commits to the production branch. + */ + production_deployments_enabled?: boolean; + + /** + * The ID of the repository. + */ + repo_id?: string; + } + } } -export interface DeploymentRollbackParams { +export interface DeploymentListResponse { /** - * Path param: Identifier + * Id of the deployment. */ - account_id: string; + id: string; + + /** + * A list of alias URLs pointing to this deployment. + */ + aliases: Array | null; + + /** + * Configs for the project build process. + */ + build_config: DeploymentListResponse.BuildConfig; + + /** + * When the deployment was created. + */ + created_on: string; + + /** + * Info about what caused the deployment. + */ + deployment_trigger: DeploymentListResponse.DeploymentTrigger; + + /** + * Environment variables used for builds and Pages Functions. + */ + env_vars: { + [key: string]: + | DeploymentListResponse.PagesPlainTextEnvVar + | null + | DeploymentListResponse.PagesSecretTextEnvVar + | null; + } | null; + + /** + * Type of deploy. + */ + environment: 'preview' | 'production'; + + /** + * If the deployment has been skipped. + */ + is_skipped: boolean; + + /** + * The status of the deployment. + */ + latest_stage: ProjectsAPI.Stage; + + /** + * When the deployment was last modified. + */ + modified_on: string; + + /** + * Id of the project. + */ + project_id: string; + + /** + * Name of the project. + */ + project_name: string; + + /** + * Short Id (8 character) of the deployment. + */ + short_id: string; + + /** + * Configs for the project source control. + */ + source: DeploymentListResponse.Source; + + /** + * List of past stages. + */ + stages: Array; + + /** + * The live URL to view this deployment. + */ + url: string; /** - * Body param: + * Whether the deployment uses functions. */ - body: unknown; + uses_functions?: boolean | null; } -Deployments.History = History; +export namespace DeploymentListResponse { + /** + * Configs for the project build process. + */ + export interface BuildConfig { + /** + * The classifying tag for analytics. + */ + web_analytics_tag: string | null; -export declare namespace Deployments { - export { - type DeploymentDeleteResponse as DeploymentDeleteResponse, - type DeploymentCreateParams as DeploymentCreateParams, - type DeploymentListParams as DeploymentListParams, - type DeploymentDeleteParams as DeploymentDeleteParams, - type DeploymentGetParams as DeploymentGetParams, - type DeploymentRetryParams as DeploymentRetryParams, - type DeploymentRollbackParams as DeploymentRollbackParams, - }; + /** + * The auth token for analytics. + */ + web_analytics_token: string | null; - export { History as History }; + /** + * Enable build caching for the project. + */ + build_caching?: boolean | null; + + /** + * Command used to build project. + */ + build_command?: string | null; + + /** + * Assets output directory of the build. + */ + destination_dir?: string | null; + + /** + * Directory to run the command. + */ + root_dir?: string | null; + } + + /** + * Info about what caused the deployment. + */ + export interface DeploymentTrigger { + /** + * Additional info about the trigger. + */ + metadata: DeploymentTrigger.Metadata; + + /** + * What caused the deployment. + */ + type: 'github:push' | 'ad_hoc' | 'deploy_hook'; + } + + export namespace DeploymentTrigger { + /** + * Additional info about the trigger. + */ + export interface Metadata { + /** + * Where the trigger happened. + */ + branch: string; + + /** + * Whether the deployment trigger commit was dirty. + */ + commit_dirty: boolean; + + /** + * Hash of the deployment trigger commit. + */ + commit_hash: string; + + /** + * Message of the deployment trigger commit. + */ + commit_message: string; + } + } + + /** + * A plaintext environment variable. + */ + export interface PagesPlainTextEnvVar { + type: 'plain_text'; + + /** + * Environment variable value. + */ + value: string; + } + + /** + * An encrypted environment variable. + */ + export interface PagesSecretTextEnvVar { + type: 'secret_text'; + + /** + * Secret value. + */ + value: string; + } + + /** + * Configs for the project source control. + */ + export interface Source { + config: Source.Config; + + /** + * The source control management provider. + */ + type: 'github' | 'gitlab'; + } + + export namespace Source { + export interface Config { + /** + * The owner of the repository. + */ + owner: string; + + /** + * Whether to enable PR comments. + */ + pr_comments_enabled: boolean; + + /** + * The production branch of the repository. + */ + production_branch: string; + + /** + * The name of the repository. + */ + repo_name: string; + + /** + * @deprecated Use `production_deployments_enabled` and + * `preview_deployment_setting` for more granular control. + */ + deployments_enabled?: boolean; + + /** + * The owner ID of the repository. + */ + owner_id?: string; + + /** + * A list of paths that should be excluded from triggering a preview deployment. + * Wildcard syntax (`*`) is supported. + */ + path_excludes?: Array; + + /** + * A list of paths that should be watched to trigger a preview deployment. Wildcard + * syntax (`*`) is supported. + */ + path_includes?: Array; + + /** + * A list of branches that should not trigger a preview deployment. Wildcard syntax + * (`*`) is supported. Must be used with `preview_deployment_setting` set to + * `custom`. + */ + preview_branch_excludes?: Array; + + /** + * A list of branches that should trigger a preview deployment. Wildcard syntax + * (`*`) is supported. Must be used with `preview_deployment_setting` set to + * `custom`. + */ + preview_branch_includes?: Array; + + /** + * Controls whether commits to preview branches trigger a preview deployment. + */ + preview_deployment_setting?: 'all' | 'none' | 'custom'; + + /** + * Whether to trigger a production deployment on commits to the production branch. + */ + production_deployments_enabled?: boolean; + + /** + * The ID of the repository. + */ + repo_id?: string; + } + } } -export { DeploymentsSinglePage }; +export type DeploymentDeleteResponse = unknown; + +export interface DeploymentGetResponse { + /** + * Id of the deployment. + */ + id: string; + + /** + * A list of alias URLs pointing to this deployment. + */ + aliases: Array | null; + + /** + * Configs for the project build process. + */ + build_config: DeploymentGetResponse.BuildConfig; + + /** + * When the deployment was created. + */ + created_on: string; + + /** + * Info about what caused the deployment. + */ + deployment_trigger: DeploymentGetResponse.DeploymentTrigger; + + /** + * Environment variables used for builds and Pages Functions. + */ + env_vars: { + [key: string]: + | DeploymentGetResponse.PagesPlainTextEnvVar + | null + | DeploymentGetResponse.PagesSecretTextEnvVar + | null; + } | null; + + /** + * Type of deploy. + */ + environment: 'preview' | 'production'; + + /** + * If the deployment has been skipped. + */ + is_skipped: boolean; + + /** + * The status of the deployment. + */ + latest_stage: ProjectsAPI.Stage; + + /** + * When the deployment was last modified. + */ + modified_on: string; + + /** + * Id of the project. + */ + project_id: string; + + /** + * Name of the project. + */ + project_name: string; + + /** + * Short Id (8 character) of the deployment. + */ + short_id: string; + + /** + * Configs for the project source control. + */ + source: DeploymentGetResponse.Source; + + /** + * List of past stages. + */ + stages: Array; + + /** + * The live URL to view this deployment. + */ + url: string; + + /** + * Whether the deployment uses functions. + */ + uses_functions?: boolean | null; +} + +export namespace DeploymentGetResponse { + /** + * Configs for the project build process. + */ + export interface BuildConfig { + /** + * The classifying tag for analytics. + */ + web_analytics_tag: string | null; + + /** + * The auth token for analytics. + */ + web_analytics_token: string | null; + + /** + * Enable build caching for the project. + */ + build_caching?: boolean | null; + + /** + * Command used to build project. + */ + build_command?: string | null; + + /** + * Assets output directory of the build. + */ + destination_dir?: string | null; + + /** + * Directory to run the command. + */ + root_dir?: string | null; + } + + /** + * Info about what caused the deployment. + */ + export interface DeploymentTrigger { + /** + * Additional info about the trigger. + */ + metadata: DeploymentTrigger.Metadata; + + /** + * What caused the deployment. + */ + type: 'github:push' | 'ad_hoc' | 'deploy_hook'; + } + + export namespace DeploymentTrigger { + /** + * Additional info about the trigger. + */ + export interface Metadata { + /** + * Where the trigger happened. + */ + branch: string; + + /** + * Whether the deployment trigger commit was dirty. + */ + commit_dirty: boolean; + + /** + * Hash of the deployment trigger commit. + */ + commit_hash: string; + + /** + * Message of the deployment trigger commit. + */ + commit_message: string; + } + } + + /** + * A plaintext environment variable. + */ + export interface PagesPlainTextEnvVar { + type: 'plain_text'; + + /** + * Environment variable value. + */ + value: string; + } + + /** + * An encrypted environment variable. + */ + export interface PagesSecretTextEnvVar { + type: 'secret_text'; + + /** + * Secret value. + */ + value: string; + } + + /** + * Configs for the project source control. + */ + export interface Source { + config: Source.Config; + + /** + * The source control management provider. + */ + type: 'github' | 'gitlab'; + } + + export namespace Source { + export interface Config { + /** + * The owner of the repository. + */ + owner: string; + + /** + * Whether to enable PR comments. + */ + pr_comments_enabled: boolean; + + /** + * The production branch of the repository. + */ + production_branch: string; + + /** + * The name of the repository. + */ + repo_name: string; + + /** + * @deprecated Use `production_deployments_enabled` and + * `preview_deployment_setting` for more granular control. + */ + deployments_enabled?: boolean; + + /** + * The owner ID of the repository. + */ + owner_id?: string; + + /** + * A list of paths that should be excluded from triggering a preview deployment. + * Wildcard syntax (`*`) is supported. + */ + path_excludes?: Array; + + /** + * A list of paths that should be watched to trigger a preview deployment. Wildcard + * syntax (`*`) is supported. + */ + path_includes?: Array; + + /** + * A list of branches that should not trigger a preview deployment. Wildcard syntax + * (`*`) is supported. Must be used with `preview_deployment_setting` set to + * `custom`. + */ + preview_branch_excludes?: Array; + + /** + * A list of branches that should trigger a preview deployment. Wildcard syntax + * (`*`) is supported. Must be used with `preview_deployment_setting` set to + * `custom`. + */ + preview_branch_includes?: Array; + + /** + * Controls whether commits to preview branches trigger a preview deployment. + */ + preview_deployment_setting?: 'all' | 'none' | 'custom'; + + /** + * Whether to trigger a production deployment on commits to the production branch. + */ + production_deployments_enabled?: boolean; + + /** + * The ID of the repository. + */ + repo_id?: string; + } + } +} + +export interface DeploymentRetryResponse { + /** + * Id of the deployment. + */ + id: string; + + /** + * A list of alias URLs pointing to this deployment. + */ + aliases: Array | null; + + /** + * Configs for the project build process. + */ + build_config: DeploymentRetryResponse.BuildConfig; + + /** + * When the deployment was created. + */ + created_on: string; + + /** + * Info about what caused the deployment. + */ + deployment_trigger: DeploymentRetryResponse.DeploymentTrigger; + + /** + * Environment variables used for builds and Pages Functions. + */ + env_vars: { + [key: string]: + | DeploymentRetryResponse.PagesPlainTextEnvVar + | null + | DeploymentRetryResponse.PagesSecretTextEnvVar + | null; + } | null; + + /** + * Type of deploy. + */ + environment: 'preview' | 'production'; + + /** + * If the deployment has been skipped. + */ + is_skipped: boolean; + + /** + * The status of the deployment. + */ + latest_stage: ProjectsAPI.Stage; + + /** + * When the deployment was last modified. + */ + modified_on: string; + + /** + * Id of the project. + */ + project_id: string; + + /** + * Name of the project. + */ + project_name: string; + + /** + * Short Id (8 character) of the deployment. + */ + short_id: string; + + /** + * Configs for the project source control. + */ + source: DeploymentRetryResponse.Source; + + /** + * List of past stages. + */ + stages: Array; + + /** + * The live URL to view this deployment. + */ + url: string; + + /** + * Whether the deployment uses functions. + */ + uses_functions?: boolean | null; +} + +export namespace DeploymentRetryResponse { + /** + * Configs for the project build process. + */ + export interface BuildConfig { + /** + * The classifying tag for analytics. + */ + web_analytics_tag: string | null; + + /** + * The auth token for analytics. + */ + web_analytics_token: string | null; + + /** + * Enable build caching for the project. + */ + build_caching?: boolean | null; + + /** + * Command used to build project. + */ + build_command?: string | null; + + /** + * Assets output directory of the build. + */ + destination_dir?: string | null; + + /** + * Directory to run the command. + */ + root_dir?: string | null; + } + + /** + * Info about what caused the deployment. + */ + export interface DeploymentTrigger { + /** + * Additional info about the trigger. + */ + metadata: DeploymentTrigger.Metadata; + + /** + * What caused the deployment. + */ + type: 'github:push' | 'ad_hoc' | 'deploy_hook'; + } + + export namespace DeploymentTrigger { + /** + * Additional info about the trigger. + */ + export interface Metadata { + /** + * Where the trigger happened. + */ + branch: string; + + /** + * Whether the deployment trigger commit was dirty. + */ + commit_dirty: boolean; + + /** + * Hash of the deployment trigger commit. + */ + commit_hash: string; + + /** + * Message of the deployment trigger commit. + */ + commit_message: string; + } + } + + /** + * A plaintext environment variable. + */ + export interface PagesPlainTextEnvVar { + type: 'plain_text'; + + /** + * Environment variable value. + */ + value: string; + } + + /** + * An encrypted environment variable. + */ + export interface PagesSecretTextEnvVar { + type: 'secret_text'; + + /** + * Secret value. + */ + value: string; + } + + /** + * Configs for the project source control. + */ + export interface Source { + config: Source.Config; + + /** + * The source control management provider. + */ + type: 'github' | 'gitlab'; + } + + export namespace Source { + export interface Config { + /** + * The owner of the repository. + */ + owner: string; + + /** + * Whether to enable PR comments. + */ + pr_comments_enabled: boolean; + + /** + * The production branch of the repository. + */ + production_branch: string; + + /** + * The name of the repository. + */ + repo_name: string; + + /** + * @deprecated Use `production_deployments_enabled` and + * `preview_deployment_setting` for more granular control. + */ + deployments_enabled?: boolean; + + /** + * The owner ID of the repository. + */ + owner_id?: string; + + /** + * A list of paths that should be excluded from triggering a preview deployment. + * Wildcard syntax (`*`) is supported. + */ + path_excludes?: Array; + + /** + * A list of paths that should be watched to trigger a preview deployment. Wildcard + * syntax (`*`) is supported. + */ + path_includes?: Array; + + /** + * A list of branches that should not trigger a preview deployment. Wildcard syntax + * (`*`) is supported. Must be used with `preview_deployment_setting` set to + * `custom`. + */ + preview_branch_excludes?: Array; + + /** + * A list of branches that should trigger a preview deployment. Wildcard syntax + * (`*`) is supported. Must be used with `preview_deployment_setting` set to + * `custom`. + */ + preview_branch_includes?: Array; + + /** + * Controls whether commits to preview branches trigger a preview deployment. + */ + preview_deployment_setting?: 'all' | 'none' | 'custom'; + + /** + * Whether to trigger a production deployment on commits to the production branch. + */ + production_deployments_enabled?: boolean; + + /** + * The ID of the repository. + */ + repo_id?: string; + } + } +} + +export interface DeploymentRollbackResponse { + /** + * Id of the deployment. + */ + id: string; + + /** + * A list of alias URLs pointing to this deployment. + */ + aliases: Array | null; + + /** + * Configs for the project build process. + */ + build_config: DeploymentRollbackResponse.BuildConfig; + + /** + * When the deployment was created. + */ + created_on: string; + + /** + * Info about what caused the deployment. + */ + deployment_trigger: DeploymentRollbackResponse.DeploymentTrigger; + + /** + * Environment variables used for builds and Pages Functions. + */ + env_vars: { + [key: string]: + | DeploymentRollbackResponse.PagesPlainTextEnvVar + | null + | DeploymentRollbackResponse.PagesSecretTextEnvVar + | null; + } | null; + + /** + * Type of deploy. + */ + environment: 'preview' | 'production'; + + /** + * If the deployment has been skipped. + */ + is_skipped: boolean; + + /** + * The status of the deployment. + */ + latest_stage: ProjectsAPI.Stage; + + /** + * When the deployment was last modified. + */ + modified_on: string; + + /** + * Id of the project. + */ + project_id: string; + + /** + * Name of the project. + */ + project_name: string; + + /** + * Short Id (8 character) of the deployment. + */ + short_id: string; + + /** + * Configs for the project source control. + */ + source: DeploymentRollbackResponse.Source; + + /** + * List of past stages. + */ + stages: Array; + + /** + * The live URL to view this deployment. + */ + url: string; + + /** + * Whether the deployment uses functions. + */ + uses_functions?: boolean | null; +} + +export namespace DeploymentRollbackResponse { + /** + * Configs for the project build process. + */ + export interface BuildConfig { + /** + * The classifying tag for analytics. + */ + web_analytics_tag: string | null; + + /** + * The auth token for analytics. + */ + web_analytics_token: string | null; + + /** + * Enable build caching for the project. + */ + build_caching?: boolean | null; + + /** + * Command used to build project. + */ + build_command?: string | null; + + /** + * Assets output directory of the build. + */ + destination_dir?: string | null; + + /** + * Directory to run the command. + */ + root_dir?: string | null; + } + + /** + * Info about what caused the deployment. + */ + export interface DeploymentTrigger { + /** + * Additional info about the trigger. + */ + metadata: DeploymentTrigger.Metadata; + + /** + * What caused the deployment. + */ + type: 'github:push' | 'ad_hoc' | 'deploy_hook'; + } + + export namespace DeploymentTrigger { + /** + * Additional info about the trigger. + */ + export interface Metadata { + /** + * Where the trigger happened. + */ + branch: string; + + /** + * Whether the deployment trigger commit was dirty. + */ + commit_dirty: boolean; + + /** + * Hash of the deployment trigger commit. + */ + commit_hash: string; + + /** + * Message of the deployment trigger commit. + */ + commit_message: string; + } + } + + /** + * A plaintext environment variable. + */ + export interface PagesPlainTextEnvVar { + type: 'plain_text'; + + /** + * Environment variable value. + */ + value: string; + } + + /** + * An encrypted environment variable. + */ + export interface PagesSecretTextEnvVar { + type: 'secret_text'; + + /** + * Secret value. + */ + value: string; + } + + /** + * Configs for the project source control. + */ + export interface Source { + config: Source.Config; + + /** + * The source control management provider. + */ + type: 'github' | 'gitlab'; + } + + export namespace Source { + export interface Config { + /** + * The owner of the repository. + */ + owner: string; + + /** + * Whether to enable PR comments. + */ + pr_comments_enabled: boolean; + + /** + * The production branch of the repository. + */ + production_branch: string; + + /** + * The name of the repository. + */ + repo_name: string; + + /** + * @deprecated Use `production_deployments_enabled` and + * `preview_deployment_setting` for more granular control. + */ + deployments_enabled?: boolean; + + /** + * The owner ID of the repository. + */ + owner_id?: string; + + /** + * A list of paths that should be excluded from triggering a preview deployment. + * Wildcard syntax (`*`) is supported. + */ + path_excludes?: Array; + + /** + * A list of paths that should be watched to trigger a preview deployment. Wildcard + * syntax (`*`) is supported. + */ + path_includes?: Array; + + /** + * A list of branches that should not trigger a preview deployment. Wildcard syntax + * (`*`) is supported. Must be used with `preview_deployment_setting` set to + * `custom`. + */ + preview_branch_excludes?: Array; + + /** + * A list of branches that should trigger a preview deployment. Wildcard syntax + * (`*`) is supported. Must be used with `preview_deployment_setting` set to + * `custom`. + */ + preview_branch_includes?: Array; + + /** + * Controls whether commits to preview branches trigger a preview deployment. + */ + preview_deployment_setting?: 'all' | 'none' | 'custom'; + + /** + * Whether to trigger a production deployment on commits to the production branch. + */ + production_deployments_enabled?: boolean; + + /** + * The ID of the repository. + */ + repo_id?: string; + } + } +} + +export interface DeploymentCreateParams { + /** + * Path param: Identifier. + */ + account_id: string; + + /** + * Body param: Headers configuration file for the deployment. + */ + _headers?: Core.Uploadable; + + /** + * Body param: Redirects configuration file for the deployment. + */ + _redirects?: Core.Uploadable; + + /** + * Body param: Routes configuration file defining routing rules. + */ + '_routes.json'?: Core.Uploadable; + + /** + * Body param: Worker bundle file in multipart/form-data format. Mutually exclusive + * with `_worker.js`. Cannot specify both `_worker.js` and `_worker.bundle` in the + * same request. Maximum size: 25 MiB. + */ + '_worker.bundle'?: Core.Uploadable; + + /** + * Body param: Worker JavaScript file. Mutually exclusive with `_worker.bundle`. + * Cannot specify both `_worker.js` and `_worker.bundle` in the same request. + */ + '_worker.js'?: Core.Uploadable; + + /** + * Body param: The branch to build the new deployment from. The `HEAD` of the + * branch will be used. If omitted, the production branch will be used by default. + */ + branch?: string; + + /** + * Body param: Boolean string indicating if the working directory has uncommitted + * changes. + */ + commit_dirty?: 'true' | 'false'; + + /** + * Body param: Git commit SHA associated with this deployment. + */ + commit_hash?: string; + + /** + * Body param: Git commit message associated with this deployment. + */ + commit_message?: string; + + /** + * Body param: Functions routing configuration file. + */ + 'functions-filepath-routing-config.json'?: Core.Uploadable; + + /** + * Body param: JSON string containing a manifest of files to deploy. Maps file + * paths to their content hashes. Required for direct upload deployments. Maximum + * 20,000 entries. + */ + manifest?: string; + + /** + * Body param: The build output directory path. + */ + pages_build_output_dir?: string; + + /** + * Body param: Hash of the Wrangler configuration file used for this deployment. + */ + wrangler_config_hash?: string; +} + +export interface DeploymentListParams extends V4PagePaginationArrayParams { + /** + * Path param: Identifier. + */ + account_id: string; + + /** + * Query param: What type of deployments to fetch. + */ + env?: 'production' | 'preview'; +} + +export interface DeploymentDeleteParams { + /** + * Identifier. + */ + account_id: string; +} + +export interface DeploymentGetParams { + /** + * Identifier. + */ + account_id: string; +} + +export interface DeploymentRetryParams { + /** + * Identifier. + */ + account_id: string; +} + +export interface DeploymentRollbackParams { + /** + * Identifier. + */ + account_id: string; +} + +Deployments.DeploymentListResponsesV4PagePaginationArray = DeploymentListResponsesV4PagePaginationArray; +Deployments.History = History; + +export declare namespace Deployments { + export { + type DeploymentCreateResponse as DeploymentCreateResponse, + type DeploymentListResponse as DeploymentListResponse, + type DeploymentDeleteResponse as DeploymentDeleteResponse, + type DeploymentGetResponse as DeploymentGetResponse, + type DeploymentRetryResponse as DeploymentRetryResponse, + type DeploymentRollbackResponse as DeploymentRollbackResponse, + DeploymentListResponsesV4PagePaginationArray as DeploymentListResponsesV4PagePaginationArray, + type DeploymentCreateParams as DeploymentCreateParams, + type DeploymentListParams as DeploymentListParams, + type DeploymentDeleteParams as DeploymentDeleteParams, + type DeploymentGetParams as DeploymentGetParams, + type DeploymentRetryParams as DeploymentRetryParams, + type DeploymentRollbackParams as DeploymentRollbackParams, + }; + + export { History as History }; +} diff --git a/src/resources/pages/projects/deployments/history/logs.ts b/src/resources/pages/projects/deployments/history/logs.ts index 94ad44f1cd..e92f6d0aa4 100644 --- a/src/resources/pages/projects/deployments/history/logs.ts +++ b/src/resources/pages/projects/deployments/history/logs.ts @@ -34,24 +34,24 @@ export class Logs extends APIResource { } export interface LogGetResponse { - data?: Array; + data: Array; - includes_container_logs?: boolean; + includes_container_logs: boolean; - total?: number; + total: number; } export namespace LogGetResponse { export interface Data { - line?: string; + line: string; - ts?: string; + ts: string; } } export interface LogGetParams { /** - * Identifier + * Identifier. */ account_id: string; } diff --git a/src/resources/pages/projects/deployments/index.ts b/src/resources/pages/projects/deployments/index.ts index e111d2b387..2fae9d13f8 100644 --- a/src/resources/pages/projects/deployments/index.ts +++ b/src/resources/pages/projects/deployments/index.ts @@ -1,8 +1,14 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { + DeploymentListResponsesV4PagePaginationArray, Deployments, + type DeploymentCreateResponse, + type DeploymentListResponse, type DeploymentDeleteResponse, + type DeploymentGetResponse, + type DeploymentRetryResponse, + type DeploymentRollbackResponse, type DeploymentCreateParams, type DeploymentListParams, type DeploymentDeleteParams, diff --git a/src/resources/pages/projects/domains.ts b/src/resources/pages/projects/domains.ts index 1b5182a756..0276ffecd1 100644 --- a/src/resources/pages/projects/domains.ts +++ b/src/resources/pages/projects/domains.ts @@ -12,7 +12,10 @@ export class Domains extends APIResource { * ```ts * const domain = await client.pages.projects.domains.create( * 'this-is-my-project-01', - * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * { + * account_id: '023e105f4ecef8ad9ca31a8372d0c353', + * name: 'this-is-my-domain-01.com', + * }, * ); * ``` */ @@ -20,13 +23,13 @@ export class Domains extends APIResource { projectName: string, params: DomainCreateParams, options?: Core.RequestOptions, - ): Core.APIPromise { + ): Core.APIPromise { const { account_id, ...body } = params; return ( this._client.post(`/accounts/${account_id}/pages/projects/${projectName}/domains`, { body, ...options, - }) as Core.APIPromise<{ result: DomainCreateResponse | null }> + }) as Core.APIPromise<{ result: DomainCreateResponse }> )._thenUnwrap((obj) => obj.result); } @@ -92,10 +95,7 @@ export class Domains extends APIResource { * const response = await client.pages.projects.domains.edit( * 'this-is-my-project-01', * 'this-is-my-domain-01.com', - * { - * account_id: '023e105f4ecef8ad9ca31a8372d0c353', - * body: {}, - * }, + * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` */ @@ -104,13 +104,13 @@ export class Domains extends APIResource { domainName: string, params: DomainEditParams, options?: Core.RequestOptions, - ): Core.APIPromise { - const { account_id, body } = params; + ): Core.APIPromise { + const { account_id } = params; return ( - this._client.patch(`/accounts/${account_id}/pages/projects/${projectName}/domains/${domainName}`, { - body: body, - ...options, - }) as Core.APIPromise<{ result: DomainEditResponse | null }> + this._client.patch( + `/accounts/${account_id}/pages/projects/${projectName}/domains/${domainName}`, + options, + ) as Core.APIPromise<{ result: DomainEditResponse }> )._thenUnwrap((obj) => obj.result); } @@ -131,13 +131,13 @@ export class Domains extends APIResource { domainName: string, params: DomainGetParams, options?: Core.RequestOptions, - ): Core.APIPromise { + ): Core.APIPromise { const { account_id } = params; return ( this._client.get( `/accounts/${account_id}/pages/projects/${projectName}/domains/${domainName}`, options, - ) as Core.APIPromise<{ result: DomainGetResponse | null }> + ) as Core.APIPromise<{ result: DomainGetResponse }> )._thenUnwrap((obj) => obj.result); } } @@ -145,32 +145,35 @@ export class Domains extends APIResource { export class DomainListResponsesSinglePage extends SinglePage {} export interface DomainCreateResponse { - id?: string; + id: string; - certificate_authority?: 'google' | 'lets_encrypt'; + certificate_authority: 'google' | 'lets_encrypt'; - created_on?: string; + created_on: string; - domain_id?: string; + domain_id: string; - name?: string; + /** + * The domain name. + */ + name: string; - status?: 'initializing' | 'pending' | 'active' | 'deactivated' | 'blocked' | 'error'; + status: 'initializing' | 'pending' | 'active' | 'deactivated' | 'blocked' | 'error'; - validation_data?: DomainCreateResponse.ValidationData; + validation_data: DomainCreateResponse.ValidationData; - verification_data?: DomainCreateResponse.VerificationData; + verification_data: DomainCreateResponse.VerificationData; - zone_tag?: string; + zone_tag: string; } export namespace DomainCreateResponse { export interface ValidationData { - error_message?: string; + method: 'http' | 'txt'; - method?: 'http' | 'txt'; + status: 'initializing' | 'pending' | 'active' | 'deactivated' | 'error'; - status?: 'initializing' | 'pending' | 'active' | 'deactivated' | 'error'; + error_message?: string; txt_name?: string; @@ -178,39 +181,42 @@ export namespace DomainCreateResponse { } export interface VerificationData { - error_message?: string; + status: 'pending' | 'active' | 'deactivated' | 'blocked' | 'error'; - status?: 'pending' | 'active' | 'deactivated' | 'blocked' | 'error'; + error_message?: string; } } export interface DomainListResponse { - id?: string; + id: string; - certificate_authority?: 'google' | 'lets_encrypt'; + certificate_authority: 'google' | 'lets_encrypt'; - created_on?: string; + created_on: string; - domain_id?: string; + domain_id: string; - name?: string; + /** + * The domain name. + */ + name: string; - status?: 'initializing' | 'pending' | 'active' | 'deactivated' | 'blocked' | 'error'; + status: 'initializing' | 'pending' | 'active' | 'deactivated' | 'blocked' | 'error'; - validation_data?: DomainListResponse.ValidationData; + validation_data: DomainListResponse.ValidationData; - verification_data?: DomainListResponse.VerificationData; + verification_data: DomainListResponse.VerificationData; - zone_tag?: string; + zone_tag: string; } export namespace DomainListResponse { export interface ValidationData { - error_message?: string; + method: 'http' | 'txt'; - method?: 'http' | 'txt'; + status: 'initializing' | 'pending' | 'active' | 'deactivated' | 'error'; - status?: 'initializing' | 'pending' | 'active' | 'deactivated' | 'error'; + error_message?: string; txt_name?: string; @@ -218,41 +224,44 @@ export namespace DomainListResponse { } export interface VerificationData { - error_message?: string; + status: 'pending' | 'active' | 'deactivated' | 'blocked' | 'error'; - status?: 'pending' | 'active' | 'deactivated' | 'blocked' | 'error'; + error_message?: string; } } export type DomainDeleteResponse = unknown; export interface DomainEditResponse { - id?: string; + id: string; - certificate_authority?: 'google' | 'lets_encrypt'; + certificate_authority: 'google' | 'lets_encrypt'; - created_on?: string; + created_on: string; - domain_id?: string; + domain_id: string; - name?: string; + /** + * The domain name. + */ + name: string; - status?: 'initializing' | 'pending' | 'active' | 'deactivated' | 'blocked' | 'error'; + status: 'initializing' | 'pending' | 'active' | 'deactivated' | 'blocked' | 'error'; - validation_data?: DomainEditResponse.ValidationData; + validation_data: DomainEditResponse.ValidationData; - verification_data?: DomainEditResponse.VerificationData; + verification_data: DomainEditResponse.VerificationData; - zone_tag?: string; + zone_tag: string; } export namespace DomainEditResponse { export interface ValidationData { - error_message?: string; + method: 'http' | 'txt'; - method?: 'http' | 'txt'; + status: 'initializing' | 'pending' | 'active' | 'deactivated' | 'error'; - status?: 'initializing' | 'pending' | 'active' | 'deactivated' | 'error'; + error_message?: string; txt_name?: string; @@ -260,39 +269,42 @@ export namespace DomainEditResponse { } export interface VerificationData { - error_message?: string; + status: 'pending' | 'active' | 'deactivated' | 'blocked' | 'error'; - status?: 'pending' | 'active' | 'deactivated' | 'blocked' | 'error'; + error_message?: string; } } export interface DomainGetResponse { - id?: string; + id: string; - certificate_authority?: 'google' | 'lets_encrypt'; + certificate_authority: 'google' | 'lets_encrypt'; - created_on?: string; + created_on: string; - domain_id?: string; + domain_id: string; - name?: string; + /** + * The domain name. + */ + name: string; - status?: 'initializing' | 'pending' | 'active' | 'deactivated' | 'blocked' | 'error'; + status: 'initializing' | 'pending' | 'active' | 'deactivated' | 'blocked' | 'error'; - validation_data?: DomainGetResponse.ValidationData; + validation_data: DomainGetResponse.ValidationData; - verification_data?: DomainGetResponse.VerificationData; + verification_data: DomainGetResponse.VerificationData; - zone_tag?: string; + zone_tag: string; } export namespace DomainGetResponse { export interface ValidationData { - error_message?: string; + method: 'http' | 'txt'; - method?: 'http' | 'txt'; + status: 'initializing' | 'pending' | 'active' | 'deactivated' | 'error'; - status?: 'initializing' | 'pending' | 'active' | 'deactivated' | 'error'; + error_message?: string; txt_name?: string; @@ -300,53 +312,48 @@ export namespace DomainGetResponse { } export interface VerificationData { - error_message?: string; + status: 'pending' | 'active' | 'deactivated' | 'blocked' | 'error'; - status?: 'pending' | 'active' | 'deactivated' | 'blocked' | 'error'; + error_message?: string; } } export interface DomainCreateParams { /** - * Path param: Identifier + * Path param: Identifier. */ account_id: string; /** - * Body param: + * Body param: The domain name. */ - name?: string; + name: string; } export interface DomainListParams { /** - * Identifier + * Identifier. */ account_id: string; } export interface DomainDeleteParams { /** - * Identifier + * Identifier. */ account_id: string; } export interface DomainEditParams { /** - * Path param: Identifier + * Identifier. */ account_id: string; - - /** - * Body param: - */ - body: unknown; } export interface DomainGetParams { /** - * Identifier + * Identifier. */ account_id: string; } diff --git a/src/resources/pages/projects/index.ts b/src/resources/pages/projects/index.ts index a40f121ec5..919774d1db 100644 --- a/src/resources/pages/projects/index.ts +++ b/src/resources/pages/projects/index.ts @@ -1,8 +1,14 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { + DeploymentListResponsesV4PagePaginationArray, Deployments, + type DeploymentCreateResponse, + type DeploymentListResponse, type DeploymentDeleteResponse, + type DeploymentGetResponse, + type DeploymentRetryResponse, + type DeploymentRollbackResponse, type DeploymentCreateParams, type DeploymentListParams, type DeploymentDeleteParams, @@ -10,21 +16,6 @@ export { type DeploymentRetryParams, type DeploymentRollbackParams, } from './deployments/index'; -export { - DeploymentsSinglePage, - Projects, - type Deployment, - type Project, - type Stage, - type ProjectDeleteResponse, - type ProjectPurgeBuildCacheResponse, - type ProjectCreateParams, - type ProjectListParams, - type ProjectDeleteParams, - type ProjectEditParams, - type ProjectGetParams, - type ProjectPurgeBuildCacheParams, -} from './projects'; export { DomainListResponsesSinglePage, Domains, @@ -39,3 +30,22 @@ export { type DomainEditParams, type DomainGetParams, } from './domains'; +export { + ProjectListResponsesV4PagePaginationArray, + Projects, + type Deployment, + type Project, + type Stage, + type ProjectCreateResponse, + type ProjectListResponse, + type ProjectDeleteResponse, + type ProjectEditResponse, + type ProjectGetResponse, + type ProjectPurgeBuildCacheResponse, + type ProjectCreateParams, + type ProjectListParams, + type ProjectDeleteParams, + type ProjectEditParams, + type ProjectGetParams, + type ProjectPurgeBuildCacheParams, +} from './projects'; diff --git a/src/resources/pages/projects/projects.ts b/src/resources/pages/projects/projects.ts index 01225591dc..de1f7454c2 100644 --- a/src/resources/pages/projects/projects.ts +++ b/src/resources/pages/projects/projects.ts @@ -2,6 +2,7 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; +import * as ProjectsAPI from './projects'; import * as DomainsAPI from './domains'; import { DomainCreateParams, @@ -20,15 +21,21 @@ import { import * as DeploymentsAPI from './deployments/deployments'; import { DeploymentCreateParams, + DeploymentCreateResponse, DeploymentDeleteParams, DeploymentDeleteResponse, DeploymentGetParams, + DeploymentGetResponse, DeploymentListParams, + DeploymentListResponse, + DeploymentListResponsesV4PagePaginationArray, DeploymentRetryParams, + DeploymentRetryResponse, DeploymentRollbackParams, + DeploymentRollbackResponse, Deployments, } from './deployments/deployments'; -import { SinglePage } from '../../../pagination'; +import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../../pagination'; export class Projects extends APIResource { deployments: DeploymentsAPI.Deployments = new DeploymentsAPI.Deployments(this._client); @@ -41,14 +48,16 @@ export class Projects extends APIResource { * ```ts * const project = await client.pages.projects.create({ * account_id: '023e105f4ecef8ad9ca31a8372d0c353', + * name: 'my-pages-app', + * production_branch: 'main', * }); * ``` */ - create(params: ProjectCreateParams, options?: Core.RequestOptions): Core.APIPromise { + create(params: ProjectCreateParams, options?: Core.RequestOptions): Core.APIPromise { const { account_id, ...body } = params; return ( this._client.post(`/accounts/${account_id}/pages/projects`, { body, ...options }) as Core.APIPromise<{ - result: Project; + result: ProjectCreateResponse; }> )._thenUnwrap((obj) => obj.result); } @@ -59,9 +68,9 @@ export class Projects extends APIResource { * @example * ```ts * // Automatically fetches more pages as needed. - * for await (const deployment of client.pages.projects.list({ - * account_id: '023e105f4ecef8ad9ca31a8372d0c353', - * })) { + * for await (const projectListResponse of client.pages.projects.list( + * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * )) { * // ... * } * ``` @@ -69,9 +78,13 @@ export class Projects extends APIResource { list( params: ProjectListParams, options?: Core.RequestOptions, - ): Core.PagePromise { - const { account_id } = params; - return this._client.getAPIList(`/accounts/${account_id}/pages/projects`, DeploymentsSinglePage, options); + ): Core.PagePromise { + const { account_id, ...query } = params; + return this._client.getAPIList( + `/accounts/${account_id}/pages/projects`, + ProjectListResponsesV4PagePaginationArray, + { query, ...options }, + ); } /** @@ -105,7 +118,7 @@ export class Projects extends APIResource { * * @example * ```ts - * const project = await client.pages.projects.edit( + * const response = await client.pages.projects.edit( * 'this-is-my-project-01', * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); @@ -115,13 +128,13 @@ export class Projects extends APIResource { projectName: string, params: ProjectEditParams, options?: Core.RequestOptions, - ): Core.APIPromise { + ): Core.APIPromise { const { account_id, ...body } = params; return ( this._client.patch(`/accounts/${account_id}/pages/projects/${projectName}`, { body, ...options, - }) as Core.APIPromise<{ result: Project }> + }) as Core.APIPromise<{ result: ProjectEditResponse }> )._thenUnwrap((obj) => obj.result); } @@ -140,11 +153,11 @@ export class Projects extends APIResource { projectName: string, params: ProjectGetParams, options?: Core.RequestOptions, - ): Core.APIPromise { + ): Core.APIPromise { const { account_id } = params; return ( this._client.get(`/accounts/${account_id}/pages/projects/${projectName}`, options) as Core.APIPromise<{ - result: Project; + result: ProjectGetResponse; }> )._thenUnwrap((obj) => obj.result); } @@ -176,87 +189,95 @@ export class Projects extends APIResource { } } -export class DeploymentsSinglePage extends SinglePage {} +export class ProjectListResponsesV4PagePaginationArray extends V4PagePaginationArray {} export interface Deployment { /** * Id of the deployment. */ - id?: string; + id: string; /** * A list of alias URLs pointing to this deployment. */ - aliases?: Array | null; + aliases: Array | null; /** * Configs for the project build process. */ - build_config?: Deployment.BuildConfig; + build_config: Deployment.BuildConfig; /** * When the deployment was created. */ - created_on?: string; + created_on: string; /** * Info about what caused the deployment. */ - deployment_trigger?: Deployment.DeploymentTrigger; + deployment_trigger: Deployment.DeploymentTrigger; /** * Environment variables used for builds and Pages Functions. */ - env_vars?: { + env_vars: { [key: string]: Deployment.PagesPlainTextEnvVar | null | Deployment.PagesSecretTextEnvVar | null; - }; + } | null; /** * Type of deploy. */ - environment?: 'preview' | 'production'; + environment: 'preview' | 'production'; /** * If the deployment has been skipped. */ - is_skipped?: boolean; + is_skipped: boolean; /** * The status of the deployment. */ - latest_stage?: Stage; + latest_stage: Stage; /** * When the deployment was last modified. */ - modified_on?: string; + modified_on: string; /** * Id of the project. */ - project_id?: string; + project_id: string; /** * Name of the project. */ - project_name?: string; + project_name: string; /** * Short Id (8 character) of the deployment. */ - short_id?: string; + short_id: string; - source?: Deployment.Source; + /** + * Configs for the project source control. + */ + source: Deployment.Source; /** * List of past stages. */ - stages?: Array; + stages: Array; /** * The live URL to view this deployment. */ - url?: string; + url: string; + + /** + * Whether the deployment uses functions. + */ + uses_functions?: boolean | null; } export namespace Deployment { @@ -264,6 +285,16 @@ export namespace Deployment { * Configs for the project build process. */ export interface BuildConfig { + /** + * The classifying tag for analytics. + */ + web_analytics_tag: string | null; + + /** + * The auth token for analytics. + */ + web_analytics_token: string | null; + /** * Enable build caching for the project. */ @@ -275,7 +306,7 @@ export namespace Deployment { build_command?: string | null; /** - * Output directory of the build. + * Assets output directory of the build. */ destination_dir?: string | null; @@ -283,16 +314,6 @@ export namespace Deployment { * Directory to run the command. */ root_dir?: string | null; - - /** - * The classifying tag for analytics. - */ - web_analytics_tag?: string | null; - - /** - * The auth token for analytics. - */ - web_analytics_token?: string | null; } /** @@ -302,12 +323,12 @@ export namespace Deployment { /** * Additional info about the trigger. */ - metadata?: DeploymentTrigger.Metadata; + metadata: DeploymentTrigger.Metadata; /** * What caused the deployment. */ - type?: 'push' | 'ad_hoc'; + type: 'github:push' | 'ad_hoc' | 'deploy_hook'; } export namespace DeploymentTrigger { @@ -318,17 +339,22 @@ export namespace Deployment { /** * Where the trigger happened. */ - branch?: string; + branch: string; + + /** + * Whether the deployment trigger commit was dirty. + */ + commit_dirty: boolean; /** * Hash of the deployment trigger commit. */ - commit_hash?: string; + commit_hash: string; /** * Message of the deployment trigger commit. */ - commit_message?: string; + commit_message: string; } } @@ -356,85 +382,169 @@ export namespace Deployment { value: string; } + /** + * Configs for the project source control. + */ export interface Source { - config?: Source.Config; + config: Source.Config; - type?: string; + /** + * The source control management provider. + */ + type: 'github' | 'gitlab'; } export namespace Source { export interface Config { + /** + * The owner of the repository. + */ + owner: string; + + /** + * Whether to enable PR comments. + */ + pr_comments_enabled: boolean; + + /** + * The production branch of the repository. + */ + production_branch: string; + + /** + * The name of the repository. + */ + repo_name: string; + + /** + * @deprecated Use `production_deployments_enabled` and + * `preview_deployment_setting` for more granular control. + */ deployments_enabled?: boolean; - owner?: string; + /** + * The owner ID of the repository. + */ + owner_id?: string; + /** + * A list of paths that should be excluded from triggering a preview deployment. + * Wildcard syntax (`*`) is supported. + */ path_excludes?: Array; + /** + * A list of paths that should be watched to trigger a preview deployment. Wildcard + * syntax (`*`) is supported. + */ path_includes?: Array; - pr_comments_enabled?: boolean; - + /** + * A list of branches that should not trigger a preview deployment. Wildcard syntax + * (`*`) is supported. Must be used with `preview_deployment_setting` set to + * `custom`. + */ preview_branch_excludes?: Array; + /** + * A list of branches that should trigger a preview deployment. Wildcard syntax + * (`*`) is supported. Must be used with `preview_deployment_setting` set to + * `custom`. + */ preview_branch_includes?: Array; + /** + * Controls whether commits to preview branches trigger a preview deployment. + */ preview_deployment_setting?: 'all' | 'none' | 'custom'; - production_branch?: string; - + /** + * Whether to trigger a production deployment on commits to the production branch. + */ production_deployments_enabled?: boolean; - repo_name?: string; + /** + * The ID of the repository. + */ + repo_id?: string; } } } export interface Project { /** - * Id of the project. + * ID of the project. */ - id?: string; + id: string; /** - * Configs for the project build process. + * Most recent production deployment of the project. */ - build_config?: Project.BuildConfig; + canonical_deployment: Project.CanonicalDeployment | null; /** - * Most recent deployment to the repo. + * When the project was created. */ - canonical_deployment?: Deployment | null; + created_on: string; /** - * When the project was created. + * Configs for deployments in a project. */ - created_on?: string; + deployment_configs: Project.DeploymentConfigs; /** - * Configs for deployments in a project. + * Framework the project is using. */ - deployment_configs?: Project.DeploymentConfigs; + framework: string; /** - * A list of associated custom domains for the project. + * Version of the framework the project is using. */ - domains?: Array; + framework_version: string; /** - * Most recent deployment to the repo. + * Most recent deployment of the project. */ - latest_deployment?: Deployment | null; + latest_deployment: Project.LatestDeployment | null; /** * Name of the project. */ - name?: string; + name: string; + + /** + * Name of the preview script. + */ + preview_script_name: string; /** * Production branch of the project. Used to identify production deployments. */ - production_branch?: string; + production_branch: string; + + /** + * Name of the production script. + */ + production_script_name: string; + + /** + * Whether the project uses functions. + */ + uses_functions: boolean | null; + + /** + * Configs for the project build process. + */ + build_config?: Project.BuildConfig; + /** + * A list of associated custom domains for the project. + */ + domains?: Array; + + /** + * Configs for the project source control. + */ source?: Project.Source; /** @@ -445,390 +555,455 @@ export interface Project { export namespace Project { /** - * Configs for the project build process. + * Most recent production deployment of the project. */ - export interface BuildConfig { + export interface CanonicalDeployment { /** - * Enable build caching for the project. + * Id of the deployment. */ - build_caching?: boolean | null; + id: string; /** - * Command used to build project. + * A list of alias URLs pointing to this deployment. */ - build_command?: string | null; + aliases: Array | null; /** - * Output directory of the build. + * Configs for the project build process. */ - destination_dir?: string | null; + build_config: CanonicalDeployment.BuildConfig; /** - * Directory to run the command. + * When the deployment was created. */ - root_dir?: string | null; + created_on: string; /** - * The classifying tag for analytics. + * Info about what caused the deployment. */ - web_analytics_tag?: string | null; + deployment_trigger: CanonicalDeployment.DeploymentTrigger; /** - * The auth token for analytics. + * Environment variables used for builds and Pages Functions. */ - web_analytics_token?: string | null; - } + env_vars: { + [key: string]: + | CanonicalDeployment.PagesPlainTextEnvVar + | null + | CanonicalDeployment.PagesSecretTextEnvVar + | null; + } | null; - /** - * Configs for deployments in a project. - */ - export interface DeploymentConfigs { /** - * Configs for preview deploys. + * Type of deploy. */ - preview?: DeploymentConfigs.Preview; + environment: 'preview' | 'production'; /** - * Configs for production deploys. + * If the deployment has been skipped. */ - production?: DeploymentConfigs.Production; - } + is_skipped: boolean; - export namespace DeploymentConfigs { /** - * Configs for preview deploys. + * The status of the deployment. */ - export interface Preview { - /** - * Constellation bindings used for Pages Functions. - */ - ai_bindings?: { [key: string]: Preview.AIBindings | null } | null; + latest_stage: ProjectsAPI.Stage; - /** - * Analytics Engine bindings used for Pages Functions. - */ - analytics_engine_datasets?: { [key: string]: Preview.AnalyticsEngineDatasets | null } | null; + /** + * When the deployment was last modified. + */ + modified_on: string; - /** - * Browser bindings used for Pages Functions. - */ - browsers?: { [key: string]: Preview.Browsers | null } | null; + /** + * Id of the project. + */ + project_id: string; - /** - * Compatibility date used for Pages Functions. - */ - compatibility_date?: string; + /** + * Name of the project. + */ + project_name: string; - /** - * Compatibility flags used for Pages Functions. - */ - compatibility_flags?: Array; + /** + * Short Id (8 character) of the deployment. + */ + short_id: string; - /** - * D1 databases used for Pages Functions. - */ - d1_databases?: { [key: string]: Preview.D1Databases | null } | null; + /** + * Configs for the project source control. + */ + source: CanonicalDeployment.Source; - /** - * Durable Object namespaces used for Pages Functions. - */ - durable_object_namespaces?: { [key: string]: Preview.DurableObjectNamespaces | null } | null; + /** + * List of past stages. + */ + stages: Array; - /** - * Environment variables used for builds and Pages Functions. - */ - env_vars?: { - [key: string]: Preview.PagesPlainTextEnvVar | null | Preview.PagesSecretTextEnvVar | null; - }; + /** + * The live URL to view this deployment. + */ + url: string; - /** - * Hyperdrive bindings used for Pages Functions. - */ - hyperdrive_bindings?: { [key: string]: Preview.HyperdriveBindings | null } | null; + /** + * Whether the deployment uses functions. + */ + uses_functions?: boolean | null; + } + export namespace CanonicalDeployment { + /** + * Configs for the project build process. + */ + export interface BuildConfig { /** - * KV namespaces used for Pages Functions. + * The classifying tag for analytics. */ - kv_namespaces?: { [key: string]: Preview.KVNamespaces | null } | null; + web_analytics_tag: string | null; /** - * mTLS bindings used for Pages Functions. + * The auth token for analytics. */ - mtls_certificates?: { [key: string]: Preview.MTLSCertificates | null } | null; + web_analytics_token: string | null; /** - * Placement setting used for Pages Functions. + * Enable build caching for the project. */ - placement?: Preview.Placement | null; + build_caching?: boolean | null; /** - * Queue Producer bindings used for Pages Functions. + * Command used to build project. */ - queue_producers?: { [key: string]: Preview.QueueProducers | null } | null; + build_command?: string | null; /** - * R2 buckets used for Pages Functions. + * Assets output directory of the build. */ - r2_buckets?: { [key: string]: Preview.R2Buckets | null } | null; + destination_dir?: string | null; /** - * Services used for Pages Functions. + * Directory to run the command. */ - services?: { [key: string]: Preview.Services | null } | null; + root_dir?: string | null; + } + /** + * Info about what caused the deployment. + */ + export interface DeploymentTrigger { /** - * Vectorize bindings used for Pages Functions. + * Additional info about the trigger. */ - vectorize_bindings?: { [key: string]: Preview.VectorizeBindings | null } | null; - } + metadata: DeploymentTrigger.Metadata; - export namespace Preview { /** - * AI binding. + * What caused the deployment. */ - export interface AIBindings { - project_id?: string; - } + type: 'github:push' | 'ad_hoc' | 'deploy_hook'; + } + export namespace DeploymentTrigger { /** - * Analytics Engine binding. + * Additional info about the trigger. */ - export interface AnalyticsEngineDatasets { + export interface Metadata { /** - * Name of the dataset. + * Where the trigger happened. */ - dataset?: string; - } - - /** - * Browser binding. - */ - export interface Browsers {} + branch: string; - /** - * D1 binding. - */ - export interface D1Databases { /** - * UUID of the D1 database. + * Whether the deployment trigger commit was dirty. */ - id?: string; - } + commit_dirty: boolean; - /** - * Durable Object binding. - */ - export interface DurableObjectNamespaces { /** - * ID of the Durable Object namespace. + * Hash of the deployment trigger commit. */ - namespace_id?: string; - } - - /** - * A plaintext environment variable. - */ - export interface PagesPlainTextEnvVar { - type: 'plain_text'; + commit_hash: string; /** - * Environment variable value. + * Message of the deployment trigger commit. */ - value: string; + commit_message: string; } + } + + /** + * A plaintext environment variable. + */ + export interface PagesPlainTextEnvVar { + type: 'plain_text'; /** - * An encrypted environment variable. + * Environment variable value. */ - export interface PagesSecretTextEnvVar { - type: 'secret_text'; + value: string; + } - /** - * Secret value. - */ - value: string; - } + /** + * An encrypted environment variable. + */ + export interface PagesSecretTextEnvVar { + type: 'secret_text'; /** - * Hyperdrive binding. + * Secret value. */ - export interface HyperdriveBindings { - id?: string; - } + value: string; + } + + /** + * Configs for the project source control. + */ + export interface Source { + config: Source.Config; /** - * KV namespace binding. + * The source control management provider. */ - export interface KVNamespaces { + type: 'github' | 'gitlab'; + } + + export namespace Source { + export interface Config { /** - * ID of the KV namespace. + * The owner of the repository. */ - namespace_id?: string; - } + owner: string; - /** - * mTLS binding. - */ - export interface MTLSCertificates { - certificate_id?: string; - } + /** + * Whether to enable PR comments. + */ + pr_comments_enabled: boolean; - /** - * Placement setting used for Pages Functions. - */ - export interface Placement { /** - * Placement mode. + * The production branch of the repository. */ - mode?: string; - } + production_branch: string; - /** - * Queue Producer binding. - */ - export interface QueueProducers { /** - * Name of the Queue. + * The name of the repository. */ - name?: string; - } + repo_name: string; - /** - * R2 binding. - */ - export interface R2Buckets { /** - * Jurisdiction of the R2 bucket. + * @deprecated Use `production_deployments_enabled` and + * `preview_deployment_setting` for more granular control. */ - jurisdiction?: string | null; + deployments_enabled?: boolean; /** - * Name of the R2 bucket. + * The owner ID of the repository. */ - name?: string; - } + owner_id?: string; - /** - * Service binding. - */ - export interface Services { /** - * The entrypoint to bind to. + * A list of paths that should be excluded from triggering a preview deployment. + * Wildcard syntax (`*`) is supported. */ - entrypoint?: string | null; + path_excludes?: Array; /** - * The Service environment. + * A list of paths that should be watched to trigger a preview deployment. Wildcard + * syntax (`*`) is supported. */ - environment?: string; + path_includes?: Array; /** - * The Service name. + * A list of branches that should not trigger a preview deployment. Wildcard syntax + * (`*`) is supported. Must be used with `preview_deployment_setting` set to + * `custom`. */ - service?: string; - } + preview_branch_excludes?: Array; - /** - * Vectorize binding. - */ - export interface VectorizeBindings { - index_name?: string; + /** + * A list of branches that should trigger a preview deployment. Wildcard syntax + * (`*`) is supported. Must be used with `preview_deployment_setting` set to + * `custom`. + */ + preview_branch_includes?: Array; + + /** + * Controls whether commits to preview branches trigger a preview deployment. + */ + preview_deployment_setting?: 'all' | 'none' | 'custom'; + + /** + * Whether to trigger a production deployment on commits to the production branch. + */ + production_deployments_enabled?: boolean; + + /** + * The ID of the repository. + */ + repo_id?: string; } } + } + + /** + * Configs for deployments in a project. + */ + export interface DeploymentConfigs { + /** + * Configs for preview deploys. + */ + preview: DeploymentConfigs.Preview; /** * Configs for production deploys. */ - export interface Production { - /** - * Constellation bindings used for Pages Functions. - */ - ai_bindings?: { [key: string]: Production.AIBindings | null } | null; + production: DeploymentConfigs.Production; + } + export namespace DeploymentConfigs { + /** + * Configs for preview deploys. + */ + export interface Preview { /** - * Analytics Engine bindings used for Pages Functions. + * Whether to always use the latest compatibility date for Pages Functions. */ - analytics_engine_datasets?: { [key: string]: Production.AnalyticsEngineDatasets | null } | null; + always_use_latest_compatibility_date: boolean; /** - * Browser bindings used for Pages Functions. + * The major version of the build image to use for Pages Functions. */ - browsers?: { [key: string]: Production.Browsers | null } | null; + build_image_major_version: number; /** * Compatibility date used for Pages Functions. */ - compatibility_date?: string; + compatibility_date: string; /** * Compatibility flags used for Pages Functions. */ - compatibility_flags?: Array; + compatibility_flags: Array; /** - * D1 databases used for Pages Functions. + * Environment variables used for builds and Pages Functions. */ - d1_databases?: { [key: string]: Production.D1Databases | null } | null; + env_vars: { + [key: string]: Preview.PagesPlainTextEnvVar | null | Preview.PagesSecretTextEnvVar | null; + } | null; /** - * Durable Object namespaces used for Pages Functions. + * Whether to fail open when the deployment config cannot be applied. */ - durable_object_namespaces?: { [key: string]: Production.DurableObjectNamespaces | null } | null; + fail_open: boolean; /** - * Environment variables used for builds and Pages Functions. + * @deprecated All new projects now use the Standard usage model. */ - env_vars?: { - [key: string]: Production.PagesPlainTextEnvVar | null | Production.PagesSecretTextEnvVar | null; - }; + usage_model: 'standard' | 'bundled' | 'unbound'; + + /** + * Constellation bindings used for Pages Functions. + */ + ai_bindings?: { [key: string]: Preview.AIBindings }; + + /** + * Analytics Engine bindings used for Pages Functions. + */ + analytics_engine_datasets?: { [key: string]: Preview.AnalyticsEngineDatasets }; + + /** + * Browser bindings used for Pages Functions. + */ + browsers?: { [key: string]: Preview.Browsers | null }; + + /** + * D1 databases used for Pages Functions. + */ + d1_databases?: { [key: string]: Preview.D1Databases }; + + /** + * Durable Object namespaces used for Pages Functions. + */ + durable_object_namespaces?: { [key: string]: Preview.DurableObjectNamespaces }; /** * Hyperdrive bindings used for Pages Functions. */ - hyperdrive_bindings?: { [key: string]: Production.HyperdriveBindings | null } | null; + hyperdrive_bindings?: { [key: string]: Preview.HyperdriveBindings }; /** * KV namespaces used for Pages Functions. */ - kv_namespaces?: { [key: string]: Production.KVNamespaces | null } | null; + kv_namespaces?: { [key: string]: Preview.KVNamespaces }; + + /** + * Limits for Pages Functions. + */ + limits?: Preview.Limits; /** * mTLS bindings used for Pages Functions. */ - mtls_certificates?: { [key: string]: Production.MTLSCertificates | null } | null; + mtls_certificates?: { [key: string]: Preview.MTLSCertificates }; /** * Placement setting used for Pages Functions. */ - placement?: Production.Placement | null; + placement?: Preview.Placement; /** * Queue Producer bindings used for Pages Functions. */ - queue_producers?: { [key: string]: Production.QueueProducers | null } | null; + queue_producers?: { [key: string]: Preview.QueueProducers }; /** * R2 buckets used for Pages Functions. */ - r2_buckets?: { [key: string]: Production.R2Buckets | null } | null; + r2_buckets?: { [key: string]: Preview.R2Buckets }; /** * Services used for Pages Functions. */ - services?: { [key: string]: Production.Services | null } | null; + services?: { [key: string]: Preview.Services }; /** * Vectorize bindings used for Pages Functions. */ - vectorize_bindings?: { [key: string]: Production.VectorizeBindings | null } | null; + vectorize_bindings?: { [key: string]: Preview.VectorizeBindings }; + + /** + * Hash of the Wrangler configuration used for the deployment. + */ + wrangler_config_hash?: string; } - export namespace Production { + export namespace Preview { + /** + * A plaintext environment variable. + */ + export interface PagesPlainTextEnvVar { + type: 'plain_text'; + + /** + * Environment variable value. + */ + value: string; + } + + /** + * An encrypted environment variable. + */ + export interface PagesSecretTextEnvVar { + type: 'secret_text'; + + /** + * Secret value. + */ + value: string; + } + /** * AI binding. */ export interface AIBindings { - project_id?: string; + project_id: string; } /** @@ -838,7 +1013,7 @@ export namespace Project { /** * Name of the dataset. */ - dataset?: string; + dataset: string; } /** @@ -853,7 +1028,7 @@ export namespace Project { /** * UUID of the D1 database. */ - id?: string; + id: string; } /** @@ -863,55 +1038,41 @@ export namespace Project { /** * ID of the Durable Object namespace. */ - namespace_id?: string; + namespace_id: string; } /** - * A plaintext environment variable. + * Hyperdrive binding. */ - export interface PagesPlainTextEnvVar { - type: 'plain_text'; - - /** - * Environment variable value. - */ - value: string; + export interface HyperdriveBindings { + id: string; } /** - * An encrypted environment variable. + * KV namespace binding. */ - export interface PagesSecretTextEnvVar { - type: 'secret_text'; - + export interface KVNamespaces { /** - * Secret value. + * ID of the KV namespace. */ - value: string; + namespace_id: string; } /** - * Hyperdrive binding. - */ - export interface HyperdriveBindings { - id?: string; - } - - /** - * KV namespace binding. + * Limits for Pages Functions. */ - export interface KVNamespaces { + export interface Limits { /** - * ID of the KV namespace. + * CPU time limit in milliseconds. */ - namespace_id?: string; + cpu_ms: number; } /** * mTLS binding. */ export interface MTLSCertificates { - certificate_id?: string; + certificate_id: string; } /** @@ -921,7 +1082,7 @@ export namespace Project { /** * Placement mode. */ - mode?: string; + mode: string; } /** @@ -931,7 +1092,7 @@ export namespace Project { /** * Name of the Queue. */ - name?: string; + name: string; } /** @@ -939,14 +1100,14 @@ export namespace Project { */ export interface R2Buckets { /** - * Jurisdiction of the R2 bucket. + * Name of the R2 bucket. */ - jurisdiction?: string | null; + name: string; /** - * Name of the R2 bucket. + * Jurisdiction of the R2 bucket. */ - name?: string; + jurisdiction?: string | null; } /** @@ -954,121 +1115,6220 @@ export namespace Project { */ export interface Services { /** - * The entrypoint to bind to. + * The Service environment. */ - entrypoint?: string | null; + environment: string; /** - * The Service environment. + * The Service name. */ - environment?: string; + service: string; /** - * The Service name. + * The entrypoint to bind to. */ - service?: string; + entrypoint?: string | null; } /** * Vectorize binding. */ export interface VectorizeBindings { - index_name?: string; + index_name: string; } } - } - export interface Source { - config?: Source.Config; + /** + * Configs for production deploys. + */ + export interface Production { + /** + * Whether to always use the latest compatibility date for Pages Functions. + */ + always_use_latest_compatibility_date: boolean; - type?: string; - } + /** + * The major version of the build image to use for Pages Functions. + */ + build_image_major_version: number; - export namespace Source { - export interface Config { - deployments_enabled?: boolean; + /** + * Compatibility date used for Pages Functions. + */ + compatibility_date: string; - owner?: string; + /** + * Compatibility flags used for Pages Functions. + */ + compatibility_flags: Array; - path_excludes?: Array; + /** + * Environment variables used for builds and Pages Functions. + */ + env_vars: { + [key: string]: Production.PagesPlainTextEnvVar | null | Production.PagesSecretTextEnvVar | null; + } | null; - path_includes?: Array; + /** + * Whether to fail open when the deployment config cannot be applied. + */ + fail_open: boolean; - pr_comments_enabled?: boolean; + /** + * @deprecated All new projects now use the Standard usage model. + */ + usage_model: 'standard' | 'bundled' | 'unbound'; - preview_branch_excludes?: Array; + /** + * Constellation bindings used for Pages Functions. + */ + ai_bindings?: { [key: string]: Production.AIBindings }; - preview_branch_includes?: Array; + /** + * Analytics Engine bindings used for Pages Functions. + */ + analytics_engine_datasets?: { [key: string]: Production.AnalyticsEngineDatasets }; - preview_deployment_setting?: 'all' | 'none' | 'custom'; + /** + * Browser bindings used for Pages Functions. + */ + browsers?: { [key: string]: Production.Browsers | null }; - production_branch?: string; + /** + * D1 databases used for Pages Functions. + */ + d1_databases?: { [key: string]: Production.D1Databases }; - production_deployments_enabled?: boolean; + /** + * Durable Object namespaces used for Pages Functions. + */ + durable_object_namespaces?: { [key: string]: Production.DurableObjectNamespaces }; - repo_name?: string; - } - } -} + /** + * Hyperdrive bindings used for Pages Functions. + */ + hyperdrive_bindings?: { [key: string]: Production.HyperdriveBindings }; -/** - * The status of the deployment. - */ -export interface Stage { - /** - * When the stage ended. - */ - ended_on?: string | null; + /** + * KV namespaces used for Pages Functions. + */ + kv_namespaces?: { [key: string]: Production.KVNamespaces }; - /** - * The current build stage. - */ - name?: 'queued' | 'initialize' | 'clone_repo' | 'build' | 'deploy'; + /** + * Limits for Pages Functions. + */ + limits?: Production.Limits; + + /** + * mTLS bindings used for Pages Functions. + */ + mtls_certificates?: { [key: string]: Production.MTLSCertificates }; + + /** + * Placement setting used for Pages Functions. + */ + placement?: Production.Placement; + + /** + * Queue Producer bindings used for Pages Functions. + */ + queue_producers?: { [key: string]: Production.QueueProducers }; + + /** + * R2 buckets used for Pages Functions. + */ + r2_buckets?: { [key: string]: Production.R2Buckets }; + + /** + * Services used for Pages Functions. + */ + services?: { [key: string]: Production.Services }; + + /** + * Vectorize bindings used for Pages Functions. + */ + vectorize_bindings?: { [key: string]: Production.VectorizeBindings }; + + /** + * Hash of the Wrangler configuration used for the deployment. + */ + wrangler_config_hash?: string; + } + + export namespace Production { + /** + * A plaintext environment variable. + */ + export interface PagesPlainTextEnvVar { + type: 'plain_text'; + + /** + * Environment variable value. + */ + value: string; + } + + /** + * An encrypted environment variable. + */ + export interface PagesSecretTextEnvVar { + type: 'secret_text'; + + /** + * Secret value. + */ + value: string; + } + + /** + * AI binding. + */ + export interface AIBindings { + project_id: string; + } + + /** + * Analytics Engine binding. + */ + export interface AnalyticsEngineDatasets { + /** + * Name of the dataset. + */ + dataset: string; + } + + /** + * Browser binding. + */ + export interface Browsers {} + + /** + * D1 binding. + */ + export interface D1Databases { + /** + * UUID of the D1 database. + */ + id: string; + } + + /** + * Durable Object binding. + */ + export interface DurableObjectNamespaces { + /** + * ID of the Durable Object namespace. + */ + namespace_id: string; + } + + /** + * Hyperdrive binding. + */ + export interface HyperdriveBindings { + id: string; + } + + /** + * KV namespace binding. + */ + export interface KVNamespaces { + /** + * ID of the KV namespace. + */ + namespace_id: string; + } + + /** + * Limits for Pages Functions. + */ + export interface Limits { + /** + * CPU time limit in milliseconds. + */ + cpu_ms: number; + } + + /** + * mTLS binding. + */ + export interface MTLSCertificates { + certificate_id: string; + } + + /** + * Placement setting used for Pages Functions. + */ + export interface Placement { + /** + * Placement mode. + */ + mode: string; + } + + /** + * Queue Producer binding. + */ + export interface QueueProducers { + /** + * Name of the Queue. + */ + name: string; + } + + /** + * R2 binding. + */ + export interface R2Buckets { + /** + * Name of the R2 bucket. + */ + name: string; + + /** + * Jurisdiction of the R2 bucket. + */ + jurisdiction?: string | null; + } + + /** + * Service binding. + */ + export interface Services { + /** + * The Service environment. + */ + environment: string; + + /** + * The Service name. + */ + service: string; + + /** + * The entrypoint to bind to. + */ + entrypoint?: string | null; + } + + /** + * Vectorize binding. + */ + export interface VectorizeBindings { + index_name: string; + } + } + } + + /** + * Most recent deployment of the project. + */ + export interface LatestDeployment { + /** + * Id of the deployment. + */ + id: string; + + /** + * A list of alias URLs pointing to this deployment. + */ + aliases: Array | null; + + /** + * Configs for the project build process. + */ + build_config: LatestDeployment.BuildConfig; + + /** + * When the deployment was created. + */ + created_on: string; + + /** + * Info about what caused the deployment. + */ + deployment_trigger: LatestDeployment.DeploymentTrigger; + + /** + * Environment variables used for builds and Pages Functions. + */ + env_vars: { + [key: string]: + | LatestDeployment.PagesPlainTextEnvVar + | null + | LatestDeployment.PagesSecretTextEnvVar + | null; + } | null; + + /** + * Type of deploy. + */ + environment: 'preview' | 'production'; + + /** + * If the deployment has been skipped. + */ + is_skipped: boolean; + + /** + * The status of the deployment. + */ + latest_stage: ProjectsAPI.Stage; + + /** + * When the deployment was last modified. + */ + modified_on: string; + + /** + * Id of the project. + */ + project_id: string; + + /** + * Name of the project. + */ + project_name: string; + + /** + * Short Id (8 character) of the deployment. + */ + short_id: string; + + /** + * Configs for the project source control. + */ + source: LatestDeployment.Source; + + /** + * List of past stages. + */ + stages: Array; + + /** + * The live URL to view this deployment. + */ + url: string; + + /** + * Whether the deployment uses functions. + */ + uses_functions?: boolean | null; + } + + export namespace LatestDeployment { + /** + * Configs for the project build process. + */ + export interface BuildConfig { + /** + * The classifying tag for analytics. + */ + web_analytics_tag: string | null; + + /** + * The auth token for analytics. + */ + web_analytics_token: string | null; + + /** + * Enable build caching for the project. + */ + build_caching?: boolean | null; + + /** + * Command used to build project. + */ + build_command?: string | null; + + /** + * Assets output directory of the build. + */ + destination_dir?: string | null; + + /** + * Directory to run the command. + */ + root_dir?: string | null; + } + + /** + * Info about what caused the deployment. + */ + export interface DeploymentTrigger { + /** + * Additional info about the trigger. + */ + metadata: DeploymentTrigger.Metadata; + + /** + * What caused the deployment. + */ + type: 'github:push' | 'ad_hoc' | 'deploy_hook'; + } + + export namespace DeploymentTrigger { + /** + * Additional info about the trigger. + */ + export interface Metadata { + /** + * Where the trigger happened. + */ + branch: string; + + /** + * Whether the deployment trigger commit was dirty. + */ + commit_dirty: boolean; + + /** + * Hash of the deployment trigger commit. + */ + commit_hash: string; + + /** + * Message of the deployment trigger commit. + */ + commit_message: string; + } + } + + /** + * A plaintext environment variable. + */ + export interface PagesPlainTextEnvVar { + type: 'plain_text'; + + /** + * Environment variable value. + */ + value: string; + } + + /** + * An encrypted environment variable. + */ + export interface PagesSecretTextEnvVar { + type: 'secret_text'; + + /** + * Secret value. + */ + value: string; + } + + /** + * Configs for the project source control. + */ + export interface Source { + config: Source.Config; + + /** + * The source control management provider. + */ + type: 'github' | 'gitlab'; + } + + export namespace Source { + export interface Config { + /** + * The owner of the repository. + */ + owner: string; + + /** + * Whether to enable PR comments. + */ + pr_comments_enabled: boolean; + + /** + * The production branch of the repository. + */ + production_branch: string; + + /** + * The name of the repository. + */ + repo_name: string; + + /** + * @deprecated Use `production_deployments_enabled` and + * `preview_deployment_setting` for more granular control. + */ + deployments_enabled?: boolean; + + /** + * The owner ID of the repository. + */ + owner_id?: string; + + /** + * A list of paths that should be excluded from triggering a preview deployment. + * Wildcard syntax (`*`) is supported. + */ + path_excludes?: Array; + + /** + * A list of paths that should be watched to trigger a preview deployment. Wildcard + * syntax (`*`) is supported. + */ + path_includes?: Array; + + /** + * A list of branches that should not trigger a preview deployment. Wildcard syntax + * (`*`) is supported. Must be used with `preview_deployment_setting` set to + * `custom`. + */ + preview_branch_excludes?: Array; + + /** + * A list of branches that should trigger a preview deployment. Wildcard syntax + * (`*`) is supported. Must be used with `preview_deployment_setting` set to + * `custom`. + */ + preview_branch_includes?: Array; + + /** + * Controls whether commits to preview branches trigger a preview deployment. + */ + preview_deployment_setting?: 'all' | 'none' | 'custom'; + + /** + * Whether to trigger a production deployment on commits to the production branch. + */ + production_deployments_enabled?: boolean; + + /** + * The ID of the repository. + */ + repo_id?: string; + } + } + } + + /** + * Configs for the project build process. + */ + export interface BuildConfig { + /** + * The classifying tag for analytics. + */ + web_analytics_tag: string | null; + + /** + * The auth token for analytics. + */ + web_analytics_token: string | null; + + /** + * Enable build caching for the project. + */ + build_caching?: boolean | null; + + /** + * Command used to build project. + */ + build_command?: string | null; + + /** + * Assets output directory of the build. + */ + destination_dir?: string | null; + + /** + * Directory to run the command. + */ + root_dir?: string | null; + } + + /** + * Configs for the project source control. + */ + export interface Source { + config: Source.Config; + + /** + * The source control management provider. + */ + type: 'github' | 'gitlab'; + } + + export namespace Source { + export interface Config { + /** + * The owner of the repository. + */ + owner: string; + + /** + * Whether to enable PR comments. + */ + pr_comments_enabled: boolean; + + /** + * The production branch of the repository. + */ + production_branch: string; + + /** + * The name of the repository. + */ + repo_name: string; + + /** + * @deprecated Use `production_deployments_enabled` and + * `preview_deployment_setting` for more granular control. + */ + deployments_enabled?: boolean; + + /** + * The owner ID of the repository. + */ + owner_id?: string; + + /** + * A list of paths that should be excluded from triggering a preview deployment. + * Wildcard syntax (`*`) is supported. + */ + path_excludes?: Array; + + /** + * A list of paths that should be watched to trigger a preview deployment. Wildcard + * syntax (`*`) is supported. + */ + path_includes?: Array; + + /** + * A list of branches that should not trigger a preview deployment. Wildcard syntax + * (`*`) is supported. Must be used with `preview_deployment_setting` set to + * `custom`. + */ + preview_branch_excludes?: Array; + + /** + * A list of branches that should trigger a preview deployment. Wildcard syntax + * (`*`) is supported. Must be used with `preview_deployment_setting` set to + * `custom`. + */ + preview_branch_includes?: Array; + + /** + * Controls whether commits to preview branches trigger a preview deployment. + */ + preview_deployment_setting?: 'all' | 'none' | 'custom'; + + /** + * Whether to trigger a production deployment on commits to the production branch. + */ + production_deployments_enabled?: boolean; + + /** + * The ID of the repository. + */ + repo_id?: string; + } + } +} + +/** + * The status of the deployment. + */ +export interface Stage { + /** + * When the stage ended. + */ + ended_on: string | null; + + /** + * The current build stage. + */ + name: 'queued' | 'initialize' | 'clone_repo' | 'build' | 'deploy'; + + /** + * When the stage started. + */ + started_on: string | null; + + /** + * State of the current stage. + */ + status: 'success' | 'idle' | 'active' | 'failure' | 'canceled'; +} + +export interface ProjectCreateResponse { + /** + * ID of the project. + */ + id: string; + + /** + * Most recent production deployment of the project. + */ + canonical_deployment: ProjectCreateResponse.CanonicalDeployment | null; + + /** + * When the project was created. + */ + created_on: string; + + /** + * Configs for deployments in a project. + */ + deployment_configs: ProjectCreateResponse.DeploymentConfigs; + + /** + * Framework the project is using. + */ + framework: string; + + /** + * Version of the framework the project is using. + */ + framework_version: string; + + /** + * Most recent deployment of the project. + */ + latest_deployment: ProjectCreateResponse.LatestDeployment | null; + + /** + * Name of the project. + */ + name: string; + + /** + * Name of the preview script. + */ + preview_script_name: string; + + /** + * Production branch of the project. Used to identify production deployments. + */ + production_branch: string; + + /** + * Name of the production script. + */ + production_script_name: string; + + /** + * Whether the project uses functions. + */ + uses_functions: boolean | null; + + /** + * Configs for the project build process. + */ + build_config?: ProjectCreateResponse.BuildConfig; + + /** + * A list of associated custom domains for the project. + */ + domains?: Array; + + /** + * Configs for the project source control. + */ + source?: ProjectCreateResponse.Source; + + /** + * The Cloudflare subdomain associated with the project. + */ + subdomain?: string; +} + +export namespace ProjectCreateResponse { + /** + * Most recent production deployment of the project. + */ + export interface CanonicalDeployment { + /** + * Id of the deployment. + */ + id: string; + + /** + * A list of alias URLs pointing to this deployment. + */ + aliases: Array | null; + + /** + * Configs for the project build process. + */ + build_config: CanonicalDeployment.BuildConfig; + + /** + * When the deployment was created. + */ + created_on: string; + + /** + * Info about what caused the deployment. + */ + deployment_trigger: CanonicalDeployment.DeploymentTrigger; + + /** + * Environment variables used for builds and Pages Functions. + */ + env_vars: { + [key: string]: + | CanonicalDeployment.PagesPlainTextEnvVar + | null + | CanonicalDeployment.PagesSecretTextEnvVar + | null; + } | null; + + /** + * Type of deploy. + */ + environment: 'preview' | 'production'; + + /** + * If the deployment has been skipped. + */ + is_skipped: boolean; + + /** + * The status of the deployment. + */ + latest_stage: ProjectsAPI.Stage; + + /** + * When the deployment was last modified. + */ + modified_on: string; + + /** + * Id of the project. + */ + project_id: string; + + /** + * Name of the project. + */ + project_name: string; + + /** + * Short Id (8 character) of the deployment. + */ + short_id: string; + + /** + * Configs for the project source control. + */ + source: CanonicalDeployment.Source; + + /** + * List of past stages. + */ + stages: Array; + + /** + * The live URL to view this deployment. + */ + url: string; + + /** + * Whether the deployment uses functions. + */ + uses_functions?: boolean | null; + } + + export namespace CanonicalDeployment { + /** + * Configs for the project build process. + */ + export interface BuildConfig { + /** + * The classifying tag for analytics. + */ + web_analytics_tag: string | null; + + /** + * The auth token for analytics. + */ + web_analytics_token: string | null; + + /** + * Enable build caching for the project. + */ + build_caching?: boolean | null; + + /** + * Command used to build project. + */ + build_command?: string | null; + + /** + * Assets output directory of the build. + */ + destination_dir?: string | null; + + /** + * Directory to run the command. + */ + root_dir?: string | null; + } + + /** + * Info about what caused the deployment. + */ + export interface DeploymentTrigger { + /** + * Additional info about the trigger. + */ + metadata: DeploymentTrigger.Metadata; + + /** + * What caused the deployment. + */ + type: 'github:push' | 'ad_hoc' | 'deploy_hook'; + } + + export namespace DeploymentTrigger { + /** + * Additional info about the trigger. + */ + export interface Metadata { + /** + * Where the trigger happened. + */ + branch: string; + + /** + * Whether the deployment trigger commit was dirty. + */ + commit_dirty: boolean; + + /** + * Hash of the deployment trigger commit. + */ + commit_hash: string; + + /** + * Message of the deployment trigger commit. + */ + commit_message: string; + } + } + + /** + * A plaintext environment variable. + */ + export interface PagesPlainTextEnvVar { + type: 'plain_text'; + + /** + * Environment variable value. + */ + value: string; + } + + /** + * An encrypted environment variable. + */ + export interface PagesSecretTextEnvVar { + type: 'secret_text'; + + /** + * Secret value. + */ + value: string; + } + + /** + * Configs for the project source control. + */ + export interface Source { + config: Source.Config; + + /** + * The source control management provider. + */ + type: 'github' | 'gitlab'; + } + + export namespace Source { + export interface Config { + /** + * The owner of the repository. + */ + owner: string; + + /** + * Whether to enable PR comments. + */ + pr_comments_enabled: boolean; + + /** + * The production branch of the repository. + */ + production_branch: string; + + /** + * The name of the repository. + */ + repo_name: string; + + /** + * @deprecated Use `production_deployments_enabled` and + * `preview_deployment_setting` for more granular control. + */ + deployments_enabled?: boolean; + + /** + * The owner ID of the repository. + */ + owner_id?: string; + + /** + * A list of paths that should be excluded from triggering a preview deployment. + * Wildcard syntax (`*`) is supported. + */ + path_excludes?: Array; + + /** + * A list of paths that should be watched to trigger a preview deployment. Wildcard + * syntax (`*`) is supported. + */ + path_includes?: Array; + + /** + * A list of branches that should not trigger a preview deployment. Wildcard syntax + * (`*`) is supported. Must be used with `preview_deployment_setting` set to + * `custom`. + */ + preview_branch_excludes?: Array; + + /** + * A list of branches that should trigger a preview deployment. Wildcard syntax + * (`*`) is supported. Must be used with `preview_deployment_setting` set to + * `custom`. + */ + preview_branch_includes?: Array; + + /** + * Controls whether commits to preview branches trigger a preview deployment. + */ + preview_deployment_setting?: 'all' | 'none' | 'custom'; + + /** + * Whether to trigger a production deployment on commits to the production branch. + */ + production_deployments_enabled?: boolean; + + /** + * The ID of the repository. + */ + repo_id?: string; + } + } + } + + /** + * Configs for deployments in a project. + */ + export interface DeploymentConfigs { + /** + * Configs for preview deploys. + */ + preview: DeploymentConfigs.Preview; + + /** + * Configs for production deploys. + */ + production: DeploymentConfigs.Production; + } + + export namespace DeploymentConfigs { + /** + * Configs for preview deploys. + */ + export interface Preview { + /** + * Whether to always use the latest compatibility date for Pages Functions. + */ + always_use_latest_compatibility_date: boolean; + + /** + * The major version of the build image to use for Pages Functions. + */ + build_image_major_version: number; + + /** + * Compatibility date used for Pages Functions. + */ + compatibility_date: string; + + /** + * Compatibility flags used for Pages Functions. + */ + compatibility_flags: Array; + + /** + * Environment variables used for builds and Pages Functions. + */ + env_vars: { + [key: string]: Preview.PagesPlainTextEnvVar | null | Preview.PagesSecretTextEnvVar | null; + } | null; + + /** + * Whether to fail open when the deployment config cannot be applied. + */ + fail_open: boolean; + + /** + * @deprecated All new projects now use the Standard usage model. + */ + usage_model: 'standard' | 'bundled' | 'unbound'; + + /** + * Constellation bindings used for Pages Functions. + */ + ai_bindings?: { [key: string]: Preview.AIBindings }; + + /** + * Analytics Engine bindings used for Pages Functions. + */ + analytics_engine_datasets?: { [key: string]: Preview.AnalyticsEngineDatasets }; + + /** + * Browser bindings used for Pages Functions. + */ + browsers?: { [key: string]: Preview.Browsers | null }; + + /** + * D1 databases used for Pages Functions. + */ + d1_databases?: { [key: string]: Preview.D1Databases }; + + /** + * Durable Object namespaces used for Pages Functions. + */ + durable_object_namespaces?: { [key: string]: Preview.DurableObjectNamespaces }; + + /** + * Hyperdrive bindings used for Pages Functions. + */ + hyperdrive_bindings?: { [key: string]: Preview.HyperdriveBindings }; + + /** + * KV namespaces used for Pages Functions. + */ + kv_namespaces?: { [key: string]: Preview.KVNamespaces }; + + /** + * Limits for Pages Functions. + */ + limits?: Preview.Limits; + + /** + * mTLS bindings used for Pages Functions. + */ + mtls_certificates?: { [key: string]: Preview.MTLSCertificates }; + + /** + * Placement setting used for Pages Functions. + */ + placement?: Preview.Placement; + + /** + * Queue Producer bindings used for Pages Functions. + */ + queue_producers?: { [key: string]: Preview.QueueProducers }; + + /** + * R2 buckets used for Pages Functions. + */ + r2_buckets?: { [key: string]: Preview.R2Buckets }; + + /** + * Services used for Pages Functions. + */ + services?: { [key: string]: Preview.Services }; + + /** + * Vectorize bindings used for Pages Functions. + */ + vectorize_bindings?: { [key: string]: Preview.VectorizeBindings }; + + /** + * Hash of the Wrangler configuration used for the deployment. + */ + wrangler_config_hash?: string; + } + + export namespace Preview { + /** + * A plaintext environment variable. + */ + export interface PagesPlainTextEnvVar { + type: 'plain_text'; + + /** + * Environment variable value. + */ + value: string; + } + + /** + * An encrypted environment variable. + */ + export interface PagesSecretTextEnvVar { + type: 'secret_text'; + + /** + * Secret value. + */ + value: string; + } + + /** + * AI binding. + */ + export interface AIBindings { + project_id: string; + } + + /** + * Analytics Engine binding. + */ + export interface AnalyticsEngineDatasets { + /** + * Name of the dataset. + */ + dataset: string; + } + + /** + * Browser binding. + */ + export interface Browsers {} + + /** + * D1 binding. + */ + export interface D1Databases { + /** + * UUID of the D1 database. + */ + id: string; + } + + /** + * Durable Object binding. + */ + export interface DurableObjectNamespaces { + /** + * ID of the Durable Object namespace. + */ + namespace_id: string; + } + + /** + * Hyperdrive binding. + */ + export interface HyperdriveBindings { + id: string; + } + + /** + * KV namespace binding. + */ + export interface KVNamespaces { + /** + * ID of the KV namespace. + */ + namespace_id: string; + } + + /** + * Limits for Pages Functions. + */ + export interface Limits { + /** + * CPU time limit in milliseconds. + */ + cpu_ms: number; + } + + /** + * mTLS binding. + */ + export interface MTLSCertificates { + certificate_id: string; + } + + /** + * Placement setting used for Pages Functions. + */ + export interface Placement { + /** + * Placement mode. + */ + mode: string; + } + + /** + * Queue Producer binding. + */ + export interface QueueProducers { + /** + * Name of the Queue. + */ + name: string; + } + + /** + * R2 binding. + */ + export interface R2Buckets { + /** + * Name of the R2 bucket. + */ + name: string; + + /** + * Jurisdiction of the R2 bucket. + */ + jurisdiction?: string | null; + } + + /** + * Service binding. + */ + export interface Services { + /** + * The Service environment. + */ + environment: string; + + /** + * The Service name. + */ + service: string; + + /** + * The entrypoint to bind to. + */ + entrypoint?: string | null; + } + + /** + * Vectorize binding. + */ + export interface VectorizeBindings { + index_name: string; + } + } + + /** + * Configs for production deploys. + */ + export interface Production { + /** + * Whether to always use the latest compatibility date for Pages Functions. + */ + always_use_latest_compatibility_date: boolean; + + /** + * The major version of the build image to use for Pages Functions. + */ + build_image_major_version: number; + + /** + * Compatibility date used for Pages Functions. + */ + compatibility_date: string; + + /** + * Compatibility flags used for Pages Functions. + */ + compatibility_flags: Array; + + /** + * Environment variables used for builds and Pages Functions. + */ + env_vars: { + [key: string]: Production.PagesPlainTextEnvVar | null | Production.PagesSecretTextEnvVar | null; + } | null; + + /** + * Whether to fail open when the deployment config cannot be applied. + */ + fail_open: boolean; + + /** + * @deprecated All new projects now use the Standard usage model. + */ + usage_model: 'standard' | 'bundled' | 'unbound'; + + /** + * Constellation bindings used for Pages Functions. + */ + ai_bindings?: { [key: string]: Production.AIBindings }; + + /** + * Analytics Engine bindings used for Pages Functions. + */ + analytics_engine_datasets?: { [key: string]: Production.AnalyticsEngineDatasets }; + + /** + * Browser bindings used for Pages Functions. + */ + browsers?: { [key: string]: Production.Browsers | null }; + + /** + * D1 databases used for Pages Functions. + */ + d1_databases?: { [key: string]: Production.D1Databases }; + + /** + * Durable Object namespaces used for Pages Functions. + */ + durable_object_namespaces?: { [key: string]: Production.DurableObjectNamespaces }; + + /** + * Hyperdrive bindings used for Pages Functions. + */ + hyperdrive_bindings?: { [key: string]: Production.HyperdriveBindings }; + + /** + * KV namespaces used for Pages Functions. + */ + kv_namespaces?: { [key: string]: Production.KVNamespaces }; + + /** + * Limits for Pages Functions. + */ + limits?: Production.Limits; + + /** + * mTLS bindings used for Pages Functions. + */ + mtls_certificates?: { [key: string]: Production.MTLSCertificates }; + + /** + * Placement setting used for Pages Functions. + */ + placement?: Production.Placement; + + /** + * Queue Producer bindings used for Pages Functions. + */ + queue_producers?: { [key: string]: Production.QueueProducers }; + + /** + * R2 buckets used for Pages Functions. + */ + r2_buckets?: { [key: string]: Production.R2Buckets }; + + /** + * Services used for Pages Functions. + */ + services?: { [key: string]: Production.Services }; + + /** + * Vectorize bindings used for Pages Functions. + */ + vectorize_bindings?: { [key: string]: Production.VectorizeBindings }; + + /** + * Hash of the Wrangler configuration used for the deployment. + */ + wrangler_config_hash?: string; + } + + export namespace Production { + /** + * A plaintext environment variable. + */ + export interface PagesPlainTextEnvVar { + type: 'plain_text'; + + /** + * Environment variable value. + */ + value: string; + } + + /** + * An encrypted environment variable. + */ + export interface PagesSecretTextEnvVar { + type: 'secret_text'; + + /** + * Secret value. + */ + value: string; + } + + /** + * AI binding. + */ + export interface AIBindings { + project_id: string; + } + + /** + * Analytics Engine binding. + */ + export interface AnalyticsEngineDatasets { + /** + * Name of the dataset. + */ + dataset: string; + } + + /** + * Browser binding. + */ + export interface Browsers {} + + /** + * D1 binding. + */ + export interface D1Databases { + /** + * UUID of the D1 database. + */ + id: string; + } + + /** + * Durable Object binding. + */ + export interface DurableObjectNamespaces { + /** + * ID of the Durable Object namespace. + */ + namespace_id: string; + } + + /** + * Hyperdrive binding. + */ + export interface HyperdriveBindings { + id: string; + } + + /** + * KV namespace binding. + */ + export interface KVNamespaces { + /** + * ID of the KV namespace. + */ + namespace_id: string; + } + + /** + * Limits for Pages Functions. + */ + export interface Limits { + /** + * CPU time limit in milliseconds. + */ + cpu_ms: number; + } + + /** + * mTLS binding. + */ + export interface MTLSCertificates { + certificate_id: string; + } + + /** + * Placement setting used for Pages Functions. + */ + export interface Placement { + /** + * Placement mode. + */ + mode: string; + } + + /** + * Queue Producer binding. + */ + export interface QueueProducers { + /** + * Name of the Queue. + */ + name: string; + } + + /** + * R2 binding. + */ + export interface R2Buckets { + /** + * Name of the R2 bucket. + */ + name: string; + + /** + * Jurisdiction of the R2 bucket. + */ + jurisdiction?: string | null; + } + + /** + * Service binding. + */ + export interface Services { + /** + * The Service environment. + */ + environment: string; + + /** + * The Service name. + */ + service: string; + + /** + * The entrypoint to bind to. + */ + entrypoint?: string | null; + } + + /** + * Vectorize binding. + */ + export interface VectorizeBindings { + index_name: string; + } + } + } + + /** + * Most recent deployment of the project. + */ + export interface LatestDeployment { + /** + * Id of the deployment. + */ + id: string; + + /** + * A list of alias URLs pointing to this deployment. + */ + aliases: Array | null; + + /** + * Configs for the project build process. + */ + build_config: LatestDeployment.BuildConfig; + + /** + * When the deployment was created. + */ + created_on: string; + + /** + * Info about what caused the deployment. + */ + deployment_trigger: LatestDeployment.DeploymentTrigger; + + /** + * Environment variables used for builds and Pages Functions. + */ + env_vars: { + [key: string]: + | LatestDeployment.PagesPlainTextEnvVar + | null + | LatestDeployment.PagesSecretTextEnvVar + | null; + } | null; + + /** + * Type of deploy. + */ + environment: 'preview' | 'production'; + + /** + * If the deployment has been skipped. + */ + is_skipped: boolean; + + /** + * The status of the deployment. + */ + latest_stage: ProjectsAPI.Stage; + + /** + * When the deployment was last modified. + */ + modified_on: string; + + /** + * Id of the project. + */ + project_id: string; + + /** + * Name of the project. + */ + project_name: string; + + /** + * Short Id (8 character) of the deployment. + */ + short_id: string; + + /** + * Configs for the project source control. + */ + source: LatestDeployment.Source; + + /** + * List of past stages. + */ + stages: Array; + + /** + * The live URL to view this deployment. + */ + url: string; + + /** + * Whether the deployment uses functions. + */ + uses_functions?: boolean | null; + } + + export namespace LatestDeployment { + /** + * Configs for the project build process. + */ + export interface BuildConfig { + /** + * The classifying tag for analytics. + */ + web_analytics_tag: string | null; + + /** + * The auth token for analytics. + */ + web_analytics_token: string | null; + + /** + * Enable build caching for the project. + */ + build_caching?: boolean | null; + + /** + * Command used to build project. + */ + build_command?: string | null; + + /** + * Assets output directory of the build. + */ + destination_dir?: string | null; + + /** + * Directory to run the command. + */ + root_dir?: string | null; + } + + /** + * Info about what caused the deployment. + */ + export interface DeploymentTrigger { + /** + * Additional info about the trigger. + */ + metadata: DeploymentTrigger.Metadata; + + /** + * What caused the deployment. + */ + type: 'github:push' | 'ad_hoc' | 'deploy_hook'; + } + + export namespace DeploymentTrigger { + /** + * Additional info about the trigger. + */ + export interface Metadata { + /** + * Where the trigger happened. + */ + branch: string; + + /** + * Whether the deployment trigger commit was dirty. + */ + commit_dirty: boolean; + + /** + * Hash of the deployment trigger commit. + */ + commit_hash: string; + + /** + * Message of the deployment trigger commit. + */ + commit_message: string; + } + } + + /** + * A plaintext environment variable. + */ + export interface PagesPlainTextEnvVar { + type: 'plain_text'; + + /** + * Environment variable value. + */ + value: string; + } + + /** + * An encrypted environment variable. + */ + export interface PagesSecretTextEnvVar { + type: 'secret_text'; + + /** + * Secret value. + */ + value: string; + } + + /** + * Configs for the project source control. + */ + export interface Source { + config: Source.Config; + + /** + * The source control management provider. + */ + type: 'github' | 'gitlab'; + } + + export namespace Source { + export interface Config { + /** + * The owner of the repository. + */ + owner: string; + + /** + * Whether to enable PR comments. + */ + pr_comments_enabled: boolean; + + /** + * The production branch of the repository. + */ + production_branch: string; + + /** + * The name of the repository. + */ + repo_name: string; + + /** + * @deprecated Use `production_deployments_enabled` and + * `preview_deployment_setting` for more granular control. + */ + deployments_enabled?: boolean; + + /** + * The owner ID of the repository. + */ + owner_id?: string; + + /** + * A list of paths that should be excluded from triggering a preview deployment. + * Wildcard syntax (`*`) is supported. + */ + path_excludes?: Array; + + /** + * A list of paths that should be watched to trigger a preview deployment. Wildcard + * syntax (`*`) is supported. + */ + path_includes?: Array; + + /** + * A list of branches that should not trigger a preview deployment. Wildcard syntax + * (`*`) is supported. Must be used with `preview_deployment_setting` set to + * `custom`. + */ + preview_branch_excludes?: Array; + + /** + * A list of branches that should trigger a preview deployment. Wildcard syntax + * (`*`) is supported. Must be used with `preview_deployment_setting` set to + * `custom`. + */ + preview_branch_includes?: Array; + + /** + * Controls whether commits to preview branches trigger a preview deployment. + */ + preview_deployment_setting?: 'all' | 'none' | 'custom'; + + /** + * Whether to trigger a production deployment on commits to the production branch. + */ + production_deployments_enabled?: boolean; + + /** + * The ID of the repository. + */ + repo_id?: string; + } + } + } + + /** + * Configs for the project build process. + */ + export interface BuildConfig { + /** + * The classifying tag for analytics. + */ + web_analytics_tag: string | null; + + /** + * The auth token for analytics. + */ + web_analytics_token: string | null; + + /** + * Enable build caching for the project. + */ + build_caching?: boolean | null; + + /** + * Command used to build project. + */ + build_command?: string | null; + + /** + * Assets output directory of the build. + */ + destination_dir?: string | null; + + /** + * Directory to run the command. + */ + root_dir?: string | null; + } + + /** + * Configs for the project source control. + */ + export interface Source { + config: Source.Config; + + /** + * The source control management provider. + */ + type: 'github' | 'gitlab'; + } + + export namespace Source { + export interface Config { + /** + * The owner of the repository. + */ + owner: string; + + /** + * Whether to enable PR comments. + */ + pr_comments_enabled: boolean; + + /** + * The production branch of the repository. + */ + production_branch: string; + + /** + * The name of the repository. + */ + repo_name: string; + + /** + * @deprecated Use `production_deployments_enabled` and + * `preview_deployment_setting` for more granular control. + */ + deployments_enabled?: boolean; + + /** + * The owner ID of the repository. + */ + owner_id?: string; + + /** + * A list of paths that should be excluded from triggering a preview deployment. + * Wildcard syntax (`*`) is supported. + */ + path_excludes?: Array; + + /** + * A list of paths that should be watched to trigger a preview deployment. Wildcard + * syntax (`*`) is supported. + */ + path_includes?: Array; + + /** + * A list of branches that should not trigger a preview deployment. Wildcard syntax + * (`*`) is supported. Must be used with `preview_deployment_setting` set to + * `custom`. + */ + preview_branch_excludes?: Array; + + /** + * A list of branches that should trigger a preview deployment. Wildcard syntax + * (`*`) is supported. Must be used with `preview_deployment_setting` set to + * `custom`. + */ + preview_branch_includes?: Array; + + /** + * Controls whether commits to preview branches trigger a preview deployment. + */ + preview_deployment_setting?: 'all' | 'none' | 'custom'; + + /** + * Whether to trigger a production deployment on commits to the production branch. + */ + production_deployments_enabled?: boolean; + + /** + * The ID of the repository. + */ + repo_id?: string; + } + } +} + +export interface ProjectListResponse { + /** + * ID of the project. + */ + id: string; + + /** + * Most recent production deployment of the project. + */ + canonical_deployment: ProjectListResponse.CanonicalDeployment | null; + + /** + * When the project was created. + */ + created_on: string; + + /** + * Configs for deployments in a project. + */ + deployment_configs: ProjectListResponse.DeploymentConfigs; + + /** + * Framework the project is using. + */ + framework: string; + + /** + * Version of the framework the project is using. + */ + framework_version: string; + + /** + * Most recent deployment of the project. + */ + latest_deployment: ProjectListResponse.LatestDeployment | null; + + /** + * Name of the project. + */ + name: string; + + /** + * Name of the preview script. + */ + preview_script_name: string; + + /** + * Production branch of the project. Used to identify production deployments. + */ + production_branch: string; + + /** + * Name of the production script. + */ + production_script_name: string; + + /** + * Whether the project uses functions. + */ + uses_functions: boolean | null; + + /** + * Configs for the project build process. + */ + build_config?: ProjectListResponse.BuildConfig; + + /** + * A list of associated custom domains for the project. + */ + domains?: Array; + + /** + * Configs for the project source control. + */ + source?: ProjectListResponse.Source; + + /** + * The Cloudflare subdomain associated with the project. + */ + subdomain?: string; +} + +export namespace ProjectListResponse { + /** + * Most recent production deployment of the project. + */ + export interface CanonicalDeployment { + /** + * Id of the deployment. + */ + id: string; + + /** + * A list of alias URLs pointing to this deployment. + */ + aliases: Array | null; + + /** + * Configs for the project build process. + */ + build_config: CanonicalDeployment.BuildConfig; + + /** + * When the deployment was created. + */ + created_on: string; + + /** + * Info about what caused the deployment. + */ + deployment_trigger: CanonicalDeployment.DeploymentTrigger; + + /** + * Environment variables used for builds and Pages Functions. + */ + env_vars: { + [key: string]: + | CanonicalDeployment.PagesPlainTextEnvVar + | null + | CanonicalDeployment.PagesSecretTextEnvVar + | null; + } | null; + + /** + * Type of deploy. + */ + environment: 'preview' | 'production'; + + /** + * If the deployment has been skipped. + */ + is_skipped: boolean; + + /** + * The status of the deployment. + */ + latest_stage: ProjectsAPI.Stage; + + /** + * When the deployment was last modified. + */ + modified_on: string; + + /** + * Id of the project. + */ + project_id: string; + + /** + * Name of the project. + */ + project_name: string; + + /** + * Short Id (8 character) of the deployment. + */ + short_id: string; + + /** + * Configs for the project source control. + */ + source: CanonicalDeployment.Source; + + /** + * List of past stages. + */ + stages: Array; + + /** + * The live URL to view this deployment. + */ + url: string; + + /** + * Whether the deployment uses functions. + */ + uses_functions?: boolean | null; + } + + export namespace CanonicalDeployment { + /** + * Configs for the project build process. + */ + export interface BuildConfig { + /** + * The classifying tag for analytics. + */ + web_analytics_tag: string | null; + + /** + * The auth token for analytics. + */ + web_analytics_token: string | null; + + /** + * Enable build caching for the project. + */ + build_caching?: boolean | null; + + /** + * Command used to build project. + */ + build_command?: string | null; + + /** + * Assets output directory of the build. + */ + destination_dir?: string | null; + + /** + * Directory to run the command. + */ + root_dir?: string | null; + } + + /** + * Info about what caused the deployment. + */ + export interface DeploymentTrigger { + /** + * Additional info about the trigger. + */ + metadata: DeploymentTrigger.Metadata; + + /** + * What caused the deployment. + */ + type: 'github:push' | 'ad_hoc' | 'deploy_hook'; + } + + export namespace DeploymentTrigger { + /** + * Additional info about the trigger. + */ + export interface Metadata { + /** + * Where the trigger happened. + */ + branch: string; + + /** + * Whether the deployment trigger commit was dirty. + */ + commit_dirty: boolean; + + /** + * Hash of the deployment trigger commit. + */ + commit_hash: string; + + /** + * Message of the deployment trigger commit. + */ + commit_message: string; + } + } + + /** + * A plaintext environment variable. + */ + export interface PagesPlainTextEnvVar { + type: 'plain_text'; + + /** + * Environment variable value. + */ + value: string; + } + + /** + * An encrypted environment variable. + */ + export interface PagesSecretTextEnvVar { + type: 'secret_text'; + + /** + * Secret value. + */ + value: string; + } + + /** + * Configs for the project source control. + */ + export interface Source { + config: Source.Config; + + /** + * The source control management provider. + */ + type: 'github' | 'gitlab'; + } + + export namespace Source { + export interface Config { + /** + * The owner of the repository. + */ + owner: string; + + /** + * Whether to enable PR comments. + */ + pr_comments_enabled: boolean; + + /** + * The production branch of the repository. + */ + production_branch: string; + + /** + * The name of the repository. + */ + repo_name: string; + + /** + * @deprecated Use `production_deployments_enabled` and + * `preview_deployment_setting` for more granular control. + */ + deployments_enabled?: boolean; + + /** + * The owner ID of the repository. + */ + owner_id?: string; + + /** + * A list of paths that should be excluded from triggering a preview deployment. + * Wildcard syntax (`*`) is supported. + */ + path_excludes?: Array; + + /** + * A list of paths that should be watched to trigger a preview deployment. Wildcard + * syntax (`*`) is supported. + */ + path_includes?: Array; + + /** + * A list of branches that should not trigger a preview deployment. Wildcard syntax + * (`*`) is supported. Must be used with `preview_deployment_setting` set to + * `custom`. + */ + preview_branch_excludes?: Array; + + /** + * A list of branches that should trigger a preview deployment. Wildcard syntax + * (`*`) is supported. Must be used with `preview_deployment_setting` set to + * `custom`. + */ + preview_branch_includes?: Array; + + /** + * Controls whether commits to preview branches trigger a preview deployment. + */ + preview_deployment_setting?: 'all' | 'none' | 'custom'; + + /** + * Whether to trigger a production deployment on commits to the production branch. + */ + production_deployments_enabled?: boolean; + + /** + * The ID of the repository. + */ + repo_id?: string; + } + } + } + + /** + * Configs for deployments in a project. + */ + export interface DeploymentConfigs { + /** + * Configs for preview deploys. + */ + preview: DeploymentConfigs.Preview; + + /** + * Configs for production deploys. + */ + production: DeploymentConfigs.Production; + } + + export namespace DeploymentConfigs { + /** + * Configs for preview deploys. + */ + export interface Preview { + /** + * Whether to always use the latest compatibility date for Pages Functions. + */ + always_use_latest_compatibility_date: boolean; + + /** + * The major version of the build image to use for Pages Functions. + */ + build_image_major_version: number; + + /** + * Compatibility date used for Pages Functions. + */ + compatibility_date: string; + + /** + * Compatibility flags used for Pages Functions. + */ + compatibility_flags: Array; + + /** + * Environment variables used for builds and Pages Functions. + */ + env_vars: { + [key: string]: Preview.PagesPlainTextEnvVar | null | Preview.PagesSecretTextEnvVar | null; + } | null; + + /** + * Whether to fail open when the deployment config cannot be applied. + */ + fail_open: boolean; + + /** + * @deprecated All new projects now use the Standard usage model. + */ + usage_model: 'standard' | 'bundled' | 'unbound'; + + /** + * Constellation bindings used for Pages Functions. + */ + ai_bindings?: { [key: string]: Preview.AIBindings }; + + /** + * Analytics Engine bindings used for Pages Functions. + */ + analytics_engine_datasets?: { [key: string]: Preview.AnalyticsEngineDatasets }; + + /** + * Browser bindings used for Pages Functions. + */ + browsers?: { [key: string]: Preview.Browsers | null }; + + /** + * D1 databases used for Pages Functions. + */ + d1_databases?: { [key: string]: Preview.D1Databases }; + + /** + * Durable Object namespaces used for Pages Functions. + */ + durable_object_namespaces?: { [key: string]: Preview.DurableObjectNamespaces }; + + /** + * Hyperdrive bindings used for Pages Functions. + */ + hyperdrive_bindings?: { [key: string]: Preview.HyperdriveBindings }; + + /** + * KV namespaces used for Pages Functions. + */ + kv_namespaces?: { [key: string]: Preview.KVNamespaces }; + + /** + * Limits for Pages Functions. + */ + limits?: Preview.Limits; + + /** + * mTLS bindings used for Pages Functions. + */ + mtls_certificates?: { [key: string]: Preview.MTLSCertificates }; + + /** + * Placement setting used for Pages Functions. + */ + placement?: Preview.Placement; + + /** + * Queue Producer bindings used for Pages Functions. + */ + queue_producers?: { [key: string]: Preview.QueueProducers }; + + /** + * R2 buckets used for Pages Functions. + */ + r2_buckets?: { [key: string]: Preview.R2Buckets }; + + /** + * Services used for Pages Functions. + */ + services?: { [key: string]: Preview.Services }; + + /** + * Vectorize bindings used for Pages Functions. + */ + vectorize_bindings?: { [key: string]: Preview.VectorizeBindings }; + + /** + * Hash of the Wrangler configuration used for the deployment. + */ + wrangler_config_hash?: string; + } + + export namespace Preview { + /** + * A plaintext environment variable. + */ + export interface PagesPlainTextEnvVar { + type: 'plain_text'; + + /** + * Environment variable value. + */ + value: string; + } + + /** + * An encrypted environment variable. + */ + export interface PagesSecretTextEnvVar { + type: 'secret_text'; + + /** + * Secret value. + */ + value: string; + } + + /** + * AI binding. + */ + export interface AIBindings { + project_id: string; + } + + /** + * Analytics Engine binding. + */ + export interface AnalyticsEngineDatasets { + /** + * Name of the dataset. + */ + dataset: string; + } + + /** + * Browser binding. + */ + export interface Browsers {} + + /** + * D1 binding. + */ + export interface D1Databases { + /** + * UUID of the D1 database. + */ + id: string; + } + + /** + * Durable Object binding. + */ + export interface DurableObjectNamespaces { + /** + * ID of the Durable Object namespace. + */ + namespace_id: string; + } + + /** + * Hyperdrive binding. + */ + export interface HyperdriveBindings { + id: string; + } + + /** + * KV namespace binding. + */ + export interface KVNamespaces { + /** + * ID of the KV namespace. + */ + namespace_id: string; + } + + /** + * Limits for Pages Functions. + */ + export interface Limits { + /** + * CPU time limit in milliseconds. + */ + cpu_ms: number; + } + + /** + * mTLS binding. + */ + export interface MTLSCertificates { + certificate_id: string; + } + + /** + * Placement setting used for Pages Functions. + */ + export interface Placement { + /** + * Placement mode. + */ + mode: string; + } + + /** + * Queue Producer binding. + */ + export interface QueueProducers { + /** + * Name of the Queue. + */ + name: string; + } + + /** + * R2 binding. + */ + export interface R2Buckets { + /** + * Name of the R2 bucket. + */ + name: string; + + /** + * Jurisdiction of the R2 bucket. + */ + jurisdiction?: string | null; + } + + /** + * Service binding. + */ + export interface Services { + /** + * The Service environment. + */ + environment: string; + + /** + * The Service name. + */ + service: string; + + /** + * The entrypoint to bind to. + */ + entrypoint?: string | null; + } + + /** + * Vectorize binding. + */ + export interface VectorizeBindings { + index_name: string; + } + } + + /** + * Configs for production deploys. + */ + export interface Production { + /** + * Whether to always use the latest compatibility date for Pages Functions. + */ + always_use_latest_compatibility_date: boolean; + + /** + * The major version of the build image to use for Pages Functions. + */ + build_image_major_version: number; + + /** + * Compatibility date used for Pages Functions. + */ + compatibility_date: string; + + /** + * Compatibility flags used for Pages Functions. + */ + compatibility_flags: Array; + + /** + * Environment variables used for builds and Pages Functions. + */ + env_vars: { + [key: string]: Production.PagesPlainTextEnvVar | null | Production.PagesSecretTextEnvVar | null; + } | null; + + /** + * Whether to fail open when the deployment config cannot be applied. + */ + fail_open: boolean; + + /** + * @deprecated All new projects now use the Standard usage model. + */ + usage_model: 'standard' | 'bundled' | 'unbound'; + + /** + * Constellation bindings used for Pages Functions. + */ + ai_bindings?: { [key: string]: Production.AIBindings }; + + /** + * Analytics Engine bindings used for Pages Functions. + */ + analytics_engine_datasets?: { [key: string]: Production.AnalyticsEngineDatasets }; + + /** + * Browser bindings used for Pages Functions. + */ + browsers?: { [key: string]: Production.Browsers | null }; + + /** + * D1 databases used for Pages Functions. + */ + d1_databases?: { [key: string]: Production.D1Databases }; + + /** + * Durable Object namespaces used for Pages Functions. + */ + durable_object_namespaces?: { [key: string]: Production.DurableObjectNamespaces }; + + /** + * Hyperdrive bindings used for Pages Functions. + */ + hyperdrive_bindings?: { [key: string]: Production.HyperdriveBindings }; + + /** + * KV namespaces used for Pages Functions. + */ + kv_namespaces?: { [key: string]: Production.KVNamespaces }; + + /** + * Limits for Pages Functions. + */ + limits?: Production.Limits; + + /** + * mTLS bindings used for Pages Functions. + */ + mtls_certificates?: { [key: string]: Production.MTLSCertificates }; + + /** + * Placement setting used for Pages Functions. + */ + placement?: Production.Placement; + + /** + * Queue Producer bindings used for Pages Functions. + */ + queue_producers?: { [key: string]: Production.QueueProducers }; + + /** + * R2 buckets used for Pages Functions. + */ + r2_buckets?: { [key: string]: Production.R2Buckets }; + + /** + * Services used for Pages Functions. + */ + services?: { [key: string]: Production.Services }; + + /** + * Vectorize bindings used for Pages Functions. + */ + vectorize_bindings?: { [key: string]: Production.VectorizeBindings }; + + /** + * Hash of the Wrangler configuration used for the deployment. + */ + wrangler_config_hash?: string; + } + + export namespace Production { + /** + * A plaintext environment variable. + */ + export interface PagesPlainTextEnvVar { + type: 'plain_text'; + + /** + * Environment variable value. + */ + value: string; + } + + /** + * An encrypted environment variable. + */ + export interface PagesSecretTextEnvVar { + type: 'secret_text'; + + /** + * Secret value. + */ + value: string; + } + + /** + * AI binding. + */ + export interface AIBindings { + project_id: string; + } + + /** + * Analytics Engine binding. + */ + export interface AnalyticsEngineDatasets { + /** + * Name of the dataset. + */ + dataset: string; + } + + /** + * Browser binding. + */ + export interface Browsers {} + + /** + * D1 binding. + */ + export interface D1Databases { + /** + * UUID of the D1 database. + */ + id: string; + } + + /** + * Durable Object binding. + */ + export interface DurableObjectNamespaces { + /** + * ID of the Durable Object namespace. + */ + namespace_id: string; + } + + /** + * Hyperdrive binding. + */ + export interface HyperdriveBindings { + id: string; + } + + /** + * KV namespace binding. + */ + export interface KVNamespaces { + /** + * ID of the KV namespace. + */ + namespace_id: string; + } + + /** + * Limits for Pages Functions. + */ + export interface Limits { + /** + * CPU time limit in milliseconds. + */ + cpu_ms: number; + } + + /** + * mTLS binding. + */ + export interface MTLSCertificates { + certificate_id: string; + } + + /** + * Placement setting used for Pages Functions. + */ + export interface Placement { + /** + * Placement mode. + */ + mode: string; + } + + /** + * Queue Producer binding. + */ + export interface QueueProducers { + /** + * Name of the Queue. + */ + name: string; + } + + /** + * R2 binding. + */ + export interface R2Buckets { + /** + * Name of the R2 bucket. + */ + name: string; + + /** + * Jurisdiction of the R2 bucket. + */ + jurisdiction?: string | null; + } + + /** + * Service binding. + */ + export interface Services { + /** + * The Service environment. + */ + environment: string; + + /** + * The Service name. + */ + service: string; + + /** + * The entrypoint to bind to. + */ + entrypoint?: string | null; + } + + /** + * Vectorize binding. + */ + export interface VectorizeBindings { + index_name: string; + } + } + } + + /** + * Most recent deployment of the project. + */ + export interface LatestDeployment { + /** + * Id of the deployment. + */ + id: string; + + /** + * A list of alias URLs pointing to this deployment. + */ + aliases: Array | null; + + /** + * Configs for the project build process. + */ + build_config: LatestDeployment.BuildConfig; + + /** + * When the deployment was created. + */ + created_on: string; + + /** + * Info about what caused the deployment. + */ + deployment_trigger: LatestDeployment.DeploymentTrigger; + + /** + * Environment variables used for builds and Pages Functions. + */ + env_vars: { + [key: string]: + | LatestDeployment.PagesPlainTextEnvVar + | null + | LatestDeployment.PagesSecretTextEnvVar + | null; + } | null; + + /** + * Type of deploy. + */ + environment: 'preview' | 'production'; + + /** + * If the deployment has been skipped. + */ + is_skipped: boolean; + + /** + * The status of the deployment. + */ + latest_stage: ProjectsAPI.Stage; + + /** + * When the deployment was last modified. + */ + modified_on: string; + + /** + * Id of the project. + */ + project_id: string; + + /** + * Name of the project. + */ + project_name: string; + + /** + * Short Id (8 character) of the deployment. + */ + short_id: string; + + /** + * Configs for the project source control. + */ + source: LatestDeployment.Source; + + /** + * List of past stages. + */ + stages: Array; + + /** + * The live URL to view this deployment. + */ + url: string; + + /** + * Whether the deployment uses functions. + */ + uses_functions?: boolean | null; + } + + export namespace LatestDeployment { + /** + * Configs for the project build process. + */ + export interface BuildConfig { + /** + * The classifying tag for analytics. + */ + web_analytics_tag: string | null; + + /** + * The auth token for analytics. + */ + web_analytics_token: string | null; + + /** + * Enable build caching for the project. + */ + build_caching?: boolean | null; + + /** + * Command used to build project. + */ + build_command?: string | null; + + /** + * Assets output directory of the build. + */ + destination_dir?: string | null; + + /** + * Directory to run the command. + */ + root_dir?: string | null; + } + + /** + * Info about what caused the deployment. + */ + export interface DeploymentTrigger { + /** + * Additional info about the trigger. + */ + metadata: DeploymentTrigger.Metadata; + + /** + * What caused the deployment. + */ + type: 'github:push' | 'ad_hoc' | 'deploy_hook'; + } + + export namespace DeploymentTrigger { + /** + * Additional info about the trigger. + */ + export interface Metadata { + /** + * Where the trigger happened. + */ + branch: string; + + /** + * Whether the deployment trigger commit was dirty. + */ + commit_dirty: boolean; + + /** + * Hash of the deployment trigger commit. + */ + commit_hash: string; + + /** + * Message of the deployment trigger commit. + */ + commit_message: string; + } + } + + /** + * A plaintext environment variable. + */ + export interface PagesPlainTextEnvVar { + type: 'plain_text'; + + /** + * Environment variable value. + */ + value: string; + } + + /** + * An encrypted environment variable. + */ + export interface PagesSecretTextEnvVar { + type: 'secret_text'; + + /** + * Secret value. + */ + value: string; + } + + /** + * Configs for the project source control. + */ + export interface Source { + config: Source.Config; + + /** + * The source control management provider. + */ + type: 'github' | 'gitlab'; + } + + export namespace Source { + export interface Config { + /** + * The owner of the repository. + */ + owner: string; + + /** + * Whether to enable PR comments. + */ + pr_comments_enabled: boolean; + + /** + * The production branch of the repository. + */ + production_branch: string; + + /** + * The name of the repository. + */ + repo_name: string; + + /** + * @deprecated Use `production_deployments_enabled` and + * `preview_deployment_setting` for more granular control. + */ + deployments_enabled?: boolean; + + /** + * The owner ID of the repository. + */ + owner_id?: string; + + /** + * A list of paths that should be excluded from triggering a preview deployment. + * Wildcard syntax (`*`) is supported. + */ + path_excludes?: Array; + + /** + * A list of paths that should be watched to trigger a preview deployment. Wildcard + * syntax (`*`) is supported. + */ + path_includes?: Array; + + /** + * A list of branches that should not trigger a preview deployment. Wildcard syntax + * (`*`) is supported. Must be used with `preview_deployment_setting` set to + * `custom`. + */ + preview_branch_excludes?: Array; + + /** + * A list of branches that should trigger a preview deployment. Wildcard syntax + * (`*`) is supported. Must be used with `preview_deployment_setting` set to + * `custom`. + */ + preview_branch_includes?: Array; + + /** + * Controls whether commits to preview branches trigger a preview deployment. + */ + preview_deployment_setting?: 'all' | 'none' | 'custom'; + + /** + * Whether to trigger a production deployment on commits to the production branch. + */ + production_deployments_enabled?: boolean; + + /** + * The ID of the repository. + */ + repo_id?: string; + } + } + } + + /** + * Configs for the project build process. + */ + export interface BuildConfig { + /** + * The classifying tag for analytics. + */ + web_analytics_tag: string | null; + + /** + * The auth token for analytics. + */ + web_analytics_token: string | null; + + /** + * Enable build caching for the project. + */ + build_caching?: boolean | null; + + /** + * Command used to build project. + */ + build_command?: string | null; + + /** + * Assets output directory of the build. + */ + destination_dir?: string | null; + + /** + * Directory to run the command. + */ + root_dir?: string | null; + } + + /** + * Configs for the project source control. + */ + export interface Source { + config: Source.Config; + + /** + * The source control management provider. + */ + type: 'github' | 'gitlab'; + } + + export namespace Source { + export interface Config { + /** + * The owner of the repository. + */ + owner: string; + + /** + * Whether to enable PR comments. + */ + pr_comments_enabled: boolean; + + /** + * The production branch of the repository. + */ + production_branch: string; + + /** + * The name of the repository. + */ + repo_name: string; + + /** + * @deprecated Use `production_deployments_enabled` and + * `preview_deployment_setting` for more granular control. + */ + deployments_enabled?: boolean; + + /** + * The owner ID of the repository. + */ + owner_id?: string; + + /** + * A list of paths that should be excluded from triggering a preview deployment. + * Wildcard syntax (`*`) is supported. + */ + path_excludes?: Array; + + /** + * A list of paths that should be watched to trigger a preview deployment. Wildcard + * syntax (`*`) is supported. + */ + path_includes?: Array; + + /** + * A list of branches that should not trigger a preview deployment. Wildcard syntax + * (`*`) is supported. Must be used with `preview_deployment_setting` set to + * `custom`. + */ + preview_branch_excludes?: Array; + + /** + * A list of branches that should trigger a preview deployment. Wildcard syntax + * (`*`) is supported. Must be used with `preview_deployment_setting` set to + * `custom`. + */ + preview_branch_includes?: Array; + + /** + * Controls whether commits to preview branches trigger a preview deployment. + */ + preview_deployment_setting?: 'all' | 'none' | 'custom'; + + /** + * Whether to trigger a production deployment on commits to the production branch. + */ + production_deployments_enabled?: boolean; + + /** + * The ID of the repository. + */ + repo_id?: string; + } + } +} + +export type ProjectDeleteResponse = unknown; + +export interface ProjectEditResponse { + /** + * ID of the project. + */ + id: string; + + /** + * Most recent production deployment of the project. + */ + canonical_deployment: ProjectEditResponse.CanonicalDeployment | null; + + /** + * When the project was created. + */ + created_on: string; + + /** + * Configs for deployments in a project. + */ + deployment_configs: ProjectEditResponse.DeploymentConfigs; + + /** + * Framework the project is using. + */ + framework: string; + + /** + * Version of the framework the project is using. + */ + framework_version: string; + + /** + * Most recent deployment of the project. + */ + latest_deployment: ProjectEditResponse.LatestDeployment | null; + + /** + * Name of the project. + */ + name: string; + + /** + * Name of the preview script. + */ + preview_script_name: string; + + /** + * Production branch of the project. Used to identify production deployments. + */ + production_branch: string; + + /** + * Name of the production script. + */ + production_script_name: string; + + /** + * Whether the project uses functions. + */ + uses_functions: boolean | null; + + /** + * Configs for the project build process. + */ + build_config?: ProjectEditResponse.BuildConfig; + + /** + * A list of associated custom domains for the project. + */ + domains?: Array; + + /** + * Configs for the project source control. + */ + source?: ProjectEditResponse.Source; + + /** + * The Cloudflare subdomain associated with the project. + */ + subdomain?: string; +} + +export namespace ProjectEditResponse { + /** + * Most recent production deployment of the project. + */ + export interface CanonicalDeployment { + /** + * Id of the deployment. + */ + id: string; + + /** + * A list of alias URLs pointing to this deployment. + */ + aliases: Array | null; + + /** + * Configs for the project build process. + */ + build_config: CanonicalDeployment.BuildConfig; + + /** + * When the deployment was created. + */ + created_on: string; + + /** + * Info about what caused the deployment. + */ + deployment_trigger: CanonicalDeployment.DeploymentTrigger; + + /** + * Environment variables used for builds and Pages Functions. + */ + env_vars: { + [key: string]: + | CanonicalDeployment.PagesPlainTextEnvVar + | null + | CanonicalDeployment.PagesSecretTextEnvVar + | null; + } | null; + + /** + * Type of deploy. + */ + environment: 'preview' | 'production'; + + /** + * If the deployment has been skipped. + */ + is_skipped: boolean; + + /** + * The status of the deployment. + */ + latest_stage: ProjectsAPI.Stage; + + /** + * When the deployment was last modified. + */ + modified_on: string; + + /** + * Id of the project. + */ + project_id: string; + + /** + * Name of the project. + */ + project_name: string; + + /** + * Short Id (8 character) of the deployment. + */ + short_id: string; + + /** + * Configs for the project source control. + */ + source: CanonicalDeployment.Source; + + /** + * List of past stages. + */ + stages: Array; + + /** + * The live URL to view this deployment. + */ + url: string; + + /** + * Whether the deployment uses functions. + */ + uses_functions?: boolean | null; + } + + export namespace CanonicalDeployment { + /** + * Configs for the project build process. + */ + export interface BuildConfig { + /** + * The classifying tag for analytics. + */ + web_analytics_tag: string | null; + + /** + * The auth token for analytics. + */ + web_analytics_token: string | null; + + /** + * Enable build caching for the project. + */ + build_caching?: boolean | null; + + /** + * Command used to build project. + */ + build_command?: string | null; + + /** + * Assets output directory of the build. + */ + destination_dir?: string | null; + + /** + * Directory to run the command. + */ + root_dir?: string | null; + } + + /** + * Info about what caused the deployment. + */ + export interface DeploymentTrigger { + /** + * Additional info about the trigger. + */ + metadata: DeploymentTrigger.Metadata; + + /** + * What caused the deployment. + */ + type: 'github:push' | 'ad_hoc' | 'deploy_hook'; + } + + export namespace DeploymentTrigger { + /** + * Additional info about the trigger. + */ + export interface Metadata { + /** + * Where the trigger happened. + */ + branch: string; + + /** + * Whether the deployment trigger commit was dirty. + */ + commit_dirty: boolean; + + /** + * Hash of the deployment trigger commit. + */ + commit_hash: string; + + /** + * Message of the deployment trigger commit. + */ + commit_message: string; + } + } + + /** + * A plaintext environment variable. + */ + export interface PagesPlainTextEnvVar { + type: 'plain_text'; + + /** + * Environment variable value. + */ + value: string; + } + + /** + * An encrypted environment variable. + */ + export interface PagesSecretTextEnvVar { + type: 'secret_text'; + + /** + * Secret value. + */ + value: string; + } + + /** + * Configs for the project source control. + */ + export interface Source { + config: Source.Config; + + /** + * The source control management provider. + */ + type: 'github' | 'gitlab'; + } + + export namespace Source { + export interface Config { + /** + * The owner of the repository. + */ + owner: string; + + /** + * Whether to enable PR comments. + */ + pr_comments_enabled: boolean; + + /** + * The production branch of the repository. + */ + production_branch: string; + + /** + * The name of the repository. + */ + repo_name: string; + + /** + * @deprecated Use `production_deployments_enabled` and + * `preview_deployment_setting` for more granular control. + */ + deployments_enabled?: boolean; + + /** + * The owner ID of the repository. + */ + owner_id?: string; + + /** + * A list of paths that should be excluded from triggering a preview deployment. + * Wildcard syntax (`*`) is supported. + */ + path_excludes?: Array; + + /** + * A list of paths that should be watched to trigger a preview deployment. Wildcard + * syntax (`*`) is supported. + */ + path_includes?: Array; + + /** + * A list of branches that should not trigger a preview deployment. Wildcard syntax + * (`*`) is supported. Must be used with `preview_deployment_setting` set to + * `custom`. + */ + preview_branch_excludes?: Array; + + /** + * A list of branches that should trigger a preview deployment. Wildcard syntax + * (`*`) is supported. Must be used with `preview_deployment_setting` set to + * `custom`. + */ + preview_branch_includes?: Array; + + /** + * Controls whether commits to preview branches trigger a preview deployment. + */ + preview_deployment_setting?: 'all' | 'none' | 'custom'; + + /** + * Whether to trigger a production deployment on commits to the production branch. + */ + production_deployments_enabled?: boolean; + + /** + * The ID of the repository. + */ + repo_id?: string; + } + } + } + + /** + * Configs for deployments in a project. + */ + export interface DeploymentConfigs { + /** + * Configs for preview deploys. + */ + preview: DeploymentConfigs.Preview; + + /** + * Configs for production deploys. + */ + production: DeploymentConfigs.Production; + } + + export namespace DeploymentConfigs { + /** + * Configs for preview deploys. + */ + export interface Preview { + /** + * Whether to always use the latest compatibility date for Pages Functions. + */ + always_use_latest_compatibility_date: boolean; + + /** + * The major version of the build image to use for Pages Functions. + */ + build_image_major_version: number; + + /** + * Compatibility date used for Pages Functions. + */ + compatibility_date: string; + + /** + * Compatibility flags used for Pages Functions. + */ + compatibility_flags: Array; + + /** + * Environment variables used for builds and Pages Functions. + */ + env_vars: { + [key: string]: Preview.PagesPlainTextEnvVar | null | Preview.PagesSecretTextEnvVar | null; + } | null; + + /** + * Whether to fail open when the deployment config cannot be applied. + */ + fail_open: boolean; + + /** + * @deprecated All new projects now use the Standard usage model. + */ + usage_model: 'standard' | 'bundled' | 'unbound'; + + /** + * Constellation bindings used for Pages Functions. + */ + ai_bindings?: { [key: string]: Preview.AIBindings }; + + /** + * Analytics Engine bindings used for Pages Functions. + */ + analytics_engine_datasets?: { [key: string]: Preview.AnalyticsEngineDatasets }; + + /** + * Browser bindings used for Pages Functions. + */ + browsers?: { [key: string]: Preview.Browsers | null }; + + /** + * D1 databases used for Pages Functions. + */ + d1_databases?: { [key: string]: Preview.D1Databases }; + + /** + * Durable Object namespaces used for Pages Functions. + */ + durable_object_namespaces?: { [key: string]: Preview.DurableObjectNamespaces }; + + /** + * Hyperdrive bindings used for Pages Functions. + */ + hyperdrive_bindings?: { [key: string]: Preview.HyperdriveBindings }; + + /** + * KV namespaces used for Pages Functions. + */ + kv_namespaces?: { [key: string]: Preview.KVNamespaces }; + + /** + * Limits for Pages Functions. + */ + limits?: Preview.Limits; + + /** + * mTLS bindings used for Pages Functions. + */ + mtls_certificates?: { [key: string]: Preview.MTLSCertificates }; + + /** + * Placement setting used for Pages Functions. + */ + placement?: Preview.Placement; + + /** + * Queue Producer bindings used for Pages Functions. + */ + queue_producers?: { [key: string]: Preview.QueueProducers }; + + /** + * R2 buckets used for Pages Functions. + */ + r2_buckets?: { [key: string]: Preview.R2Buckets }; + + /** + * Services used for Pages Functions. + */ + services?: { [key: string]: Preview.Services }; + + /** + * Vectorize bindings used for Pages Functions. + */ + vectorize_bindings?: { [key: string]: Preview.VectorizeBindings }; + + /** + * Hash of the Wrangler configuration used for the deployment. + */ + wrangler_config_hash?: string; + } + + export namespace Preview { + /** + * A plaintext environment variable. + */ + export interface PagesPlainTextEnvVar { + type: 'plain_text'; + + /** + * Environment variable value. + */ + value: string; + } + + /** + * An encrypted environment variable. + */ + export interface PagesSecretTextEnvVar { + type: 'secret_text'; + + /** + * Secret value. + */ + value: string; + } + + /** + * AI binding. + */ + export interface AIBindings { + project_id: string; + } + + /** + * Analytics Engine binding. + */ + export interface AnalyticsEngineDatasets { + /** + * Name of the dataset. + */ + dataset: string; + } + + /** + * Browser binding. + */ + export interface Browsers {} + + /** + * D1 binding. + */ + export interface D1Databases { + /** + * UUID of the D1 database. + */ + id: string; + } + + /** + * Durable Object binding. + */ + export interface DurableObjectNamespaces { + /** + * ID of the Durable Object namespace. + */ + namespace_id: string; + } + + /** + * Hyperdrive binding. + */ + export interface HyperdriveBindings { + id: string; + } + + /** + * KV namespace binding. + */ + export interface KVNamespaces { + /** + * ID of the KV namespace. + */ + namespace_id: string; + } + + /** + * Limits for Pages Functions. + */ + export interface Limits { + /** + * CPU time limit in milliseconds. + */ + cpu_ms: number; + } + + /** + * mTLS binding. + */ + export interface MTLSCertificates { + certificate_id: string; + } + + /** + * Placement setting used for Pages Functions. + */ + export interface Placement { + /** + * Placement mode. + */ + mode: string; + } + + /** + * Queue Producer binding. + */ + export interface QueueProducers { + /** + * Name of the Queue. + */ + name: string; + } + + /** + * R2 binding. + */ + export interface R2Buckets { + /** + * Name of the R2 bucket. + */ + name: string; + + /** + * Jurisdiction of the R2 bucket. + */ + jurisdiction?: string | null; + } + + /** + * Service binding. + */ + export interface Services { + /** + * The Service environment. + */ + environment: string; + + /** + * The Service name. + */ + service: string; + + /** + * The entrypoint to bind to. + */ + entrypoint?: string | null; + } + + /** + * Vectorize binding. + */ + export interface VectorizeBindings { + index_name: string; + } + } + + /** + * Configs for production deploys. + */ + export interface Production { + /** + * Whether to always use the latest compatibility date for Pages Functions. + */ + always_use_latest_compatibility_date: boolean; + + /** + * The major version of the build image to use for Pages Functions. + */ + build_image_major_version: number; + + /** + * Compatibility date used for Pages Functions. + */ + compatibility_date: string; + + /** + * Compatibility flags used for Pages Functions. + */ + compatibility_flags: Array; + + /** + * Environment variables used for builds and Pages Functions. + */ + env_vars: { + [key: string]: Production.PagesPlainTextEnvVar | null | Production.PagesSecretTextEnvVar | null; + } | null; + + /** + * Whether to fail open when the deployment config cannot be applied. + */ + fail_open: boolean; + + /** + * @deprecated All new projects now use the Standard usage model. + */ + usage_model: 'standard' | 'bundled' | 'unbound'; + + /** + * Constellation bindings used for Pages Functions. + */ + ai_bindings?: { [key: string]: Production.AIBindings }; + + /** + * Analytics Engine bindings used for Pages Functions. + */ + analytics_engine_datasets?: { [key: string]: Production.AnalyticsEngineDatasets }; + + /** + * Browser bindings used for Pages Functions. + */ + browsers?: { [key: string]: Production.Browsers | null }; + + /** + * D1 databases used for Pages Functions. + */ + d1_databases?: { [key: string]: Production.D1Databases }; + + /** + * Durable Object namespaces used for Pages Functions. + */ + durable_object_namespaces?: { [key: string]: Production.DurableObjectNamespaces }; + + /** + * Hyperdrive bindings used for Pages Functions. + */ + hyperdrive_bindings?: { [key: string]: Production.HyperdriveBindings }; + + /** + * KV namespaces used for Pages Functions. + */ + kv_namespaces?: { [key: string]: Production.KVNamespaces }; + + /** + * Limits for Pages Functions. + */ + limits?: Production.Limits; + + /** + * mTLS bindings used for Pages Functions. + */ + mtls_certificates?: { [key: string]: Production.MTLSCertificates }; + + /** + * Placement setting used for Pages Functions. + */ + placement?: Production.Placement; + + /** + * Queue Producer bindings used for Pages Functions. + */ + queue_producers?: { [key: string]: Production.QueueProducers }; + + /** + * R2 buckets used for Pages Functions. + */ + r2_buckets?: { [key: string]: Production.R2Buckets }; + + /** + * Services used for Pages Functions. + */ + services?: { [key: string]: Production.Services }; + + /** + * Vectorize bindings used for Pages Functions. + */ + vectorize_bindings?: { [key: string]: Production.VectorizeBindings }; + + /** + * Hash of the Wrangler configuration used for the deployment. + */ + wrangler_config_hash?: string; + } + + export namespace Production { + /** + * A plaintext environment variable. + */ + export interface PagesPlainTextEnvVar { + type: 'plain_text'; + + /** + * Environment variable value. + */ + value: string; + } + + /** + * An encrypted environment variable. + */ + export interface PagesSecretTextEnvVar { + type: 'secret_text'; + + /** + * Secret value. + */ + value: string; + } + + /** + * AI binding. + */ + export interface AIBindings { + project_id: string; + } + + /** + * Analytics Engine binding. + */ + export interface AnalyticsEngineDatasets { + /** + * Name of the dataset. + */ + dataset: string; + } + + /** + * Browser binding. + */ + export interface Browsers {} + + /** + * D1 binding. + */ + export interface D1Databases { + /** + * UUID of the D1 database. + */ + id: string; + } + + /** + * Durable Object binding. + */ + export interface DurableObjectNamespaces { + /** + * ID of the Durable Object namespace. + */ + namespace_id: string; + } + + /** + * Hyperdrive binding. + */ + export interface HyperdriveBindings { + id: string; + } + + /** + * KV namespace binding. + */ + export interface KVNamespaces { + /** + * ID of the KV namespace. + */ + namespace_id: string; + } + + /** + * Limits for Pages Functions. + */ + export interface Limits { + /** + * CPU time limit in milliseconds. + */ + cpu_ms: number; + } + + /** + * mTLS binding. + */ + export interface MTLSCertificates { + certificate_id: string; + } + + /** + * Placement setting used for Pages Functions. + */ + export interface Placement { + /** + * Placement mode. + */ + mode: string; + } + + /** + * Queue Producer binding. + */ + export interface QueueProducers { + /** + * Name of the Queue. + */ + name: string; + } + + /** + * R2 binding. + */ + export interface R2Buckets { + /** + * Name of the R2 bucket. + */ + name: string; + + /** + * Jurisdiction of the R2 bucket. + */ + jurisdiction?: string | null; + } + + /** + * Service binding. + */ + export interface Services { + /** + * The Service environment. + */ + environment: string; + + /** + * The Service name. + */ + service: string; + + /** + * The entrypoint to bind to. + */ + entrypoint?: string | null; + } + + /** + * Vectorize binding. + */ + export interface VectorizeBindings { + index_name: string; + } + } + } + + /** + * Most recent deployment of the project. + */ + export interface LatestDeployment { + /** + * Id of the deployment. + */ + id: string; + + /** + * A list of alias URLs pointing to this deployment. + */ + aliases: Array | null; + + /** + * Configs for the project build process. + */ + build_config: LatestDeployment.BuildConfig; + + /** + * When the deployment was created. + */ + created_on: string; + + /** + * Info about what caused the deployment. + */ + deployment_trigger: LatestDeployment.DeploymentTrigger; + + /** + * Environment variables used for builds and Pages Functions. + */ + env_vars: { + [key: string]: + | LatestDeployment.PagesPlainTextEnvVar + | null + | LatestDeployment.PagesSecretTextEnvVar + | null; + } | null; + + /** + * Type of deploy. + */ + environment: 'preview' | 'production'; + + /** + * If the deployment has been skipped. + */ + is_skipped: boolean; + + /** + * The status of the deployment. + */ + latest_stage: ProjectsAPI.Stage; + + /** + * When the deployment was last modified. + */ + modified_on: string; + + /** + * Id of the project. + */ + project_id: string; + + /** + * Name of the project. + */ + project_name: string; + + /** + * Short Id (8 character) of the deployment. + */ + short_id: string; + + /** + * Configs for the project source control. + */ + source: LatestDeployment.Source; + + /** + * List of past stages. + */ + stages: Array; + + /** + * The live URL to view this deployment. + */ + url: string; + + /** + * Whether the deployment uses functions. + */ + uses_functions?: boolean | null; + } + + export namespace LatestDeployment { + /** + * Configs for the project build process. + */ + export interface BuildConfig { + /** + * The classifying tag for analytics. + */ + web_analytics_tag: string | null; + + /** + * The auth token for analytics. + */ + web_analytics_token: string | null; + + /** + * Enable build caching for the project. + */ + build_caching?: boolean | null; + + /** + * Command used to build project. + */ + build_command?: string | null; + + /** + * Assets output directory of the build. + */ + destination_dir?: string | null; + + /** + * Directory to run the command. + */ + root_dir?: string | null; + } + + /** + * Info about what caused the deployment. + */ + export interface DeploymentTrigger { + /** + * Additional info about the trigger. + */ + metadata: DeploymentTrigger.Metadata; + + /** + * What caused the deployment. + */ + type: 'github:push' | 'ad_hoc' | 'deploy_hook'; + } + + export namespace DeploymentTrigger { + /** + * Additional info about the trigger. + */ + export interface Metadata { + /** + * Where the trigger happened. + */ + branch: string; + + /** + * Whether the deployment trigger commit was dirty. + */ + commit_dirty: boolean; + + /** + * Hash of the deployment trigger commit. + */ + commit_hash: string; + + /** + * Message of the deployment trigger commit. + */ + commit_message: string; + } + } + + /** + * A plaintext environment variable. + */ + export interface PagesPlainTextEnvVar { + type: 'plain_text'; + + /** + * Environment variable value. + */ + value: string; + } + + /** + * An encrypted environment variable. + */ + export interface PagesSecretTextEnvVar { + type: 'secret_text'; + + /** + * Secret value. + */ + value: string; + } + + /** + * Configs for the project source control. + */ + export interface Source { + config: Source.Config; + + /** + * The source control management provider. + */ + type: 'github' | 'gitlab'; + } + + export namespace Source { + export interface Config { + /** + * The owner of the repository. + */ + owner: string; + + /** + * Whether to enable PR comments. + */ + pr_comments_enabled: boolean; + + /** + * The production branch of the repository. + */ + production_branch: string; + + /** + * The name of the repository. + */ + repo_name: string; + + /** + * @deprecated Use `production_deployments_enabled` and + * `preview_deployment_setting` for more granular control. + */ + deployments_enabled?: boolean; + + /** + * The owner ID of the repository. + */ + owner_id?: string; + + /** + * A list of paths that should be excluded from triggering a preview deployment. + * Wildcard syntax (`*`) is supported. + */ + path_excludes?: Array; + + /** + * A list of paths that should be watched to trigger a preview deployment. Wildcard + * syntax (`*`) is supported. + */ + path_includes?: Array; + + /** + * A list of branches that should not trigger a preview deployment. Wildcard syntax + * (`*`) is supported. Must be used with `preview_deployment_setting` set to + * `custom`. + */ + preview_branch_excludes?: Array; + + /** + * A list of branches that should trigger a preview deployment. Wildcard syntax + * (`*`) is supported. Must be used with `preview_deployment_setting` set to + * `custom`. + */ + preview_branch_includes?: Array; + + /** + * Controls whether commits to preview branches trigger a preview deployment. + */ + preview_deployment_setting?: 'all' | 'none' | 'custom'; + + /** + * Whether to trigger a production deployment on commits to the production branch. + */ + production_deployments_enabled?: boolean; + + /** + * The ID of the repository. + */ + repo_id?: string; + } + } + } + + /** + * Configs for the project build process. + */ + export interface BuildConfig { + /** + * The classifying tag for analytics. + */ + web_analytics_tag: string | null; + + /** + * The auth token for analytics. + */ + web_analytics_token: string | null; + + /** + * Enable build caching for the project. + */ + build_caching?: boolean | null; + + /** + * Command used to build project. + */ + build_command?: string | null; + + /** + * Assets output directory of the build. + */ + destination_dir?: string | null; + + /** + * Directory to run the command. + */ + root_dir?: string | null; + } + + /** + * Configs for the project source control. + */ + export interface Source { + config: Source.Config; + + /** + * The source control management provider. + */ + type: 'github' | 'gitlab'; + } + + export namespace Source { + export interface Config { + /** + * The owner of the repository. + */ + owner: string; + + /** + * Whether to enable PR comments. + */ + pr_comments_enabled: boolean; + + /** + * The production branch of the repository. + */ + production_branch: string; + + /** + * The name of the repository. + */ + repo_name: string; + + /** + * @deprecated Use `production_deployments_enabled` and + * `preview_deployment_setting` for more granular control. + */ + deployments_enabled?: boolean; + + /** + * The owner ID of the repository. + */ + owner_id?: string; + + /** + * A list of paths that should be excluded from triggering a preview deployment. + * Wildcard syntax (`*`) is supported. + */ + path_excludes?: Array; + + /** + * A list of paths that should be watched to trigger a preview deployment. Wildcard + * syntax (`*`) is supported. + */ + path_includes?: Array; + + /** + * A list of branches that should not trigger a preview deployment. Wildcard syntax + * (`*`) is supported. Must be used with `preview_deployment_setting` set to + * `custom`. + */ + preview_branch_excludes?: Array; + + /** + * A list of branches that should trigger a preview deployment. Wildcard syntax + * (`*`) is supported. Must be used with `preview_deployment_setting` set to + * `custom`. + */ + preview_branch_includes?: Array; + + /** + * Controls whether commits to preview branches trigger a preview deployment. + */ + preview_deployment_setting?: 'all' | 'none' | 'custom'; + + /** + * Whether to trigger a production deployment on commits to the production branch. + */ + production_deployments_enabled?: boolean; + + /** + * The ID of the repository. + */ + repo_id?: string; + } + } +} + +export interface ProjectGetResponse { + /** + * ID of the project. + */ + id: string; + + /** + * Most recent production deployment of the project. + */ + canonical_deployment: ProjectGetResponse.CanonicalDeployment | null; + + /** + * When the project was created. + */ + created_on: string; + + /** + * Configs for deployments in a project. + */ + deployment_configs: ProjectGetResponse.DeploymentConfigs; + + /** + * Framework the project is using. + */ + framework: string; + + /** + * Version of the framework the project is using. + */ + framework_version: string; + + /** + * Most recent deployment of the project. + */ + latest_deployment: ProjectGetResponse.LatestDeployment | null; + + /** + * Name of the project. + */ + name: string; + + /** + * Name of the preview script. + */ + preview_script_name: string; + + /** + * Production branch of the project. Used to identify production deployments. + */ + production_branch: string; + + /** + * Name of the production script. + */ + production_script_name: string; + + /** + * Whether the project uses functions. + */ + uses_functions: boolean | null; + + /** + * Configs for the project build process. + */ + build_config?: ProjectGetResponse.BuildConfig; + + /** + * A list of associated custom domains for the project. + */ + domains?: Array; + + /** + * Configs for the project source control. + */ + source?: ProjectGetResponse.Source; + + /** + * The Cloudflare subdomain associated with the project. + */ + subdomain?: string; +} + +export namespace ProjectGetResponse { + /** + * Most recent production deployment of the project. + */ + export interface CanonicalDeployment { + /** + * Id of the deployment. + */ + id: string; + + /** + * A list of alias URLs pointing to this deployment. + */ + aliases: Array | null; + + /** + * Configs for the project build process. + */ + build_config: CanonicalDeployment.BuildConfig; + + /** + * When the deployment was created. + */ + created_on: string; + + /** + * Info about what caused the deployment. + */ + deployment_trigger: CanonicalDeployment.DeploymentTrigger; + + /** + * Environment variables used for builds and Pages Functions. + */ + env_vars: { + [key: string]: + | CanonicalDeployment.PagesPlainTextEnvVar + | null + | CanonicalDeployment.PagesSecretTextEnvVar + | null; + } | null; + + /** + * Type of deploy. + */ + environment: 'preview' | 'production'; + + /** + * If the deployment has been skipped. + */ + is_skipped: boolean; + + /** + * The status of the deployment. + */ + latest_stage: ProjectsAPI.Stage; + + /** + * When the deployment was last modified. + */ + modified_on: string; + + /** + * Id of the project. + */ + project_id: string; + + /** + * Name of the project. + */ + project_name: string; + + /** + * Short Id (8 character) of the deployment. + */ + short_id: string; + + /** + * Configs for the project source control. + */ + source: CanonicalDeployment.Source; + + /** + * List of past stages. + */ + stages: Array; + + /** + * The live URL to view this deployment. + */ + url: string; + + /** + * Whether the deployment uses functions. + */ + uses_functions?: boolean | null; + } + + export namespace CanonicalDeployment { + /** + * Configs for the project build process. + */ + export interface BuildConfig { + /** + * The classifying tag for analytics. + */ + web_analytics_tag: string | null; + + /** + * The auth token for analytics. + */ + web_analytics_token: string | null; + + /** + * Enable build caching for the project. + */ + build_caching?: boolean | null; + + /** + * Command used to build project. + */ + build_command?: string | null; + + /** + * Assets output directory of the build. + */ + destination_dir?: string | null; + + /** + * Directory to run the command. + */ + root_dir?: string | null; + } + + /** + * Info about what caused the deployment. + */ + export interface DeploymentTrigger { + /** + * Additional info about the trigger. + */ + metadata: DeploymentTrigger.Metadata; + + /** + * What caused the deployment. + */ + type: 'github:push' | 'ad_hoc' | 'deploy_hook'; + } + + export namespace DeploymentTrigger { + /** + * Additional info about the trigger. + */ + export interface Metadata { + /** + * Where the trigger happened. + */ + branch: string; + + /** + * Whether the deployment trigger commit was dirty. + */ + commit_dirty: boolean; + + /** + * Hash of the deployment trigger commit. + */ + commit_hash: string; + + /** + * Message of the deployment trigger commit. + */ + commit_message: string; + } + } + + /** + * A plaintext environment variable. + */ + export interface PagesPlainTextEnvVar { + type: 'plain_text'; + + /** + * Environment variable value. + */ + value: string; + } + + /** + * An encrypted environment variable. + */ + export interface PagesSecretTextEnvVar { + type: 'secret_text'; + + /** + * Secret value. + */ + value: string; + } + + /** + * Configs for the project source control. + */ + export interface Source { + config: Source.Config; + + /** + * The source control management provider. + */ + type: 'github' | 'gitlab'; + } + + export namespace Source { + export interface Config { + /** + * The owner of the repository. + */ + owner: string; + + /** + * Whether to enable PR comments. + */ + pr_comments_enabled: boolean; + + /** + * The production branch of the repository. + */ + production_branch: string; + + /** + * The name of the repository. + */ + repo_name: string; + + /** + * @deprecated Use `production_deployments_enabled` and + * `preview_deployment_setting` for more granular control. + */ + deployments_enabled?: boolean; + + /** + * The owner ID of the repository. + */ + owner_id?: string; + + /** + * A list of paths that should be excluded from triggering a preview deployment. + * Wildcard syntax (`*`) is supported. + */ + path_excludes?: Array; + + /** + * A list of paths that should be watched to trigger a preview deployment. Wildcard + * syntax (`*`) is supported. + */ + path_includes?: Array; + + /** + * A list of branches that should not trigger a preview deployment. Wildcard syntax + * (`*`) is supported. Must be used with `preview_deployment_setting` set to + * `custom`. + */ + preview_branch_excludes?: Array; + + /** + * A list of branches that should trigger a preview deployment. Wildcard syntax + * (`*`) is supported. Must be used with `preview_deployment_setting` set to + * `custom`. + */ + preview_branch_includes?: Array; + + /** + * Controls whether commits to preview branches trigger a preview deployment. + */ + preview_deployment_setting?: 'all' | 'none' | 'custom'; + + /** + * Whether to trigger a production deployment on commits to the production branch. + */ + production_deployments_enabled?: boolean; + + /** + * The ID of the repository. + */ + repo_id?: string; + } + } + } + + /** + * Configs for deployments in a project. + */ + export interface DeploymentConfigs { + /** + * Configs for preview deploys. + */ + preview: DeploymentConfigs.Preview; + + /** + * Configs for production deploys. + */ + production: DeploymentConfigs.Production; + } + + export namespace DeploymentConfigs { + /** + * Configs for preview deploys. + */ + export interface Preview { + /** + * Whether to always use the latest compatibility date for Pages Functions. + */ + always_use_latest_compatibility_date: boolean; + + /** + * The major version of the build image to use for Pages Functions. + */ + build_image_major_version: number; + + /** + * Compatibility date used for Pages Functions. + */ + compatibility_date: string; + + /** + * Compatibility flags used for Pages Functions. + */ + compatibility_flags: Array; + + /** + * Environment variables used for builds and Pages Functions. + */ + env_vars: { + [key: string]: Preview.PagesPlainTextEnvVar | null | Preview.PagesSecretTextEnvVar | null; + } | null; + + /** + * Whether to fail open when the deployment config cannot be applied. + */ + fail_open: boolean; + + /** + * @deprecated All new projects now use the Standard usage model. + */ + usage_model: 'standard' | 'bundled' | 'unbound'; + + /** + * Constellation bindings used for Pages Functions. + */ + ai_bindings?: { [key: string]: Preview.AIBindings }; + + /** + * Analytics Engine bindings used for Pages Functions. + */ + analytics_engine_datasets?: { [key: string]: Preview.AnalyticsEngineDatasets }; + + /** + * Browser bindings used for Pages Functions. + */ + browsers?: { [key: string]: Preview.Browsers | null }; + + /** + * D1 databases used for Pages Functions. + */ + d1_databases?: { [key: string]: Preview.D1Databases }; + + /** + * Durable Object namespaces used for Pages Functions. + */ + durable_object_namespaces?: { [key: string]: Preview.DurableObjectNamespaces }; + + /** + * Hyperdrive bindings used for Pages Functions. + */ + hyperdrive_bindings?: { [key: string]: Preview.HyperdriveBindings }; + + /** + * KV namespaces used for Pages Functions. + */ + kv_namespaces?: { [key: string]: Preview.KVNamespaces }; + + /** + * Limits for Pages Functions. + */ + limits?: Preview.Limits; + + /** + * mTLS bindings used for Pages Functions. + */ + mtls_certificates?: { [key: string]: Preview.MTLSCertificates }; + + /** + * Placement setting used for Pages Functions. + */ + placement?: Preview.Placement; + + /** + * Queue Producer bindings used for Pages Functions. + */ + queue_producers?: { [key: string]: Preview.QueueProducers }; + + /** + * R2 buckets used for Pages Functions. + */ + r2_buckets?: { [key: string]: Preview.R2Buckets }; + + /** + * Services used for Pages Functions. + */ + services?: { [key: string]: Preview.Services }; + + /** + * Vectorize bindings used for Pages Functions. + */ + vectorize_bindings?: { [key: string]: Preview.VectorizeBindings }; + + /** + * Hash of the Wrangler configuration used for the deployment. + */ + wrangler_config_hash?: string; + } + + export namespace Preview { + /** + * A plaintext environment variable. + */ + export interface PagesPlainTextEnvVar { + type: 'plain_text'; + + /** + * Environment variable value. + */ + value: string; + } + + /** + * An encrypted environment variable. + */ + export interface PagesSecretTextEnvVar { + type: 'secret_text'; + + /** + * Secret value. + */ + value: string; + } + + /** + * AI binding. + */ + export interface AIBindings { + project_id: string; + } + + /** + * Analytics Engine binding. + */ + export interface AnalyticsEngineDatasets { + /** + * Name of the dataset. + */ + dataset: string; + } + + /** + * Browser binding. + */ + export interface Browsers {} + + /** + * D1 binding. + */ + export interface D1Databases { + /** + * UUID of the D1 database. + */ + id: string; + } + + /** + * Durable Object binding. + */ + export interface DurableObjectNamespaces { + /** + * ID of the Durable Object namespace. + */ + namespace_id: string; + } + + /** + * Hyperdrive binding. + */ + export interface HyperdriveBindings { + id: string; + } + + /** + * KV namespace binding. + */ + export interface KVNamespaces { + /** + * ID of the KV namespace. + */ + namespace_id: string; + } + + /** + * Limits for Pages Functions. + */ + export interface Limits { + /** + * CPU time limit in milliseconds. + */ + cpu_ms: number; + } + + /** + * mTLS binding. + */ + export interface MTLSCertificates { + certificate_id: string; + } + + /** + * Placement setting used for Pages Functions. + */ + export interface Placement { + /** + * Placement mode. + */ + mode: string; + } + + /** + * Queue Producer binding. + */ + export interface QueueProducers { + /** + * Name of the Queue. + */ + name: string; + } + + /** + * R2 binding. + */ + export interface R2Buckets { + /** + * Name of the R2 bucket. + */ + name: string; + + /** + * Jurisdiction of the R2 bucket. + */ + jurisdiction?: string | null; + } + + /** + * Service binding. + */ + export interface Services { + /** + * The Service environment. + */ + environment: string; + + /** + * The Service name. + */ + service: string; + + /** + * The entrypoint to bind to. + */ + entrypoint?: string | null; + } + + /** + * Vectorize binding. + */ + export interface VectorizeBindings { + index_name: string; + } + } + + /** + * Configs for production deploys. + */ + export interface Production { + /** + * Whether to always use the latest compatibility date for Pages Functions. + */ + always_use_latest_compatibility_date: boolean; + + /** + * The major version of the build image to use for Pages Functions. + */ + build_image_major_version: number; + + /** + * Compatibility date used for Pages Functions. + */ + compatibility_date: string; + + /** + * Compatibility flags used for Pages Functions. + */ + compatibility_flags: Array; + + /** + * Environment variables used for builds and Pages Functions. + */ + env_vars: { + [key: string]: Production.PagesPlainTextEnvVar | null | Production.PagesSecretTextEnvVar | null; + } | null; + + /** + * Whether to fail open when the deployment config cannot be applied. + */ + fail_open: boolean; + + /** + * @deprecated All new projects now use the Standard usage model. + */ + usage_model: 'standard' | 'bundled' | 'unbound'; + + /** + * Constellation bindings used for Pages Functions. + */ + ai_bindings?: { [key: string]: Production.AIBindings }; + + /** + * Analytics Engine bindings used for Pages Functions. + */ + analytics_engine_datasets?: { [key: string]: Production.AnalyticsEngineDatasets }; + + /** + * Browser bindings used for Pages Functions. + */ + browsers?: { [key: string]: Production.Browsers | null }; + + /** + * D1 databases used for Pages Functions. + */ + d1_databases?: { [key: string]: Production.D1Databases }; + + /** + * Durable Object namespaces used for Pages Functions. + */ + durable_object_namespaces?: { [key: string]: Production.DurableObjectNamespaces }; + + /** + * Hyperdrive bindings used for Pages Functions. + */ + hyperdrive_bindings?: { [key: string]: Production.HyperdriveBindings }; + + /** + * KV namespaces used for Pages Functions. + */ + kv_namespaces?: { [key: string]: Production.KVNamespaces }; + + /** + * Limits for Pages Functions. + */ + limits?: Production.Limits; + + /** + * mTLS bindings used for Pages Functions. + */ + mtls_certificates?: { [key: string]: Production.MTLSCertificates }; + + /** + * Placement setting used for Pages Functions. + */ + placement?: Production.Placement; + + /** + * Queue Producer bindings used for Pages Functions. + */ + queue_producers?: { [key: string]: Production.QueueProducers }; + + /** + * R2 buckets used for Pages Functions. + */ + r2_buckets?: { [key: string]: Production.R2Buckets }; + + /** + * Services used for Pages Functions. + */ + services?: { [key: string]: Production.Services }; + + /** + * Vectorize bindings used for Pages Functions. + */ + vectorize_bindings?: { [key: string]: Production.VectorizeBindings }; + + /** + * Hash of the Wrangler configuration used for the deployment. + */ + wrangler_config_hash?: string; + } + + export namespace Production { + /** + * A plaintext environment variable. + */ + export interface PagesPlainTextEnvVar { + type: 'plain_text'; + + /** + * Environment variable value. + */ + value: string; + } + + /** + * An encrypted environment variable. + */ + export interface PagesSecretTextEnvVar { + type: 'secret_text'; + + /** + * Secret value. + */ + value: string; + } + + /** + * AI binding. + */ + export interface AIBindings { + project_id: string; + } + + /** + * Analytics Engine binding. + */ + export interface AnalyticsEngineDatasets { + /** + * Name of the dataset. + */ + dataset: string; + } + + /** + * Browser binding. + */ + export interface Browsers {} + + /** + * D1 binding. + */ + export interface D1Databases { + /** + * UUID of the D1 database. + */ + id: string; + } + + /** + * Durable Object binding. + */ + export interface DurableObjectNamespaces { + /** + * ID of the Durable Object namespace. + */ + namespace_id: string; + } + + /** + * Hyperdrive binding. + */ + export interface HyperdriveBindings { + id: string; + } + + /** + * KV namespace binding. + */ + export interface KVNamespaces { + /** + * ID of the KV namespace. + */ + namespace_id: string; + } + + /** + * Limits for Pages Functions. + */ + export interface Limits { + /** + * CPU time limit in milliseconds. + */ + cpu_ms: number; + } + + /** + * mTLS binding. + */ + export interface MTLSCertificates { + certificate_id: string; + } + + /** + * Placement setting used for Pages Functions. + */ + export interface Placement { + /** + * Placement mode. + */ + mode: string; + } + + /** + * Queue Producer binding. + */ + export interface QueueProducers { + /** + * Name of the Queue. + */ + name: string; + } + + /** + * R2 binding. + */ + export interface R2Buckets { + /** + * Name of the R2 bucket. + */ + name: string; + + /** + * Jurisdiction of the R2 bucket. + */ + jurisdiction?: string | null; + } + + /** + * Service binding. + */ + export interface Services { + /** + * The Service environment. + */ + environment: string; + + /** + * The Service name. + */ + service: string; + + /** + * The entrypoint to bind to. + */ + entrypoint?: string | null; + } + + /** + * Vectorize binding. + */ + export interface VectorizeBindings { + index_name: string; + } + } + } + + /** + * Most recent deployment of the project. + */ + export interface LatestDeployment { + /** + * Id of the deployment. + */ + id: string; + + /** + * A list of alias URLs pointing to this deployment. + */ + aliases: Array | null; + + /** + * Configs for the project build process. + */ + build_config: LatestDeployment.BuildConfig; + + /** + * When the deployment was created. + */ + created_on: string; + + /** + * Info about what caused the deployment. + */ + deployment_trigger: LatestDeployment.DeploymentTrigger; + + /** + * Environment variables used for builds and Pages Functions. + */ + env_vars: { + [key: string]: + | LatestDeployment.PagesPlainTextEnvVar + | null + | LatestDeployment.PagesSecretTextEnvVar + | null; + } | null; + + /** + * Type of deploy. + */ + environment: 'preview' | 'production'; + + /** + * If the deployment has been skipped. + */ + is_skipped: boolean; + + /** + * The status of the deployment. + */ + latest_stage: ProjectsAPI.Stage; + + /** + * When the deployment was last modified. + */ + modified_on: string; + + /** + * Id of the project. + */ + project_id: string; + + /** + * Name of the project. + */ + project_name: string; + + /** + * Short Id (8 character) of the deployment. + */ + short_id: string; + + /** + * Configs for the project source control. + */ + source: LatestDeployment.Source; + + /** + * List of past stages. + */ + stages: Array; + + /** + * The live URL to view this deployment. + */ + url: string; + + /** + * Whether the deployment uses functions. + */ + uses_functions?: boolean | null; + } + + export namespace LatestDeployment { + /** + * Configs for the project build process. + */ + export interface BuildConfig { + /** + * The classifying tag for analytics. + */ + web_analytics_tag: string | null; + + /** + * The auth token for analytics. + */ + web_analytics_token: string | null; + + /** + * Enable build caching for the project. + */ + build_caching?: boolean | null; + + /** + * Command used to build project. + */ + build_command?: string | null; + + /** + * Assets output directory of the build. + */ + destination_dir?: string | null; + + /** + * Directory to run the command. + */ + root_dir?: string | null; + } + + /** + * Info about what caused the deployment. + */ + export interface DeploymentTrigger { + /** + * Additional info about the trigger. + */ + metadata: DeploymentTrigger.Metadata; + + /** + * What caused the deployment. + */ + type: 'github:push' | 'ad_hoc' | 'deploy_hook'; + } + + export namespace DeploymentTrigger { + /** + * Additional info about the trigger. + */ + export interface Metadata { + /** + * Where the trigger happened. + */ + branch: string; + + /** + * Whether the deployment trigger commit was dirty. + */ + commit_dirty: boolean; + + /** + * Hash of the deployment trigger commit. + */ + commit_hash: string; + + /** + * Message of the deployment trigger commit. + */ + commit_message: string; + } + } + + /** + * A plaintext environment variable. + */ + export interface PagesPlainTextEnvVar { + type: 'plain_text'; + + /** + * Environment variable value. + */ + value: string; + } + + /** + * An encrypted environment variable. + */ + export interface PagesSecretTextEnvVar { + type: 'secret_text'; + + /** + * Secret value. + */ + value: string; + } + + /** + * Configs for the project source control. + */ + export interface Source { + config: Source.Config; + + /** + * The source control management provider. + */ + type: 'github' | 'gitlab'; + } + + export namespace Source { + export interface Config { + /** + * The owner of the repository. + */ + owner: string; + + /** + * Whether to enable PR comments. + */ + pr_comments_enabled: boolean; + + /** + * The production branch of the repository. + */ + production_branch: string; + + /** + * The name of the repository. + */ + repo_name: string; + + /** + * @deprecated Use `production_deployments_enabled` and + * `preview_deployment_setting` for more granular control. + */ + deployments_enabled?: boolean; + + /** + * The owner ID of the repository. + */ + owner_id?: string; + + /** + * A list of paths that should be excluded from triggering a preview deployment. + * Wildcard syntax (`*`) is supported. + */ + path_excludes?: Array; + + /** + * A list of paths that should be watched to trigger a preview deployment. Wildcard + * syntax (`*`) is supported. + */ + path_includes?: Array; + + /** + * A list of branches that should not trigger a preview deployment. Wildcard syntax + * (`*`) is supported. Must be used with `preview_deployment_setting` set to + * `custom`. + */ + preview_branch_excludes?: Array; + + /** + * A list of branches that should trigger a preview deployment. Wildcard syntax + * (`*`) is supported. Must be used with `preview_deployment_setting` set to + * `custom`. + */ + preview_branch_includes?: Array; + + /** + * Controls whether commits to preview branches trigger a preview deployment. + */ + preview_deployment_setting?: 'all' | 'none' | 'custom'; + + /** + * Whether to trigger a production deployment on commits to the production branch. + */ + production_deployments_enabled?: boolean; + + /** + * The ID of the repository. + */ + repo_id?: string; + } + } + } + + /** + * Configs for the project build process. + */ + export interface BuildConfig { + /** + * The classifying tag for analytics. + */ + web_analytics_tag: string | null; + + /** + * The auth token for analytics. + */ + web_analytics_token: string | null; + + /** + * Enable build caching for the project. + */ + build_caching?: boolean | null; + + /** + * Command used to build project. + */ + build_command?: string | null; + + /** + * Assets output directory of the build. + */ + destination_dir?: string | null; + + /** + * Directory to run the command. + */ + root_dir?: string | null; + } + + /** + * Configs for the project source control. + */ + export interface Source { + config: Source.Config; + + /** + * The source control management provider. + */ + type: 'github' | 'gitlab'; + } + + export namespace Source { + export interface Config { + /** + * The owner of the repository. + */ + owner: string; + + /** + * Whether to enable PR comments. + */ + pr_comments_enabled: boolean; + + /** + * The production branch of the repository. + */ + production_branch: string; + + /** + * The name of the repository. + */ + repo_name: string; + + /** + * @deprecated Use `production_deployments_enabled` and + * `preview_deployment_setting` for more granular control. + */ + deployments_enabled?: boolean; + + /** + * The owner ID of the repository. + */ + owner_id?: string; + + /** + * A list of paths that should be excluded from triggering a preview deployment. + * Wildcard syntax (`*`) is supported. + */ + path_excludes?: Array; + + /** + * A list of paths that should be watched to trigger a preview deployment. Wildcard + * syntax (`*`) is supported. + */ + path_includes?: Array; + + /** + * A list of branches that should not trigger a preview deployment. Wildcard syntax + * (`*`) is supported. Must be used with `preview_deployment_setting` set to + * `custom`. + */ + preview_branch_excludes?: Array; + + /** + * A list of branches that should trigger a preview deployment. Wildcard syntax + * (`*`) is supported. Must be used with `preview_deployment_setting` set to + * `custom`. + */ + preview_branch_includes?: Array; + + /** + * Controls whether commits to preview branches trigger a preview deployment. + */ + preview_deployment_setting?: 'all' | 'none' | 'custom'; - /** - * When the stage started. - */ - started_on?: string | null; + /** + * Whether to trigger a production deployment on commits to the production branch. + */ + production_deployments_enabled?: boolean; - /** - * State of the current stage. - */ - status?: 'success' | 'idle' | 'active' | 'failure' | 'canceled'; + /** + * The ID of the repository. + */ + repo_id?: string; + } + } } -export type ProjectDeleteResponse = unknown; - export type ProjectPurgeBuildCacheResponse = unknown; export interface ProjectCreateParams { /** - * Path param: Identifier + * Path param: Identifier. */ account_id: string; /** - * Body param: Configs for the project build process. + * Body param: Name of the project. */ - build_config?: ProjectCreateParams.BuildConfig; + name: string; /** - * Body param: Configs for deployments in a project. + * Body param: Production branch of the project. Used to identify production + * deployments. */ - deployment_configs?: ProjectCreateParams.DeploymentConfigs; + production_branch: string; /** - * Body param: Name of the project. + * Body param: Configs for the project build process. */ - name?: string; + build_config?: ProjectCreateParams.BuildConfig; /** - * Body param: Production branch of the project. Used to identify production - * deployments. + * Body param: Configs for deployments in a project. */ - production_branch?: string; + deployment_configs?: ProjectCreateParams.DeploymentConfigs; /** - * Body param: + * Body param: Configs for the project source control. */ source?: ProjectCreateParams.Source; } @@ -1081,22 +7341,22 @@ export namespace ProjectCreateParams { /** * Enable build caching for the project. */ - build_caching?: boolean | null; + build_caching?: boolean; /** * Command used to build project. */ - build_command?: string | null; + build_command?: string; /** * Output directory of the build. */ - destination_dir?: string | null; + destination_dir?: string; /** * Directory to run the command. */ - root_dir?: string | null; + root_dir?: string; /** * The classifying tag for analytics. @@ -1132,17 +7392,27 @@ export namespace ProjectCreateParams { /** * Constellation bindings used for Pages Functions. */ - ai_bindings?: { [key: string]: Preview.AIBindings | null } | null; + ai_bindings?: { [key: string]: Preview.AIBindings | null }; + + /** + * Whether to always use the latest compatibility date for Pages Functions. + */ + always_use_latest_compatibility_date?: boolean; /** * Analytics Engine bindings used for Pages Functions. */ - analytics_engine_datasets?: { [key: string]: Preview.AnalyticsEngineDatasets | null } | null; + analytics_engine_datasets?: { [key: string]: Preview.AnalyticsEngineDatasets | null }; /** * Browser bindings used for Pages Functions. */ - browsers?: { [key: string]: Preview.Browsers | null } | null; + browsers?: { [key: string]: Preview.Browsers | null }; + + /** + * The major version of the build image to use for Pages Functions. + */ + build_image_major_version?: number; /** * Compatibility date used for Pages Functions. @@ -1157,12 +7427,12 @@ export namespace ProjectCreateParams { /** * D1 databases used for Pages Functions. */ - d1_databases?: { [key: string]: Preview.D1Databases | null } | null; + d1_databases?: { [key: string]: Preview.D1Databases | null }; /** * Durable Object namespaces used for Pages Functions. */ - durable_object_namespaces?: { [key: string]: Preview.DurableObjectNamespaces | null } | null; + durable_object_namespaces?: { [key: string]: Preview.DurableObjectNamespaces | null }; /** * Environment variables used for builds and Pages Functions. @@ -1171,45 +7441,65 @@ export namespace ProjectCreateParams { [key: string]: Preview.PagesPlainTextEnvVar | null | Preview.PagesSecretTextEnvVar | null; }; + /** + * Whether to fail open when the deployment config cannot be applied. + */ + fail_open?: boolean; + /** * Hyperdrive bindings used for Pages Functions. */ - hyperdrive_bindings?: { [key: string]: Preview.HyperdriveBindings | null } | null; + hyperdrive_bindings?: { [key: string]: Preview.HyperdriveBindings | null }; /** * KV namespaces used for Pages Functions. */ - kv_namespaces?: { [key: string]: Preview.KVNamespaces | null } | null; + kv_namespaces?: { [key: string]: Preview.KVNamespaces | null }; + + /** + * Limits for Pages Functions. + */ + limits?: Preview.Limits; /** * mTLS bindings used for Pages Functions. */ - mtls_certificates?: { [key: string]: Preview.MTLSCertificates | null } | null; + mtls_certificates?: { [key: string]: Preview.MTLSCertificates | null }; /** * Placement setting used for Pages Functions. */ - placement?: Preview.Placement | null; + placement?: Preview.Placement; /** * Queue Producer bindings used for Pages Functions. */ - queue_producers?: { [key: string]: Preview.QueueProducers | null } | null; + queue_producers?: { [key: string]: Preview.QueueProducers | null }; /** * R2 buckets used for Pages Functions. */ - r2_buckets?: { [key: string]: Preview.R2Buckets | null } | null; + r2_buckets?: { [key: string]: Preview.R2Buckets | null }; /** * Services used for Pages Functions. */ - services?: { [key: string]: Preview.Services | null } | null; + services?: { [key: string]: Preview.Services | null }; + + /** + * @deprecated All new projects now use the Standard usage model. + */ + usage_model?: 'standard' | 'bundled' | 'unbound'; /** * Vectorize bindings used for Pages Functions. */ - vectorize_bindings?: { [key: string]: Preview.VectorizeBindings | null } | null; + vectorize_bindings?: { [key: string]: Preview.VectorizeBindings | null }; + + /** + * Hash of the Wrangler configuration used for the deployment. + */ + wrangler_config_hash?: string; } export namespace Preview { @@ -1217,7 +7507,7 @@ export namespace ProjectCreateParams { * AI binding. */ export interface AIBindings { - project_id?: string; + project_id: string; } /** @@ -1227,7 +7517,7 @@ export namespace ProjectCreateParams { /** * Name of the dataset. */ - dataset?: string; + dataset: string; } /** @@ -1242,7 +7532,7 @@ export namespace ProjectCreateParams { /** * UUID of the D1 database. */ - id?: string; + id: string; } /** @@ -1252,7 +7542,7 @@ export namespace ProjectCreateParams { /** * ID of the Durable Object namespace. */ - namespace_id?: string; + namespace_id: string; } /** @@ -1283,7 +7573,7 @@ export namespace ProjectCreateParams { * Hyperdrive binding. */ export interface HyperdriveBindings { - id?: string; + id: string; } /** @@ -1293,14 +7583,24 @@ export namespace ProjectCreateParams { /** * ID of the KV namespace. */ - namespace_id?: string; + namespace_id: string; + } + + /** + * Limits for Pages Functions. + */ + export interface Limits { + /** + * CPU time limit in milliseconds. + */ + cpu_ms: number; } /** * mTLS binding. */ export interface MTLSCertificates { - certificate_id?: string; + certificate_id: string; } /** @@ -1310,7 +7610,7 @@ export namespace ProjectCreateParams { /** * Placement mode. */ - mode?: string; + mode: string; } /** @@ -1320,7 +7620,7 @@ export namespace ProjectCreateParams { /** * Name of the Queue. */ - name?: string; + name: string; } /** @@ -1328,20 +7628,25 @@ export namespace ProjectCreateParams { */ export interface R2Buckets { /** - * Jurisdiction of the R2 bucket. + * Name of the R2 bucket. */ - jurisdiction?: string | null; + name: string; /** - * Name of the R2 bucket. + * Jurisdiction of the R2 bucket. */ - name?: string; + jurisdiction?: string | null; } /** * Service binding. */ export interface Services { + /** + * The Service name. + */ + service: string; + /** * The entrypoint to bind to. */ @@ -1351,18 +7656,13 @@ export namespace ProjectCreateParams { * The Service environment. */ environment?: string; - - /** - * The Service name. - */ - service?: string; } /** * Vectorize binding. */ export interface VectorizeBindings { - index_name?: string; + index_name: string; } } @@ -1373,17 +7673,27 @@ export namespace ProjectCreateParams { /** * Constellation bindings used for Pages Functions. */ - ai_bindings?: { [key: string]: Production.AIBindings | null } | null; + ai_bindings?: { [key: string]: Production.AIBindings | null }; + + /** + * Whether to always use the latest compatibility date for Pages Functions. + */ + always_use_latest_compatibility_date?: boolean; /** * Analytics Engine bindings used for Pages Functions. */ - analytics_engine_datasets?: { [key: string]: Production.AnalyticsEngineDatasets | null } | null; + analytics_engine_datasets?: { [key: string]: Production.AnalyticsEngineDatasets | null }; /** * Browser bindings used for Pages Functions. */ - browsers?: { [key: string]: Production.Browsers | null } | null; + browsers?: { [key: string]: Production.Browsers | null }; + + /** + * The major version of the build image to use for Pages Functions. + */ + build_image_major_version?: number; /** * Compatibility date used for Pages Functions. @@ -1398,12 +7708,12 @@ export namespace ProjectCreateParams { /** * D1 databases used for Pages Functions. */ - d1_databases?: { [key: string]: Production.D1Databases | null } | null; + d1_databases?: { [key: string]: Production.D1Databases | null }; /** * Durable Object namespaces used for Pages Functions. */ - durable_object_namespaces?: { [key: string]: Production.DurableObjectNamespaces | null } | null; + durable_object_namespaces?: { [key: string]: Production.DurableObjectNamespaces | null }; /** * Environment variables used for builds and Pages Functions. @@ -1412,45 +7722,65 @@ export namespace ProjectCreateParams { [key: string]: Production.PagesPlainTextEnvVar | null | Production.PagesSecretTextEnvVar | null; }; + /** + * Whether to fail open when the deployment config cannot be applied. + */ + fail_open?: boolean; + /** * Hyperdrive bindings used for Pages Functions. */ - hyperdrive_bindings?: { [key: string]: Production.HyperdriveBindings | null } | null; + hyperdrive_bindings?: { [key: string]: Production.HyperdriveBindings | null }; /** * KV namespaces used for Pages Functions. */ - kv_namespaces?: { [key: string]: Production.KVNamespaces | null } | null; + kv_namespaces?: { [key: string]: Production.KVNamespaces | null }; + + /** + * Limits for Pages Functions. + */ + limits?: Production.Limits; /** * mTLS bindings used for Pages Functions. */ - mtls_certificates?: { [key: string]: Production.MTLSCertificates | null } | null; + mtls_certificates?: { [key: string]: Production.MTLSCertificates | null }; /** * Placement setting used for Pages Functions. */ - placement?: Production.Placement | null; + placement?: Production.Placement; /** * Queue Producer bindings used for Pages Functions. */ - queue_producers?: { [key: string]: Production.QueueProducers | null } | null; + queue_producers?: { [key: string]: Production.QueueProducers | null }; /** * R2 buckets used for Pages Functions. */ - r2_buckets?: { [key: string]: Production.R2Buckets | null } | null; + r2_buckets?: { [key: string]: Production.R2Buckets | null }; /** * Services used for Pages Functions. */ - services?: { [key: string]: Production.Services | null } | null; + services?: { [key: string]: Production.Services | null }; + + /** + * @deprecated All new projects now use the Standard usage model. + */ + usage_model?: 'standard' | 'bundled' | 'unbound'; /** * Vectorize bindings used for Pages Functions. */ - vectorize_bindings?: { [key: string]: Production.VectorizeBindings | null } | null; + vectorize_bindings?: { [key: string]: Production.VectorizeBindings | null }; + + /** + * Hash of the Wrangler configuration used for the deployment. + */ + wrangler_config_hash?: string; } export namespace Production { @@ -1458,7 +7788,7 @@ export namespace ProjectCreateParams { * AI binding. */ export interface AIBindings { - project_id?: string; + project_id: string; } /** @@ -1468,7 +7798,7 @@ export namespace ProjectCreateParams { /** * Name of the dataset. */ - dataset?: string; + dataset: string; } /** @@ -1483,7 +7813,7 @@ export namespace ProjectCreateParams { /** * UUID of the D1 database. */ - id?: string; + id: string; } /** @@ -1493,7 +7823,7 @@ export namespace ProjectCreateParams { /** * ID of the Durable Object namespace. */ - namespace_id?: string; + namespace_id: string; } /** @@ -1524,7 +7854,7 @@ export namespace ProjectCreateParams { * Hyperdrive binding. */ export interface HyperdriveBindings { - id?: string; + id: string; } /** @@ -1534,14 +7864,24 @@ export namespace ProjectCreateParams { /** * ID of the KV namespace. */ - namespace_id?: string; + namespace_id: string; + } + + /** + * Limits for Pages Functions. + */ + export interface Limits { + /** + * CPU time limit in milliseconds. + */ + cpu_ms: number; } /** * mTLS binding. */ export interface MTLSCertificates { - certificate_id?: string; + certificate_id: string; } /** @@ -1551,7 +7891,7 @@ export namespace ProjectCreateParams { /** * Placement mode. */ - mode?: string; + mode: string; } /** @@ -1561,7 +7901,7 @@ export namespace ProjectCreateParams { /** * Name of the Queue. */ - name?: string; + name: string; } /** @@ -1569,20 +7909,25 @@ export namespace ProjectCreateParams { */ export interface R2Buckets { /** - * Jurisdiction of the R2 bucket. + * Name of the R2 bucket. */ - jurisdiction?: string | null; + name: string; /** - * Name of the R2 bucket. + * Jurisdiction of the R2 bucket. */ - name?: string; + jurisdiction?: string | null; } /** * Service binding. */ export interface Services { + /** + * The Service name. + */ + service: string; + /** * The entrypoint to bind to. */ @@ -1592,72 +7937,123 @@ export namespace ProjectCreateParams { * The Service environment. */ environment?: string; - - /** - * The Service name. - */ - service?: string; } /** * Vectorize binding. */ export interface VectorizeBindings { - index_name?: string; + index_name: string; } } } + /** + * Configs for the project source control. + */ export interface Source { - config?: Source.Config; + config: Source.Config; - type?: string; + /** + * The source control management provider. + */ + type: 'github' | 'gitlab'; } export namespace Source { export interface Config { + /** + * @deprecated Use `production_deployments_enabled` and + * `preview_deployment_setting` for more granular control. + */ deployments_enabled?: boolean; + /** + * The owner of the repository. + */ owner?: string; + /** + * The owner ID of the repository. + */ + owner_id?: string; + + /** + * A list of paths that should be excluded from triggering a preview deployment. + * Wildcard syntax (`*`) is supported. + */ path_excludes?: Array; + /** + * A list of paths that should be watched to trigger a preview deployment. Wildcard + * syntax (`*`) is supported. + */ path_includes?: Array; + /** + * Whether to enable PR comments. + */ pr_comments_enabled?: boolean; + /** + * A list of branches that should not trigger a preview deployment. Wildcard syntax + * (`*`) is supported. Must be used with `preview_deployment_setting` set to + * `custom`. + */ preview_branch_excludes?: Array; + /** + * A list of branches that should trigger a preview deployment. Wildcard syntax + * (`*`) is supported. Must be used with `preview_deployment_setting` set to + * `custom`. + */ preview_branch_includes?: Array; + /** + * Controls whether commits to preview branches trigger a preview deployment. + */ preview_deployment_setting?: 'all' | 'none' | 'custom'; + /** + * The production branch of the repository. + */ production_branch?: string; + /** + * Whether to trigger a production deployment on commits to the production branch. + */ production_deployments_enabled?: boolean; + /** + * The ID of the repository. + */ + repo_id?: string; + + /** + * The name of the repository. + */ repo_name?: string; } } } -export interface ProjectListParams { +export interface ProjectListParams extends V4PagePaginationArrayParams { /** - * Identifier + * Path param: Identifier. */ account_id: string; } export interface ProjectDeleteParams { /** - * Identifier + * Identifier. */ account_id: string; } export interface ProjectEditParams { /** - * Path param: Identifier + * Path param: Identifier. */ account_id: string; @@ -1683,7 +8079,7 @@ export interface ProjectEditParams { production_branch?: string; /** - * Body param: + * Body param: Configs for the project source control. */ source?: ProjectEditParams.Source; } @@ -1696,22 +8092,22 @@ export namespace ProjectEditParams { /** * Enable build caching for the project. */ - build_caching?: boolean | null; + build_caching?: boolean; /** * Command used to build project. */ - build_command?: string | null; + build_command?: string; /** * Output directory of the build. */ - destination_dir?: string | null; + destination_dir?: string; /** * Directory to run the command. */ - root_dir?: string | null; + root_dir?: string; /** * The classifying tag for analytics. @@ -1747,17 +8143,27 @@ export namespace ProjectEditParams { /** * Constellation bindings used for Pages Functions. */ - ai_bindings?: { [key: string]: Preview.AIBindings | null } | null; + ai_bindings?: { [key: string]: Preview.AIBindings | null }; + + /** + * Whether to always use the latest compatibility date for Pages Functions. + */ + always_use_latest_compatibility_date?: boolean; /** * Analytics Engine bindings used for Pages Functions. */ - analytics_engine_datasets?: { [key: string]: Preview.AnalyticsEngineDatasets | null } | null; + analytics_engine_datasets?: { [key: string]: Preview.AnalyticsEngineDatasets | null }; /** * Browser bindings used for Pages Functions. */ - browsers?: { [key: string]: Preview.Browsers | null } | null; + browsers?: { [key: string]: Preview.Browsers | null }; + + /** + * The major version of the build image to use for Pages Functions. + */ + build_image_major_version?: number; /** * Compatibility date used for Pages Functions. @@ -1772,12 +8178,12 @@ export namespace ProjectEditParams { /** * D1 databases used for Pages Functions. */ - d1_databases?: { [key: string]: Preview.D1Databases | null } | null; + d1_databases?: { [key: string]: Preview.D1Databases | null }; /** * Durable Object namespaces used for Pages Functions. */ - durable_object_namespaces?: { [key: string]: Preview.DurableObjectNamespaces | null } | null; + durable_object_namespaces?: { [key: string]: Preview.DurableObjectNamespaces | null }; /** * Environment variables used for builds and Pages Functions. @@ -1786,45 +8192,65 @@ export namespace ProjectEditParams { [key: string]: Preview.PagesPlainTextEnvVar | null | Preview.PagesSecretTextEnvVar | null; }; + /** + * Whether to fail open when the deployment config cannot be applied. + */ + fail_open?: boolean; + /** * Hyperdrive bindings used for Pages Functions. */ - hyperdrive_bindings?: { [key: string]: Preview.HyperdriveBindings | null } | null; + hyperdrive_bindings?: { [key: string]: Preview.HyperdriveBindings | null }; /** * KV namespaces used for Pages Functions. */ - kv_namespaces?: { [key: string]: Preview.KVNamespaces | null } | null; + kv_namespaces?: { [key: string]: Preview.KVNamespaces | null }; + + /** + * Limits for Pages Functions. + */ + limits?: Preview.Limits; /** * mTLS bindings used for Pages Functions. */ - mtls_certificates?: { [key: string]: Preview.MTLSCertificates | null } | null; + mtls_certificates?: { [key: string]: Preview.MTLSCertificates | null }; /** * Placement setting used for Pages Functions. */ - placement?: Preview.Placement | null; + placement?: Preview.Placement; /** * Queue Producer bindings used for Pages Functions. */ - queue_producers?: { [key: string]: Preview.QueueProducers | null } | null; + queue_producers?: { [key: string]: Preview.QueueProducers | null }; /** * R2 buckets used for Pages Functions. */ - r2_buckets?: { [key: string]: Preview.R2Buckets | null } | null; + r2_buckets?: { [key: string]: Preview.R2Buckets | null }; /** * Services used for Pages Functions. */ - services?: { [key: string]: Preview.Services | null } | null; + services?: { [key: string]: Preview.Services | null }; + + /** + * @deprecated All new projects now use the Standard usage model. + */ + usage_model?: 'standard' | 'bundled' | 'unbound'; /** * Vectorize bindings used for Pages Functions. */ - vectorize_bindings?: { [key: string]: Preview.VectorizeBindings | null } | null; + vectorize_bindings?: { [key: string]: Preview.VectorizeBindings | null }; + + /** + * Hash of the Wrangler configuration used for the deployment. + */ + wrangler_config_hash?: string; } export namespace Preview { @@ -1832,7 +8258,7 @@ export namespace ProjectEditParams { * AI binding. */ export interface AIBindings { - project_id?: string; + project_id: string; } /** @@ -1842,7 +8268,7 @@ export namespace ProjectEditParams { /** * Name of the dataset. */ - dataset?: string; + dataset: string; } /** @@ -1857,7 +8283,7 @@ export namespace ProjectEditParams { /** * UUID of the D1 database. */ - id?: string; + id: string; } /** @@ -1867,7 +8293,7 @@ export namespace ProjectEditParams { /** * ID of the Durable Object namespace. */ - namespace_id?: string; + namespace_id: string; } /** @@ -1898,7 +8324,7 @@ export namespace ProjectEditParams { * Hyperdrive binding. */ export interface HyperdriveBindings { - id?: string; + id: string; } /** @@ -1908,14 +8334,24 @@ export namespace ProjectEditParams { /** * ID of the KV namespace. */ - namespace_id?: string; + namespace_id: string; + } + + /** + * Limits for Pages Functions. + */ + export interface Limits { + /** + * CPU time limit in milliseconds. + */ + cpu_ms: number; } /** * mTLS binding. */ export interface MTLSCertificates { - certificate_id?: string; + certificate_id: string; } /** @@ -1925,7 +8361,7 @@ export namespace ProjectEditParams { /** * Placement mode. */ - mode?: string; + mode: string; } /** @@ -1935,7 +8371,7 @@ export namespace ProjectEditParams { /** * Name of the Queue. */ - name?: string; + name: string; } /** @@ -1943,20 +8379,25 @@ export namespace ProjectEditParams { */ export interface R2Buckets { /** - * Jurisdiction of the R2 bucket. + * Name of the R2 bucket. */ - jurisdiction?: string | null; + name: string; /** - * Name of the R2 bucket. + * Jurisdiction of the R2 bucket. */ - name?: string; + jurisdiction?: string | null; } /** * Service binding. */ export interface Services { + /** + * The Service name. + */ + service: string; + /** * The entrypoint to bind to. */ @@ -1966,18 +8407,13 @@ export namespace ProjectEditParams { * The Service environment. */ environment?: string; - - /** - * The Service name. - */ - service?: string; } /** * Vectorize binding. */ export interface VectorizeBindings { - index_name?: string; + index_name: string; } } @@ -1988,17 +8424,27 @@ export namespace ProjectEditParams { /** * Constellation bindings used for Pages Functions. */ - ai_bindings?: { [key: string]: Production.AIBindings | null } | null; + ai_bindings?: { [key: string]: Production.AIBindings | null }; + + /** + * Whether to always use the latest compatibility date for Pages Functions. + */ + always_use_latest_compatibility_date?: boolean; /** * Analytics Engine bindings used for Pages Functions. */ - analytics_engine_datasets?: { [key: string]: Production.AnalyticsEngineDatasets | null } | null; + analytics_engine_datasets?: { [key: string]: Production.AnalyticsEngineDatasets | null }; /** * Browser bindings used for Pages Functions. */ - browsers?: { [key: string]: Production.Browsers | null } | null; + browsers?: { [key: string]: Production.Browsers | null }; + + /** + * The major version of the build image to use for Pages Functions. + */ + build_image_major_version?: number; /** * Compatibility date used for Pages Functions. @@ -2013,12 +8459,12 @@ export namespace ProjectEditParams { /** * D1 databases used for Pages Functions. */ - d1_databases?: { [key: string]: Production.D1Databases | null } | null; + d1_databases?: { [key: string]: Production.D1Databases | null }; /** * Durable Object namespaces used for Pages Functions. */ - durable_object_namespaces?: { [key: string]: Production.DurableObjectNamespaces | null } | null; + durable_object_namespaces?: { [key: string]: Production.DurableObjectNamespaces | null }; /** * Environment variables used for builds and Pages Functions. @@ -2027,45 +8473,65 @@ export namespace ProjectEditParams { [key: string]: Production.PagesPlainTextEnvVar | null | Production.PagesSecretTextEnvVar | null; }; + /** + * Whether to fail open when the deployment config cannot be applied. + */ + fail_open?: boolean; + /** * Hyperdrive bindings used for Pages Functions. */ - hyperdrive_bindings?: { [key: string]: Production.HyperdriveBindings | null } | null; + hyperdrive_bindings?: { [key: string]: Production.HyperdriveBindings | null }; /** * KV namespaces used for Pages Functions. */ - kv_namespaces?: { [key: string]: Production.KVNamespaces | null } | null; + kv_namespaces?: { [key: string]: Production.KVNamespaces | null }; + + /** + * Limits for Pages Functions. + */ + limits?: Production.Limits; /** * mTLS bindings used for Pages Functions. */ - mtls_certificates?: { [key: string]: Production.MTLSCertificates | null } | null; + mtls_certificates?: { [key: string]: Production.MTLSCertificates | null }; /** * Placement setting used for Pages Functions. */ - placement?: Production.Placement | null; + placement?: Production.Placement; /** * Queue Producer bindings used for Pages Functions. */ - queue_producers?: { [key: string]: Production.QueueProducers | null } | null; + queue_producers?: { [key: string]: Production.QueueProducers | null }; /** * R2 buckets used for Pages Functions. */ - r2_buckets?: { [key: string]: Production.R2Buckets | null } | null; + r2_buckets?: { [key: string]: Production.R2Buckets | null }; /** * Services used for Pages Functions. */ - services?: { [key: string]: Production.Services | null } | null; + services?: { [key: string]: Production.Services | null }; + + /** + * @deprecated All new projects now use the Standard usage model. + */ + usage_model?: 'standard' | 'bundled' | 'unbound'; /** * Vectorize bindings used for Pages Functions. */ - vectorize_bindings?: { [key: string]: Production.VectorizeBindings | null } | null; + vectorize_bindings?: { [key: string]: Production.VectorizeBindings | null }; + + /** + * Hash of the Wrangler configuration used for the deployment. + */ + wrangler_config_hash?: string; } export namespace Production { @@ -2073,7 +8539,7 @@ export namespace ProjectEditParams { * AI binding. */ export interface AIBindings { - project_id?: string; + project_id: string; } /** @@ -2083,7 +8549,7 @@ export namespace ProjectEditParams { /** * Name of the dataset. */ - dataset?: string; + dataset: string; } /** @@ -2098,7 +8564,7 @@ export namespace ProjectEditParams { /** * UUID of the D1 database. */ - id?: string; + id: string; } /** @@ -2108,7 +8574,7 @@ export namespace ProjectEditParams { /** * ID of the Durable Object namespace. */ - namespace_id?: string; + namespace_id: string; } /** @@ -2139,7 +8605,7 @@ export namespace ProjectEditParams { * Hyperdrive binding. */ export interface HyperdriveBindings { - id?: string; + id: string; } /** @@ -2149,14 +8615,24 @@ export namespace ProjectEditParams { /** * ID of the KV namespace. */ - namespace_id?: string; + namespace_id: string; + } + + /** + * Limits for Pages Functions. + */ + export interface Limits { + /** + * CPU time limit in milliseconds. + */ + cpu_ms: number; } /** * mTLS binding. */ export interface MTLSCertificates { - certificate_id?: string; + certificate_id: string; } /** @@ -2166,7 +8642,7 @@ export namespace ProjectEditParams { /** * Placement mode. */ - mode?: string; + mode: string; } /** @@ -2176,7 +8652,7 @@ export namespace ProjectEditParams { /** * Name of the Queue. */ - name?: string; + name: string; } /** @@ -2184,20 +8660,25 @@ export namespace ProjectEditParams { */ export interface R2Buckets { /** - * Jurisdiction of the R2 bucket. + * Name of the R2 bucket. */ - jurisdiction?: string | null; + name: string; /** - * Name of the R2 bucket. + * Jurisdiction of the R2 bucket. */ - name?: string; + jurisdiction?: string | null; } /** * Service binding. */ export interface Services { + /** + * The Service name. + */ + service: string; + /** * The entrypoint to bind to. */ @@ -2207,50 +8688,101 @@ export namespace ProjectEditParams { * The Service environment. */ environment?: string; - - /** - * The Service name. - */ - service?: string; } /** * Vectorize binding. */ export interface VectorizeBindings { - index_name?: string; + index_name: string; } } } + /** + * Configs for the project source control. + */ export interface Source { - config?: Source.Config; + config: Source.Config; - type?: string; + /** + * The source control management provider. + */ + type: 'github' | 'gitlab'; } export namespace Source { export interface Config { + /** + * @deprecated Use `production_deployments_enabled` and + * `preview_deployment_setting` for more granular control. + */ deployments_enabled?: boolean; + /** + * The owner of the repository. + */ owner?: string; + /** + * The owner ID of the repository. + */ + owner_id?: string; + + /** + * A list of paths that should be excluded from triggering a preview deployment. + * Wildcard syntax (`*`) is supported. + */ path_excludes?: Array; + /** + * A list of paths that should be watched to trigger a preview deployment. Wildcard + * syntax (`*`) is supported. + */ path_includes?: Array; + /** + * Whether to enable PR comments. + */ pr_comments_enabled?: boolean; + /** + * A list of branches that should not trigger a preview deployment. Wildcard syntax + * (`*`) is supported. Must be used with `preview_deployment_setting` set to + * `custom`. + */ preview_branch_excludes?: Array; + /** + * A list of branches that should trigger a preview deployment. Wildcard syntax + * (`*`) is supported. Must be used with `preview_deployment_setting` set to + * `custom`. + */ preview_branch_includes?: Array; + /** + * Controls whether commits to preview branches trigger a preview deployment. + */ preview_deployment_setting?: 'all' | 'none' | 'custom'; + /** + * The production branch of the repository. + */ production_branch?: string; + /** + * Whether to trigger a production deployment on commits to the production branch. + */ production_deployments_enabled?: boolean; + /** + * The ID of the repository. + */ + repo_id?: string; + + /** + * The name of the repository. + */ repo_name?: string; } } @@ -2258,20 +8790,21 @@ export namespace ProjectEditParams { export interface ProjectGetParams { /** - * Identifier + * Identifier. */ account_id: string; } export interface ProjectPurgeBuildCacheParams { /** - * Identifier + * Identifier. */ account_id: string; } -Projects.DeploymentsSinglePage = DeploymentsSinglePage; +Projects.ProjectListResponsesV4PagePaginationArray = ProjectListResponsesV4PagePaginationArray; Projects.Deployments = Deployments; +Projects.DeploymentListResponsesV4PagePaginationArray = DeploymentListResponsesV4PagePaginationArray; Projects.Domains = Domains; Projects.DomainListResponsesSinglePage = DomainListResponsesSinglePage; @@ -2280,9 +8813,13 @@ export declare namespace Projects { type Deployment as Deployment, type Project as Project, type Stage as Stage, + type ProjectCreateResponse as ProjectCreateResponse, + type ProjectListResponse as ProjectListResponse, type ProjectDeleteResponse as ProjectDeleteResponse, + type ProjectEditResponse as ProjectEditResponse, + type ProjectGetResponse as ProjectGetResponse, type ProjectPurgeBuildCacheResponse as ProjectPurgeBuildCacheResponse, - DeploymentsSinglePage as DeploymentsSinglePage, + ProjectListResponsesV4PagePaginationArray as ProjectListResponsesV4PagePaginationArray, type ProjectCreateParams as ProjectCreateParams, type ProjectListParams as ProjectListParams, type ProjectDeleteParams as ProjectDeleteParams, @@ -2293,7 +8830,13 @@ export declare namespace Projects { export { Deployments as Deployments, + type DeploymentCreateResponse as DeploymentCreateResponse, + type DeploymentListResponse as DeploymentListResponse, type DeploymentDeleteResponse as DeploymentDeleteResponse, + type DeploymentGetResponse as DeploymentGetResponse, + type DeploymentRetryResponse as DeploymentRetryResponse, + type DeploymentRollbackResponse as DeploymentRollbackResponse, + DeploymentListResponsesV4PagePaginationArray as DeploymentListResponsesV4PagePaginationArray, type DeploymentCreateParams as DeploymentCreateParams, type DeploymentListParams as DeploymentListParams, type DeploymentDeleteParams as DeploymentDeleteParams, diff --git a/src/resources/pipelines.ts b/src/resources/pipelines.ts index 02e40368e4..7c0dd168ab 100644 --- a/src/resources/pipelines.ts +++ b/src/resources/pipelines.ts @@ -1,1053 +1,3 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { APIResource } from '../resource'; -import * as Core from '../core'; - -export class Pipelines extends APIResource { - /** - * Create a new pipeline. - * - * @example - * ```ts - * const pipeline = await client.pipelines.create({ - * account_id: '023e105f4ecef8ad9ca31a8372d0c353', - * destination: { - * batch: {}, - * compression: {}, - * credentials: { - * access_key_id: '', - * endpoint: - * 'https://123f8a8258064ed892a347f173372359.r2.cloudflarestorage.com', - * secret_access_key: '', - * }, - * format: 'json', - * path: { bucket: 'bucket' }, - * type: 'r2', - * }, - * name: 'sample_pipeline', - * source: [{ format: 'json', type: 'type' }], - * }); - * ``` - */ - create( - params: PipelineCreateParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - const { account_id, ...body } = params; - return ( - this._client.post(`/accounts/${account_id}/pipelines`, { body, ...options }) as Core.APIPromise<{ - result: PipelineCreateResponse; - }> - )._thenUnwrap((obj) => obj.result); - } - - /** - * Update an existing pipeline. - * - * @example - * ```ts - * const pipeline = await client.pipelines.update( - * 'sample_pipeline', - * { - * account_id: '023e105f4ecef8ad9ca31a8372d0c353', - * destination: { - * batch: {}, - * compression: {}, - * format: 'json', - * path: { bucket: 'bucket' }, - * type: 'r2', - * }, - * name: 'sample_pipeline', - * source: [{ format: 'json', type: 'type' }], - * }, - * ); - * ``` - */ - update( - pipelineName: string, - params: PipelineUpdateParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - const { account_id, ...body } = params; - return ( - this._client.put(`/accounts/${account_id}/pipelines/${pipelineName}`, { - body, - ...options, - }) as Core.APIPromise<{ result: PipelineUpdateResponse }> - )._thenUnwrap((obj) => obj.result); - } - - /** - * List, filter, and paginate pipelines in an account. - * - * @example - * ```ts - * const pipelines = await client.pipelines.list({ - * account_id: '023e105f4ecef8ad9ca31a8372d0c353', - * }); - * ``` - */ - list(params: PipelineListParams, options?: Core.RequestOptions): Core.APIPromise { - const { account_id, ...query } = params; - return this._client.get(`/accounts/${account_id}/pipelines`, { query, ...options }); - } - - /** - * Delete a pipeline. - * - * @example - * ```ts - * await client.pipelines.delete('sample_pipeline', { - * account_id: '023e105f4ecef8ad9ca31a8372d0c353', - * }); - * ``` - */ - delete( - pipelineName: string, - params: PipelineDeleteParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - const { account_id } = params; - return this._client.delete(`/accounts/${account_id}/pipelines/${pipelineName}`, { - ...options, - headers: { Accept: '*/*', ...options?.headers }, - }); - } - - /** - * Get configuration of a pipeline. - * - * @example - * ```ts - * const pipeline = await client.pipelines.get( - * 'sample_pipeline', - * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, - * ); - * ``` - */ - get( - pipelineName: string, - params: PipelineGetParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - const { account_id } = params; - return ( - this._client.get(`/accounts/${account_id}/pipelines/${pipelineName}`, options) as Core.APIPromise<{ - result: PipelineGetResponse; - }> - )._thenUnwrap((obj) => obj.result); - } -} - -/** - * Describes the configuration of a pipeline. - */ -export interface PipelineCreateResponse { - /** - * Specifies the pipeline identifier. - */ - id: string; - - destination: PipelineCreateResponse.Destination; - - /** - * Indicates the endpoint URL to send traffic. - */ - endpoint: string; - - /** - * Defines the name of the pipeline. - */ - name: string; - - source: Array< - | PipelineCreateResponse.CloudflarePipelinesWorkersPipelinesHTTPSource - | PipelineCreateResponse.CloudflarePipelinesWorkersPipelinesBindingSource - >; - - /** - * Indicates the version number of last saved configuration. - */ - version: number; -} - -export namespace PipelineCreateResponse { - export interface Destination { - batch: Destination.Batch; - - compression: Destination.Compression; - - /** - * Specifies the format of data to deliver. - */ - format: 'json'; - - path: Destination.Path; - - /** - * Specifies the type of destination. - */ - type: 'r2'; - } - - export namespace Destination { - export interface Batch { - /** - * Specifies rough maximum size of files. - */ - max_bytes: number; - - /** - * Specifies duration to wait to aggregate batches files. - */ - max_duration_s: number; - - /** - * Specifies rough maximum number of rows per file. - */ - max_rows: number; - } - - export interface Compression { - /** - * Specifies the desired compression algorithm and format. - */ - type: 'none' | 'gzip' | 'deflate'; - } - - export interface Path { - /** - * Specifies the R2 Bucket to store files. - */ - bucket: string; - - /** - * Specifies the name pattern to for individual data files. - */ - filename?: string; - - /** - * Specifies the name pattern for directory. - */ - filepath?: string; - - /** - * Specifies the base directory within the bucket. - */ - prefix?: string; - } - } - - export interface CloudflarePipelinesWorkersPipelinesHTTPSource { - /** - * Specifies the format of source data. - */ - format: 'json'; - - type: string; - - /** - * Specifies whether authentication is required to send to this pipeline via HTTP. - */ - authentication?: boolean; - - cors?: CloudflarePipelinesWorkersPipelinesHTTPSource.CORS; - } - - export namespace CloudflarePipelinesWorkersPipelinesHTTPSource { - export interface CORS { - /** - * Specifies allowed origins to allow Cross Origin HTTP Requests. - */ - origins?: Array; - } - } - - export interface CloudflarePipelinesWorkersPipelinesBindingSource { - /** - * Specifies the format of source data. - */ - format: 'json'; - - type: string; - } -} - -/** - * Describes the configuration of a pipeline. - */ -export interface PipelineUpdateResponse { - /** - * Specifies the pipeline identifier. - */ - id: string; - - destination: PipelineUpdateResponse.Destination; - - /** - * Indicates the endpoint URL to send traffic. - */ - endpoint: string; - - /** - * Defines the name of the pipeline. - */ - name: string; - - source: Array< - | PipelineUpdateResponse.CloudflarePipelinesWorkersPipelinesHTTPSource - | PipelineUpdateResponse.CloudflarePipelinesWorkersPipelinesBindingSource - >; - - /** - * Indicates the version number of last saved configuration. - */ - version: number; -} - -export namespace PipelineUpdateResponse { - export interface Destination { - batch: Destination.Batch; - - compression: Destination.Compression; - - /** - * Specifies the format of data to deliver. - */ - format: 'json'; - - path: Destination.Path; - - /** - * Specifies the type of destination. - */ - type: 'r2'; - } - - export namespace Destination { - export interface Batch { - /** - * Specifies rough maximum size of files. - */ - max_bytes: number; - - /** - * Specifies duration to wait to aggregate batches files. - */ - max_duration_s: number; - - /** - * Specifies rough maximum number of rows per file. - */ - max_rows: number; - } - - export interface Compression { - /** - * Specifies the desired compression algorithm and format. - */ - type: 'none' | 'gzip' | 'deflate'; - } - - export interface Path { - /** - * Specifies the R2 Bucket to store files. - */ - bucket: string; - - /** - * Specifies the name pattern to for individual data files. - */ - filename?: string; - - /** - * Specifies the name pattern for directory. - */ - filepath?: string; - - /** - * Specifies the base directory within the bucket. - */ - prefix?: string; - } - } - - export interface CloudflarePipelinesWorkersPipelinesHTTPSource { - /** - * Specifies the format of source data. - */ - format: 'json'; - - type: string; - - /** - * Specifies whether authentication is required to send to this pipeline via HTTP. - */ - authentication?: boolean; - - cors?: CloudflarePipelinesWorkersPipelinesHTTPSource.CORS; - } - - export namespace CloudflarePipelinesWorkersPipelinesHTTPSource { - export interface CORS { - /** - * Specifies allowed origins to allow Cross Origin HTTP Requests. - */ - origins?: Array; - } - } - - export interface CloudflarePipelinesWorkersPipelinesBindingSource { - /** - * Specifies the format of source data. - */ - format: 'json'; - - type: string; - } -} - -export interface PipelineListResponse { - result_info: PipelineListResponse.ResultInfo; - - results: Array; - - /** - * Indicates whether the API call was successful. - */ - success: boolean; -} - -export namespace PipelineListResponse { - export interface ResultInfo { - /** - * Indicates the number of items on current page. - */ - count: number; - - /** - * Indicates the current page number. - */ - page: number; - - /** - * Indicates the number of items per page. - */ - per_page: number; - - /** - * Indicates the total number of items. - */ - total_count: number; - } - - /** - * Describes the configuration of a pipeline. - */ - export interface Result { - /** - * Specifies the pipeline identifier. - */ - id: string; - - destination: Result.Destination; - - /** - * Indicates the endpoint URL to send traffic. - */ - endpoint: string; - - /** - * Defines the name of the pipeline. - */ - name: string; - - source: Array< - | Result.CloudflarePipelinesWorkersPipelinesHTTPSource - | Result.CloudflarePipelinesWorkersPipelinesBindingSource - >; - - /** - * Indicates the version number of last saved configuration. - */ - version: number; - } - - export namespace Result { - export interface Destination { - batch: Destination.Batch; - - compression: Destination.Compression; - - /** - * Specifies the format of data to deliver. - */ - format: 'json'; - - path: Destination.Path; - - /** - * Specifies the type of destination. - */ - type: 'r2'; - } - - export namespace Destination { - export interface Batch { - /** - * Specifies rough maximum size of files. - */ - max_bytes: number; - - /** - * Specifies duration to wait to aggregate batches files. - */ - max_duration_s: number; - - /** - * Specifies rough maximum number of rows per file. - */ - max_rows: number; - } - - export interface Compression { - /** - * Specifies the desired compression algorithm and format. - */ - type: 'none' | 'gzip' | 'deflate'; - } - - export interface Path { - /** - * Specifies the R2 Bucket to store files. - */ - bucket: string; - - /** - * Specifies the name pattern to for individual data files. - */ - filename?: string; - - /** - * Specifies the name pattern for directory. - */ - filepath?: string; - - /** - * Specifies the base directory within the bucket. - */ - prefix?: string; - } - } - - export interface CloudflarePipelinesWorkersPipelinesHTTPSource { - /** - * Specifies the format of source data. - */ - format: 'json'; - - type: string; - - /** - * Specifies whether authentication is required to send to this pipeline via HTTP. - */ - authentication?: boolean; - - cors?: CloudflarePipelinesWorkersPipelinesHTTPSource.CORS; - } - - export namespace CloudflarePipelinesWorkersPipelinesHTTPSource { - export interface CORS { - /** - * Specifies allowed origins to allow Cross Origin HTTP Requests. - */ - origins?: Array; - } - } - - export interface CloudflarePipelinesWorkersPipelinesBindingSource { - /** - * Specifies the format of source data. - */ - format: 'json'; - - type: string; - } - } -} - -/** - * Describes the configuration of a pipeline. - */ -export interface PipelineGetResponse { - /** - * Specifies the pipeline identifier. - */ - id: string; - - destination: PipelineGetResponse.Destination; - - /** - * Indicates the endpoint URL to send traffic. - */ - endpoint: string; - - /** - * Defines the name of the pipeline. - */ - name: string; - - source: Array< - | PipelineGetResponse.CloudflarePipelinesWorkersPipelinesHTTPSource - | PipelineGetResponse.CloudflarePipelinesWorkersPipelinesBindingSource - >; - - /** - * Indicates the version number of last saved configuration. - */ - version: number; -} - -export namespace PipelineGetResponse { - export interface Destination { - batch: Destination.Batch; - - compression: Destination.Compression; - - /** - * Specifies the format of data to deliver. - */ - format: 'json'; - - path: Destination.Path; - - /** - * Specifies the type of destination. - */ - type: 'r2'; - } - - export namespace Destination { - export interface Batch { - /** - * Specifies rough maximum size of files. - */ - max_bytes: number; - - /** - * Specifies duration to wait to aggregate batches files. - */ - max_duration_s: number; - - /** - * Specifies rough maximum number of rows per file. - */ - max_rows: number; - } - - export interface Compression { - /** - * Specifies the desired compression algorithm and format. - */ - type: 'none' | 'gzip' | 'deflate'; - } - - export interface Path { - /** - * Specifies the R2 Bucket to store files. - */ - bucket: string; - - /** - * Specifies the name pattern to for individual data files. - */ - filename?: string; - - /** - * Specifies the name pattern for directory. - */ - filepath?: string; - - /** - * Specifies the base directory within the bucket. - */ - prefix?: string; - } - } - - export interface CloudflarePipelinesWorkersPipelinesHTTPSource { - /** - * Specifies the format of source data. - */ - format: 'json'; - - type: string; - - /** - * Specifies whether authentication is required to send to this pipeline via HTTP. - */ - authentication?: boolean; - - cors?: CloudflarePipelinesWorkersPipelinesHTTPSource.CORS; - } - - export namespace CloudflarePipelinesWorkersPipelinesHTTPSource { - export interface CORS { - /** - * Specifies allowed origins to allow Cross Origin HTTP Requests. - */ - origins?: Array; - } - } - - export interface CloudflarePipelinesWorkersPipelinesBindingSource { - /** - * Specifies the format of source data. - */ - format: 'json'; - - type: string; - } -} - -export interface PipelineCreateParams { - /** - * Path param: Specifies the public ID of the account. - */ - account_id: string; - - /** - * Body param: - */ - destination: PipelineCreateParams.Destination; - - /** - * Body param: Defines the name of the pipeline. - */ - name: string; - - /** - * Body param: - */ - source: Array< - | PipelineCreateParams.CloudflarePipelinesWorkersPipelinesHTTPSource - | PipelineCreateParams.CloudflarePipelinesWorkersPipelinesBindingSource - >; -} - -export namespace PipelineCreateParams { - export interface Destination { - batch: Destination.Batch; - - compression: Destination.Compression; - - credentials: Destination.Credentials; - - /** - * Specifies the format of data to deliver. - */ - format: 'json'; - - path: Destination.Path; - - /** - * Specifies the type of destination. - */ - type: 'r2'; - } - - export namespace Destination { - export interface Batch { - /** - * Specifies rough maximum size of files. - */ - max_bytes?: number; - - /** - * Specifies duration to wait to aggregate batches files. - */ - max_duration_s?: number; - - /** - * Specifies rough maximum number of rows per file. - */ - max_rows?: number; - } - - export interface Compression { - /** - * Specifies the desired compression algorithm and format. - */ - type?: 'none' | 'gzip' | 'deflate'; - } - - export interface Credentials { - /** - * Specifies the R2 Bucket Access Key Id. - */ - access_key_id: string; - - /** - * Specifies the R2 Endpoint. - */ - endpoint: string; - - /** - * Specifies the R2 Bucket Secret Access Key. - */ - secret_access_key: string; - } - - export interface Path { - /** - * Specifies the R2 Bucket to store files. - */ - bucket: string; - - /** - * Specifies the name pattern to for individual data files. - */ - filename?: string; - - /** - * Specifies the name pattern for directory. - */ - filepath?: string; - - /** - * Specifies the base directory within the bucket. - */ - prefix?: string; - } - } - - export interface CloudflarePipelinesWorkersPipelinesHTTPSource { - /** - * Specifies the format of source data. - */ - format: 'json'; - - type: string; - - /** - * Specifies whether authentication is required to send to this pipeline via HTTP. - */ - authentication?: boolean; - - cors?: CloudflarePipelinesWorkersPipelinesHTTPSource.CORS; - } - - export namespace CloudflarePipelinesWorkersPipelinesHTTPSource { - export interface CORS { - /** - * Specifies allowed origins to allow Cross Origin HTTP Requests. - */ - origins?: Array; - } - } - - export interface CloudflarePipelinesWorkersPipelinesBindingSource { - /** - * Specifies the format of source data. - */ - format: 'json'; - - type: string; - } -} - -export interface PipelineUpdateParams { - /** - * Path param: Specifies the public ID of the account. - */ - account_id: string; - - /** - * Body param: - */ - destination: PipelineUpdateParams.Destination; - - /** - * Body param: Defines the name of the pipeline. - */ - name: string; - - /** - * Body param: - */ - source: Array< - | PipelineUpdateParams.CloudflarePipelinesWorkersPipelinesHTTPSource - | PipelineUpdateParams.CloudflarePipelinesWorkersPipelinesBindingSource - >; -} - -export namespace PipelineUpdateParams { - export interface Destination { - batch: Destination.Batch; - - compression: Destination.Compression; - - /** - * Specifies the format of data to deliver. - */ - format: 'json'; - - path: Destination.Path; - - /** - * Specifies the type of destination. - */ - type: 'r2'; - - credentials?: Destination.Credentials; - } - - export namespace Destination { - export interface Batch { - /** - * Specifies rough maximum size of files. - */ - max_bytes?: number; - - /** - * Specifies duration to wait to aggregate batches files. - */ - max_duration_s?: number; - - /** - * Specifies rough maximum number of rows per file. - */ - max_rows?: number; - } - - export interface Compression { - /** - * Specifies the desired compression algorithm and format. - */ - type?: 'none' | 'gzip' | 'deflate'; - } - - export interface Path { - /** - * Specifies the R2 Bucket to store files. - */ - bucket: string; - - /** - * Specifies the name pattern to for individual data files. - */ - filename?: string; - - /** - * Specifies the name pattern for directory. - */ - filepath?: string; - - /** - * Specifies the base directory within the bucket. - */ - prefix?: string; - } - - export interface Credentials { - /** - * Specifies the R2 Bucket Access Key Id. - */ - access_key_id: string; - - /** - * Specifies the R2 Endpoint. - */ - endpoint: string; - - /** - * Specifies the R2 Bucket Secret Access Key. - */ - secret_access_key: string; - } - } - - export interface CloudflarePipelinesWorkersPipelinesHTTPSource { - /** - * Specifies the format of source data. - */ - format: 'json'; - - type: string; - - /** - * Specifies whether authentication is required to send to this pipeline via HTTP. - */ - authentication?: boolean; - - cors?: CloudflarePipelinesWorkersPipelinesHTTPSource.CORS; - } - - export namespace CloudflarePipelinesWorkersPipelinesHTTPSource { - export interface CORS { - /** - * Specifies allowed origins to allow Cross Origin HTTP Requests. - */ - origins?: Array; - } - } - - export interface CloudflarePipelinesWorkersPipelinesBindingSource { - /** - * Specifies the format of source data. - */ - format: 'json'; - - type: string; - } -} - -export interface PipelineListParams { - /** - * Path param: Specifies the public ID of the account. - */ - account_id: string; - - /** - * Query param: Specifies which page to retrieve. - */ - page?: string; - - /** - * Query param: Specifies the number of pipelines per page. - */ - per_page?: string; - - /** - * Query param: Specifies the prefix of pipeline name to search. - */ - search?: string; -} - -export interface PipelineDeleteParams { - /** - * Specifies the public ID of the account. - */ - account_id: string; -} - -export interface PipelineGetParams { - /** - * Specifies the public ID of the account. - */ - account_id: string; -} - -export declare namespace Pipelines { - export { - type PipelineCreateResponse as PipelineCreateResponse, - type PipelineUpdateResponse as PipelineUpdateResponse, - type PipelineListResponse as PipelineListResponse, - type PipelineGetResponse as PipelineGetResponse, - type PipelineCreateParams as PipelineCreateParams, - type PipelineUpdateParams as PipelineUpdateParams, - type PipelineListParams as PipelineListParams, - type PipelineDeleteParams as PipelineDeleteParams, - type PipelineGetParams as PipelineGetParams, - }; -} +export * from './pipelines/index'; diff --git a/src/resources/pipelines/index.ts b/src/resources/pipelines/index.ts new file mode 100644 index 0000000000..5a27aae1c7 --- /dev/null +++ b/src/resources/pipelines/index.ts @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { Pipelines } from './pipelines'; +export { + SinkListResponsesV4PagePaginationArray, + Sinks, + type SinkCreateResponse, + type SinkListResponse, + type SinkGetResponse, + type SinkCreateParams, + type SinkListParams, + type SinkDeleteParams, + type SinkGetParams, +} from './sinks'; +export { + StreamListResponsesV4PagePaginationArray, + Streams, + type StreamCreateResponse, + type StreamUpdateResponse, + type StreamListResponse, + type StreamGetResponse, + type StreamCreateParams, + type StreamUpdateParams, + type StreamListParams, + type StreamDeleteParams, + type StreamGetParams, +} from './streams'; diff --git a/src/resources/pipelines/pipelines.ts b/src/resources/pipelines/pipelines.ts new file mode 100644 index 0000000000..ebe126d177 --- /dev/null +++ b/src/resources/pipelines/pipelines.ts @@ -0,0 +1,1466 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../resource'; +import * as Core from '../../core'; +import * as SinksAPI from './sinks'; +import { + SinkCreateParams, + SinkCreateResponse, + SinkDeleteParams, + SinkGetParams, + SinkGetResponse, + SinkListParams, + SinkListResponse, + SinkListResponsesV4PagePaginationArray, + Sinks, +} from './sinks'; +import * as StreamsAPI from './streams'; +import { + StreamCreateParams, + StreamCreateResponse, + StreamDeleteParams, + StreamGetParams, + StreamGetResponse, + StreamListParams, + StreamListResponse, + StreamListResponsesV4PagePaginationArray, + StreamUpdateParams, + StreamUpdateResponse, + Streams, +} from './streams'; +import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../pagination'; + +export class Pipelines extends APIResource { + sinks: SinksAPI.Sinks = new SinksAPI.Sinks(this._client); + streams: StreamsAPI.Streams = new StreamsAPI.Streams(this._client); + + /** + * [DEPRECATED] Create a new pipeline. Use the new /pipelines/v1/pipelines endpoint + * instead. + * + * @deprecated Use create_v1 instead. This endpoint will be removed in the future. + */ + create( + params: PipelineCreateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.post(`/accounts/${account_id}/pipelines`, { body, ...options }) as Core.APIPromise<{ + result: PipelineCreateResponse; + }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * [DEPRECATED] Update an existing pipeline. Use the new /pipelines/v1/pipelines + * endpoint instead. + * + * @deprecated The v1 API does not support updates. This endpoint will be removed in the future. + */ + update( + pipelineName: string, + params: PipelineUpdateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.put(`/accounts/${account_id}/pipelines/${pipelineName}`, { + body, + ...options, + }) as Core.APIPromise<{ result: PipelineUpdateResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * [DEPRECATED] List, filter, and paginate pipelines in an account. Use the new + * /pipelines/v1/pipelines endpoint instead. + * + * @deprecated Use list_v1 instead. This endpoint will be removed in the future. + */ + list(params: PipelineListParams, options?: Core.RequestOptions): Core.APIPromise { + const { account_id, ...query } = params; + return this._client.get(`/accounts/${account_id}/pipelines`, { query, ...options }); + } + + /** + * [DEPRECATED] Delete a pipeline. Use the new /pipelines/v1/pipelines endpoint + * instead. + * + * @deprecated Use delete_v1 instead. This endpoint will be removed in the future. + */ + delete( + pipelineName: string, + params: PipelineDeleteParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return this._client.delete(`/accounts/${account_id}/pipelines/${pipelineName}`, { + ...options, + headers: { Accept: '*/*', ...options?.headers }, + }); + } + + /** + * Create a new Pipeline. + * + * @example + * ```ts + * const response = await client.pipelines.createV1({ + * account_id: '0123105f4ecef8ad9ca31a8372d0c353', + * name: 'my_pipeline', + * sql: 'insert into sink select * from source;', + * }); + * ``` + */ + createV1( + params: PipelineCreateV1Params, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.post(`/accounts/${account_id}/pipelines/v1/pipelines`, { + body, + ...options, + }) as Core.APIPromise<{ result: PipelineCreateV1Response }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Delete Pipeline in Account. + * + * @example + * ```ts + * await client.pipelines.deleteV1( + * '043e105f4ecef8ad9ca31a8372d0c353', + * { account_id: '0123105f4ecef8ad9ca31a8372d0c353' }, + * ); + * ``` + */ + deleteV1( + pipelineId: string, + params: PipelineDeleteV1Params, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return this._client.delete(`/accounts/${account_id}/pipelines/v1/pipelines/${pipelineId}`, { + ...options, + headers: { Accept: '*/*', ...options?.headers }, + }); + } + + /** + * [DEPRECATED] Get configuration of a pipeline. Use the new + * /pipelines/v1/pipelines endpoint instead. + * + * @deprecated Use get_v1 instead. This endpoint will be removed in the future. + */ + get( + pipelineName: string, + params: PipelineGetParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.get(`/accounts/${account_id}/pipelines/${pipelineName}`, options) as Core.APIPromise<{ + result: PipelineGetResponse; + }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Get Pipelines Details. + * + * @example + * ```ts + * const response = await client.pipelines.getV1( + * '043e105f4ecef8ad9ca31a8372d0c353', + * { account_id: '0123105f4ecef8ad9ca31a8372d0c353' }, + * ); + * ``` + */ + getV1( + pipelineId: string, + params: PipelineGetV1Params, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.get( + `/accounts/${account_id}/pipelines/v1/pipelines/${pipelineId}`, + options, + ) as Core.APIPromise<{ result: PipelineGetV1Response }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * List/Filter Pipelines in Account. + * + * @example + * ```ts + * // Automatically fetches more pages as needed. + * for await (const pipelineListV1Response of client.pipelines.listV1( + * { account_id: '0123105f4ecef8ad9ca31a8372d0c353' }, + * )) { + * // ... + * } + * ``` + */ + listV1( + params: PipelineListV1Params, + options?: Core.RequestOptions, + ): Core.PagePromise { + const { account_id, ...query } = params; + return this._client.getAPIList( + `/accounts/${account_id}/pipelines/v1/pipelines`, + PipelineListV1ResponsesV4PagePaginationArray, + { query, ...options }, + ); + } + + /** + * Validate Arroyo SQL. + * + * @example + * ```ts + * const response = await client.pipelines.validateSql({ + * account_id: '0123105f4ecef8ad9ca31a8372d0c353', + * sql: 'insert into sink select * from source;', + * }); + * ``` + */ + validateSql( + params: PipelineValidateSqlParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.post(`/accounts/${account_id}/pipelines/v1/validate_sql`, { + body, + ...options, + }) as Core.APIPromise<{ result: PipelineValidateSqlResponse }> + )._thenUnwrap((obj) => obj.result); + } +} + +export class PipelineListV1ResponsesV4PagePaginationArray extends V4PagePaginationArray {} + +/** + * @deprecated [DEPRECATED] Describes the configuration of a pipeline. Use the new + * streams/sinks/pipelines API instead. + */ +export interface PipelineCreateResponse { + /** + * Specifies the pipeline identifier. + */ + id: string; + + destination: PipelineCreateResponse.Destination; + + /** + * Indicates the endpoint URL to send traffic. + */ + endpoint: string; + + /** + * Defines the name of the pipeline. + */ + name: string; + + source: Array< + | PipelineCreateResponse.CloudflarePipelinesWorkersPipelinesHTTPSource + | PipelineCreateResponse.CloudflarePipelinesWorkersPipelinesBindingSource + >; + + /** + * Indicates the version number of last saved configuration. + */ + version: number; +} + +export namespace PipelineCreateResponse { + export interface Destination { + batch: Destination.Batch; + + compression: Destination.Compression; + + /** + * Specifies the format of data to deliver. + */ + format: 'json'; + + path: Destination.Path; + + /** + * Specifies the type of destination. + */ + type: 'r2'; + } + + export namespace Destination { + export interface Batch { + /** + * Specifies rough maximum size of files. + */ + max_bytes: number; + + /** + * Specifies duration to wait to aggregate batches files. + */ + max_duration_s: number; + + /** + * Specifies rough maximum number of rows per file. + */ + max_rows: number; + } + + export interface Compression { + /** + * Specifies the desired compression algorithm and format. + */ + type: 'none' | 'gzip' | 'deflate'; + } + + export interface Path { + /** + * Specifies the R2 Bucket to store files. + */ + bucket: string; + + /** + * Specifies the name pattern to for individual data files. + */ + filename?: string; + + /** + * Specifies the name pattern for directory. + */ + filepath?: string; + + /** + * Specifies the base directory within the bucket. + */ + prefix?: string; + } + } + + /** + * @deprecated [DEPRECATED] HTTP source configuration. Use the new streams API + * instead. + */ + export interface CloudflarePipelinesWorkersPipelinesHTTPSource { + /** + * Specifies the format of source data. + */ + format: 'json'; + + type: string; + + /** + * Specifies whether authentication is required to send to this pipeline via HTTP. + */ + authentication?: boolean; + + cors?: CloudflarePipelinesWorkersPipelinesHTTPSource.CORS; + } + + export namespace CloudflarePipelinesWorkersPipelinesHTTPSource { + export interface CORS { + /** + * Specifies allowed origins to allow Cross Origin HTTP Requests. + */ + origins?: Array; + } + } + + /** + * @deprecated [DEPRECATED] Worker binding source configuration. Use the new + * streams API instead. + */ + export interface CloudflarePipelinesWorkersPipelinesBindingSource { + /** + * Specifies the format of source data. + */ + format: 'json'; + + type: string; + } +} + +/** + * @deprecated [DEPRECATED] Describes the configuration of a pipeline. Use the new + * streams/sinks/pipelines API instead. + */ +export interface PipelineUpdateResponse { + /** + * Specifies the pipeline identifier. + */ + id: string; + + destination: PipelineUpdateResponse.Destination; + + /** + * Indicates the endpoint URL to send traffic. + */ + endpoint: string; + + /** + * Defines the name of the pipeline. + */ + name: string; + + source: Array< + | PipelineUpdateResponse.CloudflarePipelinesWorkersPipelinesHTTPSource + | PipelineUpdateResponse.CloudflarePipelinesWorkersPipelinesBindingSource + >; + + /** + * Indicates the version number of last saved configuration. + */ + version: number; +} + +export namespace PipelineUpdateResponse { + export interface Destination { + batch: Destination.Batch; + + compression: Destination.Compression; + + /** + * Specifies the format of data to deliver. + */ + format: 'json'; + + path: Destination.Path; + + /** + * Specifies the type of destination. + */ + type: 'r2'; + } + + export namespace Destination { + export interface Batch { + /** + * Specifies rough maximum size of files. + */ + max_bytes: number; + + /** + * Specifies duration to wait to aggregate batches files. + */ + max_duration_s: number; + + /** + * Specifies rough maximum number of rows per file. + */ + max_rows: number; + } + + export interface Compression { + /** + * Specifies the desired compression algorithm and format. + */ + type: 'none' | 'gzip' | 'deflate'; + } + + export interface Path { + /** + * Specifies the R2 Bucket to store files. + */ + bucket: string; + + /** + * Specifies the name pattern to for individual data files. + */ + filename?: string; + + /** + * Specifies the name pattern for directory. + */ + filepath?: string; + + /** + * Specifies the base directory within the bucket. + */ + prefix?: string; + } + } + + /** + * @deprecated [DEPRECATED] HTTP source configuration. Use the new streams API + * instead. + */ + export interface CloudflarePipelinesWorkersPipelinesHTTPSource { + /** + * Specifies the format of source data. + */ + format: 'json'; + + type: string; + + /** + * Specifies whether authentication is required to send to this pipeline via HTTP. + */ + authentication?: boolean; + + cors?: CloudflarePipelinesWorkersPipelinesHTTPSource.CORS; + } + + export namespace CloudflarePipelinesWorkersPipelinesHTTPSource { + export interface CORS { + /** + * Specifies allowed origins to allow Cross Origin HTTP Requests. + */ + origins?: Array; + } + } + + /** + * @deprecated [DEPRECATED] Worker binding source configuration. Use the new + * streams API instead. + */ + export interface CloudflarePipelinesWorkersPipelinesBindingSource { + /** + * Specifies the format of source data. + */ + format: 'json'; + + type: string; + } +} + +export interface PipelineListResponse { + result_info: PipelineListResponse.ResultInfo; + + results: Array; + + /** + * Indicates whether the API call was successful. + */ + success: boolean; +} + +export namespace PipelineListResponse { + export interface ResultInfo { + /** + * Indicates the number of items on current page. + */ + count: number; + + /** + * Indicates the current page number. + */ + page: number; + + /** + * Indicates the number of items per page. + */ + per_page: number; + + /** + * Indicates the total number of items. + */ + total_count: number; + } + + /** + * @deprecated [DEPRECATED] Describes the configuration of a pipeline. Use the new + * streams/sinks/pipelines API instead. + */ + export interface Result { + /** + * Specifies the pipeline identifier. + */ + id: string; + + destination: Result.Destination; + + /** + * Indicates the endpoint URL to send traffic. + */ + endpoint: string; + + /** + * Defines the name of the pipeline. + */ + name: string; + + source: Array< + | Result.CloudflarePipelinesWorkersPipelinesHTTPSource + | Result.CloudflarePipelinesWorkersPipelinesBindingSource + >; + + /** + * Indicates the version number of last saved configuration. + */ + version: number; + } + + export namespace Result { + export interface Destination { + batch: Destination.Batch; + + compression: Destination.Compression; + + /** + * Specifies the format of data to deliver. + */ + format: 'json'; + + path: Destination.Path; + + /** + * Specifies the type of destination. + */ + type: 'r2'; + } + + export namespace Destination { + export interface Batch { + /** + * Specifies rough maximum size of files. + */ + max_bytes: number; + + /** + * Specifies duration to wait to aggregate batches files. + */ + max_duration_s: number; + + /** + * Specifies rough maximum number of rows per file. + */ + max_rows: number; + } + + export interface Compression { + /** + * Specifies the desired compression algorithm and format. + */ + type: 'none' | 'gzip' | 'deflate'; + } + + export interface Path { + /** + * Specifies the R2 Bucket to store files. + */ + bucket: string; + + /** + * Specifies the name pattern to for individual data files. + */ + filename?: string; + + /** + * Specifies the name pattern for directory. + */ + filepath?: string; + + /** + * Specifies the base directory within the bucket. + */ + prefix?: string; + } + } + + /** + * @deprecated [DEPRECATED] HTTP source configuration. Use the new streams API + * instead. + */ + export interface CloudflarePipelinesWorkersPipelinesHTTPSource { + /** + * Specifies the format of source data. + */ + format: 'json'; + + type: string; + + /** + * Specifies whether authentication is required to send to this pipeline via HTTP. + */ + authentication?: boolean; + + cors?: CloudflarePipelinesWorkersPipelinesHTTPSource.CORS; + } + + export namespace CloudflarePipelinesWorkersPipelinesHTTPSource { + export interface CORS { + /** + * Specifies allowed origins to allow Cross Origin HTTP Requests. + */ + origins?: Array; + } + } + + /** + * @deprecated [DEPRECATED] Worker binding source configuration. Use the new + * streams API instead. + */ + export interface CloudflarePipelinesWorkersPipelinesBindingSource { + /** + * Specifies the format of source data. + */ + format: 'json'; + + type: string; + } + } +} + +export interface PipelineCreateV1Response { + /** + * Indicates a unique identifier for this pipeline. + */ + id: string; + + created_at: string; + + modified_at: string; + + /** + * Indicates the name of the Pipeline. + */ + name: string; + + /** + * Specifies SQL for the Pipeline processing flow. + */ + sql: string; + + /** + * Indicates the current status of the Pipeline. + */ + status: string; +} + +/** + * @deprecated [DEPRECATED] Describes the configuration of a pipeline. Use the new + * streams/sinks/pipelines API instead. + */ +export interface PipelineGetResponse { + /** + * Specifies the pipeline identifier. + */ + id: string; + + destination: PipelineGetResponse.Destination; + + /** + * Indicates the endpoint URL to send traffic. + */ + endpoint: string; + + /** + * Defines the name of the pipeline. + */ + name: string; + + source: Array< + | PipelineGetResponse.CloudflarePipelinesWorkersPipelinesHTTPSource + | PipelineGetResponse.CloudflarePipelinesWorkersPipelinesBindingSource + >; + + /** + * Indicates the version number of last saved configuration. + */ + version: number; +} + +export namespace PipelineGetResponse { + export interface Destination { + batch: Destination.Batch; + + compression: Destination.Compression; + + /** + * Specifies the format of data to deliver. + */ + format: 'json'; + + path: Destination.Path; + + /** + * Specifies the type of destination. + */ + type: 'r2'; + } + + export namespace Destination { + export interface Batch { + /** + * Specifies rough maximum size of files. + */ + max_bytes: number; + + /** + * Specifies duration to wait to aggregate batches files. + */ + max_duration_s: number; + + /** + * Specifies rough maximum number of rows per file. + */ + max_rows: number; + } + + export interface Compression { + /** + * Specifies the desired compression algorithm and format. + */ + type: 'none' | 'gzip' | 'deflate'; + } + + export interface Path { + /** + * Specifies the R2 Bucket to store files. + */ + bucket: string; + + /** + * Specifies the name pattern to for individual data files. + */ + filename?: string; + + /** + * Specifies the name pattern for directory. + */ + filepath?: string; + + /** + * Specifies the base directory within the bucket. + */ + prefix?: string; + } + } + + /** + * @deprecated [DEPRECATED] HTTP source configuration. Use the new streams API + * instead. + */ + export interface CloudflarePipelinesWorkersPipelinesHTTPSource { + /** + * Specifies the format of source data. + */ + format: 'json'; + + type: string; + + /** + * Specifies whether authentication is required to send to this pipeline via HTTP. + */ + authentication?: boolean; + + cors?: CloudflarePipelinesWorkersPipelinesHTTPSource.CORS; + } + + export namespace CloudflarePipelinesWorkersPipelinesHTTPSource { + export interface CORS { + /** + * Specifies allowed origins to allow Cross Origin HTTP Requests. + */ + origins?: Array; + } + } + + /** + * @deprecated [DEPRECATED] Worker binding source configuration. Use the new + * streams API instead. + */ + export interface CloudflarePipelinesWorkersPipelinesBindingSource { + /** + * Specifies the format of source data. + */ + format: 'json'; + + type: string; + } +} + +export interface PipelineGetV1Response { + /** + * Indicates a unique identifier for this pipeline. + */ + id: string; + + created_at: string; + + modified_at: string; + + /** + * Indicates the name of the Pipeline. + */ + name: string; + + /** + * Specifies SQL for the Pipeline processing flow. + */ + sql: string; + + /** + * Indicates the current status of the Pipeline. + */ + status: string; + + /** + * List of streams and sinks used by this pipeline. + */ + tables: Array; +} + +export namespace PipelineGetV1Response { + export interface Table { + /** + * Unique identifier for the connection (stream or sink). + */ + id: string; + + /** + * Latest available version of the connection. + */ + latest: number; + + /** + * Name of the connection. + */ + name: string; + + /** + * Type of the connection. + */ + type: 'stream' | 'sink'; + + /** + * Current version of the connection used by this pipeline. + */ + version: number; + } +} + +export interface PipelineListV1Response { + /** + * Indicates a unique identifier for this pipeline. + */ + id: string; + + created_at: string; + + modified_at: string; + + /** + * Indicates the name of the Pipeline. + */ + name: string; + + /** + * Specifies SQL for the Pipeline processing flow. + */ + sql: string; + + /** + * Indicates the current status of the Pipeline. + */ + status: string; +} + +export interface PipelineValidateSqlResponse { + /** + * Indicates tables involved in the processing. + */ + tables: { [key: string]: PipelineValidateSqlResponse.Tables }; + + graph?: PipelineValidateSqlResponse.Graph; +} + +export namespace PipelineValidateSqlResponse { + export interface Tables { + id: string; + + name: string; + + type: string; + + version: number; + } + + export interface Graph { + edges: Array; + + nodes: Array; + } + + export namespace Graph { + export interface Edge { + dest_id: number; + + edge_type: string; + + key_type: string; + + src_id: number; + + value_type: string; + } + + export interface Node { + description: string; + + node_id: number; + + operator: string; + + parallelism: number; + } + } +} + +export interface PipelineCreateParams { + /** + * Path param: Specifies the public ID of the account. + */ + account_id: string; + + /** + * Body param: + */ + destination: PipelineCreateParams.Destination; + + /** + * Body param: Defines the name of the pipeline. + */ + name: string; + + /** + * Body param: + */ + source: Array< + | PipelineCreateParams.CloudflarePipelinesWorkersPipelinesHTTPSource + | PipelineCreateParams.CloudflarePipelinesWorkersPipelinesBindingSource + >; +} + +export namespace PipelineCreateParams { + export interface Destination { + batch: Destination.Batch; + + compression: Destination.Compression; + + credentials: Destination.Credentials; + + /** + * Specifies the format of data to deliver. + */ + format: 'json'; + + path: Destination.Path; + + /** + * Specifies the type of destination. + */ + type: 'r2'; + } + + export namespace Destination { + export interface Batch { + /** + * Specifies rough maximum size of files. + */ + max_bytes?: number; + + /** + * Specifies duration to wait to aggregate batches files. + */ + max_duration_s?: number; + + /** + * Specifies rough maximum number of rows per file. + */ + max_rows?: number; + } + + export interface Compression { + /** + * Specifies the desired compression algorithm and format. + */ + type?: 'none' | 'gzip' | 'deflate'; + } + + export interface Credentials { + /** + * Specifies the R2 Bucket Access Key Id. + */ + access_key_id: string; + + /** + * Specifies the R2 Endpoint. + */ + endpoint: string; + + /** + * Specifies the R2 Bucket Secret Access Key. + */ + secret_access_key: string; + } + + export interface Path { + /** + * Specifies the R2 Bucket to store files. + */ + bucket: string; + + /** + * Specifies the name pattern to for individual data files. + */ + filename?: string; + + /** + * Specifies the name pattern for directory. + */ + filepath?: string; + + /** + * Specifies the base directory within the bucket. + */ + prefix?: string; + } + } + + /** + * @deprecated [DEPRECATED] HTTP source configuration. Use the new streams API + * instead. + */ + export interface CloudflarePipelinesWorkersPipelinesHTTPSource { + /** + * Specifies the format of source data. + */ + format: 'json'; + + type: string; + + /** + * Specifies whether authentication is required to send to this pipeline via HTTP. + */ + authentication?: boolean; + + cors?: CloudflarePipelinesWorkersPipelinesHTTPSource.CORS; + } + + export namespace CloudflarePipelinesWorkersPipelinesHTTPSource { + export interface CORS { + /** + * Specifies allowed origins to allow Cross Origin HTTP Requests. + */ + origins?: Array; + } + } + + /** + * @deprecated [DEPRECATED] Worker binding source configuration. Use the new + * streams API instead. + */ + export interface CloudflarePipelinesWorkersPipelinesBindingSource { + /** + * Specifies the format of source data. + */ + format: 'json'; + + type: string; + } +} + +export interface PipelineUpdateParams { + /** + * Path param: Specifies the public ID of the account. + */ + account_id: string; + + /** + * Body param: + */ + destination: PipelineUpdateParams.Destination; + + /** + * Body param: Defines the name of the pipeline. + */ + name: string; + + /** + * Body param: + */ + source: Array< + | PipelineUpdateParams.CloudflarePipelinesWorkersPipelinesHTTPSource + | PipelineUpdateParams.CloudflarePipelinesWorkersPipelinesBindingSource + >; +} + +export namespace PipelineUpdateParams { + export interface Destination { + batch: Destination.Batch; + + compression: Destination.Compression; + + /** + * Specifies the format of data to deliver. + */ + format: 'json'; + + path: Destination.Path; + + /** + * Specifies the type of destination. + */ + type: 'r2'; + + credentials?: Destination.Credentials; + } + + export namespace Destination { + export interface Batch { + /** + * Specifies rough maximum size of files. + */ + max_bytes?: number; + + /** + * Specifies duration to wait to aggregate batches files. + */ + max_duration_s?: number; + + /** + * Specifies rough maximum number of rows per file. + */ + max_rows?: number; + } + + export interface Compression { + /** + * Specifies the desired compression algorithm and format. + */ + type?: 'none' | 'gzip' | 'deflate'; + } + + export interface Path { + /** + * Specifies the R2 Bucket to store files. + */ + bucket: string; + + /** + * Specifies the name pattern to for individual data files. + */ + filename?: string; + + /** + * Specifies the name pattern for directory. + */ + filepath?: string; + + /** + * Specifies the base directory within the bucket. + */ + prefix?: string; + } + + export interface Credentials { + /** + * Specifies the R2 Bucket Access Key Id. + */ + access_key_id: string; + + /** + * Specifies the R2 Endpoint. + */ + endpoint: string; + + /** + * Specifies the R2 Bucket Secret Access Key. + */ + secret_access_key: string; + } + } + + /** + * @deprecated [DEPRECATED] HTTP source configuration. Use the new streams API + * instead. + */ + export interface CloudflarePipelinesWorkersPipelinesHTTPSource { + /** + * Specifies the format of source data. + */ + format: 'json'; + + type: string; + + /** + * Specifies whether authentication is required to send to this pipeline via HTTP. + */ + authentication?: boolean; + + cors?: CloudflarePipelinesWorkersPipelinesHTTPSource.CORS; + } + + export namespace CloudflarePipelinesWorkersPipelinesHTTPSource { + export interface CORS { + /** + * Specifies allowed origins to allow Cross Origin HTTP Requests. + */ + origins?: Array; + } + } + + /** + * @deprecated [DEPRECATED] Worker binding source configuration. Use the new + * streams API instead. + */ + export interface CloudflarePipelinesWorkersPipelinesBindingSource { + /** + * Specifies the format of source data. + */ + format: 'json'; + + type: string; + } +} + +export interface PipelineListParams { + /** + * Path param: Specifies the public ID of the account. + */ + account_id: string; + + /** + * Query param: Specifies which page to retrieve. + */ + page?: string; + + /** + * Query param: Specifies the number of pipelines per page. + */ + per_page?: string; + + /** + * Query param: Specifies the prefix of pipeline name to search. + */ + search?: string; +} + +export interface PipelineDeleteParams { + /** + * Specifies the public ID of the account. + */ + account_id: string; +} + +export interface PipelineCreateV1Params { + /** + * Path param: Specifies the public ID of the account. + */ + account_id: string; + + /** + * Body param: Specifies the name of the Pipeline. + */ + name: string; + + /** + * Body param: Specifies SQL for the Pipeline processing flow. + */ + sql: string; +} + +export interface PipelineDeleteV1Params { + /** + * Specifies the public ID of the account. + */ + account_id: string; +} + +export interface PipelineGetParams { + /** + * Specifies the public ID of the account. + */ + account_id: string; +} + +export interface PipelineGetV1Params { + /** + * Specifies the public ID of the account. + */ + account_id: string; +} + +export interface PipelineListV1Params extends V4PagePaginationArrayParams { + /** + * Path param: Specifies the public ID of the account. + */ + account_id: string; +} + +export interface PipelineValidateSqlParams { + /** + * Path param: Specifies the public ID of the account. + */ + account_id: string; + + /** + * Body param: Specifies SQL to validate. + */ + sql: string; +} + +Pipelines.PipelineListV1ResponsesV4PagePaginationArray = PipelineListV1ResponsesV4PagePaginationArray; +Pipelines.Sinks = Sinks; +Pipelines.SinkListResponsesV4PagePaginationArray = SinkListResponsesV4PagePaginationArray; +Pipelines.Streams = Streams; +Pipelines.StreamListResponsesV4PagePaginationArray = StreamListResponsesV4PagePaginationArray; + +export declare namespace Pipelines { + export { + type PipelineCreateResponse as PipelineCreateResponse, + type PipelineUpdateResponse as PipelineUpdateResponse, + type PipelineListResponse as PipelineListResponse, + type PipelineCreateV1Response as PipelineCreateV1Response, + type PipelineGetResponse as PipelineGetResponse, + type PipelineGetV1Response as PipelineGetV1Response, + type PipelineListV1Response as PipelineListV1Response, + type PipelineValidateSqlResponse as PipelineValidateSqlResponse, + PipelineListV1ResponsesV4PagePaginationArray as PipelineListV1ResponsesV4PagePaginationArray, + type PipelineCreateParams as PipelineCreateParams, + type PipelineUpdateParams as PipelineUpdateParams, + type PipelineListParams as PipelineListParams, + type PipelineDeleteParams as PipelineDeleteParams, + type PipelineCreateV1Params as PipelineCreateV1Params, + type PipelineDeleteV1Params as PipelineDeleteV1Params, + type PipelineGetParams as PipelineGetParams, + type PipelineGetV1Params as PipelineGetV1Params, + type PipelineListV1Params as PipelineListV1Params, + type PipelineValidateSqlParams as PipelineValidateSqlParams, + }; + + export { + Sinks as Sinks, + type SinkCreateResponse as SinkCreateResponse, + type SinkListResponse as SinkListResponse, + type SinkGetResponse as SinkGetResponse, + SinkListResponsesV4PagePaginationArray as SinkListResponsesV4PagePaginationArray, + type SinkCreateParams as SinkCreateParams, + type SinkListParams as SinkListParams, + type SinkDeleteParams as SinkDeleteParams, + type SinkGetParams as SinkGetParams, + }; + + export { + Streams as Streams, + type StreamCreateResponse as StreamCreateResponse, + type StreamUpdateResponse as StreamUpdateResponse, + type StreamListResponse as StreamListResponse, + type StreamGetResponse as StreamGetResponse, + StreamListResponsesV4PagePaginationArray as StreamListResponsesV4PagePaginationArray, + type StreamCreateParams as StreamCreateParams, + type StreamUpdateParams as StreamUpdateParams, + type StreamListParams as StreamListParams, + type StreamDeleteParams as StreamDeleteParams, + type StreamGetParams as StreamGetParams, + }; +} diff --git a/src/resources/pipelines/sinks.ts b/src/resources/pipelines/sinks.ts new file mode 100644 index 0000000000..bc79abd008 --- /dev/null +++ b/src/resources/pipelines/sinks.ts @@ -0,0 +1,1610 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../resource'; +import * as Core from '../../core'; +import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../pagination'; + +export class Sinks extends APIResource { + /** + * Create a new Sink. + * + * @example + * ```ts + * const sink = await client.pipelines.sinks.create({ + * account_id: '0123105f4ecef8ad9ca31a8372d0c353', + * name: 'my_sink', + * type: 'r2', + * }); + * ``` + */ + create(params: SinkCreateParams, options?: Core.RequestOptions): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.post(`/accounts/${account_id}/pipelines/v1/sinks`, { + body, + ...options, + }) as Core.APIPromise<{ result: SinkCreateResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * List/Filter Sinks in Account. + * + * @example + * ```ts + * // Automatically fetches more pages as needed. + * for await (const sinkListResponse of client.pipelines.sinks.list( + * { account_id: '0123105f4ecef8ad9ca31a8372d0c353' }, + * )) { + * // ... + * } + * ``` + */ + list( + params: SinkListParams, + options?: Core.RequestOptions, + ): Core.PagePromise { + const { account_id, ...query } = params; + return this._client.getAPIList( + `/accounts/${account_id}/pipelines/v1/sinks`, + SinkListResponsesV4PagePaginationArray, + { query, ...options }, + ); + } + + /** + * Delete Pipeline in Account. + * + * @example + * ```ts + * await client.pipelines.sinks.delete( + * '0223105f4ecef8ad9ca31a8372d0c353', + * { account_id: '0123105f4ecef8ad9ca31a8372d0c353' }, + * ); + * ``` + */ + delete(sinkId: string, params: SinkDeleteParams, options?: Core.RequestOptions): Core.APIPromise { + const { account_id, force } = params; + return this._client.delete(`/accounts/${account_id}/pipelines/v1/sinks/${sinkId}`, { + query: { force }, + ...options, + headers: { Accept: '*/*', ...options?.headers }, + }); + } + + /** + * Get Sink Details. + * + * @example + * ```ts + * const sink = await client.pipelines.sinks.get( + * '0223105f4ecef8ad9ca31a8372d0c353', + * { account_id: '0123105f4ecef8ad9ca31a8372d0c353' }, + * ); + * ``` + */ + get( + sinkId: string, + params: SinkGetParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.get(`/accounts/${account_id}/pipelines/v1/sinks/${sinkId}`, options) as Core.APIPromise<{ + result: SinkGetResponse; + }> + )._thenUnwrap((obj) => obj.result); + } +} + +export class SinkListResponsesV4PagePaginationArray extends V4PagePaginationArray {} + +export interface SinkCreateResponse { + /** + * Indicates a unique identifier for this sink. + */ + id: string; + + created_at: string; + + modified_at: string; + + /** + * Defines the name of the Sink. + */ + name: string; + + /** + * Specifies the type of sink. + */ + type: 'r2' | 'r2_data_catalog'; + + /** + * R2 Data Catalog Sink + */ + config?: + | SinkCreateResponse.CloudflarePipelinesR2Table + | SinkCreateResponse.CloudflarePipelinesR2DataCatalogTable; + + format?: SinkCreateResponse.Json | SinkCreateResponse.Parquet; + + schema?: SinkCreateResponse.Schema; +} + +export namespace SinkCreateResponse { + export interface CloudflarePipelinesR2Table { + /** + * Cloudflare Account ID for the bucket + */ + account_id: string; + + /** + * R2 Bucket to write to + */ + bucket: string; + + credentials: CloudflarePipelinesR2Table.Credentials; + + /** + * Controls filename prefix/suffix and strategy. + */ + file_naming?: CloudflarePipelinesR2Table.FileNaming; + + /** + * Jurisdiction this bucket is hosted in + */ + jurisdiction?: string; + + /** + * Data-layout partitioning for sinks. + */ + partitioning?: CloudflarePipelinesR2Table.Partitioning; + + /** + * Subpath within the bucket to write to + */ + path?: string; + + /** + * Rolling policy for file sinks (when & why to close a file and open a new one). + */ + rolling_policy?: CloudflarePipelinesR2Table.RollingPolicy; + } + + export namespace CloudflarePipelinesR2Table { + export interface Credentials { + /** + * Cloudflare Account ID for the bucket + */ + access_key_id: string; + + /** + * Cloudflare Account ID for the bucket + */ + secret_access_key: string; + } + + /** + * Controls filename prefix/suffix and strategy. + */ + export interface FileNaming { + /** + * The prefix to use in file name. i.e prefix-.parquet + */ + prefix?: string; + + /** + * Filename generation strategy. + */ + strategy?: 'serial' | 'uuid' | 'uuid_v7' | 'ulid'; + + /** + * This will overwrite the default file suffix. i.e .parquet, use with caution + */ + suffix?: string; + } + + /** + * Data-layout partitioning for sinks. + */ + export interface Partitioning { + /** + * The pattern of the date string + */ + time_pattern?: string; + } + + /** + * Rolling policy for file sinks (when & why to close a file and open a new one). + */ + export interface RollingPolicy { + /** + * Files will be rolled after reaching this number of bytes + */ + file_size_bytes?: number; + + /** + * Number of seconds of inactivity to wait before rolling over to a new file + */ + inactivity_seconds?: number; + + /** + * Number of seconds to wait before rolling over to a new file + */ + interval_seconds?: number; + } + } + + /** + * R2 Data Catalog Sink + */ + export interface CloudflarePipelinesR2DataCatalogTable { + /** + * Authentication token + */ + token: string; + + /** + * Cloudflare Account ID + */ + account_id: string; + + /** + * The R2 Bucket that hosts this catalog + */ + bucket: string; + + /** + * Table name + */ + table_name: string; + + /** + * Table namespace + */ + namespace?: string; + + /** + * Rolling policy for file sinks (when & why to close a file and open a new one). + */ + rolling_policy?: CloudflarePipelinesR2DataCatalogTable.RollingPolicy; + } + + export namespace CloudflarePipelinesR2DataCatalogTable { + /** + * Rolling policy for file sinks (when & why to close a file and open a new one). + */ + export interface RollingPolicy { + /** + * Files will be rolled after reaching this number of bytes + */ + file_size_bytes?: number; + + /** + * Number of seconds of inactivity to wait before rolling over to a new file + */ + inactivity_seconds?: number; + + /** + * Number of seconds to wait before rolling over to a new file + */ + interval_seconds?: number; + } + } + + export interface Json { + type: 'json'; + + decimal_encoding?: 'number' | 'string' | 'bytes'; + + timestamp_format?: 'rfc3339' | 'unix_millis'; + + unstructured?: boolean; + } + + export interface Parquet { + type: 'parquet'; + + compression?: 'uncompressed' | 'snappy' | 'gzip' | 'zstd' | 'lz4'; + + row_group_bytes?: number | null; + } + + export interface Schema { + fields?: Array< + | Schema.Int32 + | Schema.Int64 + | Schema.Float32 + | Schema.Float64 + | Schema.Bool + | Schema.String + | Schema.Binary + | Schema.Timestamp + | Schema.Json + | Schema.Struct + | Schema.List + >; + + format?: Schema.Json | Schema.Parquet; + + inferred?: boolean | null; + } + + export namespace Schema { + export interface Int32 { + type: 'int32'; + + metadata_key?: string | null; + + name?: string; + + required?: boolean; + + sql_name?: string; + } + + export interface Int64 { + type: 'int64'; + + metadata_key?: string | null; + + name?: string; + + required?: boolean; + + sql_name?: string; + } + + export interface Float32 { + type: 'float32'; + + metadata_key?: string | null; + + name?: string; + + required?: boolean; + + sql_name?: string; + } + + export interface Float64 { + type: 'float64'; + + metadata_key?: string | null; + + name?: string; + + required?: boolean; + + sql_name?: string; + } + + export interface Bool { + type: 'bool'; + + metadata_key?: string | null; + + name?: string; + + required?: boolean; + + sql_name?: string; + } + + export interface String { + type: 'string'; + + metadata_key?: string | null; + + name?: string; + + required?: boolean; + + sql_name?: string; + } + + export interface Binary { + type: 'binary'; + + metadata_key?: string | null; + + name?: string; + + required?: boolean; + + sql_name?: string; + } + + export interface Timestamp { + type: 'timestamp'; + + metadata_key?: string | null; + + name?: string; + + required?: boolean; + + sql_name?: string; + + unit?: 'second' | 'millisecond' | 'microsecond' | 'nanosecond'; + } + + export interface Json { + type: 'json'; + + metadata_key?: string | null; + + name?: string; + + required?: boolean; + + sql_name?: string; + } + + export interface Struct {} + + export interface List {} + + export interface Json { + type: 'json'; + + decimal_encoding?: 'number' | 'string' | 'bytes'; + + timestamp_format?: 'rfc3339' | 'unix_millis'; + + unstructured?: boolean; + } + + export interface Parquet { + type: 'parquet'; + + compression?: 'uncompressed' | 'snappy' | 'gzip' | 'zstd' | 'lz4'; + + row_group_bytes?: number | null; + } + } +} + +export interface SinkListResponse { + /** + * Indicates a unique identifier for this sink. + */ + id: string; + + created_at: string; + + modified_at: string; + + /** + * Defines the name of the Sink. + */ + name: string; + + /** + * Specifies the type of sink. + */ + type: 'r2' | 'r2_data_catalog'; + + /** + * Defines the configuration of the R2 Sink. + */ + config?: + | SinkListResponse.CloudflarePipelinesR2Table + | SinkListResponse.CloudflarePipelinesR2DataCatalogTable; + + format?: SinkListResponse.Json | SinkListResponse.Parquet; + + schema?: SinkListResponse.Schema; +} + +export namespace SinkListResponse { + export interface CloudflarePipelinesR2Table { + /** + * Cloudflare Account ID for the bucket + */ + account_id: string; + + /** + * R2 Bucket to write to + */ + bucket: string; + + credentials: CloudflarePipelinesR2Table.Credentials; + + /** + * Controls filename prefix/suffix and strategy. + */ + file_naming?: CloudflarePipelinesR2Table.FileNaming; + + /** + * Jurisdiction this bucket is hosted in + */ + jurisdiction?: string; + + /** + * Data-layout partitioning for sinks. + */ + partitioning?: CloudflarePipelinesR2Table.Partitioning; + + /** + * Subpath within the bucket to write to + */ + path?: string; + + /** + * Rolling policy for file sinks (when & why to close a file and open a new one). + */ + rolling_policy?: CloudflarePipelinesR2Table.RollingPolicy; + } + + export namespace CloudflarePipelinesR2Table { + export interface Credentials { + /** + * Cloudflare Account ID for the bucket + */ + access_key_id: string; + + /** + * Cloudflare Account ID for the bucket + */ + secret_access_key: string; + } + + /** + * Controls filename prefix/suffix and strategy. + */ + export interface FileNaming { + /** + * The prefix to use in file name. i.e prefix-.parquet + */ + prefix?: string; + + /** + * Filename generation strategy. + */ + strategy?: 'serial' | 'uuid' | 'uuid_v7' | 'ulid'; + + /** + * This will overwrite the default file suffix. i.e .parquet, use with caution + */ + suffix?: string; + } + + /** + * Data-layout partitioning for sinks. + */ + export interface Partitioning { + /** + * The pattern of the date string + */ + time_pattern?: string; + } + + /** + * Rolling policy for file sinks (when & why to close a file and open a new one). + */ + export interface RollingPolicy { + /** + * Files will be rolled after reaching this number of bytes + */ + file_size_bytes?: number; + + /** + * Number of seconds of inactivity to wait before rolling over to a new file + */ + inactivity_seconds?: number; + + /** + * Number of seconds to wait before rolling over to a new file + */ + interval_seconds?: number; + } + } + + /** + * R2 Data Catalog Sink + */ + export interface CloudflarePipelinesR2DataCatalogTable { + /** + * Authentication token + */ + token: string; + + /** + * Cloudflare Account ID + */ + account_id: string; + + /** + * The R2 Bucket that hosts this catalog + */ + bucket: string; + + /** + * Table name + */ + table_name: string; + + /** + * Table namespace + */ + namespace?: string; + + /** + * Rolling policy for file sinks (when & why to close a file and open a new one). + */ + rolling_policy?: CloudflarePipelinesR2DataCatalogTable.RollingPolicy; + } + + export namespace CloudflarePipelinesR2DataCatalogTable { + /** + * Rolling policy for file sinks (when & why to close a file and open a new one). + */ + export interface RollingPolicy { + /** + * Files will be rolled after reaching this number of bytes + */ + file_size_bytes?: number; + + /** + * Number of seconds of inactivity to wait before rolling over to a new file + */ + inactivity_seconds?: number; + + /** + * Number of seconds to wait before rolling over to a new file + */ + interval_seconds?: number; + } + } + + export interface Json { + type: 'json'; + + decimal_encoding?: 'number' | 'string' | 'bytes'; + + timestamp_format?: 'rfc3339' | 'unix_millis'; + + unstructured?: boolean; + } + + export interface Parquet { + type: 'parquet'; + + compression?: 'uncompressed' | 'snappy' | 'gzip' | 'zstd' | 'lz4'; + + row_group_bytes?: number | null; + } + + export interface Schema { + fields?: Array< + | Schema.Int32 + | Schema.Int64 + | Schema.Float32 + | Schema.Float64 + | Schema.Bool + | Schema.String + | Schema.Binary + | Schema.Timestamp + | Schema.Json + | Schema.Struct + | Schema.List + >; + + format?: Schema.Json | Schema.Parquet; + + inferred?: boolean | null; + } + + export namespace Schema { + export interface Int32 { + type: 'int32'; + + metadata_key?: string | null; + + name?: string; + + required?: boolean; + + sql_name?: string; + } + + export interface Int64 { + type: 'int64'; + + metadata_key?: string | null; + + name?: string; + + required?: boolean; + + sql_name?: string; + } + + export interface Float32 { + type: 'float32'; + + metadata_key?: string | null; + + name?: string; + + required?: boolean; + + sql_name?: string; + } + + export interface Float64 { + type: 'float64'; + + metadata_key?: string | null; + + name?: string; + + required?: boolean; + + sql_name?: string; + } + + export interface Bool { + type: 'bool'; + + metadata_key?: string | null; + + name?: string; + + required?: boolean; + + sql_name?: string; + } + + export interface String { + type: 'string'; + + metadata_key?: string | null; + + name?: string; + + required?: boolean; + + sql_name?: string; + } + + export interface Binary { + type: 'binary'; + + metadata_key?: string | null; + + name?: string; + + required?: boolean; + + sql_name?: string; + } + + export interface Timestamp { + type: 'timestamp'; + + metadata_key?: string | null; + + name?: string; + + required?: boolean; + + sql_name?: string; + + unit?: 'second' | 'millisecond' | 'microsecond' | 'nanosecond'; + } + + export interface Json { + type: 'json'; + + metadata_key?: string | null; + + name?: string; + + required?: boolean; + + sql_name?: string; + } + + export interface Struct {} + + export interface List {} + + export interface Json { + type: 'json'; + + decimal_encoding?: 'number' | 'string' | 'bytes'; + + timestamp_format?: 'rfc3339' | 'unix_millis'; + + unstructured?: boolean; + } + + export interface Parquet { + type: 'parquet'; + + compression?: 'uncompressed' | 'snappy' | 'gzip' | 'zstd' | 'lz4'; + + row_group_bytes?: number | null; + } + } +} + +export interface SinkGetResponse { + /** + * Indicates a unique identifier for this sink. + */ + id: string; + + created_at: string; + + modified_at: string; + + /** + * Defines the name of the Sink. + */ + name: string; + + /** + * Specifies the type of sink. + */ + type: 'r2' | 'r2_data_catalog'; + + /** + * Defines the configuration of the R2 Sink. + */ + config?: SinkGetResponse.CloudflarePipelinesR2Table | SinkGetResponse.CloudflarePipelinesR2DataCatalogTable; + + format?: SinkGetResponse.Json | SinkGetResponse.Parquet; + + schema?: SinkGetResponse.Schema; +} + +export namespace SinkGetResponse { + export interface CloudflarePipelinesR2Table { + /** + * Cloudflare Account ID for the bucket + */ + account_id: string; + + /** + * R2 Bucket to write to + */ + bucket: string; + + credentials: CloudflarePipelinesR2Table.Credentials; + + /** + * Controls filename prefix/suffix and strategy. + */ + file_naming?: CloudflarePipelinesR2Table.FileNaming; + + /** + * Jurisdiction this bucket is hosted in + */ + jurisdiction?: string; + + /** + * Data-layout partitioning for sinks. + */ + partitioning?: CloudflarePipelinesR2Table.Partitioning; + + /** + * Subpath within the bucket to write to + */ + path?: string; + + /** + * Rolling policy for file sinks (when & why to close a file and open a new one). + */ + rolling_policy?: CloudflarePipelinesR2Table.RollingPolicy; + } + + export namespace CloudflarePipelinesR2Table { + export interface Credentials { + /** + * Cloudflare Account ID for the bucket + */ + access_key_id: string; + + /** + * Cloudflare Account ID for the bucket + */ + secret_access_key: string; + } + + /** + * Controls filename prefix/suffix and strategy. + */ + export interface FileNaming { + /** + * The prefix to use in file name. i.e prefix-.parquet + */ + prefix?: string; + + /** + * Filename generation strategy. + */ + strategy?: 'serial' | 'uuid' | 'uuid_v7' | 'ulid'; + + /** + * This will overwrite the default file suffix. i.e .parquet, use with caution + */ + suffix?: string; + } + + /** + * Data-layout partitioning for sinks. + */ + export interface Partitioning { + /** + * The pattern of the date string + */ + time_pattern?: string; + } + + /** + * Rolling policy for file sinks (when & why to close a file and open a new one). + */ + export interface RollingPolicy { + /** + * Files will be rolled after reaching this number of bytes + */ + file_size_bytes?: number; + + /** + * Number of seconds of inactivity to wait before rolling over to a new file + */ + inactivity_seconds?: number; + + /** + * Number of seconds to wait before rolling over to a new file + */ + interval_seconds?: number; + } + } + + /** + * R2 Data Catalog Sink + */ + export interface CloudflarePipelinesR2DataCatalogTable { + /** + * Authentication token + */ + token: string; + + /** + * Cloudflare Account ID + */ + account_id: string; + + /** + * The R2 Bucket that hosts this catalog + */ + bucket: string; + + /** + * Table name + */ + table_name: string; + + /** + * Table namespace + */ + namespace?: string; + + /** + * Rolling policy for file sinks (when & why to close a file and open a new one). + */ + rolling_policy?: CloudflarePipelinesR2DataCatalogTable.RollingPolicy; + } + + export namespace CloudflarePipelinesR2DataCatalogTable { + /** + * Rolling policy for file sinks (when & why to close a file and open a new one). + */ + export interface RollingPolicy { + /** + * Files will be rolled after reaching this number of bytes + */ + file_size_bytes?: number; + + /** + * Number of seconds of inactivity to wait before rolling over to a new file + */ + inactivity_seconds?: number; + + /** + * Number of seconds to wait before rolling over to a new file + */ + interval_seconds?: number; + } + } + + export interface Json { + type: 'json'; + + decimal_encoding?: 'number' | 'string' | 'bytes'; + + timestamp_format?: 'rfc3339' | 'unix_millis'; + + unstructured?: boolean; + } + + export interface Parquet { + type: 'parquet'; + + compression?: 'uncompressed' | 'snappy' | 'gzip' | 'zstd' | 'lz4'; + + row_group_bytes?: number | null; + } + + export interface Schema { + fields?: Array< + | Schema.Int32 + | Schema.Int64 + | Schema.Float32 + | Schema.Float64 + | Schema.Bool + | Schema.String + | Schema.Binary + | Schema.Timestamp + | Schema.Json + | Schema.Struct + | Schema.List + >; + + format?: Schema.Json | Schema.Parquet; + + inferred?: boolean | null; + } + + export namespace Schema { + export interface Int32 { + type: 'int32'; + + metadata_key?: string | null; + + name?: string; + + required?: boolean; + + sql_name?: string; + } + + export interface Int64 { + type: 'int64'; + + metadata_key?: string | null; + + name?: string; + + required?: boolean; + + sql_name?: string; + } + + export interface Float32 { + type: 'float32'; + + metadata_key?: string | null; + + name?: string; + + required?: boolean; + + sql_name?: string; + } + + export interface Float64 { + type: 'float64'; + + metadata_key?: string | null; + + name?: string; + + required?: boolean; + + sql_name?: string; + } + + export interface Bool { + type: 'bool'; + + metadata_key?: string | null; + + name?: string; + + required?: boolean; + + sql_name?: string; + } + + export interface String { + type: 'string'; + + metadata_key?: string | null; + + name?: string; + + required?: boolean; + + sql_name?: string; + } + + export interface Binary { + type: 'binary'; + + metadata_key?: string | null; + + name?: string; + + required?: boolean; + + sql_name?: string; + } + + export interface Timestamp { + type: 'timestamp'; + + metadata_key?: string | null; + + name?: string; + + required?: boolean; + + sql_name?: string; + + unit?: 'second' | 'millisecond' | 'microsecond' | 'nanosecond'; + } + + export interface Json { + type: 'json'; + + metadata_key?: string | null; + + name?: string; + + required?: boolean; + + sql_name?: string; + } + + export interface Struct {} + + export interface List {} + + export interface Json { + type: 'json'; + + decimal_encoding?: 'number' | 'string' | 'bytes'; + + timestamp_format?: 'rfc3339' | 'unix_millis'; + + unstructured?: boolean; + } + + export interface Parquet { + type: 'parquet'; + + compression?: 'uncompressed' | 'snappy' | 'gzip' | 'zstd' | 'lz4'; + + row_group_bytes?: number | null; + } + } +} + +export interface SinkCreateParams { + /** + * Path param: Specifies the public ID of the account. + */ + account_id: string; + + /** + * Body param: Defines the name of the Sink. + */ + name: string; + + /** + * Body param: Specifies the type of sink. + */ + type: 'r2' | 'r2_data_catalog'; + + /** + * Body param: Defines the configuration of the R2 Sink. + */ + config?: + | SinkCreateParams.CloudflarePipelinesR2Table + | SinkCreateParams.CloudflarePipelinesR2DataCatalogTable; + + /** + * Body param: + */ + format?: SinkCreateParams.Json | SinkCreateParams.Parquet; + + /** + * Body param: + */ + schema?: SinkCreateParams.Schema; +} + +export namespace SinkCreateParams { + export interface CloudflarePipelinesR2Table { + /** + * Cloudflare Account ID for the bucket + */ + account_id: string; + + /** + * R2 Bucket to write to + */ + bucket: string; + + credentials: CloudflarePipelinesR2Table.Credentials; + + /** + * Controls filename prefix/suffix and strategy. + */ + file_naming?: CloudflarePipelinesR2Table.FileNaming; + + /** + * Jurisdiction this bucket is hosted in + */ + jurisdiction?: string; + + /** + * Data-layout partitioning for sinks. + */ + partitioning?: CloudflarePipelinesR2Table.Partitioning; + + /** + * Subpath within the bucket to write to + */ + path?: string; + + /** + * Rolling policy for file sinks (when & why to close a file and open a new one). + */ + rolling_policy?: CloudflarePipelinesR2Table.RollingPolicy; + } + + export namespace CloudflarePipelinesR2Table { + export interface Credentials { + /** + * Cloudflare Account ID for the bucket + */ + access_key_id: string; + + /** + * Cloudflare Account ID for the bucket + */ + secret_access_key: string; + } + + /** + * Controls filename prefix/suffix and strategy. + */ + export interface FileNaming { + /** + * The prefix to use in file name. i.e prefix-.parquet + */ + prefix?: string; + + /** + * Filename generation strategy. + */ + strategy?: 'serial' | 'uuid' | 'uuid_v7' | 'ulid'; + + /** + * This will overwrite the default file suffix. i.e .parquet, use with caution + */ + suffix?: string; + } + + /** + * Data-layout partitioning for sinks. + */ + export interface Partitioning { + /** + * The pattern of the date string + */ + time_pattern?: string; + } + + /** + * Rolling policy for file sinks (when & why to close a file and open a new one). + */ + export interface RollingPolicy { + /** + * Files will be rolled after reaching this number of bytes + */ + file_size_bytes?: number; + + /** + * Number of seconds of inactivity to wait before rolling over to a new file + */ + inactivity_seconds?: number; + + /** + * Number of seconds to wait before rolling over to a new file + */ + interval_seconds?: number; + } + } + + /** + * R2 Data Catalog Sink + */ + export interface CloudflarePipelinesR2DataCatalogTable { + /** + * Authentication token + */ + token: string; + + /** + * Cloudflare Account ID + */ + account_id: string; + + /** + * The R2 Bucket that hosts this catalog + */ + bucket: string; + + /** + * Table name + */ + table_name: string; + + /** + * Table namespace + */ + namespace?: string; + + /** + * Rolling policy for file sinks (when & why to close a file and open a new one). + */ + rolling_policy?: CloudflarePipelinesR2DataCatalogTable.RollingPolicy; + } + + export namespace CloudflarePipelinesR2DataCatalogTable { + /** + * Rolling policy for file sinks (when & why to close a file and open a new one). + */ + export interface RollingPolicy { + /** + * Files will be rolled after reaching this number of bytes + */ + file_size_bytes?: number; + + /** + * Number of seconds of inactivity to wait before rolling over to a new file + */ + inactivity_seconds?: number; + + /** + * Number of seconds to wait before rolling over to a new file + */ + interval_seconds?: number; + } + } + + export interface Json { + type: 'json'; + + decimal_encoding?: 'number' | 'string' | 'bytes'; + + timestamp_format?: 'rfc3339' | 'unix_millis'; + + unstructured?: boolean; + } + + export interface Parquet { + type: 'parquet'; + + compression?: 'uncompressed' | 'snappy' | 'gzip' | 'zstd' | 'lz4'; + + row_group_bytes?: number | null; + } + + export interface Schema { + fields?: Array< + | Schema.Int32 + | Schema.Int64 + | Schema.Float32 + | Schema.Float64 + | Schema.Bool + | Schema.String + | Schema.Binary + | Schema.Timestamp + | Schema.Json + | Schema.Struct + | Schema.List + >; + + format?: Schema.Json | Schema.Parquet; + + inferred?: boolean | null; + } + + export namespace Schema { + export interface Int32 { + type: 'int32'; + + metadata_key?: string | null; + + name?: string; + + required?: boolean; + + sql_name?: string; + } + + export interface Int64 { + type: 'int64'; + + metadata_key?: string | null; + + name?: string; + + required?: boolean; + + sql_name?: string; + } + + export interface Float32 { + type: 'float32'; + + metadata_key?: string | null; + + name?: string; + + required?: boolean; + + sql_name?: string; + } + + export interface Float64 { + type: 'float64'; + + metadata_key?: string | null; + + name?: string; + + required?: boolean; + + sql_name?: string; + } + + export interface Bool { + type: 'bool'; + + metadata_key?: string | null; + + name?: string; + + required?: boolean; + + sql_name?: string; + } + + export interface String { + type: 'string'; + + metadata_key?: string | null; + + name?: string; + + required?: boolean; + + sql_name?: string; + } + + export interface Binary { + type: 'binary'; + + metadata_key?: string | null; + + name?: string; + + required?: boolean; + + sql_name?: string; + } + + export interface Timestamp { + type: 'timestamp'; + + metadata_key?: string | null; + + name?: string; + + required?: boolean; + + sql_name?: string; + + unit?: 'second' | 'millisecond' | 'microsecond' | 'nanosecond'; + } + + export interface Json { + type: 'json'; + + metadata_key?: string | null; + + name?: string; + + required?: boolean; + + sql_name?: string; + } + + export interface Struct {} + + export interface List {} + + export interface Json { + type: 'json'; + + decimal_encoding?: 'number' | 'string' | 'bytes'; + + timestamp_format?: 'rfc3339' | 'unix_millis'; + + unstructured?: boolean; + } + + export interface Parquet { + type: 'parquet'; + + compression?: 'uncompressed' | 'snappy' | 'gzip' | 'zstd' | 'lz4'; + + row_group_bytes?: number | null; + } + } +} + +export interface SinkListParams extends V4PagePaginationArrayParams { + /** + * Path param: Specifies the public ID of the account. + */ + account_id: string; + + /** + * Query param: + */ + pipeline_id?: string; +} + +export interface SinkDeleteParams { + /** + * Path param: Specifies the public ID of the account. + */ + account_id: string; + + /** + * Query param: Delete sink forcefully, including deleting any dependent pipelines. + */ + force?: string; +} + +export interface SinkGetParams { + /** + * Specifies the public ID of the account. + */ + account_id: string; +} + +Sinks.SinkListResponsesV4PagePaginationArray = SinkListResponsesV4PagePaginationArray; + +export declare namespace Sinks { + export { + type SinkCreateResponse as SinkCreateResponse, + type SinkListResponse as SinkListResponse, + type SinkGetResponse as SinkGetResponse, + SinkListResponsesV4PagePaginationArray as SinkListResponsesV4PagePaginationArray, + type SinkCreateParams as SinkCreateParams, + type SinkListParams as SinkListParams, + type SinkDeleteParams as SinkDeleteParams, + type SinkGetParams as SinkGetParams, + }; +} diff --git a/src/resources/pipelines/streams.ts b/src/resources/pipelines/streams.ts new file mode 100644 index 0000000000..8c0537e878 --- /dev/null +++ b/src/resources/pipelines/streams.ts @@ -0,0 +1,1273 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../resource'; +import * as Core from '../../core'; +import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../pagination'; + +export class Streams extends APIResource { + /** + * Create a new Stream. + * + * @example + * ```ts + * const stream = await client.pipelines.streams.create({ + * account_id: '0123105f4ecef8ad9ca31a8372d0c353', + * name: 'my_stream', + * }); + * ``` + */ + create(params: StreamCreateParams, options?: Core.RequestOptions): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.post(`/accounts/${account_id}/pipelines/v1/streams`, { + body, + ...options, + }) as Core.APIPromise<{ result: StreamCreateResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Update a Stream. + * + * @example + * ```ts + * const stream = await client.pipelines.streams.update( + * '033e105f4ecef8ad9ca31a8372d0c353', + * { account_id: '0123105f4ecef8ad9ca31a8372d0c353' }, + * ); + * ``` + */ + update( + streamId: string, + params: StreamUpdateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.patch(`/accounts/${account_id}/pipelines/v1/streams/${streamId}`, { + body, + ...options, + }) as Core.APIPromise<{ result: StreamUpdateResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * List/Filter Streams in Account. + * + * @example + * ```ts + * // Automatically fetches more pages as needed. + * for await (const streamListResponse of client.pipelines.streams.list( + * { account_id: '0123105f4ecef8ad9ca31a8372d0c353' }, + * )) { + * // ... + * } + * ``` + */ + list( + params: StreamListParams, + options?: Core.RequestOptions, + ): Core.PagePromise { + const { account_id, ...query } = params; + return this._client.getAPIList( + `/accounts/${account_id}/pipelines/v1/streams`, + StreamListResponsesV4PagePaginationArray, + { query, ...options }, + ); + } + + /** + * Delete Stream in Account. + * + * @example + * ```ts + * await client.pipelines.streams.delete( + * '033e105f4ecef8ad9ca31a8372d0c353', + * { account_id: '0123105f4ecef8ad9ca31a8372d0c353' }, + * ); + * ``` + */ + delete(streamId: string, params: StreamDeleteParams, options?: Core.RequestOptions): Core.APIPromise { + const { account_id, force } = params; + return this._client.delete(`/accounts/${account_id}/pipelines/v1/streams/${streamId}`, { + query: { force }, + ...options, + headers: { Accept: '*/*', ...options?.headers }, + }); + } + + /** + * Get Stream Details. + * + * @example + * ```ts + * const stream = await client.pipelines.streams.get( + * '033e105f4ecef8ad9ca31a8372d0c353', + * { account_id: '0123105f4ecef8ad9ca31a8372d0c353' }, + * ); + * ``` + */ + get( + streamId: string, + params: StreamGetParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.get( + `/accounts/${account_id}/pipelines/v1/streams/${streamId}`, + options, + ) as Core.APIPromise<{ result: StreamGetResponse }> + )._thenUnwrap((obj) => obj.result); + } +} + +export class StreamListResponsesV4PagePaginationArray extends V4PagePaginationArray {} + +export interface StreamCreateResponse { + /** + * Indicates a unique identifier for this stream. + */ + id: string; + + created_at: string; + + http: StreamCreateResponse.HTTP; + + modified_at: string; + + /** + * Indicates the name of the Stream. + */ + name: string; + + /** + * Indicates the current version of this stream. + */ + version: number; + + worker_binding: StreamCreateResponse.WorkerBinding; + + /** + * Indicates the endpoint URL of this stream. + */ + endpoint?: string; + + format?: StreamCreateResponse.Json | StreamCreateResponse.Parquet; + + schema?: StreamCreateResponse.Schema; +} + +export namespace StreamCreateResponse { + export interface HTTP { + /** + * Indicates that authentication is required for the HTTP endpoint. + */ + authentication: boolean; + + /** + * Indicates that the HTTP endpoint is enabled. + */ + enabled: boolean; + + /** + * Specifies the CORS options for the HTTP endpoint. + */ + cors?: HTTP.CORS; + } + + export namespace HTTP { + /** + * Specifies the CORS options for the HTTP endpoint. + */ + export interface CORS { + origins?: Array; + } + } + + export interface WorkerBinding { + /** + * Indicates that the worker binding is enabled. + */ + enabled: boolean; + } + + export interface Json { + type: 'json'; + + decimal_encoding?: 'number' | 'string' | 'bytes'; + + timestamp_format?: 'rfc3339' | 'unix_millis'; + + unstructured?: boolean; + } + + export interface Parquet { + type: 'parquet'; + + compression?: 'uncompressed' | 'snappy' | 'gzip' | 'zstd' | 'lz4'; + + row_group_bytes?: number | null; + } + + export interface Schema { + fields?: Array< + | Schema.Int32 + | Schema.Int64 + | Schema.Float32 + | Schema.Float64 + | Schema.Bool + | Schema.String + | Schema.Binary + | Schema.Timestamp + | Schema.Json + | Schema.Struct + | Schema.List + >; + + format?: Schema.Json | Schema.Parquet; + + inferred?: boolean | null; + } + + export namespace Schema { + export interface Int32 { + type: 'int32'; + + metadata_key?: string | null; + + name?: string; + + required?: boolean; + + sql_name?: string; + } + + export interface Int64 { + type: 'int64'; + + metadata_key?: string | null; + + name?: string; + + required?: boolean; + + sql_name?: string; + } + + export interface Float32 { + type: 'float32'; + + metadata_key?: string | null; + + name?: string; + + required?: boolean; + + sql_name?: string; + } + + export interface Float64 { + type: 'float64'; + + metadata_key?: string | null; + + name?: string; + + required?: boolean; + + sql_name?: string; + } + + export interface Bool { + type: 'bool'; + + metadata_key?: string | null; + + name?: string; + + required?: boolean; + + sql_name?: string; + } + + export interface String { + type: 'string'; + + metadata_key?: string | null; + + name?: string; + + required?: boolean; + + sql_name?: string; + } + + export interface Binary { + type: 'binary'; + + metadata_key?: string | null; + + name?: string; + + required?: boolean; + + sql_name?: string; + } + + export interface Timestamp { + type: 'timestamp'; + + metadata_key?: string | null; + + name?: string; + + required?: boolean; + + sql_name?: string; + + unit?: 'second' | 'millisecond' | 'microsecond' | 'nanosecond'; + } + + export interface Json { + type: 'json'; + + metadata_key?: string | null; + + name?: string; + + required?: boolean; + + sql_name?: string; + } + + export interface Struct {} + + export interface List {} + + export interface Json { + type: 'json'; + + decimal_encoding?: 'number' | 'string' | 'bytes'; + + timestamp_format?: 'rfc3339' | 'unix_millis'; + + unstructured?: boolean; + } + + export interface Parquet { + type: 'parquet'; + + compression?: 'uncompressed' | 'snappy' | 'gzip' | 'zstd' | 'lz4'; + + row_group_bytes?: number | null; + } + } +} + +export interface StreamUpdateResponse { + /** + * Indicates a unique identifier for this stream. + */ + id: string; + + created_at: string; + + http: StreamUpdateResponse.HTTP; + + modified_at: string; + + /** + * Indicates the name of the Stream. + */ + name: string; + + /** + * Indicates the current version of this stream. + */ + version: number; + + worker_binding: StreamUpdateResponse.WorkerBinding; + + /** + * Indicates the endpoint URL of this stream. + */ + endpoint?: string; + + format?: StreamUpdateResponse.Json | StreamUpdateResponse.Parquet; +} + +export namespace StreamUpdateResponse { + export interface HTTP { + /** + * Indicates that authentication is required for the HTTP endpoint. + */ + authentication: boolean; + + /** + * Indicates that the HTTP endpoint is enabled. + */ + enabled: boolean; + + /** + * Specifies the CORS options for the HTTP endpoint. + */ + cors?: HTTP.CORS; + } + + export namespace HTTP { + /** + * Specifies the CORS options for the HTTP endpoint. + */ + export interface CORS { + origins?: Array; + } + } + + export interface WorkerBinding { + /** + * Indicates that the worker binding is enabled. + */ + enabled: boolean; + } + + export interface Json { + type: 'json'; + + decimal_encoding?: 'number' | 'string' | 'bytes'; + + timestamp_format?: 'rfc3339' | 'unix_millis'; + + unstructured?: boolean; + } + + export interface Parquet { + type: 'parquet'; + + compression?: 'uncompressed' | 'snappy' | 'gzip' | 'zstd' | 'lz4'; + + row_group_bytes?: number | null; + } +} + +export interface StreamListResponse { + /** + * Indicates a unique identifier for this stream. + */ + id: string; + + created_at: string; + + http: StreamListResponse.HTTP; + + modified_at: string; + + /** + * Indicates the name of the Stream. + */ + name: string; + + /** + * Indicates the current version of this stream. + */ + version: number; + + worker_binding: StreamListResponse.WorkerBinding; + + /** + * Indicates the endpoint URL of this stream. + */ + endpoint?: string; + + format?: StreamListResponse.Json | StreamListResponse.Parquet; + + schema?: StreamListResponse.Schema; +} + +export namespace StreamListResponse { + export interface HTTP { + /** + * Indicates that authentication is required for the HTTP endpoint. + */ + authentication: boolean; + + /** + * Indicates that the HTTP endpoint is enabled. + */ + enabled: boolean; + + /** + * Specifies the CORS options for the HTTP endpoint. + */ + cors?: HTTP.CORS; + } + + export namespace HTTP { + /** + * Specifies the CORS options for the HTTP endpoint. + */ + export interface CORS { + origins?: Array; + } + } + + export interface WorkerBinding { + /** + * Indicates that the worker binding is enabled. + */ + enabled: boolean; + } + + export interface Json { + type: 'json'; + + decimal_encoding?: 'number' | 'string' | 'bytes'; + + timestamp_format?: 'rfc3339' | 'unix_millis'; + + unstructured?: boolean; + } + + export interface Parquet { + type: 'parquet'; + + compression?: 'uncompressed' | 'snappy' | 'gzip' | 'zstd' | 'lz4'; + + row_group_bytes?: number | null; + } + + export interface Schema { + fields?: Array< + | Schema.Int32 + | Schema.Int64 + | Schema.Float32 + | Schema.Float64 + | Schema.Bool + | Schema.String + | Schema.Binary + | Schema.Timestamp + | Schema.Json + | Schema.Struct + | Schema.List + >; + + format?: Schema.Json | Schema.Parquet; + + inferred?: boolean | null; + } + + export namespace Schema { + export interface Int32 { + type: 'int32'; + + metadata_key?: string | null; + + name?: string; + + required?: boolean; + + sql_name?: string; + } + + export interface Int64 { + type: 'int64'; + + metadata_key?: string | null; + + name?: string; + + required?: boolean; + + sql_name?: string; + } + + export interface Float32 { + type: 'float32'; + + metadata_key?: string | null; + + name?: string; + + required?: boolean; + + sql_name?: string; + } + + export interface Float64 { + type: 'float64'; + + metadata_key?: string | null; + + name?: string; + + required?: boolean; + + sql_name?: string; + } + + export interface Bool { + type: 'bool'; + + metadata_key?: string | null; + + name?: string; + + required?: boolean; + + sql_name?: string; + } + + export interface String { + type: 'string'; + + metadata_key?: string | null; + + name?: string; + + required?: boolean; + + sql_name?: string; + } + + export interface Binary { + type: 'binary'; + + metadata_key?: string | null; + + name?: string; + + required?: boolean; + + sql_name?: string; + } + + export interface Timestamp { + type: 'timestamp'; + + metadata_key?: string | null; + + name?: string; + + required?: boolean; + + sql_name?: string; + + unit?: 'second' | 'millisecond' | 'microsecond' | 'nanosecond'; + } + + export interface Json { + type: 'json'; + + metadata_key?: string | null; + + name?: string; + + required?: boolean; + + sql_name?: string; + } + + export interface Struct {} + + export interface List {} + + export interface Json { + type: 'json'; + + decimal_encoding?: 'number' | 'string' | 'bytes'; + + timestamp_format?: 'rfc3339' | 'unix_millis'; + + unstructured?: boolean; + } + + export interface Parquet { + type: 'parquet'; + + compression?: 'uncompressed' | 'snappy' | 'gzip' | 'zstd' | 'lz4'; + + row_group_bytes?: number | null; + } + } +} + +export interface StreamGetResponse { + /** + * Indicates a unique identifier for this stream. + */ + id: string; + + created_at: string; + + http: StreamGetResponse.HTTP; + + modified_at: string; + + /** + * Indicates the name of the Stream. + */ + name: string; + + /** + * Indicates the current version of this stream. + */ + version: number; + + worker_binding: StreamGetResponse.WorkerBinding; + + /** + * Indicates the endpoint URL of this stream. + */ + endpoint?: string; + + format?: StreamGetResponse.Json | StreamGetResponse.Parquet; + + schema?: StreamGetResponse.Schema; +} + +export namespace StreamGetResponse { + export interface HTTP { + /** + * Indicates that authentication is required for the HTTP endpoint. + */ + authentication: boolean; + + /** + * Indicates that the HTTP endpoint is enabled. + */ + enabled: boolean; + + /** + * Specifies the CORS options for the HTTP endpoint. + */ + cors?: HTTP.CORS; + } + + export namespace HTTP { + /** + * Specifies the CORS options for the HTTP endpoint. + */ + export interface CORS { + origins?: Array; + } + } + + export interface WorkerBinding { + /** + * Indicates that the worker binding is enabled. + */ + enabled: boolean; + } + + export interface Json { + type: 'json'; + + decimal_encoding?: 'number' | 'string' | 'bytes'; + + timestamp_format?: 'rfc3339' | 'unix_millis'; + + unstructured?: boolean; + } + + export interface Parquet { + type: 'parquet'; + + compression?: 'uncompressed' | 'snappy' | 'gzip' | 'zstd' | 'lz4'; + + row_group_bytes?: number | null; + } + + export interface Schema { + fields?: Array< + | Schema.Int32 + | Schema.Int64 + | Schema.Float32 + | Schema.Float64 + | Schema.Bool + | Schema.String + | Schema.Binary + | Schema.Timestamp + | Schema.Json + | Schema.Struct + | Schema.List + >; + + format?: Schema.Json | Schema.Parquet; + + inferred?: boolean | null; + } + + export namespace Schema { + export interface Int32 { + type: 'int32'; + + metadata_key?: string | null; + + name?: string; + + required?: boolean; + + sql_name?: string; + } + + export interface Int64 { + type: 'int64'; + + metadata_key?: string | null; + + name?: string; + + required?: boolean; + + sql_name?: string; + } + + export interface Float32 { + type: 'float32'; + + metadata_key?: string | null; + + name?: string; + + required?: boolean; + + sql_name?: string; + } + + export interface Float64 { + type: 'float64'; + + metadata_key?: string | null; + + name?: string; + + required?: boolean; + + sql_name?: string; + } + + export interface Bool { + type: 'bool'; + + metadata_key?: string | null; + + name?: string; + + required?: boolean; + + sql_name?: string; + } + + export interface String { + type: 'string'; + + metadata_key?: string | null; + + name?: string; + + required?: boolean; + + sql_name?: string; + } + + export interface Binary { + type: 'binary'; + + metadata_key?: string | null; + + name?: string; + + required?: boolean; + + sql_name?: string; + } + + export interface Timestamp { + type: 'timestamp'; + + metadata_key?: string | null; + + name?: string; + + required?: boolean; + + sql_name?: string; + + unit?: 'second' | 'millisecond' | 'microsecond' | 'nanosecond'; + } + + export interface Json { + type: 'json'; + + metadata_key?: string | null; + + name?: string; + + required?: boolean; + + sql_name?: string; + } + + export interface Struct {} + + export interface List {} + + export interface Json { + type: 'json'; + + decimal_encoding?: 'number' | 'string' | 'bytes'; + + timestamp_format?: 'rfc3339' | 'unix_millis'; + + unstructured?: boolean; + } + + export interface Parquet { + type: 'parquet'; + + compression?: 'uncompressed' | 'snappy' | 'gzip' | 'zstd' | 'lz4'; + + row_group_bytes?: number | null; + } + } +} + +export interface StreamCreateParams { + /** + * Path param: Specifies the public ID of the account. + */ + account_id: string; + + /** + * Body param: Specifies the name of the Stream. + */ + name: string; + + /** + * Body param: + */ + format?: StreamCreateParams.Json | StreamCreateParams.Parquet; + + /** + * Body param: + */ + http?: StreamCreateParams.HTTP; + + /** + * Body param: + */ + schema?: StreamCreateParams.Schema; + + /** + * Body param: + */ + worker_binding?: StreamCreateParams.WorkerBinding; +} + +export namespace StreamCreateParams { + export interface Json { + type: 'json'; + + decimal_encoding?: 'number' | 'string' | 'bytes'; + + timestamp_format?: 'rfc3339' | 'unix_millis'; + + unstructured?: boolean; + } + + export interface Parquet { + type: 'parquet'; + + compression?: 'uncompressed' | 'snappy' | 'gzip' | 'zstd' | 'lz4'; + + row_group_bytes?: number | null; + } + + export interface HTTP { + /** + * Indicates that authentication is required for the HTTP endpoint. + */ + authentication: boolean; + + /** + * Indicates that the HTTP endpoint is enabled. + */ + enabled: boolean; + + /** + * Specifies the CORS options for the HTTP endpoint. + */ + cors?: HTTP.CORS; + } + + export namespace HTTP { + /** + * Specifies the CORS options for the HTTP endpoint. + */ + export interface CORS { + origins?: Array; + } + } + + export interface Schema { + fields?: Array< + | Schema.Int32 + | Schema.Int64 + | Schema.Float32 + | Schema.Float64 + | Schema.Bool + | Schema.String + | Schema.Binary + | Schema.Timestamp + | Schema.Json + | Schema.Struct + | Schema.List + >; + + format?: Schema.Json | Schema.Parquet; + + inferred?: boolean | null; + } + + export namespace Schema { + export interface Int32 { + type: 'int32'; + + metadata_key?: string | null; + + name?: string; + + required?: boolean; + + sql_name?: string; + } + + export interface Int64 { + type: 'int64'; + + metadata_key?: string | null; + + name?: string; + + required?: boolean; + + sql_name?: string; + } + + export interface Float32 { + type: 'float32'; + + metadata_key?: string | null; + + name?: string; + + required?: boolean; + + sql_name?: string; + } + + export interface Float64 { + type: 'float64'; + + metadata_key?: string | null; + + name?: string; + + required?: boolean; + + sql_name?: string; + } + + export interface Bool { + type: 'bool'; + + metadata_key?: string | null; + + name?: string; + + required?: boolean; + + sql_name?: string; + } + + export interface String { + type: 'string'; + + metadata_key?: string | null; + + name?: string; + + required?: boolean; + + sql_name?: string; + } + + export interface Binary { + type: 'binary'; + + metadata_key?: string | null; + + name?: string; + + required?: boolean; + + sql_name?: string; + } + + export interface Timestamp { + type: 'timestamp'; + + metadata_key?: string | null; + + name?: string; + + required?: boolean; + + sql_name?: string; + + unit?: 'second' | 'millisecond' | 'microsecond' | 'nanosecond'; + } + + export interface Json { + type: 'json'; + + metadata_key?: string | null; + + name?: string; + + required?: boolean; + + sql_name?: string; + } + + export interface Struct {} + + export interface List {} + + export interface Json { + type: 'json'; + + decimal_encoding?: 'number' | 'string' | 'bytes'; + + timestamp_format?: 'rfc3339' | 'unix_millis'; + + unstructured?: boolean; + } + + export interface Parquet { + type: 'parquet'; + + compression?: 'uncompressed' | 'snappy' | 'gzip' | 'zstd' | 'lz4'; + + row_group_bytes?: number | null; + } + } + + export interface WorkerBinding { + /** + * Indicates that the worker binding is enabled. + */ + enabled: boolean; + } +} + +export interface StreamUpdateParams { + /** + * Path param: Specifies the public ID of the account. + */ + account_id: string; + + /** + * Body param: + */ + http?: StreamUpdateParams.HTTP; + + /** + * Body param: + */ + worker_binding?: StreamUpdateParams.WorkerBinding; +} + +export namespace StreamUpdateParams { + export interface HTTP { + /** + * Indicates that authentication is required for the HTTP endpoint. + */ + authentication: boolean; + + /** + * Indicates that the HTTP endpoint is enabled. + */ + enabled: boolean; + + /** + * Specifies the CORS options for the HTTP endpoint. + */ + cors?: HTTP.CORS; + } + + export namespace HTTP { + /** + * Specifies the CORS options for the HTTP endpoint. + */ + export interface CORS { + origins?: Array; + } + } + + export interface WorkerBinding { + /** + * Indicates that the worker binding is enabled. + */ + enabled: boolean; + } +} + +export interface StreamListParams extends V4PagePaginationArrayParams { + /** + * Path param: Specifies the public ID of the account. + */ + account_id: string; + + /** + * Query param: Specifies the public ID of the pipeline. + */ + pipeline_id?: string; +} + +export interface StreamDeleteParams { + /** + * Path param: Specifies the public ID of the account. + */ + account_id: string; + + /** + * Query param: Delete stream forcefully, including deleting any dependent + * pipelines. + */ + force?: string; +} + +export interface StreamGetParams { + /** + * Specifies the public ID of the account. + */ + account_id: string; +} + +Streams.StreamListResponsesV4PagePaginationArray = StreamListResponsesV4PagePaginationArray; + +export declare namespace Streams { + export { + type StreamCreateResponse as StreamCreateResponse, + type StreamUpdateResponse as StreamUpdateResponse, + type StreamListResponse as StreamListResponse, + type StreamGetResponse as StreamGetResponse, + StreamListResponsesV4PagePaginationArray as StreamListResponsesV4PagePaginationArray, + type StreamCreateParams as StreamCreateParams, + type StreamUpdateParams as StreamUpdateParams, + type StreamListParams as StreamListParams, + type StreamDeleteParams as StreamDeleteParams, + type StreamGetParams as StreamGetParams, + }; +} diff --git a/src/resources/queues/index.ts b/src/resources/queues/index.ts index ebf2923861..ab15d31aa7 100644 --- a/src/resources/queues/index.ts +++ b/src/resources/queues/index.ts @@ -31,8 +31,10 @@ export { type SubscriptionUpdateResponse, type SubscriptionListResponse, type SubscriptionDeleteResponse, + type SubscriptionGetResponse, type SubscriptionCreateParams, type SubscriptionUpdateParams, type SubscriptionListParams, type SubscriptionDeleteParams, + type SubscriptionGetParams, } from './subscriptions'; diff --git a/src/resources/queues/queues.ts b/src/resources/queues/queues.ts index 667ab7a44a..836f42bd41 100644 --- a/src/resources/queues/queues.ts +++ b/src/resources/queues/queues.ts @@ -35,6 +35,8 @@ import { SubscriptionCreateResponse, SubscriptionDeleteParams, SubscriptionDeleteResponse, + SubscriptionGetParams, + SubscriptionGetResponse, SubscriptionListParams, SubscriptionListResponse, SubscriptionListResponsesV4PagePaginationArray, @@ -399,10 +401,12 @@ export declare namespace Queues { type SubscriptionUpdateResponse as SubscriptionUpdateResponse, type SubscriptionListResponse as SubscriptionListResponse, type SubscriptionDeleteResponse as SubscriptionDeleteResponse, + type SubscriptionGetResponse as SubscriptionGetResponse, SubscriptionListResponsesV4PagePaginationArray as SubscriptionListResponsesV4PagePaginationArray, type SubscriptionCreateParams as SubscriptionCreateParams, type SubscriptionUpdateParams as SubscriptionUpdateParams, type SubscriptionListParams as SubscriptionListParams, type SubscriptionDeleteParams as SubscriptionDeleteParams, + type SubscriptionGetParams as SubscriptionGetParams, }; } diff --git a/src/resources/queues/subscriptions.ts b/src/resources/queues/subscriptions.ts index 3bb405e3fc..74c9b0e81f 100644 --- a/src/resources/queues/subscriptions.ts +++ b/src/resources/queues/subscriptions.ts @@ -105,6 +105,31 @@ export class Subscriptions extends APIResource { ) as Core.APIPromise<{ result: SubscriptionDeleteResponse }> )._thenUnwrap((obj) => obj.result); } + + /** + * Get details about an existing event subscription + * + * @example + * ```ts + * const subscription = await client.queues.subscriptions.get( + * '023e105f4ecef8ad9ca31a8372d0c353', + * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * ); + * ``` + */ + get( + subscriptionId: string, + params: SubscriptionGetParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.get( + `/accounts/${account_id}/event_subscriptions/subscriptions/${subscriptionId}`, + options, + ) as Core.APIPromise<{ result: SubscriptionGetResponse }> + )._thenUnwrap((obj) => obj.result); + } } export class SubscriptionListResponsesV4PagePaginationArray extends V4PagePaginationArray {} @@ -661,6 +686,144 @@ export namespace SubscriptionDeleteResponse { } } +export interface SubscriptionGetResponse { + /** + * Unique identifier for the subscription + */ + id: string; + + /** + * When the subscription was created + */ + created_at: string; + + /** + * Destination configuration for the subscription + */ + destination: SubscriptionGetResponse.Destination; + + /** + * Whether the subscription is active + */ + enabled: boolean; + + /** + * List of event types this subscription handles + */ + events: Array; + + /** + * When the subscription was last modified + */ + modified_at: string; + + /** + * Name of the subscription + */ + name: string; + + /** + * Source configuration for the subscription + */ + source: + | SubscriptionGetResponse.MqEventSourceImages + | SubscriptionGetResponse.MqEventSourceKV + | SubscriptionGetResponse.MqEventSourceR2 + | SubscriptionGetResponse.MqEventSourceSuperSlurper + | SubscriptionGetResponse.MqEventSourceVectorize + | SubscriptionGetResponse.MqEventSourceWorkersAIModel + | SubscriptionGetResponse.MqEventSourceWorkersBuildsWorker + | SubscriptionGetResponse.MqEventSourceWorkflowsWorkflow; +} + +export namespace SubscriptionGetResponse { + /** + * Destination configuration for the subscription + */ + export interface Destination { + /** + * ID of the target queue + */ + queue_id: string; + + /** + * Type of destination + */ + type: 'queues.queue'; + } + + export interface MqEventSourceImages { + /** + * Type of source + */ + type?: 'images'; + } + + export interface MqEventSourceKV { + /** + * Type of source + */ + type?: 'kv'; + } + + export interface MqEventSourceR2 { + /** + * Type of source + */ + type?: 'r2'; + } + + export interface MqEventSourceSuperSlurper { + /** + * Type of source + */ + type?: 'superSlurper'; + } + + export interface MqEventSourceVectorize { + /** + * Type of source + */ + type?: 'vectorize'; + } + + export interface MqEventSourceWorkersAIModel { + /** + * Name of the Workers AI model + */ + model_name?: string; + + /** + * Type of source + */ + type?: 'workersAi.model'; + } + + export interface MqEventSourceWorkersBuildsWorker { + /** + * Type of source + */ + type?: 'workersBuilds.worker'; + + /** + * Name of the worker + */ + worker_name?: string; + } + + export interface MqEventSourceWorkflowsWorkflow { + /** + * Type of source + */ + type?: 'workflows.workflow'; + + /** + * Name of the workflow + */ + workflow_name?: string; + } +} + export interface SubscriptionCreateParams { /** * Path param: A Resource identifier. @@ -857,6 +1020,13 @@ export interface SubscriptionDeleteParams { account_id: string; } +export interface SubscriptionGetParams { + /** + * A Resource identifier. + */ + account_id: string; +} + Subscriptions.SubscriptionListResponsesV4PagePaginationArray = SubscriptionListResponsesV4PagePaginationArray; export declare namespace Subscriptions { @@ -865,10 +1035,12 @@ export declare namespace Subscriptions { type SubscriptionUpdateResponse as SubscriptionUpdateResponse, type SubscriptionListResponse as SubscriptionListResponse, type SubscriptionDeleteResponse as SubscriptionDeleteResponse, + type SubscriptionGetResponse as SubscriptionGetResponse, SubscriptionListResponsesV4PagePaginationArray as SubscriptionListResponsesV4PagePaginationArray, type SubscriptionCreateParams as SubscriptionCreateParams, type SubscriptionUpdateParams as SubscriptionUpdateParams, type SubscriptionListParams as SubscriptionListParams, type SubscriptionDeleteParams as SubscriptionDeleteParams, + type SubscriptionGetParams as SubscriptionGetParams, }; } diff --git a/src/resources/r2-data-catalog.ts b/src/resources/r2-data-catalog.ts new file mode 100644 index 0000000000..759693fdec --- /dev/null +++ b/src/resources/r2-data-catalog.ts @@ -0,0 +1,3 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export * from './r2-data-catalog/index'; diff --git a/src/resources/r2-data-catalog/credentials.ts b/src/resources/r2-data-catalog/credentials.ts new file mode 100644 index 0000000000..031e421791 --- /dev/null +++ b/src/resources/r2-data-catalog/credentials.ts @@ -0,0 +1,57 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../resource'; +import * as Core from '../../core'; + +export class Credentials extends APIResource { + /** + * Store authentication credentials for a catalog. These credentials are used to + * authenticate with R2 storage when performing catalog operations. + * + * @example + * ```ts + * const credential = + * await client.r2DataCatalog.credentials.create( + * 'my-data-bucket', + * { + * account_id: '0123456789abcdef0123456789abcdef', + * token: 'your-cloudflare-api-token-here', + * }, + * ); + * ``` + */ + create( + bucketName: string, + params: CredentialCreateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.post(`/accounts/${account_id}/r2-catalog/${bucketName}/credential`, { + body, + ...options, + }) as Core.APIPromise<{ result: CredentialCreateResponse | null }> + )._thenUnwrap((obj) => obj.result); + } +} + +export type CredentialCreateResponse = unknown; + +export interface CredentialCreateParams { + /** + * Path param: Use this to identify the account. + */ + account_id: string; + + /** + * Body param: Provides the Cloudflare API token for accessing R2. + */ + token: string; +} + +export declare namespace Credentials { + export { + type CredentialCreateResponse as CredentialCreateResponse, + type CredentialCreateParams as CredentialCreateParams, + }; +} diff --git a/src/resources/r2-data-catalog/index.ts b/src/resources/r2-data-catalog/index.ts new file mode 100644 index 0000000000..b83ccfefe3 --- /dev/null +++ b/src/resources/r2-data-catalog/index.ts @@ -0,0 +1,12 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { Credentials, type CredentialCreateResponse, type CredentialCreateParams } from './credentials'; +export { + MaintenanceConfigs, + type MaintenanceConfigUpdateResponse, + type MaintenanceConfigGetResponse, + type MaintenanceConfigUpdateParams, + type MaintenanceConfigGetParams, +} from './maintenance-configs'; +export { Namespaces, type NamespaceListResponse, type NamespaceListParams } from './namespaces/index'; +export { R2DataCatalog } from './r2-data-catalog'; diff --git a/src/resources/r2-data-catalog/maintenance-configs.ts b/src/resources/r2-data-catalog/maintenance-configs.ts new file mode 100644 index 0000000000..d1e19cfc92 --- /dev/null +++ b/src/resources/r2-data-catalog/maintenance-configs.ts @@ -0,0 +1,182 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../resource'; +import * as Core from '../../core'; + +export class MaintenanceConfigs extends APIResource { + /** + * Update the maintenance configuration for a catalog. This allows you to enable or + * disable compaction and adjust target file sizes for optimization. + * + * @example + * ```ts + * const maintenanceConfig = + * await client.r2DataCatalog.maintenanceConfigs.update( + * 'my-data-bucket', + * { + * account_id: '0123456789abcdef0123456789abcdef', + * compaction: { + * state: 'enabled', + * target_size_mb: '256', + * }, + * }, + * ); + * ``` + */ + update( + bucketName: string, + params: MaintenanceConfigUpdateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.post(`/accounts/${account_id}/r2-catalog/${bucketName}/maintenance-configs`, { + body, + ...options, + }) as Core.APIPromise<{ result: MaintenanceConfigUpdateResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Retrieve the maintenance configuration for a specific catalog, including + * compaction settings and credential status. + * + * @example + * ```ts + * const maintenanceConfig = + * await client.r2DataCatalog.maintenanceConfigs.get( + * 'my-data-bucket', + * { account_id: '0123456789abcdef0123456789abcdef' }, + * ); + * ``` + */ + get( + bucketName: string, + params: MaintenanceConfigGetParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.get( + `/accounts/${account_id}/r2-catalog/${bucketName}/maintenance-configs`, + options, + ) as Core.APIPromise<{ result: MaintenanceConfigGetResponse }> + )._thenUnwrap((obj) => obj.result); + } +} + +/** + * Configures maintenance for the catalog. + */ +export interface MaintenanceConfigUpdateResponse { + /** + * Configures compaction for catalog maintenance. + */ + compaction?: MaintenanceConfigUpdateResponse.Compaction; +} + +export namespace MaintenanceConfigUpdateResponse { + /** + * Configures compaction for catalog maintenance. + */ + export interface Compaction { + /** + * Specifies the state of maintenance operations. + */ + state: 'enabled' | 'disabled'; + + /** + * Sets the target file size for compaction in megabytes. + */ + target_size_mb: '64' | '128' | '256' | '512'; + } +} + +/** + * Contains maintenance configuration and credential status. + */ +export interface MaintenanceConfigGetResponse { + /** + * Shows the credential configuration status. + */ + credential_status: 'present' | 'absent'; + + /** + * Configures maintenance for the catalog. + */ + maintenance_config: MaintenanceConfigGetResponse.MaintenanceConfig; +} + +export namespace MaintenanceConfigGetResponse { + /** + * Configures maintenance for the catalog. + */ + export interface MaintenanceConfig { + /** + * Configures compaction for catalog maintenance. + */ + compaction?: MaintenanceConfig.Compaction; + } + + export namespace MaintenanceConfig { + /** + * Configures compaction for catalog maintenance. + */ + export interface Compaction { + /** + * Specifies the state of maintenance operations. + */ + state: 'enabled' | 'disabled'; + + /** + * Sets the target file size for compaction in megabytes. + */ + target_size_mb: '64' | '128' | '256' | '512'; + } + } +} + +export interface MaintenanceConfigUpdateParams { + /** + * Path param: Use this to identify the account. + */ + account_id: string; + + /** + * Body param: Updates compaction configuration (all fields optional). + */ + compaction?: MaintenanceConfigUpdateParams.Compaction; +} + +export namespace MaintenanceConfigUpdateParams { + /** + * Updates compaction configuration (all fields optional). + */ + export interface Compaction { + /** + * Updates the state optionally. + */ + state?: 'enabled' | 'disabled'; + + /** + * Updates the target file size optionally. + */ + target_size_mb?: '64' | '128' | '256' | '512'; + } +} + +export interface MaintenanceConfigGetParams { + /** + * Use this to identify the account. + */ + account_id: string; +} + +export declare namespace MaintenanceConfigs { + export { + type MaintenanceConfigUpdateResponse as MaintenanceConfigUpdateResponse, + type MaintenanceConfigGetResponse as MaintenanceConfigGetResponse, + type MaintenanceConfigUpdateParams as MaintenanceConfigUpdateParams, + type MaintenanceConfigGetParams as MaintenanceConfigGetParams, + }; +} diff --git a/src/resources/r2-data-catalog/namespaces.ts b/src/resources/r2-data-catalog/namespaces.ts new file mode 100644 index 0000000000..572bf385de --- /dev/null +++ b/src/resources/r2-data-catalog/namespaces.ts @@ -0,0 +1,3 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export * from './namespaces/index'; diff --git a/src/resources/r2-data-catalog/namespaces/index.ts b/src/resources/r2-data-catalog/namespaces/index.ts new file mode 100644 index 0000000000..6ab364d167 --- /dev/null +++ b/src/resources/r2-data-catalog/namespaces/index.ts @@ -0,0 +1,4 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { Namespaces, type NamespaceListResponse, type NamespaceListParams } from './namespaces'; +export { Tables, type TableListResponse, type TableListParams } from './tables/index'; diff --git a/src/resources/r2-data-catalog/namespaces/namespaces.ts b/src/resources/r2-data-catalog/namespaces/namespaces.ts new file mode 100644 index 0000000000..43b48df119 --- /dev/null +++ b/src/resources/r2-data-catalog/namespaces/namespaces.ts @@ -0,0 +1,146 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../resource'; +import * as Core from '../../../core'; +import * as TablesAPI from './tables/tables'; +import { TableListParams, TableListResponse, Tables } from './tables/tables'; + +export class Namespaces extends APIResource { + tables: TablesAPI.Tables = new TablesAPI.Tables(this._client); + + /** + * Returns a list of namespaces in the specified R2 catalog. Supports hierarchical + * filtering and pagination for efficient traversal of large namespace hierarchies. + * + * @example + * ```ts + * const namespaces = + * await client.r2DataCatalog.namespaces.list( + * 'my-data-bucket', + * { account_id: '0123456789abcdef0123456789abcdef' }, + * ); + * ``` + */ + list( + bucketName: string, + params: NamespaceListParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...query } = params; + return ( + this._client.get(`/accounts/${account_id}/r2-catalog/${bucketName}/namespaces`, { + query, + ...options, + }) as Core.APIPromise<{ result: NamespaceListResponse }> + )._thenUnwrap((obj) => obj.result); + } +} + +/** + * Contains the list of namespaces with optional pagination. + */ +export interface NamespaceListResponse { + /** + * Lists namespaces in the catalog. + */ + namespaces: Array>; + + /** + * Contains detailed metadata for each namespace when return_details is true. Each + * object includes the namespace, UUID, and timestamps. + */ + details?: Array | null; + + /** + * Contains UUIDs for each namespace when return_uuids is true. The order + * corresponds to the namespaces array. + */ + namespace_uuids?: Array | null; + + /** + * Use this opaque token to fetch the next page of results. A null or absent value + * indicates the last page. + */ + next_page_token?: string | null; +} + +export namespace NamespaceListResponse { + /** + * Contains namespace with metadata details. + */ + export interface Detail { + /** + * Specifies the hierarchical namespace parts as an array of strings. For example, + * ["bronze", "analytics"] represents the namespace "bronze.analytics". + */ + namespace: Array; + + /** + * Contains the UUID that persists across renames. + */ + namespace_uuid: string; + + /** + * Indicates the creation timestamp in ISO 8601 format. + */ + created_at?: string | null; + + /** + * Shows the last update timestamp in ISO 8601 format. Null if never updated. + */ + updated_at?: string | null; + } +} + +export interface NamespaceListParams { + /** + * Path param: Use this to identify the account. + */ + account_id: string; + + /** + * Query param: Maximum number of namespaces to return per page. Defaults to 100, + * maximum 1000. + */ + page_size?: number; + + /** + * Query param: Opaque pagination token from a previous response. Use this to fetch + * the next page of results. + */ + page_token?: string; + + /** + * Query param: Parent namespace to filter by. Only returns direct children of this + * namespace. For nested namespaces, use %1F as separator (e.g., + * "bronze%1Fanalytics"). Omit this parameter to list top-level namespaces. + */ + parent?: string; + + /** + * Query param: Whether to include additional metadata (timestamps). When true, + * response includes created_at and updated_at arrays. + */ + return_details?: boolean; + + /** + * Query param: Whether to include namespace UUIDs in the response. Set to true to + * receive the namespace_uuids array. + */ + return_uuids?: boolean; +} + +Namespaces.Tables = Tables; + +export declare namespace Namespaces { + export { + type NamespaceListResponse as NamespaceListResponse, + type NamespaceListParams as NamespaceListParams, + }; + + export { + Tables as Tables, + type TableListResponse as TableListResponse, + type TableListParams as TableListParams, + }; +} diff --git a/src/resources/r2-data-catalog/namespaces/tables.ts b/src/resources/r2-data-catalog/namespaces/tables.ts new file mode 100644 index 0000000000..b0a55d84aa --- /dev/null +++ b/src/resources/r2-data-catalog/namespaces/tables.ts @@ -0,0 +1,3 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export * from './tables/index'; diff --git a/src/resources/r2-data-catalog/namespaces/tables/index.ts b/src/resources/r2-data-catalog/namespaces/tables/index.ts new file mode 100644 index 0000000000..80d4a9e43d --- /dev/null +++ b/src/resources/r2-data-catalog/namespaces/tables/index.ts @@ -0,0 +1,10 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { + MaintenanceConfigs, + type MaintenanceConfigUpdateResponse, + type MaintenanceConfigGetResponse, + type MaintenanceConfigUpdateParams, + type MaintenanceConfigGetParams, +} from './maintenance-configs'; +export { Tables, type TableListResponse, type TableListParams } from './tables'; diff --git a/src/resources/r2-data-catalog/namespaces/tables/maintenance-configs.ts b/src/resources/r2-data-catalog/namespaces/tables/maintenance-configs.ts new file mode 100644 index 0000000000..92329105f2 --- /dev/null +++ b/src/resources/r2-data-catalog/namespaces/tables/maintenance-configs.ts @@ -0,0 +1,185 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../../resource'; +import * as Core from '../../../../core'; + +export class MaintenanceConfigs extends APIResource { + /** + * Update the maintenance configuration for a specific table. This allows you to + * enable or disable compaction and adjust target file sizes for optimization. + * + * @example + * ```ts + * const maintenanceConfig = + * await client.r2DataCatalog.namespaces.tables.maintenanceConfigs.update( + * 'my-data-bucket', + * 'my_namespace%1Fsub_namespace', + * 'my_table', + * { + * account_id: '0123456789abcdef0123456789abcdef', + * compaction: { + * state: 'enabled', + * target_size_mb: '256', + * }, + * }, + * ); + * ``` + */ + update( + bucketName: string, + namespace: string, + tableName: string, + params: MaintenanceConfigUpdateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.post( + `/accounts/${account_id}/r2-catalog/${bucketName}/namespaces/${namespace}/tables/${tableName}/maintenance-configs`, + { body, ...options }, + ) as Core.APIPromise<{ result: MaintenanceConfigUpdateResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Retrieve the maintenance configuration for a specific table, including + * compaction settings. + * + * @example + * ```ts + * const maintenanceConfig = + * await client.r2DataCatalog.namespaces.tables.maintenanceConfigs.get( + * 'my-data-bucket', + * 'my_namespace%1Fsub_namespace', + * 'my_table', + * { account_id: '0123456789abcdef0123456789abcdef' }, + * ); + * ``` + */ + get( + bucketName: string, + namespace: string, + tableName: string, + params: MaintenanceConfigGetParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.get( + `/accounts/${account_id}/r2-catalog/${bucketName}/namespaces/${namespace}/tables/${tableName}/maintenance-configs`, + options, + ) as Core.APIPromise<{ result: MaintenanceConfigGetResponse }> + )._thenUnwrap((obj) => obj.result); + } +} + +/** + * Configures maintenance for the table. + */ +export interface MaintenanceConfigUpdateResponse { + /** + * Configures compaction settings for table optimization. + */ + compaction?: MaintenanceConfigUpdateResponse.Compaction; +} + +export namespace MaintenanceConfigUpdateResponse { + /** + * Configures compaction settings for table optimization. + */ + export interface Compaction { + /** + * Specifies the state of maintenance operations. + */ + state: 'enabled' | 'disabled'; + + /** + * Sets the target file size for compaction in megabytes. + */ + target_size_mb: '64' | '128' | '256' | '512'; + } +} + +/** + * Contains table maintenance configuration. + */ +export interface MaintenanceConfigGetResponse { + /** + * Configures maintenance for the table. + */ + maintenance_config: MaintenanceConfigGetResponse.MaintenanceConfig; +} + +export namespace MaintenanceConfigGetResponse { + /** + * Configures maintenance for the table. + */ + export interface MaintenanceConfig { + /** + * Configures compaction settings for table optimization. + */ + compaction?: MaintenanceConfig.Compaction; + } + + export namespace MaintenanceConfig { + /** + * Configures compaction settings for table optimization. + */ + export interface Compaction { + /** + * Specifies the state of maintenance operations. + */ + state: 'enabled' | 'disabled'; + + /** + * Sets the target file size for compaction in megabytes. + */ + target_size_mb: '64' | '128' | '256' | '512'; + } + } +} + +export interface MaintenanceConfigUpdateParams { + /** + * Path param: Use this to identify the account. + */ + account_id: string; + + /** + * Body param: Updates compaction configuration (all fields optional). + */ + compaction?: MaintenanceConfigUpdateParams.Compaction; +} + +export namespace MaintenanceConfigUpdateParams { + /** + * Updates compaction configuration (all fields optional). + */ + export interface Compaction { + /** + * Updates the state optionally. + */ + state?: 'enabled' | 'disabled'; + + /** + * Updates the target file size optionally. + */ + target_size_mb?: '64' | '128' | '256' | '512'; + } +} + +export interface MaintenanceConfigGetParams { + /** + * Use this to identify the account. + */ + account_id: string; +} + +export declare namespace MaintenanceConfigs { + export { + type MaintenanceConfigUpdateResponse as MaintenanceConfigUpdateResponse, + type MaintenanceConfigGetResponse as MaintenanceConfigGetResponse, + type MaintenanceConfigUpdateParams as MaintenanceConfigUpdateParams, + type MaintenanceConfigGetParams as MaintenanceConfigGetParams, + }; +} diff --git a/src/resources/r2-data-catalog/namespaces/tables/tables.ts b/src/resources/r2-data-catalog/namespaces/tables/tables.ts new file mode 100644 index 0000000000..58f6c509d3 --- /dev/null +++ b/src/resources/r2-data-catalog/namespaces/tables/tables.ts @@ -0,0 +1,192 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../../resource'; +import * as Core from '../../../../core'; +import * as MaintenanceConfigsAPI from './maintenance-configs'; +import { + MaintenanceConfigGetParams, + MaintenanceConfigGetResponse, + MaintenanceConfigUpdateParams, + MaintenanceConfigUpdateResponse, + MaintenanceConfigs, +} from './maintenance-configs'; + +export class Tables extends APIResource { + maintenanceConfigs: MaintenanceConfigsAPI.MaintenanceConfigs = new MaintenanceConfigsAPI.MaintenanceConfigs( + this._client, + ); + + /** + * Returns a list of tables in the specified namespace within an R2 catalog. + * Supports pagination for efficient traversal of large table collections. + * + * @example + * ```ts + * const tables = + * await client.r2DataCatalog.namespaces.tables.list( + * 'my-data-bucket', + * 'bronze', + * { account_id: '0123456789abcdef0123456789abcdef' }, + * ); + * ``` + */ + list( + bucketName: string, + namespace: string, + params: TableListParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...query } = params; + return ( + this._client.get(`/accounts/${account_id}/r2-catalog/${bucketName}/namespaces/${namespace}/tables`, { + query, + ...options, + }) as Core.APIPromise<{ result: TableListResponse }> + )._thenUnwrap((obj) => obj.result); + } +} + +/** + * Contains the list of tables with optional pagination. + */ +export interface TableListResponse { + /** + * Lists tables in the namespace. + */ + identifiers: Array; + + /** + * Contains detailed metadata for each table when return_details is true. Each + * object includes identifier, UUID, timestamps, and locations. + */ + details?: Array | null; + + /** + * Use this opaque token to fetch the next page of results. A null or absent value + * indicates the last page. + */ + next_page_token?: string | null; + + /** + * Contains UUIDs for each table when return_uuids is true. The order corresponds + * to the identifiers array. + */ + table_uuids?: Array | null; +} + +export namespace TableListResponse { + /** + * Specifies a unique table identifier within a catalog. + */ + export interface Identifier { + /** + * Specifies the table name. + */ + name: string; + + /** + * Specifies the hierarchical namespace parts as an array of strings. For example, + * ["bronze", "analytics"] represents the namespace "bronze.analytics". + */ + namespace: Array; + } + + /** + * Contains table with metadata. + */ + export interface Detail { + /** + * Specifies a unique table identifier within a catalog. + */ + identifier: Detail.Identifier; + + /** + * Contains the UUID that persists across renames. + */ + table_uuid: string; + + /** + * Indicates the creation timestamp in ISO 8601 format. + */ + created_at?: string | null; + + /** + * Specifies the base S3 URI for table storage location. + */ + location?: string | null; + + /** + * Contains the S3 URI to table metadata file. Null for staged tables. + */ + metadata_location?: string | null; + + /** + * Shows the last update timestamp in ISO 8601 format. Null if never updated. + */ + updated_at?: string | null; + } + + export namespace Detail { + /** + * Specifies a unique table identifier within a catalog. + */ + export interface Identifier { + /** + * Specifies the table name. + */ + name: string; + + /** + * Specifies the hierarchical namespace parts as an array of strings. For example, + * ["bronze", "analytics"] represents the namespace "bronze.analytics". + */ + namespace: Array; + } + } +} + +export interface TableListParams { + /** + * Path param: Use this to identify the account. + */ + account_id: string; + + /** + * Query param: Maximum number of tables to return per page. Defaults to 100, + * maximum 1000. + */ + page_size?: number; + + /** + * Query param: Opaque pagination token from a previous response. Use this to fetch + * the next page of results. + */ + page_token?: string; + + /** + * Query param: Whether to include additional metadata (timestamps, locations). + * When true, response includes created_at, updated_at, metadata_locations, and + * locations arrays. + */ + return_details?: boolean; + + /** + * Query param: Whether to include table UUIDs in the response. Set to true to + * receive the table_uuids array. + */ + return_uuids?: boolean; +} + +Tables.MaintenanceConfigs = MaintenanceConfigs; + +export declare namespace Tables { + export { type TableListResponse as TableListResponse, type TableListParams as TableListParams }; + + export { + MaintenanceConfigs as MaintenanceConfigs, + type MaintenanceConfigUpdateResponse as MaintenanceConfigUpdateResponse, + type MaintenanceConfigGetResponse as MaintenanceConfigGetResponse, + type MaintenanceConfigUpdateParams as MaintenanceConfigUpdateParams, + type MaintenanceConfigGetParams as MaintenanceConfigGetParams, + }; +} diff --git a/src/resources/r2-data-catalog/r2-data-catalog.ts b/src/resources/r2-data-catalog/r2-data-catalog.ts new file mode 100644 index 0000000000..bffbd67585 --- /dev/null +++ b/src/resources/r2-data-catalog/r2-data-catalog.ts @@ -0,0 +1,342 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../resource'; +import * as Core from '../../core'; +import * as CredentialsAPI from './credentials'; +import { CredentialCreateParams, CredentialCreateResponse, Credentials } from './credentials'; +import * as MaintenanceConfigsAPI from './maintenance-configs'; +import { + MaintenanceConfigGetParams, + MaintenanceConfigGetResponse, + MaintenanceConfigUpdateParams, + MaintenanceConfigUpdateResponse, + MaintenanceConfigs, +} from './maintenance-configs'; +import * as NamespacesAPI from './namespaces/namespaces'; +import { NamespaceListParams, NamespaceListResponse, Namespaces } from './namespaces/namespaces'; + +export class R2DataCatalog extends APIResource { + maintenanceConfigs: MaintenanceConfigsAPI.MaintenanceConfigs = new MaintenanceConfigsAPI.MaintenanceConfigs( + this._client, + ); + credentials: CredentialsAPI.Credentials = new CredentialsAPI.Credentials(this._client); + namespaces: NamespacesAPI.Namespaces = new NamespacesAPI.Namespaces(this._client); + + /** + * Returns a list of R2 buckets that have been enabled as Apache Iceberg catalogs + * for the specified account. Each catalog represents an R2 bucket configured to + * store Iceberg metadata and data files. + * + * @example + * ```ts + * const r2DataCatalogs = await client.r2DataCatalog.list({ + * account_id: '0123456789abcdef0123456789abcdef', + * }); + * ``` + */ + list( + params: R2DataCatalogListParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.get(`/accounts/${account_id}/r2-catalog`, options) as Core.APIPromise<{ + result: R2DataCatalogListResponse; + }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Disable an R2 bucket as a catalog. This operation deactivates the catalog but + * preserves existing metadata and data files. The catalog can be re-enabled later. + * + * @example + * ```ts + * await client.r2DataCatalog.disable('my-data-bucket', { + * account_id: '0123456789abcdef0123456789abcdef', + * }); + * ``` + */ + disable( + bucketName: string, + params: R2DataCatalogDisableParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return this._client.post(`/accounts/${account_id}/r2-catalog/${bucketName}/disable`, { + ...options, + headers: { Accept: '*/*', ...options?.headers }, + }); + } + + /** + * Enable an R2 bucket as an Apache Iceberg catalog. This operation creates the + * necessary catalog infrastructure and activates the bucket for storing Iceberg + * metadata and data files. + * + * @example + * ```ts + * const response = await client.r2DataCatalog.enable( + * 'my-data-bucket', + * { account_id: '0123456789abcdef0123456789abcdef' }, + * ); + * ``` + */ + enable( + bucketName: string, + params: R2DataCatalogEnableParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.post( + `/accounts/${account_id}/r2-catalog/${bucketName}/enable`, + options, + ) as Core.APIPromise<{ result: R2DataCatalogEnableResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Retrieve detailed information about a specific R2 catalog by bucket name. + * Returns catalog status, maintenance configuration, and credential status. + * + * @example + * ```ts + * const r2DataCatalog = await client.r2DataCatalog.get( + * 'my-data-bucket', + * { account_id: '0123456789abcdef0123456789abcdef' }, + * ); + * ``` + */ + get( + bucketName: string, + params: R2DataCatalogGetParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.get(`/accounts/${account_id}/r2-catalog/${bucketName}`, options) as Core.APIPromise<{ + result: R2DataCatalogGetResponse; + }> + )._thenUnwrap((obj) => obj.result); + } +} + +/** + * Contains the list of catalogs. + */ +export interface R2DataCatalogListResponse { + /** + * Lists catalogs in the account. + */ + warehouses: Array; +} + +export namespace R2DataCatalogListResponse { + /** + * Contains R2 Data Catalog information. + */ + export interface Warehouse { + /** + * Use this to uniquely identify the catalog. + */ + id: string; + + /** + * Specifies the associated R2 bucket name. + */ + bucket: string; + + /** + * Specifies the catalog name (generated from account and bucket name). + */ + name: string; + + /** + * Indicates the status of the catalog. + */ + status: 'active' | 'inactive'; + + /** + * Shows the credential configuration status. + */ + credential_status?: 'present' | 'absent' | null; + + /** + * Configures maintenance for the catalog. + */ + maintenance_config?: Warehouse.MaintenanceConfig | null; + } + + export namespace Warehouse { + /** + * Configures maintenance for the catalog. + */ + export interface MaintenanceConfig { + /** + * Configures compaction for catalog maintenance. + */ + compaction?: MaintenanceConfig.Compaction; + } + + export namespace MaintenanceConfig { + /** + * Configures compaction for catalog maintenance. + */ + export interface Compaction { + /** + * Specifies the state of maintenance operations. + */ + state: 'enabled' | 'disabled'; + + /** + * Sets the target file size for compaction in megabytes. + */ + target_size_mb: '64' | '128' | '256' | '512'; + } + } + } +} + +/** + * Contains response from activating an R2 bucket as a catalog. + */ +export interface R2DataCatalogEnableResponse { + /** + * Use this to uniquely identify the activated catalog. + */ + id: string; + + /** + * Specifies the name of the activated catalog. + */ + name: string; +} + +/** + * Contains R2 Data Catalog information. + */ +export interface R2DataCatalogGetResponse { + /** + * Use this to uniquely identify the catalog. + */ + id: string; + + /** + * Specifies the associated R2 bucket name. + */ + bucket: string; + + /** + * Specifies the catalog name (generated from account and bucket name). + */ + name: string; + + /** + * Indicates the status of the catalog. + */ + status: 'active' | 'inactive'; + + /** + * Shows the credential configuration status. + */ + credential_status?: 'present' | 'absent' | null; + + /** + * Configures maintenance for the catalog. + */ + maintenance_config?: R2DataCatalogGetResponse.MaintenanceConfig | null; +} + +export namespace R2DataCatalogGetResponse { + /** + * Configures maintenance for the catalog. + */ + export interface MaintenanceConfig { + /** + * Configures compaction for catalog maintenance. + */ + compaction?: MaintenanceConfig.Compaction; + } + + export namespace MaintenanceConfig { + /** + * Configures compaction for catalog maintenance. + */ + export interface Compaction { + /** + * Specifies the state of maintenance operations. + */ + state: 'enabled' | 'disabled'; + + /** + * Sets the target file size for compaction in megabytes. + */ + target_size_mb: '64' | '128' | '256' | '512'; + } + } +} + +export interface R2DataCatalogListParams { + /** + * Use this to identify the account. + */ + account_id: string; +} + +export interface R2DataCatalogDisableParams { + /** + * Use this to identify the account. + */ + account_id: string; +} + +export interface R2DataCatalogEnableParams { + /** + * Use this to identify the account. + */ + account_id: string; +} + +export interface R2DataCatalogGetParams { + /** + * Use this to identify the account. + */ + account_id: string; +} + +R2DataCatalog.MaintenanceConfigs = MaintenanceConfigs; +R2DataCatalog.Credentials = Credentials; +R2DataCatalog.Namespaces = Namespaces; + +export declare namespace R2DataCatalog { + export { + type R2DataCatalogListResponse as R2DataCatalogListResponse, + type R2DataCatalogEnableResponse as R2DataCatalogEnableResponse, + type R2DataCatalogGetResponse as R2DataCatalogGetResponse, + type R2DataCatalogListParams as R2DataCatalogListParams, + type R2DataCatalogDisableParams as R2DataCatalogDisableParams, + type R2DataCatalogEnableParams as R2DataCatalogEnableParams, + type R2DataCatalogGetParams as R2DataCatalogGetParams, + }; + + export { + MaintenanceConfigs as MaintenanceConfigs, + type MaintenanceConfigUpdateResponse as MaintenanceConfigUpdateResponse, + type MaintenanceConfigGetResponse as MaintenanceConfigGetResponse, + type MaintenanceConfigUpdateParams as MaintenanceConfigUpdateParams, + type MaintenanceConfigGetParams as MaintenanceConfigGetParams, + }; + + export { + Credentials as Credentials, + type CredentialCreateResponse as CredentialCreateResponse, + type CredentialCreateParams as CredentialCreateParams, + }; + + export { + Namespaces as Namespaces, + type NamespaceListResponse as NamespaceListResponse, + type NamespaceListParams as NamespaceListParams, + }; +} diff --git a/src/resources/r2/buckets/event-notifications.ts b/src/resources/r2/buckets/event-notifications.ts index cb0ba791f0..b3f163f204 100644 --- a/src/resources/r2/buckets/event-notifications.ts +++ b/src/resources/r2/buckets/event-notifications.ts @@ -13,7 +13,10 @@ export class EventNotifications extends APIResource { * await client.r2.buckets.eventNotifications.update( * 'example-bucket', * 'queue_id', - * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * { + * account_id: '023e105f4ecef8ad9ca31a8372d0c353', + * rules: [{ actions: ['PutObject', 'CopyObject'] }], + * }, * ); * ``` */ @@ -275,7 +278,7 @@ export interface EventNotificationUpdateParams { /** * Body param: Array of rules to drive notifications. */ - rules?: Array; + rules: Array; /** * Header param: Jurisdiction where objects in this bucket are guaranteed to be diff --git a/src/resources/r2/buckets/sippy.ts b/src/resources/r2/buckets/sippy.ts index 2a2c266863..282a037fe2 100644 --- a/src/resources/r2/buckets/sippy.ts +++ b/src/resources/r2/buckets/sippy.ts @@ -139,11 +139,16 @@ export namespace Sippy { */ export interface Source { /** - * Name of the bucket on the provider. + * Name of the bucket on the provider (AWS, GCS only). */ - bucket?: string; + bucket?: string | null; + + /** + * S3-compatible URL (Generic S3-compatible providers only). + */ + bucketUrl?: string | null; - provider?: 'aws' | 'gcs'; + provider?: 'aws' | 'gcs' | 's3'; /** * Region where the bucket resides (AWS only). @@ -156,7 +161,10 @@ export interface SippyDeleteResponse { enabled?: false; } -export type SippyUpdateParams = SippyUpdateParams.R2EnableSippyAws | SippyUpdateParams.R2EnableSippyGcs; +export type SippyUpdateParams = + | SippyUpdateParams.R2EnableSippyAws + | SippyUpdateParams.R2EnableSippyGcs + | SippyUpdateParams.R2EnableSippyS3; export declare namespace SippyUpdateParams { export interface R2EnableSippyAws { @@ -311,6 +319,80 @@ export declare namespace SippyUpdateParams { provider?: 'gcs'; } } + + export interface R2EnableSippyS3 { + /** + * Path param: Account ID. + */ + account_id: string; + + /** + * Body param: R2 bucket to copy objects to. + */ + destination?: R2EnableSippyS3.Destination; + + /** + * Body param: General S3-compatible provider to copy objects from. + */ + source?: R2EnableSippyS3.Source; + + /** + * Header param: Jurisdiction where objects in this bucket are guaranteed to be + * stored. + */ + jurisdiction?: 'default' | 'eu' | 'fedramp'; + } + + export namespace R2EnableSippyS3 { + /** + * R2 bucket to copy objects to. + */ + export interface Destination { + /** + * ID of a Cloudflare API token. This is the value labelled "Access Key ID" when + * creating an API. token from the + * [R2 dashboard](https://dash.cloudflare.com/?to=/:account/r2/api-tokens). + * + * Sippy will use this token when writing objects to R2, so it is best to scope + * this token to the bucket you're enabling Sippy for. + */ + accessKeyId?: string; + + provider?: SippyAPI.ProviderParam; + + /** + * Value of a Cloudflare API token. This is the value labelled "Secret Access Key" + * when creating an API. token from the + * [R2 dashboard](https://dash.cloudflare.com/?to=/:account/r2/api-tokens). + * + * Sippy will use this token when writing objects to R2, so it is best to scope + * this token to the bucket you're enabling Sippy for. + */ + secretAccessKey?: string; + } + + /** + * General S3-compatible provider to copy objects from. + */ + export interface Source { + /** + * Access Key ID of an IAM credential (ideally scoped to a single S3 bucket). + */ + accessKeyId?: string; + + /** + * URL to the S3-compatible API of the bucket. + */ + bucketUrl?: string; + + provider?: 's3'; + + /** + * Secret Access Key of an IAM credential (ideally scoped to a single S3 bucket). + */ + secretAccessKey?: string; + } + } } export interface SippyDeleteParams { diff --git a/src/resources/r2/super-slurper/connectivity-precheck.ts b/src/resources/r2/super-slurper/connectivity-precheck.ts index 654a8193d5..2283824388 100644 --- a/src/resources/r2/super-slurper/connectivity-precheck.ts +++ b/src/resources/r2/super-slurper/connectivity-precheck.ts @@ -13,6 +13,12 @@ export class ConnectivityPrecheck extends APIResource { * const response = * await client.r2.superSlurper.connectivityPrecheck.source({ * account_id: 'account_id', + * bucket: 'bucket', + * secret: { + * accessKeyId: 'accessKeyId', + * secretAccessKey: 'secretAccessKey', + * }, + * vendor: 's3', * }); * ``` */ @@ -37,6 +43,12 @@ export class ConnectivityPrecheck extends APIResource { * const response = * await client.r2.superSlurper.connectivityPrecheck.target({ * account_id: 'account_id', + * bucket: 'bucket', + * secret: { + * accessKeyId: 'accessKeyId', + * secretAccessKey: 'secretAccessKey', + * }, + * vendor: 'r2', * }); * ``` */ @@ -77,7 +89,17 @@ export declare namespace ConnectivityPrecheckSourceParams { /** * Body param: */ - bucket?: string; + bucket: string; + + /** + * Body param: + */ + secret: R2SlurperS3SourceSchema.Secret; + + /** + * Body param: + */ + vendor: 's3'; /** * Body param: @@ -87,19 +109,19 @@ export declare namespace ConnectivityPrecheckSourceParams { /** * Body param: */ - secret?: R2SlurperS3SourceSchema.Secret; + pathPrefix?: string | null; /** * Body param: */ - vendor?: 's3'; + region?: string | null; } export namespace R2SlurperS3SourceSchema { export interface Secret { - accessKeyId?: string; + accessKeyId: string; - secretAccessKey?: string; + secretAccessKey: string; } } @@ -112,24 +134,29 @@ export declare namespace ConnectivityPrecheckSourceParams { /** * Body param: */ - bucket?: string; + bucket: string; + + /** + * Body param: + */ + secret: R2SlurperGcsSourceSchema.Secret; /** * Body param: */ - secret?: R2SlurperGcsSourceSchema.Secret; + vendor: 'gcs'; /** * Body param: */ - vendor?: 'gcs'; + pathPrefix?: string | null; } export namespace R2SlurperGcsSourceSchema { export interface Secret { - clientEmail?: string; + clientEmail: string; - privateKey?: string; + privateKey: string; } } @@ -142,29 +169,34 @@ export declare namespace ConnectivityPrecheckSourceParams { /** * Body param: */ - bucket?: string; + bucket: string; /** * Body param: */ - jurisdiction?: 'default' | 'eu' | 'fedramp'; + secret: R2SlurperR2SourceSchema.Secret; + + /** + * Body param: + */ + vendor: SippyAPI.ProviderParam; /** * Body param: */ - secret?: R2SlurperR2SourceSchema.Secret; + jurisdiction?: 'default' | 'eu' | 'fedramp'; /** * Body param: */ - vendor?: SippyAPI.ProviderParam; + pathPrefix?: string | null; } export namespace R2SlurperR2SourceSchema { export interface Secret { - accessKeyId?: string; + accessKeyId: string; - secretAccessKey?: string; + secretAccessKey: string; } } } @@ -178,29 +210,29 @@ export interface ConnectivityPrecheckTargetParams { /** * Body param: */ - bucket?: string; + bucket: string; /** * Body param: */ - jurisdiction?: 'default' | 'eu' | 'fedramp'; + secret: ConnectivityPrecheckTargetParams.Secret; /** * Body param: */ - secret?: ConnectivityPrecheckTargetParams.Secret; + vendor: SippyAPI.ProviderParam; /** * Body param: */ - vendor?: SippyAPI.ProviderParam; + jurisdiction?: 'default' | 'eu' | 'fedramp'; } export namespace ConnectivityPrecheckTargetParams { export interface Secret { - accessKeyId?: string; + accessKeyId: string; - secretAccessKey?: string; + secretAccessKey: string; } } diff --git a/src/resources/r2/super-slurper/jobs/jobs.ts b/src/resources/r2/super-slurper/jobs/jobs.ts index 0e70bb10e5..c57e763e78 100644 --- a/src/resources/r2/super-slurper/jobs/jobs.ts +++ b/src/resources/r2/super-slurper/jobs/jobs.ts @@ -220,6 +220,8 @@ export namespace JobListResponse { endpoint?: string | null; + keys?: Array | null; + pathPrefix?: string | null; vendor?: 's3'; @@ -228,6 +230,8 @@ export namespace JobListResponse { export interface GcsSourceResponseSchema { bucket?: string; + keys?: Array | null; + pathPrefix?: string | null; vendor?: 'gcs'; @@ -238,6 +242,8 @@ export namespace JobListResponse { jurisdiction?: 'default' | 'eu' | 'fedramp'; + keys?: Array | null; + pathPrefix?: string | null; vendor?: SippyAPI.Provider; @@ -281,6 +287,8 @@ export namespace JobGetResponse { endpoint?: string | null; + keys?: Array | null; + pathPrefix?: string | null; vendor?: 's3'; @@ -289,6 +297,8 @@ export namespace JobGetResponse { export interface GcsSourceResponseSchema { bucket?: string; + keys?: Array | null; + pathPrefix?: string | null; vendor?: 'gcs'; @@ -299,6 +309,8 @@ export namespace JobGetResponse { jurisdiction?: 'default' | 'eu' | 'fedramp'; + keys?: Array | null; + pathPrefix?: string | null; vendor?: SippyAPI.Provider; @@ -360,72 +372,80 @@ export interface JobCreateParams { export namespace JobCreateParams { export interface R2SlurperS3SourceSchema { - bucket?: string; + bucket: string; + + secret: R2SlurperS3SourceSchema.Secret; + + vendor: 's3'; endpoint?: string | null; - secret?: R2SlurperS3SourceSchema.Secret; + pathPrefix?: string | null; - vendor?: 's3'; + region?: string | null; } export namespace R2SlurperS3SourceSchema { export interface Secret { - accessKeyId?: string; + accessKeyId: string; - secretAccessKey?: string; + secretAccessKey: string; } } export interface R2SlurperGcsSourceSchema { - bucket?: string; + bucket: string; - secret?: R2SlurperGcsSourceSchema.Secret; + secret: R2SlurperGcsSourceSchema.Secret; - vendor?: 'gcs'; + vendor: 'gcs'; + + pathPrefix?: string | null; } export namespace R2SlurperGcsSourceSchema { export interface Secret { - clientEmail?: string; + clientEmail: string; - privateKey?: string; + privateKey: string; } } export interface R2SlurperR2SourceSchema { - bucket?: string; + bucket: string; - jurisdiction?: 'default' | 'eu' | 'fedramp'; + secret: R2SlurperR2SourceSchema.Secret; - secret?: R2SlurperR2SourceSchema.Secret; + vendor: SippyAPI.ProviderParam; - vendor?: SippyAPI.ProviderParam; + jurisdiction?: 'default' | 'eu' | 'fedramp'; + + pathPrefix?: string | null; } export namespace R2SlurperR2SourceSchema { export interface Secret { - accessKeyId?: string; + accessKeyId: string; - secretAccessKey?: string; + secretAccessKey: string; } } export interface Target { - bucket?: string; + bucket: string; - jurisdiction?: 'default' | 'eu' | 'fedramp'; + secret: Target.Secret; - secret?: Target.Secret; + vendor: SippyAPI.ProviderParam; - vendor?: SippyAPI.ProviderParam; + jurisdiction?: 'default' | 'eu' | 'fedramp'; } export namespace Target { export interface Secret { - accessKeyId?: string; + accessKeyId: string; - secretAccessKey?: string; + secretAccessKey: string; } } } diff --git a/src/resources/radar/ai/ai.ts b/src/resources/radar/ai/ai.ts index c4830c1214..b9f3118f5f 100755 --- a/src/resources/radar/ai/ai.ts +++ b/src/resources/radar/ai/ai.ts @@ -21,9 +21,23 @@ import { ToMarkdownCreateResponsesSinglePage, } from './to-markdown'; import * as BotsAPI from './bots/bots'; -import { Bots } from './bots/bots'; +import { + BotSummaryV2Params, + BotSummaryV2Response, + BotTimeseriesGroupsParams, + BotTimeseriesGroupsResponse, + BotTimeseriesParams, + BotTimeseriesResponse, + Bots, +} from './bots/bots'; import * as InferenceAPI from './inference/inference'; -import { Inference } from './inference/inference'; +import { + Inference, + InferenceSummaryV2Params, + InferenceSummaryV2Response, + InferenceTimeseriesGroupsV2Params, + InferenceTimeseriesGroupsV2Response, +} from './inference/inference'; export class AI extends APIResource { toMarkdown: ToMarkdownAPI.ToMarkdown = new ToMarkdownAPI.ToMarkdown(this._client); @@ -48,9 +62,23 @@ export declare namespace AI { type ToMarkdownCreateParams as ToMarkdownCreateParams, }; - export { Inference as Inference }; + export { + Inference as Inference, + type InferenceSummaryV2Response as InferenceSummaryV2Response, + type InferenceTimeseriesGroupsV2Response as InferenceTimeseriesGroupsV2Response, + type InferenceSummaryV2Params as InferenceSummaryV2Params, + type InferenceTimeseriesGroupsV2Params as InferenceTimeseriesGroupsV2Params, + }; - export { Bots as Bots }; + export { + Bots as Bots, + type BotSummaryV2Response as BotSummaryV2Response, + type BotTimeseriesResponse as BotTimeseriesResponse, + type BotTimeseriesGroupsResponse as BotTimeseriesGroupsResponse, + type BotSummaryV2Params as BotSummaryV2Params, + type BotTimeseriesParams as BotTimeseriesParams, + type BotTimeseriesGroupsParams as BotTimeseriesGroupsParams, + }; export { TimeseriesGroups as TimeseriesGroups, diff --git a/src/resources/radar/ai/bots/bots.ts b/src/resources/radar/ai/bots/bots.ts index 865665cba6..4051e03caf 100644 --- a/src/resources/radar/ai/bots/bots.ts +++ b/src/resources/radar/ai/bots/bots.ts @@ -1,16 +1,781 @@ // 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 SummaryAPI from './summary'; import { Summary, SummaryUserAgentParams, SummaryUserAgentResponse } from './summary'; export class Bots extends APIResource { summary: SummaryAPI.Summary = new SummaryAPI.Summary(this._client); + + /** + * Retrieves an aggregated summary of AI bots HTTP requests grouped by the + * specified dimension. + * + * @example + * ```ts + * const response = await client.radar.ai.bots.summaryV2( + * 'USER_AGENT', + * ); + * ``` + */ + summaryV2( + dimension: 'USER_AGENT' | 'CRAWL_PURPOSE' | 'INDUSTRY' | 'VERTICAL', + query?: BotSummaryV2Params, + options?: Core.RequestOptions, + ): Core.APIPromise; + summaryV2( + dimension: 'USER_AGENT' | 'CRAWL_PURPOSE' | 'INDUSTRY' | 'VERTICAL', + options?: Core.RequestOptions, + ): Core.APIPromise; + summaryV2( + dimension: 'USER_AGENT' | 'CRAWL_PURPOSE' | 'INDUSTRY' | 'VERTICAL', + query: BotSummaryV2Params | Core.RequestOptions = {}, + options?: Core.RequestOptions, + ): Core.APIPromise { + if (isRequestOptions(query)) { + return this.summaryV2(dimension, {}, query); + } + return ( + this._client.get(`/radar/ai/bots/summary/${dimension}`, { query, ...options }) as Core.APIPromise<{ + result: BotSummaryV2Response; + }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Retrieves AI bots HTTP request volume over time. + * + * @example + * ```ts + * const response = await client.radar.ai.bots.timeseries(); + * ``` + */ + timeseries( + query?: BotTimeseriesParams, + options?: Core.RequestOptions, + ): Core.APIPromise; + timeseries(options?: Core.RequestOptions): Core.APIPromise; + timeseries( + query: BotTimeseriesParams | Core.RequestOptions = {}, + options?: Core.RequestOptions, + ): Core.APIPromise { + if (isRequestOptions(query)) { + return this.timeseries({}, query); + } + return ( + this._client.get('/radar/ai/bots/timeseries', { query, ...options }) as Core.APIPromise<{ + result: BotTimeseriesResponse; + }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Retrieves the distribution of HTTP requests from AI bots, grouped by chosen the + * specified dimension over time. + * + * @example + * ```ts + * const response = + * await client.radar.ai.bots.timeseriesGroups('USER_AGENT'); + * ``` + */ + timeseriesGroups( + dimension: 'USER_AGENT' | 'CRAWL_PURPOSE' | 'INDUSTRY' | 'VERTICAL', + query?: BotTimeseriesGroupsParams, + options?: Core.RequestOptions, + ): Core.APIPromise; + timeseriesGroups( + dimension: 'USER_AGENT' | 'CRAWL_PURPOSE' | 'INDUSTRY' | 'VERTICAL', + options?: Core.RequestOptions, + ): Core.APIPromise; + timeseriesGroups( + dimension: 'USER_AGENT' | 'CRAWL_PURPOSE' | 'INDUSTRY' | 'VERTICAL', + query: BotTimeseriesGroupsParams | Core.RequestOptions = {}, + options?: Core.RequestOptions, + ): Core.APIPromise { + if (isRequestOptions(query)) { + return this.timeseriesGroups(dimension, {}, query); + } + return ( + this._client.get(`/radar/ai/bots/timeseries_groups/${dimension}`, { + query, + ...options, + }) as Core.APIPromise<{ result: BotTimeseriesGroupsResponse }> + )._thenUnwrap((obj) => obj.result); + } +} + +export interface BotSummaryV2Response { + /** + * Metadata for the results. + */ + meta: BotSummaryV2Response.Meta; + + summary_0: { [key: string]: string }; +} + +export namespace BotSummaryV2Response { + /** + * Metadata for the results. + */ + export interface Meta { + confidenceInfo: Meta.ConfidenceInfo; + + dateRange: Array; + + /** + * Timestamp of the last dataset update. + */ + lastUpdated: string; + + /** + * Normalization method applied to the results. Refer to + * [Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/). + */ + normalization: + | 'PERCENTAGE' + | 'MIN0_MAX' + | 'MIN_MAX' + | 'RAW_VALUES' + | 'PERCENTAGE_CHANGE' + | 'ROLLING_AVERAGE' + | 'OVERLAPPED_PERCENTAGE' + | 'RATIO'; + + /** + * Measurement units for the results. + */ + units: Array; + } + + export namespace Meta { + export interface ConfidenceInfo { + annotations: Array; + + /** + * Provides an indication of how much confidence Cloudflare has in the data. + */ + level: number; + } + + export namespace ConfidenceInfo { + /** + * Annotation associated with the result (e.g. outage or other type of event). + */ + export interface Annotation { + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; + + description: string; + + endDate: string; + + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; + + /** + * Whether event is a single point in time or a time range. + */ + isInstantaneous: boolean; + + linkedUrl: string; + + startDate: string; + } + } + + export interface DateRange { + /** + * Adjusted end of date range. + */ + endTime: string; + + /** + * Adjusted start of date range. + */ + startTime: string; + } + + export interface Unit { + name: string; + + value: string; + } + } +} + +export interface BotTimeseriesResponse { + /** + * Metadata for the results. + */ + meta: BotTimeseriesResponse.Meta; + + [k: string]: + | BotTimeseriesResponse.unnamed_schema_ref_75bae70cf28e6bcef364b9840db3bdeb + | BotTimeseriesResponse.Meta + | undefined; +} + +export namespace BotTimeseriesResponse { + /** + * Metadata for the results. + */ + export interface Meta { + /** + * Aggregation interval of the results (e.g., in 15 minutes or 1 hour intervals). + * Refer to + * [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + */ + aggInterval: 'FIFTEEN_MINUTES' | 'ONE_HOUR' | 'ONE_DAY' | 'ONE_WEEK' | 'ONE_MONTH'; + + confidenceInfo: Meta.ConfidenceInfo; + + dateRange: Array; + + /** + * Timestamp of the last dataset update. + */ + lastUpdated: string; + + /** + * Normalization method applied to the results. Refer to + * [Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/). + */ + normalization: + | 'PERCENTAGE' + | 'MIN0_MAX' + | 'MIN_MAX' + | 'RAW_VALUES' + | 'PERCENTAGE_CHANGE' + | 'ROLLING_AVERAGE' + | 'OVERLAPPED_PERCENTAGE' + | 'RATIO'; + + /** + * Measurement units for the results. + */ + units: Array; + } + + export namespace Meta { + export interface ConfidenceInfo { + annotations: Array; + + /** + * Provides an indication of how much confidence Cloudflare has in the data. + */ + level: number; + } + + export namespace ConfidenceInfo { + /** + * Annotation associated with the result (e.g. outage or other type of event). + */ + export interface Annotation { + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; + + description: string; + + endDate: string; + + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; + + /** + * Whether event is a single point in time or a time range. + */ + isInstantaneous: boolean; + + linkedUrl: string; + + startDate: string; + } + } + + export interface DateRange { + /** + * Adjusted end of date range. + */ + endTime: string; + + /** + * Adjusted start of date range. + */ + startTime: string; + } + + export interface Unit { + name: string; + + value: string; + } + } + + export interface unnamed_schema_ref_75bae70cf28e6bcef364b9840db3bdeb { + timestamps: Array; + + values: Array; + } +} + +export interface BotTimeseriesGroupsResponse { + /** + * Metadata for the results. + */ + meta: BotTimeseriesGroupsResponse.Meta; + + serie_0: BotTimeseriesGroupsResponse.Serie0; +} + +export namespace BotTimeseriesGroupsResponse { + /** + * Metadata for the results. + */ + export interface Meta { + /** + * Aggregation interval of the results (e.g., in 15 minutes or 1 hour intervals). + * Refer to + * [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + */ + aggInterval: 'FIFTEEN_MINUTES' | 'ONE_HOUR' | 'ONE_DAY' | 'ONE_WEEK' | 'ONE_MONTH'; + + confidenceInfo: Meta.ConfidenceInfo; + + dateRange: Array; + + /** + * Timestamp of the last dataset update. + */ + lastUpdated: string; + + /** + * Normalization method applied to the results. Refer to + * [Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/). + */ + normalization: + | 'PERCENTAGE' + | 'MIN0_MAX' + | 'MIN_MAX' + | 'RAW_VALUES' + | 'PERCENTAGE_CHANGE' + | 'ROLLING_AVERAGE' + | 'OVERLAPPED_PERCENTAGE' + | 'RATIO'; + + /** + * Measurement units for the results. + */ + units: Array; + } + + export namespace Meta { + export interface ConfidenceInfo { + annotations: Array; + + /** + * Provides an indication of how much confidence Cloudflare has in the data. + */ + level: number; + } + + export namespace ConfidenceInfo { + /** + * Annotation associated with the result (e.g. outage or other type of event). + */ + export interface Annotation { + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; + + description: string; + + endDate: string; + + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; + + /** + * Whether event is a single point in time or a time range. + */ + isInstantaneous: boolean; + + linkedUrl: string; + + startDate: string; + } + } + + export interface DateRange { + /** + * Adjusted end of date range. + */ + endTime: string; + + /** + * Adjusted start of date range. + */ + startTime: string; + } + + export interface Unit { + name: string; + + value: string; + } + } + + export interface Serie0 { + timestamps: Array; + + [k: string]: Array | Array | undefined; + } +} + +export interface BotSummaryV2Params { + /** + * Filters results by Autonomous System. Specify one or more Autonomous System + * Numbers (ASNs) as a comma-separated list. Prefix with `-` to exclude ASNs from + * results. For example, `-174, 3356` excludes results from AS174, but includes + * results from AS3356. + */ + asn?: Array; + + /** + * Filters results by continent. Specify a comma-separated list of alpha-2 codes. + * Prefix with `-` to exclude continents from results. For example, `-EU,NA` + * excludes results from EU, but includes results from NA. + */ + continent?: Array; + + /** + * Filters results by bot crawl purpose. + */ + crawlPurpose?: Array; + + /** + * End of the date range (inclusive). + */ + dateEnd?: Array; + + /** + * Filters results by date range. For example, use `7d` and `7dcontrol` to compare + * this week with the previous week. Use this parameter or set specific start and + * end dates (`dateStart` and `dateEnd` parameters). + */ + dateRange?: Array; + + /** + * Start of the date range. + */ + dateStart?: Array; + + /** + * Format in which results will be returned. + */ + format?: 'JSON' | 'CSV'; + + /** + * Filters results by industry. + */ + industry?: Array; + + /** + * Limits the number of objects per group to the top items within the specified + * time range. When item count exceeds the limit, extra items appear grouped under + * an "other" category. + */ + limitPerGroup?: number; + + /** + * Filters results by location. Specify a comma-separated list of alpha-2 codes. + * Prefix with `-` to exclude locations from results. For example, `-US,PT` + * excludes results from the US, but includes results from PT. + */ + location?: Array; + + /** + * Array of names used to label the series in the response. + */ + name?: Array; + + /** + * Filters results by vertical. + */ + vertical?: Array; +} + +export interface BotTimeseriesParams { + /** + * Aggregation interval of the results (e.g., in 15 minutes or 1 hour intervals). + * Refer to + * [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + */ + aggInterval?: '15m' | '1h' | '1d' | '1w'; + + /** + * Filters results by Autonomous System. Specify one or more Autonomous System + * Numbers (ASNs) as a comma-separated list. Prefix with `-` to exclude ASNs from + * results. For example, `-174, 3356` excludes results from AS174, but includes + * results from AS3356. + */ + asn?: Array; + + /** + * Filters results by continent. Specify a comma-separated list of alpha-2 codes. + * Prefix with `-` to exclude continents from results. For example, `-EU,NA` + * excludes results from EU, but includes results from NA. + */ + continent?: Array; + + /** + * Filters results by bot crawl purpose. + */ + crawlPurpose?: Array; + + /** + * End of the date range (inclusive). + */ + dateEnd?: Array; + + /** + * Filters results by date range. For example, use `7d` and `7dcontrol` to compare + * this week with the previous week. Use this parameter or set specific start and + * end dates (`dateStart` and `dateEnd` parameters). + */ + dateRange?: Array; + + /** + * Start of the date range. + */ + dateStart?: Array; + + /** + * Format in which results will be returned. + */ + format?: 'JSON' | 'CSV'; + + /** + * Filters results by industry. + */ + industry?: Array; + + /** + * Limits the number of objects per group to the top items within the specified + * time range. When item count exceeds the limit, extra items appear grouped under + * an "other" category. + */ + limitPerGroup?: number; + + /** + * Filters results by location. Specify a comma-separated list of alpha-2 codes. + * Prefix with `-` to exclude locations from results. For example, `-US,PT` + * excludes results from the US, but includes results from PT. + */ + location?: Array; + + /** + * Array of names used to label the series in the response. + */ + name?: Array; + + /** + * Filters results by user agent. + */ + userAgent?: Array; + + /** + * Filters results by vertical. + */ + vertical?: Array; +} + +export interface BotTimeseriesGroupsParams { + /** + * Aggregation interval of the results (e.g., in 15 minutes or 1 hour intervals). + * Refer to + * [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + */ + aggInterval?: '15m' | '1h' | '1d' | '1w'; + + /** + * Filters results by Autonomous System. Specify one or more Autonomous System + * Numbers (ASNs) as a comma-separated list. Prefix with `-` to exclude ASNs from + * results. For example, `-174, 3356` excludes results from AS174, but includes + * results from AS3356. + */ + asn?: Array; + + /** + * Filters results by continent. Specify a comma-separated list of alpha-2 codes. + * Prefix with `-` to exclude continents from results. For example, `-EU,NA` + * excludes results from EU, but includes results from NA. + */ + continent?: Array; + + /** + * Filters results by bot crawl purpose. + */ + crawlPurpose?: Array; + + /** + * End of the date range (inclusive). + */ + dateEnd?: Array; + + /** + * Filters results by date range. For example, use `7d` and `7dcontrol` to compare + * this week with the previous week. Use this parameter or set specific start and + * end dates (`dateStart` and `dateEnd` parameters). + */ + dateRange?: Array; + + /** + * Start of the date range. + */ + dateStart?: Array; + + /** + * Format in which results will be returned. + */ + format?: 'JSON' | 'CSV'; + + /** + * Filters results by industry. + */ + industry?: Array; + + /** + * Limits the number of objects per group to the top items within the specified + * time range. When item count exceeds the limit, extra items appear grouped under + * an "other" category. + */ + limitPerGroup?: number; + + /** + * Filters results by location. Specify a comma-separated list of alpha-2 codes. + * Prefix with `-` to exclude locations from results. For example, `-US,PT` + * excludes results from the US, but includes results from PT. + */ + location?: Array; + + /** + * Array of names used to label the series in the response. + */ + name?: Array; + + /** + * Normalization method applied to the results. Refer to + * [Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/). + */ + normalization?: 'PERCENTAGE_CHANGE' | 'MIN0_MAX'; + + /** + * Filters results by vertical. + */ + vertical?: Array; } Bots.Summary = Summary; export declare namespace Bots { + export { + type BotSummaryV2Response as BotSummaryV2Response, + type BotTimeseriesResponse as BotTimeseriesResponse, + type BotTimeseriesGroupsResponse as BotTimeseriesGroupsResponse, + type BotSummaryV2Params as BotSummaryV2Params, + type BotTimeseriesParams as BotTimeseriesParams, + type BotTimeseriesGroupsParams as BotTimeseriesGroupsParams, + }; + export { Summary as Summary, type SummaryUserAgentResponse as SummaryUserAgentResponse, diff --git a/src/resources/radar/ai/bots/index.ts b/src/resources/radar/ai/bots/index.ts index c94177cbcd..8d3512cf95 100644 --- a/src/resources/radar/ai/bots/index.ts +++ b/src/resources/radar/ai/bots/index.ts @@ -1,4 +1,12 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { Bots } from './bots'; +export { + Bots, + type BotSummaryV2Response, + type BotTimeseriesResponse, + type BotTimeseriesGroupsResponse, + type BotSummaryV2Params, + type BotTimeseriesParams, + type BotTimeseriesGroupsParams, +} from './bots'; export { Summary, type SummaryUserAgentResponse, type SummaryUserAgentParams } from './summary'; diff --git a/src/resources/radar/ai/bots/summary.ts b/src/resources/radar/ai/bots/summary.ts index 75c99603d5..bfa14e8b8e 100644 --- a/src/resources/radar/ai/bots/summary.ts +++ b/src/resources/radar/ai/bots/summary.ts @@ -8,7 +8,7 @@ export class Summary extends APIResource { /** * Retrieves the distribution of traffic by AI user agent. * - * @deprecated + * @deprecated Use [Radar AI Bots Summary By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/ai/subresources/bots/methods/summary_v2/) instead. */ userAgent( query?: SummaryUserAgentParams, @@ -88,13 +88,44 @@ export namespace SummaryUserAgentResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. diff --git a/src/resources/radar/ai/index.ts b/src/resources/radar/ai/index.ts index d56384a99a..12a71ffebc 100755 --- a/src/resources/radar/ai/index.ts +++ b/src/resources/radar/ai/index.ts @@ -1,8 +1,22 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { AI } from './ai'; -export { Bots } from './bots/index'; -export { Inference } from './inference/index'; +export { + Bots, + type BotSummaryV2Response, + type BotTimeseriesResponse, + type BotTimeseriesGroupsResponse, + type BotSummaryV2Params, + type BotTimeseriesParams, + type BotTimeseriesGroupsParams, +} from './bots/index'; +export { + Inference, + type InferenceSummaryV2Response, + type InferenceTimeseriesGroupsV2Response, + type InferenceSummaryV2Params, + type InferenceTimeseriesGroupsV2Params, +} from './inference/index'; export { TimeseriesGroups, type TimeseriesGroupSummaryResponse, diff --git a/src/resources/radar/ai/inference/index.ts b/src/resources/radar/ai/inference/index.ts index a26b5943df..3e6766d9a6 100644 --- a/src/resources/radar/ai/inference/index.ts +++ b/src/resources/radar/ai/inference/index.ts @@ -1,6 +1,12 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { Inference } from './inference'; +export { + Inference, + type InferenceSummaryV2Response, + type InferenceTimeseriesGroupsV2Response, + type InferenceSummaryV2Params, + type InferenceTimeseriesGroupsV2Params, +} from './inference'; export { Summary, type SummaryModelResponse, diff --git a/src/resources/radar/ai/inference/inference.ts b/src/resources/radar/ai/inference/inference.ts index 7f31aa0ffb..55e2afa3c5 100644 --- a/src/resources/radar/ai/inference/inference.ts +++ b/src/resources/radar/ai/inference/inference.ts @@ -1,6 +1,8 @@ // 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 SummaryAPI from './summary'; import { Summary, @@ -17,12 +19,489 @@ export class Inference extends APIResource { timeseriesGroups: TimeseriesGroupsAPI.TimeseriesGroups = new TimeseriesGroupsAPI.TimeseriesGroups( this._client, ); + + /** + * Retrieves an aggregated summary of unique accounts using Workers AI inference + * grouped by the specified dimension. + * + * @example + * ```ts + * const response = await client.radar.ai.inference.summaryV2( + * 'MODEL', + * ); + * ``` + */ + summaryV2( + dimension: 'MODEL' | 'TASK', + query?: InferenceSummaryV2Params, + options?: Core.RequestOptions, + ): Core.APIPromise; + summaryV2( + dimension: 'MODEL' | 'TASK', + options?: Core.RequestOptions, + ): Core.APIPromise; + summaryV2( + dimension: 'MODEL' | 'TASK', + query: InferenceSummaryV2Params | Core.RequestOptions = {}, + options?: Core.RequestOptions, + ): Core.APIPromise { + if (isRequestOptions(query)) { + return this.summaryV2(dimension, {}, query); + } + return ( + this._client.get(`/radar/ai/inference/summary/${dimension}`, { query, ...options }) as Core.APIPromise<{ + result: InferenceSummaryV2Response; + }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Retrieves the distribution of unique accounts using Workers AI inference, + * grouped by the specified dimension over time. + * + * @example + * ```ts + * const response = + * await client.radar.ai.inference.timeseriesGroupsV2( + * 'MODEL', + * ); + * ``` + */ + timeseriesGroupsV2( + dimension: 'MODEL' | 'TASK', + query?: InferenceTimeseriesGroupsV2Params, + options?: Core.RequestOptions, + ): Core.APIPromise; + timeseriesGroupsV2( + dimension: 'MODEL' | 'TASK', + options?: Core.RequestOptions, + ): Core.APIPromise; + timeseriesGroupsV2( + dimension: 'MODEL' | 'TASK', + query: InferenceTimeseriesGroupsV2Params | Core.RequestOptions = {}, + options?: Core.RequestOptions, + ): Core.APIPromise { + if (isRequestOptions(query)) { + return this.timeseriesGroupsV2(dimension, {}, query); + } + return ( + this._client.get(`/radar/ai/inference/timeseries_groups/${dimension}`, { + query, + ...options, + }) as Core.APIPromise<{ result: InferenceTimeseriesGroupsV2Response }> + )._thenUnwrap((obj) => obj.result); + } +} + +export interface InferenceSummaryV2Response { + /** + * Metadata for the results. + */ + meta: InferenceSummaryV2Response.Meta; + + summary_0: { [key: string]: string }; +} + +export namespace InferenceSummaryV2Response { + /** + * Metadata for the results. + */ + export interface Meta { + confidenceInfo: Meta.ConfidenceInfo; + + dateRange: Array; + + /** + * Timestamp of the last dataset update. + */ + lastUpdated: string; + + /** + * Normalization method applied to the results. Refer to + * [Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/). + */ + normalization: + | 'PERCENTAGE' + | 'MIN0_MAX' + | 'MIN_MAX' + | 'RAW_VALUES' + | 'PERCENTAGE_CHANGE' + | 'ROLLING_AVERAGE' + | 'OVERLAPPED_PERCENTAGE' + | 'RATIO'; + + /** + * Measurement units for the results. + */ + units: Array; + } + + export namespace Meta { + export interface ConfidenceInfo { + annotations: Array; + + /** + * Provides an indication of how much confidence Cloudflare has in the data. + */ + level: number; + } + + export namespace ConfidenceInfo { + /** + * Annotation associated with the result (e.g. outage or other type of event). + */ + export interface Annotation { + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; + + description: string; + + endDate: string; + + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; + + /** + * Whether event is a single point in time or a time range. + */ + isInstantaneous: boolean; + + linkedUrl: string; + + startDate: string; + } + } + + export interface DateRange { + /** + * Adjusted end of date range. + */ + endTime: string; + + /** + * Adjusted start of date range. + */ + startTime: string; + } + + export interface Unit { + name: string; + + value: string; + } + } +} + +export interface InferenceTimeseriesGroupsV2Response { + /** + * Metadata for the results. + */ + meta: InferenceTimeseriesGroupsV2Response.Meta; + + serie_0: InferenceTimeseriesGroupsV2Response.Serie0; +} + +export namespace InferenceTimeseriesGroupsV2Response { + /** + * Metadata for the results. + */ + export interface Meta { + /** + * Aggregation interval of the results (e.g., in 15 minutes or 1 hour intervals). + * Refer to + * [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + */ + aggInterval: 'FIFTEEN_MINUTES' | 'ONE_HOUR' | 'ONE_DAY' | 'ONE_WEEK' | 'ONE_MONTH'; + + confidenceInfo: Meta.ConfidenceInfo; + + dateRange: Array; + + /** + * Timestamp of the last dataset update. + */ + lastUpdated: string; + + /** + * Normalization method applied to the results. Refer to + * [Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/). + */ + normalization: + | 'PERCENTAGE' + | 'MIN0_MAX' + | 'MIN_MAX' + | 'RAW_VALUES' + | 'PERCENTAGE_CHANGE' + | 'ROLLING_AVERAGE' + | 'OVERLAPPED_PERCENTAGE' + | 'RATIO'; + + /** + * Measurement units for the results. + */ + units: Array; + } + + export namespace Meta { + export interface ConfidenceInfo { + annotations: Array; + + /** + * Provides an indication of how much confidence Cloudflare has in the data. + */ + level: number; + } + + export namespace ConfidenceInfo { + /** + * Annotation associated with the result (e.g. outage or other type of event). + */ + export interface Annotation { + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; + + description: string; + + endDate: string; + + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; + + /** + * Whether event is a single point in time or a time range. + */ + isInstantaneous: boolean; + + linkedUrl: string; + + startDate: string; + } + } + + export interface DateRange { + /** + * Adjusted end of date range. + */ + endTime: string; + + /** + * Adjusted start of date range. + */ + startTime: string; + } + + export interface Unit { + name: string; + + value: string; + } + } + + export interface Serie0 { + timestamps: Array; + + [k: string]: Array | Array | undefined; + } +} + +export interface InferenceSummaryV2Params { + /** + * Filters results by Autonomous System. Specify one or more Autonomous System + * Numbers (ASNs) as a comma-separated list. Prefix with `-` to exclude ASNs from + * results. For example, `-174, 3356` excludes results from AS174, but includes + * results from AS3356. + */ + asn?: Array; + + /** + * Filters results by continent. Specify a comma-separated list of alpha-2 codes. + * Prefix with `-` to exclude continents from results. For example, `-EU,NA` + * excludes results from EU, but includes results from NA. + */ + continent?: Array; + + /** + * End of the date range (inclusive). + */ + dateEnd?: Array; + + /** + * Filters results by date range. For example, use `7d` and `7dcontrol` to compare + * this week with the previous week. Use this parameter or set specific start and + * end dates (`dateStart` and `dateEnd` parameters). + */ + dateRange?: Array; + + /** + * Start of the date range. + */ + dateStart?: Array; + + /** + * Format in which results will be returned. + */ + format?: 'JSON' | 'CSV'; + + /** + * Limits the number of objects per group to the top items within the specified + * time range. When item count exceeds the limit, extra items appear grouped under + * an "other" category. + */ + limitPerGroup?: number; + + /** + * Filters results by location. Specify a comma-separated list of alpha-2 codes. + * Prefix with `-` to exclude locations from results. For example, `-US,PT` + * excludes results from the US, but includes results from PT. + */ + location?: Array; + + /** + * Array of names used to label the series in the response. + */ + name?: Array; +} + +export interface InferenceTimeseriesGroupsV2Params { + /** + * Aggregation interval of the results (e.g., in 15 minutes or 1 hour intervals). + * Refer to + * [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + */ + aggInterval?: '15m' | '1h' | '1d' | '1w'; + + /** + * Filters results by Autonomous System. Specify one or more Autonomous System + * Numbers (ASNs) as a comma-separated list. Prefix with `-` to exclude ASNs from + * results. For example, `-174, 3356` excludes results from AS174, but includes + * results from AS3356. + */ + asn?: Array; + + /** + * Filters results by continent. Specify a comma-separated list of alpha-2 codes. + * Prefix with `-` to exclude continents from results. For example, `-EU,NA` + * excludes results from EU, but includes results from NA. + */ + continent?: Array; + + /** + * End of the date range (inclusive). + */ + dateEnd?: Array; + + /** + * Filters results by date range. For example, use `7d` and `7dcontrol` to compare + * this week with the previous week. Use this parameter or set specific start and + * end dates (`dateStart` and `dateEnd` parameters). + */ + dateRange?: Array; + + /** + * Start of the date range. + */ + dateStart?: Array; + + /** + * Format in which results will be returned. + */ + format?: 'JSON' | 'CSV'; + + /** + * Limits the number of objects per group to the top items within the specified + * time range. When item count exceeds the limit, extra items appear grouped under + * an "other" category. + */ + limitPerGroup?: number; + + /** + * Filters results by location. Specify a comma-separated list of alpha-2 codes. + * Prefix with `-` to exclude locations from results. For example, `-US,PT` + * excludes results from the US, but includes results from PT. + */ + location?: Array; + + /** + * Array of names used to label the series in the response. + */ + name?: Array; + + /** + * Normalization method applied to the results. Refer to + * [Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/). + */ + normalization?: 'PERCENTAGE_CHANGE' | 'MIN0_MAX'; } Inference.Summary = Summary; Inference.TimeseriesGroups = TimeseriesGroups; export declare namespace Inference { + export { + type InferenceSummaryV2Response as InferenceSummaryV2Response, + type InferenceTimeseriesGroupsV2Response as InferenceTimeseriesGroupsV2Response, + type InferenceSummaryV2Params as InferenceSummaryV2Params, + type InferenceTimeseriesGroupsV2Params as InferenceTimeseriesGroupsV2Params, + }; + export { Summary as Summary, type SummaryModelResponse as SummaryModelResponse, diff --git a/src/resources/radar/ai/inference/summary.ts b/src/resources/radar/ai/inference/summary.ts index a22b6f10e9..4927908af3 100644 --- a/src/resources/radar/ai/inference/summary.ts +++ b/src/resources/radar/ai/inference/summary.ts @@ -8,7 +8,7 @@ export class Summary extends APIResource { /** * Retrieves the distribution of unique accounts by model. * - * @deprecated + * @deprecated Use [Radar AI Inference Summary By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/ai/subresources/inference/methods/summary_v2/) instead. */ model(query?: SummaryModelParams, options?: Core.RequestOptions): Core.APIPromise; model(options?: Core.RequestOptions): Core.APIPromise; @@ -29,7 +29,7 @@ export class Summary extends APIResource { /** * Retrieves the distribution of unique accounts by task. * - * @deprecated + * @deprecated Use [Radar AI Inference Summary By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/ai/subresources/inference/methods/summary_v2/) instead. */ task(query?: SummaryTaskParams, options?: Core.RequestOptions): Core.APIPromise; task(options?: Core.RequestOptions): Core.APIPromise; @@ -106,13 +106,44 @@ export namespace SummaryModelResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -203,13 +234,44 @@ export namespace SummaryTaskResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. diff --git a/src/resources/radar/ai/inference/timeseries-groups/summary.ts b/src/resources/radar/ai/inference/timeseries-groups/summary.ts index bf808d1b21..7a95c0ff53 100644 --- a/src/resources/radar/ai/inference/timeseries-groups/summary.ts +++ b/src/resources/radar/ai/inference/timeseries-groups/summary.ts @@ -8,7 +8,7 @@ export class Summary extends APIResource { /** * Retrieves the distribution of unique accounts by model over time. * - * @deprecated + * @deprecated Use [Radar AI Inference Timeseries Groups By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/ai/subresources/inference/methods/timeseries_groups_v2/) instead. */ model(query?: SummaryModelParams, options?: Core.RequestOptions): Core.APIPromise; model(options?: Core.RequestOptions): Core.APIPromise; @@ -30,7 +30,7 @@ export class Summary extends APIResource { /** * Retrieves the distribution of unique accounts by task over time. * - * @deprecated + * @deprecated Use [Radar AI Inference Timeseries Groups By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/ai/subresources/inference/methods/timeseries_groups_v2/) instead. */ task(query?: SummaryTaskParams, options?: Core.RequestOptions): Core.APIPromise; task(options?: Core.RequestOptions): Core.APIPromise; @@ -115,13 +115,44 @@ export namespace SummaryModelResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -225,13 +256,44 @@ export namespace SummaryTaskResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. diff --git a/src/resources/radar/ai/timeseries-groups.ts b/src/resources/radar/ai/timeseries-groups.ts index 09ff1ff862..c42612565a 100644 --- a/src/resources/radar/ai/timeseries-groups.ts +++ b/src/resources/radar/ai/timeseries-groups.ts @@ -9,13 +9,7 @@ export class TimeseriesGroups extends APIResource { * Retrieves an aggregated summary of AI bots HTTP requests grouped by the * specified dimension. * - * @example - * ```ts - * const response = - * await client.radar.ai.timeseriesGroups.summary( - * 'USER_AGENT', - * ); - * ``` + * @deprecated Use [Radar > AI > Bots > Summary](https://developers.cloudflare.com/api/resources/radar/subresources/ai/subresources/bots/methods/summary_v2/) instead. */ summary( dimension: 'USER_AGENT' | 'CRAWL_PURPOSE' | 'INDUSTRY' | 'VERTICAL', @@ -44,11 +38,7 @@ export class TimeseriesGroups extends APIResource { /** * Retrieves AI bots HTTP request volume over time. * - * @example - * ```ts - * const response = - * await client.radar.ai.timeseriesGroups.timeseries(); - * ``` + * @deprecated Use [Radar > AI > Bots > Timeseries](https://developers.cloudflare.com/api/resources/radar/subresources/ai/subresources/bots/methods/timeseries/) instead. */ timeseries( query?: TimeseriesGroupTimeseriesParams, @@ -73,13 +63,7 @@ export class TimeseriesGroups extends APIResource { * Retrieves the distribution of HTTP requests from AI bots, grouped by chosen the * specified dimension over time. * - * @example - * ```ts - * const response = - * await client.radar.ai.timeseriesGroups.timeseriesGroups( - * 'USER_AGENT', - * ); - * ``` + * @deprecated Use [Radar > AI > Bots > Timeseries Groups](https://developers.cloudflare.com/api/resources/radar/subresources/ai/subresources/bots/methods/timeseries_groups/) instead. */ timeseriesGroups( dimension: 'USER_AGENT' | 'CRAWL_PURPOSE' | 'INDUSTRY' | 'VERTICAL', @@ -109,7 +93,7 @@ export class TimeseriesGroups extends APIResource { /** * Retrieves the distribution of traffic by AI user agent over time. * - * @deprecated + * @deprecated Use [Radar AI Bots Timeseries Groups By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/ai/subresources/bots/methods/timeseries_groups/) instead. */ userAgent( query?: TimeseriesGroupUserAgentParams, @@ -190,13 +174,44 @@ export namespace TimeseriesGroupSummaryResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -297,13 +312,44 @@ export namespace TimeseriesGroupTimeseriesResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -407,13 +453,44 @@ export namespace TimeseriesGroupTimeseriesGroupsResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -517,13 +594,44 @@ export namespace TimeseriesGroupUserAgentResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. diff --git a/src/resources/radar/ai/to-markdown.ts b/src/resources/radar/ai/to-markdown.ts index cc254c45c8..b3016565e9 100644 --- a/src/resources/radar/ai/to-markdown.ts +++ b/src/resources/radar/ai/to-markdown.ts @@ -9,16 +9,7 @@ export class ToMarkdown extends APIResource { /** * Convert Files into Markdown * - * @example - * ```ts - * // Automatically fetches more pages as needed. - * for await (const toMarkdownCreateResponse of client.radar.ai.toMarkdown.create( - * fs.createReadStream('path/to/file'), - * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, - * )) { - * // ... - * } - * ``` + * @deprecated Use [AI > To Markdown](https://developers.cloudflare.com/api/resources/ai/subresources/to_markdown/) instead. */ create( body: string | ArrayBufferView | ArrayBuffer | BlobLike, diff --git a/src/resources/radar/annotations/annotations.ts b/src/resources/radar/annotations/annotations.ts index 53c6ec4b4d..0081472338 100644 --- a/src/resources/radar/annotations/annotations.ts +++ b/src/resources/radar/annotations/annotations.ts @@ -60,6 +60,10 @@ export namespace AnnotationListResponse { locationsDetails: Array; + origins: Array; + + originsDetails: Array; + outage: Annotation.Outage; startDate: string; @@ -96,6 +100,12 @@ export namespace AnnotationListResponse { name: string; } + export interface OriginsDetail { + name: string; + + origin: string; + } + export interface Outage { outageCause: string; @@ -111,6 +121,36 @@ export interface AnnotationListParams { */ asn?: number; + /** + * Filters results by data source. + */ + dataSource?: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; + /** * End of the date range (inclusive). */ @@ -126,6 +166,11 @@ export interface AnnotationListParams { */ dateStart?: string; + /** + * Filters results by event type. + */ + eventType?: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; + /** * Format in which results will be returned. */ @@ -145,6 +190,11 @@ export interface AnnotationListParams { * Skips the specified number of objects before fetching the results. */ offset?: number; + + /** + * Filters results by origin. + */ + origin?: string; } Annotations.Outages = Outages; diff --git a/src/resources/radar/annotations/outages.ts b/src/resources/radar/annotations/outages.ts index aa96529ac2..387130d287 100644 --- a/src/resources/radar/annotations/outages.ts +++ b/src/resources/radar/annotations/outages.ts @@ -78,6 +78,10 @@ export namespace OutageGetResponse { locationsDetails: Array; + origins: Array; + + originsDetails: Array; + outage: Annotation.Outage; startDate: string; @@ -114,6 +118,12 @@ export namespace OutageGetResponse { name: string; } + export interface OriginsDetail { + name: string; + + origin: string; + } + export interface Outage { outageCause: string; @@ -180,6 +190,11 @@ export interface OutageGetParams { * Skips the specified number of objects before fetching the results. */ offset?: number; + + /** + * Filters results by origin. + */ + origin?: string; } export interface OutageLocationsParams { diff --git a/src/resources/radar/as112/as112.ts b/src/resources/radar/as112/as112.ts index 876d8d74aa..8db8abc332 100644 --- a/src/resources/radar/as112/as112.ts +++ b/src/resources/radar/as112/as112.ts @@ -55,6 +55,40 @@ export class AS112 extends APIResource { ); top: TopAPI.Top = new TopAPI.Top(this._client); + /** + * Retrieves the distribution of AS112 queries by the specified dimension. + * + * @example + * ```ts + * const response = await client.radar.as112.summaryV2( + * 'DNSSEC', + * ); + * ``` + */ + summaryV2( + dimension: 'DNSSEC' | 'EDNS' | 'IP_VERSION' | 'PROTOCOL' | 'QUERY_TYPE' | 'RESPONSE_CODE', + query?: AS112SummaryV2Params, + options?: Core.RequestOptions, + ): Core.APIPromise; + summaryV2( + dimension: 'DNSSEC' | 'EDNS' | 'IP_VERSION' | 'PROTOCOL' | 'QUERY_TYPE' | 'RESPONSE_CODE', + options?: Core.RequestOptions, + ): Core.APIPromise; + summaryV2( + dimension: 'DNSSEC' | 'EDNS' | 'IP_VERSION' | 'PROTOCOL' | 'QUERY_TYPE' | 'RESPONSE_CODE', + query: AS112SummaryV2Params | Core.RequestOptions = {}, + options?: Core.RequestOptions, + ): Core.APIPromise { + if (isRequestOptions(query)) { + return this.summaryV2(dimension, {}, query); + } + return ( + this._client.get(`/radar/as112/summary/${dimension}`, { query, ...options }) as Core.APIPromise<{ + result: AS112SummaryV2Response; + }> + )._thenUnwrap((obj) => obj.result); + } + /** * Retrieves the AS112 DNS queries over time. * @@ -81,6 +115,168 @@ export class AS112 extends APIResource { }> )._thenUnwrap((obj) => obj.result); } + + /** + * Retrieves the distribution of AS112 queries grouped by dimension over time. + * + * @example + * ```ts + * const response = + * await client.radar.as112.timeseriesGroupsV2('DNSSEC'); + * ``` + */ + timeseriesGroupsV2( + dimension: 'DNSSEC' | 'EDNS' | 'IP_VERSION' | 'PROTOCOL' | 'QUERY_TYPE' | 'RESPONSE_CODE', + query?: AS112TimeseriesGroupsV2Params, + options?: Core.RequestOptions, + ): Core.APIPromise; + timeseriesGroupsV2( + dimension: 'DNSSEC' | 'EDNS' | 'IP_VERSION' | 'PROTOCOL' | 'QUERY_TYPE' | 'RESPONSE_CODE', + options?: Core.RequestOptions, + ): Core.APIPromise; + timeseriesGroupsV2( + dimension: 'DNSSEC' | 'EDNS' | 'IP_VERSION' | 'PROTOCOL' | 'QUERY_TYPE' | 'RESPONSE_CODE', + query: AS112TimeseriesGroupsV2Params | Core.RequestOptions = {}, + options?: Core.RequestOptions, + ): Core.APIPromise { + if (isRequestOptions(query)) { + return this.timeseriesGroupsV2(dimension, {}, query); + } + return ( + this._client.get(`/radar/as112/timeseries_groups/${dimension}`, { + query, + ...options, + }) as Core.APIPromise<{ result: AS112TimeseriesGroupsV2Response }> + )._thenUnwrap((obj) => obj.result); + } +} + +export interface AS112SummaryV2Response { + /** + * Metadata for the results. + */ + meta: AS112SummaryV2Response.Meta; + + summary_0: { [key: string]: string }; +} + +export namespace AS112SummaryV2Response { + /** + * Metadata for the results. + */ + export interface Meta { + confidenceInfo: Meta.ConfidenceInfo; + + dateRange: Array; + + /** + * Timestamp of the last dataset update. + */ + lastUpdated: string; + + /** + * Normalization method applied to the results. Refer to + * [Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/). + */ + normalization: + | 'PERCENTAGE' + | 'MIN0_MAX' + | 'MIN_MAX' + | 'RAW_VALUES' + | 'PERCENTAGE_CHANGE' + | 'ROLLING_AVERAGE' + | 'OVERLAPPED_PERCENTAGE' + | 'RATIO'; + + /** + * Measurement units for the results. + */ + units: Array; + } + + export namespace Meta { + export interface ConfidenceInfo { + annotations: Array; + + /** + * Provides an indication of how much confidence Cloudflare has in the data. + */ + level: number; + } + + export namespace ConfidenceInfo { + /** + * Annotation associated with the result (e.g. outage or other type of event). + */ + export interface Annotation { + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; + + description: string; + + endDate: string; + + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; + + /** + * Whether event is a single point in time or a time range. + */ + isInstantaneous: boolean; + + linkedUrl: string; + + startDate: string; + } + } + + export interface DateRange { + /** + * Adjusted end of date range. + */ + endTime: string; + + /** + * Adjusted start of date range. + */ + startTime: string; + } + + export interface Unit { + name: string; + + value: string; + } + } } export interface AS112TimeseriesResponse { @@ -151,13 +347,44 @@ export namespace AS112TimeseriesResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -196,14 +423,148 @@ export namespace AS112TimeseriesResponse { } } -export interface AS112TimeseriesParams { +export interface AS112TimeseriesGroupsV2Response { /** - * Aggregation interval of the results (e.g., in 15 minutes or 1 hour intervals). - * Refer to - * [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + * Metadata for the results. */ - aggInterval?: '15m' | '1h' | '1d' | '1w'; + meta: AS112TimeseriesGroupsV2Response.Meta; + + serie_0: AS112TimeseriesGroupsV2Response.Serie0; +} + +export namespace AS112TimeseriesGroupsV2Response { + /** + * Metadata for the results. + */ + export interface Meta { + /** + * Aggregation interval of the results (e.g., in 15 minutes or 1 hour intervals). + * Refer to + * [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + */ + aggInterval: 'FIFTEEN_MINUTES' | 'ONE_HOUR' | 'ONE_DAY' | 'ONE_WEEK' | 'ONE_MONTH'; + + confidenceInfo: Meta.ConfidenceInfo; + + dateRange: Array; + + /** + * Timestamp of the last dataset update. + */ + lastUpdated: string; + + /** + * Normalization method applied to the results. Refer to + * [Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/). + */ + normalization: + | 'PERCENTAGE' + | 'MIN0_MAX' + | 'MIN_MAX' + | 'RAW_VALUES' + | 'PERCENTAGE_CHANGE' + | 'ROLLING_AVERAGE' + | 'OVERLAPPED_PERCENTAGE' + | 'RATIO'; + + /** + * Measurement units for the results. + */ + units: Array; + } + + export namespace Meta { + export interface ConfidenceInfo { + annotations: Array; + + /** + * Provides an indication of how much confidence Cloudflare has in the data. + */ + level: number; + } + + export namespace ConfidenceInfo { + /** + * Annotation associated with the result (e.g. outage or other type of event). + */ + export interface Annotation { + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; + + description: string; + + endDate: string; + + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; + + /** + * Whether event is a single point in time or a time range. + */ + isInstantaneous: boolean; + + linkedUrl: string; + + startDate: string; + } + } + + export interface DateRange { + /** + * Adjusted end of date range. + */ + endTime: string; + + /** + * Adjusted start of date range. + */ + startTime: string; + } + + export interface Unit { + name: string; + + value: string; + } + } + + export interface Serie0 { + timestamps: Array; + + [k: string]: Array | Array | undefined; + } +} +export interface AS112SummaryV2Params { /** * Filters results by continent. Specify a comma-separated list of alpha-2 codes. * Prefix with `-` to exclude continents from results. For example, `-EU,NA` @@ -233,6 +594,370 @@ export interface AS112TimeseriesParams { */ format?: 'JSON' | 'CSV'; + /** + * Limits the number of objects per group to the top items within the specified + * time range. When item count exceeds the limit, extra items appear grouped under + * an "other" category. + */ + limitPerGroup?: number; + + /** + * Filters results by location. Specify a comma-separated list of alpha-2 codes. + * Prefix with `-` to exclude locations from results. For example, `-US,PT` + * excludes results from the US, but includes results from PT. + */ + location?: Array; + + /** + * Array of names used to label the series in the response. + */ + name?: Array; + + /** + * Filters results by DNS transport protocol. + */ + protocol?: Array<'UDP' | 'TCP' | 'HTTPS' | 'TLS'>; + + /** + * Filters results by DNS query type. + */ + queryType?: Array< + | 'A' + | 'AAAA' + | 'A6' + | 'AFSDB' + | 'ANY' + | 'APL' + | 'ATMA' + | 'AXFR' + | 'CAA' + | 'CDNSKEY' + | 'CDS' + | 'CERT' + | 'CNAME' + | 'CSYNC' + | 'DHCID' + | 'DLV' + | 'DNAME' + | 'DNSKEY' + | 'DOA' + | 'DS' + | 'EID' + | 'EUI48' + | 'EUI64' + | 'GPOS' + | 'GID' + | 'HINFO' + | 'HIP' + | 'HTTPS' + | 'IPSECKEY' + | 'ISDN' + | 'IXFR' + | 'KEY' + | 'KX' + | 'L32' + | 'L64' + | 'LOC' + | 'LP' + | 'MAILA' + | 'MAILB' + | 'MB' + | 'MD' + | 'MF' + | 'MG' + | 'MINFO' + | 'MR' + | 'MX' + | 'NAPTR' + | 'NB' + | 'NBSTAT' + | 'NID' + | 'NIMLOC' + | 'NINFO' + | 'NS' + | 'NSAP' + | 'NSEC' + | 'NSEC3' + | 'NSEC3PARAM' + | 'NULL' + | 'NXT' + | 'OPENPGPKEY' + | 'OPT' + | 'PTR' + | 'PX' + | 'RKEY' + | 'RP' + | 'RRSIG' + | 'RT' + | 'SIG' + | 'SINK' + | 'SMIMEA' + | 'SOA' + | 'SPF' + | 'SRV' + | 'SSHFP' + | 'SVCB' + | 'TA' + | 'TALINK' + | 'TKEY' + | 'TLSA' + | 'TSIG' + | 'TXT' + | 'UINFO' + | 'UID' + | 'UNSPEC' + | 'URI' + | 'WKS' + | 'X25' + | 'ZONEMD' + | null + >; + + /** + * Filters results by DNS response code. + */ + responseCode?: Array< + | 'NOERROR' + | 'FORMERR' + | 'SERVFAIL' + | 'NXDOMAIN' + | 'NOTIMP' + | 'REFUSED' + | 'YXDOMAIN' + | 'YXRRSET' + | 'NXRRSET' + | 'NOTAUTH' + | 'NOTZONE' + | 'BADSIG' + | 'BADKEY' + | 'BADTIME' + | 'BADMODE' + | 'BADNAME' + | 'BADALG' + | 'BADTRUNC' + | 'BADCOOKIE' + >; +} + +export interface AS112TimeseriesParams { + /** + * Aggregation interval of the results (e.g., in 15 minutes or 1 hour intervals). + * Refer to + * [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + */ + aggInterval?: '15m' | '1h' | '1d' | '1w'; + + /** + * Filters results by continent. Specify a comma-separated list of alpha-2 codes. + * Prefix with `-` to exclude continents from results. For example, `-EU,NA` + * excludes results from EU, but includes results from NA. + */ + continent?: Array; + + /** + * End of the date range (inclusive). + */ + dateEnd?: Array; + + /** + * Filters results by date range. For example, use `7d` and `7dcontrol` to compare + * this week with the previous week. Use this parameter or set specific start and + * end dates (`dateStart` and `dateEnd` parameters). + */ + dateRange?: Array; + + /** + * Start of the date range. + */ + dateStart?: Array; + + /** + * Format in which results will be returned. + */ + format?: 'JSON' | 'CSV'; + + /** + * Filters results by location. Specify a comma-separated list of alpha-2 codes. + * Prefix with `-` to exclude locations from results. For example, `-US,PT` + * excludes results from the US, but includes results from PT. + */ + location?: Array; + + /** + * Array of names used to label the series in the response. + */ + name?: Array; + + /** + * Filters results by DNS transport protocol. + */ + protocol?: Array<'UDP' | 'TCP' | 'HTTPS' | 'TLS'>; + + /** + * Filters results by DNS query type. + */ + queryType?: Array< + | 'A' + | 'AAAA' + | 'A6' + | 'AFSDB' + | 'ANY' + | 'APL' + | 'ATMA' + | 'AXFR' + | 'CAA' + | 'CDNSKEY' + | 'CDS' + | 'CERT' + | 'CNAME' + | 'CSYNC' + | 'DHCID' + | 'DLV' + | 'DNAME' + | 'DNSKEY' + | 'DOA' + | 'DS' + | 'EID' + | 'EUI48' + | 'EUI64' + | 'GPOS' + | 'GID' + | 'HINFO' + | 'HIP' + | 'HTTPS' + | 'IPSECKEY' + | 'ISDN' + | 'IXFR' + | 'KEY' + | 'KX' + | 'L32' + | 'L64' + | 'LOC' + | 'LP' + | 'MAILA' + | 'MAILB' + | 'MB' + | 'MD' + | 'MF' + | 'MG' + | 'MINFO' + | 'MR' + | 'MX' + | 'NAPTR' + | 'NB' + | 'NBSTAT' + | 'NID' + | 'NIMLOC' + | 'NINFO' + | 'NS' + | 'NSAP' + | 'NSEC' + | 'NSEC3' + | 'NSEC3PARAM' + | 'NULL' + | 'NXT' + | 'OPENPGPKEY' + | 'OPT' + | 'PTR' + | 'PX' + | 'RKEY' + | 'RP' + | 'RRSIG' + | 'RT' + | 'SIG' + | 'SINK' + | 'SMIMEA' + | 'SOA' + | 'SPF' + | 'SRV' + | 'SSHFP' + | 'SVCB' + | 'TA' + | 'TALINK' + | 'TKEY' + | 'TLSA' + | 'TSIG' + | 'TXT' + | 'UINFO' + | 'UID' + | 'UNSPEC' + | 'URI' + | 'WKS' + | 'X25' + | 'ZONEMD' + | null + >; + + /** + * Filters results by DNS response code. + */ + responseCode?: Array< + | 'NOERROR' + | 'FORMERR' + | 'SERVFAIL' + | 'NXDOMAIN' + | 'NOTIMP' + | 'REFUSED' + | 'YXDOMAIN' + | 'YXRRSET' + | 'NXRRSET' + | 'NOTAUTH' + | 'NOTZONE' + | 'BADSIG' + | 'BADKEY' + | 'BADTIME' + | 'BADMODE' + | 'BADNAME' + | 'BADALG' + | 'BADTRUNC' + | 'BADCOOKIE' + >; +} + +export interface AS112TimeseriesGroupsV2Params { + /** + * Aggregation interval of the results (e.g., in 15 minutes or 1 hour intervals). + * Refer to + * [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + */ + aggInterval?: '15m' | '1h' | '1d' | '1w'; + + /** + * Filters results by continent. Specify a comma-separated list of alpha-2 codes. + * Prefix with `-` to exclude continents from results. For example, `-EU,NA` + * excludes results from EU, but includes results from NA. + */ + continent?: Array; + + /** + * End of the date range (inclusive). + */ + dateEnd?: Array; + + /** + * Filters results by date range. For example, use `7d` and `7dcontrol` to compare + * this week with the previous week. Use this parameter or set specific start and + * end dates (`dateStart` and `dateEnd` parameters). + */ + dateRange?: Array; + + /** + * Start of the date range. + */ + dateStart?: Array; + + /** + * Format in which results will be returned. + */ + format?: 'JSON' | 'CSV'; + + /** + * Limits the number of objects per group to the top items within the specified + * time range. When item count exceeds the limit, extra items appear grouped under + * an "other" category. + */ + limitPerGroup?: number; + /** * Filters results by location. Specify a comma-separated list of alpha-2 codes. * Prefix with `-` to exclude locations from results. For example, `-US,PT` @@ -248,12 +973,12 @@ export interface AS112TimeseriesParams { /** * Filters results by DNS transport protocol. */ - protocol?: 'UDP' | 'TCP' | 'HTTPS' | 'TLS'; + protocol?: Array<'UDP' | 'TCP' | 'HTTPS' | 'TLS'>; /** * Filters results by DNS query type. */ - queryType?: + queryType?: Array< | 'A' | 'AAAA' | 'A6' @@ -342,12 +1067,13 @@ export interface AS112TimeseriesParams { | 'WKS' | 'X25' | 'ZONEMD' - | null; + | null + >; /** * Filters results by DNS response code. */ - responseCode?: + responseCode?: Array< | 'NOERROR' | 'FORMERR' | 'SERVFAIL' @@ -366,7 +1092,8 @@ export interface AS112TimeseriesParams { | 'BADNAME' | 'BADALG' | 'BADTRUNC' - | 'BADCOOKIE'; + | 'BADCOOKIE' + >; } AS112.Summary = Summary; @@ -375,8 +1102,12 @@ AS112.Top = Top; export declare namespace AS112 { export { + type AS112SummaryV2Response as AS112SummaryV2Response, type AS112TimeseriesResponse as AS112TimeseriesResponse, + type AS112TimeseriesGroupsV2Response as AS112TimeseriesGroupsV2Response, + type AS112SummaryV2Params as AS112SummaryV2Params, type AS112TimeseriesParams as AS112TimeseriesParams, + type AS112TimeseriesGroupsV2Params as AS112TimeseriesGroupsV2Params, }; export { diff --git a/src/resources/radar/as112/index.ts b/src/resources/radar/as112/index.ts index 7b5e4752cb..f3e1911eea 100644 --- a/src/resources/radar/as112/index.ts +++ b/src/resources/radar/as112/index.ts @@ -1,6 +1,14 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { AS112, type AS112TimeseriesResponse, type AS112TimeseriesParams } from './as112'; +export { + AS112, + type AS112SummaryV2Response, + type AS112TimeseriesResponse, + type AS112TimeseriesGroupsV2Response, + type AS112SummaryV2Params, + type AS112TimeseriesParams, + type AS112TimeseriesGroupsV2Params, +} from './as112'; export { Summary, type SummaryDNSSECResponse, diff --git a/src/resources/radar/as112/summary.ts b/src/resources/radar/as112/summary.ts index c59fdaeb5a..a4948a9737 100644 --- a/src/resources/radar/as112/summary.ts +++ b/src/resources/radar/as112/summary.ts @@ -9,10 +9,7 @@ export class Summary extends APIResource { * Retrieves the distribution of DNS queries to AS112 by DNSSEC (DNS Security * Extensions) support. * - * @example - * ```ts - * const response = await client.radar.as112.summary.dnssec(); - * ``` + * @deprecated Use [Radar AS112 Summary By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/as112/methods/summary_v2/) instead. */ dnssec(query?: SummaryDNSSECParams, options?: Core.RequestOptions): Core.APIPromise; dnssec(options?: Core.RequestOptions): Core.APIPromise; @@ -34,10 +31,7 @@ export class Summary extends APIResource { * Retrieves the distribution of DNS queries to AS112 by EDNS (Extension Mechanisms * for DNS) support. * - * @example - * ```ts - * const response = await client.radar.as112.summary.edns(); - * ``` + * @deprecated Use [Radar AS112 Summary By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/as112/methods/summary_v2/) instead. */ edns(query?: SummaryEdnsParams, options?: Core.RequestOptions): Core.APIPromise; edns(options?: Core.RequestOptions): Core.APIPromise; @@ -58,11 +52,7 @@ export class Summary extends APIResource { /** * Retrieves the distribution of DNS queries to AS112 by IP version. * - * @example - * ```ts - * const response = - * await client.radar.as112.summary.ipVersion(); - * ``` + * @deprecated Use [Radar AS112 Summary By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/as112/methods/summary_v2/) instead. */ ipVersion( query?: SummaryIPVersionParams, @@ -86,11 +76,7 @@ export class Summary extends APIResource { /** * Retrieves the distribution of DNS queries to AS112 by protocol. * - * @example - * ```ts - * const response = - * await client.radar.as112.summary.protocol(); - * ``` + * @deprecated Use [Radar AS112 Summary By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/as112/methods/summary_v2/) instead. */ protocol( query?: SummaryProtocolParams, @@ -114,11 +100,7 @@ export class Summary extends APIResource { /** * Retrieves the distribution of DNS queries to AS112 by type. * - * @example - * ```ts - * const response = - * await client.radar.as112.summary.queryType(); - * ``` + * @deprecated Use [Radar AS112 Summary By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/as112/methods/summary_v2/) instead. */ queryType( query?: SummaryQueryTypeParams, @@ -142,11 +124,7 @@ export class Summary extends APIResource { /** * Retrieves the distribution of AS112 DNS requests classified by response code. * - * @example - * ```ts - * const response = - * await client.radar.as112.summary.responseCodes(); - * ``` + * @deprecated Use [Radar AS112 Summary By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/as112/methods/summary_v2/) instead. */ responseCodes( query?: SummaryResponseCodesParams, @@ -226,13 +204,44 @@ export namespace SummaryDNSSECResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -335,13 +344,44 @@ export namespace SummaryEdnsResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -444,13 +484,44 @@ export namespace SummaryIPVersionResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -553,13 +624,44 @@ export namespace SummaryProtocolResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -672,13 +774,44 @@ export namespace SummaryQueryTypeResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -769,13 +902,44 @@ export namespace SummaryResponseCodesResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -853,12 +1017,12 @@ export interface SummaryDNSSECParams { /** * Filters results by DNS transport protocol. */ - protocol?: 'UDP' | 'TCP' | 'HTTPS' | 'TLS'; + protocol?: Array<'UDP' | 'TCP' | 'HTTPS' | 'TLS'>; /** * Filters results by DNS query type. */ - queryType?: + queryType?: Array< | 'A' | 'AAAA' | 'A6' @@ -947,12 +1111,13 @@ export interface SummaryDNSSECParams { | 'WKS' | 'X25' | 'ZONEMD' - | null; + | null + >; /** * Filters results by DNS response code. */ - responseCode?: + responseCode?: Array< | 'NOERROR' | 'FORMERR' | 'SERVFAIL' @@ -971,7 +1136,8 @@ export interface SummaryDNSSECParams { | 'BADNAME' | 'BADALG' | 'BADTRUNC' - | 'BADCOOKIE'; + | 'BADCOOKIE' + >; } export interface SummaryEdnsParams { @@ -1019,12 +1185,12 @@ export interface SummaryEdnsParams { /** * Filters results by DNS transport protocol. */ - protocol?: 'UDP' | 'TCP' | 'HTTPS' | 'TLS'; + protocol?: Array<'UDP' | 'TCP' | 'HTTPS' | 'TLS'>; /** * Filters results by DNS query type. */ - queryType?: + queryType?: Array< | 'A' | 'AAAA' | 'A6' @@ -1113,12 +1279,13 @@ export interface SummaryEdnsParams { | 'WKS' | 'X25' | 'ZONEMD' - | null; + | null + >; /** * Filters results by DNS response code. */ - responseCode?: + responseCode?: Array< | 'NOERROR' | 'FORMERR' | 'SERVFAIL' @@ -1137,7 +1304,8 @@ export interface SummaryEdnsParams { | 'BADNAME' | 'BADALG' | 'BADTRUNC' - | 'BADCOOKIE'; + | 'BADCOOKIE' + >; } export interface SummaryIPVersionParams { @@ -1185,12 +1353,12 @@ export interface SummaryIPVersionParams { /** * Filters results by DNS transport protocol. */ - protocol?: 'UDP' | 'TCP' | 'HTTPS' | 'TLS'; + protocol?: Array<'UDP' | 'TCP' | 'HTTPS' | 'TLS'>; /** * Filters results by DNS query type. */ - queryType?: + queryType?: Array< | 'A' | 'AAAA' | 'A6' @@ -1279,12 +1447,13 @@ export interface SummaryIPVersionParams { | 'WKS' | 'X25' | 'ZONEMD' - | null; + | null + >; /** * Filters results by DNS response code. */ - responseCode?: + responseCode?: Array< | 'NOERROR' | 'FORMERR' | 'SERVFAIL' @@ -1303,7 +1472,8 @@ export interface SummaryIPVersionParams { | 'BADNAME' | 'BADALG' | 'BADTRUNC' - | 'BADCOOKIE'; + | 'BADCOOKIE' + >; } export interface SummaryProtocolParams { @@ -1351,7 +1521,7 @@ export interface SummaryProtocolParams { /** * Filters results by DNS query type. */ - queryType?: + queryType?: Array< | 'A' | 'AAAA' | 'A6' @@ -1440,12 +1610,13 @@ export interface SummaryProtocolParams { | 'WKS' | 'X25' | 'ZONEMD' - | null; + | null + >; /** * Filters results by DNS response code. */ - responseCode?: + responseCode?: Array< | 'NOERROR' | 'FORMERR' | 'SERVFAIL' @@ -1464,7 +1635,8 @@ export interface SummaryProtocolParams { | 'BADNAME' | 'BADALG' | 'BADTRUNC' - | 'BADCOOKIE'; + | 'BADCOOKIE' + >; } export interface SummaryQueryTypeParams { @@ -1519,12 +1691,12 @@ export interface SummaryQueryTypeParams { /** * Filters results by DNS transport protocol. */ - protocol?: 'UDP' | 'TCP' | 'HTTPS' | 'TLS'; + protocol?: Array<'UDP' | 'TCP' | 'HTTPS' | 'TLS'>; /** * Filters results by DNS response code. */ - responseCode?: + responseCode?: Array< | 'NOERROR' | 'FORMERR' | 'SERVFAIL' @@ -1543,7 +1715,8 @@ export interface SummaryQueryTypeParams { | 'BADNAME' | 'BADALG' | 'BADTRUNC' - | 'BADCOOKIE'; + | 'BADCOOKIE' + >; } export interface SummaryResponseCodesParams { @@ -1598,12 +1771,12 @@ export interface SummaryResponseCodesParams { /** * Filters results by DNS transport protocol. */ - protocol?: 'UDP' | 'TCP' | 'HTTPS' | 'TLS'; + protocol?: Array<'UDP' | 'TCP' | 'HTTPS' | 'TLS'>; /** * Filters results by DNS query type. */ - queryType?: + queryType?: Array< | 'A' | 'AAAA' | 'A6' @@ -1692,7 +1865,8 @@ export interface SummaryResponseCodesParams { | 'WKS' | 'X25' | 'ZONEMD' - | null; + | null + >; } export declare namespace Summary { diff --git a/src/resources/radar/as112/timeseries-groups.ts b/src/resources/radar/as112/timeseries-groups.ts index a9e2aa049c..f3beccd0fb 100644 --- a/src/resources/radar/as112/timeseries-groups.ts +++ b/src/resources/radar/as112/timeseries-groups.ts @@ -9,11 +9,7 @@ export class TimeseriesGroups extends APIResource { * Retrieves the distribution of AS112 DNS queries by DNSSEC (DNS Security * Extensions) support over time. * - * @example - * ```ts - * const response = - * await client.radar.as112.timeseriesGroups.dnssec(); - * ``` + * @deprecated Use [Radar AS112 Timeseries Groups By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/as112/methods/timeseries_groups_v2/) instead. */ dnssec( query?: TimeseriesGroupDNSSECParams, @@ -38,11 +34,7 @@ export class TimeseriesGroups extends APIResource { * Retrieves the distribution of AS112 DNS queries by EDNS (Extension Mechanisms * for DNS) support over time. * - * @example - * ```ts - * const response = - * await client.radar.as112.timeseriesGroups.edns(); - * ``` + * @deprecated Use [Radar AS112 Timeseries Groups By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/as112/methods/timeseries_groups_v2/) instead. */ edns( query?: TimeseriesGroupEdnsParams, @@ -66,11 +58,7 @@ export class TimeseriesGroups extends APIResource { /** * Retrieves the distribution of AS112 DNS queries by IP version over time. * - * @example - * ```ts - * const response = - * await client.radar.as112.timeseriesGroups.ipVersion(); - * ``` + * @deprecated Use [Radar AS112 Timeseries Groups By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/as112/methods/timeseries_groups_v2/) instead. */ ipVersion( query?: TimeseriesGroupIPVersionParams, @@ -96,11 +84,7 @@ export class TimeseriesGroups extends APIResource { * Retrieves the distribution of AS112 DNS requests classified by protocol over * time. * - * @example - * ```ts - * const response = - * await client.radar.as112.timeseriesGroups.protocol(); - * ``` + * @deprecated Use [Radar AS112 Timeseries Groups By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/as112/methods/timeseries_groups_v2/) instead. */ protocol( query?: TimeseriesGroupProtocolParams, @@ -124,11 +108,7 @@ export class TimeseriesGroups extends APIResource { /** * Retrieves the distribution of AS112 DNS queries by type over time. * - * @example - * ```ts - * const response = - * await client.radar.as112.timeseriesGroups.queryType(); - * ``` + * @deprecated Use [Radar AS112 Timeseries Groups By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/as112/methods/timeseries_groups_v2/) instead. */ queryType( query?: TimeseriesGroupQueryTypeParams, @@ -154,11 +134,7 @@ export class TimeseriesGroups extends APIResource { * Retrieves the distribution of AS112 DNS requests classified by response code * over time. * - * @example - * ```ts - * const response = - * await client.radar.as112.timeseriesGroups.responseCodes(); - * ``` + * @deprecated Use [Radar AS112 Timeseries Groups By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/as112/methods/timeseries_groups_v2/) instead. */ responseCodes( query?: TimeseriesGroupResponseCodesParams, @@ -246,13 +222,44 @@ export namespace TimeseriesGroupDNSSECResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -356,13 +363,44 @@ export namespace TimeseriesGroupEdnsResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -466,13 +504,44 @@ export namespace TimeseriesGroupIPVersionResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -576,13 +645,44 @@ export namespace TimeseriesGroupProtocolResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -690,13 +790,44 @@ export namespace TimeseriesGroupQueryTypeResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -800,13 +931,44 @@ export namespace TimeseriesGroupResponseCodesResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -897,12 +1059,12 @@ export interface TimeseriesGroupDNSSECParams { /** * Filters results by DNS transport protocol. */ - protocol?: 'UDP' | 'TCP' | 'HTTPS' | 'TLS'; + protocol?: Array<'UDP' | 'TCP' | 'HTTPS' | 'TLS'>; /** * Filters results by DNS query type. */ - queryType?: + queryType?: Array< | 'A' | 'AAAA' | 'A6' @@ -991,12 +1153,13 @@ export interface TimeseriesGroupDNSSECParams { | 'WKS' | 'X25' | 'ZONEMD' - | null; + | null + >; /** * Filters results by DNS response code. */ - responseCode?: + responseCode?: Array< | 'NOERROR' | 'FORMERR' | 'SERVFAIL' @@ -1015,7 +1178,8 @@ export interface TimeseriesGroupDNSSECParams { | 'BADNAME' | 'BADALG' | 'BADTRUNC' - | 'BADCOOKIE'; + | 'BADCOOKIE' + >; } export interface TimeseriesGroupEdnsParams { @@ -1070,12 +1234,12 @@ export interface TimeseriesGroupEdnsParams { /** * Filters results by DNS transport protocol. */ - protocol?: 'UDP' | 'TCP' | 'HTTPS' | 'TLS'; + protocol?: Array<'UDP' | 'TCP' | 'HTTPS' | 'TLS'>; /** * Filters results by DNS query type. */ - queryType?: + queryType?: Array< | 'A' | 'AAAA' | 'A6' @@ -1164,12 +1328,13 @@ export interface TimeseriesGroupEdnsParams { | 'WKS' | 'X25' | 'ZONEMD' - | null; + | null + >; /** * Filters results by DNS response code. */ - responseCode?: + responseCode?: Array< | 'NOERROR' | 'FORMERR' | 'SERVFAIL' @@ -1188,7 +1353,8 @@ export interface TimeseriesGroupEdnsParams { | 'BADNAME' | 'BADALG' | 'BADTRUNC' - | 'BADCOOKIE'; + | 'BADCOOKIE' + >; } export interface TimeseriesGroupIPVersionParams { @@ -1243,12 +1409,12 @@ export interface TimeseriesGroupIPVersionParams { /** * Filters results by DNS transport protocol. */ - protocol?: 'UDP' | 'TCP' | 'HTTPS' | 'TLS'; + protocol?: Array<'UDP' | 'TCP' | 'HTTPS' | 'TLS'>; /** * Filters results by DNS query type. */ - queryType?: + queryType?: Array< | 'A' | 'AAAA' | 'A6' @@ -1337,12 +1503,13 @@ export interface TimeseriesGroupIPVersionParams { | 'WKS' | 'X25' | 'ZONEMD' - | null; + | null + >; /** * Filters results by DNS response code. */ - responseCode?: + responseCode?: Array< | 'NOERROR' | 'FORMERR' | 'SERVFAIL' @@ -1361,7 +1528,8 @@ export interface TimeseriesGroupIPVersionParams { | 'BADNAME' | 'BADALG' | 'BADTRUNC' - | 'BADCOOKIE'; + | 'BADCOOKIE' + >; } export interface TimeseriesGroupProtocolParams { @@ -1416,7 +1584,7 @@ export interface TimeseriesGroupProtocolParams { /** * Filters results by DNS query type. */ - queryType?: + queryType?: Array< | 'A' | 'AAAA' | 'A6' @@ -1505,12 +1673,13 @@ export interface TimeseriesGroupProtocolParams { | 'WKS' | 'X25' | 'ZONEMD' - | null; + | null + >; /** * Filters results by DNS response code. */ - responseCode?: + responseCode?: Array< | 'NOERROR' | 'FORMERR' | 'SERVFAIL' @@ -1529,7 +1698,8 @@ export interface TimeseriesGroupProtocolParams { | 'BADNAME' | 'BADALG' | 'BADTRUNC' - | 'BADCOOKIE'; + | 'BADCOOKIE' + >; } export interface TimeseriesGroupQueryTypeParams { @@ -1591,12 +1761,12 @@ export interface TimeseriesGroupQueryTypeParams { /** * Filters results by DNS transport protocol. */ - protocol?: 'UDP' | 'TCP' | 'HTTPS' | 'TLS'; + protocol?: Array<'UDP' | 'TCP' | 'HTTPS' | 'TLS'>; /** * Filters results by DNS response code. */ - responseCode?: + responseCode?: Array< | 'NOERROR' | 'FORMERR' | 'SERVFAIL' @@ -1615,7 +1785,8 @@ export interface TimeseriesGroupQueryTypeParams { | 'BADNAME' | 'BADALG' | 'BADTRUNC' - | 'BADCOOKIE'; + | 'BADCOOKIE' + >; } export interface TimeseriesGroupResponseCodesParams { @@ -1677,12 +1848,12 @@ export interface TimeseriesGroupResponseCodesParams { /** * Filters results by DNS transport protocol. */ - protocol?: 'UDP' | 'TCP' | 'HTTPS' | 'TLS'; + protocol?: Array<'UDP' | 'TCP' | 'HTTPS' | 'TLS'>; /** * Filters results by DNS query type. */ - queryType?: + queryType?: Array< | 'A' | 'AAAA' | 'A6' @@ -1771,7 +1942,8 @@ export interface TimeseriesGroupResponseCodesParams { | 'WKS' | 'X25' | 'ZONEMD' - | null; + | null + >; } export declare namespace TimeseriesGroups { diff --git a/src/resources/radar/as112/top.ts b/src/resources/radar/as112/top.ts index dd2fe90eba..03bacb01c8 100644 --- a/src/resources/radar/as112/top.ts +++ b/src/resources/radar/as112/top.ts @@ -188,13 +188,44 @@ export namespace TopDNSSECResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -296,13 +327,44 @@ export namespace TopEdnsResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -404,13 +466,44 @@ export namespace TopIPVersionResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -512,13 +605,44 @@ export namespace TopLocationsResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. diff --git a/src/resources/radar/attacks/attacks.ts b/src/resources/radar/attacks/attacks.ts index 9d3c9c4aef..4346cf6862 100644 --- a/src/resources/radar/attacks/attacks.ts +++ b/src/resources/radar/attacks/attacks.ts @@ -2,9 +2,25 @@ import { APIResource } from '../../../resource'; import * as Layer3API from './layer3/layer3'; -import { Layer3, Layer3TimeseriesParams, Layer3TimeseriesResponse } from './layer3/layer3'; +import { + Layer3, + Layer3SummaryV2Params, + Layer3SummaryV2Response, + Layer3TimeseriesGroupsV2Params, + Layer3TimeseriesGroupsV2Response, + Layer3TimeseriesParams, + Layer3TimeseriesResponse, +} from './layer3/layer3'; import * as Layer7API from './layer7/layer7'; -import { Layer7, Layer7TimeseriesParams, Layer7TimeseriesResponse } from './layer7/layer7'; +import { + Layer7, + Layer7SummaryV2Params, + Layer7SummaryV2Response, + Layer7TimeseriesGroupsV2Params, + Layer7TimeseriesGroupsV2Response, + Layer7TimeseriesParams, + Layer7TimeseriesResponse, +} from './layer7/layer7'; export class Attacks extends APIResource { layer3: Layer3API.Layer3 = new Layer3API.Layer3(this._client); @@ -17,13 +33,21 @@ Attacks.Layer7 = Layer7; export declare namespace Attacks { export { Layer3 as Layer3, + type Layer3SummaryV2Response as Layer3SummaryV2Response, type Layer3TimeseriesResponse as Layer3TimeseriesResponse, + type Layer3TimeseriesGroupsV2Response as Layer3TimeseriesGroupsV2Response, + type Layer3SummaryV2Params as Layer3SummaryV2Params, type Layer3TimeseriesParams as Layer3TimeseriesParams, + type Layer3TimeseriesGroupsV2Params as Layer3TimeseriesGroupsV2Params, }; export { Layer7 as Layer7, + type Layer7SummaryV2Response as Layer7SummaryV2Response, type Layer7TimeseriesResponse as Layer7TimeseriesResponse, + type Layer7TimeseriesGroupsV2Response as Layer7TimeseriesGroupsV2Response, + type Layer7SummaryV2Params as Layer7SummaryV2Params, type Layer7TimeseriesParams as Layer7TimeseriesParams, + type Layer7TimeseriesGroupsV2Params as Layer7TimeseriesGroupsV2Params, }; } diff --git a/src/resources/radar/attacks/index.ts b/src/resources/radar/attacks/index.ts index 28216f9bd4..5ff5753f57 100644 --- a/src/resources/radar/attacks/index.ts +++ b/src/resources/radar/attacks/index.ts @@ -1,5 +1,21 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { Attacks } from './attacks'; -export { Layer3, type Layer3TimeseriesResponse, type Layer3TimeseriesParams } from './layer3/index'; -export { Layer7, type Layer7TimeseriesResponse, type Layer7TimeseriesParams } from './layer7/index'; +export { + Layer3, + type Layer3SummaryV2Response, + type Layer3TimeseriesResponse, + type Layer3TimeseriesGroupsV2Response, + type Layer3SummaryV2Params, + type Layer3TimeseriesParams, + type Layer3TimeseriesGroupsV2Params, +} from './layer3/index'; +export { + Layer7, + type Layer7SummaryV2Response, + type Layer7TimeseriesResponse, + type Layer7TimeseriesGroupsV2Response, + type Layer7SummaryV2Params, + type Layer7TimeseriesParams, + type Layer7TimeseriesGroupsV2Params, +} from './layer7/index'; diff --git a/src/resources/radar/attacks/layer3/index.ts b/src/resources/radar/attacks/layer3/index.ts index aea57a5a87..5cda25b111 100644 --- a/src/resources/radar/attacks/layer3/index.ts +++ b/src/resources/radar/attacks/layer3/index.ts @@ -1,6 +1,14 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { Layer3, type Layer3TimeseriesResponse, type Layer3TimeseriesParams } from './layer3'; +export { + Layer3, + type Layer3SummaryV2Response, + type Layer3TimeseriesResponse, + type Layer3TimeseriesGroupsV2Response, + type Layer3SummaryV2Params, + type Layer3TimeseriesParams, + type Layer3TimeseriesGroupsV2Params, +} from './layer3'; export { Summary, type SummaryBitrateResponse, diff --git a/src/resources/radar/attacks/layer3/layer3.ts b/src/resources/radar/attacks/layer3/layer3.ts index 3fcf323b99..7a8d390f79 100644 --- a/src/resources/radar/attacks/layer3/layer3.ts +++ b/src/resources/radar/attacks/layer3/layer3.ts @@ -57,6 +57,40 @@ export class Layer3 extends APIResource { ); top: TopAPI.Top = new TopAPI.Top(this._client); + /** + * Retrieves the distribution of layer 3 attacks by the specified dimension. + * + * @example + * ```ts + * const response = + * await client.radar.attacks.layer3.summaryV2('PROTOCOL'); + * ``` + */ + summaryV2( + dimension: 'PROTOCOL' | 'IP_VERSION' | 'VECTOR' | 'DURATION' | 'BITRATE' | 'VERTICAL' | 'INDUSTRY', + query?: Layer3SummaryV2Params, + options?: Core.RequestOptions, + ): Core.APIPromise; + summaryV2( + dimension: 'PROTOCOL' | 'IP_VERSION' | 'VECTOR' | 'DURATION' | 'BITRATE' | 'VERTICAL' | 'INDUSTRY', + options?: Core.RequestOptions, + ): Core.APIPromise; + summaryV2( + dimension: 'PROTOCOL' | 'IP_VERSION' | 'VECTOR' | 'DURATION' | 'BITRATE' | 'VERTICAL' | 'INDUSTRY', + query: Layer3SummaryV2Params | Core.RequestOptions = {}, + options?: Core.RequestOptions, + ): Core.APIPromise { + if (isRequestOptions(query)) { + return this.summaryV2(dimension, {}, query); + } + return ( + this._client.get(`/radar/attacks/layer3/summary/${dimension}`, { + query, + ...options, + }) as Core.APIPromise<{ result: Layer3SummaryV2Response }> + )._thenUnwrap((obj) => obj.result); + } + /** * Retrieves layer 3 attacks over time. * @@ -84,6 +118,170 @@ export class Layer3 extends APIResource { }> )._thenUnwrap((obj) => obj.result); } + + /** + * Retrieves the distribution of layer 3 attacks grouped by dimension over time. + * + * @example + * ```ts + * const response = + * await client.radar.attacks.layer3.timeseriesGroupsV2( + * 'PROTOCOL', + * ); + * ``` + */ + timeseriesGroupsV2( + dimension: 'PROTOCOL' | 'IP_VERSION' | 'VECTOR' | 'DURATION' | 'BITRATE' | 'VERTICAL' | 'INDUSTRY', + query?: Layer3TimeseriesGroupsV2Params, + options?: Core.RequestOptions, + ): Core.APIPromise; + timeseriesGroupsV2( + dimension: 'PROTOCOL' | 'IP_VERSION' | 'VECTOR' | 'DURATION' | 'BITRATE' | 'VERTICAL' | 'INDUSTRY', + options?: Core.RequestOptions, + ): Core.APIPromise; + timeseriesGroupsV2( + dimension: 'PROTOCOL' | 'IP_VERSION' | 'VECTOR' | 'DURATION' | 'BITRATE' | 'VERTICAL' | 'INDUSTRY', + query: Layer3TimeseriesGroupsV2Params | Core.RequestOptions = {}, + options?: Core.RequestOptions, + ): Core.APIPromise { + if (isRequestOptions(query)) { + return this.timeseriesGroupsV2(dimension, {}, query); + } + return ( + this._client.get(`/radar/attacks/layer3/timeseries_groups/${dimension}`, { + query, + ...options, + }) as Core.APIPromise<{ result: Layer3TimeseriesGroupsV2Response }> + )._thenUnwrap((obj) => obj.result); + } +} + +export interface Layer3SummaryV2Response { + /** + * Metadata for the results. + */ + meta: Layer3SummaryV2Response.Meta; + + summary_0: { [key: string]: string }; +} + +export namespace Layer3SummaryV2Response { + /** + * Metadata for the results. + */ + export interface Meta { + confidenceInfo: Meta.ConfidenceInfo; + + dateRange: Array; + + /** + * Timestamp of the last dataset update. + */ + lastUpdated: string; + + /** + * Normalization method applied to the results. Refer to + * [Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/). + */ + normalization: + | 'PERCENTAGE' + | 'MIN0_MAX' + | 'MIN_MAX' + | 'RAW_VALUES' + | 'PERCENTAGE_CHANGE' + | 'ROLLING_AVERAGE' + | 'OVERLAPPED_PERCENTAGE' + | 'RATIO'; + + /** + * Measurement units for the results. + */ + units: Array; + } + + export namespace Meta { + export interface ConfidenceInfo { + annotations: Array; + + /** + * Provides an indication of how much confidence Cloudflare has in the data. + */ + level: number; + } + + export namespace ConfidenceInfo { + /** + * Annotation associated with the result (e.g. outage or other type of event). + */ + export interface Annotation { + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; + + description: string; + + endDate: string; + + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; + + /** + * Whether event is a single point in time or a time range. + */ + isInstantaneous: boolean; + + linkedUrl: string; + + startDate: string; + } + } + + export interface DateRange { + /** + * Adjusted end of date range. + */ + endTime: string; + + /** + * Adjusted start of date range. + */ + startTime: string; + } + + export interface Unit { + name: string; + + value: string; + } + } } export interface Layer3TimeseriesResponse { @@ -154,13 +352,44 @@ export namespace Layer3TimeseriesResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -199,6 +428,213 @@ export namespace Layer3TimeseriesResponse { } } +export interface Layer3TimeseriesGroupsV2Response { + /** + * Metadata for the results. + */ + meta: Layer3TimeseriesGroupsV2Response.Meta; + + serie_0: Layer3TimeseriesGroupsV2Response.Serie0; +} + +export namespace Layer3TimeseriesGroupsV2Response { + /** + * Metadata for the results. + */ + export interface Meta { + /** + * Aggregation interval of the results (e.g., in 15 minutes or 1 hour intervals). + * Refer to + * [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + */ + aggInterval: 'FIFTEEN_MINUTES' | 'ONE_HOUR' | 'ONE_DAY' | 'ONE_WEEK' | 'ONE_MONTH'; + + confidenceInfo: Meta.ConfidenceInfo; + + dateRange: Array; + + /** + * Timestamp of the last dataset update. + */ + lastUpdated: string; + + /** + * Normalization method applied to the results. Refer to + * [Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/). + */ + normalization: + | 'PERCENTAGE' + | 'MIN0_MAX' + | 'MIN_MAX' + | 'RAW_VALUES' + | 'PERCENTAGE_CHANGE' + | 'ROLLING_AVERAGE' + | 'OVERLAPPED_PERCENTAGE' + | 'RATIO'; + + /** + * Measurement units for the results. + */ + units: Array; + } + + export namespace Meta { + export interface ConfidenceInfo { + annotations: Array; + + /** + * Provides an indication of how much confidence Cloudflare has in the data. + */ + level: number; + } + + export namespace ConfidenceInfo { + /** + * Annotation associated with the result (e.g. outage or other type of event). + */ + export interface Annotation { + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; + + description: string; + + endDate: string; + + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; + + /** + * Whether event is a single point in time or a time range. + */ + isInstantaneous: boolean; + + linkedUrl: string; + + startDate: string; + } + } + + export interface DateRange { + /** + * Adjusted end of date range. + */ + endTime: string; + + /** + * Adjusted start of date range. + */ + startTime: string; + } + + export interface Unit { + name: string; + + value: string; + } + } + + export interface Serie0 { + timestamps: Array; + + [k: string]: Array | Array | undefined; + } +} + +export interface Layer3SummaryV2Params { + /** + * Filters results by continent. Specify a comma-separated list of alpha-2 codes. + * Prefix with `-` to exclude continents from results. For example, `-EU,NA` + * excludes results from EU, but includes results from NA. + */ + continent?: Array; + + /** + * End of the date range (inclusive). + */ + dateEnd?: Array; + + /** + * Filters results by date range. For example, use `7d` and `7dcontrol` to compare + * this week with the previous week. Use this parameter or set specific start and + * end dates (`dateStart` and `dateEnd` parameters). + */ + dateRange?: Array; + + /** + * Start of the date range. + */ + dateStart?: Array; + + /** + * Specifies whether the `location` filter applies to the source or target + * location. + */ + direction?: 'ORIGIN' | 'TARGET'; + + /** + * Format in which results will be returned. + */ + format?: 'JSON' | 'CSV'; + + /** + * Filters results by IP version (Ipv4 vs. IPv6). + */ + ipVersion?: Array<'IPv4' | 'IPv6'>; + + /** + * Limits the number of objects per group to the top items within the specified + * time range. When item count exceeds the limit, extra items appear grouped under + * an "other" category. + */ + limitPerGroup?: number; + + /** + * Filters results by location. Specify a comma-separated list of alpha-2 codes. + * Prefix with `-` to exclude locations from results. For example, `-US,PT` + * excludes results from the US, but includes results from PT. + */ + location?: Array; + + /** + * Array of names used to label the series in the response. + */ + name?: Array; + + /** + * Filters the results by layer 3/4 protocol. + */ + protocol?: Array<'UDP' | 'TCP' | 'ICMP' | 'GRE'>; +} + export interface Layer3TimeseriesParams { /** * Aggregation interval of the results (e.g., in 15 minutes or 1 hour intervals). @@ -284,14 +720,97 @@ export interface Layer3TimeseriesParams { protocol?: Array<'UDP' | 'TCP' | 'ICMP' | 'GRE'>; } +export interface Layer3TimeseriesGroupsV2Params { + /** + * Aggregation interval of the results (e.g., in 15 minutes or 1 hour intervals). + * Refer to + * [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + */ + aggInterval?: '15m' | '1h' | '1d' | '1w'; + + /** + * Filters results by continent. Specify a comma-separated list of alpha-2 codes. + * Prefix with `-` to exclude continents from results. For example, `-EU,NA` + * excludes results from EU, but includes results from NA. + */ + continent?: Array; + + /** + * End of the date range (inclusive). + */ + dateEnd?: Array; + + /** + * Filters results by date range. For example, use `7d` and `7dcontrol` to compare + * this week with the previous week. Use this parameter or set specific start and + * end dates (`dateStart` and `dateEnd` parameters). + */ + dateRange?: Array; + + /** + * Start of the date range. + */ + dateStart?: Array; + + /** + * Specifies whether the `location` filter applies to the source or target + * location. + */ + direction?: 'ORIGIN' | 'TARGET'; + + /** + * Format in which results will be returned. + */ + format?: 'JSON' | 'CSV'; + + /** + * Filters results by IP version (Ipv4 vs. IPv6). + */ + ipVersion?: Array<'IPv4' | 'IPv6'>; + + /** + * Limits the number of objects per group to the top items within the specified + * time range. When item count exceeds the limit, extra items appear grouped under + * an "other" category. + */ + limitPerGroup?: number; + + /** + * Filters results by location. Specify a comma-separated list of alpha-2 codes. + * Prefix with `-` to exclude locations from results. For example, `-US,PT` + * excludes results from the US, but includes results from PT. + */ + location?: Array; + + /** + * Array of names used to label the series in the response. + */ + name?: Array; + + /** + * Normalization method applied to the results. Refer to + * [Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/). + */ + normalization?: 'PERCENTAGE' | 'MIN0_MAX'; + + /** + * Filters the results by layer 3/4 protocol. + */ + protocol?: Array<'UDP' | 'TCP' | 'ICMP' | 'GRE'>; +} + Layer3.Summary = Summary; Layer3.TimeseriesGroups = TimeseriesGroups; Layer3.Top = Top; export declare namespace Layer3 { export { + type Layer3SummaryV2Response as Layer3SummaryV2Response, type Layer3TimeseriesResponse as Layer3TimeseriesResponse, + type Layer3TimeseriesGroupsV2Response as Layer3TimeseriesGroupsV2Response, + type Layer3SummaryV2Params as Layer3SummaryV2Params, type Layer3TimeseriesParams as Layer3TimeseriesParams, + type Layer3TimeseriesGroupsV2Params as Layer3TimeseriesGroupsV2Params, }; export { diff --git a/src/resources/radar/attacks/layer3/summary.ts b/src/resources/radar/attacks/layer3/summary.ts index 73ed7d7c70..f6dc94c307 100644 --- a/src/resources/radar/attacks/layer3/summary.ts +++ b/src/resources/radar/attacks/layer3/summary.ts @@ -8,11 +8,7 @@ export class Summary extends APIResource { /** * Retrieves the distribution of layer 3 attacks by bitrate. * - * @example - * ```ts - * const response = - * await client.radar.attacks.layer3.summary.bitrate(); - * ``` + * @deprecated Use [Radar Attacks Layer 3 Summary By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/attacks/subresources/layer3/methods/summary_v2/) instead. */ bitrate( query?: SummaryBitrateParams, @@ -36,11 +32,7 @@ export class Summary extends APIResource { /** * Retrieves the distribution of layer 3 attacks by duration. * - * @example - * ```ts - * const response = - * await client.radar.attacks.layer3.summary.duration(); - * ``` + * @deprecated Use [Radar Attacks Layer 3 Summary By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/attacks/subresources/layer3/methods/summary_v2/) instead. */ duration( query?: SummaryDurationParams, @@ -64,11 +56,7 @@ export class Summary extends APIResource { /** * Retrieves the distribution of layer 3 attacks by targeted industry. * - * @example - * ```ts - * const response = - * await client.radar.attacks.layer3.summary.industry(); - * ``` + * @deprecated Use [Radar Attacks Layer 3 Summary By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/attacks/subresources/layer3/methods/summary_v2/) instead. */ industry( query?: SummaryIndustryParams, @@ -92,11 +80,7 @@ export class Summary extends APIResource { /** * Retrieves the distribution of layer 3 attacks by IP version. * - * @example - * ```ts - * const response = - * await client.radar.attacks.layer3.summary.ipVersion(); - * ``` + * @deprecated Use [Radar Attacks Layer 3 Summary By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/attacks/subresources/layer3/methods/summary_v2/) instead. */ ipVersion( query?: SummaryIPVersionParams, @@ -120,11 +104,7 @@ export class Summary extends APIResource { /** * Retrieves the distribution of layer 3 attacks by protocol. * - * @example - * ```ts - * const response = - * await client.radar.attacks.layer3.summary.protocol(); - * ``` + * @deprecated Use [Radar Attacks Layer 3 Summary By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/attacks/subresources/layer3/methods/summary_v2/) instead. */ protocol( query?: SummaryProtocolParams, @@ -148,11 +128,7 @@ export class Summary extends APIResource { /** * Retrieves the distribution of layer 3 attacks by vector. * - * @example - * ```ts - * const response = - * await client.radar.attacks.layer3.summary.vector(); - * ``` + * @deprecated Use [Radar Attacks Layer 3 Summary By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/attacks/subresources/layer3/methods/summary_v2/) instead. */ vector(query?: SummaryVectorParams, options?: Core.RequestOptions): Core.APIPromise; vector(options?: Core.RequestOptions): Core.APIPromise; @@ -173,11 +149,7 @@ export class Summary extends APIResource { /** * Retrieves the distribution of layer 3 attacks by targeted vertical. * - * @example - * ```ts - * const response = - * await client.radar.attacks.layer3.summary.vertical(); - * ``` + * @deprecated Use [Radar Attacks Layer 3 Summary By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/attacks/subresources/layer3/methods/summary_v2/) instead. */ vertical( query?: SummaryVerticalParams, @@ -257,13 +229,44 @@ export namespace SummaryBitrateResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -381,13 +384,44 @@ export namespace SummaryDurationResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -510,13 +544,44 @@ export namespace SummaryIndustryResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -607,13 +672,44 @@ export namespace SummaryIPVersionResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -716,13 +812,44 @@ export namespace SummaryProtocolResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -835,13 +962,44 @@ export namespace SummaryVectorResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -932,13 +1090,44 @@ export namespace SummaryVerticalResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. diff --git a/src/resources/radar/attacks/layer3/timeseries-groups.ts b/src/resources/radar/attacks/layer3/timeseries-groups.ts index 740bb97cae..c4fc8404e1 100644 --- a/src/resources/radar/attacks/layer3/timeseries-groups.ts +++ b/src/resources/radar/attacks/layer3/timeseries-groups.ts @@ -8,11 +8,7 @@ export class TimeseriesGroups extends APIResource { /** * Retrieves the distribution of layer 3 attacks by bitrate over time. * - * @example - * ```ts - * const response = - * await client.radar.attacks.layer3.timeseriesGroups.bitrate(); - * ``` + * @deprecated Use [Radar Attacks Layer 3 Timeseries Groups By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/attacks/subresources/layer3/methods/timeseries_groups_v2/) instead. */ bitrate( query?: TimeseriesGroupBitrateParams, @@ -37,11 +33,7 @@ export class TimeseriesGroups extends APIResource { /** * Retrieves the distribution of layer 3 attacks by duration over time. * - * @example - * ```ts - * const response = - * await client.radar.attacks.layer3.timeseriesGroups.duration(); - * ``` + * @deprecated Use [Radar Attacks Layer 3 Timeseries Groups By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/attacks/subresources/layer3/methods/timeseries_groups_v2/) instead. */ duration( query?: TimeseriesGroupDurationParams, @@ -66,11 +58,7 @@ export class TimeseriesGroups extends APIResource { /** * Retrieves the distribution of layer 3 attacks by targeted industry over time. * - * @example - * ```ts - * const response = - * await client.radar.attacks.layer3.timeseriesGroups.industry(); - * ``` + * @deprecated Use [Radar Attacks Layer 3 Timeseries Groups By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/attacks/subresources/layer3/methods/timeseries_groups_v2/) instead. */ industry( query?: TimeseriesGroupIndustryParams, @@ -95,11 +83,7 @@ export class TimeseriesGroups extends APIResource { /** * Retrieves the distribution of layer 3 attacks by IP version over time. * - * @example - * ```ts - * const response = - * await client.radar.attacks.layer3.timeseriesGroups.ipVersion(); - * ``` + * @deprecated Use [Radar Attacks Layer 3 Timeseries Groups By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/attacks/subresources/layer3/methods/timeseries_groups_v2/) instead. */ ipVersion( query?: TimeseriesGroupIPVersionParams, @@ -124,11 +108,7 @@ export class TimeseriesGroups extends APIResource { /** * Retrieves the distribution of layer 3 attacks by protocol over time. * - * @example - * ```ts - * const response = - * await client.radar.attacks.layer3.timeseriesGroups.protocol(); - * ``` + * @deprecated Use [Radar Attacks Layer 3 Timeseries Groups By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/attacks/subresources/layer3/methods/timeseries_groups_v2/) instead. */ protocol( query?: TimeseriesGroupProtocolParams, @@ -153,11 +133,7 @@ export class TimeseriesGroups extends APIResource { /** * Retrieves the distribution of layer 3 attacks by vector over time. * - * @example - * ```ts - * const response = - * await client.radar.attacks.layer3.timeseriesGroups.vector(); - * ``` + * @deprecated Use [Radar Attacks Layer 3 Timeseries Groups By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/attacks/subresources/layer3/methods/timeseries_groups_v2/) instead. */ vector( query?: TimeseriesGroupVectorParams, @@ -182,11 +158,7 @@ export class TimeseriesGroups extends APIResource { /** * Retrieves the distribution of layer 3 attacks by targeted vertical over time. * - * @example - * ```ts - * const response = - * await client.radar.attacks.layer3.timeseriesGroups.vertical(); - * ``` + * @deprecated Use [Radar Attacks Layer 3 Timeseries Groups By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/attacks/subresources/layer3/methods/timeseries_groups_v2/) instead. */ vertical( query?: TimeseriesGroupVerticalParams, @@ -274,13 +246,44 @@ export namespace TimeseriesGroupBitrateResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -392,13 +395,44 @@ export namespace TimeseriesGroupDurationResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -512,13 +546,44 @@ export namespace TimeseriesGroupIndustryResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -622,13 +687,44 @@ export namespace TimeseriesGroupIPVersionResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -734,13 +830,44 @@ export namespace TimeseriesGroupProtocolResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -850,13 +977,44 @@ export namespace TimeseriesGroupVectorResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -960,13 +1118,44 @@ export namespace TimeseriesGroupVerticalResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. diff --git a/src/resources/radar/attacks/layer3/top/locations.ts b/src/resources/radar/attacks/layer3/top/locations.ts index df0b8aafaa..a0b2a750bc 100644 --- a/src/resources/radar/attacks/layer3/top/locations.ts +++ b/src/resources/radar/attacks/layer3/top/locations.ts @@ -122,13 +122,44 @@ export namespace LocationOriginResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -229,13 +260,44 @@ export namespace LocationTargetResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. diff --git a/src/resources/radar/attacks/layer3/top/top.ts b/src/resources/radar/attacks/layer3/top/top.ts index 2da56402ce..9d77ec86a7 100644 --- a/src/resources/radar/attacks/layer3/top/top.ts +++ b/src/resources/radar/attacks/layer3/top/top.ts @@ -47,7 +47,7 @@ export class Top extends APIResource { * This endpoint is deprecated. To continue getting this data, switch to the * summary by industry endpoint. * - * @deprecated + * @deprecated Use [Radar Attacks Layer 3 Summary By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/attacks/subresources/layer3/methods/summary_v2/) instead. */ industry(query?: TopIndustryParams, options?: Core.RequestOptions): Core.APIPromise; industry(options?: Core.RequestOptions): Core.APIPromise; @@ -69,7 +69,7 @@ export class Top extends APIResource { * This endpoint is deprecated. To continue getting this data, switch to the * summary by vertical endpoint. * - * @deprecated + * @deprecated Use [Radar Attacks Layer 3 Summary By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/attacks/subresources/layer3/methods/summary_v2/) instead. */ vertical(query?: TopVerticalParams, options?: Core.RequestOptions): Core.APIPromise; vertical(options?: Core.RequestOptions): Core.APIPromise; @@ -146,13 +146,44 @@ export namespace TopAttacksResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -251,13 +282,44 @@ export namespace TopIndustryResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -354,13 +416,44 @@ export namespace TopVerticalResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. diff --git a/src/resources/radar/attacks/layer7/index.ts b/src/resources/radar/attacks/layer7/index.ts index ea12e3b31d..20456df07c 100644 --- a/src/resources/radar/attacks/layer7/index.ts +++ b/src/resources/radar/attacks/layer7/index.ts @@ -1,6 +1,14 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { Layer7, type Layer7TimeseriesResponse, type Layer7TimeseriesParams } from './layer7'; +export { + Layer7, + type Layer7SummaryV2Response, + type Layer7TimeseriesResponse, + type Layer7TimeseriesGroupsV2Response, + type Layer7SummaryV2Params, + type Layer7TimeseriesParams, + type Layer7TimeseriesGroupsV2Params, +} from './layer7'; export { Summary, type SummaryHTTPMethodResponse, diff --git a/src/resources/radar/attacks/layer7/layer7.ts b/src/resources/radar/attacks/layer7/layer7.ts index 633b50c1a5..102b49e419 100644 --- a/src/resources/radar/attacks/layer7/layer7.ts +++ b/src/resources/radar/attacks/layer7/layer7.ts @@ -57,6 +57,63 @@ export class Layer7 extends APIResource { ); top: TopAPI.Top = new TopAPI.Top(this._client); + /** + * Retrieves the distribution of layer 7 attacks by the specified dimension. + * + * @example + * ```ts + * const response = + * await client.radar.attacks.layer7.summaryV2( + * 'HTTP_METHOD', + * ); + * ``` + */ + summaryV2( + dimension: + | 'HTTP_METHOD' + | 'HTTP_VERSION' + | 'IP_VERSION' + | 'MANAGED_RULES' + | 'MITIGATION_PRODUCT' + | 'VERTICAL' + | 'INDUSTRY', + query?: Layer7SummaryV2Params, + options?: Core.RequestOptions, + ): Core.APIPromise; + summaryV2( + dimension: + | 'HTTP_METHOD' + | 'HTTP_VERSION' + | 'IP_VERSION' + | 'MANAGED_RULES' + | 'MITIGATION_PRODUCT' + | 'VERTICAL' + | 'INDUSTRY', + options?: Core.RequestOptions, + ): Core.APIPromise; + summaryV2( + dimension: + | 'HTTP_METHOD' + | 'HTTP_VERSION' + | 'IP_VERSION' + | 'MANAGED_RULES' + | 'MITIGATION_PRODUCT' + | 'VERTICAL' + | 'INDUSTRY', + query: Layer7SummaryV2Params | Core.RequestOptions = {}, + options?: Core.RequestOptions, + ): Core.APIPromise { + if (isRequestOptions(query)) { + return this.summaryV2(dimension, {}, query); + } + return ( + this._client.get(`/radar/attacks/layer7/summary/${dimension}`, { + query, + ...options, + }) as Core.APIPromise<{ result: Layer7SummaryV2Response }> + )._thenUnwrap((obj) => obj.result); + } + /** * Retrieves layer 7 attacks over time. * @@ -84,6 +141,191 @@ export class Layer7 extends APIResource { }> )._thenUnwrap((obj) => obj.result); } + + /** + * Retrieves the distribution of layer 7 attacks grouped by dimension over time. + * + * @example + * ```ts + * const response = + * await client.radar.attacks.layer7.timeseriesGroupsV2( + * 'HTTP_METHOD', + * ); + * ``` + */ + timeseriesGroupsV2( + dimension: + | 'HTTP_METHOD' + | 'HTTP_VERSION' + | 'IP_VERSION' + | 'MANAGED_RULES' + | 'MITIGATION_PRODUCT' + | 'VERTICAL' + | 'INDUSTRY', + query?: Layer7TimeseriesGroupsV2Params, + options?: Core.RequestOptions, + ): Core.APIPromise; + timeseriesGroupsV2( + dimension: + | 'HTTP_METHOD' + | 'HTTP_VERSION' + | 'IP_VERSION' + | 'MANAGED_RULES' + | 'MITIGATION_PRODUCT' + | 'VERTICAL' + | 'INDUSTRY', + options?: Core.RequestOptions, + ): Core.APIPromise; + timeseriesGroupsV2( + dimension: + | 'HTTP_METHOD' + | 'HTTP_VERSION' + | 'IP_VERSION' + | 'MANAGED_RULES' + | 'MITIGATION_PRODUCT' + | 'VERTICAL' + | 'INDUSTRY', + query: Layer7TimeseriesGroupsV2Params | Core.RequestOptions = {}, + options?: Core.RequestOptions, + ): Core.APIPromise { + if (isRequestOptions(query)) { + return this.timeseriesGroupsV2(dimension, {}, query); + } + return ( + this._client.get(`/radar/attacks/layer7/timeseries_groups/${dimension}`, { + query, + ...options, + }) as Core.APIPromise<{ result: Layer7TimeseriesGroupsV2Response }> + )._thenUnwrap((obj) => obj.result); + } +} + +export interface Layer7SummaryV2Response { + /** + * Metadata for the results. + */ + meta: Layer7SummaryV2Response.Meta; + + summary_0: { [key: string]: string }; +} + +export namespace Layer7SummaryV2Response { + /** + * Metadata for the results. + */ + export interface Meta { + confidenceInfo: Meta.ConfidenceInfo; + + dateRange: Array; + + /** + * Timestamp of the last dataset update. + */ + lastUpdated: string; + + /** + * Normalization method applied to the results. Refer to + * [Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/). + */ + normalization: + | 'PERCENTAGE' + | 'MIN0_MAX' + | 'MIN_MAX' + | 'RAW_VALUES' + | 'PERCENTAGE_CHANGE' + | 'ROLLING_AVERAGE' + | 'OVERLAPPED_PERCENTAGE' + | 'RATIO'; + + /** + * Measurement units for the results. + */ + units: Array; + } + + export namespace Meta { + export interface ConfidenceInfo { + annotations: Array; + + /** + * Provides an indication of how much confidence Cloudflare has in the data. + */ + level: number; + } + + export namespace ConfidenceInfo { + /** + * Annotation associated with the result (e.g. outage or other type of event). + */ + export interface Annotation { + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; + + description: string; + + endDate: string; + + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; + + /** + * Whether event is a single point in time or a time range. + */ + isInstantaneous: boolean; + + linkedUrl: string; + + startDate: string; + } + } + + export interface DateRange { + /** + * Adjusted end of date range. + */ + endTime: string; + + /** + * Adjusted start of date range. + */ + startTime: string; + } + + export interface Unit { + name: string; + + value: string; + } + } } export interface Layer7TimeseriesResponse { @@ -151,13 +393,44 @@ export namespace Layer7TimeseriesResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -196,6 +469,280 @@ export namespace Layer7TimeseriesResponse { } } +export interface Layer7TimeseriesGroupsV2Response { + /** + * Metadata for the results. + */ + meta: Layer7TimeseriesGroupsV2Response.Meta; + + serie_0: Layer7TimeseriesGroupsV2Response.Serie0; +} + +export namespace Layer7TimeseriesGroupsV2Response { + /** + * Metadata for the results. + */ + export interface Meta { + /** + * Aggregation interval of the results (e.g., in 15 minutes or 1 hour intervals). + * Refer to + * [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + */ + aggInterval: 'FIFTEEN_MINUTES' | 'ONE_HOUR' | 'ONE_DAY' | 'ONE_WEEK' | 'ONE_MONTH'; + + confidenceInfo: Meta.ConfidenceInfo; + + dateRange: Array; + + /** + * Timestamp of the last dataset update. + */ + lastUpdated: string; + + /** + * Normalization method applied to the results. Refer to + * [Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/). + */ + normalization: + | 'PERCENTAGE' + | 'MIN0_MAX' + | 'MIN_MAX' + | 'RAW_VALUES' + | 'PERCENTAGE_CHANGE' + | 'ROLLING_AVERAGE' + | 'OVERLAPPED_PERCENTAGE' + | 'RATIO'; + + /** + * Measurement units for the results. + */ + units: Array; + } + + export namespace Meta { + export interface ConfidenceInfo { + annotations: Array; + + /** + * Provides an indication of how much confidence Cloudflare has in the data. + */ + level: number; + } + + export namespace ConfidenceInfo { + /** + * Annotation associated with the result (e.g. outage or other type of event). + */ + export interface Annotation { + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; + + description: string; + + endDate: string; + + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; + + /** + * Whether event is a single point in time or a time range. + */ + isInstantaneous: boolean; + + linkedUrl: string; + + startDate: string; + } + } + + export interface DateRange { + /** + * Adjusted end of date range. + */ + endTime: string; + + /** + * Adjusted start of date range. + */ + startTime: string; + } + + export interface Unit { + name: string; + + value: string; + } + } + + export interface Serie0 { + timestamps: Array; + + [k: string]: Array | Array | undefined; + } +} + +export interface Layer7SummaryV2Params { + /** + * Filters results by Autonomous System. Specify one or more Autonomous System + * Numbers (ASNs) as a comma-separated list. Prefix with `-` to exclude ASNs from + * results. For example, `-174, 3356` excludes results from AS174, but includes + * results from AS3356. + */ + asn?: Array; + + /** + * Filters results by continent. Specify a comma-separated list of alpha-2 codes. + * Prefix with `-` to exclude continents from results. For example, `-EU,NA` + * excludes results from EU, but includes results from NA. + */ + continent?: Array; + + /** + * End of the date range (inclusive). + */ + dateEnd?: Array; + + /** + * Filters results by date range. For example, use `7d` and `7dcontrol` to compare + * this week with the previous week. Use this parameter or set specific start and + * end dates (`dateStart` and `dateEnd` parameters). + */ + dateRange?: Array; + + /** + * Start of the date range. + */ + dateStart?: Array; + + /** + * Format in which results will be returned. + */ + format?: 'JSON' | 'CSV'; + + /** + * Filters results by HTTP method. + */ + httpMethod?: Array< + | 'GET' + | 'POST' + | 'DELETE' + | 'PUT' + | 'HEAD' + | 'PURGE' + | 'OPTIONS' + | 'PROPFIND' + | 'MKCOL' + | 'PATCH' + | 'ACL' + | 'BCOPY' + | 'BDELETE' + | 'BMOVE' + | 'BPROPFIND' + | 'BPROPPATCH' + | 'CHECKIN' + | 'CHECKOUT' + | 'CONNECT' + | 'COPY' + | 'LABEL' + | 'LOCK' + | 'MERGE' + | 'MKACTIVITY' + | 'MKWORKSPACE' + | 'MOVE' + | 'NOTIFY' + | 'ORDERPATCH' + | 'POLL' + | 'PROPPATCH' + | 'REPORT' + | 'SEARCH' + | 'SUBSCRIBE' + | 'TRACE' + | 'UNCHECKOUT' + | 'UNLOCK' + | 'UNSUBSCRIBE' + | 'UPDATE' + | 'VERSIONCONTROL' + | 'BASELINECONTROL' + | 'XMSENUMATTS' + | 'RPC_OUT_DATA' + | 'RPC_IN_DATA' + | 'JSON' + | 'COOK' + | 'TRACK' + >; + + /** + * Filters results by HTTP version. + */ + httpVersion?: Array<'HTTPv1' | 'HTTPv2' | 'HTTPv3'>; + + /** + * Filters results by IP version (Ipv4 vs. IPv6). + */ + ipVersion?: Array<'IPv4' | 'IPv6'>; + + /** + * Limits the number of objects per group to the top items within the specified + * time range. When item count exceeds the limit, extra items appear grouped under + * an "other" category. + */ + limitPerGroup?: number; + + /** + * Filters results by location. Specify a comma-separated list of alpha-2 codes. + * Prefix with `-` to exclude locations from results. For example, `-US,PT` + * excludes results from the US, but includes results from PT. + */ + location?: Array; + + /** + * Filters the results by layer 7 mitigation product. + */ + mitigationProduct?: Array< + | 'DDOS' + | 'WAF' + | 'BOT_MANAGEMENT' + | 'ACCESS_RULES' + | 'IP_REPUTATION' + | 'API_SHIELD' + | 'DATA_LOSS_PREVENTION' + >; + + /** + * Array of names used to label the series in the response. + */ + name?: Array; +} + export interface Layer7TimeseriesParams { /** * Aggregation interval of the results (e.g., in 15 minutes or 1 hour intervals). @@ -335,14 +882,164 @@ export interface Layer7TimeseriesParams { normalization?: 'PERCENTAGE_CHANGE' | 'MIN0_MAX'; } +export interface Layer7TimeseriesGroupsV2Params { + /** + * Aggregation interval of the results (e.g., in 15 minutes or 1 hour intervals). + * Refer to + * [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + */ + aggInterval?: '15m' | '1h' | '1d' | '1w'; + + /** + * Filters results by Autonomous System. Specify one or more Autonomous System + * Numbers (ASNs) as a comma-separated list. Prefix with `-` to exclude ASNs from + * results. For example, `-174, 3356` excludes results from AS174, but includes + * results from AS3356. + */ + asn?: Array; + + /** + * Filters results by continent. Specify a comma-separated list of alpha-2 codes. + * Prefix with `-` to exclude continents from results. For example, `-EU,NA` + * excludes results from EU, but includes results from NA. + */ + continent?: Array; + + /** + * End of the date range (inclusive). + */ + dateEnd?: Array; + + /** + * Filters results by date range. For example, use `7d` and `7dcontrol` to compare + * this week with the previous week. Use this parameter or set specific start and + * end dates (`dateStart` and `dateEnd` parameters). + */ + dateRange?: Array; + + /** + * Start of the date range. + */ + dateStart?: Array; + + /** + * Format in which results will be returned. + */ + format?: 'JSON' | 'CSV'; + + /** + * Filters results by HTTP method. + */ + httpMethod?: Array< + | 'GET' + | 'POST' + | 'DELETE' + | 'PUT' + | 'HEAD' + | 'PURGE' + | 'OPTIONS' + | 'PROPFIND' + | 'MKCOL' + | 'PATCH' + | 'ACL' + | 'BCOPY' + | 'BDELETE' + | 'BMOVE' + | 'BPROPFIND' + | 'BPROPPATCH' + | 'CHECKIN' + | 'CHECKOUT' + | 'CONNECT' + | 'COPY' + | 'LABEL' + | 'LOCK' + | 'MERGE' + | 'MKACTIVITY' + | 'MKWORKSPACE' + | 'MOVE' + | 'NOTIFY' + | 'ORDERPATCH' + | 'POLL' + | 'PROPPATCH' + | 'REPORT' + | 'SEARCH' + | 'SUBSCRIBE' + | 'TRACE' + | 'UNCHECKOUT' + | 'UNLOCK' + | 'UNSUBSCRIBE' + | 'UPDATE' + | 'VERSIONCONTROL' + | 'BASELINECONTROL' + | 'XMSENUMATTS' + | 'RPC_OUT_DATA' + | 'RPC_IN_DATA' + | 'JSON' + | 'COOK' + | 'TRACK' + >; + + /** + * Filters results by HTTP version. + */ + httpVersion?: Array<'HTTPv1' | 'HTTPv2' | 'HTTPv3'>; + + /** + * Filters results by IP version (Ipv4 vs. IPv6). + */ + ipVersion?: Array<'IPv4' | 'IPv6'>; + + /** + * Limits the number of objects per group to the top items within the specified + * time range. When item count exceeds the limit, extra items appear grouped under + * an "other" category. + */ + limitPerGroup?: number; + + /** + * Filters results by location. Specify a comma-separated list of alpha-2 codes. + * Prefix with `-` to exclude locations from results. For example, `-US,PT` + * excludes results from the US, but includes results from PT. + */ + location?: Array; + + /** + * Filters the results by layer 7 mitigation product. + */ + mitigationProduct?: Array< + | 'DDOS' + | 'WAF' + | 'BOT_MANAGEMENT' + | 'ACCESS_RULES' + | 'IP_REPUTATION' + | 'API_SHIELD' + | 'DATA_LOSS_PREVENTION' + >; + + /** + * Array of names used to label the series in the response. + */ + name?: Array; + + /** + * Normalization method applied to the results. Refer to + * [Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/). + */ + normalization?: 'PERCENTAGE' | 'MIN0_MAX'; +} + Layer7.Summary = Summary; Layer7.TimeseriesGroups = TimeseriesGroups; Layer7.Top = Top; export declare namespace Layer7 { export { + type Layer7SummaryV2Response as Layer7SummaryV2Response, type Layer7TimeseriesResponse as Layer7TimeseriesResponse, + type Layer7TimeseriesGroupsV2Response as Layer7TimeseriesGroupsV2Response, + type Layer7SummaryV2Params as Layer7SummaryV2Params, type Layer7TimeseriesParams as Layer7TimeseriesParams, + type Layer7TimeseriesGroupsV2Params as Layer7TimeseriesGroupsV2Params, }; export { diff --git a/src/resources/radar/attacks/layer7/summary.ts b/src/resources/radar/attacks/layer7/summary.ts index 4afa3d68d0..cec600190e 100644 --- a/src/resources/radar/attacks/layer7/summary.ts +++ b/src/resources/radar/attacks/layer7/summary.ts @@ -8,11 +8,7 @@ export class Summary extends APIResource { /** * Retrieves the distribution of layer 7 attacks by HTTP method. * - * @example - * ```ts - * const response = - * await client.radar.attacks.layer7.summary.httpMethod(); - * ``` + * @deprecated Use [Radar Attacks Layer 7 Summary By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/attacks/subresources/layer7/methods/summary_v2/) instead. */ httpMethod( query?: SummaryHTTPMethodParams, @@ -37,11 +33,7 @@ export class Summary extends APIResource { /** * Retrieves the distribution of layer 7 attacks by HTTP version. * - * @example - * ```ts - * const response = - * await client.radar.attacks.layer7.summary.httpVersion(); - * ``` + * @deprecated Use [Radar Attacks Layer 7 Summary By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/attacks/subresources/layer7/methods/summary_v2/) instead. */ httpVersion( query?: SummaryHTTPVersionParams, @@ -66,11 +58,7 @@ export class Summary extends APIResource { /** * Retrieves the distribution of layer 7 attacks by targeted industry. * - * @example - * ```ts - * const response = - * await client.radar.attacks.layer7.summary.industry(); - * ``` + * @deprecated Use [Radar Attacks Layer 7 Summary By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/attacks/subresources/layer7/methods/summary_v2/) instead. */ industry( query?: SummaryIndustryParams, @@ -94,11 +82,7 @@ export class Summary extends APIResource { /** * Retrieves the distribution of layer 7 attacks by IP version. * - * @example - * ```ts - * const response = - * await client.radar.attacks.layer7.summary.ipVersion(); - * ``` + * @deprecated Use [Radar Attacks Layer 7 Summary By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/attacks/subresources/layer7/methods/summary_v2/) instead. */ ipVersion( query?: SummaryIPVersionParams, @@ -122,11 +106,7 @@ export class Summary extends APIResource { /** * Retrieves the distribution of layer 7 attacks by managed rules. * - * @example - * ```ts - * const response = - * await client.radar.attacks.layer7.summary.managedRules(); - * ``` + * @deprecated Use [Radar Attacks Layer 7 Summary By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/attacks/subresources/layer7/methods/summary_v2/) instead. */ managedRules( query?: SummaryManagedRulesParams, @@ -151,11 +131,7 @@ export class Summary extends APIResource { /** * Retrieves the distribution of layer 7 attacks by mitigation product. * - * @example - * ```ts - * const response = - * await client.radar.attacks.layer7.summary.mitigationProduct(); - * ``` + * @deprecated Use [Radar Attacks Layer 7 Summary By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/attacks/subresources/layer7/methods/summary_v2/) instead. */ mitigationProduct( query?: SummaryMitigationProductParams, @@ -180,11 +156,7 @@ export class Summary extends APIResource { /** * Retrieves the distribution of layer 7 attacks by targeted vertical. * - * @example - * ```ts - * const response = - * await client.radar.attacks.layer7.summary.vertical(); - * ``` + * @deprecated Use [Radar Attacks Layer 7 Summary By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/attacks/subresources/layer7/methods/summary_v2/) instead. */ vertical( query?: SummaryVerticalParams, @@ -264,13 +236,44 @@ export namespace SummaryHTTPMethodResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -361,13 +364,44 @@ export namespace SummaryHTTPVersionResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -466,13 +500,44 @@ export namespace SummaryIndustryResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -563,13 +628,44 @@ export namespace SummaryIPVersionResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -666,13 +762,44 @@ export namespace SummaryManagedRulesResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -763,13 +890,44 @@ export namespace SummaryMitigationProductResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -860,13 +1018,44 @@ export namespace SummaryVerticalResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. diff --git a/src/resources/radar/attacks/layer7/timeseries-groups.ts b/src/resources/radar/attacks/layer7/timeseries-groups.ts index ab7e962788..3e13149952 100644 --- a/src/resources/radar/attacks/layer7/timeseries-groups.ts +++ b/src/resources/radar/attacks/layer7/timeseries-groups.ts @@ -8,11 +8,7 @@ export class TimeseriesGroups extends APIResource { /** * Retrieves the distribution of layer 7 attacks by HTTP method over time. * - * @example - * ```ts - * const response = - * await client.radar.attacks.layer7.timeseriesGroups.httpMethod(); - * ``` + * @deprecated Use [Radar Attacks Layer 7 Timeseries Groups By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/attacks/subresources/layer7/methods/timeseries_groups_v2/) instead. */ httpMethod( query?: TimeseriesGroupHTTPMethodParams, @@ -37,11 +33,7 @@ export class TimeseriesGroups extends APIResource { /** * Retrieves the distribution of layer 7 attacks by HTTP version over time. * - * @example - * ```ts - * const response = - * await client.radar.attacks.layer7.timeseriesGroups.httpVersion(); - * ``` + * @deprecated Use [Radar Attacks Layer 7 Timeseries Groups By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/attacks/subresources/layer7/methods/timeseries_groups_v2/) instead. */ httpVersion( query?: TimeseriesGroupHTTPVersionParams, @@ -66,11 +58,7 @@ export class TimeseriesGroups extends APIResource { /** * Retrieves the distribution of layer 7 attacks by targeted industry over time. * - * @example - * ```ts - * const response = - * await client.radar.attacks.layer7.timeseriesGroups.industry(); - * ``` + * @deprecated Use [Radar Attacks Layer 7 Timeseries Groups By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/attacks/subresources/layer7/methods/timeseries_groups_v2/) instead. */ industry( query?: TimeseriesGroupIndustryParams, @@ -95,11 +83,7 @@ export class TimeseriesGroups extends APIResource { /** * Retrieves the distribution of layer 7 attacks by IP version used over time. * - * @example - * ```ts - * const response = - * await client.radar.attacks.layer7.timeseriesGroups.ipVersion(); - * ``` + * @deprecated Use [Radar Attacks Layer 7 Timeseries Groups By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/attacks/subresources/layer7/methods/timeseries_groups_v2/) instead. */ ipVersion( query?: TimeseriesGroupIPVersionParams, @@ -124,11 +108,7 @@ export class TimeseriesGroups extends APIResource { /** * Retrieves the distribution of layer 7 attacks by managed rules over time. * - * @example - * ```ts - * const response = - * await client.radar.attacks.layer7.timeseriesGroups.managedRules(); - * ``` + * @deprecated Use [Radar Attacks Layer 7 Timeseries Groups By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/attacks/subresources/layer7/methods/timeseries_groups_v2/) instead. */ managedRules( query?: TimeseriesGroupManagedRulesParams, @@ -153,11 +133,7 @@ export class TimeseriesGroups extends APIResource { /** * Retrieves the distribution of layer 7 attacks by mitigation product over time. * - * @example - * ```ts - * const response = - * await client.radar.attacks.layer7.timeseriesGroups.mitigationProduct(); - * ``` + * @deprecated Use [Radar Attacks Layer 7 Timeseries Groups By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/attacks/subresources/layer7/methods/timeseries_groups_v2/) instead. */ mitigationProduct( query?: TimeseriesGroupMitigationProductParams, @@ -182,11 +158,7 @@ export class TimeseriesGroups extends APIResource { /** * Retrieves the distribution of layer 7 attacks by targeted vertical over time. * - * @example - * ```ts - * const response = - * await client.radar.attacks.layer7.timeseriesGroups.vertical(); - * ``` + * @deprecated Use [Radar Attacks Layer 7 Timeseries Groups By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/attacks/subresources/layer7/methods/timeseries_groups_v2/) instead. */ vertical( query?: TimeseriesGroupVerticalParams, @@ -274,13 +246,44 @@ export namespace TimeseriesGroupHTTPMethodResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -384,13 +387,44 @@ export namespace TimeseriesGroupHTTPVersionResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -498,13 +532,44 @@ export namespace TimeseriesGroupIndustryResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -608,13 +673,44 @@ export namespace TimeseriesGroupIPVersionResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -720,13 +816,44 @@ export namespace TimeseriesGroupManagedRulesResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -830,13 +957,44 @@ export namespace TimeseriesGroupMitigationProductResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -940,13 +1098,44 @@ export namespace TimeseriesGroupVerticalResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. diff --git a/src/resources/radar/attacks/layer7/top/ases.ts b/src/resources/radar/attacks/layer7/top/ases.ts index 4e998f8967..bc875fb2b8 100644 --- a/src/resources/radar/attacks/layer7/top/ases.ts +++ b/src/resources/radar/attacks/layer7/top/ases.ts @@ -91,13 +91,44 @@ export namespace AseOriginResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. diff --git a/src/resources/radar/attacks/layer7/top/locations.ts b/src/resources/radar/attacks/layer7/top/locations.ts index 6410fa6d06..7e39ad01f4 100644 --- a/src/resources/radar/attacks/layer7/top/locations.ts +++ b/src/resources/radar/attacks/layer7/top/locations.ts @@ -126,13 +126,44 @@ export namespace LocationOriginResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -233,13 +264,44 @@ export namespace LocationTargetResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. diff --git a/src/resources/radar/attacks/layer7/top/top.ts b/src/resources/radar/attacks/layer7/top/top.ts index 74086112c2..1020f7a1fd 100644 --- a/src/resources/radar/attacks/layer7/top/top.ts +++ b/src/resources/radar/attacks/layer7/top/top.ts @@ -51,7 +51,7 @@ export class Top extends APIResource { * This endpoint is deprecated. To continue getting this data, switch to the * summary by industry endpoint. * - * @deprecated + * @deprecated Use [Radar Attacks Layer 7 Summary By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/attacks/subresources/layer7/methods/summary_v2/) instead. */ industry(query?: TopIndustryParams, options?: Core.RequestOptions): Core.APIPromise; industry(options?: Core.RequestOptions): Core.APIPromise; @@ -73,7 +73,7 @@ export class Top extends APIResource { * This endpoint is deprecated. To continue getting this data, switch to the * summary by vertical endpoint. * - * @deprecated + * @deprecated Use [Radar Attacks Layer 7 Summary By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/attacks/subresources/layer7/methods/summary_v2/) instead. */ vertical(query?: TopVerticalParams, options?: Core.RequestOptions): Core.APIPromise; vertical(options?: Core.RequestOptions): Core.APIPromise; @@ -150,13 +150,44 @@ export namespace TopAttacksResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -259,13 +290,44 @@ export namespace TopIndustryResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -362,13 +424,44 @@ export namespace TopVerticalResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. diff --git a/src/resources/radar/bgp/bgp.ts b/src/resources/radar/bgp/bgp.ts index d12f0258f9..422c35583c 100644 --- a/src/resources/radar/bgp/bgp.ts +++ b/src/resources/radar/bgp/bgp.ts @@ -94,13 +94,44 @@ export namespace BGPTimeseriesResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. diff --git a/src/resources/radar/bgp/hijacks/events.ts b/src/resources/radar/bgp/hijacks/events.ts index 10e427a591..d1f81f790b 100644 --- a/src/resources/radar/bgp/hijacks/events.ts +++ b/src/resources/radar/bgp/hijacks/events.ts @@ -155,9 +155,6 @@ export interface EventListParams extends V4PagePaginationParams { */ minConfidence?: number; - /** - * Network prefix, IPv4 or IPv6. - */ prefix?: string; /** diff --git a/src/resources/radar/bgp/ips.ts b/src/resources/radar/bgp/ips.ts index d693e41e2c..9146957338 100644 --- a/src/resources/radar/bgp/ips.ts +++ b/src/resources/radar/bgp/ips.ts @@ -101,13 +101,44 @@ export namespace IPTimeseriesResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. diff --git a/src/resources/radar/bgp/routes.ts b/src/resources/radar/bgp/routes.ts index 6a67caeff7..4fd17648af 100644 --- a/src/resources/radar/bgp/routes.ts +++ b/src/resources/radar/bgp/routes.ts @@ -510,9 +510,6 @@ export interface RouteMoasParams { */ origin?: number; - /** - * Network prefix, IPv4 or IPv6. - */ prefix?: string; } @@ -533,9 +530,6 @@ export interface RoutePfx2asParams { */ origin?: number; - /** - * Network prefix, IPv4 or IPv6. - */ prefix?: string; /** @@ -550,9 +544,6 @@ export interface RouteRealtimeParams { */ format?: 'JSON' | 'CSV'; - /** - * Network prefix, IPv4 or IPv6. - */ prefix?: string; } diff --git a/src/resources/radar/bots/bots.ts b/src/resources/radar/bots/bots.ts index 781b114d81..8fab41fe66 100644 --- a/src/resources/radar/bots/bots.ts +++ b/src/resources/radar/bots/bots.ts @@ -304,13 +304,44 @@ export namespace BotSummaryResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -411,13 +442,44 @@ export namespace BotTimeseriesResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -521,13 +583,44 @@ export namespace BotTimeseriesGroupsResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. diff --git a/src/resources/radar/bots/web-crawlers.ts b/src/resources/radar/bots/web-crawlers.ts index 7cf614f5a4..2b5ee154da 100644 --- a/src/resources/radar/bots/web-crawlers.ts +++ b/src/resources/radar/bots/web-crawlers.ts @@ -12,20 +12,22 @@ export class WebCrawlers extends APIResource { * @example * ```ts * const response = - * await client.radar.bots.webCrawlers.summary('USER_AGENT'); + * await client.radar.bots.webCrawlers.summary( + * 'CLIENT_TYPE', + * ); * ``` */ summary( - dimension: 'USER_AGENT' | 'REFERER' | 'CRAWL_REFER_RATIO' | 'VERTICAL' | 'INDUSTRY', + dimension: 'CLIENT_TYPE' | 'USER_AGENT' | 'REFERER' | 'CRAWL_REFER_RATIO' | 'VERTICAL' | 'INDUSTRY', query?: WebCrawlerSummaryParams, options?: Core.RequestOptions, ): Core.APIPromise; summary( - dimension: 'USER_AGENT' | 'REFERER' | 'CRAWL_REFER_RATIO' | 'VERTICAL' | 'INDUSTRY', + dimension: 'CLIENT_TYPE' | 'USER_AGENT' | 'REFERER' | 'CRAWL_REFER_RATIO' | 'VERTICAL' | 'INDUSTRY', options?: Core.RequestOptions, ): Core.APIPromise; summary( - dimension: 'USER_AGENT' | 'REFERER' | 'CRAWL_REFER_RATIO' | 'VERTICAL' | 'INDUSTRY', + dimension: 'CLIENT_TYPE' | 'USER_AGENT' | 'REFERER' | 'CRAWL_REFER_RATIO' | 'VERTICAL' | 'INDUSTRY', query: WebCrawlerSummaryParams | Core.RequestOptions = {}, options?: Core.RequestOptions, ): Core.APIPromise { @@ -48,21 +50,21 @@ export class WebCrawlers extends APIResource { * ```ts * const response = * await client.radar.bots.webCrawlers.timeseriesGroups( - * 'USER_AGENT', + * 'CLIENT_TYPE', * ); * ``` */ timeseriesGroups( - dimension: 'USER_AGENT' | 'REFERER' | 'CRAWL_REFER_RATIO' | 'VERTICAL' | 'INDUSTRY', + dimension: 'CLIENT_TYPE' | 'USER_AGENT' | 'REFERER' | 'CRAWL_REFER_RATIO' | 'VERTICAL' | 'INDUSTRY', query?: WebCrawlerTimeseriesGroupsParams, options?: Core.RequestOptions, ): Core.APIPromise; timeseriesGroups( - dimension: 'USER_AGENT' | 'REFERER' | 'CRAWL_REFER_RATIO' | 'VERTICAL' | 'INDUSTRY', + dimension: 'CLIENT_TYPE' | 'USER_AGENT' | 'REFERER' | 'CRAWL_REFER_RATIO' | 'VERTICAL' | 'INDUSTRY', options?: Core.RequestOptions, ): Core.APIPromise; timeseriesGroups( - dimension: 'USER_AGENT' | 'REFERER' | 'CRAWL_REFER_RATIO' | 'VERTICAL' | 'INDUSTRY', + dimension: 'CLIENT_TYPE' | 'USER_AGENT' | 'REFERER' | 'CRAWL_REFER_RATIO' | 'VERTICAL' | 'INDUSTRY', query: WebCrawlerTimeseriesGroupsParams | Core.RequestOptions = {}, options?: Core.RequestOptions, ): Core.APIPromise { @@ -136,13 +138,44 @@ export namespace WebCrawlerSummaryResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -240,13 +273,44 @@ export namespace WebCrawlerTimeseriesGroupsResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -291,6 +355,11 @@ export interface WebCrawlerSummaryParams { */ botOperator?: Array; + /** + * Filters results by agent type. + */ + clientType?: Array<'HUMAN' | 'NON_AI_BOT' | 'AI_BOT' | 'MIXED_PURPOSE'>; + /** * End of the date range (inclusive). */ @@ -349,6 +418,11 @@ export interface WebCrawlerTimeseriesGroupsParams { */ botOperator?: Array; + /** + * Filters results by agent type. + */ + clientType?: Array<'HUMAN' | 'NON_AI_BOT' | 'AI_BOT' | 'MIXED_PURPOSE'>; + /** * End of the date range (inclusive). */ diff --git a/src/resources/radar/ct/ct.ts b/src/resources/radar/ct/ct.ts index 9f5873a4d2..ce5877b4b9 100644 --- a/src/resources/radar/ct/ct.ts +++ b/src/resources/radar/ct/ct.ts @@ -264,13 +264,44 @@ export namespace CtSummaryResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -427,13 +458,44 @@ export namespace CtTimeseriesResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -545,13 +607,44 @@ export namespace CtTimeseriesGroupsResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. diff --git a/src/resources/radar/ct/logs.ts b/src/resources/radar/ct/logs.ts index 4ba71c4acf..829a017a4b 100644 --- a/src/resources/radar/ct/logs.ts +++ b/src/resources/radar/ct/logs.ts @@ -121,6 +121,12 @@ export namespace LogGetResponse { */ api: 'RFC6962' | 'STATIC'; + /** + * The average throughput of the CT log, measured in certificates per hour + * (certs/hour). + */ + avgThroughput: number; + /** * A brief description of the certificate log. */ @@ -131,6 +137,11 @@ export namespace LogGetResponse { */ endExclusive: string; + /** + * Timestamp of the most recent update to the CT log. + */ + lastUpdate: string; + /** * The organization responsible for operating the certificate log. */ @@ -168,6 +179,18 @@ export namespace LogGetResponse { */ stateTimestamp: string; + /** + * Number of certificates that are eligible for inclusion to this log but have not + * been included yet. Based on certificates signed by trusted root CAs within the + * log's accepted date range. + */ + submittableCertCount: string | null; + + /** + * Number of certificates already included in this CT log. + */ + submittedCertCount: string | null; + /** * The URL for the certificate log. */ diff --git a/src/resources/radar/dns/dns.ts b/src/resources/radar/dns/dns.ts index 8220269674..c6bfb30a59 100644 --- a/src/resources/radar/dns/dns.ts +++ b/src/resources/radar/dns/dns.ts @@ -61,6 +61,76 @@ export class DNS extends APIResource { this._client, ); + /** + * Retrieves the distribution of DNS queries by the specified dimension. + * + * @example + * ```ts + * const response = await client.radar.dns.summaryV2( + * 'IP_VERSION', + * ); + * ``` + */ + summaryV2( + dimension: + | 'IP_VERSION' + | 'CACHE_HIT' + | 'DNSSEC' + | 'DNSSEC_AWARE' + | 'DNSSEC_E2E' + | 'MATCHING_ANSWER' + | 'PROTOCOL' + | 'QUERY_TYPE' + | 'RESPONSE_CODE' + | 'RESPONSE_TTL' + | 'TLD' + | 'TLD_DNS_MAGNITUDE', + query?: DNSSummaryV2Params, + options?: Core.RequestOptions, + ): Core.APIPromise; + summaryV2( + dimension: + | 'IP_VERSION' + | 'CACHE_HIT' + | 'DNSSEC' + | 'DNSSEC_AWARE' + | 'DNSSEC_E2E' + | 'MATCHING_ANSWER' + | 'PROTOCOL' + | 'QUERY_TYPE' + | 'RESPONSE_CODE' + | 'RESPONSE_TTL' + | 'TLD' + | 'TLD_DNS_MAGNITUDE', + options?: Core.RequestOptions, + ): Core.APIPromise; + summaryV2( + dimension: + | 'IP_VERSION' + | 'CACHE_HIT' + | 'DNSSEC' + | 'DNSSEC_AWARE' + | 'DNSSEC_E2E' + | 'MATCHING_ANSWER' + | 'PROTOCOL' + | 'QUERY_TYPE' + | 'RESPONSE_CODE' + | 'RESPONSE_TTL' + | 'TLD' + | 'TLD_DNS_MAGNITUDE', + query: DNSSummaryV2Params | Core.RequestOptions = {}, + options?: Core.RequestOptions, + ): Core.APIPromise { + if (isRequestOptions(query)) { + return this.summaryV2(dimension, {}, query); + } + return ( + this._client.get(`/radar/dns/summary/${dimension}`, { query, ...options }) as Core.APIPromise<{ + result: DNSSummaryV2Response; + }> + )._thenUnwrap((obj) => obj.result); + } + /** * Retrieves normalized query volume to the 1.1.1.1 DNS resolver over time. * @@ -87,6 +157,202 @@ export class DNS extends APIResource { }> )._thenUnwrap((obj) => obj.result); } + + /** + * Retrieves the distribution of DNS queries grouped by dimension over time. + * + * @example + * ```ts + * const response = await client.radar.dns.timeseriesGroupsV2( + * 'IP_VERSION', + * ); + * ``` + */ + timeseriesGroupsV2( + dimension: + | 'IP_VERSION' + | 'CACHE_HIT' + | 'DNSSEC' + | 'DNSSEC_AWARE' + | 'DNSSEC_E2E' + | 'MATCHING_ANSWER' + | 'PROTOCOL' + | 'QUERY_TYPE' + | 'RESPONSE_CODE' + | 'RESPONSE_TTL' + | 'TLD', + query?: DNSTimeseriesGroupsV2Params, + options?: Core.RequestOptions, + ): Core.APIPromise; + timeseriesGroupsV2( + dimension: + | 'IP_VERSION' + | 'CACHE_HIT' + | 'DNSSEC' + | 'DNSSEC_AWARE' + | 'DNSSEC_E2E' + | 'MATCHING_ANSWER' + | 'PROTOCOL' + | 'QUERY_TYPE' + | 'RESPONSE_CODE' + | 'RESPONSE_TTL' + | 'TLD', + options?: Core.RequestOptions, + ): Core.APIPromise; + timeseriesGroupsV2( + dimension: + | 'IP_VERSION' + | 'CACHE_HIT' + | 'DNSSEC' + | 'DNSSEC_AWARE' + | 'DNSSEC_E2E' + | 'MATCHING_ANSWER' + | 'PROTOCOL' + | 'QUERY_TYPE' + | 'RESPONSE_CODE' + | 'RESPONSE_TTL' + | 'TLD', + query: DNSTimeseriesGroupsV2Params | Core.RequestOptions = {}, + options?: Core.RequestOptions, + ): Core.APIPromise { + if (isRequestOptions(query)) { + return this.timeseriesGroupsV2(dimension, {}, query); + } + return ( + this._client.get(`/radar/dns/timeseries_groups/${dimension}`, { + query, + ...options, + }) as Core.APIPromise<{ result: DNSTimeseriesGroupsV2Response }> + )._thenUnwrap((obj) => obj.result); + } +} + +export interface DNSSummaryV2Response { + /** + * Metadata for the results. + */ + meta: DNSSummaryV2Response.Meta; + + summary_0: { [key: string]: string }; +} + +export namespace DNSSummaryV2Response { + /** + * Metadata for the results. + */ + export interface Meta { + confidenceInfo: Meta.ConfidenceInfo; + + dateRange: Array; + + /** + * Timestamp of the last dataset update. + */ + lastUpdated: string; + + /** + * Normalization method applied to the results. Refer to + * [Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/). + */ + normalization: + | 'PERCENTAGE' + | 'MIN0_MAX' + | 'MIN_MAX' + | 'RAW_VALUES' + | 'PERCENTAGE_CHANGE' + | 'ROLLING_AVERAGE' + | 'OVERLAPPED_PERCENTAGE' + | 'RATIO'; + + /** + * Measurement units for the results. + */ + units: Array; + } + + export namespace Meta { + export interface ConfidenceInfo { + annotations: Array; + + /** + * Provides an indication of how much confidence Cloudflare has in the data. + */ + level: number; + } + + export namespace ConfidenceInfo { + /** + * Annotation associated with the result (e.g. outage or other type of event). + */ + export interface Annotation { + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; + + description: string; + + endDate: string; + + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; + + /** + * Whether event is a single point in time or a time range. + */ + isInstantaneous: boolean; + + linkedUrl: string; + + startDate: string; + } + } + + export interface DateRange { + /** + * Adjusted end of date range. + */ + endTime: string; + + /** + * Adjusted start of date range. + */ + startTime: string; + } + + export interface Unit { + name: string; + + value: string; + } + } } export interface DNSTimeseriesResponse { @@ -122,87 +388,719 @@ export namespace DNSTimeseriesResponse { */ lastUpdated: string; - /** - * Normalization method applied to the results. Refer to - * [Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/). - */ - normalization: - | 'PERCENTAGE' - | 'MIN0_MAX' - | 'MIN_MAX' - | 'RAW_VALUES' - | 'PERCENTAGE_CHANGE' - | 'ROLLING_AVERAGE' - | 'OVERLAPPED_PERCENTAGE' - | 'RATIO'; + /** + * Normalization method applied to the results. Refer to + * [Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/). + */ + normalization: + | 'PERCENTAGE' + | 'MIN0_MAX' + | 'MIN_MAX' + | 'RAW_VALUES' + | 'PERCENTAGE_CHANGE' + | 'ROLLING_AVERAGE' + | 'OVERLAPPED_PERCENTAGE' + | 'RATIO'; + + /** + * Measurement units for the results. + */ + units: Array; + } + + export namespace Meta { + export interface ConfidenceInfo { + annotations: Array; + + /** + * Provides an indication of how much confidence Cloudflare has in the data. + */ + level: number; + } + + export namespace ConfidenceInfo { + /** + * Annotation associated with the result (e.g. outage or other type of event). + */ + export interface Annotation { + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; + + description: string; + + endDate: string; + + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; + + /** + * Whether event is a single point in time or a time range. + */ + isInstantaneous: boolean; + + linkedUrl: string; + + startDate: string; + } + } + + export interface DateRange { + /** + * Adjusted end of date range. + */ + endTime: string; + + /** + * Adjusted start of date range. + */ + startTime: string; + } + + export interface Unit { + name: string; + + value: string; + } + } + + export interface unnamed_schema_ref_75bae70cf28e6bcef364b9840db3bdeb { + timestamps: Array; + + values: Array; + } +} + +export interface DNSTimeseriesGroupsV2Response { + /** + * Metadata for the results. + */ + meta: DNSTimeseriesGroupsV2Response.Meta; + + serie_0: DNSTimeseriesGroupsV2Response.Serie0; +} + +export namespace DNSTimeseriesGroupsV2Response { + /** + * Metadata for the results. + */ + export interface Meta { + /** + * Aggregation interval of the results (e.g., in 15 minutes or 1 hour intervals). + * Refer to + * [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + */ + aggInterval: 'FIFTEEN_MINUTES' | 'ONE_HOUR' | 'ONE_DAY' | 'ONE_WEEK' | 'ONE_MONTH'; + + confidenceInfo: Meta.ConfidenceInfo; + + dateRange: Array; + + /** + * Timestamp of the last dataset update. + */ + lastUpdated: string; + + /** + * Normalization method applied to the results. Refer to + * [Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/). + */ + normalization: + | 'PERCENTAGE' + | 'MIN0_MAX' + | 'MIN_MAX' + | 'RAW_VALUES' + | 'PERCENTAGE_CHANGE' + | 'ROLLING_AVERAGE' + | 'OVERLAPPED_PERCENTAGE' + | 'RATIO'; + + /** + * Measurement units for the results. + */ + units: Array; + } + + export namespace Meta { + export interface ConfidenceInfo { + annotations: Array; + + /** + * Provides an indication of how much confidence Cloudflare has in the data. + */ + level: number; + } + + export namespace ConfidenceInfo { + /** + * Annotation associated with the result (e.g. outage or other type of event). + */ + export interface Annotation { + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; + + description: string; + + endDate: string; + + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; + + /** + * Whether event is a single point in time or a time range. + */ + isInstantaneous: boolean; + + linkedUrl: string; + + startDate: string; + } + } + + export interface DateRange { + /** + * Adjusted end of date range. + */ + endTime: string; + + /** + * Adjusted start of date range. + */ + startTime: string; + } + + export interface Unit { + name: string; + + value: string; + } + } + + export interface Serie0 { + timestamps: Array; + + [k: string]: Array | Array | undefined; + } +} + +export interface DNSSummaryV2Params { + /** + * Filters results by Autonomous System. Specify one or more Autonomous System + * Numbers (ASNs) as a comma-separated list. Prefix with `-` to exclude ASNs from + * results. For example, `-174, 3356` excludes results from AS174, but includes + * results from AS3356. + */ + asn?: Array; + + /** + * Filters results based on cache status. + */ + cacheHit?: Array; + + /** + * Filters results by continent. Specify a comma-separated list of alpha-2 codes. + * Prefix with `-` to exclude continents from results. For example, `-EU,NA` + * excludes results from EU, but includes results from NA. + */ + continent?: Array; + + /** + * End of the date range (inclusive). + */ + dateEnd?: Array; + + /** + * Filters results by date range. For example, use `7d` and `7dcontrol` to compare + * this week with the previous week. Use this parameter or set specific start and + * end dates (`dateStart` and `dateEnd` parameters). + */ + dateRange?: Array; + + /** + * Start of the date range. + */ + dateStart?: Array; + + /** + * Filters results based on DNSSEC (DNS Security Extensions) support. + */ + dnssec?: Array<'INVALID' | 'INSECURE' | 'SECURE' | 'OTHER'>; + + /** + * Filters results based on DNSSEC (DNS Security Extensions) client awareness. + */ + dnssecAware?: Array<'SUPPORTED' | 'NOT_SUPPORTED'>; + + /** + * Filters results based on DNSSEC-validated answers by end-to-end security status. + */ + dnssecE2e?: Array; + + /** + * Format in which results will be returned. + */ + format?: 'JSON' | 'CSV'; + + /** + * Filters results by IP version (Ipv4 vs. IPv6). + */ + ipVersion?: Array<'IPv4' | 'IPv6'>; + + /** + * Limits the number of objects per group to the top items within the specified + * time range. When item count exceeds the limit, extra items appear grouped under + * an "other" category. + */ + limitPerGroup?: number; + + /** + * Filters results by location. Specify a comma-separated list of alpha-2 codes. + * Prefix with `-` to exclude locations from results. For example, `-US,PT` + * excludes results from the US, but includes results from PT. + */ + location?: Array; + + /** + * Filters results based on whether the queries have a matching answer. + */ + matchingAnswer?: Array; + + /** + * Array of names used to label the series in the response. + */ + name?: Array; + + /** + * Specifies whether the response includes empty DNS responses (NODATA). + */ + nodata?: Array; + + /** + * Filters results by DNS transport protocol. + */ + protocol?: Array<'UDP' | 'TCP' | 'HTTPS' | 'TLS'>; + + /** + * Filters results by DNS query type. + */ + queryType?: Array< + | 'A' + | 'AAAA' + | 'A6' + | 'AFSDB' + | 'ANY' + | 'APL' + | 'ATMA' + | 'AXFR' + | 'CAA' + | 'CDNSKEY' + | 'CDS' + | 'CERT' + | 'CNAME' + | 'CSYNC' + | 'DHCID' + | 'DLV' + | 'DNAME' + | 'DNSKEY' + | 'DOA' + | 'DS' + | 'EID' + | 'EUI48' + | 'EUI64' + | 'GPOS' + | 'GID' + | 'HINFO' + | 'HIP' + | 'HTTPS' + | 'IPSECKEY' + | 'ISDN' + | 'IXFR' + | 'KEY' + | 'KX' + | 'L32' + | 'L64' + | 'LOC' + | 'LP' + | 'MAILA' + | 'MAILB' + | 'MB' + | 'MD' + | 'MF' + | 'MG' + | 'MINFO' + | 'MR' + | 'MX' + | 'NAPTR' + | 'NB' + | 'NBSTAT' + | 'NID' + | 'NIMLOC' + | 'NINFO' + | 'NS' + | 'NSAP' + | 'NSEC' + | 'NSEC3' + | 'NSEC3PARAM' + | 'NULL' + | 'NXT' + | 'OPENPGPKEY' + | 'OPT' + | 'PTR' + | 'PX' + | 'RKEY' + | 'RP' + | 'RRSIG' + | 'RT' + | 'SIG' + | 'SINK' + | 'SMIMEA' + | 'SOA' + | 'SPF' + | 'SRV' + | 'SSHFP' + | 'SVCB' + | 'TA' + | 'TALINK' + | 'TKEY' + | 'TLSA' + | 'TSIG' + | 'TXT' + | 'UINFO' + | 'UID' + | 'UNSPEC' + | 'URI' + | 'WKS' + | 'X25' + | 'ZONEMD' + | null + >; + + /** + * Filters results by DNS response code. + */ + responseCode?: Array< + | 'NOERROR' + | 'FORMERR' + | 'SERVFAIL' + | 'NXDOMAIN' + | 'NOTIMP' + | 'REFUSED' + | 'YXDOMAIN' + | 'YXRRSET' + | 'NXRRSET' + | 'NOTAUTH' + | 'NOTZONE' + | 'BADSIG' + | 'BADKEY' + | 'BADTIME' + | 'BADMODE' + | 'BADNAME' + | 'BADALG' + | 'BADTRUNC' + | 'BADCOOKIE' + >; + + /** + * Filters results by DNS response TTL. + */ + responseTtl?: Array< + 'LTE_1M' | 'GT_1M_LTE_5M' | 'GT_5M_LTE_15M' | 'GT_15M_LTE_1H' | 'GT_1H_LTE_1D' | 'GT_1D_LTE_1W' | 'GT_1W' + >; + + /** + * Filters results by top-level domain. + */ + tld?: Array; +} + +export interface DNSTimeseriesParams { + /** + * Aggregation interval of the results (e.g., in 15 minutes or 1 hour intervals). + * Refer to + * [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + */ + aggInterval?: '15m' | '1h' | '1d' | '1w'; + + /** + * Filters results by Autonomous System. Specify one or more Autonomous System + * Numbers (ASNs) as a comma-separated list. Prefix with `-` to exclude ASNs from + * results. For example, `-174, 3356` excludes results from AS174, but includes + * results from AS3356. + */ + asn?: Array; + + /** + * Filters results based on cache status. + */ + cacheHit?: Array; + + /** + * Filters results by continent. Specify a comma-separated list of alpha-2 codes. + * Prefix with `-` to exclude continents from results. For example, `-EU,NA` + * excludes results from EU, but includes results from NA. + */ + continent?: Array; - /** - * Measurement units for the results. - */ - units: Array; - } + /** + * End of the date range (inclusive). + */ + dateEnd?: Array; - export namespace Meta { - export interface ConfidenceInfo { - annotations: Array; + /** + * Filters results by date range. For example, use `7d` and `7dcontrol` to compare + * this week with the previous week. Use this parameter or set specific start and + * end dates (`dateStart` and `dateEnd` parameters). + */ + dateRange?: Array; - /** - * Provides an indication of how much confidence Cloudflare has in the data. - */ - level: number; - } + /** + * Start of the date range. + */ + dateStart?: Array; - export namespace ConfidenceInfo { - /** - * Annotation associated with the result (e.g. outage or other type of event). - */ - export interface Annotation { - dataSource: string; + /** + * Filters results based on DNSSEC (DNS Security Extensions) support. + */ + dnssec?: Array<'INVALID' | 'INSECURE' | 'SECURE' | 'OTHER'>; - description: string; + /** + * Filters results based on DNSSEC (DNS Security Extensions) client awareness. + */ + dnssecAware?: Array<'SUPPORTED' | 'NOT_SUPPORTED'>; - endDate: string; + /** + * Filters results based on DNSSEC-validated answers by end-to-end security status. + */ + dnssecE2e?: Array; - eventType: string; + /** + * Format in which results will be returned. + */ + format?: 'JSON' | 'CSV'; - /** - * Whether event is a single point in time or a time range. - */ - isInstantaneous: boolean; + /** + * Filters results by IP version (Ipv4 vs. IPv6). + */ + ipVersion?: Array<'IPv4' | 'IPv6'>; - linkedUrl: string; + /** + * Filters results by location. Specify a comma-separated list of alpha-2 codes. + * Prefix with `-` to exclude locations from results. For example, `-US,PT` + * excludes results from the US, but includes results from PT. + */ + location?: Array; - startDate: string; - } - } + /** + * Filters results based on whether the queries have a matching answer. + */ + matchingAnswer?: Array; - export interface DateRange { - /** - * Adjusted end of date range. - */ - endTime: string; + /** + * Array of names used to label the series in the response. + */ + name?: Array; - /** - * Adjusted start of date range. - */ - startTime: string; - } + /** + * Specifies whether the response includes empty DNS responses (NODATA). + */ + nodata?: Array; - export interface Unit { - name: string; + /** + * Filters results by DNS transport protocol. + */ + protocol?: Array<'UDP' | 'TCP' | 'HTTPS' | 'TLS'>; - value: string; - } - } + /** + * Filters results by DNS query type. + */ + queryType?: Array< + | 'A' + | 'AAAA' + | 'A6' + | 'AFSDB' + | 'ANY' + | 'APL' + | 'ATMA' + | 'AXFR' + | 'CAA' + | 'CDNSKEY' + | 'CDS' + | 'CERT' + | 'CNAME' + | 'CSYNC' + | 'DHCID' + | 'DLV' + | 'DNAME' + | 'DNSKEY' + | 'DOA' + | 'DS' + | 'EID' + | 'EUI48' + | 'EUI64' + | 'GPOS' + | 'GID' + | 'HINFO' + | 'HIP' + | 'HTTPS' + | 'IPSECKEY' + | 'ISDN' + | 'IXFR' + | 'KEY' + | 'KX' + | 'L32' + | 'L64' + | 'LOC' + | 'LP' + | 'MAILA' + | 'MAILB' + | 'MB' + | 'MD' + | 'MF' + | 'MG' + | 'MINFO' + | 'MR' + | 'MX' + | 'NAPTR' + | 'NB' + | 'NBSTAT' + | 'NID' + | 'NIMLOC' + | 'NINFO' + | 'NS' + | 'NSAP' + | 'NSEC' + | 'NSEC3' + | 'NSEC3PARAM' + | 'NULL' + | 'NXT' + | 'OPENPGPKEY' + | 'OPT' + | 'PTR' + | 'PX' + | 'RKEY' + | 'RP' + | 'RRSIG' + | 'RT' + | 'SIG' + | 'SINK' + | 'SMIMEA' + | 'SOA' + | 'SPF' + | 'SRV' + | 'SSHFP' + | 'SVCB' + | 'TA' + | 'TALINK' + | 'TKEY' + | 'TLSA' + | 'TSIG' + | 'TXT' + | 'UINFO' + | 'UID' + | 'UNSPEC' + | 'URI' + | 'WKS' + | 'X25' + | 'ZONEMD' + | null + >; - export interface unnamed_schema_ref_75bae70cf28e6bcef364b9840db3bdeb { - timestamps: Array; + /** + * Filters results by DNS response code. + */ + responseCode?: Array< + | 'NOERROR' + | 'FORMERR' + | 'SERVFAIL' + | 'NXDOMAIN' + | 'NOTIMP' + | 'REFUSED' + | 'YXDOMAIN' + | 'YXRRSET' + | 'NXRRSET' + | 'NOTAUTH' + | 'NOTZONE' + | 'BADSIG' + | 'BADKEY' + | 'BADTIME' + | 'BADMODE' + | 'BADNAME' + | 'BADALG' + | 'BADTRUNC' + | 'BADCOOKIE' + >; - values: Array; - } + /** + * Filters results by DNS response TTL. + */ + responseTtl?: Array< + 'LTE_1M' | 'GT_1M_LTE_5M' | 'GT_5M_LTE_15M' | 'GT_15M_LTE_1H' | 'GT_1H_LTE_1D' | 'GT_1D_LTE_1W' | 'GT_1W' + >; + + /** + * Filters results by top-level domain. + */ + tld?: Array; } -export interface DNSTimeseriesParams { +export interface DNSTimeseriesGroupsV2Params { /** * Aggregation interval of the results (e.g., in 15 minutes or 1 hour intervals). * Refer to @@ -218,6 +1116,11 @@ export interface DNSTimeseriesParams { */ asn?: Array; + /** + * Filters results based on cache status. + */ + cacheHit?: Array; + /** * Filters results by continent. Specify a comma-separated list of alpha-2 codes. * Prefix with `-` to exclude continents from results. For example, `-EU,NA` @@ -242,11 +1145,38 @@ export interface DNSTimeseriesParams { */ dateStart?: Array; + /** + * Filters results based on DNSSEC (DNS Security Extensions) support. + */ + dnssec?: Array<'INVALID' | 'INSECURE' | 'SECURE' | 'OTHER'>; + + /** + * Filters results based on DNSSEC (DNS Security Extensions) client awareness. + */ + dnssecAware?: Array<'SUPPORTED' | 'NOT_SUPPORTED'>; + + /** + * Filters results based on DNSSEC-validated answers by end-to-end security status. + */ + dnssecE2e?: Array; + /** * Format in which results will be returned. */ format?: 'JSON' | 'CSV'; + /** + * Filters results by IP version (Ipv4 vs. IPv6). + */ + ipVersion?: Array<'IPv4' | 'IPv6'>; + + /** + * Limits the number of objects per group to the top items within the specified + * time range. When item count exceeds the limit, extra items appear grouped under + * an "other" category. + */ + limitPerGroup?: number; + /** * Filters results by location. Specify a comma-separated list of alpha-2 codes. * Prefix with `-` to exclude locations from results. For example, `-US,PT` @@ -254,6 +1184,11 @@ export interface DNSTimeseriesParams { */ location?: Array; + /** + * Filters results based on whether the queries have a matching answer. + */ + matchingAnswer?: Array; + /** * Array of names used to label the series in the response. */ @@ -262,17 +1197,23 @@ export interface DNSTimeseriesParams { /** * Specifies whether the response includes empty DNS responses (NODATA). */ - nodata?: boolean; + nodata?: Array; + + /** + * Normalization method applied to the results. Refer to + * [Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/). + */ + normalization?: 'PERCENTAGE' | 'MIN0_MAX'; /** * Filters results by DNS transport protocol. */ - protocol?: 'UDP' | 'TCP' | 'HTTPS' | 'TLS'; + protocol?: Array<'UDP' | 'TCP' | 'HTTPS' | 'TLS'>; /** * Filters results by DNS query type. */ - queryType?: + queryType?: Array< | 'A' | 'AAAA' | 'A6' @@ -361,12 +1302,13 @@ export interface DNSTimeseriesParams { | 'WKS' | 'X25' | 'ZONEMD' - | null; + | null + >; /** * Filters results by DNS response code. */ - responseCode?: + responseCode?: Array< | 'NOERROR' | 'FORMERR' | 'SERVFAIL' @@ -385,10 +1327,18 @@ export interface DNSTimeseriesParams { | 'BADNAME' | 'BADALG' | 'BADTRUNC' - | 'BADCOOKIE'; + | 'BADCOOKIE' + >; + + /** + * Filters results by DNS response TTL. + */ + responseTtl?: Array< + 'LTE_1M' | 'GT_1M_LTE_5M' | 'GT_5M_LTE_15M' | 'GT_15M_LTE_1H' | 'GT_1H_LTE_1D' | 'GT_1D_LTE_1W' | 'GT_1W' + >; /** - * Filters results by country code top-level domain (ccTLD). + * Filters results by top-level domain. */ tld?: Array; } @@ -399,8 +1349,12 @@ DNS.TimeseriesGroups = TimeseriesGroups; export declare namespace DNS { export { + type DNSSummaryV2Response as DNSSummaryV2Response, type DNSTimeseriesResponse as DNSTimeseriesResponse, + type DNSTimeseriesGroupsV2Response as DNSTimeseriesGroupsV2Response, + type DNSSummaryV2Params as DNSSummaryV2Params, type DNSTimeseriesParams as DNSTimeseriesParams, + type DNSTimeseriesGroupsV2Params as DNSTimeseriesGroupsV2Params, }; export { diff --git a/src/resources/radar/dns/index.ts b/src/resources/radar/dns/index.ts index 5254679872..d86325efb1 100644 --- a/src/resources/radar/dns/index.ts +++ b/src/resources/radar/dns/index.ts @@ -1,6 +1,14 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { DNS, type DNSTimeseriesResponse, type DNSTimeseriesParams } from './dns'; +export { + DNS, + type DNSSummaryV2Response, + type DNSTimeseriesResponse, + type DNSTimeseriesGroupsV2Response, + type DNSSummaryV2Params, + type DNSTimeseriesParams, + type DNSTimeseriesGroupsV2Params, +} from './dns'; export { Summary, type SummaryCacheHitResponse, diff --git a/src/resources/radar/dns/summary.ts b/src/resources/radar/dns/summary.ts index 9bc87aa1f9..3c75d72c23 100644 --- a/src/resources/radar/dns/summary.ts +++ b/src/resources/radar/dns/summary.ts @@ -8,10 +8,7 @@ export class Summary extends APIResource { /** * Retrieves the distribution of DNS queries by cache status. * - * @example - * ```ts - * const response = await client.radar.dns.summary.cacheHit(); - * ``` + * @deprecated Use [Radar DNS Summary By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/dns/methods/summary_v2/) instead. */ cacheHit( query?: SummaryCacheHitParams, @@ -36,10 +33,7 @@ export class Summary extends APIResource { * Retrieves the distribution of DNS responses by DNSSEC (DNS Security Extensions) * support. * - * @example - * ```ts - * const response = await client.radar.dns.summary.dnssec(); - * ``` + * @deprecated Use [Radar DNS Summary By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/dns/methods/summary_v2/) instead. */ dnssec(query?: SummaryDNSSECParams, options?: Core.RequestOptions): Core.APIPromise; dnssec(options?: Core.RequestOptions): Core.APIPromise; @@ -61,11 +55,7 @@ export class Summary extends APIResource { * Retrieves the distribution of DNS queries by DNSSEC (DNS Security Extensions) * client awareness. * - * @example - * ```ts - * const response = - * await client.radar.dns.summary.dnssecAware(); - * ``` + * @deprecated Use [Radar DNS Summary By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/dns/methods/summary_v2/) instead. */ dnssecAware( query?: SummaryDNSSECAwareParams, @@ -90,10 +80,7 @@ export class Summary extends APIResource { * Retrieves the distribution of DNSSEC-validated answers by end-to-end security * status. * - * @example - * ```ts - * const response = await client.radar.dns.summary.dnssecE2E(); - * ``` + * @deprecated Use [Radar DNS Summary By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/dns/methods/summary_v2/) instead. */ dnssecE2E( query?: SummaryDNSSECE2EParams, @@ -117,10 +104,7 @@ export class Summary extends APIResource { /** * Retrieves the distribution of DNS queries by IP version. * - * @example - * ```ts - * const response = await client.radar.dns.summary.ipVersion(); - * ``` + * @deprecated Use [Radar DNS Summary By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/dns/methods/summary_v2/) instead. */ ipVersion( query?: SummaryIPVersionParams, @@ -144,11 +128,7 @@ export class Summary extends APIResource { /** * Retrieves the distribution of DNS queries by matching answers. * - * @example - * ```ts - * const response = - * await client.radar.dns.summary.matchingAnswer(); - * ``` + * @deprecated Use [Radar DNS Summary By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/dns/methods/summary_v2/) instead. */ matchingAnswer( query?: SummaryMatchingAnswerParams, @@ -172,10 +152,7 @@ export class Summary extends APIResource { /** * Retrieves the distribution of DNS queries by DNS transport protocol. * - * @example - * ```ts - * const response = await client.radar.dns.summary.protocol(); - * ``` + * @deprecated Use [Radar DNS Summary By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/dns/methods/summary_v2/) instead. */ protocol( query?: SummaryProtocolParams, @@ -199,10 +176,7 @@ export class Summary extends APIResource { /** * Retrieves the distribution of DNS queries by type. * - * @example - * ```ts - * const response = await client.radar.dns.summary.queryType(); - * ``` + * @deprecated Use [Radar DNS Summary By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/dns/methods/summary_v2/) instead. */ queryType( query?: SummaryQueryTypeParams, @@ -226,11 +200,7 @@ export class Summary extends APIResource { /** * Retrieves the distribution of DNS queries by response code. * - * @example - * ```ts - * const response = - * await client.radar.dns.summary.responseCode(); - * ``` + * @deprecated Use [Radar DNS Summary By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/dns/methods/summary_v2/) instead. */ responseCode( query?: SummaryResponseCodeParams, @@ -254,11 +224,7 @@ export class Summary extends APIResource { /** * Retrieves the distribution of DNS queries by minimum response TTL. * - * @example - * ```ts - * const response = - * await client.radar.dns.summary.responseTTL(); - * ``` + * @deprecated Use [Radar DNS Summary By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/dns/methods/summary_v2/) instead. */ responseTTL( query?: SummaryResponseTTLParams, @@ -338,13 +304,44 @@ export namespace SummaryCacheHitResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -447,13 +444,44 @@ export namespace SummaryDNSSECResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -566,13 +594,44 @@ export namespace SummaryDNSSECAwareResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -675,13 +734,44 @@ export namespace SummaryDNSSECE2EResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -784,13 +874,44 @@ export namespace SummaryIPVersionResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -893,13 +1014,44 @@ export namespace SummaryMatchingAnswerResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -1002,13 +1154,44 @@ export namespace SummaryProtocolResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -1121,13 +1304,44 @@ export namespace SummaryQueryTypeResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -1218,13 +1432,44 @@ export namespace SummaryResponseCodeResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -1315,13 +1560,44 @@ export namespace SummaryResponseTTLResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -1444,17 +1720,17 @@ export interface SummaryCacheHitParams { /** * Specifies whether the response includes empty DNS responses (NODATA). */ - nodata?: boolean; + nodata?: Array; /** * Filters results by DNS transport protocol. */ - protocol?: 'UDP' | 'TCP' | 'HTTPS' | 'TLS'; + protocol?: Array<'UDP' | 'TCP' | 'HTTPS' | 'TLS'>; /** * Filters results by DNS query type. */ - queryType?: + queryType?: Array< | 'A' | 'AAAA' | 'A6' @@ -1543,12 +1819,13 @@ export interface SummaryCacheHitParams { | 'WKS' | 'X25' | 'ZONEMD' - | null; + | null + >; /** * Filters results by DNS response code. */ - responseCode?: + responseCode?: Array< | 'NOERROR' | 'FORMERR' | 'SERVFAIL' @@ -1567,10 +1844,11 @@ export interface SummaryCacheHitParams { | 'BADNAME' | 'BADALG' | 'BADTRUNC' - | 'BADCOOKIE'; + | 'BADCOOKIE' + >; /** - * Filters results by country code top-level domain (ccTLD). + * Filters results by top-level domain. */ tld?: Array; } @@ -1628,17 +1906,17 @@ export interface SummaryDNSSECParams { /** * Specifies whether the response includes empty DNS responses (NODATA). */ - nodata?: boolean; + nodata?: Array; /** * Filters results by DNS transport protocol. */ - protocol?: 'UDP' | 'TCP' | 'HTTPS' | 'TLS'; + protocol?: Array<'UDP' | 'TCP' | 'HTTPS' | 'TLS'>; /** * Filters results by DNS query type. */ - queryType?: + queryType?: Array< | 'A' | 'AAAA' | 'A6' @@ -1727,12 +2005,13 @@ export interface SummaryDNSSECParams { | 'WKS' | 'X25' | 'ZONEMD' - | null; + | null + >; /** * Filters results by DNS response code. */ - responseCode?: + responseCode?: Array< | 'NOERROR' | 'FORMERR' | 'SERVFAIL' @@ -1751,10 +2030,11 @@ export interface SummaryDNSSECParams { | 'BADNAME' | 'BADALG' | 'BADTRUNC' - | 'BADCOOKIE'; + | 'BADCOOKIE' + >; /** - * Filters results by country code top-level domain (ccTLD). + * Filters results by top-level domain. */ tld?: Array; } @@ -1812,17 +2092,17 @@ export interface SummaryDNSSECAwareParams { /** * Specifies whether the response includes empty DNS responses (NODATA). */ - nodata?: boolean; + nodata?: Array; /** * Filters results by DNS transport protocol. */ - protocol?: 'UDP' | 'TCP' | 'HTTPS' | 'TLS'; + protocol?: Array<'UDP' | 'TCP' | 'HTTPS' | 'TLS'>; /** * Filters results by DNS query type. */ - queryType?: + queryType?: Array< | 'A' | 'AAAA' | 'A6' @@ -1911,12 +2191,13 @@ export interface SummaryDNSSECAwareParams { | 'WKS' | 'X25' | 'ZONEMD' - | null; + | null + >; /** * Filters results by DNS response code. */ - responseCode?: + responseCode?: Array< | 'NOERROR' | 'FORMERR' | 'SERVFAIL' @@ -1935,10 +2216,11 @@ export interface SummaryDNSSECAwareParams { | 'BADNAME' | 'BADALG' | 'BADTRUNC' - | 'BADCOOKIE'; + | 'BADCOOKIE' + >; /** - * Filters results by country code top-level domain (ccTLD). + * Filters results by top-level domain. */ tld?: Array; } @@ -1996,17 +2278,17 @@ export interface SummaryDNSSECE2EParams { /** * Specifies whether the response includes empty DNS responses (NODATA). */ - nodata?: boolean; + nodata?: Array; /** * Filters results by DNS transport protocol. */ - protocol?: 'UDP' | 'TCP' | 'HTTPS' | 'TLS'; + protocol?: Array<'UDP' | 'TCP' | 'HTTPS' | 'TLS'>; /** * Filters results by DNS query type. */ - queryType?: + queryType?: Array< | 'A' | 'AAAA' | 'A6' @@ -2095,12 +2377,13 @@ export interface SummaryDNSSECE2EParams { | 'WKS' | 'X25' | 'ZONEMD' - | null; + | null + >; /** * Filters results by DNS response code. */ - responseCode?: + responseCode?: Array< | 'NOERROR' | 'FORMERR' | 'SERVFAIL' @@ -2119,10 +2402,11 @@ export interface SummaryDNSSECE2EParams { | 'BADNAME' | 'BADALG' | 'BADTRUNC' - | 'BADCOOKIE'; + | 'BADCOOKIE' + >; /** - * Filters results by country code top-level domain (ccTLD). + * Filters results by top-level domain. */ tld?: Array; } @@ -2180,17 +2464,17 @@ export interface SummaryIPVersionParams { /** * Specifies whether the response includes empty DNS responses (NODATA). */ - nodata?: boolean; + nodata?: Array; /** * Filters results by DNS transport protocol. */ - protocol?: 'UDP' | 'TCP' | 'HTTPS' | 'TLS'; + protocol?: Array<'UDP' | 'TCP' | 'HTTPS' | 'TLS'>; /** * Filters results by DNS query type. */ - queryType?: + queryType?: Array< | 'A' | 'AAAA' | 'A6' @@ -2279,12 +2563,13 @@ export interface SummaryIPVersionParams { | 'WKS' | 'X25' | 'ZONEMD' - | null; + | null + >; /** * Filters results by DNS response code. */ - responseCode?: + responseCode?: Array< | 'NOERROR' | 'FORMERR' | 'SERVFAIL' @@ -2303,10 +2588,11 @@ export interface SummaryIPVersionParams { | 'BADNAME' | 'BADALG' | 'BADTRUNC' - | 'BADCOOKIE'; + | 'BADCOOKIE' + >; /** - * Filters results by country code top-level domain (ccTLD). + * Filters results by top-level domain. */ tld?: Array; } @@ -2364,17 +2650,17 @@ export interface SummaryMatchingAnswerParams { /** * Specifies whether the response includes empty DNS responses (NODATA). */ - nodata?: boolean; + nodata?: Array; /** * Filters results by DNS transport protocol. */ - protocol?: 'UDP' | 'TCP' | 'HTTPS' | 'TLS'; + protocol?: Array<'UDP' | 'TCP' | 'HTTPS' | 'TLS'>; /** * Filters results by DNS query type. */ - queryType?: + queryType?: Array< | 'A' | 'AAAA' | 'A6' @@ -2463,12 +2749,13 @@ export interface SummaryMatchingAnswerParams { | 'WKS' | 'X25' | 'ZONEMD' - | null; + | null + >; /** * Filters results by DNS response code. */ - responseCode?: + responseCode?: Array< | 'NOERROR' | 'FORMERR' | 'SERVFAIL' @@ -2487,10 +2774,11 @@ export interface SummaryMatchingAnswerParams { | 'BADNAME' | 'BADALG' | 'BADTRUNC' - | 'BADCOOKIE'; + | 'BADCOOKIE' + >; /** - * Filters results by country code top-level domain (ccTLD). + * Filters results by top-level domain. */ tld?: Array; } @@ -2548,12 +2836,12 @@ export interface SummaryProtocolParams { /** * Specifies whether the response includes empty DNS responses (NODATA). */ - nodata?: boolean; + nodata?: Array; /** * Filters results by DNS query type. */ - queryType?: + queryType?: Array< | 'A' | 'AAAA' | 'A6' @@ -2642,12 +2930,13 @@ export interface SummaryProtocolParams { | 'WKS' | 'X25' | 'ZONEMD' - | null; + | null + >; /** * Filters results by DNS response code. */ - responseCode?: + responseCode?: Array< | 'NOERROR' | 'FORMERR' | 'SERVFAIL' @@ -2666,10 +2955,11 @@ export interface SummaryProtocolParams { | 'BADNAME' | 'BADALG' | 'BADTRUNC' - | 'BADCOOKIE'; + | 'BADCOOKIE' + >; /** - * Filters results by country code top-level domain (ccTLD). + * Filters results by top-level domain. */ tld?: Array; } @@ -2734,17 +3024,17 @@ export interface SummaryQueryTypeParams { /** * Specifies whether the response includes empty DNS responses (NODATA). */ - nodata?: boolean; + nodata?: Array; /** * Filters results by DNS transport protocol. */ - protocol?: 'UDP' | 'TCP' | 'HTTPS' | 'TLS'; + protocol?: Array<'UDP' | 'TCP' | 'HTTPS' | 'TLS'>; /** * Filters results by DNS response code. */ - responseCode?: + responseCode?: Array< | 'NOERROR' | 'FORMERR' | 'SERVFAIL' @@ -2763,10 +3053,11 @@ export interface SummaryQueryTypeParams { | 'BADNAME' | 'BADALG' | 'BADTRUNC' - | 'BADCOOKIE'; + | 'BADCOOKIE' + >; /** - * Filters results by country code top-level domain (ccTLD). + * Filters results by top-level domain. */ tld?: Array; } @@ -2831,17 +3122,17 @@ export interface SummaryResponseCodeParams { /** * Specifies whether the response includes empty DNS responses (NODATA). */ - nodata?: boolean; + nodata?: Array; /** * Filters results by DNS transport protocol. */ - protocol?: 'UDP' | 'TCP' | 'HTTPS' | 'TLS'; + protocol?: Array<'UDP' | 'TCP' | 'HTTPS' | 'TLS'>; /** * Filters results by DNS query type. */ - queryType?: + queryType?: Array< | 'A' | 'AAAA' | 'A6' @@ -2930,10 +3221,11 @@ export interface SummaryResponseCodeParams { | 'WKS' | 'X25' | 'ZONEMD' - | null; + | null + >; /** - * Filters results by country code top-level domain (ccTLD). + * Filters results by top-level domain. */ tld?: Array; } @@ -2991,17 +3283,17 @@ export interface SummaryResponseTTLParams { /** * Specifies whether the response includes empty DNS responses (NODATA). */ - nodata?: boolean; + nodata?: Array; /** * Filters results by DNS transport protocol. */ - protocol?: 'UDP' | 'TCP' | 'HTTPS' | 'TLS'; + protocol?: Array<'UDP' | 'TCP' | 'HTTPS' | 'TLS'>; /** * Filters results by DNS query type. */ - queryType?: + queryType?: Array< | 'A' | 'AAAA' | 'A6' @@ -3090,12 +3382,13 @@ export interface SummaryResponseTTLParams { | 'WKS' | 'X25' | 'ZONEMD' - | null; + | null + >; /** * Filters results by DNS response code. */ - responseCode?: + responseCode?: Array< | 'NOERROR' | 'FORMERR' | 'SERVFAIL' @@ -3114,10 +3407,11 @@ export interface SummaryResponseTTLParams { | 'BADNAME' | 'BADALG' | 'BADTRUNC' - | 'BADCOOKIE'; + | 'BADCOOKIE' + >; /** - * Filters results by country code top-level domain (ccTLD). + * Filters results by top-level domain. */ tld?: Array; } diff --git a/src/resources/radar/dns/timeseries-groups.ts b/src/resources/radar/dns/timeseries-groups.ts index 9a242a93fb..af767175f7 100644 --- a/src/resources/radar/dns/timeseries-groups.ts +++ b/src/resources/radar/dns/timeseries-groups.ts @@ -8,11 +8,7 @@ export class TimeseriesGroups extends APIResource { /** * Retrieves the distribution of DNS queries by cache status over time. * - * @example - * ```ts - * const response = - * await client.radar.dns.timeseriesGroups.cacheHit(); - * ``` + * @deprecated Use [Radar DNS Timeseries Groups By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/dns/methods/timeseries_groups_v2/) instead. */ cacheHit( query?: TimeseriesGroupCacheHitParams, @@ -37,11 +33,7 @@ export class TimeseriesGroups extends APIResource { * Retrieves the distribution of DNS responses by DNSSEC (DNS Security Extensions) * support over time. * - * @example - * ```ts - * const response = - * await client.radar.dns.timeseriesGroups.dnssec(); - * ``` + * @deprecated Use [Radar DNS Timeseries Groups By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/dns/methods/timeseries_groups_v2/) instead. */ dnssec( query?: TimeseriesGroupDNSSECParams, @@ -66,11 +58,7 @@ export class TimeseriesGroups extends APIResource { * Retrieves the distribution of DNS queries by DNSSEC (DNS Security Extensions) * client awareness over time. * - * @example - * ```ts - * const response = - * await client.radar.dns.timeseriesGroups.dnssecAware(); - * ``` + * @deprecated Use [Radar DNS Timeseries Groups By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/dns/methods/timeseries_groups_v2/) instead. */ dnssecAware( query?: TimeseriesGroupDNSSECAwareParams, @@ -96,11 +84,7 @@ export class TimeseriesGroups extends APIResource { * Retrieves the distribution of DNSSEC-validated answers by end-to-end security * status over time. * - * @example - * ```ts - * const response = - * await client.radar.dns.timeseriesGroups.dnssecE2E(); - * ``` + * @deprecated Use [Radar DNS Timeseries Groups By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/dns/methods/timeseries_groups_v2/) instead. */ dnssecE2E( query?: TimeseriesGroupDNSSECE2EParams, @@ -124,11 +108,7 @@ export class TimeseriesGroups extends APIResource { /** * Retrieves the distribution of DNS queries by IP version over time. * - * @example - * ```ts - * const response = - * await client.radar.dns.timeseriesGroups.ipVersion(); - * ``` + * @deprecated Use [Radar DNS Timeseries Groups By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/dns/methods/timeseries_groups_v2/) instead. */ ipVersion( query?: TimeseriesGroupIPVersionParams, @@ -152,11 +132,7 @@ export class TimeseriesGroups extends APIResource { /** * Retrieves the distribution of DNS queries by matching answers over time. * - * @example - * ```ts - * const response = - * await client.radar.dns.timeseriesGroups.matchingAnswer(); - * ``` + * @deprecated Use [Radar DNS Timeseries Groups By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/dns/methods/timeseries_groups_v2/) instead. */ matchingAnswer( query?: TimeseriesGroupMatchingAnswerParams, @@ -181,11 +157,7 @@ export class TimeseriesGroups extends APIResource { /** * Retrieves the distribution of DNS queries by DNS transport protocol over time. * - * @example - * ```ts - * const response = - * await client.radar.dns.timeseriesGroups.protocol(); - * ``` + * @deprecated Use [Radar DNS Timeseries Groups By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/dns/methods/timeseries_groups_v2/) instead. */ protocol( query?: TimeseriesGroupProtocolParams, @@ -209,11 +181,7 @@ export class TimeseriesGroups extends APIResource { /** * Retrieves the distribution of DNS queries by type over time. * - * @example - * ```ts - * const response = - * await client.radar.dns.timeseriesGroups.queryType(); - * ``` + * @deprecated Use [Radar DNS Timeseries Groups By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/dns/methods/timeseries_groups_v2/) instead. */ queryType( query?: TimeseriesGroupQueryTypeParams, @@ -237,11 +205,7 @@ export class TimeseriesGroups extends APIResource { /** * Retrieves the distribution of DNS queries by response code over time. * - * @example - * ```ts - * const response = - * await client.radar.dns.timeseriesGroups.responseCode(); - * ``` + * @deprecated Use [Radar DNS Timeseries Groups By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/dns/methods/timeseries_groups_v2/) instead. */ responseCode( query?: TimeseriesGroupResponseCodeParams, @@ -266,11 +230,7 @@ export class TimeseriesGroups extends APIResource { /** * Retrieves the distribution of DNS queries by minimum answer TTL over time. * - * @example - * ```ts - * const response = - * await client.radar.dns.timeseriesGroups.responseTTL(); - * ``` + * @deprecated Use [Radar DNS Timeseries Groups By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/dns/methods/timeseries_groups_v2/) instead. */ responseTTL( query?: TimeseriesGroupResponseTTLParams, @@ -358,13 +318,44 @@ export namespace TimeseriesGroupCacheHitResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -468,13 +459,44 @@ export namespace TimeseriesGroupDNSSECResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -582,13 +604,44 @@ export namespace TimeseriesGroupDNSSECAwareResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -692,13 +745,44 @@ export namespace TimeseriesGroupDNSSECE2EResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -802,13 +886,44 @@ export namespace TimeseriesGroupIPVersionResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -912,13 +1027,44 @@ export namespace TimeseriesGroupMatchingAnswerResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -1022,13 +1168,44 @@ export namespace TimeseriesGroupProtocolResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -1136,13 +1313,44 @@ export namespace TimeseriesGroupQueryTypeResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -1246,13 +1454,44 @@ export namespace TimeseriesGroupResponseCodeResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -1356,13 +1595,44 @@ export namespace TimeseriesGroupResponseTTLResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -1471,17 +1741,17 @@ export interface TimeseriesGroupCacheHitParams { /** * Specifies whether the response includes empty DNS responses (NODATA). */ - nodata?: boolean; + nodata?: Array; /** * Filters results by DNS transport protocol. */ - protocol?: 'UDP' | 'TCP' | 'HTTPS' | 'TLS'; + protocol?: Array<'UDP' | 'TCP' | 'HTTPS' | 'TLS'>; /** * Filters results by DNS query type. */ - queryType?: + queryType?: Array< | 'A' | 'AAAA' | 'A6' @@ -1570,12 +1840,13 @@ export interface TimeseriesGroupCacheHitParams { | 'WKS' | 'X25' | 'ZONEMD' - | null; + | null + >; /** * Filters results by DNS response code. */ - responseCode?: + responseCode?: Array< | 'NOERROR' | 'FORMERR' | 'SERVFAIL' @@ -1594,10 +1865,11 @@ export interface TimeseriesGroupCacheHitParams { | 'BADNAME' | 'BADALG' | 'BADTRUNC' - | 'BADCOOKIE'; + | 'BADCOOKIE' + >; /** - * Filters results by country code top-level domain (ccTLD). + * Filters results by top-level domain. */ tld?: Array; } @@ -1662,17 +1934,17 @@ export interface TimeseriesGroupDNSSECParams { /** * Specifies whether the response includes empty DNS responses (NODATA). */ - nodata?: boolean; + nodata?: Array; /** * Filters results by DNS transport protocol. */ - protocol?: 'UDP' | 'TCP' | 'HTTPS' | 'TLS'; + protocol?: Array<'UDP' | 'TCP' | 'HTTPS' | 'TLS'>; /** * Filters results by DNS query type. */ - queryType?: + queryType?: Array< | 'A' | 'AAAA' | 'A6' @@ -1761,12 +2033,13 @@ export interface TimeseriesGroupDNSSECParams { | 'WKS' | 'X25' | 'ZONEMD' - | null; + | null + >; /** * Filters results by DNS response code. */ - responseCode?: + responseCode?: Array< | 'NOERROR' | 'FORMERR' | 'SERVFAIL' @@ -1785,10 +2058,11 @@ export interface TimeseriesGroupDNSSECParams { | 'BADNAME' | 'BADALG' | 'BADTRUNC' - | 'BADCOOKIE'; + | 'BADCOOKIE' + >; /** - * Filters results by country code top-level domain (ccTLD). + * Filters results by top-level domain. */ tld?: Array; } @@ -1853,17 +2127,17 @@ export interface TimeseriesGroupDNSSECAwareParams { /** * Specifies whether the response includes empty DNS responses (NODATA). */ - nodata?: boolean; + nodata?: Array; /** * Filters results by DNS transport protocol. */ - protocol?: 'UDP' | 'TCP' | 'HTTPS' | 'TLS'; + protocol?: Array<'UDP' | 'TCP' | 'HTTPS' | 'TLS'>; /** * Filters results by DNS query type. */ - queryType?: + queryType?: Array< | 'A' | 'AAAA' | 'A6' @@ -1952,12 +2226,13 @@ export interface TimeseriesGroupDNSSECAwareParams { | 'WKS' | 'X25' | 'ZONEMD' - | null; + | null + >; /** * Filters results by DNS response code. */ - responseCode?: + responseCode?: Array< | 'NOERROR' | 'FORMERR' | 'SERVFAIL' @@ -1976,10 +2251,11 @@ export interface TimeseriesGroupDNSSECAwareParams { | 'BADNAME' | 'BADALG' | 'BADTRUNC' - | 'BADCOOKIE'; + | 'BADCOOKIE' + >; /** - * Filters results by country code top-level domain (ccTLD). + * Filters results by top-level domain. */ tld?: Array; } @@ -2044,17 +2320,17 @@ export interface TimeseriesGroupDNSSECE2EParams { /** * Specifies whether the response includes empty DNS responses (NODATA). */ - nodata?: boolean; + nodata?: Array; /** * Filters results by DNS transport protocol. */ - protocol?: 'UDP' | 'TCP' | 'HTTPS' | 'TLS'; + protocol?: Array<'UDP' | 'TCP' | 'HTTPS' | 'TLS'>; /** * Filters results by DNS query type. */ - queryType?: + queryType?: Array< | 'A' | 'AAAA' | 'A6' @@ -2143,12 +2419,13 @@ export interface TimeseriesGroupDNSSECE2EParams { | 'WKS' | 'X25' | 'ZONEMD' - | null; + | null + >; /** * Filters results by DNS response code. */ - responseCode?: + responseCode?: Array< | 'NOERROR' | 'FORMERR' | 'SERVFAIL' @@ -2167,10 +2444,11 @@ export interface TimeseriesGroupDNSSECE2EParams { | 'BADNAME' | 'BADALG' | 'BADTRUNC' - | 'BADCOOKIE'; + | 'BADCOOKIE' + >; /** - * Filters results by country code top-level domain (ccTLD). + * Filters results by top-level domain. */ tld?: Array; } @@ -2235,17 +2513,17 @@ export interface TimeseriesGroupIPVersionParams { /** * Specifies whether the response includes empty DNS responses (NODATA). */ - nodata?: boolean; + nodata?: Array; /** * Filters results by DNS transport protocol. */ - protocol?: 'UDP' | 'TCP' | 'HTTPS' | 'TLS'; + protocol?: Array<'UDP' | 'TCP' | 'HTTPS' | 'TLS'>; /** * Filters results by DNS query type. */ - queryType?: + queryType?: Array< | 'A' | 'AAAA' | 'A6' @@ -2334,12 +2612,13 @@ export interface TimeseriesGroupIPVersionParams { | 'WKS' | 'X25' | 'ZONEMD' - | null; + | null + >; /** * Filters results by DNS response code. */ - responseCode?: + responseCode?: Array< | 'NOERROR' | 'FORMERR' | 'SERVFAIL' @@ -2358,10 +2637,11 @@ export interface TimeseriesGroupIPVersionParams { | 'BADNAME' | 'BADALG' | 'BADTRUNC' - | 'BADCOOKIE'; + | 'BADCOOKIE' + >; /** - * Filters results by country code top-level domain (ccTLD). + * Filters results by top-level domain. */ tld?: Array; } @@ -2426,17 +2706,17 @@ export interface TimeseriesGroupMatchingAnswerParams { /** * Specifies whether the response includes empty DNS responses (NODATA). */ - nodata?: boolean; + nodata?: Array; /** * Filters results by DNS transport protocol. */ - protocol?: 'UDP' | 'TCP' | 'HTTPS' | 'TLS'; + protocol?: Array<'UDP' | 'TCP' | 'HTTPS' | 'TLS'>; /** * Filters results by DNS query type. */ - queryType?: + queryType?: Array< | 'A' | 'AAAA' | 'A6' @@ -2525,12 +2805,13 @@ export interface TimeseriesGroupMatchingAnswerParams { | 'WKS' | 'X25' | 'ZONEMD' - | null; + | null + >; /** * Filters results by DNS response code. */ - responseCode?: + responseCode?: Array< | 'NOERROR' | 'FORMERR' | 'SERVFAIL' @@ -2549,10 +2830,11 @@ export interface TimeseriesGroupMatchingAnswerParams { | 'BADNAME' | 'BADALG' | 'BADTRUNC' - | 'BADCOOKIE'; + | 'BADCOOKIE' + >; /** - * Filters results by country code top-level domain (ccTLD). + * Filters results by top-level domain. */ tld?: Array; } @@ -2617,12 +2899,12 @@ export interface TimeseriesGroupProtocolParams { /** * Specifies whether the response includes empty DNS responses (NODATA). */ - nodata?: boolean; + nodata?: Array; /** * Filters results by DNS query type. */ - queryType?: + queryType?: Array< | 'A' | 'AAAA' | 'A6' @@ -2711,12 +2993,13 @@ export interface TimeseriesGroupProtocolParams { | 'WKS' | 'X25' | 'ZONEMD' - | null; + | null + >; /** * Filters results by DNS response code. */ - responseCode?: + responseCode?: Array< | 'NOERROR' | 'FORMERR' | 'SERVFAIL' @@ -2735,10 +3018,11 @@ export interface TimeseriesGroupProtocolParams { | 'BADNAME' | 'BADALG' | 'BADTRUNC' - | 'BADCOOKIE'; + | 'BADCOOKIE' + >; /** - * Filters results by country code top-level domain (ccTLD). + * Filters results by top-level domain. */ tld?: Array; } @@ -2810,17 +3094,17 @@ export interface TimeseriesGroupQueryTypeParams { /** * Specifies whether the response includes empty DNS responses (NODATA). */ - nodata?: boolean; + nodata?: Array; /** * Filters results by DNS transport protocol. */ - protocol?: 'UDP' | 'TCP' | 'HTTPS' | 'TLS'; + protocol?: Array<'UDP' | 'TCP' | 'HTTPS' | 'TLS'>; /** * Filters results by DNS response code. */ - responseCode?: + responseCode?: Array< | 'NOERROR' | 'FORMERR' | 'SERVFAIL' @@ -2839,10 +3123,11 @@ export interface TimeseriesGroupQueryTypeParams { | 'BADNAME' | 'BADALG' | 'BADTRUNC' - | 'BADCOOKIE'; + | 'BADCOOKIE' + >; /** - * Filters results by country code top-level domain (ccTLD). + * Filters results by top-level domain. */ tld?: Array; } @@ -2914,17 +3199,17 @@ export interface TimeseriesGroupResponseCodeParams { /** * Specifies whether the response includes empty DNS responses (NODATA). */ - nodata?: boolean; + nodata?: Array; /** * Filters results by DNS transport protocol. */ - protocol?: 'UDP' | 'TCP' | 'HTTPS' | 'TLS'; + protocol?: Array<'UDP' | 'TCP' | 'HTTPS' | 'TLS'>; /** * Filters results by DNS query type. */ - queryType?: + queryType?: Array< | 'A' | 'AAAA' | 'A6' @@ -3013,10 +3298,11 @@ export interface TimeseriesGroupResponseCodeParams { | 'WKS' | 'X25' | 'ZONEMD' - | null; + | null + >; /** - * Filters results by country code top-level domain (ccTLD). + * Filters results by top-level domain. */ tld?: Array; } @@ -3081,17 +3367,17 @@ export interface TimeseriesGroupResponseTTLParams { /** * Specifies whether the response includes empty DNS responses (NODATA). */ - nodata?: boolean; + nodata?: Array; /** * Filters results by DNS transport protocol. */ - protocol?: 'UDP' | 'TCP' | 'HTTPS' | 'TLS'; + protocol?: Array<'UDP' | 'TCP' | 'HTTPS' | 'TLS'>; /** * Filters results by DNS query type. */ - queryType?: + queryType?: Array< | 'A' | 'AAAA' | 'A6' @@ -3180,12 +3466,13 @@ export interface TimeseriesGroupResponseTTLParams { | 'WKS' | 'X25' | 'ZONEMD' - | null; + | null + >; /** * Filters results by DNS response code. */ - responseCode?: + responseCode?: Array< | 'NOERROR' | 'FORMERR' | 'SERVFAIL' @@ -3204,10 +3491,11 @@ export interface TimeseriesGroupResponseTTLParams { | 'BADNAME' | 'BADALG' | 'BADTRUNC' - | 'BADCOOKIE'; + | 'BADCOOKIE' + >; /** - * Filters results by country code top-level domain (ccTLD). + * Filters results by top-level domain. */ tld?: Array; } diff --git a/src/resources/radar/dns/top.ts b/src/resources/radar/dns/top.ts index fe0bd763d1..4cce870620 100644 --- a/src/resources/radar/dns/top.ts +++ b/src/resources/radar/dns/top.ts @@ -113,13 +113,44 @@ export namespace TopAsesResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -221,13 +252,44 @@ export namespace TopLocationsResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -280,6 +342,11 @@ export interface TopAsesParams { */ asn?: Array; + /** + * Filters results based on cache status. + */ + cacheHit?: Array; + /** * Filters results by continent. Specify a comma-separated list of alpha-2 codes. * Prefix with `-` to exclude continents from results. For example, `-EU,NA` @@ -304,6 +371,21 @@ export interface TopAsesParams { */ dateStart?: Array; + /** + * Filters results based on DNSSEC (DNS Security Extensions) support. + */ + dnssec?: Array<'INVALID' | 'INSECURE' | 'SECURE' | 'OTHER'>; + + /** + * Filters results based on DNSSEC (DNS Security Extensions) client awareness. + */ + dnssecAware?: Array<'SUPPORTED' | 'NOT_SUPPORTED'>; + + /** + * Filters results based on DNSSEC-validated answers by end-to-end security status. + */ + dnssecE2e?: Array; + /** * Filters results by domain name. */ @@ -314,6 +396,11 @@ export interface TopAsesParams { */ format?: 'JSON' | 'CSV'; + /** + * Filters results by IP version (Ipv4 vs. IPv6). + */ + ipVersion?: Array<'IPv4' | 'IPv6'>; + /** * Limits the number of objects returned in the response. */ @@ -326,10 +413,152 @@ export interface TopAsesParams { */ location?: Array; + /** + * Filters results based on whether the queries have a matching answer. + */ + matchingAnswer?: Array; + /** * Array of names used to label the series in the response. */ name?: Array; + + /** + * Specifies whether the response includes empty DNS responses (NODATA). + */ + nodata?: Array; + + /** + * Filters results by DNS transport protocol. + */ + protocol?: Array<'UDP' | 'TCP' | 'HTTPS' | 'TLS'>; + + /** + * Filters results by DNS query type. + */ + queryType?: Array< + | 'A' + | 'AAAA' + | 'A6' + | 'AFSDB' + | 'ANY' + | 'APL' + | 'ATMA' + | 'AXFR' + | 'CAA' + | 'CDNSKEY' + | 'CDS' + | 'CERT' + | 'CNAME' + | 'CSYNC' + | 'DHCID' + | 'DLV' + | 'DNAME' + | 'DNSKEY' + | 'DOA' + | 'DS' + | 'EID' + | 'EUI48' + | 'EUI64' + | 'GPOS' + | 'GID' + | 'HINFO' + | 'HIP' + | 'HTTPS' + | 'IPSECKEY' + | 'ISDN' + | 'IXFR' + | 'KEY' + | 'KX' + | 'L32' + | 'L64' + | 'LOC' + | 'LP' + | 'MAILA' + | 'MAILB' + | 'MB' + | 'MD' + | 'MF' + | 'MG' + | 'MINFO' + | 'MR' + | 'MX' + | 'NAPTR' + | 'NB' + | 'NBSTAT' + | 'NID' + | 'NIMLOC' + | 'NINFO' + | 'NS' + | 'NSAP' + | 'NSEC' + | 'NSEC3' + | 'NSEC3PARAM' + | 'NULL' + | 'NXT' + | 'OPENPGPKEY' + | 'OPT' + | 'PTR' + | 'PX' + | 'RKEY' + | 'RP' + | 'RRSIG' + | 'RT' + | 'SIG' + | 'SINK' + | 'SMIMEA' + | 'SOA' + | 'SPF' + | 'SRV' + | 'SSHFP' + | 'SVCB' + | 'TA' + | 'TALINK' + | 'TKEY' + | 'TLSA' + | 'TSIG' + | 'TXT' + | 'UINFO' + | 'UID' + | 'UNSPEC' + | 'URI' + | 'WKS' + | 'X25' + | 'ZONEMD' + | null + >; + + /** + * Filters results by DNS response code. + */ + responseCode?: Array< + | 'NOERROR' + | 'FORMERR' + | 'SERVFAIL' + | 'NXDOMAIN' + | 'NOTIMP' + | 'REFUSED' + | 'YXDOMAIN' + | 'YXRRSET' + | 'NXRRSET' + | 'NOTAUTH' + | 'NOTZONE' + | 'BADSIG' + | 'BADKEY' + | 'BADTIME' + | 'BADMODE' + | 'BADNAME' + | 'BADALG' + | 'BADTRUNC' + | 'BADCOOKIE' + >; + + /** + * Filters results by DNS response TTL. + */ + responseTtl?: Array< + 'LTE_1M' | 'GT_1M_LTE_5M' | 'GT_5M_LTE_15M' | 'GT_15M_LTE_1H' | 'GT_1H_LTE_1D' | 'GT_1D_LTE_1W' | 'GT_1W' + >; } export interface TopLocationsParams { @@ -341,6 +570,11 @@ export interface TopLocationsParams { */ asn?: Array; + /** + * Filters results based on cache status. + */ + cacheHit?: Array; + /** * Filters results by continent. Specify a comma-separated list of alpha-2 codes. * Prefix with `-` to exclude continents from results. For example, `-EU,NA` @@ -365,6 +599,21 @@ export interface TopLocationsParams { */ dateStart?: Array; + /** + * Filters results based on DNSSEC (DNS Security Extensions) support. + */ + dnssec?: Array<'INVALID' | 'INSECURE' | 'SECURE' | 'OTHER'>; + + /** + * Filters results based on DNSSEC (DNS Security Extensions) client awareness. + */ + dnssecAware?: Array<'SUPPORTED' | 'NOT_SUPPORTED'>; + + /** + * Filters results based on DNSSEC-validated answers by end-to-end security status. + */ + dnssecE2e?: Array; + /** * Filters results by domain name. */ @@ -375,6 +624,11 @@ export interface TopLocationsParams { */ format?: 'JSON' | 'CSV'; + /** + * Filters results by IP version (Ipv4 vs. IPv6). + */ + ipVersion?: Array<'IPv4' | 'IPv6'>; + /** * Limits the number of objects returned in the response. */ @@ -387,10 +641,157 @@ export interface TopLocationsParams { */ location?: Array; + /** + * Filters results based on whether the queries have a matching answer. + */ + matchingAnswer?: Array; + /** * Array of names used to label the series in the response. */ name?: Array; + + /** + * Specifies whether the response includes empty DNS responses (NODATA). + */ + nodata?: Array; + + /** + * Filters results by DNS transport protocol. + */ + protocol?: Array<'UDP' | 'TCP' | 'HTTPS' | 'TLS'>; + + /** + * Filters results by DNS query type. + */ + queryType?: Array< + | 'A' + | 'AAAA' + | 'A6' + | 'AFSDB' + | 'ANY' + | 'APL' + | 'ATMA' + | 'AXFR' + | 'CAA' + | 'CDNSKEY' + | 'CDS' + | 'CERT' + | 'CNAME' + | 'CSYNC' + | 'DHCID' + | 'DLV' + | 'DNAME' + | 'DNSKEY' + | 'DOA' + | 'DS' + | 'EID' + | 'EUI48' + | 'EUI64' + | 'GPOS' + | 'GID' + | 'HINFO' + | 'HIP' + | 'HTTPS' + | 'IPSECKEY' + | 'ISDN' + | 'IXFR' + | 'KEY' + | 'KX' + | 'L32' + | 'L64' + | 'LOC' + | 'LP' + | 'MAILA' + | 'MAILB' + | 'MB' + | 'MD' + | 'MF' + | 'MG' + | 'MINFO' + | 'MR' + | 'MX' + | 'NAPTR' + | 'NB' + | 'NBSTAT' + | 'NID' + | 'NIMLOC' + | 'NINFO' + | 'NS' + | 'NSAP' + | 'NSEC' + | 'NSEC3' + | 'NSEC3PARAM' + | 'NULL' + | 'NXT' + | 'OPENPGPKEY' + | 'OPT' + | 'PTR' + | 'PX' + | 'RKEY' + | 'RP' + | 'RRSIG' + | 'RT' + | 'SIG' + | 'SINK' + | 'SMIMEA' + | 'SOA' + | 'SPF' + | 'SRV' + | 'SSHFP' + | 'SVCB' + | 'TA' + | 'TALINK' + | 'TKEY' + | 'TLSA' + | 'TSIG' + | 'TXT' + | 'UINFO' + | 'UID' + | 'UNSPEC' + | 'URI' + | 'WKS' + | 'X25' + | 'ZONEMD' + | null + >; + + /** + * Filters results by DNS response code. + */ + responseCode?: Array< + | 'NOERROR' + | 'FORMERR' + | 'SERVFAIL' + | 'NXDOMAIN' + | 'NOTIMP' + | 'REFUSED' + | 'YXDOMAIN' + | 'YXRRSET' + | 'NXRRSET' + | 'NOTAUTH' + | 'NOTZONE' + | 'BADSIG' + | 'BADKEY' + | 'BADTIME' + | 'BADMODE' + | 'BADNAME' + | 'BADALG' + | 'BADTRUNC' + | 'BADCOOKIE' + >; + + /** + * Filters results by DNS response TTL. + */ + responseTtl?: Array< + 'LTE_1M' | 'GT_1M_LTE_5M' | 'GT_5M_LTE_15M' | 'GT_15M_LTE_1H' | 'GT_1H_LTE_1D' | 'GT_1D_LTE_1W' | 'GT_1W' + >; + + /** + * Filters results by top-level domain. + */ + tld?: Array; } export declare namespace Top { diff --git a/src/resources/radar/email/email.ts b/src/resources/radar/email/email.ts index 460238da53..e490d29630 100644 --- a/src/resources/radar/email/email.ts +++ b/src/resources/radar/email/email.ts @@ -2,9 +2,21 @@ import { APIResource } from '../../../resource'; import * as RoutingAPI from './routing/routing'; -import { Routing } from './routing/routing'; +import { + Routing, + RoutingSummaryV2Params, + RoutingSummaryV2Response, + RoutingTimeseriesGroupsV2Params, + RoutingTimeseriesGroupsV2Response, +} from './routing/routing'; import * as SecurityAPI from './security/security'; -import { Security } from './security/security'; +import { + Security, + SecuritySummaryV2Params, + SecuritySummaryV2Response, + SecurityTimeseriesGroupsV2Params, + SecurityTimeseriesGroupsV2Response, +} from './security/security'; export class Email extends APIResource { routing: RoutingAPI.Routing = new RoutingAPI.Routing(this._client); @@ -42,7 +54,19 @@ Email.Security = Security; export declare namespace Email { export { type RadarEmailSeries as RadarEmailSeries, type RadarEmailSummary as RadarEmailSummary }; - export { Routing as Routing }; + export { + Routing as Routing, + type RoutingSummaryV2Response as RoutingSummaryV2Response, + type RoutingTimeseriesGroupsV2Response as RoutingTimeseriesGroupsV2Response, + type RoutingSummaryV2Params as RoutingSummaryV2Params, + type RoutingTimeseriesGroupsV2Params as RoutingTimeseriesGroupsV2Params, + }; - export { Security as Security }; + export { + Security as Security, + type SecuritySummaryV2Response as SecuritySummaryV2Response, + type SecurityTimeseriesGroupsV2Response as SecurityTimeseriesGroupsV2Response, + type SecuritySummaryV2Params as SecuritySummaryV2Params, + type SecurityTimeseriesGroupsV2Params as SecurityTimeseriesGroupsV2Params, + }; } diff --git a/src/resources/radar/email/index.ts b/src/resources/radar/email/index.ts index 0e113c2250..47de1d26d8 100644 --- a/src/resources/radar/email/index.ts +++ b/src/resources/radar/email/index.ts @@ -1,5 +1,17 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { Email, type RadarEmailSeries, type RadarEmailSummary } from './email'; -export { Routing } from './routing/index'; -export { Security } from './security/index'; +export { + Routing, + type RoutingSummaryV2Response, + type RoutingTimeseriesGroupsV2Response, + type RoutingSummaryV2Params, + type RoutingTimeseriesGroupsV2Params, +} from './routing/index'; +export { + Security, + type SecuritySummaryV2Response, + type SecurityTimeseriesGroupsV2Response, + type SecuritySummaryV2Params, + type SecurityTimeseriesGroupsV2Params, +} from './security/index'; diff --git a/src/resources/radar/email/routing/index.ts b/src/resources/radar/email/routing/index.ts index a7447f6d0f..4e2cf69ee7 100644 --- a/src/resources/radar/email/routing/index.ts +++ b/src/resources/radar/email/routing/index.ts @@ -1,6 +1,12 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { Routing } from './routing'; +export { + Routing, + type RoutingSummaryV2Response, + type RoutingTimeseriesGroupsV2Response, + type RoutingSummaryV2Params, + type RoutingTimeseriesGroupsV2Params, +} from './routing'; export { Summary, type SummaryARCResponse, diff --git a/src/resources/radar/email/routing/routing.ts b/src/resources/radar/email/routing/routing.ts index f4c5d68359..0930b37cd4 100644 --- a/src/resources/radar/email/routing/routing.ts +++ b/src/resources/radar/email/routing/routing.ts @@ -1,6 +1,8 @@ // 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 SummaryAPI from './summary'; import { Summary, @@ -39,12 +41,501 @@ export class Routing extends APIResource { timeseriesGroups: TimeseriesGroupsAPI.TimeseriesGroups = new TimeseriesGroupsAPI.TimeseriesGroups( this._client, ); + + /** + * Retrieves the distribution of email routing metrics by the specified dimension. + * + * @example + * ```ts + * const response = await client.radar.email.routing.summaryV2( + * 'IP_VERSION', + * ); + * ``` + */ + summaryV2( + dimension: 'IP_VERSION' | 'ENCRYPTED' | 'ARC' | 'DKIM' | 'DMARC' | 'SPF', + query?: RoutingSummaryV2Params, + options?: Core.RequestOptions, + ): Core.APIPromise; + summaryV2( + dimension: 'IP_VERSION' | 'ENCRYPTED' | 'ARC' | 'DKIM' | 'DMARC' | 'SPF', + options?: Core.RequestOptions, + ): Core.APIPromise; + summaryV2( + dimension: 'IP_VERSION' | 'ENCRYPTED' | 'ARC' | 'DKIM' | 'DMARC' | 'SPF', + query: RoutingSummaryV2Params | Core.RequestOptions = {}, + options?: Core.RequestOptions, + ): Core.APIPromise { + if (isRequestOptions(query)) { + return this.summaryV2(dimension, {}, query); + } + return ( + this._client.get(`/radar/email/routing/summary/${dimension}`, { + query, + ...options, + }) as Core.APIPromise<{ result: RoutingSummaryV2Response }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Retrieves the distribution of email routing metrics grouped by dimension over + * time. + * + * @example + * ```ts + * const response = + * await client.radar.email.routing.timeseriesGroupsV2( + * 'IP_VERSION', + * ); + * ``` + */ + timeseriesGroupsV2( + dimension: 'IP_VERSION' | 'ENCRYPTED' | 'ARC' | 'DKIM' | 'DMARC' | 'SPF', + query?: RoutingTimeseriesGroupsV2Params, + options?: Core.RequestOptions, + ): Core.APIPromise; + timeseriesGroupsV2( + dimension: 'IP_VERSION' | 'ENCRYPTED' | 'ARC' | 'DKIM' | 'DMARC' | 'SPF', + options?: Core.RequestOptions, + ): Core.APIPromise; + timeseriesGroupsV2( + dimension: 'IP_VERSION' | 'ENCRYPTED' | 'ARC' | 'DKIM' | 'DMARC' | 'SPF', + query: RoutingTimeseriesGroupsV2Params | Core.RequestOptions = {}, + options?: Core.RequestOptions, + ): Core.APIPromise { + if (isRequestOptions(query)) { + return this.timeseriesGroupsV2(dimension, {}, query); + } + return ( + this._client.get(`/radar/email/routing/timeseries_groups/${dimension}`, { + query, + ...options, + }) as Core.APIPromise<{ result: RoutingTimeseriesGroupsV2Response }> + )._thenUnwrap((obj) => obj.result); + } +} + +export interface RoutingSummaryV2Response { + /** + * Metadata for the results. + */ + meta: RoutingSummaryV2Response.Meta; + + summary_0: { [key: string]: string }; +} + +export namespace RoutingSummaryV2Response { + /** + * Metadata for the results. + */ + export interface Meta { + confidenceInfo: Meta.ConfidenceInfo; + + dateRange: Array; + + /** + * Timestamp of the last dataset update. + */ + lastUpdated: string; + + /** + * Normalization method applied to the results. Refer to + * [Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/). + */ + normalization: + | 'PERCENTAGE' + | 'MIN0_MAX' + | 'MIN_MAX' + | 'RAW_VALUES' + | 'PERCENTAGE_CHANGE' + | 'ROLLING_AVERAGE' + | 'OVERLAPPED_PERCENTAGE' + | 'RATIO'; + + /** + * Measurement units for the results. + */ + units: Array; + } + + export namespace Meta { + export interface ConfidenceInfo { + annotations: Array; + + /** + * Provides an indication of how much confidence Cloudflare has in the data. + */ + level: number; + } + + export namespace ConfidenceInfo { + /** + * Annotation associated with the result (e.g. outage or other type of event). + */ + export interface Annotation { + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; + + description: string; + + endDate: string; + + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; + + /** + * Whether event is a single point in time or a time range. + */ + isInstantaneous: boolean; + + linkedUrl: string; + + startDate: string; + } + } + + export interface DateRange { + /** + * Adjusted end of date range. + */ + endTime: string; + + /** + * Adjusted start of date range. + */ + startTime: string; + } + + export interface Unit { + name: string; + + value: string; + } + } +} + +export interface RoutingTimeseriesGroupsV2Response { + /** + * Metadata for the results. + */ + meta: RoutingTimeseriesGroupsV2Response.Meta; + + serie_0: RoutingTimeseriesGroupsV2Response.Serie0; +} + +export namespace RoutingTimeseriesGroupsV2Response { + /** + * Metadata for the results. + */ + export interface Meta { + /** + * Aggregation interval of the results (e.g., in 15 minutes or 1 hour intervals). + * Refer to + * [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + */ + aggInterval: 'FIFTEEN_MINUTES' | 'ONE_HOUR' | 'ONE_DAY' | 'ONE_WEEK' | 'ONE_MONTH'; + + confidenceInfo: Meta.ConfidenceInfo; + + dateRange: Array; + + /** + * Timestamp of the last dataset update. + */ + lastUpdated: string; + + /** + * Normalization method applied to the results. Refer to + * [Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/). + */ + normalization: + | 'PERCENTAGE' + | 'MIN0_MAX' + | 'MIN_MAX' + | 'RAW_VALUES' + | 'PERCENTAGE_CHANGE' + | 'ROLLING_AVERAGE' + | 'OVERLAPPED_PERCENTAGE' + | 'RATIO'; + + /** + * Measurement units for the results. + */ + units: Array; + } + + export namespace Meta { + export interface ConfidenceInfo { + annotations: Array; + + /** + * Provides an indication of how much confidence Cloudflare has in the data. + */ + level: number; + } + + export namespace ConfidenceInfo { + /** + * Annotation associated with the result (e.g. outage or other type of event). + */ + export interface Annotation { + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; + + description: string; + + endDate: string; + + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; + + /** + * Whether event is a single point in time or a time range. + */ + isInstantaneous: boolean; + + linkedUrl: string; + + startDate: string; + } + } + + export interface DateRange { + /** + * Adjusted end of date range. + */ + endTime: string; + + /** + * Adjusted start of date range. + */ + startTime: string; + } + + export interface Unit { + name: string; + + value: string; + } + } + + export interface Serie0 { + timestamps: Array; + + [k: string]: Array | Array | undefined; + } +} + +export interface RoutingSummaryV2Params { + /** + * Filters results by ARC (Authenticated Received Chain) validation. + */ + arc?: Array<'PASS' | 'NONE' | 'FAIL'>; + + /** + * End of the date range (inclusive). + */ + dateEnd?: Array; + + /** + * Filters results by date range. For example, use `7d` and `7dcontrol` to compare + * this week with the previous week. Use this parameter or set specific start and + * end dates (`dateStart` and `dateEnd` parameters). + */ + dateRange?: Array; + + /** + * Start of the date range. + */ + dateStart?: Array; + + /** + * Filters results by DKIM (DomainKeys Identified Mail) validation status. + */ + dkim?: Array<'PASS' | 'NONE' | 'FAIL'>; + + /** + * Filters results by DMARC (Domain-based Message Authentication, Reporting and + * Conformance) validation status. + */ + dmarc?: Array<'PASS' | 'NONE' | 'FAIL'>; + + /** + * Filters results by encryption status (encrypted vs. not-encrypted). + */ + encrypted?: Array<'ENCRYPTED' | 'NOT_ENCRYPTED'>; + + /** + * Format in which results will be returned. + */ + format?: 'JSON' | 'CSV'; + + /** + * Filters results by IP version (Ipv4 vs. IPv6). + */ + ipVersion?: Array<'IPv4' | 'IPv6'>; + + /** + * Limits the number of objects per group to the top items within the specified + * time range. When item count exceeds the limit, extra items appear grouped under + * an "other" category. + */ + limitPerGroup?: number; + + /** + * Array of names used to label the series in the response. + */ + name?: Array; + + /** + * Filters results by SPF (Sender Policy Framework) validation status. + */ + spf?: Array<'PASS' | 'NONE' | 'FAIL'>; +} + +export interface RoutingTimeseriesGroupsV2Params { + /** + * Aggregation interval of the results (e.g., in 15 minutes or 1 hour intervals). + * Refer to + * [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + */ + aggInterval?: '15m' | '1h' | '1d' | '1w'; + + /** + * Filters results by ARC (Authenticated Received Chain) validation. + */ + arc?: Array<'PASS' | 'NONE' | 'FAIL'>; + + /** + * End of the date range (inclusive). + */ + dateEnd?: Array; + + /** + * Filters results by date range. For example, use `7d` and `7dcontrol` to compare + * this week with the previous week. Use this parameter or set specific start and + * end dates (`dateStart` and `dateEnd` parameters). + */ + dateRange?: Array; + + /** + * Start of the date range. + */ + dateStart?: Array; + + /** + * Filters results by DKIM (DomainKeys Identified Mail) validation status. + */ + dkim?: Array<'PASS' | 'NONE' | 'FAIL'>; + + /** + * Filters results by DMARC (Domain-based Message Authentication, Reporting and + * Conformance) validation status. + */ + dmarc?: Array<'PASS' | 'NONE' | 'FAIL'>; + + /** + * Filters results by encryption status (encrypted vs. not-encrypted). + */ + encrypted?: Array<'ENCRYPTED' | 'NOT_ENCRYPTED'>; + + /** + * Format in which results will be returned. + */ + format?: 'JSON' | 'CSV'; + + /** + * Filters results by IP version (Ipv4 vs. IPv6). + */ + ipVersion?: Array<'IPv4' | 'IPv6'>; + + /** + * Limits the number of objects per group to the top items within the specified + * time range. When item count exceeds the limit, extra items appear grouped under + * an "other" category. + */ + limitPerGroup?: number; + + /** + * Array of names used to label the series in the response. + */ + name?: Array; + + /** + * Filters results by SPF (Sender Policy Framework) validation status. + */ + spf?: Array<'PASS' | 'NONE' | 'FAIL'>; } Routing.Summary = Summary; Routing.TimeseriesGroups = TimeseriesGroups; export declare namespace Routing { + export { + type RoutingSummaryV2Response as RoutingSummaryV2Response, + type RoutingTimeseriesGroupsV2Response as RoutingTimeseriesGroupsV2Response, + type RoutingSummaryV2Params as RoutingSummaryV2Params, + type RoutingTimeseriesGroupsV2Params as RoutingTimeseriesGroupsV2Params, + }; + export { Summary as Summary, type SummaryARCResponse as SummaryARCResponse, diff --git a/src/resources/radar/email/routing/summary.ts b/src/resources/radar/email/routing/summary.ts index 4085dc05e9..c2231dfa1d 100644 --- a/src/resources/radar/email/routing/summary.ts +++ b/src/resources/radar/email/routing/summary.ts @@ -10,11 +10,7 @@ export class Summary extends APIResource { * Retrieves the distribution of emails by ARC (Authenticated Received Chain) * validation. * - * @example - * ```ts - * const response = - * await client.radar.email.routing.summary.arc(); - * ``` + * @deprecated Use [Radar Email Routing Summary By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/email/subresources/routing/methods/summary_v2/) instead. */ arc(query?: SummaryARCParams, options?: Core.RequestOptions): Core.APIPromise; arc(options?: Core.RequestOptions): Core.APIPromise; @@ -36,11 +32,7 @@ export class Summary extends APIResource { * Retrieves the distribution of emails by DKIM (DomainKeys Identified Mail) * validation. * - * @example - * ```ts - * const response = - * await client.radar.email.routing.summary.dkim(); - * ``` + * @deprecated Use [Radar Email Routing Summary By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/email/subresources/routing/methods/summary_v2/) instead. */ dkim(query?: SummaryDKIMParams, options?: Core.RequestOptions): Core.APIPromise; dkim(options?: Core.RequestOptions): Core.APIPromise; @@ -62,11 +54,7 @@ export class Summary extends APIResource { * Retrieves the distribution of emails by DMARC (Domain-based Message * Authentication, Reporting and Conformance) validation. * - * @example - * ```ts - * const response = - * await client.radar.email.routing.summary.dmarc(); - * ``` + * @deprecated Use [Radar Email Routing Summary By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/email/subresources/routing/methods/summary_v2/) instead. */ dmarc(query?: SummaryDMARCParams, options?: Core.RequestOptions): Core.APIPromise; dmarc(options?: Core.RequestOptions): Core.APIPromise; @@ -88,11 +76,7 @@ export class Summary extends APIResource { * Retrieves the distribution of emails by encryption status (encrypted vs. * not-encrypted). * - * @example - * ```ts - * const response = - * await client.radar.email.routing.summary.encrypted(); - * ``` + * @deprecated Use [Radar Email Routing Summary By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/email/subresources/routing/methods/summary_v2/) instead. */ encrypted( query?: SummaryEncryptedParams, @@ -116,11 +100,7 @@ export class Summary extends APIResource { /** * Retrieves the distribution of emails by IP version. * - * @example - * ```ts - * const response = - * await client.radar.email.routing.summary.ipVersion(); - * ``` + * @deprecated Use [Radar Email Routing Summary By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/email/subresources/routing/methods/summary_v2/) instead. */ ipVersion( query?: SummaryIPVersionParams, @@ -145,11 +125,7 @@ export class Summary extends APIResource { * Retrieves the distribution of emails by SPF (Sender Policy Framework) * validation. * - * @example - * ```ts - * const response = - * await client.radar.email.routing.summary.spf(); - * ``` + * @deprecated Use [Radar Email Routing Summary By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/email/subresources/routing/methods/summary_v2/) instead. */ spf(query?: SummarySPFParams, options?: Core.RequestOptions): Core.APIPromise; spf(options?: Core.RequestOptions): Core.APIPromise; @@ -226,13 +202,44 @@ export namespace SummaryARCResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -323,13 +330,44 @@ export namespace SummaryDKIMResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -420,13 +458,44 @@ export namespace SummaryDMARCResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -517,13 +586,44 @@ export namespace SummaryEncryptedResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -626,13 +726,44 @@ export namespace SummaryIPVersionResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -735,13 +866,44 @@ export namespace SummarySPFResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. diff --git a/src/resources/radar/email/routing/timeseries-groups.ts b/src/resources/radar/email/routing/timeseries-groups.ts index c398945534..fb8eaf7ba4 100644 --- a/src/resources/radar/email/routing/timeseries-groups.ts +++ b/src/resources/radar/email/routing/timeseries-groups.ts @@ -10,11 +10,7 @@ export class TimeseriesGroups extends APIResource { * Retrieves the distribution of emails by ARC (Authenticated Received Chain) * validation over time. * - * @example - * ```ts - * const response = - * await client.radar.email.routing.timeseriesGroups.arc(); - * ``` + * @deprecated Use [Radar Email Routing Timeseries Groups By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/email/subresources/routing/methods/timeseries_groups_v2/) instead. */ arc( query?: TimeseriesGroupARCParams, @@ -40,11 +36,7 @@ export class TimeseriesGroups extends APIResource { * Retrieves the distribution of emails by DKIM (DomainKeys Identified Mail) * validation over time. * - * @example - * ```ts - * const response = - * await client.radar.email.routing.timeseriesGroups.dkim(); - * ``` + * @deprecated Use [Radar Email Routing Timeseries Groups By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/email/subresources/routing/methods/timeseries_groups_v2/) instead. */ dkim( query?: TimeseriesGroupDKIMParams, @@ -70,11 +62,7 @@ export class TimeseriesGroups extends APIResource { * Retrieves the distribution of emails by DMARC (Domain-based Message * Authentication, Reporting and Conformance) validation over time. * - * @example - * ```ts - * const response = - * await client.radar.email.routing.timeseriesGroups.dmarc(); - * ``` + * @deprecated Use [Radar Email Routing Timeseries Groups By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/email/subresources/routing/methods/timeseries_groups_v2/) instead. */ dmarc( query?: TimeseriesGroupDMARCParams, @@ -100,11 +88,7 @@ export class TimeseriesGroups extends APIResource { * Retrieves the distribution of emails by encryption status (encrypted vs. * not-encrypted) over time. * - * @example - * ```ts - * const response = - * await client.radar.email.routing.timeseriesGroups.encrypted(); - * ``` + * @deprecated Use [Radar Email Routing Timeseries Groups By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/email/subresources/routing/methods/timeseries_groups_v2/) instead. */ encrypted( query?: TimeseriesGroupEncryptedParams, @@ -129,11 +113,7 @@ export class TimeseriesGroups extends APIResource { /** * Retrieves the distribution of emails by IP version over time. * - * @example - * ```ts - * const response = - * await client.radar.email.routing.timeseriesGroups.ipVersion(); - * ``` + * @deprecated Use [Radar Email Routing Timeseries Groups By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/email/subresources/routing/methods/timeseries_groups_v2/) instead. */ ipVersion( query?: TimeseriesGroupIPVersionParams, @@ -159,11 +139,7 @@ export class TimeseriesGroups extends APIResource { * Retrieves the distribution of emails by SPF (Sender Policy Framework) validation * over time. * - * @example - * ```ts - * const response = - * await client.radar.email.routing.timeseriesGroups.spf(); - * ``` + * @deprecated Use [Radar Email Routing Timeseries Groups By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/email/subresources/routing/methods/timeseries_groups_v2/) instead. */ spf( query?: TimeseriesGroupSPFParams, @@ -251,13 +227,44 @@ export namespace TimeseriesGroupARCResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -355,13 +362,44 @@ export namespace TimeseriesGroupDKIMResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -459,13 +497,44 @@ export namespace TimeseriesGroupDMARCResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -563,13 +632,44 @@ export namespace TimeseriesGroupEncryptedResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -673,13 +773,44 @@ export namespace TimeseriesGroupIPVersionResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -783,13 +914,44 @@ export namespace TimeseriesGroupSPFResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. diff --git a/src/resources/radar/email/security/index.ts b/src/resources/radar/email/security/index.ts index b48f43fb39..01cfb4dade 100644 --- a/src/resources/radar/email/security/index.ts +++ b/src/resources/radar/email/security/index.ts @@ -1,6 +1,12 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { Security } from './security'; +export { + Security, + type SecuritySummaryV2Response, + type SecurityTimeseriesGroupsV2Response, + type SecuritySummaryV2Params, + type SecurityTimeseriesGroupsV2Params, +} from './security'; export { Summary, type SummaryARCResponse, diff --git a/src/resources/radar/email/security/security.ts b/src/resources/radar/email/security/security.ts index c1c1c5f337..3977760ddf 100644 --- a/src/resources/radar/email/security/security.ts +++ b/src/resources/radar/email/security/security.ts @@ -1,6 +1,8 @@ // 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 SummaryAPI from './summary'; import { Summary, @@ -54,6 +56,531 @@ export class Security extends APIResource { timeseriesGroups: TimeseriesGroupsAPI.TimeseriesGroups = new TimeseriesGroupsAPI.TimeseriesGroups( this._client, ); + + /** + * Retrieves the distribution of email security metrics by the specified dimension. + * + * @example + * ```ts + * const response = + * await client.radar.email.security.summaryV2('SPAM'); + * ``` + */ + summaryV2( + dimension: + | 'SPAM' + | 'MALICIOUS' + | 'SPOOF' + | 'THREAT_CATEGORY' + | 'ARC' + | 'DKIM' + | 'DMARC' + | 'SPF' + | 'TLS_VERSION', + query?: SecuritySummaryV2Params, + options?: Core.RequestOptions, + ): Core.APIPromise; + summaryV2( + dimension: + | 'SPAM' + | 'MALICIOUS' + | 'SPOOF' + | 'THREAT_CATEGORY' + | 'ARC' + | 'DKIM' + | 'DMARC' + | 'SPF' + | 'TLS_VERSION', + options?: Core.RequestOptions, + ): Core.APIPromise; + summaryV2( + dimension: + | 'SPAM' + | 'MALICIOUS' + | 'SPOOF' + | 'THREAT_CATEGORY' + | 'ARC' + | 'DKIM' + | 'DMARC' + | 'SPF' + | 'TLS_VERSION', + query: SecuritySummaryV2Params | Core.RequestOptions = {}, + options?: Core.RequestOptions, + ): Core.APIPromise { + if (isRequestOptions(query)) { + return this.summaryV2(dimension, {}, query); + } + return ( + this._client.get(`/radar/email/security/summary/${dimension}`, { + query, + ...options, + }) as Core.APIPromise<{ result: SecuritySummaryV2Response }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Retrieves the distribution of email security metrics grouped by dimension over + * time. + * + * @example + * ```ts + * const response = + * await client.radar.email.security.timeseriesGroupsV2( + * 'SPAM', + * ); + * ``` + */ + timeseriesGroupsV2( + dimension: + | 'SPAM' + | 'MALICIOUS' + | 'SPOOF' + | 'THREAT_CATEGORY' + | 'ARC' + | 'DKIM' + | 'DMARC' + | 'SPF' + | 'TLS_VERSION', + query?: SecurityTimeseriesGroupsV2Params, + options?: Core.RequestOptions, + ): Core.APIPromise; + timeseriesGroupsV2( + dimension: + | 'SPAM' + | 'MALICIOUS' + | 'SPOOF' + | 'THREAT_CATEGORY' + | 'ARC' + | 'DKIM' + | 'DMARC' + | 'SPF' + | 'TLS_VERSION', + options?: Core.RequestOptions, + ): Core.APIPromise; + timeseriesGroupsV2( + dimension: + | 'SPAM' + | 'MALICIOUS' + | 'SPOOF' + | 'THREAT_CATEGORY' + | 'ARC' + | 'DKIM' + | 'DMARC' + | 'SPF' + | 'TLS_VERSION', + query: SecurityTimeseriesGroupsV2Params | Core.RequestOptions = {}, + options?: Core.RequestOptions, + ): Core.APIPromise { + if (isRequestOptions(query)) { + return this.timeseriesGroupsV2(dimension, {}, query); + } + return ( + this._client.get(`/radar/email/security/timeseries_groups/${dimension}`, { + query, + ...options, + }) as Core.APIPromise<{ result: SecurityTimeseriesGroupsV2Response }> + )._thenUnwrap((obj) => obj.result); + } +} + +export interface SecuritySummaryV2Response { + /** + * Metadata for the results. + */ + meta: SecuritySummaryV2Response.Meta; + + summary_0: { [key: string]: string }; +} + +export namespace SecuritySummaryV2Response { + /** + * Metadata for the results. + */ + export interface Meta { + confidenceInfo: Meta.ConfidenceInfo; + + dateRange: Array; + + /** + * Timestamp of the last dataset update. + */ + lastUpdated: string; + + /** + * Normalization method applied to the results. Refer to + * [Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/). + */ + normalization: + | 'PERCENTAGE' + | 'MIN0_MAX' + | 'MIN_MAX' + | 'RAW_VALUES' + | 'PERCENTAGE_CHANGE' + | 'ROLLING_AVERAGE' + | 'OVERLAPPED_PERCENTAGE' + | 'RATIO'; + + /** + * Measurement units for the results. + */ + units: Array; + } + + export namespace Meta { + export interface ConfidenceInfo { + annotations: Array; + + /** + * Provides an indication of how much confidence Cloudflare has in the data. + */ + level: number; + } + + export namespace ConfidenceInfo { + /** + * Annotation associated with the result (e.g. outage or other type of event). + */ + export interface Annotation { + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; + + description: string; + + endDate: string; + + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; + + /** + * Whether event is a single point in time or a time range. + */ + isInstantaneous: boolean; + + linkedUrl: string; + + startDate: string; + } + } + + export interface DateRange { + /** + * Adjusted end of date range. + */ + endTime: string; + + /** + * Adjusted start of date range. + */ + startTime: string; + } + + export interface Unit { + name: string; + + value: string; + } + } +} + +export interface SecurityTimeseriesGroupsV2Response { + /** + * Metadata for the results. + */ + meta: SecurityTimeseriesGroupsV2Response.Meta; + + serie_0: SecurityTimeseriesGroupsV2Response.Serie0; +} + +export namespace SecurityTimeseriesGroupsV2Response { + /** + * Metadata for the results. + */ + export interface Meta { + /** + * Aggregation interval of the results (e.g., in 15 minutes or 1 hour intervals). + * Refer to + * [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + */ + aggInterval: 'FIFTEEN_MINUTES' | 'ONE_HOUR' | 'ONE_DAY' | 'ONE_WEEK' | 'ONE_MONTH'; + + confidenceInfo: Meta.ConfidenceInfo; + + dateRange: Array; + + /** + * Timestamp of the last dataset update. + */ + lastUpdated: string; + + /** + * Normalization method applied to the results. Refer to + * [Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/). + */ + normalization: + | 'PERCENTAGE' + | 'MIN0_MAX' + | 'MIN_MAX' + | 'RAW_VALUES' + | 'PERCENTAGE_CHANGE' + | 'ROLLING_AVERAGE' + | 'OVERLAPPED_PERCENTAGE' + | 'RATIO'; + + /** + * Measurement units for the results. + */ + units: Array; + } + + export namespace Meta { + export interface ConfidenceInfo { + annotations: Array; + + /** + * Provides an indication of how much confidence Cloudflare has in the data. + */ + level: number; + } + + export namespace ConfidenceInfo { + /** + * Annotation associated with the result (e.g. outage or other type of event). + */ + export interface Annotation { + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; + + description: string; + + endDate: string; + + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; + + /** + * Whether event is a single point in time or a time range. + */ + isInstantaneous: boolean; + + linkedUrl: string; + + startDate: string; + } + } + + export interface DateRange { + /** + * Adjusted end of date range. + */ + endTime: string; + + /** + * Adjusted start of date range. + */ + startTime: string; + } + + export interface Unit { + name: string; + + value: string; + } + } + + export interface Serie0 { + timestamps: Array; + + [k: string]: Array | Array | undefined; + } +} + +export interface SecuritySummaryV2Params { + /** + * Filters results by ARC (Authenticated Received Chain) validation. + */ + arc?: Array<'PASS' | 'NONE' | 'FAIL'>; + + /** + * End of the date range (inclusive). + */ + dateEnd?: Array; + + /** + * Filters results by date range. For example, use `7d` and `7dcontrol` to compare + * this week with the previous week. Use this parameter or set specific start and + * end dates (`dateStart` and `dateEnd` parameters). + */ + dateRange?: Array; + + /** + * Start of the date range. + */ + dateStart?: Array; + + /** + * Filters results by DKIM (DomainKeys Identified Mail) validation status. + */ + dkim?: Array<'PASS' | 'NONE' | 'FAIL'>; + + /** + * Filters results by DMARC (Domain-based Message Authentication, Reporting and + * Conformance) validation status. + */ + dmarc?: Array<'PASS' | 'NONE' | 'FAIL'>; + + /** + * Format in which results will be returned. + */ + format?: 'JSON' | 'CSV'; + + /** + * Limits the number of objects per group to the top items within the specified + * time range. When item count exceeds the limit, extra items appear grouped under + * an "other" category. + */ + limitPerGroup?: number; + + /** + * Array of names used to label the series in the response. + */ + name?: Array; + + /** + * Filters results by SPF (Sender Policy Framework) validation status. + */ + spf?: Array<'PASS' | 'NONE' | 'FAIL'>; + + /** + * Filters results by TLS version. + */ + tlsVersion?: Array<'TLSv1_0' | 'TLSv1_1' | 'TLSv1_2' | 'TLSv1_3'>; +} + +export interface SecurityTimeseriesGroupsV2Params { + /** + * Aggregation interval of the results (e.g., in 15 minutes or 1 hour intervals). + * Refer to + * [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + */ + aggInterval?: '15m' | '1h' | '1d' | '1w'; + + /** + * Filters results by ARC (Authenticated Received Chain) validation. + */ + arc?: Array<'PASS' | 'NONE' | 'FAIL'>; + + /** + * End of the date range (inclusive). + */ + dateEnd?: Array; + + /** + * Filters results by date range. For example, use `7d` and `7dcontrol` to compare + * this week with the previous week. Use this parameter or set specific start and + * end dates (`dateStart` and `dateEnd` parameters). + */ + dateRange?: Array; + + /** + * Start of the date range. + */ + dateStart?: Array; + + /** + * Filters results by DKIM (DomainKeys Identified Mail) validation status. + */ + dkim?: Array<'PASS' | 'NONE' | 'FAIL'>; + + /** + * Filters results by DMARC (Domain-based Message Authentication, Reporting and + * Conformance) validation status. + */ + dmarc?: Array<'PASS' | 'NONE' | 'FAIL'>; + + /** + * Format in which results will be returned. + */ + format?: 'JSON' | 'CSV'; + + /** + * Limits the number of objects per group to the top items within the specified + * time range. When item count exceeds the limit, extra items appear grouped under + * an "other" category. + */ + limitPerGroup?: number; + + /** + * Array of names used to label the series in the response. + */ + name?: Array; + + /** + * Filters results by SPF (Sender Policy Framework) validation status. + */ + spf?: Array<'PASS' | 'NONE' | 'FAIL'>; + + /** + * Filters results by TLS version. + */ + tlsVersion?: Array<'TLSv1_0' | 'TLSv1_1' | 'TLSv1_2' | 'TLSv1_3'>; } Security.Top = Top; @@ -61,6 +588,13 @@ Security.Summary = Summary; Security.TimeseriesGroups = TimeseriesGroups; export declare namespace Security { + export { + type SecuritySummaryV2Response as SecuritySummaryV2Response, + type SecurityTimeseriesGroupsV2Response as SecurityTimeseriesGroupsV2Response, + type SecuritySummaryV2Params as SecuritySummaryV2Params, + type SecurityTimeseriesGroupsV2Params as SecurityTimeseriesGroupsV2Params, + }; + export { Top as Top }; export { diff --git a/src/resources/radar/email/security/summary.ts b/src/resources/radar/email/security/summary.ts index 3a984c2f4f..7be8a83dda 100644 --- a/src/resources/radar/email/security/summary.ts +++ b/src/resources/radar/email/security/summary.ts @@ -10,11 +10,7 @@ export class Summary extends APIResource { * Retrieves the distribution of emails by ARC (Authenticated Received Chain) * validation. * - * @example - * ```ts - * const response = - * await client.radar.email.security.summary.arc(); - * ``` + * @deprecated Use [Radar Email Security Summary By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/email/subresources/security/methods/summary_v2/) instead. */ arc(query?: SummaryARCParams, options?: Core.RequestOptions): Core.APIPromise; arc(options?: Core.RequestOptions): Core.APIPromise; @@ -36,11 +32,7 @@ export class Summary extends APIResource { * Retrieves the distribution of emails by DKIM (DomainKeys Identified Mail) * validation. * - * @example - * ```ts - * const response = - * await client.radar.email.security.summary.dkim(); - * ``` + * @deprecated Use [Radar Email Security Summary By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/email/subresources/security/methods/summary_v2/) instead. */ dkim(query?: SummaryDKIMParams, options?: Core.RequestOptions): Core.APIPromise; dkim(options?: Core.RequestOptions): Core.APIPromise; @@ -62,11 +54,7 @@ export class Summary extends APIResource { * Retrieves the distribution of emails by DMARC (Domain-based Message * Authentication, Reporting and Conformance) validation. * - * @example - * ```ts - * const response = - * await client.radar.email.security.summary.dmarc(); - * ``` + * @deprecated Use [Radar Email Security Summary By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/email/subresources/security/methods/summary_v2/) instead. */ dmarc(query?: SummaryDMARCParams, options?: Core.RequestOptions): Core.APIPromise; dmarc(options?: Core.RequestOptions): Core.APIPromise; @@ -87,11 +75,7 @@ export class Summary extends APIResource { /** * Retrieves the distribution of emails by malicious classification. * - * @example - * ```ts - * const response = - * await client.radar.email.security.summary.malicious(); - * ``` + * @deprecated Use [Radar Email Security Summary By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/email/subresources/security/methods/summary_v2/) instead. */ malicious( query?: SummaryMaliciousParams, @@ -115,11 +99,7 @@ export class Summary extends APIResource { /** * Retrieves the proportion of emails by spam classification (spam vs. non-spam). * - * @example - * ```ts - * const response = - * await client.radar.email.security.summary.spam(); - * ``` + * @deprecated Use [Radar Email Security Summary By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/email/subresources/security/methods/summary_v2/) instead. */ spam(query?: SummarySpamParams, options?: Core.RequestOptions): Core.APIPromise; spam(options?: Core.RequestOptions): Core.APIPromise; @@ -141,11 +121,7 @@ export class Summary extends APIResource { * Retrieves the distribution of emails by SPF (Sender Policy Framework) * validation. * - * @example - * ```ts - * const response = - * await client.radar.email.security.summary.spf(); - * ``` + * @deprecated Use [Radar Email Security Summary By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/email/subresources/security/methods/summary_v2/) instead. */ spf(query?: SummarySPFParams, options?: Core.RequestOptions): Core.APIPromise; spf(options?: Core.RequestOptions): Core.APIPromise; @@ -167,11 +143,7 @@ export class Summary extends APIResource { * Retrieves the proportion of emails by spoof classification (spoof vs. * non-spoof). * - * @example - * ```ts - * const response = - * await client.radar.email.security.summary.spoof(); - * ``` + * @deprecated Use [Radar Email Security Summary By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/email/subresources/security/methods/summary_v2/) instead. */ spoof(query?: SummarySpoofParams, options?: Core.RequestOptions): Core.APIPromise; spoof(options?: Core.RequestOptions): Core.APIPromise; @@ -192,11 +164,7 @@ export class Summary extends APIResource { /** * Retrieves the distribution of emails by threat categories. * - * @example - * ```ts - * const response = - * await client.radar.email.security.summary.threatCategory(); - * ``` + * @deprecated Use [Radar Email Security Summary By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/email/subresources/security/methods/summary_v2/) instead. */ threatCategory( query?: SummaryThreatCategoryParams, @@ -221,11 +189,7 @@ export class Summary extends APIResource { /** * Retrieves the distribution of emails by TLS version. * - * @example - * ```ts - * const response = - * await client.radar.email.security.summary.tlsVersion(); - * ``` + * @deprecated Use [Radar Email Security Summary By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/email/subresources/security/methods/summary_v2/) instead. */ tlsVersion( query?: SummaryTLSVersionParams, @@ -306,13 +270,44 @@ export namespace SummaryARCResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -403,13 +398,44 @@ export namespace SummaryDKIMResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -500,13 +526,44 @@ export namespace SummaryDMARCResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -597,13 +654,44 @@ export namespace SummaryMaliciousResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -706,13 +794,44 @@ export namespace SummarySpamResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -815,13 +934,44 @@ export namespace SummarySPFResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -912,13 +1062,44 @@ export namespace SummarySpoofResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -1021,13 +1202,44 @@ export namespace SummaryThreatCategoryResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -1140,13 +1352,44 @@ export namespace SummaryTLSVersionResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. diff --git a/src/resources/radar/email/security/timeseries-groups.ts b/src/resources/radar/email/security/timeseries-groups.ts index 2fb9bbef99..a8cb4fdced 100644 --- a/src/resources/radar/email/security/timeseries-groups.ts +++ b/src/resources/radar/email/security/timeseries-groups.ts @@ -10,11 +10,7 @@ export class TimeseriesGroups extends APIResource { * Retrieves the distribution of emails by ARC (Authenticated Received Chain) * validation over time. * - * @example - * ```ts - * const response = - * await client.radar.email.security.timeseriesGroups.arc(); - * ``` + * @deprecated Use [Radar Email Security Timeseries Groups By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/email/subresources/security/methods/timeseries_groups_v2/) instead. */ arc( query?: TimeseriesGroupARCParams, @@ -40,11 +36,7 @@ export class TimeseriesGroups extends APIResource { * Retrieves the distribution of emails by DKIM (DomainKeys Identified Mail) * validation over time. * - * @example - * ```ts - * const response = - * await client.radar.email.security.timeseriesGroups.dkim(); - * ``` + * @deprecated Use [Radar Email Security Timeseries Groups By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/email/subresources/security/methods/timeseries_groups_v2/) instead. */ dkim( query?: TimeseriesGroupDKIMParams, @@ -70,11 +62,7 @@ export class TimeseriesGroups extends APIResource { * Retrieves the distribution of emails by DMARC (Domain-based Message * Authentication, Reporting and Conformance) validation over time. * - * @example - * ```ts - * const response = - * await client.radar.email.security.timeseriesGroups.dmarc(); - * ``` + * @deprecated Use [Radar Email Security Timeseries Groups By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/email/subresources/security/methods/timeseries_groups_v2/) instead. */ dmarc( query?: TimeseriesGroupDMARCParams, @@ -99,11 +87,7 @@ export class TimeseriesGroups extends APIResource { /** * Retrieves the distribution of emails by malicious classification over time. * - * @example - * ```ts - * const response = - * await client.radar.email.security.timeseriesGroups.malicious(); - * ``` + * @deprecated Use [Radar Email Security Timeseries Groups By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/email/subresources/security/methods/timeseries_groups_v2/) instead. */ malicious( query?: TimeseriesGroupMaliciousParams, @@ -129,11 +113,7 @@ export class TimeseriesGroups extends APIResource { * Retrieves the distribution of emails by spam classification (spam vs. non-spam) * over time. * - * @example - * ```ts - * const response = - * await client.radar.email.security.timeseriesGroups.spam(); - * ``` + * @deprecated Use [Radar Email Security Timeseries Groups By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/email/subresources/security/methods/timeseries_groups_v2/) instead. */ spam( query?: TimeseriesGroupSpamParams, @@ -159,11 +139,7 @@ export class TimeseriesGroups extends APIResource { * Retrieves the distribution of emails by SPF (Sender Policy Framework) validation * over time. * - * @example - * ```ts - * const response = - * await client.radar.email.security.timeseriesGroups.spf(); - * ``` + * @deprecated Use [Radar Email Security Timeseries Groups By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/email/subresources/security/methods/timeseries_groups_v2/) instead. */ spf( query?: TimeseriesGroupSPFParams, @@ -189,11 +165,7 @@ export class TimeseriesGroups extends APIResource { * Retrieves the distribution of emails by spoof classification (spoof vs. * non-spoof) over time. * - * @example - * ```ts - * const response = - * await client.radar.email.security.timeseriesGroups.spoof(); - * ``` + * @deprecated Use [Radar Email Security Timeseries Groups By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/email/subresources/security/methods/timeseries_groups_v2/) instead. */ spoof( query?: TimeseriesGroupSpoofParams, @@ -218,11 +190,7 @@ export class TimeseriesGroups extends APIResource { /** * Retrieves the distribution of emails by threat category over time. * - * @example - * ```ts - * const response = - * await client.radar.email.security.timeseriesGroups.threatCategory(); - * ``` + * @deprecated Use [Radar Email Security Timeseries Groups By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/email/subresources/security/methods/timeseries_groups_v2/) instead. */ threatCategory( query?: TimeseriesGroupThreatCategoryParams, @@ -247,11 +215,7 @@ export class TimeseriesGroups extends APIResource { /** * Retrieves the distribution of emails by TLS version over time. * - * @example - * ```ts - * const response = - * await client.radar.email.security.timeseriesGroups.tlsVersion(); - * ``` + * @deprecated Use [Radar Email Security Timeseries Groups By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/email/subresources/security/methods/timeseries_groups_v2/) instead. */ tlsVersion( query?: TimeseriesGroupTLSVersionParams, @@ -339,13 +303,44 @@ export namespace TimeseriesGroupARCResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -443,13 +438,44 @@ export namespace TimeseriesGroupDKIMResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -547,13 +573,44 @@ export namespace TimeseriesGroupDMARCResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -651,13 +708,44 @@ export namespace TimeseriesGroupMaliciousResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -761,13 +849,44 @@ export namespace TimeseriesGroupSpamResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -871,13 +990,44 @@ export namespace TimeseriesGroupSPFResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -975,13 +1125,44 @@ export namespace TimeseriesGroupSpoofResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -1085,13 +1266,44 @@ export namespace TimeseriesGroupThreatCategoryResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -1199,13 +1411,44 @@ export namespace TimeseriesGroupTLSVersionResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. diff --git a/src/resources/radar/email/security/top/tlds/malicious.ts b/src/resources/radar/email/security/top/tlds/malicious.ts index 2d8a739e42..34d882d463 100644 --- a/src/resources/radar/email/security/top/tlds/malicious.ts +++ b/src/resources/radar/email/security/top/tlds/malicious.ts @@ -100,13 +100,44 @@ export namespace MaliciousGetResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. diff --git a/src/resources/radar/email/security/top/tlds/spam.ts b/src/resources/radar/email/security/top/tlds/spam.ts index 8c60de4c6d..d6d51eb3d0 100644 --- a/src/resources/radar/email/security/top/tlds/spam.ts +++ b/src/resources/radar/email/security/top/tlds/spam.ts @@ -97,13 +97,44 @@ export namespace SpamGetResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. diff --git a/src/resources/radar/email/security/top/tlds/spoof.ts b/src/resources/radar/email/security/top/tlds/spoof.ts index e96ed6d815..ad854ee083 100644 --- a/src/resources/radar/email/security/top/tlds/spoof.ts +++ b/src/resources/radar/email/security/top/tlds/spoof.ts @@ -97,13 +97,44 @@ export namespace SpoofGetResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. diff --git a/src/resources/radar/email/security/top/tlds/tlds.ts b/src/resources/radar/email/security/top/tlds/tlds.ts index 7da3648e6f..369d0dcde0 100644 --- a/src/resources/radar/email/security/top/tlds/tlds.ts +++ b/src/resources/radar/email/security/top/tlds/tlds.ts @@ -99,13 +99,44 @@ export namespace TldGetResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. diff --git a/src/resources/radar/entities/asns.ts b/src/resources/radar/entities/asns.ts index 66ecf4a6e9..7697e9dd84 100644 --- a/src/resources/radar/entities/asns.ts +++ b/src/resources/radar/entities/asns.ts @@ -194,10 +194,20 @@ export namespace ASNAsSetResponse { */ name: string; + /** + * The AS number following hierarchical AS-SET name + */ + hierarchical_asn?: number; + /** * The inferred AS number of the AS-SET */ - asn?: number; + inferred_asn?: number; + + /** + * The AS number matching PeeringDB record + */ + peeringdb_asn?: number; } } diff --git a/src/resources/radar/geolocations.ts b/src/resources/radar/geolocations.ts new file mode 100644 index 0000000000..13ead450ff --- /dev/null +++ b/src/resources/radar/geolocations.ts @@ -0,0 +1,263 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../resource'; +import { isRequestOptions } from '../../core'; +import * as Core from '../../core'; + +export class Geolocations extends APIResource { + /** + * Retrieves a list of geolocations. + * + * @example + * ```ts + * const geolocations = await client.radar.geolocations.list(); + * ``` + */ + list( + query?: GeolocationListParams, + options?: Core.RequestOptions, + ): Core.APIPromise; + list(options?: Core.RequestOptions): Core.APIPromise; + list( + query: GeolocationListParams | Core.RequestOptions = {}, + options?: Core.RequestOptions, + ): Core.APIPromise { + if (isRequestOptions(query)) { + return this.list({}, query); + } + return ( + this._client.get('/radar/geolocations', { query, ...options }) as Core.APIPromise<{ + result: GeolocationListResponse; + }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Retrieves the requested Geolocation information. + * + * @example + * ```ts + * const geolocation = await client.radar.geolocations.get( + * '3190509', + * ); + * ``` + */ + get( + geoId: string, + query?: GeolocationGetParams, + options?: Core.RequestOptions, + ): Core.APIPromise; + get(geoId: string, options?: Core.RequestOptions): Core.APIPromise; + get( + geoId: string, + query: GeolocationGetParams | Core.RequestOptions = {}, + options?: Core.RequestOptions, + ): Core.APIPromise { + if (isRequestOptions(query)) { + return this.get(geoId, {}, query); + } + return ( + this._client.get(`/radar/geolocations/${geoId}`, { query, ...options }) as Core.APIPromise<{ + result: GeolocationGetResponse; + }> + )._thenUnwrap((obj) => obj.result); + } +} + +export interface GeolocationListResponse { + geolocations: Array; +} + +export namespace GeolocationListResponse { + export interface Geolocation { + geoId: string; + + /** + * A numeric string. + */ + latitude: string; + + /** + * A numeric string. + */ + longitude: string; + + name: string; + + parent: Geolocation.Parent; + + /** + * The type of the geolocation. + */ + type: 'CONTINENT' | 'COUNTRY' | 'ADM1'; + } + + export namespace Geolocation { + export interface Parent { + geoId: string; + + /** + * A numeric string. + */ + latitude: string; + + /** + * A numeric string. + */ + longitude: string; + + name: string; + + parent: Parent.Parent; + + /** + * The type of the geolocation. + */ + type: 'CONTINENT' | 'COUNTRY' | 'ADM1'; + } + + export namespace Parent { + export interface Parent { + geoId: string; + + /** + * A numeric string. + */ + latitude: string; + + /** + * A numeric string. + */ + longitude: string; + + name: string; + + /** + * The type of the geolocation. + */ + type: 'CONTINENT' | 'COUNTRY' | 'ADM1'; + } + } + } +} + +export interface GeolocationGetResponse { + geolocation: GeolocationGetResponse.Geolocation; +} + +export namespace GeolocationGetResponse { + export interface Geolocation { + geoId: string; + + /** + * A numeric string. + */ + latitude: string; + + /** + * A numeric string. + */ + longitude: string; + + name: string; + + parent: Geolocation.Parent; + + /** + * The type of the geolocation. + */ + type: 'CONTINENT' | 'COUNTRY' | 'ADM1'; + } + + export namespace Geolocation { + export interface Parent { + geoId: string; + + /** + * A numeric string. + */ + latitude: string; + + /** + * A numeric string. + */ + longitude: string; + + name: string; + + parent: Parent.Parent; + + /** + * The type of the geolocation. + */ + type: 'CONTINENT' | 'COUNTRY' | 'ADM1'; + } + + export namespace Parent { + export interface Parent { + geoId: string; + + /** + * A numeric string. + */ + latitude: string; + + /** + * A numeric string. + */ + longitude: string; + + name: string; + + /** + * The type of the geolocation. + */ + type: 'CONTINENT' | 'COUNTRY' | 'ADM1'; + } + } + } +} + +export interface GeolocationListParams { + /** + * Format in which results will be returned. + */ + format?: 'JSON' | 'CSV'; + + /** + * Filters results by geolocation. Specify a comma-separated list of GeoNames IDs. + */ + geoId?: string; + + /** + * Limits the number of objects returned in the response. + */ + limit?: number; + + /** + * Filters results by location. Specify a comma-separated list of alpha-2 location + * codes. + */ + location?: string; + + /** + * Skips the specified number of objects before fetching the results. + */ + offset?: number; +} + +export interface GeolocationGetParams { + /** + * Format in which results will be returned. + */ + format?: 'JSON' | 'CSV'; +} + +export declare namespace Geolocations { + export { + type GeolocationListResponse as GeolocationListResponse, + type GeolocationGetResponse as GeolocationGetResponse, + type GeolocationListParams as GeolocationListParams, + type GeolocationGetParams as GeolocationGetParams, + }; +} diff --git a/src/resources/radar/http/ases/ases.ts b/src/resources/radar/http/ases/ases.ts index 10694a020f..21e8de1b7c 100644 --- a/src/resources/radar/http/ases/ases.ts +++ b/src/resources/radar/http/ases/ases.ts @@ -113,13 +113,44 @@ export namespace AseGetResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. diff --git a/src/resources/radar/http/ases/bot-class.ts b/src/resources/radar/http/ases/bot-class.ts index 6445b6cd7a..74767c6ee1 100644 --- a/src/resources/radar/http/ases/bot-class.ts +++ b/src/resources/radar/http/ases/bot-class.ts @@ -100,13 +100,44 @@ export namespace BotClassGetResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. diff --git a/src/resources/radar/http/ases/browser-family.ts b/src/resources/radar/http/ases/browser-family.ts index 00de7696a5..da8661ab64 100644 --- a/src/resources/radar/http/ases/browser-family.ts +++ b/src/resources/radar/http/ases/browser-family.ts @@ -99,13 +99,44 @@ export namespace BrowserFamilyGetResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. diff --git a/src/resources/radar/http/ases/device-type.ts b/src/resources/radar/http/ases/device-type.ts index d2a867b1ce..6c7a3d6381 100644 --- a/src/resources/radar/http/ases/device-type.ts +++ b/src/resources/radar/http/ases/device-type.ts @@ -99,13 +99,44 @@ export namespace DeviceTypeGetResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. diff --git a/src/resources/radar/http/ases/http-method.ts b/src/resources/radar/http/ases/http-method.ts index fe83fa1fb4..8a9b1f9c78 100644 --- a/src/resources/radar/http/ases/http-method.ts +++ b/src/resources/radar/http/ases/http-method.ts @@ -99,13 +99,44 @@ export namespace HTTPMethodGetResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. diff --git a/src/resources/radar/http/ases/http-protocol.ts b/src/resources/radar/http/ases/http-protocol.ts index 590616cd92..9cc2c26d5f 100644 --- a/src/resources/radar/http/ases/http-protocol.ts +++ b/src/resources/radar/http/ases/http-protocol.ts @@ -99,13 +99,44 @@ export namespace HTTPProtocolGetResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. diff --git a/src/resources/radar/http/ases/ip-version.ts b/src/resources/radar/http/ases/ip-version.ts index 5b33784026..1dfa7c75bc 100644 --- a/src/resources/radar/http/ases/ip-version.ts +++ b/src/resources/radar/http/ases/ip-version.ts @@ -96,13 +96,44 @@ export namespace IPVersionGetResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. diff --git a/src/resources/radar/http/ases/os.ts b/src/resources/radar/http/ases/os.ts index f3f307fe57..e03fce40ad 100644 --- a/src/resources/radar/http/ases/os.ts +++ b/src/resources/radar/http/ases/os.ts @@ -97,13 +97,44 @@ export namespace OSGetResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. diff --git a/src/resources/radar/http/ases/tls-version.ts b/src/resources/radar/http/ases/tls-version.ts index 59103601a4..f407aba846 100644 --- a/src/resources/radar/http/ases/tls-version.ts +++ b/src/resources/radar/http/ases/tls-version.ts @@ -99,13 +99,44 @@ export namespace TLSVersionGetResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. diff --git a/src/resources/radar/http/http.ts b/src/resources/radar/http/http.ts index 7d3a80fcb6..9f658ffc5d 100644 --- a/src/resources/radar/http/http.ts +++ b/src/resources/radar/http/http.ts @@ -69,6 +69,71 @@ export class HTTP extends APIResource { ); top: TopAPI.Top = new TopAPI.Top(this._client); + /** + * Retrieves the distribution of HTTP requests by the specified dimension. + * + * @example + * ```ts + * const response = await client.radar.http.summaryV2('ADM1'); + * ``` + */ + summaryV2( + dimension: + | 'ADM1' + | 'BOT_CLASS' + | 'BROWSER' + | 'BROWSER_FAMILY' + | 'DEVICE_TYPE' + | 'HTTP_PROTOCOL' + | 'HTTP_VERSION' + | 'IP_VERSION' + | 'OS' + | 'POST_QUANTUM' + | 'TLS_VERSION', + query?: HTTPSummaryV2Params, + options?: Core.RequestOptions, + ): Core.APIPromise; + summaryV2( + dimension: + | 'ADM1' + | 'BOT_CLASS' + | 'BROWSER' + | 'BROWSER_FAMILY' + | 'DEVICE_TYPE' + | 'HTTP_PROTOCOL' + | 'HTTP_VERSION' + | 'IP_VERSION' + | 'OS' + | 'POST_QUANTUM' + | 'TLS_VERSION', + options?: Core.RequestOptions, + ): Core.APIPromise; + summaryV2( + dimension: + | 'ADM1' + | 'BOT_CLASS' + | 'BROWSER' + | 'BROWSER_FAMILY' + | 'DEVICE_TYPE' + | 'HTTP_PROTOCOL' + | 'HTTP_VERSION' + | 'IP_VERSION' + | 'OS' + | 'POST_QUANTUM' + | 'TLS_VERSION', + query: HTTPSummaryV2Params | Core.RequestOptions = {}, + options?: Core.RequestOptions, + ): Core.APIPromise { + if (isRequestOptions(query)) { + return this.summaryV2(dimension, {}, query); + } + return ( + this._client.get(`/radar/http/summary/${dimension}`, { query, ...options }) as Core.APIPromise<{ + result: HTTPSummaryV2Response; + }> + )._thenUnwrap((obj) => obj.result); + } + /** * Retrieves the HTTP requests over time. * @@ -95,6 +160,202 @@ export class HTTP extends APIResource { }> )._thenUnwrap((obj) => obj.result); } + + /** + * Retrieves the distribution of HTTP requests grouped by dimension. + * + * @example + * ```ts + * const response = await client.radar.http.timeseriesGroupsV2( + * 'ADM1', + * ); + * ``` + */ + timeseriesGroupsV2( + dimension: + | 'ADM1' + | 'BOT_CLASS' + | 'BROWSER' + | 'BROWSER_FAMILY' + | 'DEVICE_TYPE' + | 'HTTP_PROTOCOL' + | 'HTTP_VERSION' + | 'IP_VERSION' + | 'OS' + | 'POST_QUANTUM' + | 'TLS_VERSION', + query?: HTTPTimeseriesGroupsV2Params, + options?: Core.RequestOptions, + ): Core.APIPromise; + timeseriesGroupsV2( + dimension: + | 'ADM1' + | 'BOT_CLASS' + | 'BROWSER' + | 'BROWSER_FAMILY' + | 'DEVICE_TYPE' + | 'HTTP_PROTOCOL' + | 'HTTP_VERSION' + | 'IP_VERSION' + | 'OS' + | 'POST_QUANTUM' + | 'TLS_VERSION', + options?: Core.RequestOptions, + ): Core.APIPromise; + timeseriesGroupsV2( + dimension: + | 'ADM1' + | 'BOT_CLASS' + | 'BROWSER' + | 'BROWSER_FAMILY' + | 'DEVICE_TYPE' + | 'HTTP_PROTOCOL' + | 'HTTP_VERSION' + | 'IP_VERSION' + | 'OS' + | 'POST_QUANTUM' + | 'TLS_VERSION', + query: HTTPTimeseriesGroupsV2Params | Core.RequestOptions = {}, + options?: Core.RequestOptions, + ): Core.APIPromise { + if (isRequestOptions(query)) { + return this.timeseriesGroupsV2(dimension, {}, query); + } + return ( + this._client.get(`/radar/http/timeseries_groups/${dimension}`, { + query, + ...options, + }) as Core.APIPromise<{ result: HTTPTimeseriesGroupsV2Response }> + )._thenUnwrap((obj) => obj.result); + } +} + +export interface HTTPSummaryV2Response { + /** + * Metadata for the results. + */ + meta: HTTPSummaryV2Response.Meta; + + summary_0: { [key: string]: string }; +} + +export namespace HTTPSummaryV2Response { + /** + * Metadata for the results. + */ + export interface Meta { + confidenceInfo: Meta.ConfidenceInfo; + + dateRange: Array; + + /** + * Timestamp of the last dataset update. + */ + lastUpdated: string; + + /** + * Normalization method applied to the results. Refer to + * [Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/). + */ + normalization: + | 'PERCENTAGE' + | 'MIN0_MAX' + | 'MIN_MAX' + | 'RAW_VALUES' + | 'PERCENTAGE_CHANGE' + | 'ROLLING_AVERAGE' + | 'OVERLAPPED_PERCENTAGE' + | 'RATIO'; + + /** + * Measurement units for the results. + */ + units: Array; + } + + export namespace Meta { + export interface ConfidenceInfo { + annotations: Array; + + /** + * Provides an indication of how much confidence Cloudflare has in the data. + */ + level: number; + } + + export namespace ConfidenceInfo { + /** + * Annotation associated with the result (e.g. outage or other type of event). + */ + export interface Annotation { + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; + + description: string; + + endDate: string; + + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; + + /** + * Whether event is a single point in time or a time range. + */ + isInstantaneous: boolean; + + linkedUrl: string; + + startDate: string; + } + } + + export interface DateRange { + /** + * Adjusted end of date range. + */ + endTime: string; + + /** + * Adjusted start of date range. + */ + startTime: string; + } + + export interface Unit { + name: string; + + value: string; + } + } } export interface HTTPTimeseriesResponse { @@ -165,13 +426,44 @@ export namespace HTTPTimeseriesResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -210,6 +502,249 @@ export namespace HTTPTimeseriesResponse { } } +export interface HTTPTimeseriesGroupsV2Response { + /** + * Metadata for the results. + */ + meta: HTTPTimeseriesGroupsV2Response.Meta; + + serie_0: HTTPTimeseriesGroupsV2Response.Serie0; +} + +export namespace HTTPTimeseriesGroupsV2Response { + /** + * Metadata for the results. + */ + export interface Meta { + /** + * Aggregation interval of the results (e.g., in 15 minutes or 1 hour intervals). + * Refer to + * [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + */ + aggInterval: 'FIFTEEN_MINUTES' | 'ONE_HOUR' | 'ONE_DAY' | 'ONE_WEEK' | 'ONE_MONTH'; + + confidenceInfo: Meta.ConfidenceInfo; + + dateRange: Array; + + /** + * Timestamp of the last dataset update. + */ + lastUpdated: string; + + /** + * Normalization method applied to the results. Refer to + * [Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/). + */ + normalization: + | 'PERCENTAGE' + | 'MIN0_MAX' + | 'MIN_MAX' + | 'RAW_VALUES' + | 'PERCENTAGE_CHANGE' + | 'ROLLING_AVERAGE' + | 'OVERLAPPED_PERCENTAGE' + | 'RATIO'; + + /** + * Measurement units for the results. + */ + units: Array; + } + + export namespace Meta { + export interface ConfidenceInfo { + annotations: Array; + + /** + * Provides an indication of how much confidence Cloudflare has in the data. + */ + level: number; + } + + export namespace ConfidenceInfo { + /** + * Annotation associated with the result (e.g. outage or other type of event). + */ + export interface Annotation { + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; + + description: string; + + endDate: string; + + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; + + /** + * Whether event is a single point in time or a time range. + */ + isInstantaneous: boolean; + + linkedUrl: string; + + startDate: string; + } + } + + export interface DateRange { + /** + * Adjusted end of date range. + */ + endTime: string; + + /** + * Adjusted start of date range. + */ + startTime: string; + } + + export interface Unit { + name: string; + + value: string; + } + } + + export interface Serie0 { + timestamps: Array; + + [k: string]: Array | Array | undefined; + } +} + +export interface HTTPSummaryV2Params { + /** + * Filters results by Autonomous System. Specify one or more Autonomous System + * Numbers (ASNs) as a comma-separated list. Prefix with `-` to exclude ASNs from + * results. For example, `-174, 3356` excludes results from AS174, but includes + * results from AS3356. + */ + asn?: Array; + + /** + * Filters results by bot class. Refer to + * [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). + */ + botClass?: Array<'LIKELY_AUTOMATED' | 'LIKELY_HUMAN'>; + + /** + * Filters results by continent. Specify a comma-separated list of alpha-2 codes. + * Prefix with `-` to exclude continents from results. For example, `-EU,NA` + * excludes results from EU, but includes results from NA. + */ + continent?: Array; + + /** + * End of the date range (inclusive). + */ + dateEnd?: Array; + + /** + * Filters results by date range. For example, use `7d` and `7dcontrol` to compare + * this week with the previous week. Use this parameter or set specific start and + * end dates (`dateStart` and `dateEnd` parameters). + */ + dateRange?: Array; + + /** + * Start of the date range. + */ + dateStart?: Array; + + /** + * Filters results by device type. + */ + deviceType?: Array<'DESKTOP' | 'MOBILE' | 'OTHER'>; + + /** + * Format in which results will be returned. + */ + format?: 'JSON' | 'CSV'; + + /** + * Filters results by Geolocation. Specify a comma-separated list of GeoNames IDs. + * Prefix with `-` to exclude geoIds from results. For example, `-2267056,360689` + * excludes results from the 2267056 (Lisbon), but includes results from 5128638 + * (New York). + */ + geoId?: Array; + + /** + * Filters results by HTTP protocol (HTTP vs. HTTPS). + */ + httpProtocol?: Array<'HTTP' | 'HTTPS'>; + + /** + * Filters results by HTTP version. + */ + httpVersion?: Array<'HTTPv1' | 'HTTPv2' | 'HTTPv3'>; + + /** + * Filters results by IP version (Ipv4 vs. IPv6). + */ + ipVersion?: Array<'IPv4' | 'IPv6'>; + + /** + * Limits the number of objects per group to the top items within the specified + * time range. When item count exceeds the limit, extra items appear grouped under + * an "other" category. + */ + limitPerGroup?: number; + + /** + * Filters results by location. Specify a comma-separated list of alpha-2 codes. + * Prefix with `-` to exclude locations from results. For example, `-US,PT` + * excludes results from the US, but includes results from PT. + */ + location?: Array; + + /** + * Array of names used to label the series in the response. + */ + name?: Array; + + /** + * Filters results by operating system. + */ + os?: Array<'WINDOWS' | 'MACOSX' | 'IOS' | 'ANDROID' | 'CHROMEOS' | 'LINUX' | 'SMART_TV'>; + + /** + * Filters results by TLS version. + */ + tlsVersion?: Array<'TLSv1_0' | 'TLSv1_1' | 'TLSv1_2' | 'TLSv1_3' | 'TLSvQUIC'>; +} + export interface HTTPTimeseriesParams { /** * Aggregation interval of the results (e.g., in 15 minutes or 1 hour intervals). @@ -323,6 +858,121 @@ export interface HTTPTimeseriesParams { tlsVersion?: Array<'TLSv1_0' | 'TLSv1_1' | 'TLSv1_2' | 'TLSv1_3' | 'TLSvQUIC'>; } +export interface HTTPTimeseriesGroupsV2Params { + /** + * Aggregation interval of the results (e.g., in 15 minutes or 1 hour intervals). + * Refer to + * [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + */ + aggInterval?: '15m' | '1h' | '1d' | '1w'; + + /** + * Filters results by Autonomous System. Specify one or more Autonomous System + * Numbers (ASNs) as a comma-separated list. Prefix with `-` to exclude ASNs from + * results. For example, `-174, 3356` excludes results from AS174, but includes + * results from AS3356. + */ + asn?: Array; + + /** + * Filters results by bot class. Refer to + * [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). + */ + botClass?: Array<'LIKELY_AUTOMATED' | 'LIKELY_HUMAN'>; + + /** + * Filters results by continent. Specify a comma-separated list of alpha-2 codes. + * Prefix with `-` to exclude continents from results. For example, `-EU,NA` + * excludes results from EU, but includes results from NA. + */ + continent?: Array; + + /** + * End of the date range (inclusive). + */ + dateEnd?: Array; + + /** + * Filters results by date range. For example, use `7d` and `7dcontrol` to compare + * this week with the previous week. Use this parameter or set specific start and + * end dates (`dateStart` and `dateEnd` parameters). + */ + dateRange?: Array; + + /** + * Start of the date range. + */ + dateStart?: Array; + + /** + * Filters results by device type. + */ + deviceType?: Array<'DESKTOP' | 'MOBILE' | 'OTHER'>; + + /** + * Format in which results will be returned. + */ + format?: 'JSON' | 'CSV'; + + /** + * Filters results by Geolocation. Specify a comma-separated list of GeoNames IDs. + * Prefix with `-` to exclude geoIds from results. For example, `-2267056,360689` + * excludes results from the 2267056 (Lisbon), but includes results from 5128638 + * (New York). + */ + geoId?: Array; + + /** + * Filters results by HTTP protocol (HTTP vs. HTTPS). + */ + httpProtocol?: Array<'HTTP' | 'HTTPS'>; + + /** + * Filters results by HTTP version. + */ + httpVersion?: Array<'HTTPv1' | 'HTTPv2' | 'HTTPv3'>; + + /** + * Filters results by IP version (Ipv4 vs. IPv6). + */ + ipVersion?: Array<'IPv4' | 'IPv6'>; + + /** + * Limits the number of objects per group to the top items within the specified + * time range. When item count exceeds the limit, extra items appear grouped under + * an "other" category. + */ + limitPerGroup?: number; + + /** + * Filters results by location. Specify a comma-separated list of alpha-2 codes. + * Prefix with `-` to exclude locations from results. For example, `-US,PT` + * excludes results from the US, but includes results from PT. + */ + location?: Array; + + /** + * Array of names used to label the series in the response. + */ + name?: Array; + + /** + * Normalization method applied to the results. Refer to + * [Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/). + */ + normalization?: 'PERCENTAGE' | 'MIN0_MAX'; + + /** + * Filters results by operating system. + */ + os?: Array<'WINDOWS' | 'MACOSX' | 'IOS' | 'ANDROID' | 'CHROMEOS' | 'LINUX' | 'SMART_TV'>; + + /** + * Filters results by TLS version. + */ + tlsVersion?: Array<'TLSv1_0' | 'TLSv1_1' | 'TLSv1_2' | 'TLSv1_3' | 'TLSvQUIC'>; +} + HTTP.Locations = Locations; HTTP.Ases = Ases; HTTP.Summary = Summary; @@ -331,8 +981,12 @@ HTTP.Top = Top; export declare namespace HTTP { export { + type HTTPSummaryV2Response as HTTPSummaryV2Response, type HTTPTimeseriesResponse as HTTPTimeseriesResponse, + type HTTPTimeseriesGroupsV2Response as HTTPTimeseriesGroupsV2Response, + type HTTPSummaryV2Params as HTTPSummaryV2Params, type HTTPTimeseriesParams as HTTPTimeseriesParams, + type HTTPTimeseriesGroupsV2Params as HTTPTimeseriesGroupsV2Params, }; export { diff --git a/src/resources/radar/http/index.ts b/src/resources/radar/http/index.ts index cd20232224..d4b520cd3c 100644 --- a/src/resources/radar/http/index.ts +++ b/src/resources/radar/http/index.ts @@ -1,7 +1,15 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { Ases, type AseGetResponse, type AseGetParams } from './ases/index'; -export { HTTP, type HTTPTimeseriesResponse, type HTTPTimeseriesParams } from './http'; +export { + HTTP, + type HTTPSummaryV2Response, + type HTTPTimeseriesResponse, + type HTTPTimeseriesGroupsV2Response, + type HTTPSummaryV2Params, + type HTTPTimeseriesParams, + type HTTPTimeseriesGroupsV2Params, +} from './http'; export { Locations, type LocationGetResponse, type LocationGetParams } from './locations/index'; export { Summary, diff --git a/src/resources/radar/http/locations/bot-class.ts b/src/resources/radar/http/locations/bot-class.ts index e4cb08aec9..8f3d95731e 100644 --- a/src/resources/radar/http/locations/bot-class.ts +++ b/src/resources/radar/http/locations/bot-class.ts @@ -100,13 +100,44 @@ export namespace BotClassGetResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. diff --git a/src/resources/radar/http/locations/browser-family.ts b/src/resources/radar/http/locations/browser-family.ts index 138d5e0bbe..3822502f97 100644 --- a/src/resources/radar/http/locations/browser-family.ts +++ b/src/resources/radar/http/locations/browser-family.ts @@ -100,13 +100,44 @@ export namespace BrowserFamilyGetResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. diff --git a/src/resources/radar/http/locations/device-type.ts b/src/resources/radar/http/locations/device-type.ts index d166a8568d..6a39439797 100644 --- a/src/resources/radar/http/locations/device-type.ts +++ b/src/resources/radar/http/locations/device-type.ts @@ -100,13 +100,44 @@ export namespace DeviceTypeGetResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. diff --git a/src/resources/radar/http/locations/http-method.ts b/src/resources/radar/http/locations/http-method.ts index f06213f62b..34d322d1ac 100644 --- a/src/resources/radar/http/locations/http-method.ts +++ b/src/resources/radar/http/locations/http-method.ts @@ -100,13 +100,44 @@ export namespace HTTPMethodGetResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. diff --git a/src/resources/radar/http/locations/http-protocol.ts b/src/resources/radar/http/locations/http-protocol.ts index 7fae9f01b6..1519a7a4cc 100644 --- a/src/resources/radar/http/locations/http-protocol.ts +++ b/src/resources/radar/http/locations/http-protocol.ts @@ -100,13 +100,44 @@ export namespace HTTPProtocolGetResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. diff --git a/src/resources/radar/http/locations/ip-version.ts b/src/resources/radar/http/locations/ip-version.ts index d0441c609c..c171b16256 100644 --- a/src/resources/radar/http/locations/ip-version.ts +++ b/src/resources/radar/http/locations/ip-version.ts @@ -95,13 +95,44 @@ export namespace IPVersionGetResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. diff --git a/src/resources/radar/http/locations/locations.ts b/src/resources/radar/http/locations/locations.ts index fc472fe6d4..82deaef91b 100644 --- a/src/resources/radar/http/locations/locations.ts +++ b/src/resources/radar/http/locations/locations.ts @@ -113,13 +113,44 @@ export namespace LocationGetResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. diff --git a/src/resources/radar/http/locations/os.ts b/src/resources/radar/http/locations/os.ts index 12daac41e0..51d6e300e5 100644 --- a/src/resources/radar/http/locations/os.ts +++ b/src/resources/radar/http/locations/os.ts @@ -99,13 +99,44 @@ export namespace OSGetResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. diff --git a/src/resources/radar/http/locations/tls-version.ts b/src/resources/radar/http/locations/tls-version.ts index 56373c6dd3..eec033019f 100644 --- a/src/resources/radar/http/locations/tls-version.ts +++ b/src/resources/radar/http/locations/tls-version.ts @@ -101,13 +101,44 @@ export namespace TLSVersionGetResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. diff --git a/src/resources/radar/http/summary.ts b/src/resources/radar/http/summary.ts index 9f7f84b12e..74b14803fd 100644 --- a/src/resources/radar/http/summary.ts +++ b/src/resources/radar/http/summary.ts @@ -11,7 +11,7 @@ export class Summary extends APIResource { * https://developers.cloudflare.com/radar/concepts/bot-classes/ for more * information. * - * @deprecated + * @deprecated Use [Radar HTTP Summary By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/http/methods/summary_v2/) instead. */ botClass( query?: SummaryBotClassParams, @@ -36,7 +36,7 @@ export class Summary extends APIResource { * Retrieves the distribution of HTTP requests generated by mobile, desktop, and * other types of devices. * - * @deprecated + * @deprecated Use [Radar HTTP Summary By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/http/methods/summary_v2/) instead. */ deviceType( query?: SummaryDeviceTypeParams, @@ -60,7 +60,7 @@ export class Summary extends APIResource { /** * Retrieves the distribution of HTTP requests by HTTP protocol (HTTP vs. HTTPS). * - * @deprecated + * @deprecated Use [Radar HTTP Summary By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/http/methods/summary_v2/) instead. */ httpProtocol( query?: SummaryHTTPProtocolParams, @@ -84,7 +84,7 @@ export class Summary extends APIResource { /** * Retrieves the distribution of HTTP requests by HTTP version. * - * @deprecated + * @deprecated Use [Radar HTTP Summary By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/http/methods/summary_v2/) instead. */ httpVersion( query?: SummaryHTTPVersionParams, @@ -108,7 +108,7 @@ export class Summary extends APIResource { /** * Retrieves the distribution of HTTP requests by IP version. * - * @deprecated + * @deprecated Use [Radar HTTP Summary By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/http/methods/summary_v2/) instead. */ ipVersion( query?: SummaryIPVersionParams, @@ -133,7 +133,7 @@ export class Summary extends APIResource { * Retrieves the distribution of HTTP requests by operating system (Windows, macOS, * Android, iOS, and others). * - * @deprecated + * @deprecated Use [Radar HTTP Summary By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/http/methods/summary_v2/) instead. */ os(query?: SummaryOSParams, options?: Core.RequestOptions): Core.APIPromise; os(options?: Core.RequestOptions): Core.APIPromise; @@ -154,7 +154,7 @@ export class Summary extends APIResource { /** * Retrieves the distribution of HTTP requests by post-quantum support. * - * @deprecated + * @deprecated Use [Radar HTTP Summary By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/http/methods/summary_v2/) instead. */ postQuantum( query?: SummaryPostQuantumParams, @@ -178,7 +178,7 @@ export class Summary extends APIResource { /** * Retrieves the distribution of HTTP requests by TLS version. * - * @deprecated + * @deprecated Use [Radar HTTP Summary By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/http/methods/summary_v2/) instead. */ tlsVersion( query?: SummaryTLSVersionParams, @@ -258,13 +258,44 @@ export namespace SummaryBotClassResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -367,13 +398,44 @@ export namespace SummaryDeviceTypeResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -481,13 +543,44 @@ export namespace SummaryHTTPProtocolResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -590,13 +683,44 @@ export namespace SummaryHTTPVersionResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -704,13 +828,44 @@ export namespace SummaryIPVersionResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -813,13 +968,44 @@ export namespace SummaryOSResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -922,13 +1108,44 @@ export namespace SummaryPostQuantumResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -1031,13 +1248,44 @@ export namespace SummaryTLSVersionResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. diff --git a/src/resources/radar/http/timeseries-groups.ts b/src/resources/radar/http/timeseries-groups.ts index a22fdb7774..9a671b7b18 100644 --- a/src/resources/radar/http/timeseries-groups.ts +++ b/src/resources/radar/http/timeseries-groups.ts @@ -10,7 +10,7 @@ export class TimeseriesGroups extends APIResource { * over time. Visit https://developers.cloudflare.com/radar/concepts/bot-classes/ * for more information. * - * @deprecated + * @deprecated Use [Radar HTTP Timeseries Groups By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/http/methods/timeseries_groups_v2/) instead. */ botClass( query?: TimeseriesGroupBotClassParams, @@ -34,7 +34,7 @@ export class TimeseriesGroups extends APIResource { /** * Retrieves the distribution of HTTP requests by user agent over time. * - * @deprecated + * @deprecated Use [Radar HTTP Timeseries Groups By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/http/methods/timeseries_groups_v2/) instead. */ browser( query?: TimeseriesGroupBrowserParams, @@ -58,7 +58,7 @@ export class TimeseriesGroups extends APIResource { /** * Retrieves the distribution of HTTP requests by user agent family over time. * - * @deprecated + * @deprecated Use [Radar HTTP Timeseries Groups By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/http/methods/timeseries_groups_v2/) instead. */ browserFamily( query?: TimeseriesGroupBrowserFamilyParams, @@ -83,7 +83,7 @@ export class TimeseriesGroups extends APIResource { /** * Retrieves the distribution of HTTP requests by device type over time. * - * @deprecated + * @deprecated Use [Radar HTTP Timeseries Groups By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/http/methods/timeseries_groups_v2/) instead. */ deviceType( query?: TimeseriesGroupDeviceTypeParams, @@ -109,7 +109,7 @@ export class TimeseriesGroups extends APIResource { * Retrieves the distribution of HTTP requests by HTTP protocol (HTTP vs. HTTPS) * over time. * - * @deprecated + * @deprecated Use [Radar HTTP Timeseries Groups By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/http/methods/timeseries_groups_v2/) instead. */ httpProtocol( query?: TimeseriesGroupHTTPProtocolParams, @@ -134,7 +134,7 @@ export class TimeseriesGroups extends APIResource { /** * Retrieves the distribution of HTTP requests by HTTP version over time. * - * @deprecated + * @deprecated Use [Radar HTTP Timeseries Groups By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/http/methods/timeseries_groups_v2/) instead. */ httpVersion( query?: TimeseriesGroupHTTPVersionParams, @@ -159,7 +159,7 @@ export class TimeseriesGroups extends APIResource { /** * Retrieves the distribution of HTTP requests by IP version over time. * - * @deprecated + * @deprecated Use [Radar HTTP Timeseries Groups By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/http/methods/timeseries_groups_v2/) instead. */ ipVersion( query?: TimeseriesGroupIPVersionParams, @@ -183,7 +183,7 @@ export class TimeseriesGroups extends APIResource { /** * Retrieves the distribution of HTTP requests by operating system over time. * - * @deprecated + * @deprecated Use [Radar HTTP Timeseries Groups By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/http/methods/timeseries_groups_v2/) instead. */ os( query?: TimeseriesGroupOSParams, @@ -207,7 +207,7 @@ export class TimeseriesGroups extends APIResource { /** * Retrieves the distribution of HTTP requests by post-quantum support over time. * - * @deprecated + * @deprecated Use [Radar HTTP Timeseries Groups By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/http/methods/timeseries_groups_v2/) instead. */ postQuantum( query?: TimeseriesGroupPostQuantumParams, @@ -232,7 +232,7 @@ export class TimeseriesGroups extends APIResource { /** * Retrieves the distribution of HTTP requests by TLS version over time. * - * @deprecated + * @deprecated Use [Radar HTTP Timeseries Groups By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/http/methods/timeseries_groups_v2/) instead. */ tlsVersion( query?: TimeseriesGroupTLSVersionParams, @@ -320,13 +320,44 @@ export namespace TimeseriesGroupBotClassResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -432,13 +463,44 @@ export namespace TimeseriesGroupBrowserResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -542,13 +604,44 @@ export namespace TimeseriesGroupBrowserFamilyResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -652,13 +745,44 @@ export namespace TimeseriesGroupDeviceTypeResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -766,13 +890,44 @@ export namespace TimeseriesGroupHTTPProtocolResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -878,13 +1033,44 @@ export namespace TimeseriesGroupHTTPVersionResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -992,13 +1178,44 @@ export namespace TimeseriesGroupIPVersionResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -1104,13 +1321,44 @@ export namespace TimeseriesGroupOSResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -1214,13 +1462,44 @@ export namespace TimeseriesGroupPostQuantumResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -1326,13 +1605,44 @@ export namespace TimeseriesGroupTLSVersionResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. diff --git a/src/resources/radar/http/top.ts b/src/resources/radar/http/top.ts index 01ee05806f..2b2967694e 100644 --- a/src/resources/radar/http/top.ts +++ b/src/resources/radar/http/top.ts @@ -8,10 +8,7 @@ export class Top extends APIResource { /** * Retrieves the top user agents by HTTP requests. * - * @example - * ```ts - * const response = await client.radar.http.top.browser(); - * ``` + * @deprecated Use [Radar HTTP Summary By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/http/methods/summary_v2/) instead. */ browser(query?: TopBrowserParams, options?: Core.RequestOptions): Core.APIPromise; browser(options?: Core.RequestOptions): Core.APIPromise; @@ -32,11 +29,7 @@ export class Top extends APIResource { /** * Retrieves the top user agents, aggregated in families, by HTTP requests. * - * @example - * ```ts - * const response = - * await client.radar.http.top.browserFamily(); - * ``` + * @deprecated Use [Radar HTTP Summary By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/http/methods/summary_v2/) instead. */ browserFamily( query?: TopBrowserFamilyParams, @@ -116,13 +109,44 @@ export namespace TopBrowserResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -219,13 +243,44 @@ export namespace TopBrowserFamilyResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. diff --git a/src/resources/radar/index.ts b/src/resources/radar/index.ts index 9b9bba8ee0..8bade1de40 100644 --- a/src/resources/radar/index.ts +++ b/src/resources/radar/index.ts @@ -1,7 +1,15 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { AI } from './ai/index'; -export { AS112, type AS112TimeseriesResponse, type AS112TimeseriesParams } from './as112/index'; +export { + AS112, + type AS112SummaryV2Response, + type AS112TimeseriesResponse, + type AS112TimeseriesGroupsV2Response, + type AS112SummaryV2Params, + type AS112TimeseriesParams, + type AS112TimeseriesGroupsV2Params, +} from './as112/index'; export { Annotations, type AnnotationListResponse, type AnnotationListParams } from './annotations/index'; export { Attacks } from './attacks/index'; export { BGP, type BGPTimeseriesResponse, type BGPTimeseriesParams } from './bgp/index'; @@ -27,7 +35,15 @@ export { type CtTimeseriesParams, type CtTimeseriesGroupsParams, } from './ct/index'; -export { DNS, type DNSTimeseriesResponse, type DNSTimeseriesParams } from './dns/index'; +export { + DNS, + type DNSSummaryV2Response, + type DNSTimeseriesResponse, + type DNSTimeseriesGroupsV2Response, + type DNSSummaryV2Params, + type DNSTimeseriesParams, + type DNSTimeseriesGroupsV2Params, +} from './dns/index'; export { Datasets, type DatasetListResponse, @@ -38,14 +54,39 @@ export { } from './datasets'; export { Email, type RadarEmailSeries, type RadarEmailSummary } from './email/index'; export { Entities, type EntityGetResponse, type EntityGetParams } from './entities/index'; -export { HTTP, type HTTPTimeseriesResponse, type HTTPTimeseriesParams } from './http/index'; -export { LeakedCredentials } from './leaked-credentials/index'; +export { + Geolocations, + type GeolocationListResponse, + type GeolocationGetResponse, + type GeolocationListParams, + type GeolocationGetParams, +} from './geolocations'; +export { + HTTP, + type HTTPSummaryV2Response, + type HTTPTimeseriesResponse, + type HTTPTimeseriesGroupsV2Response, + type HTTPSummaryV2Params, + type HTTPTimeseriesParams, + type HTTPTimeseriesGroupsV2Params, +} from './http/index'; +export { + LeakedCredentials, + type LeakedCredentialSummaryV2Response, + type LeakedCredentialTimeseriesGroupsV2Response, + type LeakedCredentialSummaryV2Params, + type LeakedCredentialTimeseriesGroupsV2Params, +} from './leaked-credentials/index'; export { Netflows, type NetflowSummaryResponse, + type NetflowSummaryV2Response, type NetflowTimeseriesResponse, + type NetflowTimeseriesGroupsResponse, type NetflowSummaryParams, + type NetflowSummaryV2Params, type NetflowTimeseriesParams, + type NetflowTimeseriesGroupsParams, } from './netflows/index'; export { Quality } from './quality/index'; export { Radar } from './radar'; diff --git a/src/resources/radar/leaked-credentials/index.ts b/src/resources/radar/leaked-credentials/index.ts index dd87ce4dc7..0e9f80aa96 100644 --- a/src/resources/radar/leaked-credentials/index.ts +++ b/src/resources/radar/leaked-credentials/index.ts @@ -1,6 +1,12 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { LeakedCredentials } from './leaked-credentials'; +export { + LeakedCredentials, + type LeakedCredentialSummaryV2Response, + type LeakedCredentialTimeseriesGroupsV2Response, + type LeakedCredentialSummaryV2Params, + type LeakedCredentialTimeseriesGroupsV2Params, +} from './leaked-credentials'; export { Summary, type SummaryBotClassResponse, diff --git a/src/resources/radar/leaked-credentials/leaked-credentials.ts b/src/resources/radar/leaked-credentials/leaked-credentials.ts index 0b08cd020b..20d4b71d91 100644 --- a/src/resources/radar/leaked-credentials/leaked-credentials.ts +++ b/src/resources/radar/leaked-credentials/leaked-credentials.ts @@ -1,6 +1,8 @@ // 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 SummaryAPI from './summary'; import { Summary, @@ -23,12 +25,524 @@ export class LeakedCredentials extends APIResource { timeseriesGroups: TimeseriesGroupsAPI.TimeseriesGroups = new TimeseriesGroupsAPI.TimeseriesGroups( this._client, ); + + /** + * Retrieves an aggregated summary of HTTP authentication requests grouped by the + * specified dimension. + * + * @example + * ```ts + * const response = + * await client.radar.leakedCredentials.summaryV2( + * 'COMPROMISED', + * ); + * ``` + */ + summaryV2( + dimension: 'COMPROMISED' | 'BOT_CLASS', + query?: LeakedCredentialSummaryV2Params, + options?: Core.RequestOptions, + ): Core.APIPromise; + summaryV2( + dimension: 'COMPROMISED' | 'BOT_CLASS', + options?: Core.RequestOptions, + ): Core.APIPromise; + summaryV2( + dimension: 'COMPROMISED' | 'BOT_CLASS', + query: LeakedCredentialSummaryV2Params | Core.RequestOptions = {}, + options?: Core.RequestOptions, + ): Core.APIPromise { + if (isRequestOptions(query)) { + return this.summaryV2(dimension, {}, query); + } + return ( + this._client.get(`/radar/leaked_credential_checks/summary/${dimension}`, { + query, + ...options, + }) as Core.APIPromise<{ result: LeakedCredentialSummaryV2Response }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Retrieves the distribution of HTTP authentication requests, grouped by the + * specified dimension over time. + * + * @example + * ```ts + * const response = + * await client.radar.leakedCredentials.timeseriesGroupsV2( + * 'COMPROMISED', + * ); + * ``` + */ + timeseriesGroupsV2( + dimension: 'COMPROMISED' | 'BOT_CLASS', + query?: LeakedCredentialTimeseriesGroupsV2Params, + options?: Core.RequestOptions, + ): Core.APIPromise; + timeseriesGroupsV2( + dimension: 'COMPROMISED' | 'BOT_CLASS', + options?: Core.RequestOptions, + ): Core.APIPromise; + timeseriesGroupsV2( + dimension: 'COMPROMISED' | 'BOT_CLASS', + query: LeakedCredentialTimeseriesGroupsV2Params | Core.RequestOptions = {}, + options?: Core.RequestOptions, + ): Core.APIPromise { + if (isRequestOptions(query)) { + return this.timeseriesGroupsV2(dimension, {}, query); + } + return ( + this._client.get(`/radar/leaked_credential_checks/timeseries_groups/${dimension}`, { + query, + ...options, + }) as Core.APIPromise<{ result: LeakedCredentialTimeseriesGroupsV2Response }> + )._thenUnwrap((obj) => obj.result); + } +} + +export interface LeakedCredentialSummaryV2Response { + /** + * Metadata for the results. + */ + meta: LeakedCredentialSummaryV2Response.Meta; + + summary_0: { [key: string]: string }; +} + +export namespace LeakedCredentialSummaryV2Response { + /** + * Metadata for the results. + */ + export interface Meta { + confidenceInfo: Meta.ConfidenceInfo; + + dateRange: Array; + + /** + * Timestamp of the last dataset update. + */ + lastUpdated: string; + + /** + * Normalization method applied to the results. Refer to + * [Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/). + */ + normalization: + | 'PERCENTAGE' + | 'MIN0_MAX' + | 'MIN_MAX' + | 'RAW_VALUES' + | 'PERCENTAGE_CHANGE' + | 'ROLLING_AVERAGE' + | 'OVERLAPPED_PERCENTAGE' + | 'RATIO'; + + /** + * Measurement units for the results. + */ + units: Array; + } + + export namespace Meta { + export interface ConfidenceInfo { + annotations: Array; + + /** + * Provides an indication of how much confidence Cloudflare has in the data. + */ + level: number; + } + + export namespace ConfidenceInfo { + /** + * Annotation associated with the result (e.g. outage or other type of event). + */ + export interface Annotation { + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; + + description: string; + + endDate: string; + + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; + + /** + * Whether event is a single point in time or a time range. + */ + isInstantaneous: boolean; + + linkedUrl: string; + + startDate: string; + } + } + + export interface DateRange { + /** + * Adjusted end of date range. + */ + endTime: string; + + /** + * Adjusted start of date range. + */ + startTime: string; + } + + export interface Unit { + name: string; + + value: string; + } + } +} + +export interface LeakedCredentialTimeseriesGroupsV2Response { + /** + * Metadata for the results. + */ + meta: LeakedCredentialTimeseriesGroupsV2Response.Meta; + + serie_0: LeakedCredentialTimeseriesGroupsV2Response.Serie0; +} + +export namespace LeakedCredentialTimeseriesGroupsV2Response { + /** + * Metadata for the results. + */ + export interface Meta { + /** + * Aggregation interval of the results (e.g., in 15 minutes or 1 hour intervals). + * Refer to + * [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + */ + aggInterval: 'FIFTEEN_MINUTES' | 'ONE_HOUR' | 'ONE_DAY' | 'ONE_WEEK' | 'ONE_MONTH'; + + confidenceInfo: Meta.ConfidenceInfo; + + dateRange: Array; + + /** + * Timestamp of the last dataset update. + */ + lastUpdated: string; + + /** + * Normalization method applied to the results. Refer to + * [Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/). + */ + normalization: + | 'PERCENTAGE' + | 'MIN0_MAX' + | 'MIN_MAX' + | 'RAW_VALUES' + | 'PERCENTAGE_CHANGE' + | 'ROLLING_AVERAGE' + | 'OVERLAPPED_PERCENTAGE' + | 'RATIO'; + + /** + * Measurement units for the results. + */ + units: Array; + } + + export namespace Meta { + export interface ConfidenceInfo { + annotations: Array; + + /** + * Provides an indication of how much confidence Cloudflare has in the data. + */ + level: number; + } + + export namespace ConfidenceInfo { + /** + * Annotation associated with the result (e.g. outage or other type of event). + */ + export interface Annotation { + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; + + description: string; + + endDate: string; + + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; + + /** + * Whether event is a single point in time or a time range. + */ + isInstantaneous: boolean; + + linkedUrl: string; + + startDate: string; + } + } + + export interface DateRange { + /** + * Adjusted end of date range. + */ + endTime: string; + + /** + * Adjusted start of date range. + */ + startTime: string; + } + + export interface Unit { + name: string; + + value: string; + } + } + + export interface Serie0 { + timestamps: Array; + + [k: string]: Array | Array | undefined; + } +} + +export interface LeakedCredentialSummaryV2Params { + /** + * Filters results by Autonomous System. Specify one or more Autonomous System + * Numbers (ASNs) as a comma-separated list. Prefix with `-` to exclude ASNs from + * results. For example, `-174, 3356` excludes results from AS174, but includes + * results from AS3356. + */ + asn?: Array; + + /** + * Filters results by bot class. Refer to + * [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). + */ + botClass?: Array<'LIKELY_AUTOMATED' | 'LIKELY_HUMAN'>; + + /** + * Filters results by compromised credential status (clean vs. compromised). + */ + compromised?: Array<'CLEAN' | 'COMPROMISED'>; + + /** + * Filters results by continent. Specify a comma-separated list of alpha-2 codes. + * Prefix with `-` to exclude continents from results. For example, `-EU,NA` + * excludes results from EU, but includes results from NA. + */ + continent?: Array; + + /** + * End of the date range (inclusive). + */ + dateEnd?: Array; + + /** + * Filters results by date range. For example, use `7d` and `7dcontrol` to compare + * this week with the previous week. Use this parameter or set specific start and + * end dates (`dateStart` and `dateEnd` parameters). + */ + dateRange?: Array; + + /** + * Start of the date range. + */ + dateStart?: Array; + + /** + * Format in which results will be returned. + */ + format?: 'JSON' | 'CSV'; + + /** + * Limits the number of objects per group to the top items within the specified + * time range. When item count exceeds the limit, extra items appear grouped under + * an "other" category. + */ + limitPerGroup?: number; + + /** + * Filters results by location. Specify a comma-separated list of alpha-2 codes. + * Prefix with `-` to exclude locations from results. For example, `-US,PT` + * excludes results from the US, but includes results from PT. + */ + location?: Array; + + /** + * Array of names used to label the series in the response. + */ + name?: Array; +} + +export interface LeakedCredentialTimeseriesGroupsV2Params { + /** + * Aggregation interval of the results (e.g., in 15 minutes or 1 hour intervals). + * Refer to + * [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + */ + aggInterval?: '15m' | '1h' | '1d' | '1w'; + + /** + * Filters results by Autonomous System. Specify one or more Autonomous System + * Numbers (ASNs) as a comma-separated list. Prefix with `-` to exclude ASNs from + * results. For example, `-174, 3356` excludes results from AS174, but includes + * results from AS3356. + */ + asn?: Array; + + /** + * Filters results by bot class. Refer to + * [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). + */ + botClass?: Array<'LIKELY_AUTOMATED' | 'LIKELY_HUMAN'>; + + /** + * Filters results by leaked credential check result. + */ + checkResult?: Array< + | 'CLEAN' + | 'USERNAME_LEAKED' + | 'USERNAME_PASSWORD_SIMILAR' + | 'USERNAME_AND_PASSWORD_LEAKED' + | 'PASSWORD_LEAKED' + >; + + /** + * Filters results by compromised credential status (clean vs. compromised). + */ + compromised?: Array<'CLEAN' | 'COMPROMISED'>; + + /** + * Filters results by continent. Specify a comma-separated list of alpha-2 codes. + * Prefix with `-` to exclude continents from results. For example, `-EU,NA` + * excludes results from EU, but includes results from NA. + */ + continent?: Array; + + /** + * End of the date range (inclusive). + */ + dateEnd?: Array; + + /** + * Filters results by date range. For example, use `7d` and `7dcontrol` to compare + * this week with the previous week. Use this parameter or set specific start and + * end dates (`dateStart` and `dateEnd` parameters). + */ + dateRange?: Array; + + /** + * Start of the date range. + */ + dateStart?: Array; + + /** + * Format in which results will be returned. + */ + format?: 'JSON' | 'CSV'; + + /** + * Limits the number of objects per group to the top items within the specified + * time range. When item count exceeds the limit, extra items appear grouped under + * an "other" category. + */ + limitPerGroup?: number; + + /** + * Filters results by location. Specify a comma-separated list of alpha-2 codes. + * Prefix with `-` to exclude locations from results. For example, `-US,PT` + * excludes results from the US, but includes results from PT. + */ + location?: Array; + + /** + * Array of names used to label the series in the response. + */ + name?: Array; + + /** + * Normalization method applied to the results. Refer to + * [Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/). + */ + normalization?: 'PERCENTAGE_CHANGE' | 'MIN0_MAX'; } LeakedCredentials.Summary = Summary; LeakedCredentials.TimeseriesGroups = TimeseriesGroups; export declare namespace LeakedCredentials { + export { + type LeakedCredentialSummaryV2Response as LeakedCredentialSummaryV2Response, + type LeakedCredentialTimeseriesGroupsV2Response as LeakedCredentialTimeseriesGroupsV2Response, + type LeakedCredentialSummaryV2Params as LeakedCredentialSummaryV2Params, + type LeakedCredentialTimeseriesGroupsV2Params as LeakedCredentialTimeseriesGroupsV2Params, + }; + export { Summary as Summary, type SummaryBotClassResponse as SummaryBotClassResponse, diff --git a/src/resources/radar/leaked-credentials/summary.ts b/src/resources/radar/leaked-credentials/summary.ts index 917ce13982..6729a80633 100644 --- a/src/resources/radar/leaked-credentials/summary.ts +++ b/src/resources/radar/leaked-credentials/summary.ts @@ -8,7 +8,7 @@ export class Summary extends APIResource { /** * Retrieves the distribution of HTTP authentication requests by bot class. * - * @deprecated + * @deprecated Use [Radar Leaked Credentials Summary By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/leaked_credentials/methods/summary_v2/) instead. */ botClass( query?: SummaryBotClassParams, @@ -34,7 +34,7 @@ export class Summary extends APIResource { * Retrieves the distribution of HTTP authentication requests by compromised * credential status. * - * @deprecated + * @deprecated Use [Radar Leaked Credentials Summary By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/leaked_credentials/methods/summary_v2/) instead. */ compromised( query?: SummaryCompromisedParams, @@ -115,13 +115,44 @@ export namespace SummaryBotClassResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -224,13 +255,44 @@ export namespace SummaryCompromisedResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. diff --git a/src/resources/radar/leaked-credentials/timeseries-groups.ts b/src/resources/radar/leaked-credentials/timeseries-groups.ts index 83aa48d077..f42e21ea98 100644 --- a/src/resources/radar/leaked-credentials/timeseries-groups.ts +++ b/src/resources/radar/leaked-credentials/timeseries-groups.ts @@ -9,7 +9,7 @@ export class TimeseriesGroups extends APIResource { * Retrieves the distribution of HTTP authentication requests by bot class over * time. * - * @deprecated + * @deprecated Use [Radar Leaked Credentials Timeseries Groups By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/leaked_credentials/methods/timeseries_groups_v2/) instead. */ botClass( query?: TimeseriesGroupBotClassParams, @@ -35,7 +35,7 @@ export class TimeseriesGroups extends APIResource { * Retrieves the distribution of HTTP authentication requests by compromised * credential status over time. * - * @deprecated + * @deprecated Use [Radar Leaked Credentials Timeseries Groups By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/leaked_credentials/methods/timeseries_groups_v2/) instead. */ compromised( query?: TimeseriesGroupCompromisedParams, @@ -123,13 +123,44 @@ export namespace TimeseriesGroupBotClassResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -235,13 +266,44 @@ export namespace TimeseriesGroupCompromisedResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. diff --git a/src/resources/radar/netflows/index.ts b/src/resources/radar/netflows/index.ts index cceee75f9d..8b6dfc637a 100644 --- a/src/resources/radar/netflows/index.ts +++ b/src/resources/radar/netflows/index.ts @@ -3,9 +3,13 @@ export { Netflows, type NetflowSummaryResponse, + type NetflowSummaryV2Response, type NetflowTimeseriesResponse, + type NetflowTimeseriesGroupsResponse, type NetflowSummaryParams, + type NetflowSummaryV2Params, type NetflowTimeseriesParams, + type NetflowTimeseriesGroupsParams, } from './netflows'; export { Top, diff --git a/src/resources/radar/netflows/netflows.ts b/src/resources/radar/netflows/netflows.ts index c484510bb6..d0013e5948 100644 --- a/src/resources/radar/netflows/netflows.ts +++ b/src/resources/radar/netflows/netflows.ts @@ -13,7 +13,7 @@ export class Netflows extends APIResource { * Retrieves the distribution of network traffic (NetFlows) by HTTP vs other * protocols. * - * @deprecated + * @deprecated Use [Get Network Traffic Distribution By Dimension](https://developers.cloudflare.com/api/resources/radar/subresources/netflows/methods/summary_v2/) instead. */ summary( query?: NetflowSummaryParams, @@ -34,6 +34,41 @@ export class Netflows extends APIResource { )._thenUnwrap((obj) => obj.result); } + /** + * Retrieves the distribution of network traffic (NetFlows) by the specified + * dimension. + * + * @example + * ```ts + * const response = await client.radar.netflows.summaryV2( + * 'ADM1', + * ); + * ``` + */ + summaryV2( + dimension: 'ADM1' | 'PRODUCT', + query?: NetflowSummaryV2Params, + options?: Core.RequestOptions, + ): Core.APIPromise; + summaryV2( + dimension: 'ADM1' | 'PRODUCT', + options?: Core.RequestOptions, + ): Core.APIPromise; + summaryV2( + dimension: 'ADM1' | 'PRODUCT', + query: NetflowSummaryV2Params | Core.RequestOptions = {}, + options?: Core.RequestOptions, + ): Core.APIPromise { + if (isRequestOptions(query)) { + return this.summaryV2(dimension, {}, query); + } + return ( + this._client.get(`/radar/netflows/summary/${dimension}`, { query, ...options }) as Core.APIPromise<{ + result: NetflowSummaryV2Response; + }> + )._thenUnwrap((obj) => obj.result); + } + /** * Retrieves network traffic (NetFlows) over time. * @@ -60,6 +95,41 @@ export class Netflows extends APIResource { }> )._thenUnwrap((obj) => obj.result); } + + /** + * Retrieves the distribution of NetFlows traffic, grouped by chosen the specified + * dimension over time. + * + * @example + * ```ts + * const response = + * await client.radar.netflows.timeseriesGroups('ADM1'); + * ``` + */ + timeseriesGroups( + dimension: 'ADM1' | 'PRODUCT', + query?: NetflowTimeseriesGroupsParams, + options?: Core.RequestOptions, + ): Core.APIPromise; + timeseriesGroups( + dimension: 'ADM1' | 'PRODUCT', + options?: Core.RequestOptions, + ): Core.APIPromise; + timeseriesGroups( + dimension: 'ADM1' | 'PRODUCT', + query: NetflowTimeseriesGroupsParams | Core.RequestOptions = {}, + options?: Core.RequestOptions, + ): Core.APIPromise { + if (isRequestOptions(query)) { + return this.timeseriesGroups(dimension, {}, query); + } + return ( + this._client.get(`/radar/netflows/timeseries_groups/${dimension}`, { + query, + ...options, + }) as Core.APIPromise<{ result: NetflowTimeseriesGroupsResponse }> + )._thenUnwrap((obj) => obj.result); + } } export interface NetflowSummaryResponse { @@ -120,13 +190,44 @@ export namespace NetflowSummaryResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -171,6 +272,134 @@ export namespace NetflowSummaryResponse { } } +export interface NetflowSummaryV2Response { + /** + * Metadata for the results. + */ + meta: NetflowSummaryV2Response.Meta; + + summary_0: { [key: string]: string }; +} + +export namespace NetflowSummaryV2Response { + /** + * Metadata for the results. + */ + export interface Meta { + confidenceInfo: Meta.ConfidenceInfo; + + dateRange: Array; + + /** + * Timestamp of the last dataset update. + */ + lastUpdated: string; + + /** + * Normalization method applied to the results. Refer to + * [Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/). + */ + normalization: + | 'PERCENTAGE' + | 'MIN0_MAX' + | 'MIN_MAX' + | 'RAW_VALUES' + | 'PERCENTAGE_CHANGE' + | 'ROLLING_AVERAGE' + | 'OVERLAPPED_PERCENTAGE' + | 'RATIO'; + + /** + * Measurement units for the results. + */ + units: Array; + } + + export namespace Meta { + export interface ConfidenceInfo { + annotations: Array; + + /** + * Provides an indication of how much confidence Cloudflare has in the data. + */ + level: number; + } + + export namespace ConfidenceInfo { + /** + * Annotation associated with the result (e.g. outage or other type of event). + */ + export interface Annotation { + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; + + description: string; + + endDate: string; + + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; + + /** + * Whether event is a single point in time or a time range. + */ + isInstantaneous: boolean; + + linkedUrl: string; + + startDate: string; + } + } + + export interface DateRange { + /** + * Adjusted end of date range. + */ + endTime: string; + + /** + * Adjusted start of date range. + */ + startTime: string; + } + + export interface Unit { + name: string; + + value: string; + } + } +} + export interface NetflowTimeseriesResponse { /** * Metadata for the results. @@ -236,13 +465,44 @@ export namespace NetflowTimeseriesResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -281,6 +541,147 @@ export namespace NetflowTimeseriesResponse { } } +export interface NetflowTimeseriesGroupsResponse { + /** + * Metadata for the results. + */ + meta: NetflowTimeseriesGroupsResponse.Meta; + + serie_0: NetflowTimeseriesGroupsResponse.Serie0; +} + +export namespace NetflowTimeseriesGroupsResponse { + /** + * Metadata for the results. + */ + export interface Meta { + /** + * Aggregation interval of the results (e.g., in 15 minutes or 1 hour intervals). + * Refer to + * [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + */ + aggInterval: 'FIFTEEN_MINUTES' | 'ONE_HOUR' | 'ONE_DAY' | 'ONE_WEEK' | 'ONE_MONTH'; + + confidenceInfo: Meta.ConfidenceInfo; + + dateRange: Array; + + /** + * Timestamp of the last dataset update. + */ + lastUpdated: string; + + /** + * Normalization method applied to the results. Refer to + * [Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/). + */ + normalization: + | 'PERCENTAGE' + | 'MIN0_MAX' + | 'MIN_MAX' + | 'RAW_VALUES' + | 'PERCENTAGE_CHANGE' + | 'ROLLING_AVERAGE' + | 'OVERLAPPED_PERCENTAGE' + | 'RATIO'; + + /** + * Measurement units for the results. + */ + units: Array; + } + + export namespace Meta { + export interface ConfidenceInfo { + annotations: Array; + + /** + * Provides an indication of how much confidence Cloudflare has in the data. + */ + level: number; + } + + export namespace ConfidenceInfo { + /** + * Annotation associated with the result (e.g. outage or other type of event). + */ + export interface Annotation { + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; + + description: string; + + endDate: string; + + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; + + /** + * Whether event is a single point in time or a time range. + */ + isInstantaneous: boolean; + + linkedUrl: string; + + startDate: string; + } + } + + export interface DateRange { + /** + * Adjusted end of date range. + */ + endTime: string; + + /** + * Adjusted start of date range. + */ + startTime: string; + } + + export interface Unit { + name: string; + + value: string; + } + } + + export interface Serie0 { + timestamps: Array; + + [k: string]: Array | Array | undefined; + } +} + export interface NetflowSummaryParams { /** * Filters results by Autonomous System. Specify one or more Autonomous System @@ -340,6 +741,77 @@ export interface NetflowSummaryParams { name?: Array; } +export interface NetflowSummaryV2Params { + /** + * Filters results by Autonomous System. Specify one or more Autonomous System + * Numbers (ASNs) as a comma-separated list. Prefix with `-` to exclude ASNs from + * results. For example, `-174, 3356` excludes results from AS174, but includes + * results from AS3356. + */ + asn?: Array; + + /** + * Filters results by continent. Specify a comma-separated list of alpha-2 codes. + * Prefix with `-` to exclude continents from results. For example, `-EU,NA` + * excludes results from EU, but includes results from NA. + */ + continent?: Array; + + /** + * End of the date range (inclusive). + */ + dateEnd?: Array; + + /** + * Filters results by date range. For example, use `7d` and `7dcontrol` to compare + * this week with the previous week. Use this parameter or set specific start and + * end dates (`dateStart` and `dateEnd` parameters). + */ + dateRange?: Array; + + /** + * Start of the date range. + */ + dateStart?: Array; + + /** + * Format in which results will be returned. + */ + format?: 'JSON' | 'CSV'; + + /** + * Filters results by Geolocation. Specify a comma-separated list of GeoNames IDs. + * Prefix with `-` to exclude geoIds from results. For example, `-2267056,360689` + * excludes results from the 2267056 (Lisbon), but includes results from 5128638 + * (New York). + */ + geoId?: Array; + + /** + * Limits the number of objects per group to the top items within the specified + * time range. When item count exceeds the limit, extra items appear grouped under + * an "other" category. + */ + limitPerGroup?: number; + + /** + * Filters results by location. Specify a comma-separated list of alpha-2 codes. + * Prefix with `-` to exclude locations from results. For example, `-US,PT` + * excludes results from the US, but includes results from PT. + */ + location?: Array; + + /** + * Array of names used to label the series in the response. + */ + name?: Array; + + /** + * Filters the results by network traffic product types. + */ + product?: Array<'HTTP' | 'ALL'>; +} + export interface NetflowTimeseriesParams { /** * Aggregation interval of the results (e.g., in 15 minutes or 1 hour intervals). @@ -417,14 +889,102 @@ export interface NetflowTimeseriesParams { product?: Array<'HTTP' | 'ALL'>; } +export interface NetflowTimeseriesGroupsParams { + /** + * Aggregation interval of the results (e.g., in 15 minutes or 1 hour intervals). + * Refer to + * [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + */ + aggInterval?: '15m' | '1h' | '1d' | '1w'; + + /** + * Filters results by Autonomous System. Specify one or more Autonomous System + * Numbers (ASNs) as a comma-separated list. Prefix with `-` to exclude ASNs from + * results. For example, `-174, 3356` excludes results from AS174, but includes + * results from AS3356. + */ + asn?: Array; + + /** + * Filters results by continent. Specify a comma-separated list of alpha-2 codes. + * Prefix with `-` to exclude continents from results. For example, `-EU,NA` + * excludes results from EU, but includes results from NA. + */ + continent?: Array; + + /** + * End of the date range (inclusive). + */ + dateEnd?: Array; + + /** + * Filters results by date range. For example, use `7d` and `7dcontrol` to compare + * this week with the previous week. Use this parameter or set specific start and + * end dates (`dateStart` and `dateEnd` parameters). + */ + dateRange?: Array; + + /** + * Start of the date range. + */ + dateStart?: Array; + + /** + * Format in which results will be returned. + */ + format?: 'JSON' | 'CSV'; + + /** + * Filters results by Geolocation. Specify a comma-separated list of GeoNames IDs. + * Prefix with `-` to exclude geoIds from results. For example, `-2267056,360689` + * excludes results from the 2267056 (Lisbon), but includes results from 5128638 + * (New York). + */ + geoId?: Array; + + /** + * Limits the number of objects per group to the top items within the specified + * time range. When item count exceeds the limit, extra items appear grouped under + * an "other" category. + */ + limitPerGroup?: number; + + /** + * Filters results by location. Specify a comma-separated list of alpha-2 codes. + * Prefix with `-` to exclude locations from results. For example, `-US,PT` + * excludes results from the US, but includes results from PT. + */ + location?: Array; + + /** + * Array of names used to label the series in the response. + */ + name?: Array; + + /** + * Normalization method applied to the results. Refer to + * [Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/). + */ + normalization?: 'PERCENTAGE' | 'MIN0_MAX'; + + /** + * Filters the results by network traffic product types. + */ + product?: Array<'HTTP' | 'ALL'>; +} + Netflows.Top = Top; export declare namespace Netflows { export { type NetflowSummaryResponse as NetflowSummaryResponse, + type NetflowSummaryV2Response as NetflowSummaryV2Response, type NetflowTimeseriesResponse as NetflowTimeseriesResponse, + type NetflowTimeseriesGroupsResponse as NetflowTimeseriesGroupsResponse, type NetflowSummaryParams as NetflowSummaryParams, + type NetflowSummaryV2Params as NetflowSummaryV2Params, type NetflowTimeseriesParams as NetflowTimeseriesParams, + type NetflowTimeseriesGroupsParams as NetflowTimeseriesGroupsParams, }; export { diff --git a/src/resources/radar/netflows/top.ts b/src/resources/radar/netflows/top.ts index e8c73158d4..4ec37716e3 100644 --- a/src/resources/radar/netflows/top.ts +++ b/src/resources/radar/netflows/top.ts @@ -113,13 +113,44 @@ export namespace TopAsesResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -221,13 +252,44 @@ export namespace TopLocationsResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. diff --git a/src/resources/radar/quality/iqi.ts b/src/resources/radar/quality/iqi.ts index 4c3f288361..1b6a968a5f 100644 --- a/src/resources/radar/quality/iqi.ts +++ b/src/resources/radar/quality/iqi.ts @@ -105,13 +105,44 @@ export namespace IQISummaryResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -217,13 +248,44 @@ export namespace IQITimeseriesGroupsResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. diff --git a/src/resources/radar/quality/speed/speed.ts b/src/resources/radar/quality/speed/speed.ts index f3023aa4a7..ec4ad84a2e 100644 --- a/src/resources/radar/quality/speed/speed.ts +++ b/src/resources/radar/quality/speed/speed.ts @@ -137,13 +137,44 @@ export namespace SpeedHistogramResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -234,13 +265,44 @@ export namespace SpeedSummaryResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. diff --git a/src/resources/radar/quality/speed/top.ts b/src/resources/radar/quality/speed/top.ts index 9b858f1a94..9397414b56 100644 --- a/src/resources/radar/quality/speed/top.ts +++ b/src/resources/radar/quality/speed/top.ts @@ -116,13 +116,44 @@ export namespace TopAsesResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -235,13 +266,44 @@ export namespace TopLocationsResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. diff --git a/src/resources/radar/radar.ts b/src/resources/radar/radar.ts index 0ed666d88a..1349fb443f 100644 --- a/src/resources/radar/radar.ts +++ b/src/resources/radar/radar.ts @@ -10,6 +10,14 @@ import { DatasetListResponse, Datasets, } from './datasets'; +import * as GeolocationsAPI from './geolocations'; +import { + GeolocationGetParams, + GeolocationGetResponse, + GeolocationListParams, + GeolocationListResponse, + Geolocations, +} from './geolocations'; import * as SearchAPI from './search'; import { Search, SearchGlobalParams, SearchGlobalResponse } from './search'; import * as TCPResetsTimeoutsAPI from './tcp-resets-timeouts'; @@ -25,7 +33,15 @@ import { AI } from './ai/ai'; import * as AnnotationsAPI from './annotations/annotations'; import { AnnotationListParams, AnnotationListResponse, Annotations } from './annotations/annotations'; import * as AS112API from './as112/as112'; -import { AS112, AS112TimeseriesParams, AS112TimeseriesResponse } from './as112/as112'; +import { + AS112, + AS112SummaryV2Params, + AS112SummaryV2Response, + AS112TimeseriesGroupsV2Params, + AS112TimeseriesGroupsV2Response, + AS112TimeseriesParams, + AS112TimeseriesResponse, +} from './as112/as112'; import * as AttacksAPI from './attacks/attacks'; import { Attacks } from './attacks/attacks'; import * as BGPAPI from './bgp/bgp'; @@ -55,19 +71,45 @@ import { CtTimeseriesResponse, } from './ct/ct'; import * as DNSAPI from './dns/dns'; -import { DNS, DNSTimeseriesParams, DNSTimeseriesResponse } from './dns/dns'; +import { + DNS, + DNSSummaryV2Params, + DNSSummaryV2Response, + DNSTimeseriesGroupsV2Params, + DNSTimeseriesGroupsV2Response, + DNSTimeseriesParams, + DNSTimeseriesResponse, +} from './dns/dns'; import * as EmailAPI from './email/email'; import { Email, RadarEmailSeries, RadarEmailSummary } from './email/email'; import * as EntitiesAPI from './entities/entities'; import { Entities, EntityGetParams, EntityGetResponse } from './entities/entities'; import * as HTTPAPI from './http/http'; -import { HTTP, HTTPTimeseriesParams, HTTPTimeseriesResponse } from './http/http'; +import { + HTTP, + HTTPSummaryV2Params, + HTTPSummaryV2Response, + HTTPTimeseriesGroupsV2Params, + HTTPTimeseriesGroupsV2Response, + HTTPTimeseriesParams, + HTTPTimeseriesResponse, +} from './http/http'; import * as LeakedCredentialsAPI from './leaked-credentials/leaked-credentials'; -import { LeakedCredentials } from './leaked-credentials/leaked-credentials'; +import { + LeakedCredentialSummaryV2Params, + LeakedCredentialSummaryV2Response, + LeakedCredentialTimeseriesGroupsV2Params, + LeakedCredentialTimeseriesGroupsV2Response, + LeakedCredentials, +} from './leaked-credentials/leaked-credentials'; import * as NetflowsAPI from './netflows/netflows'; import { NetflowSummaryParams, NetflowSummaryResponse, + NetflowSummaryV2Params, + NetflowSummaryV2Response, + NetflowTimeseriesGroupsParams, + NetflowTimeseriesGroupsResponse, NetflowTimeseriesParams, NetflowTimeseriesResponse, Netflows, @@ -108,6 +150,7 @@ export class Radar extends APIResource { email: EmailAPI.Email = new EmailAPI.Email(this._client); attacks: AttacksAPI.Attacks = new AttacksAPI.Attacks(this._client); entities: EntitiesAPI.Entities = new EntitiesAPI.Entities(this._client); + geolocations: GeolocationsAPI.Geolocations = new GeolocationsAPI.Geolocations(this._client); http: HTTPAPI.HTTP = new HTTPAPI.HTTP(this._client); quality: QualityAPI.Quality = new QualityAPI.Quality(this._client); ranking: RankingAPI.Ranking = new RankingAPI.Ranking(this._client); @@ -137,6 +180,7 @@ Radar.AS112 = AS112; Radar.Email = Email; Radar.Attacks = Attacks; Radar.Entities = Entities; +Radar.Geolocations = Geolocations; Radar.HTTP = HTTP; Radar.Quality = Quality; Radar.Ranking = Ranking; @@ -195,16 +239,24 @@ export declare namespace Radar { export { DNS as DNS, + type DNSSummaryV2Response as DNSSummaryV2Response, type DNSTimeseriesResponse as DNSTimeseriesResponse, + type DNSTimeseriesGroupsV2Response as DNSTimeseriesGroupsV2Response, + type DNSSummaryV2Params as DNSSummaryV2Params, type DNSTimeseriesParams as DNSTimeseriesParams, + type DNSTimeseriesGroupsV2Params as DNSTimeseriesGroupsV2Params, }; export { Netflows as Netflows, type NetflowSummaryResponse as NetflowSummaryResponse, + type NetflowSummaryV2Response as NetflowSummaryV2Response, type NetflowTimeseriesResponse as NetflowTimeseriesResponse, + type NetflowTimeseriesGroupsResponse as NetflowTimeseriesGroupsResponse, type NetflowSummaryParams as NetflowSummaryParams, + type NetflowSummaryV2Params as NetflowSummaryV2Params, type NetflowTimeseriesParams as NetflowTimeseriesParams, + type NetflowTimeseriesGroupsParams as NetflowTimeseriesGroupsParams, }; export { @@ -217,8 +269,12 @@ export declare namespace Radar { export { AS112 as AS112, + type AS112SummaryV2Response as AS112SummaryV2Response, type AS112TimeseriesResponse as AS112TimeseriesResponse, + type AS112TimeseriesGroupsV2Response as AS112TimeseriesGroupsV2Response, + type AS112SummaryV2Params as AS112SummaryV2Params, type AS112TimeseriesParams as AS112TimeseriesParams, + type AS112TimeseriesGroupsV2Params as AS112TimeseriesGroupsV2Params, }; export { @@ -235,10 +291,22 @@ export declare namespace Radar { type EntityGetParams as EntityGetParams, }; + export { + Geolocations as Geolocations, + type GeolocationListResponse as GeolocationListResponse, + type GeolocationGetResponse as GeolocationGetResponse, + type GeolocationListParams as GeolocationListParams, + type GeolocationGetParams as GeolocationGetParams, + }; + export { HTTP as HTTP, + type HTTPSummaryV2Response as HTTPSummaryV2Response, type HTTPTimeseriesResponse as HTTPTimeseriesResponse, + type HTTPTimeseriesGroupsV2Response as HTTPTimeseriesGroupsV2Response, + type HTTPSummaryV2Params as HTTPSummaryV2Params, type HTTPTimeseriesParams as HTTPTimeseriesParams, + type HTTPTimeseriesGroupsV2Params as HTTPTimeseriesGroupsV2Params, }; export { Quality as Quality }; @@ -267,5 +335,11 @@ export declare namespace Radar { export { RobotsTXT as RobotsTXT }; - export { LeakedCredentials as LeakedCredentials }; + export { + LeakedCredentials as LeakedCredentials, + type LeakedCredentialSummaryV2Response as LeakedCredentialSummaryV2Response, + type LeakedCredentialTimeseriesGroupsV2Response as LeakedCredentialTimeseriesGroupsV2Response, + type LeakedCredentialSummaryV2Params as LeakedCredentialSummaryV2Params, + type LeakedCredentialTimeseriesGroupsV2Params as LeakedCredentialTimeseriesGroupsV2Params, + }; } diff --git a/src/resources/radar/ranking/internet-services.ts b/src/resources/radar/ranking/internet-services.ts index eccdf45fc4..8e63a9c495 100644 --- a/src/resources/radar/ranking/internet-services.ts +++ b/src/resources/radar/ranking/internet-services.ts @@ -167,13 +167,44 @@ export namespace InternetServiceTimeseriesGroupsResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -264,13 +295,44 @@ export namespace InternetServiceTopResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. diff --git a/src/resources/radar/ranking/ranking.ts b/src/resources/radar/ranking/ranking.ts index f07040dc81..7d60d9cde4 100644 --- a/src/resources/radar/ranking/ranking.ts +++ b/src/resources/radar/ranking/ranking.ts @@ -143,13 +143,44 @@ export namespace RankingTimeseriesGroupsResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -240,13 +271,44 @@ export namespace RankingTopResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. diff --git a/src/resources/radar/robots-txt/top/top.ts b/src/resources/radar/robots-txt/top/top.ts index c688b179e4..47ca8bfaaf 100644 --- a/src/resources/radar/robots-txt/top/top.ts +++ b/src/resources/radar/robots-txt/top/top.ts @@ -96,13 +96,44 @@ export namespace TopDomainCategoriesResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. diff --git a/src/resources/radar/robots-txt/top/user-agents.ts b/src/resources/radar/robots-txt/top/user-agents.ts index b0ab65f9c7..d3f3b32a38 100644 --- a/src/resources/radar/robots-txt/top/user-agents.ts +++ b/src/resources/radar/robots-txt/top/user-agents.ts @@ -93,13 +93,44 @@ export namespace UserAgentDirectiveResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. diff --git a/src/resources/radar/search.ts b/src/resources/radar/search.ts index ebf8a722f5..11301ff938 100644 --- a/src/resources/radar/search.ts +++ b/src/resources/radar/search.ts @@ -53,6 +53,8 @@ export interface SearchGlobalParams { | 'BOTS' | 'CERTIFICATE_AUTHORITIES' | 'CERTIFICATE_LOGS' + | 'ORIGINS' + | 'ORIGIN_REGIONS' | 'INDUSTRIES' | 'LOCATIONS' | 'NOTEBOOKS' @@ -74,6 +76,8 @@ export interface SearchGlobalParams { | 'BOTS' | 'CERTIFICATE_AUTHORITIES' | 'CERTIFICATE_LOGS' + | 'ORIGINS' + | 'ORIGIN_REGIONS' | 'INDUSTRIES' | 'LOCATIONS' | 'NOTEBOOKS' diff --git a/src/resources/radar/tcp-resets-timeouts.ts b/src/resources/radar/tcp-resets-timeouts.ts index 01cdb209f2..74102126a0 100644 --- a/src/resources/radar/tcp-resets-timeouts.ts +++ b/src/resources/radar/tcp-resets-timeouts.ts @@ -123,13 +123,44 @@ export namespace TCPResetsTimeoutSummaryResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -258,13 +289,44 @@ export namespace TCPResetsTimeoutTimeseriesGroupsResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. diff --git a/src/resources/radar/traffic-anomalies/traffic-anomalies.ts b/src/resources/radar/traffic-anomalies/traffic-anomalies.ts index 3dd4a6ea1b..ccf8b99386 100644 --- a/src/resources/radar/traffic-anomalies/traffic-anomalies.ts +++ b/src/resources/radar/traffic-anomalies/traffic-anomalies.ts @@ -60,6 +60,8 @@ export namespace TrafficAnomalyGetResponse { locationDetails?: TrafficAnomaly.LocationDetails; + originDetails?: TrafficAnomaly.OriginDetails; + visibleInDataSources?: Array; } @@ -85,6 +87,12 @@ export namespace TrafficAnomalyGetResponse { name: string; } + + export interface OriginDetails { + name: string; + + origin: string; + } } } @@ -130,7 +138,17 @@ export interface TrafficAnomalyGetParams { */ offset?: number; + /** + * Filters results by origin. + */ + origin?: string; + status?: 'VERIFIED' | 'UNVERIFIED'; + + /** + * Filters results by entity type (LOCATION, AS, or ORIGIN). + */ + type?: Array<'LOCATION' | 'AS' | 'ORIGIN'>; } TrafficAnomalies.Locations = LocationsAPILocations; diff --git a/src/resources/radar/verified-bots/top.ts b/src/resources/radar/verified-bots/top.ts index 405d7576c1..810a6229bd 100644 --- a/src/resources/radar/verified-bots/top.ts +++ b/src/resources/radar/verified-bots/top.ts @@ -110,13 +110,44 @@ export namespace TopBotsResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. @@ -220,13 +251,44 @@ export namespace TopCategoriesResponse { * Annotation associated with the result (e.g. outage or other type of event). */ export interface Annotation { - dataSource: string; + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; description: string; endDate: string; - eventType: string; + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; /** * Whether event is a single point in time or a time range. diff --git a/src/resources/realtime-kit.ts b/src/resources/realtime-kit.ts new file mode 100644 index 0000000000..050298a232 --- /dev/null +++ b/src/resources/realtime-kit.ts @@ -0,0 +1,5 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../resource'; + +export class RealtimeKit extends APIResource {} diff --git a/src/resources/resource-sharing/recipients.ts b/src/resources/resource-sharing/recipients.ts index f94b84a7f9..bf4fc35a47 100644 --- a/src/resources/resource-sharing/recipients.ts +++ b/src/resources/resource-sharing/recipients.ts @@ -144,11 +144,6 @@ export interface RecipientCreateResponse { */ modified: string; - /** - * Share Recipient status message. - */ - status_message: string; - resources?: Array; } @@ -168,6 +163,11 @@ export namespace RecipientCreateResponse { * Resource Version. */ resource_version: number; + + /** + * Whether the error is terminal or will be continually retried. + */ + terminal: boolean; } } @@ -197,11 +197,6 @@ export interface RecipientListResponse { */ modified: string; - /** - * Share Recipient status message. - */ - status_message: string; - resources?: Array; } @@ -221,6 +216,11 @@ export namespace RecipientListResponse { * Resource Version. */ resource_version: number; + + /** + * Whether the error is terminal or will be continually retried. + */ + terminal: boolean; } } @@ -250,11 +250,6 @@ export interface RecipientDeleteResponse { */ modified: string; - /** - * Share Recipient status message. - */ - status_message: string; - resources?: Array; } @@ -274,6 +269,11 @@ export namespace RecipientDeleteResponse { * Resource Version. */ resource_version: number; + + /** + * Whether the error is terminal or will be continually retried. + */ + terminal: boolean; } } @@ -303,11 +303,6 @@ export interface RecipientGetResponse { */ modified: string; - /** - * Share Recipient status message. - */ - status_message: string; - resources?: Array; } @@ -327,6 +322,11 @@ export namespace RecipientGetResponse { * Resource Version. */ resource_version: number; + + /** + * Whether the error is terminal or will be continually retried. + */ + terminal: boolean; } } diff --git a/src/resources/rules/lists/items.ts b/src/resources/rules/lists/items.ts index f834fbc70b..fa8de075e8 100644 --- a/src/resources/rules/lists/items.ts +++ b/src/resources/rules/lists/items.ts @@ -600,7 +600,12 @@ export interface ItemDeleteParams { } export namespace ItemDeleteParams { - export interface Item {} + export interface Item { + /** + * Defines the unique ID of the item in the List. + */ + id: string; + } } export interface ItemGetParams { diff --git a/src/resources/rulesets/rules.ts b/src/resources/rulesets/rules.ts index ee0495559c..3cca8dc4a5 100644 --- a/src/resources/rulesets/rules.ts +++ b/src/resources/rulesets/rules.ts @@ -5850,7 +5850,7 @@ export namespace SetConfigRule { bic?: boolean; /** - * Whether to disable Cloudflare Apps. + * @deprecated Cloudflare Apps are deprected. */ disable_apps?: true; @@ -5885,7 +5885,8 @@ export namespace SetConfigRule { hotlink_protection?: boolean; /** - * Whether to enable Mirage. + * @deprecated Mirage is deprecated. More information at + * https://developers.cloudflare.com/speed/optimization/images/mirage/. */ mirage?: boolean; @@ -6087,7 +6088,7 @@ export namespace SetConfigRuleParam { bic?: boolean; /** - * Whether to disable Cloudflare Apps. + * @deprecated Cloudflare Apps are deprected. */ disable_apps?: true; @@ -6122,7 +6123,8 @@ export namespace SetConfigRuleParam { hotlink_protection?: boolean; /** - * Whether to enable Mirage. + * @deprecated Mirage is deprecated. More information at + * https://developers.cloudflare.com/speed/optimization/images/mirage/. */ mirage?: boolean; @@ -11368,7 +11370,7 @@ export declare namespace RuleCreateParams { bic?: boolean; /** - * Whether to disable Cloudflare Apps. + * @deprecated Cloudflare Apps are deprected. */ disable_apps?: true; @@ -11403,7 +11405,8 @@ export declare namespace RuleCreateParams { hotlink_protection?: boolean; /** - * Whether to enable Mirage. + * @deprecated Mirage is deprecated. More information at + * https://developers.cloudflare.com/speed/optimization/images/mirage/. */ mirage?: boolean; @@ -15560,7 +15563,7 @@ export declare namespace RuleEditParams { bic?: boolean; /** - * Whether to disable Cloudflare Apps. + * @deprecated Cloudflare Apps are deprected. */ disable_apps?: true; @@ -15595,7 +15598,8 @@ export declare namespace RuleEditParams { hotlink_protection?: boolean; /** - * Whether to enable Mirage. + * @deprecated Mirage is deprecated. More information at + * https://developers.cloudflare.com/speed/optimization/images/mirage/. */ mirage?: boolean; diff --git a/src/resources/schema-validation/index.ts b/src/resources/schema-validation/index.ts index a738b4fc8d..2d9ad2ee1c 100644 --- a/src/resources/schema-validation/index.ts +++ b/src/resources/schema-validation/index.ts @@ -1,13 +1,10 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { - SchemaListResponsesV4PagePaginationArray, + PublicSchemasV4PagePaginationArray, Schemas, - type SchemaCreateResponse, - type SchemaListResponse, + type PublicSchema, type SchemaDeleteResponse, - type SchemaEditResponse, - type SchemaGetResponse, type SchemaCreateParams, type SchemaListParams, type SchemaDeleteParams, diff --git a/src/resources/schema-validation/schema-validation.ts b/src/resources/schema-validation/schema-validation.ts index cacc6e1c93..3c754a3ffb 100644 --- a/src/resources/schema-validation/schema-validation.ts +++ b/src/resources/schema-validation/schema-validation.ts @@ -3,17 +3,14 @@ import { APIResource } from '../../resource'; import * as SchemasAPI from './schemas'; import { + PublicSchema, + PublicSchemasV4PagePaginationArray, SchemaCreateParams, - SchemaCreateResponse, SchemaDeleteParams, SchemaDeleteResponse, SchemaEditParams, - SchemaEditResponse, SchemaGetParams, - SchemaGetResponse, SchemaListParams, - SchemaListResponse, - SchemaListResponsesV4PagePaginationArray, Schemas, } from './schemas'; import * as SettingsAPI from './settings/settings'; @@ -33,18 +30,15 @@ export class SchemaValidation extends APIResource { } SchemaValidation.Schemas = Schemas; -SchemaValidation.SchemaListResponsesV4PagePaginationArray = SchemaListResponsesV4PagePaginationArray; +SchemaValidation.PublicSchemasV4PagePaginationArray = PublicSchemasV4PagePaginationArray; SchemaValidation.Settings = Settings; export declare namespace SchemaValidation { export { Schemas as Schemas, - type SchemaCreateResponse as SchemaCreateResponse, - type SchemaListResponse as SchemaListResponse, + type PublicSchema as PublicSchema, type SchemaDeleteResponse as SchemaDeleteResponse, - type SchemaEditResponse as SchemaEditResponse, - type SchemaGetResponse as SchemaGetResponse, - SchemaListResponsesV4PagePaginationArray as SchemaListResponsesV4PagePaginationArray, + PublicSchemasV4PagePaginationArray as PublicSchemasV4PagePaginationArray, type SchemaCreateParams as SchemaCreateParams, type SchemaListParams as SchemaListParams, type SchemaDeleteParams as SchemaDeleteParams, diff --git a/src/resources/schema-validation/schemas.ts b/src/resources/schema-validation/schemas.ts index 6db2534007..050b1728e1 100644 --- a/src/resources/schema-validation/schemas.ts +++ b/src/resources/schema-validation/schemas.ts @@ -10,24 +10,23 @@ export class Schemas extends APIResource { * * @example * ```ts - * const schema = await client.schemaValidation.schemas.create( - * { + * const publicSchema = + * await client.schemaValidation.schemas.create({ * zone_id: '023e105f4ecef8ad9ca31a8372d0c353', * kind: 'openapi_v3', * name: 'petstore schema', * source: '', * validation_enabled: true, - * }, - * ); + * }); * ``` */ - create(params: SchemaCreateParams, options?: Core.RequestOptions): Core.APIPromise { + create(params: SchemaCreateParams, options?: Core.RequestOptions): Core.APIPromise { const { zone_id, ...body } = params; return ( this._client.post(`/zones/${zone_id}/schema_validation/schemas`, { body, ...options, - }) as Core.APIPromise<{ result: SchemaCreateResponse }> + }) as Core.APIPromise<{ result: PublicSchema }> )._thenUnwrap((obj) => obj.result); } @@ -37,7 +36,7 @@ export class Schemas extends APIResource { * @example * ```ts * // Automatically fetches more pages as needed. - * for await (const schemaListResponse of client.schemaValidation.schemas.list( + * for await (const publicSchema of client.schemaValidation.schemas.list( * { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * )) { * // ... @@ -47,11 +46,11 @@ export class Schemas extends APIResource { list( params: SchemaListParams, options?: Core.RequestOptions, - ): Core.PagePromise { + ): Core.PagePromise { const { zone_id, ...query } = params; return this._client.getAPIList( `/zones/${zone_id}/schema_validation/schemas`, - SchemaListResponsesV4PagePaginationArray, + PublicSchemasV4PagePaginationArray, { query, ...options }, ); } @@ -86,23 +85,24 @@ export class Schemas extends APIResource { * * @example * ```ts - * const response = await client.schemaValidation.schemas.edit( - * 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', - * { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }, - * ); + * const publicSchema = + * await client.schemaValidation.schemas.edit( + * 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', + * { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * ); * ``` */ edit( schemaId: string, params: SchemaEditParams, options?: Core.RequestOptions, - ): Core.APIPromise { + ): Core.APIPromise { const { zone_id, ...body } = params; return ( this._client.patch(`/zones/${zone_id}/schema_validation/schemas/${schemaId}`, { body, ...options, - }) as Core.APIPromise<{ result: SchemaEditResponse }> + }) as Core.APIPromise<{ result: PublicSchema }> )._thenUnwrap((obj) => obj.result); } @@ -111,65 +111,34 @@ export class Schemas extends APIResource { * * @example * ```ts - * const schema = await client.schemaValidation.schemas.get( - * 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', - * { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }, - * ); + * const publicSchema = + * await client.schemaValidation.schemas.get( + * 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', + * { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * ); * ``` */ get( schemaId: string, params: SchemaGetParams, options?: Core.RequestOptions, - ): Core.APIPromise { + ): Core.APIPromise { const { zone_id, ...query } = params; return ( this._client.get(`/zones/${zone_id}/schema_validation/schemas/${schemaId}`, { query, ...options, - }) as Core.APIPromise<{ result: SchemaGetResponse }> + }) as Core.APIPromise<{ result: PublicSchema }> )._thenUnwrap((obj) => obj.result); } } -export class SchemaListResponsesV4PagePaginationArray extends V4PagePaginationArray {} +export class PublicSchemasV4PagePaginationArray extends V4PagePaginationArray {} /** * A schema used in schema validation */ -export interface SchemaCreateResponse { - created_at: string; - - /** - * The kind of the schema - */ - kind: 'openapi_v3'; - - /** - * A human-readable name for the schema - */ - name: string; - - /** - * A unique identifier of this schema - */ - schema_id: string; - - /** - * The raw schema, e.g., the OpenAPI schema, either as JSON or YAML - */ - source: string; - - /** - * An indicator if this schema is enabled - */ - validation_enabled?: boolean; -} - -/** - * A schema used in schema validation - */ -export interface SchemaListResponse { +export interface PublicSchema { created_at: string; /** @@ -202,71 +171,7 @@ export interface SchemaDeleteResponse { /** * The ID of the schema that was just deleted */ - schema_id: string; -} - -/** - * A schema used in schema validation - */ -export interface SchemaEditResponse { - created_at: string; - - /** - * The kind of the schema - */ - kind: 'openapi_v3'; - - /** - * A human-readable name for the schema - */ - name: string; - - /** - * A unique identifier of this schema - */ - schema_id: string; - - /** - * The raw schema, e.g., the OpenAPI schema, either as JSON or YAML - */ - source: string; - - /** - * An indicator if this schema is enabled - */ - validation_enabled?: boolean; -} - -/** - * A schema used in schema validation - */ -export interface SchemaGetResponse { - created_at: string; - - /** - * The kind of the schema - */ - kind: 'openapi_v3'; - - /** - * A human-readable name for the schema - */ - name: string; - - /** - * A unique identifier of this schema - */ - schema_id: string; - - /** - * The raw schema, e.g., the OpenAPI schema, either as JSON or YAML - */ - source: string; - - /** - * An indicator if this schema is enabled - */ - validation_enabled?: boolean; + id: string; } export interface SchemaCreateParams { @@ -344,16 +249,13 @@ export interface SchemaGetParams { omit_source?: boolean; } -Schemas.SchemaListResponsesV4PagePaginationArray = SchemaListResponsesV4PagePaginationArray; +Schemas.PublicSchemasV4PagePaginationArray = PublicSchemasV4PagePaginationArray; export declare namespace Schemas { export { - type SchemaCreateResponse as SchemaCreateResponse, - type SchemaListResponse as SchemaListResponse, + type PublicSchema as PublicSchema, type SchemaDeleteResponse as SchemaDeleteResponse, - type SchemaEditResponse as SchemaEditResponse, - type SchemaGetResponse as SchemaGetResponse, - SchemaListResponsesV4PagePaginationArray as SchemaListResponsesV4PagePaginationArray, + PublicSchemasV4PagePaginationArray as PublicSchemasV4PagePaginationArray, type SchemaCreateParams as SchemaCreateParams, type SchemaListParams as SchemaListParams, type SchemaDeleteParams as SchemaDeleteParams, diff --git a/src/resources/secrets-store/stores/secrets.ts b/src/resources/secrets-store/stores/secrets.ts index 1ab72e50dc..ec0ca694ed 100644 --- a/src/resources/secrets-store/stores/secrets.ts +++ b/src/resources/secrets-store/stores/secrets.ts @@ -18,7 +18,7 @@ export class Secrets extends APIResource { * body: [ * { * name: 'MY_API_KEY', - * scopes: ['workers', 'ai_gateway'], + * scopes: ['workers', 'ai_gateway', 'dex', 'access'], * value: 'api-token-secret-123', * }, * ], @@ -135,7 +135,7 @@ export class Secrets extends APIResource { * { * account_id: '985e105f4ecef8ad9ca31a8372d0c353', * name: 'MY_API_KEY', - * scopes: ['workers', 'ai_gateway'], + * scopes: ['workers', 'ai_gateway', 'dex', 'access'], * }, * ); * ``` diff --git a/src/resources/security-center/insights/insights.ts b/src/resources/security-center/insights/insights.ts index 1006bfe3bd..42ba05277e 100644 --- a/src/resources/security-center/insights/insights.ts +++ b/src/resources/security-center/insights/insights.ts @@ -122,7 +122,7 @@ export namespace InsightListResponse { issue_type?: IssuesAPI.IssueType; - payload?: unknown; + payload?: Issue.Payload; resolve_link?: string; @@ -136,6 +136,17 @@ export namespace InsightListResponse { timestamp?: string; } + + export namespace Issue { + export interface Payload { + /** + * Method used to detect insight + */ + detection_method?: string; + + zone_tag?: string; + } + } } export interface InsightDismissResponse { diff --git a/src/resources/shared.ts b/src/resources/shared.ts index 9f1502f6d4..0ccf097746 100644 --- a/src/resources/shared.ts +++ b/src/resources/shared.ts @@ -998,3 +998,5 @@ export class SubscriptionsSinglePage extends SinglePage {} export class TokensV4PagePaginationArray extends V4PagePaginationArray {} export class AuditLogsV4PagePaginationArray extends V4PagePaginationArray {} + +export class CloudflareTunnelsV4PagePaginationArray extends V4PagePaginationArray {} diff --git a/src/resources/spectrum/apps.ts b/src/resources/spectrum/apps.ts index d99c8c88c4..ffc5617994 100644 --- a/src/resources/spectrum/apps.ts +++ b/src/resources/spectrum/apps.ts @@ -358,10 +358,12 @@ export namespace AppUpdateResponse { } } -export type AppListResponse = Array | Array; +export type AppListResponse = + | AppListResponse.SpectrumConfigAppConfig + | AppListResponse.SpectrumConfigPaygoAppConfig; export namespace AppListResponse { - export interface UnionMember0 { + export interface SpectrumConfigAppConfig { /** * App identifier. */ @@ -448,7 +450,7 @@ export namespace AppListResponse { tls?: 'off' | 'flexible' | 'full' | 'strict'; } - export interface UnionMember1 { + export interface SpectrumConfigPaygoAppConfig { /** * App identifier. */ diff --git a/src/resources/ssl/certificate-packs/certificate-packs.ts b/src/resources/ssl/certificate-packs/certificate-packs.ts index 9ec84ff8a9..e3258266a7 100644 --- a/src/resources/ssl/certificate-packs/certificate-packs.ts +++ b/src/resources/ssl/certificate-packs/certificate-packs.ts @@ -194,11 +194,43 @@ export type Status = */ export type ValidationMethod = 'http' | 'cname' | 'txt'; +/** + * A certificate pack with all its properties. + */ export interface CertificatePackCreateResponse { /** * Identifier. */ - id?: string; + id: string; + + /** + * Array of certificates in this pack. + */ + certificates: Array; + + /** + * Comma separated list of valid host names for the certificate packs. Must contain + * the zone apex, may not contain more than 50 hosts, and may not be empty. + */ + hosts: Array; + + /** + * Status of certificate pack. + */ + status: Status; + + /** + * Type of certificate pack. + */ + type: + | 'mh_custom' + | 'managed_hostname' + | 'sni_custom' + | 'universal' + | 'advanced' + | 'total_tls' + | 'keyless' + | 'legacy_custom'; /** * Certificate Authority selected for the order. For information on any certificate @@ -213,21 +245,179 @@ export interface CertificatePackCreateResponse { */ cloudflare_branding?: boolean; + /** + * Identifier of the primary certificate in a pack. + */ + primary_certificate?: string; + + /** + * Domain validation errors that have been received by the certificate authority + * (CA). + */ + validation_errors?: Array; + + /** + * Validation Method selected for the order. + */ + validation_method?: 'txt' | 'http' | 'email'; + + /** + * Certificates' validation records. + */ + validation_records?: Array; + + /** + * Validity Days selected for the order. + */ + validity_days?: 14 | 30 | 90 | 365; +} + +export namespace CertificatePackCreateResponse { + /** + * An individual certificate within a certificate pack. + */ + export interface Certificate { + /** + * Certificate identifier. + */ + id: string; + + /** + * Hostnames covered by this certificate. + */ + hosts: Array; + + /** + * Certificate status. + */ + status: string; + + /** + * Certificate bundle method. + */ + bundle_method?: string; + + /** + * When the certificate from the authority expires. + */ + expires_on?: string; + + /** + * Specify the region where your private key can be held locally. + */ + geo_restrictions?: Certificate.GeoRestrictions; + + /** + * The certificate authority that issued the certificate. + */ + issuer?: string; + + /** + * When the certificate was last modified. + */ + modified_on?: string; + + /** + * The order/priority in which the certificate will be used. + */ + priority?: number; + + /** + * The type of hash used for the certificate. + */ + signature?: string; + + /** + * When the certificate was uploaded to Cloudflare. + */ + uploaded_on?: string; + + /** + * Identifier. + */ + zone_id?: string; + } + + export namespace Certificate { + /** + * Specify the region where your private key can be held locally. + */ + export interface GeoRestrictions { + label?: 'us' | 'eu' | 'highest_security'; + } + } + + export interface ValidationError { + /** + * A domain validation error. + */ + message?: string; + } + + /** + * Certificate's required validation record. + */ + export interface ValidationRecord { + /** + * The set of email addresses that the certificate authority (CA) will use to + * complete domain validation. + */ + emails?: Array; + + /** + * The content that the certificate authority (CA) will expect to find at the + * http_url during the domain validation. + */ + http_body?: string; + + /** + * The url that will be checked during domain validation. + */ + http_url?: string; + + /** + * The hostname that the certificate authority (CA) will check for a TXT record + * during domain validation . + */ + txt_name?: string; + + /** + * The TXT record that the certificate authority (CA) will check during domain + * validation. + */ + txt_value?: string; + } +} + +/** + * A certificate pack with all its properties. + */ +export interface CertificatePackListResponse { + /** + * Identifier. + */ + id: string; + + /** + * Array of certificates in this pack. + */ + certificates: Array; + /** * Comma separated list of valid host names for the certificate packs. Must contain * the zone apex, may not contain more than 50 hosts, and may not be empty. */ - hosts?: Array; + hosts: Array; /** * Status of certificate pack. */ - status?: Status; + status: Status; /** * Type of certificate pack. */ - type?: + type: | 'mh_custom' | 'managed_hostname' | 'sni_custom' @@ -237,11 +427,29 @@ export interface CertificatePackCreateResponse { | 'keyless' | 'legacy_custom'; + /** + * Certificate Authority selected for the order. For information on any certificate + * authority specific details or restrictions + * [see this page for more details.](https://developers.cloudflare.com/ssl/reference/certificate-authorities) + */ + certificate_authority?: 'google' | 'lets_encrypt' | 'ssl_com'; + + /** + * Whether or not to add Cloudflare Branding for the order. This will add a + * subdomain of sni.cloudflaressl.com as the Common Name if set to true. + */ + cloudflare_branding?: boolean; + + /** + * Identifier of the primary certificate in a pack. + */ + primary_certificate?: string; + /** * Domain validation errors that have been received by the certificate authority * (CA). */ - validation_errors?: Array; + validation_errors?: Array; /** * Validation Method selected for the order. @@ -249,10 +457,9 @@ export interface CertificatePackCreateResponse { validation_method?: 'txt' | 'http' | 'email'; /** - * Certificates' validation records. Only present when certificate pack is in - * "pending_validation" status + * Certificates' validation records. */ - validation_records?: Array; + validation_records?: Array; /** * Validity Days selected for the order. @@ -260,7 +467,81 @@ export interface CertificatePackCreateResponse { validity_days?: 14 | 30 | 90 | 365; } -export namespace CertificatePackCreateResponse { +export namespace CertificatePackListResponse { + /** + * An individual certificate within a certificate pack. + */ + export interface Certificate { + /** + * Certificate identifier. + */ + id: string; + + /** + * Hostnames covered by this certificate. + */ + hosts: Array; + + /** + * Certificate status. + */ + status: string; + + /** + * Certificate bundle method. + */ + bundle_method?: string; + + /** + * When the certificate from the authority expires. + */ + expires_on?: string; + + /** + * Specify the region where your private key can be held locally. + */ + geo_restrictions?: Certificate.GeoRestrictions; + + /** + * The certificate authority that issued the certificate. + */ + issuer?: string; + + /** + * When the certificate was last modified. + */ + modified_on?: string; + + /** + * The order/priority in which the certificate will be used. + */ + priority?: number; + + /** + * The type of hash used for the certificate. + */ + signature?: string; + + /** + * When the certificate was uploaded to Cloudflare. + */ + uploaded_on?: string; + + /** + * Identifier. + */ + zone_id?: string; + } + + export namespace Certificate { + /** + * Specify the region where your private key can be held locally. + */ + export interface GeoRestrictions { + label?: 'us' | 'eu' | 'highest_security'; + } + } + export interface ValidationError { /** * A domain validation error. @@ -303,8 +584,6 @@ export namespace CertificatePackCreateResponse { } } -export type CertificatePackListResponse = unknown; - export interface CertificatePackDeleteResponse { /** * Identifier. @@ -312,11 +591,43 @@ export interface CertificatePackDeleteResponse { id?: string; } +/** + * A certificate pack with all its properties. + */ export interface CertificatePackEditResponse { /** * Identifier. */ - id?: string; + id: string; + + /** + * Array of certificates in this pack. + */ + certificates: Array; + + /** + * Comma separated list of valid host names for the certificate packs. Must contain + * the zone apex, may not contain more than 50 hosts, and may not be empty. + */ + hosts: Array; + + /** + * Status of certificate pack. + */ + status: Status; + + /** + * Type of certificate pack. + */ + type: + | 'mh_custom' + | 'managed_hostname' + | 'sni_custom' + | 'universal' + | 'advanced' + | 'total_tls' + | 'keyless' + | 'legacy_custom'; /** * Certificate Authority selected for the order. For information on any certificate @@ -331,21 +642,179 @@ export interface CertificatePackEditResponse { */ cloudflare_branding?: boolean; + /** + * Identifier of the primary certificate in a pack. + */ + primary_certificate?: string; + + /** + * Domain validation errors that have been received by the certificate authority + * (CA). + */ + validation_errors?: Array; + + /** + * Validation Method selected for the order. + */ + validation_method?: 'txt' | 'http' | 'email'; + + /** + * Certificates' validation records. + */ + validation_records?: Array; + + /** + * Validity Days selected for the order. + */ + validity_days?: 14 | 30 | 90 | 365; +} + +export namespace CertificatePackEditResponse { + /** + * An individual certificate within a certificate pack. + */ + export interface Certificate { + /** + * Certificate identifier. + */ + id: string; + + /** + * Hostnames covered by this certificate. + */ + hosts: Array; + + /** + * Certificate status. + */ + status: string; + + /** + * Certificate bundle method. + */ + bundle_method?: string; + + /** + * When the certificate from the authority expires. + */ + expires_on?: string; + + /** + * Specify the region where your private key can be held locally. + */ + geo_restrictions?: Certificate.GeoRestrictions; + + /** + * The certificate authority that issued the certificate. + */ + issuer?: string; + + /** + * When the certificate was last modified. + */ + modified_on?: string; + + /** + * The order/priority in which the certificate will be used. + */ + priority?: number; + + /** + * The type of hash used for the certificate. + */ + signature?: string; + + /** + * When the certificate was uploaded to Cloudflare. + */ + uploaded_on?: string; + + /** + * Identifier. + */ + zone_id?: string; + } + + export namespace Certificate { + /** + * Specify the region where your private key can be held locally. + */ + export interface GeoRestrictions { + label?: 'us' | 'eu' | 'highest_security'; + } + } + + export interface ValidationError { + /** + * A domain validation error. + */ + message?: string; + } + + /** + * Certificate's required validation record. + */ + export interface ValidationRecord { + /** + * The set of email addresses that the certificate authority (CA) will use to + * complete domain validation. + */ + emails?: Array; + + /** + * The content that the certificate authority (CA) will expect to find at the + * http_url during the domain validation. + */ + http_body?: string; + + /** + * The url that will be checked during domain validation. + */ + http_url?: string; + + /** + * The hostname that the certificate authority (CA) will check for a TXT record + * during domain validation . + */ + txt_name?: string; + + /** + * The TXT record that the certificate authority (CA) will check during domain + * validation. + */ + txt_value?: string; + } +} + +/** + * A certificate pack with all its properties. + */ +export interface CertificatePackGetResponse { + /** + * Identifier. + */ + id: string; + + /** + * Array of certificates in this pack. + */ + certificates: Array; + /** * Comma separated list of valid host names for the certificate packs. Must contain * the zone apex, may not contain more than 50 hosts, and may not be empty. */ - hosts?: Array; + hosts: Array; /** * Status of certificate pack. */ - status?: Status; + status: Status; /** * Type of certificate pack. */ - type?: + type: | 'mh_custom' | 'managed_hostname' | 'sni_custom' @@ -355,11 +824,29 @@ export interface CertificatePackEditResponse { | 'keyless' | 'legacy_custom'; + /** + * Certificate Authority selected for the order. For information on any certificate + * authority specific details or restrictions + * [see this page for more details.](https://developers.cloudflare.com/ssl/reference/certificate-authorities) + */ + certificate_authority?: 'google' | 'lets_encrypt' | 'ssl_com'; + + /** + * Whether or not to add Cloudflare Branding for the order. This will add a + * subdomain of sni.cloudflaressl.com as the Common Name if set to true. + */ + cloudflare_branding?: boolean; + + /** + * Identifier of the primary certificate in a pack. + */ + primary_certificate?: string; + /** * Domain validation errors that have been received by the certificate authority * (CA). */ - validation_errors?: Array; + validation_errors?: Array; /** * Validation Method selected for the order. @@ -367,10 +854,9 @@ export interface CertificatePackEditResponse { validation_method?: 'txt' | 'http' | 'email'; /** - * Certificates' validation records. Only present when certificate pack is in - * "pending_validation" status + * Certificates' validation records. */ - validation_records?: Array; + validation_records?: Array; /** * Validity Days selected for the order. @@ -378,7 +864,81 @@ export interface CertificatePackEditResponse { validity_days?: 14 | 30 | 90 | 365; } -export namespace CertificatePackEditResponse { +export namespace CertificatePackGetResponse { + /** + * An individual certificate within a certificate pack. + */ + export interface Certificate { + /** + * Certificate identifier. + */ + id: string; + + /** + * Hostnames covered by this certificate. + */ + hosts: Array; + + /** + * Certificate status. + */ + status: string; + + /** + * Certificate bundle method. + */ + bundle_method?: string; + + /** + * When the certificate from the authority expires. + */ + expires_on?: string; + + /** + * Specify the region where your private key can be held locally. + */ + geo_restrictions?: Certificate.GeoRestrictions; + + /** + * The certificate authority that issued the certificate. + */ + issuer?: string; + + /** + * When the certificate was last modified. + */ + modified_on?: string; + + /** + * The order/priority in which the certificate will be used. + */ + priority?: number; + + /** + * The type of hash used for the certificate. + */ + signature?: string; + + /** + * When the certificate was uploaded to Cloudflare. + */ + uploaded_on?: string; + + /** + * Identifier. + */ + zone_id?: string; + } + + export namespace Certificate { + /** + * Specify the region where your private key can be held locally. + */ + export interface GeoRestrictions { + label?: 'us' | 'eu' | 'highest_security'; + } + } + export interface ValidationError { /** * A domain validation error. @@ -421,8 +981,6 @@ export namespace CertificatePackEditResponse { } } -export type CertificatePackGetResponse = unknown; - export interface CertificatePackCreateParams { /** * Path param: Identifier. diff --git a/src/resources/stream/downloads.ts b/src/resources/stream/downloads.ts index a9d2589f13..1fd7a50c02 100644 --- a/src/resources/stream/downloads.ts +++ b/src/resources/stream/downloads.ts @@ -6,7 +6,8 @@ import * as Core from '../../core'; export class Downloads extends APIResource { /** * Creates a download for a video when a video is ready to view. Use - * `/downloads/{download_type}` instead for type-specific downloads. + * `/downloads/{download_type}` instead for type-specific downloads. Available + * types are `default` and `audio`. * * @example * ```ts @@ -35,7 +36,7 @@ export class Downloads extends APIResource { /** * Delete the downloads for a video. Use `/downloads/{download_type}` instead for - * type-specific downloads. + * type-specific downloads. Available types are `default` and `audio`. * * @example * ```ts diff --git a/src/resources/token-validation.ts b/src/resources/token-validation.ts new file mode 100644 index 0000000000..87665996ca --- /dev/null +++ b/src/resources/token-validation.ts @@ -0,0 +1,3 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export * from './token-validation/index'; diff --git a/src/resources/token-validation/configuration.ts b/src/resources/token-validation/configuration.ts new file mode 100644 index 0000000000..43ed080b36 --- /dev/null +++ b/src/resources/token-validation/configuration.ts @@ -0,0 +1,3 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export * from './configuration/index'; diff --git a/src/resources/token-validation/configuration/configuration.ts b/src/resources/token-validation/configuration/configuration.ts new file mode 100644 index 0000000000..a4e09be2f4 --- /dev/null +++ b/src/resources/token-validation/configuration/configuration.ts @@ -0,0 +1,518 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../resource'; +import * as Core from '../../../core'; +import * as CredentialsAPI from './credentials'; +import { + CredentialUpdateParams, + CredentialUpdateResponse, + Credentials as CredentialsAPICredentials, +} from './credentials'; +import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../../pagination'; + +export class Configuration extends APIResource { + credentials: CredentialsAPI.Credentials = new CredentialsAPI.Credentials(this._client); + + /** + * Create a new Token Validation configuration + * + * @example + * ```ts + * const tokenConfig = + * await client.tokenValidation.configuration.create({ + * zone_id: '023e105f4ecef8ad9ca31a8372d0c353', + * credentials: { + * keys: [ + * { + * alg: 'ES256', + * crv: 'P-256', + * kid: '38013f13-c266-4eec-a72a-92ec92779f21', + * kty: 'EC', + * x: 'KN53JRwN3wCjm2o39bvZUX2VdrsHzS8pxOAGjm8m7EQ', + * y: 'lnkkzIxaveggz-HFhcMWW15nxvOj0Z_uQsXbpK0GFcY', + * }, + * ], + * }, + * description: + * 'Long description for Token Validation Configuration', + * title: 'Example Token Validation Configuration', + * token_sources: [ + * 'http.request.headers["x-auth"][0]', + * 'http.request.cookies["Authorization"][0]', + * ], + * token_type: 'JWT', + * }); + * ``` + */ + create(params: ConfigurationCreateParams, options?: Core.RequestOptions): Core.APIPromise { + const { zone_id, ...body } = params; + return ( + this._client.post(`/zones/${zone_id}/token_validation/config`, { + body, + ...options, + }) as Core.APIPromise<{ result: TokenConfig }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Lists all token validation configurations for this zone + * + * @example + * ```ts + * // Automatically fetches more pages as needed. + * for await (const tokenConfig of client.tokenValidation.configuration.list( + * { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * )) { + * // ... + * } + * ``` + */ + list( + params: ConfigurationListParams, + options?: Core.RequestOptions, + ): Core.PagePromise { + const { zone_id, ...query } = params; + return this._client.getAPIList( + `/zones/${zone_id}/token_validation/config`, + TokenConfigsV4PagePaginationArray, + { query, ...options }, + ); + } + + /** + * Delete Token Configuration + * + * @example + * ```ts + * const configuration = + * await client.tokenValidation.configuration.delete( + * '4a7ee8d3-dd63-4ceb-9d5f-c27831854ce7', + * { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * ); + * ``` + */ + delete( + configId: string, + params: ConfigurationDeleteParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { zone_id } = params; + return ( + this._client.delete( + `/zones/${zone_id}/token_validation/config/${configId}`, + options, + ) as Core.APIPromise<{ result: ConfigurationDeleteResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Edit fields of an existing Token Configuration + * + * @example + * ```ts + * const response = + * await client.tokenValidation.configuration.edit( + * '4a7ee8d3-dd63-4ceb-9d5f-c27831854ce7', + * { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * ); + * ``` + */ + edit( + configId: string, + params: ConfigurationEditParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { zone_id, ...body } = params; + return ( + this._client.patch(`/zones/${zone_id}/token_validation/config/${configId}`, { + body, + ...options, + }) as Core.APIPromise<{ result: ConfigurationEditResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Get a single Token Configuration + * + * @example + * ```ts + * const tokenConfig = + * await client.tokenValidation.configuration.get( + * '4a7ee8d3-dd63-4ceb-9d5f-c27831854ce7', + * { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * ); + * ``` + */ + get( + configId: string, + params: ConfigurationGetParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { zone_id } = params; + return ( + this._client.get(`/zones/${zone_id}/token_validation/config/${configId}`, options) as Core.APIPromise<{ + result: TokenConfig; + }> + )._thenUnwrap((obj) => obj.result); + } +} + +export class TokenConfigsV4PagePaginationArray extends V4PagePaginationArray {} + +export interface TokenConfig { + /** + * UUID. + */ + id: string; + + created_at: string; + + credentials: TokenConfig.Credentials; + + description: string; + + last_updated: string; + + title: string; + + token_sources: Array; + + token_type: 'JWT'; +} + +export namespace TokenConfig { + export interface Credentials { + keys: Array< + | Credentials.APIShieldCredentialsJWTKeyRSA + | Credentials.APIShieldCredentialsJWTKeyEcEs256 + | Credentials.APIShieldCredentialsJWTKeyEcEs384 + >; + } + + export namespace Credentials { + /** + * JSON representation of an RSA key. + */ + export interface APIShieldCredentialsJWTKeyRSA { + /** + * Algorithm + */ + alg: 'RS256' | 'RS384' | 'RS512' | 'PS256' | 'PS384' | 'PS512'; + + /** + * RSA exponent + */ + e: string; + + /** + * Key ID + */ + kid: string; + + /** + * Key Type + */ + kty: 'RSA'; + + /** + * RSA modulus + */ + n: string; + } + + /** + * JSON representation of an ES256 key + */ + export interface APIShieldCredentialsJWTKeyEcEs256 { + /** + * Algorithm + */ + alg: 'ES256'; + + /** + * Curve + */ + crv: 'P-256'; + + /** + * Key ID + */ + kid: string; + + /** + * Key Type + */ + kty: 'EC'; + + /** + * X EC coordinate + */ + x: string; + + /** + * Y EC coordinate + */ + y: string; + } + + /** + * JSON representation of an ES384 key + */ + export interface APIShieldCredentialsJWTKeyEcEs384 { + /** + * Algorithm + */ + alg: 'ES384'; + + /** + * Curve + */ + crv: 'P-384'; + + /** + * Key ID + */ + kid: string; + + /** + * Key Type + */ + kty: 'EC'; + + /** + * X EC coordinate + */ + x: string; + + /** + * Y EC coordinate + */ + y: string; + } + } +} + +export interface ConfigurationDeleteResponse { + /** + * UUID. + */ + id?: string; +} + +export interface ConfigurationEditResponse { + description?: string; + + title?: string; + + token_sources?: Array; +} + +export interface ConfigurationCreateParams { + /** + * Path param: Identifier. + */ + zone_id: string; + + /** + * Body param: + */ + credentials: ConfigurationCreateParams.Credentials; + + /** + * Body param: + */ + description: string; + + /** + * Body param: + */ + title: string; + + /** + * Body param: + */ + token_sources: Array; + + /** + * Body param: + */ + token_type: 'JWT'; +} + +export namespace ConfigurationCreateParams { + export interface Credentials { + keys: Array< + | Credentials.APIShieldCredentialsJWTKeyRSA + | Credentials.APIShieldCredentialsJWTKeyEcEs256 + | Credentials.APIShieldCredentialsJWTKeyEcEs384 + >; + } + + export namespace Credentials { + /** + * JSON representation of an RSA key. + */ + export interface APIShieldCredentialsJWTKeyRSA { + /** + * Algorithm + */ + alg: 'RS256' | 'RS384' | 'RS512' | 'PS256' | 'PS384' | 'PS512'; + + /** + * RSA exponent + */ + e: string; + + /** + * Key ID + */ + kid: string; + + /** + * Key Type + */ + kty: 'RSA'; + + /** + * RSA modulus + */ + n: string; + } + + /** + * JSON representation of an ES256 key + */ + export interface APIShieldCredentialsJWTKeyEcEs256 { + /** + * Algorithm + */ + alg: 'ES256'; + + /** + * Curve + */ + crv: 'P-256'; + + /** + * Key ID + */ + kid: string; + + /** + * Key Type + */ + kty: 'EC'; + + /** + * X EC coordinate + */ + x: string; + + /** + * Y EC coordinate + */ + y: string; + } + + /** + * JSON representation of an ES384 key + */ + export interface APIShieldCredentialsJWTKeyEcEs384 { + /** + * Algorithm + */ + alg: 'ES384'; + + /** + * Curve + */ + crv: 'P-384'; + + /** + * Key ID + */ + kid: string; + + /** + * Key Type + */ + kty: 'EC'; + + /** + * X EC coordinate + */ + x: string; + + /** + * Y EC coordinate + */ + y: string; + } + } +} + +export interface ConfigurationListParams extends V4PagePaginationArrayParams { + /** + * Path param: Identifier. + */ + zone_id: string; +} + +export interface ConfigurationDeleteParams { + /** + * Identifier. + */ + zone_id: string; +} + +export interface ConfigurationEditParams { + /** + * Path param: Identifier. + */ + zone_id: string; + + /** + * Body param: + */ + description?: string; + + /** + * Body param: + */ + title?: string; + + /** + * Body param: + */ + token_sources?: Array; +} + +export interface ConfigurationGetParams { + /** + * Identifier. + */ + zone_id: string; +} + +Configuration.TokenConfigsV4PagePaginationArray = TokenConfigsV4PagePaginationArray; +Configuration.Credentials = CredentialsAPICredentials; + +export declare namespace Configuration { + export { + type TokenConfig as TokenConfig, + type ConfigurationDeleteResponse as ConfigurationDeleteResponse, + type ConfigurationEditResponse as ConfigurationEditResponse, + TokenConfigsV4PagePaginationArray as TokenConfigsV4PagePaginationArray, + type ConfigurationCreateParams as ConfigurationCreateParams, + type ConfigurationListParams as ConfigurationListParams, + type ConfigurationDeleteParams as ConfigurationDeleteParams, + type ConfigurationEditParams as ConfigurationEditParams, + type ConfigurationGetParams as ConfigurationGetParams, + }; + + export { + CredentialsAPICredentials as Credentials, + type CredentialUpdateResponse as CredentialUpdateResponse, + type CredentialUpdateParams as CredentialUpdateParams, + }; +} diff --git a/src/resources/token-validation/configuration/credentials.ts b/src/resources/token-validation/configuration/credentials.ts new file mode 100644 index 0000000000..447ee00ba5 --- /dev/null +++ b/src/resources/token-validation/configuration/credentials.ts @@ -0,0 +1,287 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../resource'; +import * as Core from '../../../core'; +import * as UserSchemasAPI from '../../api-gateway/user-schemas/user-schemas'; + +export class Credentials extends APIResource { + /** + * Update Token Configuration credentials + * + * @example + * ```ts + * const credential = + * await client.tokenValidation.configuration.credentials.update( + * '4a7ee8d3-dd63-4ceb-9d5f-c27831854ce7', + * { + * zone_id: '023e105f4ecef8ad9ca31a8372d0c353', + * keys: [ + * { + * alg: 'ES256', + * crv: 'P-256', + * kid: '38013f13-c266-4eec-a72a-92ec92779f21', + * kty: 'EC', + * x: 'KN53JRwN3wCjm2o39bvZUX2VdrsHzS8pxOAGjm8m7EQ', + * y: 'lnkkzIxaveggz-HFhcMWW15nxvOj0Z_uQsXbpK0GFcY', + * }, + * ], + * }, + * ); + * ``` + */ + update( + configId: string, + params: CredentialUpdateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { zone_id, ...body } = params; + return this._client.put(`/zones/${zone_id}/token_validation/config/${configId}/credentials`, { + body, + ...options, + }); + } +} + +export interface CredentialUpdateResponse { + errors: UserSchemasAPI.Message; + + keys: Array< + | CredentialUpdateResponse.APIShieldCredentialsJWTKeyRSA + | CredentialUpdateResponse.APIShieldCredentialsJWTKeyEcEs256 + | CredentialUpdateResponse.APIShieldCredentialsJWTKeyEcEs384 + >; + + messages: UserSchemasAPI.Message; + + /** + * Whether the API call was successful. + */ + success: true; +} + +export namespace CredentialUpdateResponse { + /** + * JSON representation of an RSA key. + */ + export interface APIShieldCredentialsJWTKeyRSA { + /** + * Algorithm + */ + alg: 'RS256' | 'RS384' | 'RS512' | 'PS256' | 'PS384' | 'PS512'; + + /** + * RSA exponent + */ + e: string; + + /** + * Key ID + */ + kid: string; + + /** + * Key Type + */ + kty: 'RSA'; + + /** + * RSA modulus + */ + n: string; + } + + /** + * JSON representation of an ES256 key + */ + export interface APIShieldCredentialsJWTKeyEcEs256 { + /** + * Algorithm + */ + alg: 'ES256'; + + /** + * Curve + */ + crv: 'P-256'; + + /** + * Key ID + */ + kid: string; + + /** + * Key Type + */ + kty: 'EC'; + + /** + * X EC coordinate + */ + x: string; + + /** + * Y EC coordinate + */ + y: string; + } + + /** + * JSON representation of an ES384 key + */ + export interface APIShieldCredentialsJWTKeyEcEs384 { + /** + * Algorithm + */ + alg: 'ES384'; + + /** + * Curve + */ + crv: 'P-384'; + + /** + * Key ID + */ + kid: string; + + /** + * Key Type + */ + kty: 'EC'; + + /** + * X EC coordinate + */ + x: string; + + /** + * Y EC coordinate + */ + y: string; + } +} + +export interface CredentialUpdateParams { + /** + * Path param: Identifier. + */ + zone_id: string; + + /** + * Body param: + */ + keys: Array< + | CredentialUpdateParams.APIShieldCredentialsJWTKeyRSA + | CredentialUpdateParams.APIShieldCredentialsJWTKeyEcEs256 + | CredentialUpdateParams.APIShieldCredentialsJWTKeyEcEs384 + >; +} + +export namespace CredentialUpdateParams { + /** + * JSON representation of an RSA key. + */ + export interface APIShieldCredentialsJWTKeyRSA { + /** + * Algorithm + */ + alg: 'RS256' | 'RS384' | 'RS512' | 'PS256' | 'PS384' | 'PS512'; + + /** + * RSA exponent + */ + e: string; + + /** + * Key ID + */ + kid: string; + + /** + * Key Type + */ + kty: 'RSA'; + + /** + * RSA modulus + */ + n: string; + } + + /** + * JSON representation of an ES256 key + */ + export interface APIShieldCredentialsJWTKeyEcEs256 { + /** + * Algorithm + */ + alg: 'ES256'; + + /** + * Curve + */ + crv: 'P-256'; + + /** + * Key ID + */ + kid: string; + + /** + * Key Type + */ + kty: 'EC'; + + /** + * X EC coordinate + */ + x: string; + + /** + * Y EC coordinate + */ + y: string; + } + + /** + * JSON representation of an ES384 key + */ + export interface APIShieldCredentialsJWTKeyEcEs384 { + /** + * Algorithm + */ + alg: 'ES384'; + + /** + * Curve + */ + crv: 'P-384'; + + /** + * Key ID + */ + kid: string; + + /** + * Key Type + */ + kty: 'EC'; + + /** + * X EC coordinate + */ + x: string; + + /** + * Y EC coordinate + */ + y: string; + } +} + +export declare namespace Credentials { + export { + type CredentialUpdateResponse as CredentialUpdateResponse, + type CredentialUpdateParams as CredentialUpdateParams, + }; +} diff --git a/src/resources/token-validation/configuration/index.ts b/src/resources/token-validation/configuration/index.ts new file mode 100644 index 0000000000..926e2265b2 --- /dev/null +++ b/src/resources/token-validation/configuration/index.ts @@ -0,0 +1,15 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { Credentials, type CredentialUpdateResponse, type CredentialUpdateParams } from './credentials'; +export { + TokenConfigsV4PagePaginationArray, + Configuration, + type TokenConfig, + type ConfigurationDeleteResponse, + type ConfigurationEditResponse, + type ConfigurationCreateParams, + type ConfigurationListParams, + type ConfigurationDeleteParams, + type ConfigurationEditParams, + type ConfigurationGetParams, +} from './configuration'; diff --git a/src/resources/token-validation/index.ts b/src/resources/token-validation/index.ts new file mode 100644 index 0000000000..47b6bfc852 --- /dev/null +++ b/src/resources/token-validation/index.ts @@ -0,0 +1,29 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { + TokenConfigsV4PagePaginationArray, + Configuration, + type TokenConfig, + type ConfigurationDeleteResponse, + type ConfigurationEditResponse, + type ConfigurationCreateParams, + type ConfigurationListParams, + type ConfigurationDeleteParams, + type ConfigurationEditParams, + type ConfigurationGetParams, +} from './configuration/index'; +export { TokenValidation } from './token-validation'; +export { + TokenValidationRulesV4PagePaginationArray, + TokenValidationRulesSinglePage, + Rules, + type TokenValidationRule, + type RuleDeleteResponse, + type RuleCreateParams, + type RuleListParams, + type RuleDeleteParams, + type RuleBulkCreateParams, + type RuleBulkEditParams, + type RuleEditParams, + type RuleGetParams, +} from './rules'; diff --git a/src/resources/token-validation/rules.ts b/src/resources/token-validation/rules.ts new file mode 100644 index 0000000000..bfd7e857b0 --- /dev/null +++ b/src/resources/token-validation/rules.ts @@ -0,0 +1,794 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../resource'; +import * as Core from '../../core'; +import { SinglePage, V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../pagination'; + +export class Rules extends APIResource { + /** + * Create a token validation rule. + * + * @example + * ```ts + * const tokenValidationRule = + * await client.tokenValidation.rules.create({ + * zone_id: '023e105f4ecef8ad9ca31a8372d0c353', + * action: 'log', + * description: + * 'Long description for Token Validation Rule', + * enabled: true, + * expression: + * 'is_jwt_valid("52973293-cb04-4a97-8f55-e7d2ad1107dd") or is_jwt_valid("46eab8d1-6376-45e3-968f-2c649d77d423")', + * selector: {}, + * title: 'Example Token Validation Rule', + * }); + * ``` + */ + create(params: RuleCreateParams, options?: Core.RequestOptions): Core.APIPromise { + const { zone_id, ...body } = params; + return ( + this._client.post(`/zones/${zone_id}/token_validation/rules`, { body, ...options }) as Core.APIPromise<{ + result: TokenValidationRule; + }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * List token validation rules + * + * @example + * ```ts + * // Automatically fetches more pages as needed. + * for await (const tokenValidationRule of client.tokenValidation.rules.list( + * { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * )) { + * // ... + * } + * ``` + */ + list( + params: RuleListParams, + options?: Core.RequestOptions, + ): Core.PagePromise { + const { zone_id, ...query } = params; + return this._client.getAPIList( + `/zones/${zone_id}/token_validation/rules`, + TokenValidationRulesV4PagePaginationArray, + { query, ...options }, + ); + } + + /** + * Delete a zone token validation rule. + * + * @example + * ```ts + * const rule = await client.tokenValidation.rules.delete( + * '4a7ee8d3-dd63-4ceb-9d5f-c27831854ce7', + * { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * ); + * ``` + */ + delete( + ruleId: string, + params: RuleDeleteParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { zone_id } = params; + return ( + this._client.delete(`/zones/${zone_id}/token_validation/rules/${ruleId}`, options) as Core.APIPromise<{ + result: RuleDeleteResponse; + }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Create zone token validation rules. + * + * A request can create multiple Token Validation Rules. + * + * @example + * ```ts + * // Automatically fetches more pages as needed. + * for await (const tokenValidationRule of client.tokenValidation.rules.bulkCreate( + * { + * zone_id: '023e105f4ecef8ad9ca31a8372d0c353', + * body: [ + * { + * action: 'log', + * description: + * 'Long description for Token Validation Rule', + * enabled: true, + * expression: + * 'is_jwt_valid("52973293-cb04-4a97-8f55-e7d2ad1107dd") or is_jwt_valid("46eab8d1-6376-45e3-968f-2c649d77d423")', + * selector: {}, + * title: 'Example Token Validation Rule', + * }, + * ], + * }, + * )) { + * // ... + * } + * ``` + */ + bulkCreate( + params: RuleBulkCreateParams, + options?: Core.RequestOptions, + ): Core.PagePromise { + const { zone_id, body } = params; + return this._client.getAPIList( + `/zones/${zone_id}/token_validation/rules/bulk`, + TokenValidationRulesSinglePage, + { body: body, method: 'post', ...options }, + ); + } + + /** + * Edit token validation rules. + * + * A request can update multiple Token Validation Rules. + * + * Rules can be re-ordered using the `position` field. + * + * Returns all updated rules. + * + * @example + * ```ts + * // Automatically fetches more pages as needed. + * for await (const tokenValidationRule of client.tokenValidation.rules.bulkEdit( + * { + * zone_id: '023e105f4ecef8ad9ca31a8372d0c353', + * body: [{ id: '0d9bf70c-92e1-4bb3-9411-34a3bcc59003' }], + * }, + * )) { + * // ... + * } + * ``` + */ + bulkEdit( + params: RuleBulkEditParams, + options?: Core.RequestOptions, + ): Core.PagePromise { + const { zone_id, body } = params; + return this._client.getAPIList( + `/zones/${zone_id}/token_validation/rules/bulk`, + TokenValidationRulesSinglePage, + { body: body, method: 'patch', ...options }, + ); + } + + /** + * Edit a zone token validation rule. + * + * @example + * ```ts + * const tokenValidationRule = + * await client.tokenValidation.rules.edit( + * '4a7ee8d3-dd63-4ceb-9d5f-c27831854ce7', + * { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * ); + * ``` + */ + edit( + ruleId: string, + params: RuleEditParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { zone_id, ...body } = params; + return ( + this._client.patch(`/zones/${zone_id}/token_validation/rules/${ruleId}`, { + body, + ...options, + }) as Core.APIPromise<{ result: TokenValidationRule }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Get a zone token validation rule. + * + * @example + * ```ts + * const tokenValidationRule = + * await client.tokenValidation.rules.get( + * '4a7ee8d3-dd63-4ceb-9d5f-c27831854ce7', + * { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * ); + * ``` + */ + get( + ruleId: string, + params: RuleGetParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { zone_id } = params; + return ( + this._client.get(`/zones/${zone_id}/token_validation/rules/${ruleId}`, options) as Core.APIPromise<{ + result: TokenValidationRule; + }> + )._thenUnwrap((obj) => obj.result); + } +} + +export class TokenValidationRulesV4PagePaginationArray extends V4PagePaginationArray {} + +export class TokenValidationRulesSinglePage extends SinglePage {} + +/** + * A Token Validation rule that can enforce security policies using JWT Tokens. + */ +export interface TokenValidationRule { + /** + * Action to take on requests that match operations included in `selector` and fail + * `expression`. + */ + action: 'log' | 'block'; + + /** + * A human-readable description that gives more details than `title`. + */ + description: string; + + /** + * Toggle rule on or off. + */ + enabled: boolean; + + /** + * Rule expression. Requests that fail to match this expression will be subject to + * `action`. + * + * For details on expressions, see the + * [Cloudflare Docs](https://developers.cloudflare.com/api-shield/security/jwt-validation/). + */ + expression: string; + + /** + * Select operations covered by this rule. + * + * For details on selectors, see the + * [Cloudflare Docs](https://developers.cloudflare.com/api-shield/security/jwt-validation/). + */ + selector: TokenValidationRule.Selector; + + /** + * A human-readable name for the rule. + */ + title: string; + + /** + * UUID. + */ + id?: string; + + created_at?: string; + + last_updated?: string; +} + +export namespace TokenValidationRule { + /** + * Select operations covered by this rule. + * + * For details on selectors, see the + * [Cloudflare Docs](https://developers.cloudflare.com/api-shield/security/jwt-validation/). + */ + export interface Selector { + /** + * Ignore operations that were otherwise included by `include`. + */ + exclude?: Array | null; + + /** + * Select all matching operations. + */ + include?: Array | null; + } + + export namespace Selector { + export interface Exclude { + /** + * Excluded operation IDs. + */ + operation_ids?: Array; + } + + export interface Include { + /** + * Included hostnames. + */ + host?: Array; + } + } +} + +export type RuleDeleteResponse = unknown; + +export interface RuleCreateParams { + /** + * Path param: Identifier. + */ + zone_id: string; + + /** + * Body param: Action to take on requests that match operations included in + * `selector` and fail `expression`. + */ + action: 'log' | 'block'; + + /** + * Body param: A human-readable description that gives more details than `title`. + */ + description: string; + + /** + * Body param: Toggle rule on or off. + */ + enabled: boolean; + + /** + * Body param: Rule expression. Requests that fail to match this expression will be + * subject to `action`. + * + * For details on expressions, see the + * [Cloudflare Docs](https://developers.cloudflare.com/api-shield/security/jwt-validation/). + */ + expression: string; + + /** + * Body param: Select operations covered by this rule. + * + * For details on selectors, see the + * [Cloudflare Docs](https://developers.cloudflare.com/api-shield/security/jwt-validation/). + */ + selector: RuleCreateParams.Selector; + + /** + * Body param: A human-readable name for the rule. + */ + title: string; +} + +export namespace RuleCreateParams { + /** + * Select operations covered by this rule. + * + * For details on selectors, see the + * [Cloudflare Docs](https://developers.cloudflare.com/api-shield/security/jwt-validation/). + */ + export interface Selector { + /** + * Ignore operations that were otherwise included by `include`. + */ + exclude?: Array | null; + + /** + * Select all matching operations. + */ + include?: Array | null; + } + + export namespace Selector { + export interface Exclude { + /** + * Excluded operation IDs. + */ + operation_ids?: Array; + } + + export interface Include { + /** + * Included hostnames. + */ + host?: Array; + } + } +} + +export interface RuleListParams extends V4PagePaginationArrayParams { + /** + * Path param: Identifier. + */ + zone_id: string; + + /** + * Query param: Select rules with these IDs. + */ + id?: string; + + /** + * Query param: Action to take on requests that match operations included in + * `selector` and fail `expression`. + */ + action?: 'log' | 'block'; + + /** + * Query param: Toggle rule on or off. + */ + enabled?: boolean; + + /** + * Query param: Select rules with this host in `include`. + */ + host?: string; + + /** + * Query param: Select rules with this host in `include`. + */ + hostname?: string; + + /** + * Query param: Select rules with these IDs. + */ + rule_id?: string; + + /** + * Query param: Select rules using any of these token configurations. + */ + token_configuration?: Array; +} + +export interface RuleDeleteParams { + /** + * Identifier. + */ + zone_id: string; +} + +export interface RuleBulkCreateParams { + /** + * Path param: Identifier. + */ + zone_id: string; + + /** + * Body param: + */ + body: Array; +} + +export namespace RuleBulkCreateParams { + /** + * A Token Validation rule that can enforce security policies using JWT Tokens. + */ + export interface Body { + /** + * Action to take on requests that match operations included in `selector` and fail + * `expression`. + */ + action: 'log' | 'block'; + + /** + * A human-readable description that gives more details than `title`. + */ + description: string; + + /** + * Toggle rule on or off. + */ + enabled: boolean; + + /** + * Rule expression. Requests that fail to match this expression will be subject to + * `action`. + * + * For details on expressions, see the + * [Cloudflare Docs](https://developers.cloudflare.com/api-shield/security/jwt-validation/). + */ + expression: string; + + /** + * Select operations covered by this rule. + * + * For details on selectors, see the + * [Cloudflare Docs](https://developers.cloudflare.com/api-shield/security/jwt-validation/). + */ + selector: Body.Selector; + + /** + * A human-readable name for the rule. + */ + title: string; + } + + export namespace Body { + /** + * Select operations covered by this rule. + * + * For details on selectors, see the + * [Cloudflare Docs](https://developers.cloudflare.com/api-shield/security/jwt-validation/). + */ + export interface Selector { + /** + * Ignore operations that were otherwise included by `include`. + */ + exclude?: Array | null; + + /** + * Select all matching operations. + */ + include?: Array | null; + } + + export namespace Selector { + export interface Exclude { + /** + * Excluded operation IDs. + */ + operation_ids?: Array; + } + + export interface Include { + /** + * Included hostnames. + */ + host?: Array; + } + } + } +} + +export interface RuleBulkEditParams { + /** + * Path param: Identifier. + */ + zone_id: string; + + /** + * Body param: + */ + body: Array; +} + +export namespace RuleBulkEditParams { + export interface Body { + /** + * Rule ID this patch applies to + */ + id: string; + + /** + * Action to take on requests that match operations included in `selector` and fail + * `expression`. + */ + action?: 'log' | 'block'; + + /** + * A human-readable description that gives more details than `title`. + */ + description?: string; + + /** + * Toggle rule on or off. + */ + enabled?: boolean; + + /** + * Rule expression. Requests that fail to match this expression will be subject to + * `action`. + * + * For details on expressions, see the + * [Cloudflare Docs](https://developers.cloudflare.com/api-shield/security/jwt-validation/). + */ + expression?: string; + + /** + * Update rule order among zone rules. + */ + position?: Body.APIShieldIndex | Body.APIShieldBefore | Body.APIShieldAfter; + + /** + * Select operations covered by this rule. + * + * For details on selectors, see the + * [Cloudflare Docs](https://developers.cloudflare.com/api-shield/security/jwt-validation/). + */ + selector?: Body.Selector; + + /** + * A human-readable name for the rule. + */ + title?: string; + } + + export namespace Body { + export interface APIShieldIndex { + /** + * Move rule to this position + */ + index: number; + } + + /** + * Move rule to after rule with ID. + */ + export interface APIShieldBefore { + /** + * Move rule to before rule with this ID. + */ + before?: string; + } + + /** + * Move rule to before rule with ID. + */ + export interface APIShieldAfter { + /** + * Move rule to after rule with this ID. + */ + after?: string; + } + + /** + * Select operations covered by this rule. + * + * For details on selectors, see the + * [Cloudflare Docs](https://developers.cloudflare.com/api-shield/security/jwt-validation/). + */ + export interface Selector { + /** + * Ignore operations that were otherwise included by `include`. + */ + exclude?: Array | null; + + /** + * Select all matching operations. + */ + include?: Array | null; + } + + export namespace Selector { + export interface Exclude { + /** + * Excluded operation IDs. + */ + operation_ids?: Array; + } + + export interface Include { + /** + * Included hostnames. + */ + host?: Array; + } + } + } +} + +export interface RuleEditParams { + /** + * Path param: Identifier. + */ + zone_id: string; + + /** + * Body param: Action to take on requests that match operations included in + * `selector` and fail `expression`. + */ + action?: 'log' | 'block'; + + /** + * Body param: A human-readable description that gives more details than `title`. + */ + description?: string; + + /** + * Body param: Toggle rule on or off. + */ + enabled?: boolean; + + /** + * Body param: Rule expression. Requests that fail to match this expression will be + * subject to `action`. + * + * For details on expressions, see the + * [Cloudflare Docs](https://developers.cloudflare.com/api-shield/security/jwt-validation/). + */ + expression?: string; + + /** + * Body param: Update rule order among zone rules. + */ + position?: RuleEditParams.APIShieldIndex | RuleEditParams.APIShieldBefore | RuleEditParams.APIShieldAfter; + + /** + * Body param: Select operations covered by this rule. + * + * For details on selectors, see the + * [Cloudflare Docs](https://developers.cloudflare.com/api-shield/security/jwt-validation/). + */ + selector?: RuleEditParams.Selector; + + /** + * Body param: A human-readable name for the rule. + */ + title?: string; +} + +export namespace RuleEditParams { + export interface APIShieldIndex { + /** + * Move rule to this position + */ + index: number; + } + + /** + * Move rule to after rule with ID. + */ + export interface APIShieldBefore { + /** + * Move rule to before rule with this ID. + */ + before?: string; + } + + /** + * Move rule to before rule with ID. + */ + export interface APIShieldAfter { + /** + * Move rule to after rule with this ID. + */ + after?: string; + } + + /** + * Select operations covered by this rule. + * + * For details on selectors, see the + * [Cloudflare Docs](https://developers.cloudflare.com/api-shield/security/jwt-validation/). + */ + export interface Selector { + /** + * Ignore operations that were otherwise included by `include`. + */ + exclude?: Array | null; + + /** + * Select all matching operations. + */ + include?: Array | null; + } + + export namespace Selector { + export interface Exclude { + /** + * Excluded operation IDs. + */ + operation_ids?: Array; + } + + export interface Include { + /** + * Included hostnames. + */ + host?: Array; + } + } +} + +export interface RuleGetParams { + /** + * Identifier. + */ + zone_id: string; +} + +Rules.TokenValidationRulesV4PagePaginationArray = TokenValidationRulesV4PagePaginationArray; +Rules.TokenValidationRulesSinglePage = TokenValidationRulesSinglePage; + +export declare namespace Rules { + export { + type TokenValidationRule as TokenValidationRule, + type RuleDeleteResponse as RuleDeleteResponse, + TokenValidationRulesV4PagePaginationArray as TokenValidationRulesV4PagePaginationArray, + TokenValidationRulesSinglePage as TokenValidationRulesSinglePage, + type RuleCreateParams as RuleCreateParams, + type RuleListParams as RuleListParams, + type RuleDeleteParams as RuleDeleteParams, + type RuleBulkCreateParams as RuleBulkCreateParams, + type RuleBulkEditParams as RuleBulkEditParams, + type RuleEditParams as RuleEditParams, + type RuleGetParams as RuleGetParams, + }; +} diff --git a/src/resources/token-validation/token-validation.ts b/src/resources/token-validation/token-validation.ts new file mode 100644 index 0000000000..7d68e71fb4 --- /dev/null +++ b/src/resources/token-validation/token-validation.ts @@ -0,0 +1,72 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../resource'; +import * as RulesAPI from './rules'; +import { + RuleBulkCreateParams, + RuleBulkEditParams, + RuleCreateParams, + RuleDeleteParams, + RuleDeleteResponse, + RuleEditParams, + RuleGetParams, + RuleListParams, + Rules, + TokenValidationRule, + TokenValidationRulesSinglePage, + TokenValidationRulesV4PagePaginationArray, +} from './rules'; +import * as ConfigurationAPI from './configuration/configuration'; +import { + Configuration, + ConfigurationCreateParams, + ConfigurationDeleteParams, + ConfigurationDeleteResponse, + ConfigurationEditParams, + ConfigurationEditResponse, + ConfigurationGetParams, + ConfigurationListParams, + TokenConfig, + TokenConfigsV4PagePaginationArray, +} from './configuration/configuration'; + +export class TokenValidation extends APIResource { + configuration: ConfigurationAPI.Configuration = new ConfigurationAPI.Configuration(this._client); + rules: RulesAPI.Rules = new RulesAPI.Rules(this._client); +} + +TokenValidation.Configuration = Configuration; +TokenValidation.TokenConfigsV4PagePaginationArray = TokenConfigsV4PagePaginationArray; +TokenValidation.Rules = Rules; +TokenValidation.TokenValidationRulesV4PagePaginationArray = TokenValidationRulesV4PagePaginationArray; +TokenValidation.TokenValidationRulesSinglePage = TokenValidationRulesSinglePage; + +export declare namespace TokenValidation { + export { + Configuration as Configuration, + type TokenConfig as TokenConfig, + type ConfigurationDeleteResponse as ConfigurationDeleteResponse, + type ConfigurationEditResponse as ConfigurationEditResponse, + TokenConfigsV4PagePaginationArray as TokenConfigsV4PagePaginationArray, + type ConfigurationCreateParams as ConfigurationCreateParams, + type ConfigurationListParams as ConfigurationListParams, + type ConfigurationDeleteParams as ConfigurationDeleteParams, + type ConfigurationEditParams as ConfigurationEditParams, + type ConfigurationGetParams as ConfigurationGetParams, + }; + + export { + Rules as Rules, + type TokenValidationRule as TokenValidationRule, + type RuleDeleteResponse as RuleDeleteResponse, + TokenValidationRulesV4PagePaginationArray as TokenValidationRulesV4PagePaginationArray, + TokenValidationRulesSinglePage as TokenValidationRulesSinglePage, + type RuleCreateParams as RuleCreateParams, + type RuleListParams as RuleListParams, + type RuleDeleteParams as RuleDeleteParams, + type RuleBulkCreateParams as RuleBulkCreateParams, + type RuleBulkEditParams as RuleBulkEditParams, + type RuleEditParams as RuleEditParams, + type RuleGetParams as RuleGetParams, + }; +} diff --git a/src/resources/workers-for-platforms/dispatch/namespaces/scripts/bindings.ts b/src/resources/workers-for-platforms/dispatch/namespaces/scripts/bindings.ts index 8b15a53e2d..d2cb382d90 100644 --- a/src/resources/workers-for-platforms/dispatch/namespaces/scripts/bindings.ts +++ b/src/resources/workers-for-platforms/dispatch/namespaces/scripts/bindings.ts @@ -63,7 +63,6 @@ export type BindingGetResponse = | BindingGetResponse.WorkersBindingKindSecretText | BindingGetResponse.WorkersBindingKindSendEmail | BindingGetResponse.WorkersBindingKindService - | BindingGetResponse.WorkersBindingKindTailConsumer | BindingGetResponse.WorkersBindingKindTextBlob | BindingGetResponse.WorkersBindingKindVectorize | BindingGetResponse.WorkersBindingKindVersionMetadata @@ -168,7 +167,7 @@ export namespace BindingGetResponse { name: string; /** - * Namespace to bind to. + * The name of the dispatch namespace. */ namespace: string; @@ -493,23 +492,6 @@ export namespace BindingGetResponse { environment?: string; } - export interface WorkersBindingKindTailConsumer { - /** - * A JavaScript variable name for the binding. - */ - name: string; - - /** - * Name of Tail Worker to bind to. - */ - service: string; - - /** - * The kind of resource that the binding provides. - */ - type: 'tail_consumer'; - } - export interface WorkersBindingKindTextBlob { /** * A JavaScript variable name for the binding. diff --git a/src/resources/workers-for-platforms/dispatch/namespaces/scripts/scripts.ts b/src/resources/workers-for-platforms/dispatch/namespaces/scripts/scripts.ts index 9170366dbd..8536843291 100644 --- a/src/resources/workers-for-platforms/dispatch/namespaces/scripts/scripts.ts +++ b/src/resources/workers-for-platforms/dispatch/namespaces/scripts/scripts.ts @@ -175,7 +175,7 @@ export interface ScriptUpdateResponse { startup_time_ms: number; /** - * The id of the script in the Workers system. Usually the script name. + * The name used to identify the script. */ id?: string; @@ -197,6 +197,11 @@ export interface ScriptUpdateResponse { */ created_on?: string; + /** + * The entry point for the script. + */ + entry_point?: string; + /** * Hashed script content, can be used in a If-None-Match header when updating. */ @@ -244,6 +249,11 @@ export interface ScriptUpdateResponse { */ named_handlers?: Array; + /** + * Observability settings for the Worker. + */ + observability?: ScriptUpdateResponse.Observability; + /** * Configuration for * [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). @@ -260,10 +270,20 @@ export interface ScriptUpdateResponse { */ placement_status?: 'SUCCESS' | 'UNSUPPORTED_APPLICATION' | 'INSUFFICIENT_INVOCATIONS'; + /** + * The immutable ID of the script. + */ + tag?: string; + + /** + * Tags associated with the Worker. + */ + tags?: Array | null; + /** * List of Workers that will consume logs from the attached Worker. */ - tail_consumers?: Array; + tail_consumers?: Array | null; /** * Usage model for the Worker invocations. @@ -284,6 +304,61 @@ export namespace ScriptUpdateResponse { name?: string; } + /** + * Observability settings for the Worker. + */ + export interface Observability { + /** + * Whether observability is enabled for the Worker. + */ + enabled: boolean; + + /** + * The sampling rate for incoming requests. From 0 to 1 (1 = 100%, 0.1 = 10%). + * Default is 1. + */ + head_sampling_rate?: number | null; + + /** + * Log settings for the Worker. + */ + logs?: Observability.Logs | null; + } + + export namespace Observability { + /** + * Log settings for the Worker. + */ + export interface Logs { + /** + * Whether logs are enabled for the Worker. + */ + enabled: boolean; + + /** + * Whether + * [invocation logs](https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs) + * are enabled for the Worker. + */ + invocation_logs: boolean; + + /** + * A list of destinations where logs will be exported to. + */ + destinations?: Array; + + /** + * The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%). Default is 1. + */ + head_sampling_rate?: number | null; + + /** + * Whether log persistence is enabled for the Worker. + */ + persist?: boolean; + } + } + /** * Configuration for * [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement). @@ -372,7 +447,6 @@ export namespace ScriptUpdateParams { | Metadata.WorkersBindingKindSecretText | Metadata.WorkersBindingKindSendEmail | Metadata.WorkersBindingKindService - | Metadata.WorkersBindingKindTailConsumer | Metadata.WorkersBindingKindTextBlob | Metadata.WorkersBindingKindVectorize | Metadata.WorkersBindingKindVersionMetadata @@ -452,7 +526,7 @@ export namespace ScriptUpdateParams { /** * List of Workers that will consume logs from the attached Worker. */ - tail_consumers?: Array; + tail_consumers?: Array | null; /** * Usage model for the Worker invocations. @@ -616,7 +690,7 @@ export namespace ScriptUpdateParams { name: string; /** - * Namespace to bind to. + * The name of the dispatch namespace. */ namespace: string; @@ -946,23 +1020,6 @@ export namespace ScriptUpdateParams { environment?: string; } - export interface WorkersBindingKindTailConsumer { - /** - * A JavaScript variable name for the binding. - */ - name: string; - - /** - * Name of Tail Worker to bind to. - */ - service: string; - - /** - * The kind of resource that the binding provides. - */ - type: 'tail_consumer'; - } - export interface WorkersBindingKindTextBlob { /** * A JavaScript variable name for the binding. diff --git a/src/resources/workers-for-platforms/dispatch/namespaces/scripts/settings.ts b/src/resources/workers-for-platforms/dispatch/namespaces/scripts/settings.ts index fea3a53ffc..436d10f14e 100644 --- a/src/resources/workers-for-platforms/dispatch/namespaces/scripts/settings.ts +++ b/src/resources/workers-for-platforms/dispatch/namespaces/scripts/settings.ts @@ -91,7 +91,6 @@ export interface SettingEditResponse { | SettingEditResponse.WorkersBindingKindSecretText | SettingEditResponse.WorkersBindingKindSendEmail | SettingEditResponse.WorkersBindingKindService - | SettingEditResponse.WorkersBindingKindTailConsumer | SettingEditResponse.WorkersBindingKindTextBlob | SettingEditResponse.WorkersBindingKindVectorize | SettingEditResponse.WorkersBindingKindVersionMetadata @@ -138,12 +137,12 @@ export interface SettingEditResponse { /** * Tags associated with the Worker. */ - tags?: Array; + tags?: Array | null; /** * List of Workers that will consume logs from the attached Worker. */ - tail_consumers?: Array; + tail_consumers?: Array | null; /** * Usage model for the Worker invocations. @@ -247,7 +246,7 @@ export namespace SettingEditResponse { name: string; /** - * Namespace to bind to. + * The name of the dispatch namespace. */ namespace: string; @@ -572,23 +571,6 @@ export namespace SettingEditResponse { environment?: string; } - export interface WorkersBindingKindTailConsumer { - /** - * A JavaScript variable name for the binding. - */ - name: string; - - /** - * Name of Tail Worker to bind to. - */ - service: string; - - /** - * The kind of resource that the binding provides. - */ - type: 'tail_consumer'; - } - export interface WorkersBindingKindTextBlob { /** * A JavaScript variable name for the binding. @@ -843,7 +825,6 @@ export interface SettingGetResponse { | SettingGetResponse.WorkersBindingKindSecretText | SettingGetResponse.WorkersBindingKindSendEmail | SettingGetResponse.WorkersBindingKindService - | SettingGetResponse.WorkersBindingKindTailConsumer | SettingGetResponse.WorkersBindingKindTextBlob | SettingGetResponse.WorkersBindingKindVectorize | SettingGetResponse.WorkersBindingKindVersionMetadata @@ -890,12 +871,12 @@ export interface SettingGetResponse { /** * Tags associated with the Worker. */ - tags?: Array; + tags?: Array | null; /** * List of Workers that will consume logs from the attached Worker. */ - tail_consumers?: Array; + tail_consumers?: Array | null; /** * Usage model for the Worker invocations. @@ -999,7 +980,7 @@ export namespace SettingGetResponse { name: string; /** - * Namespace to bind to. + * The name of the dispatch namespace. */ namespace: string; @@ -1324,23 +1305,6 @@ export namespace SettingGetResponse { environment?: string; } - export interface WorkersBindingKindTailConsumer { - /** - * A JavaScript variable name for the binding. - */ - name: string; - - /** - * Name of Tail Worker to bind to. - */ - service: string; - - /** - * The kind of resource that the binding provides. - */ - type: 'tail_consumer'; - } - export interface WorkersBindingKindTextBlob { /** * A JavaScript variable name for the binding. @@ -1608,7 +1572,6 @@ export namespace SettingEditParams { | Settings.WorkersBindingKindSecretText | Settings.WorkersBindingKindSendEmail | Settings.WorkersBindingKindService - | Settings.WorkersBindingKindTailConsumer | Settings.WorkersBindingKindTextBlob | Settings.WorkersBindingKindVectorize | Settings.WorkersBindingKindVersionMetadata @@ -1660,12 +1623,12 @@ export namespace SettingEditParams { /** * Tags associated with the Worker. */ - tags?: Array; + tags?: Array | null; /** * List of Workers that will consume logs from the attached Worker. */ - tail_consumers?: Array; + tail_consumers?: Array | null; /** * Usage model for the Worker invocations. @@ -1769,7 +1732,7 @@ export namespace SettingEditParams { name: string; /** - * Namespace to bind to. + * The name of the dispatch namespace. */ namespace: string; @@ -2099,23 +2062,6 @@ export namespace SettingEditParams { environment?: string; } - export interface WorkersBindingKindTailConsumer { - /** - * A JavaScript variable name for the binding. - */ - name: string; - - /** - * Name of Tail Worker to bind to. - */ - service: string; - - /** - * The kind of resource that the binding provides. - */ - type: 'tail_consumer'; - } - export interface WorkersBindingKindTextBlob { /** * A JavaScript variable name for the binding. diff --git a/src/resources/workers-for-platforms/dispatch/namespaces/scripts/tags.ts b/src/resources/workers-for-platforms/dispatch/namespaces/scripts/tags.ts index 73ea9f79b9..b1a6bd94be 100644 --- a/src/resources/workers-for-platforms/dispatch/namespaces/scripts/tags.ts +++ b/src/resources/workers-for-platforms/dispatch/namespaces/scripts/tags.ts @@ -116,7 +116,7 @@ export interface TagUpdateParams { /** * Body param: Tags associated with the Worker. */ - body: Array; + body: Array | null; } export interface TagListParams { diff --git a/src/resources/workers/beta/workers/versions.ts b/src/resources/workers/beta/workers/versions.ts index 300510fc56..9ccfe39b95 100644 --- a/src/resources/workers/beta/workers/versions.ts +++ b/src/resources/workers/beta/workers/versions.ts @@ -176,7 +176,6 @@ export interface Version { | Version.WorkersBindingKindSecretText | Version.WorkersBindingKindSendEmail | Version.WorkersBindingKindService - | Version.WorkersBindingKindTailConsumer | Version.WorkersBindingKindTextBlob | Version.WorkersBindingKindVectorize | Version.WorkersBindingKindVersionMetadata @@ -240,6 +239,12 @@ export interface Version { */ source?: string; + /** + * Time in milliseconds spent on + * [Worker startup](https://developers.cloudflare.com/workers/platform/limits/#worker-startup-time). + */ + startup_time_ms?: number; + /** * @deprecated Usage model for the version. */ @@ -409,7 +414,7 @@ export namespace Version { name: string; /** - * Namespace to bind to. + * The name of the dispatch namespace. */ namespace: string; @@ -734,23 +739,6 @@ export namespace Version { environment?: string; } - export interface WorkersBindingKindTailConsumer { - /** - * A JavaScript variable name for the binding. - */ - name: string; - - /** - * Name of Tail Worker to bind to. - */ - service: string; - - /** - * The kind of resource that the binding provides. - */ - type: 'tail_consumer'; - } - export interface WorkersBindingKindTextBlob { /** * A JavaScript variable name for the binding. @@ -1039,7 +1027,6 @@ export interface VersionCreateParams { | VersionCreateParams.WorkersBindingKindSecretText | VersionCreateParams.WorkersBindingKindSendEmail | VersionCreateParams.WorkersBindingKindService - | VersionCreateParams.WorkersBindingKindTailConsumer | VersionCreateParams.WorkersBindingKindTextBlob | VersionCreateParams.WorkersBindingKindVectorize | VersionCreateParams.WorkersBindingKindVersionMetadata @@ -1263,7 +1250,7 @@ export namespace VersionCreateParams { name: string; /** - * Namespace to bind to. + * The name of the dispatch namespace. */ namespace: string; @@ -1593,23 +1580,6 @@ export namespace VersionCreateParams { environment?: string; } - export interface WorkersBindingKindTailConsumer { - /** - * A JavaScript variable name for the binding. - */ - name: string; - - /** - * Name of Tail Worker to bind to. - */ - service: string; - - /** - * The kind of resource that the binding provides. - */ - type: 'tail_consumer'; - } - export interface WorkersBindingKindTextBlob { /** * A JavaScript variable name for the binding. diff --git a/src/resources/workers/beta/workers/workers.ts b/src/resources/workers/beta/workers/workers.ts index ba7791704e..d4e49b0055 100644 --- a/src/resources/workers/beta/workers/workers.ts +++ b/src/resources/workers/beta/workers/workers.ts @@ -193,6 +193,11 @@ export interface Worker { */ observability: Worker.Observability; + /** + * Other resources that reference the Worker and depend on it existing. + */ + references: Worker.References; + /** * Subdomain settings for the Worker. */ @@ -259,6 +264,139 @@ export namespace Worker { } } + /** + * Other resources that reference the Worker and depend on it existing. + */ + export interface References { + /** + * Other Workers that reference the Worker as an outbound for a dispatch namespace. + */ + dispatch_namespace_outbounds: Array; + + /** + * Custom domains connected to the Worker. + */ + domains: Array; + + /** + * Other Workers that reference Durable Object classes implemented by the Worker. + */ + durable_objects: Array; + + /** + * Queues that send messages to the Worker. + */ + queues: Array; + + /** + * Other Workers that reference the Worker using + * [service bindings](https://developers.cloudflare.com/workers/runtime-apis/bindings/service-bindings/). + */ + workers: Array; + } + + export namespace References { + export interface DispatchNamespaceOutbound { + /** + * ID of the dispatch namespace. + */ + namespace_id: string; + + /** + * Name of the dispatch namespace. + */ + namespace_name: string; + + /** + * ID of the Worker using the dispatch namespace. + */ + worker_id: string; + + /** + * Name of the Worker using the dispatch namespace. + */ + worker_name: string; + } + + export interface Domain { + /** + * ID of the custom domain. + */ + id: string; + + /** + * ID of the TLS certificate issued for the custom domain. + */ + certificate_id: string; + + /** + * Full hostname of the custom domain, including the zone name. + */ + hostname: string; + + /** + * ID of the zone. + */ + zone_id: string; + + /** + * Name of the zone. + */ + zone_name: string; + } + + export interface DurableObject { + /** + * ID of the Durable Object namespace being used. + */ + namespace_id: string; + + /** + * Name of the Durable Object namespace being used. + */ + namespace_name: string; + + /** + * ID of the Worker using the Durable Object implementation. + */ + worker_id: string; + + /** + * Name of the Worker using the Durable Object implementation. + */ + worker_name: string; + } + + export interface Queue { + /** + * ID of the queue consumer configuration. + */ + queue_consumer_id: string; + + /** + * ID of the queue. + */ + queue_id: string; + + /** + * Name of the queue. + */ + queue_name: string; + } + + export interface Worker { + /** + * ID of the referencing Worker. + */ + id: string; + + /** + * Name of the referencing Worker. + */ + name: string; + } + } + /** * Subdomain settings for the Worker. */ diff --git a/src/resources/workers/domains.ts b/src/resources/workers/domains.ts index 42eb155510..27893e400a 100644 --- a/src/resources/workers/domains.ts +++ b/src/resources/workers/domains.ts @@ -12,7 +12,6 @@ export class Domains extends APIResource { * ```ts * const domain = await client.workers.domains.update({ * account_id: '9a7806061c88ada191ed06f989cc3dac', - * environment: 'production', * hostname: 'foo.example.com', * service: 'foo', * zone_id: '593c9c94de529bbbfaac7c53ced0447d', @@ -98,7 +97,7 @@ export interface Domain { id?: string; /** - * Worker environment associated with the zone and hostname. + * @deprecated Worker environment associated with the zone and hostname. */ environment?: string; @@ -129,11 +128,6 @@ export interface DomainUpdateParams { */ account_id: string; - /** - * Body param: Worker environment associated with the zone and hostname. - */ - environment: string; - /** * Body param: Hostname of the Worker Domain. */ @@ -148,6 +142,12 @@ export interface DomainUpdateParams { * Body param: Identifier of the zone. */ zone_id: string; + + /** + * @deprecated Body param: Worker environment associated with the zone and + * hostname. + */ + environment?: string; } export interface DomainListParams { diff --git a/src/resources/workers/index.ts b/src/resources/workers/index.ts index 08d046d2c3..67c98e03aa 100644 --- a/src/resources/workers/index.ts +++ b/src/resources/workers/index.ts @@ -34,11 +34,12 @@ export { type RouteGetParams, } from './routes'; export { - ScriptsSinglePage, + ScriptListResponsesSinglePage, Scripts, type Script, type ScriptSetting, type ScriptUpdateResponse, + type ScriptListResponse, type ScriptDeleteResponse, type ScriptGetResponse, type ScriptSearchResponse, @@ -53,6 +54,7 @@ export { type SubdomainUpdateResponse, type SubdomainGetResponse, type SubdomainUpdateParams, + type SubdomainDeleteParams, type SubdomainGetParams, } from './subdomains'; export { Workers } from './workers'; diff --git a/src/resources/workers/observability/telemetry.ts b/src/resources/workers/observability/telemetry.ts index 9467608603..23fa78c987 100644 --- a/src/resources/workers/observability/telemetry.ts +++ b/src/resources/workers/observability/telemetry.ts @@ -121,6 +121,8 @@ export interface TelemetryQueryResponse { invocations?: { [key: string]: Array }; patterns?: Array; + + traces?: Array; } export namespace TelemetryQueryResponse { @@ -145,6 +147,9 @@ export namespace TelemetryQueryResponse { status: 'STARTED' | 'COMPLETED'; + /** + * Time range for the query execution + */ timeframe: Run.Timeframe; userId: string; @@ -376,14 +381,17 @@ export namespace TelemetryQueryResponse { } } + /** + * Time range for the query execution + */ export interface Timeframe { /** - * Set the start time for your query using UNIX time in milliseconds. + * Start timestamp for the query timeframe (Unix timestamp in milliseconds) */ from: number; /** - * Set the end time for your query using UNIX time in milliseconds. + * End timestamp for the query timeframe (Unix timestamp in milliseconds) */ to: number; } @@ -403,6 +411,12 @@ export namespace TelemetryQueryResponse { * Number of rows scanned from the table. */ rows_read: number; + + /** + * The level of Adaptive Bit Rate (ABR) sampling used for the query. If empty the + * ABR level is 1 + */ + abr_level?: number; } } @@ -425,6 +439,12 @@ export namespace TelemetryQueryResponse { * Number of rows scanned from the table. */ rows_read: number; + + /** + * The level of Adaptive Bit Rate (ABR) sampling used for the query. If empty the + * ABR level is 1 + */ + abr_level?: number; } export interface Calculation { @@ -578,6 +598,12 @@ export namespace TelemetryQueryResponse { timestamp: number; + /** + * Cloudflare Containers event information enriches your logs so you can easily + * identify and debug issues. + */ + $containers?: unknown; + /** * Cloudflare Workers event information enriches your logs so you can easily * identify and debug issues. @@ -641,6 +667,8 @@ export namespace TelemetryQueryResponse { traceId?: string; + transactionName?: string; + trigger?: string; type?: string; @@ -661,12 +689,12 @@ export namespace TelemetryQueryResponse { | 'websocket' | 'unknown'; - outcome: string; - requestId: string; scriptName: string; + durableObjectId?: string; + entrypoint?: string; event?: { @@ -685,6 +713,8 @@ export namespace TelemetryQueryResponse { executionModel?: 'durableObject' | 'stateless'; + outcome?: string; + scriptVersion?: UnionMember0.ScriptVersion; truncated?: boolean; @@ -727,6 +757,8 @@ export namespace TelemetryQueryResponse { dispatchNamespace?: string; + durableObjectId?: string; + entrypoint?: string; event?: { [key: string]: string | number | boolean }; @@ -830,6 +862,12 @@ export namespace TelemetryQueryResponse { timestamp: number; + /** + * Cloudflare Containers event information enriches your logs so you can easily + * identify and debug issues. + */ + $containers?: unknown; + /** * Cloudflare Workers event information enriches your logs so you can easily * identify and debug issues. @@ -893,6 +931,8 @@ export namespace TelemetryQueryResponse { traceId?: string; + transactionName?: string; + trigger?: string; type?: string; @@ -913,12 +953,12 @@ export namespace TelemetryQueryResponse { | 'websocket' | 'unknown'; - outcome: string; - requestId: string; scriptName: string; + durableObjectId?: string; + entrypoint?: string; event?: { @@ -937,6 +977,8 @@ export namespace TelemetryQueryResponse { executionModel?: 'durableObject' | 'stateless'; + outcome?: string; + scriptVersion?: UnionMember0.ScriptVersion; truncated?: boolean; @@ -979,6 +1021,8 @@ export namespace TelemetryQueryResponse { dispatchNamespace?: string; + durableObjectId?: string; + entrypoint?: string; event?: { [key: string]: string | number | boolean }; @@ -1048,6 +1092,26 @@ export namespace TelemetryQueryResponse { } } } + + export interface Trace { + rootSpanName: string; + + rootTransactionName: string; + + service: Array; + + spans: number; + + traceDurationMs: number; + + traceEndMs: number; + + traceId: string; + + traceStartMs: number; + + errors?: Array; + } } export interface TelemetryValuesResponse { @@ -1076,6 +1140,11 @@ export interface TelemetryKeysParams { */ filters?: Array; + /** + * Body param: + */ + from?: number; + /** * Body param: Search for a specific substring in the keys. */ @@ -1087,14 +1156,14 @@ export interface TelemetryKeysParams { limit?: number; /** - * Body param: Search for a specific substring in the event. + * Body param: Search for a specific substring in any of the events */ needle?: TelemetryKeysParams.Needle; /** * Body param: */ - timeframe?: TelemetryKeysParams.Timeframe; + to?: number; } export namespace TelemetryKeysParams { @@ -1148,7 +1217,7 @@ export namespace TelemetryKeysParams { } /** - * Search for a specific substring in the event. + * Search for a specific substring in any of the events */ export interface Needle { value: string | number | boolean; @@ -1157,12 +1226,6 @@ export namespace TelemetryKeysParams { matchCase?: boolean; } - - export interface Timeframe { - from: number; - - to: number; - } } export interface TelemetryQueryParams { @@ -1172,83 +1235,99 @@ export interface TelemetryQueryParams { account_id: string; /** - * Body param: + * Body param: Unique identifier for the query to execute */ queryId: string; /** - * Body param: + * Body param: Time range for the query execution */ timeframe: TelemetryQueryParams.Timeframe; /** - * Body param: + * Body param: Whether to include timeseties data in the response */ chart?: boolean; /** - * Body param: + * Body param: Whether to include comparison data with previous time periods */ compare?: boolean; /** - * Body param: + * Body param: Whether to perform a dry run without saving the results of the + * query. Useful for validation */ dry?: boolean; /** - * Body param: + * Body param: Time granularity for aggregating results (in milliseconds). Controls + * the bucketing of time-series data */ granularity?: number; /** - * Body param: + * Body param: Whether to ignore time-series data in the results and return only + * aggregated values */ ignoreSeries?: boolean; /** - * Body param: + * Body param: Maximum number of events to return. */ limit?: number; /** - * Body param: + * Body param: Cursor for pagination to retrieve the next set of results */ offset?: string; /** - * Body param: + * Body param: Number of events to skip for pagination. Used in conjunction with + * offset */ offsetBy?: number; /** - * Body param: + * Body param: Direction for offset-based pagination (e.g., 'next', 'prev') */ offsetDirection?: string; /** - * Body param: + * Body param: Optional parameters to pass to the query execution */ parameters?: TelemetryQueryParams.Parameters; /** - * Body param: + * Body param: Type of pattern to search for when using pattern-based views */ patternType?: 'message' | 'error'; /** - * Body param: + * Body param: View type for presenting the query results. */ view?: 'traces' | 'events' | 'calculations' | 'invocations' | 'requests' | 'patterns'; } export namespace TelemetryQueryParams { + /** + * Time range for the query execution + */ export interface Timeframe { + /** + * Start timestamp for the query timeframe (Unix timestamp in milliseconds) + */ from: number; + /** + * End timestamp for the query timeframe (Unix timestamp in milliseconds) + */ to: number; } + /** + * Optional parameters to pass to the query execution + */ export interface Parameters { /** * Create Calculations to compute as part of the query. diff --git a/src/resources/workers/scripts/index.ts b/src/resources/workers/scripts/index.ts index 4bbd0bb198..6fe0155b7b 100644 --- a/src/resources/workers/scripts/index.ts +++ b/src/resources/workers/scripts/index.ts @@ -27,11 +27,12 @@ export { type ScriptAndVersionSettingGetParams, } from './script-and-version-settings'; export { - ScriptsSinglePage, + ScriptListResponsesSinglePage, Scripts, type Script, type ScriptSetting, type ScriptUpdateResponse, + type ScriptListResponse, type ScriptDeleteResponse, type ScriptGetResponse, type ScriptSearchResponse, diff --git a/src/resources/workers/scripts/script-and-version-settings.ts b/src/resources/workers/scripts/script-and-version-settings.ts index 05bc7152a0..ea56961922 100644 --- a/src/resources/workers/scripts/script-and-version-settings.ts +++ b/src/resources/workers/scripts/script-and-version-settings.ts @@ -87,7 +87,6 @@ export interface ScriptAndVersionSettingEditResponse { | ScriptAndVersionSettingEditResponse.WorkersBindingKindSecretText | ScriptAndVersionSettingEditResponse.WorkersBindingKindSendEmail | ScriptAndVersionSettingEditResponse.WorkersBindingKindService - | ScriptAndVersionSettingEditResponse.WorkersBindingKindTailConsumer | ScriptAndVersionSettingEditResponse.WorkersBindingKindTextBlob | ScriptAndVersionSettingEditResponse.WorkersBindingKindVectorize | ScriptAndVersionSettingEditResponse.WorkersBindingKindVersionMetadata @@ -134,12 +133,12 @@ export interface ScriptAndVersionSettingEditResponse { /** * Tags associated with the Worker. */ - tags?: Array; + tags?: Array | null; /** * List of Workers that will consume logs from the attached Worker. */ - tail_consumers?: Array; + tail_consumers?: Array | null; /** * Usage model for the Worker invocations. @@ -243,7 +242,7 @@ export namespace ScriptAndVersionSettingEditResponse { name: string; /** - * Namespace to bind to. + * The name of the dispatch namespace. */ namespace: string; @@ -568,23 +567,6 @@ export namespace ScriptAndVersionSettingEditResponse { environment?: string; } - export interface WorkersBindingKindTailConsumer { - /** - * A JavaScript variable name for the binding. - */ - name: string; - - /** - * Name of Tail Worker to bind to. - */ - service: string; - - /** - * The kind of resource that the binding provides. - */ - type: 'tail_consumer'; - } - export interface WorkersBindingKindTextBlob { /** * A JavaScript variable name for the binding. @@ -839,7 +821,6 @@ export interface ScriptAndVersionSettingGetResponse { | ScriptAndVersionSettingGetResponse.WorkersBindingKindSecretText | ScriptAndVersionSettingGetResponse.WorkersBindingKindSendEmail | ScriptAndVersionSettingGetResponse.WorkersBindingKindService - | ScriptAndVersionSettingGetResponse.WorkersBindingKindTailConsumer | ScriptAndVersionSettingGetResponse.WorkersBindingKindTextBlob | ScriptAndVersionSettingGetResponse.WorkersBindingKindVectorize | ScriptAndVersionSettingGetResponse.WorkersBindingKindVersionMetadata @@ -886,12 +867,12 @@ export interface ScriptAndVersionSettingGetResponse { /** * Tags associated with the Worker. */ - tags?: Array; + tags?: Array | null; /** * List of Workers that will consume logs from the attached Worker. */ - tail_consumers?: Array; + tail_consumers?: Array | null; /** * Usage model for the Worker invocations. @@ -995,7 +976,7 @@ export namespace ScriptAndVersionSettingGetResponse { name: string; /** - * Namespace to bind to. + * The name of the dispatch namespace. */ namespace: string; @@ -1320,23 +1301,6 @@ export namespace ScriptAndVersionSettingGetResponse { environment?: string; } - export interface WorkersBindingKindTailConsumer { - /** - * A JavaScript variable name for the binding. - */ - name: string; - - /** - * Name of Tail Worker to bind to. - */ - service: string; - - /** - * The kind of resource that the binding provides. - */ - type: 'tail_consumer'; - } - export interface WorkersBindingKindTextBlob { /** * A JavaScript variable name for the binding. @@ -1604,7 +1568,6 @@ export namespace ScriptAndVersionSettingEditParams { | Settings.WorkersBindingKindSecretText | Settings.WorkersBindingKindSendEmail | Settings.WorkersBindingKindService - | Settings.WorkersBindingKindTailConsumer | Settings.WorkersBindingKindTextBlob | Settings.WorkersBindingKindVectorize | Settings.WorkersBindingKindVersionMetadata @@ -1656,12 +1619,12 @@ export namespace ScriptAndVersionSettingEditParams { /** * Tags associated with the Worker. */ - tags?: Array; + tags?: Array | null; /** * List of Workers that will consume logs from the attached Worker. */ - tail_consumers?: Array; + tail_consumers?: Array | null; /** * Usage model for the Worker invocations. @@ -1765,7 +1728,7 @@ export namespace ScriptAndVersionSettingEditParams { name: string; /** - * Namespace to bind to. + * The name of the dispatch namespace. */ namespace: string; @@ -2095,23 +2058,6 @@ export namespace ScriptAndVersionSettingEditParams { environment?: string; } - export interface WorkersBindingKindTailConsumer { - /** - * A JavaScript variable name for the binding. - */ - name: string; - - /** - * Name of Tail Worker to bind to. - */ - service: string; - - /** - * The kind of resource that the binding provides. - */ - type: 'tail_consumer'; - } - export interface WorkersBindingKindTextBlob { /** * A JavaScript variable name for the binding. diff --git a/src/resources/workers/scripts/scripts.ts b/src/resources/workers/scripts/scripts.ts index d96bb354dc..e3f4f45945 100644 --- a/src/resources/workers/scripts/scripts.ts +++ b/src/resources/workers/scripts/scripts.ts @@ -137,16 +137,19 @@ export class Scripts extends APIResource { * @example * ```ts * // Automatically fetches more pages as needed. - * for await (const script of client.workers.scripts.list({ - * account_id: '023e105f4ecef8ad9ca31a8372d0c353', - * })) { + * for await (const scriptListResponse of client.workers.scripts.list( + * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * )) { * // ... * } * ``` */ - list(params: ScriptListParams, options?: Core.RequestOptions): Core.PagePromise { + list( + params: ScriptListParams, + options?: Core.RequestOptions, + ): Core.PagePromise { const { account_id, ...query } = params; - return this._client.getAPIList(`/accounts/${account_id}/workers/scripts`, ScriptsSinglePage, { + return this._client.getAPIList(`/accounts/${account_id}/workers/scripts`, ScriptListResponsesSinglePage, { query, ...options, }); @@ -218,11 +221,11 @@ export class Scripts extends APIResource { } } -export class ScriptsSinglePage extends SinglePage