cloudflare
Version:
The official TypeScript library for the Cloudflare API
73 lines (64 loc) • 2.19 kB
text/typescript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from '../../core/resource';
import { PagePromise, SinglePage } from '../../core/pagination';
import { RequestOptions } from '../../internal/request-options';
import { path } from '../../internal/utils/path';
export class BaseServices extends APIResource {
static override readonly _key: readonly ['addressing', 'services'] = Object.freeze([
'addressing',
'services',
] as const);
/**
* Bring-Your-Own IP (BYOIP) prefixes onboarded to Cloudflare must be bound to a
* service running on the Cloudflare network to enable a Cloudflare product on the
* IP addresses. This endpoint can be used as a reference of available services on
* the Cloudflare network, and their service IDs.
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const serviceListResponse of client.addressing.services.list(
* { account_id: '258def64c72dae45f3e4c8516e2111f2' },
* )) {
* // ...
* }
* ```
*/
list(
params: ServiceListParams,
options?: RequestOptions,
): PagePromise<ServiceListResponsesSinglePage, ServiceListResponse> {
const { account_id } = params;
return this._client.getAPIList(
path`/accounts/${account_id}/addressing/services`,
SinglePage<ServiceListResponse>,
options,
);
}
}
export class Services extends BaseServices {}
export type ServiceListResponsesSinglePage = SinglePage<ServiceListResponse>;
export interface ServiceListResponse {
/**
* Identifier of a Service on the Cloudflare network. Available services and their
* IDs may be found in the **List Services** endpoint.
*/
id?: string;
/**
* Name of a service running on the Cloudflare network
*/
name?: string;
}
export interface ServiceListParams {
/**
* Identifier of a Cloudflare account.
*/
account_id: string;
}
export declare namespace Services {
export {
type ServiceListResponse as ServiceListResponse,
type ServiceListResponsesSinglePage as ServiceListResponsesSinglePage,
type ServiceListParams as ServiceListParams,
};
}