cloudflare/cloudflare-typescript
Publicmirrored fromhttps://github.com/cloudflare/cloudflare-typescriptAvailable
src/resources/addressing/services.ts
67lines · modecode
| 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. |
| 2 | |
| 3 | import { APIResource } from '../../resource'; |
| 4 | import * as Core from '../../core'; |
| 5 | import { SinglePage } from '../../pagination'; |
| 6 | |
| 7 | export class Services extends APIResource { |
| 8 | /** |
| 9 | * Bring-Your-Own IP (BYOIP) prefixes onboarded to Cloudflare must be bound to a |
| 10 | * service running on the Cloudflare network to enable a Cloudflare product on the |
| 11 | * IP addresses. This endpoint can be used as a reference of available services on |
| 12 | * the Cloudflare network, and their service IDs. |
| 13 | * |
| 14 | * @example |
| 15 | * ```ts |
| 16 | * // Automatically fetches more pages as needed. |
| 17 | * for await (const serviceListResponse of client.addressing.services.list( |
| 18 | * { account_id: '258def64c72dae45f3e4c8516e2111f2' }, |
| 19 | * )) { |
| 20 | * // ... |
| 21 | * } |
| 22 | * ``` |
| 23 | */ |
| 24 | list( |
| 25 | params: ServiceListParams, |
| 26 | options?: Core.RequestOptions, |
| 27 | ): Core.PagePromise<ServiceListResponsesSinglePage, ServiceListResponse> { |
| 28 | const { account_id } = params; |
| 29 | return this._client.getAPIList( |
| 30 | `/accounts/${account_id}/addressing/services`, |
| 31 | ServiceListResponsesSinglePage, |
| 32 | options, |
| 33 | ); |
| 34 | } |
| 35 | } |
| 36 | |
| 37 | export class ServiceListResponsesSinglePage extends SinglePage<ServiceListResponse> {} |
| 38 | |
| 39 | export interface ServiceListResponse { |
| 40 | /** |
| 41 | * Identifier of a Service on the Cloudflare network. Available services and their |
| 42 | * IDs may be found in the **List Services** endpoint. |
| 43 | */ |
| 44 | id?: string; |
| 45 | |
| 46 | /** |
| 47 | * Name of a service running on the Cloudflare network |
| 48 | */ |
| 49 | name?: string; |
| 50 | } |
| 51 | |
| 52 | export interface ServiceListParams { |
| 53 | /** |
| 54 | * Identifier of a Cloudflare account. |
| 55 | */ |
| 56 | account_id: string; |
| 57 | } |
| 58 | |
| 59 | Services.ServiceListResponsesSinglePage = ServiceListResponsesSinglePage; |
| 60 | |
| 61 | export declare namespace Services { |
| 62 | export { |
| 63 | type ServiceListResponse as ServiceListResponse, |
| 64 | ServiceListResponsesSinglePage as ServiceListResponsesSinglePage, |
| 65 | type ServiceListParams as ServiceListParams, |
| 66 | }; |
| 67 | } |
| 68 | |