cloudflare/cloudflare-typescript

Public

mirrored fromhttps://github.com/cloudflare/cloudflare-typescriptAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
v6.0.0-beta.2

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

src/resources/addressing/services.ts

76lines · modecode

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