@@ -9,6 +9,11 @@ import * as Pagination from 'cloudflare/pagination';
9
9
import * as API from 'cloudflare/resources/index' ;
10
10
11
11
export interface ClientOptions {
12
+ /**
13
+ * Defaults to process.env['CLOUDFLARE_API_TOKEN'].
14
+ */
15
+ apiToken ?: string | null | undefined ;
16
+
12
17
/**
13
18
* Defaults to process.env['CLOUDFLARE_API_KEY'].
14
19
*/
@@ -19,11 +24,6 @@ export interface ClientOptions {
19
24
*/
20
25
apiEmail ?: string | null | undefined ;
21
26
22
- /**
23
- * Defaults to process.env['CLOUDFLARE_API_TOKEN'].
24
- */
25
- apiToken ?: string | null | undefined ;
26
-
27
27
/**
28
28
* Defaults to process.env['CLOUDFLARE_API_USER_SERVICE_KEY'].
29
29
*/
@@ -88,19 +88,19 @@ export interface ClientOptions {
88
88
89
89
/** API Client for interfacing with the Cloudflare API. */
90
90
export class Cloudflare extends Core . APIClient {
91
+ apiToken : string | null ;
91
92
apiKey : string | null ;
92
93
apiEmail : string | null ;
93
- apiToken : string | null ;
94
94
userServiceKey : string | null ;
95
95
96
96
private _options : ClientOptions ;
97
97
98
98
/**
99
99
* API Client for interfacing with the Cloudflare API.
100
100
*
101
+ * @param {string | null | undefined } [opts.apiToken=process.env['CLOUDFLARE_API_TOKEN'] ?? null]
101
102
* @param {string | null | undefined } [opts.apiKey=process.env['CLOUDFLARE_API_KEY'] ?? null]
102
103
* @param {string | null | undefined } [opts.apiEmail=process.env['CLOUDFLARE_EMAIL'] ?? null]
103
- * @param {string | null | undefined } [opts.apiToken=process.env['CLOUDFLARE_API_TOKEN'] ?? null]
104
104
* @param {string | null | undefined } [opts.userServiceKey=process.env['CLOUDFLARE_API_USER_SERVICE_KEY'] ?? null]
105
105
* @param {string } [opts.baseURL=process.env['CLOUDFLARE_BASE_URL'] ?? https://api.cloudflare.com/client/v4] - Override the default base URL for the API.
106
106
* @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 {
112
112
*/
113
113
constructor ( {
114
114
baseURL = Core . readEnv ( 'CLOUDFLARE_BASE_URL' ) ,
115
+ apiToken = Core . readEnv ( 'CLOUDFLARE_API_TOKEN' ) ?? null ,
115
116
apiKey = Core . readEnv ( 'CLOUDFLARE_API_KEY' ) ?? null ,
116
117
apiEmail = Core . readEnv ( 'CLOUDFLARE_EMAIL' ) ?? null ,
117
- apiToken = Core . readEnv ( 'CLOUDFLARE_API_TOKEN' ) ?? null ,
118
118
userServiceKey = Core . readEnv ( 'CLOUDFLARE_API_USER_SERVICE_KEY' ) ?? null ,
119
119
...opts
120
120
} : ClientOptions = { } ) {
121
121
const options : ClientOptions = {
122
+ apiToken,
122
123
apiKey,
123
124
apiEmail,
124
- apiToken,
125
125
userServiceKey,
126
126
...opts ,
127
127
baseURL : baseURL || `https://api.cloudflare.com/client/v4` ,
@@ -136,9 +136,9 @@ export class Cloudflare extends Core.APIClient {
136
136
} ) ;
137
137
this . _options = options ;
138
138
139
+ this . apiToken = apiToken ;
139
140
this . apiKey = apiKey ;
140
141
this . apiEmail = apiEmail ;
141
- this . apiToken = apiToken ;
142
142
this . userServiceKey = userServiceKey ;
143
143
}
144
144
0 commit comments