Skip to content

Commit 1f453ad

Browse files
feat(api): update via SDK Studio (#352)
1 parent accb769 commit 1f453ad

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/index.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ import * as Pagination from 'cloudflare/pagination';
99
import * as API from 'cloudflare/resources/index';
1010

1111
export interface ClientOptions {
12+
/**
13+
* Defaults to process.env['CLOUDFLARE_API_TOKEN'].
14+
*/
15+
apiToken?: string | null | undefined;
16+
1217
/**
1318
* Defaults to process.env['CLOUDFLARE_API_KEY'].
1419
*/
@@ -19,11 +24,6 @@ export interface ClientOptions {
1924
*/
2025
apiEmail?: string | null | undefined;
2126

22-
/**
23-
* Defaults to process.env['CLOUDFLARE_API_TOKEN'].
24-
*/
25-
apiToken?: string | null | undefined;
26-
2727
/**
2828
* Defaults to process.env['CLOUDFLARE_API_USER_SERVICE_KEY'].
2929
*/
@@ -88,19 +88,19 @@ export interface ClientOptions {
8888

8989
/** API Client for interfacing with the Cloudflare API. */
9090
export class Cloudflare extends Core.APIClient {
91+
apiToken: string | null;
9192
apiKey: string | null;
9293
apiEmail: string | null;
93-
apiToken: string | null;
9494
userServiceKey: string | null;
9595

9696
private _options: ClientOptions;
9797

9898
/**
9999
* API Client for interfacing with the Cloudflare API.
100100
*
101+
* @param {string | null | undefined} [opts.apiToken=process.env['CLOUDFLARE_API_TOKEN'] ?? null]
101102
* @param {string | null | undefined} [opts.apiKey=process.env['CLOUDFLARE_API_KEY'] ?? null]
102103
* @param {string | null | undefined} [opts.apiEmail=process.env['CLOUDFLARE_EMAIL'] ?? null]
103-
* @param {string | null | undefined} [opts.apiToken=process.env['CLOUDFLARE_API_TOKEN'] ?? null]
104104
* @param {string | null | undefined} [opts.userServiceKey=process.env['CLOUDFLARE_API_USER_SERVICE_KEY'] ?? null]
105105
* @param {string} [opts.baseURL=process.env['CLOUDFLARE_BASE_URL'] ?? https://api.cloudflare.com/client/v4] - Override the default base URL for the API.
106106
* @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
@@ -112,16 +112,16 @@ export class Cloudflare extends Core.APIClient {
112112
*/
113113
constructor({
114114
baseURL = Core.readEnv('CLOUDFLARE_BASE_URL'),
115+
apiToken = Core.readEnv('CLOUDFLARE_API_TOKEN') ?? null,
115116
apiKey = Core.readEnv('CLOUDFLARE_API_KEY') ?? null,
116117
apiEmail = Core.readEnv('CLOUDFLARE_EMAIL') ?? null,
117-
apiToken = Core.readEnv('CLOUDFLARE_API_TOKEN') ?? null,
118118
userServiceKey = Core.readEnv('CLOUDFLARE_API_USER_SERVICE_KEY') ?? null,
119119
...opts
120120
}: ClientOptions = {}) {
121121
const options: ClientOptions = {
122+
apiToken,
122123
apiKey,
123124
apiEmail,
124-
apiToken,
125125
userServiceKey,
126126
...opts,
127127
baseURL: baseURL || `https://api.cloudflare.com/client/v4`,
@@ -136,9 +136,9 @@ export class Cloudflare extends Core.APIClient {
136136
});
137137
this._options = options;
138138

139+
this.apiToken = apiToken;
139140
this.apiKey = apiKey;
140141
this.apiEmail = apiEmail;
141-
this.apiToken = apiToken;
142142
this.userServiceKey = userServiceKey;
143143
}
144144

0 commit comments

Comments
 (0)