Skip to content

Commit 2274ba0

Browse files
stainless-app[bot]stainless-bot
authored andcommitted
feat(api): update via SDK Studio (#182)
1 parent 6bbd7bb commit 2274ba0

File tree

7 files changed

+84
-38
lines changed

7 files changed

+84
-38
lines changed

README.md

+48-2
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,51 @@ console.log(raw.headers.get('X-My-Header'));
201201
console.log(zone.id);
202202
```
203203

204-
## Customizing the fetch client
204+
### Making custom/undocumented requests
205+
206+
This library is typed for convenient access to the documented API. If you need to access undocumented
207+
endpoints, params, or response properties, the library can still be used.
208+
209+
#### Undocumented endpoints
210+
211+
To make requests to undocumented endpoints, you can use `client.get`, `client.post`, and other HTTP verbs.
212+
Options on the client, such as retries, will be respected when making these requests.
213+
214+
```ts
215+
await client.post('/some/path', {
216+
body: { some_prop: 'foo' },
217+
query: { some_query_arg: 'bar' },
218+
});
219+
```
220+
221+
#### Undocumented params
222+
223+
To make requests using undocumented parameters, you may use `// @ts-expect-error` on the undocumented
224+
parameter. This library doesn't validate at runtime that the request matches the type, so any extra values you
225+
send will be sent as-is.
226+
227+
```ts
228+
client.foo.create({
229+
foo: 'my_param',
230+
bar: 12,
231+
// @ts-expect-error baz is not yet public
232+
baz: 'undocumented option',
233+
});
234+
```
235+
236+
For requests with the `GET` verb, any extra params will be in the query, all other requests will send the
237+
extra param in the body.
238+
239+
If you want to explicitly send an extra argument, you can do so with the `query`, `body`, and `headers` request
240+
options.
241+
242+
#### Undocumented properties
243+
244+
To access undocumented response properties, you may access the response object with `// @ts-expect-error` on
245+
the response object, or cast the response object to the requisite type. Like the request params, we do not
246+
validate or strip extra properties from the response from the API.
247+
248+
### Customizing the fetch client
205249

206250
By default, this library uses `node-fetch` in Node, and expects a global `fetch` function in other environments.
207251

@@ -219,6 +263,8 @@ import Cloudflare from 'cloudflare';
219263
To do the inverse, add `import "cloudflare/shims/node"` (which does import polyfills).
220264
This can also be useful if you are getting the wrong TypeScript types for `Response` ([more details](https://github.com/cloudflare/cloudflare-typescript/tree/main/src/_shims#readme)).
221265

266+
### Logging and middleware
267+
222268
You may also provide a custom `fetch` function when instantiating the client,
223269
which can be used to inspect or alter the `Request` or `Response` before/after each request:
224270

@@ -239,7 +285,7 @@ const client = new Cloudflare({
239285
Note that if given a `DEBUG=true` environment variable, this library will log all requests and responses automatically.
240286
This is intended for debugging purposes only and may change in the future without notice.
241287

242-
## Configuring an HTTP(S) Agent (e.g., for proxies)
288+
### Configuring an HTTP(S) Agent (e.g., for proxies)
243289

244290
By default, this library uses a stable agent for all http/https requests to reuse TCP connections, eliminating many TCP & TLS handshakes and shaving around 100ms off most requests.
245291

src/resources/dns/records.ts

+10-10
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ export type DNSRecord =
173173
| DNSRecord.A
174174
| DNSRecord.AAAA
175175
| DNSRecord.CAA
176-
| DNSRecord.Cert
176+
| DNSRecord.CERT
177177
| DNSRecord.CNAME
178178
| DNSRecord.DNSKEY
179179
| DNSRecord.DS
@@ -183,7 +183,7 @@ export type DNSRecord =
183183
| DNSRecord.NAPTR
184184
| DNSRecord.NS
185185
| DNSRecord.PTR
186-
| DNSRecord.Smimea
186+
| DNSRecord.SMIMEA
187187
| DNSRecord.SRV
188188
| DNSRecord.SSHFP
189189
| DNSRecord.SVCB
@@ -511,11 +511,11 @@ export namespace DNSRecord {
511511
}
512512
}
513513

514-
export interface Cert {
514+
export interface CERT {
515515
/**
516516
* Components of a CERT record.
517517
*/
518-
data: Cert.Data;
518+
data: CERT.Data;
519519

520520
/**
521521
* DNS record name (or @ for the zone apex) in Punycode.
@@ -557,7 +557,7 @@ export namespace DNSRecord {
557557
/**
558558
* Extra Cloudflare-specific information about the record.
559559
*/
560-
meta?: Cert.Meta;
560+
meta?: CERT.Meta;
561561

562562
/**
563563
* When the record was last modified.
@@ -592,7 +592,7 @@ export namespace DNSRecord {
592592
zone_name?: string;
593593
}
594594

595-
export namespace Cert {
595+
export namespace CERT {
596596
/**
597597
* Components of a CERT record.
598598
*/
@@ -1688,11 +1688,11 @@ export namespace DNSRecord {
16881688
}
16891689
}
16901690

1691-
export interface Smimea {
1691+
export interface SMIMEA {
16921692
/**
16931693
* Components of a SMIMEA record.
16941694
*/
1695-
data: Smimea.Data;
1695+
data: SMIMEA.Data;
16961696

16971697
/**
16981698
* DNS record name (or @ for the zone apex) in Punycode.
@@ -1734,7 +1734,7 @@ export namespace DNSRecord {
17341734
/**
17351735
* Extra Cloudflare-specific information about the record.
17361736
*/
1737-
meta?: Smimea.Meta;
1737+
meta?: SMIMEA.Meta;
17381738

17391739
/**
17401740
* When the record was last modified.
@@ -1769,7 +1769,7 @@ export namespace DNSRecord {
17691769
zone_name?: string;
17701770
}
17711771

1772-
export namespace Smimea {
1772+
export namespace SMIMEA {
17731773
/**
17741774
* Components of a SMIMEA record.
17751775
*/

src/resources/workers-for-platforms/dispatch/namespaces/scripts/content/bindings.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export type BindingGetResponse =
3434
| BindingGetResponse.WorkersQueueBinding
3535
| BindingGetResponse.WorkersD1Binding
3636
| BindingGetResponse.WorkersDispatchNamespaceBinding
37-
| BindingGetResponse.WorkersMTLSCertBinding;
37+
| BindingGetResponse.WorkersMTLSCERTBinding;
3838

3939
export namespace BindingGetResponse {
4040
export interface WorkersKVNamespaceBinding {
@@ -221,7 +221,7 @@ export namespace BindingGetResponse {
221221
}
222222
}
223223

224-
export interface WorkersMTLSCertBinding {
224+
export interface WorkersMTLSCERTBinding {
225225
/**
226226
* A JavaScript variable name for the binding.
227227
*/

src/resources/workers-for-platforms/dispatch/namespaces/scripts/content/settings.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export interface SettingEditResponse {
5454
| SettingEditResponse.WorkersQueueBinding
5555
| SettingEditResponse.WorkersD1Binding
5656
| SettingEditResponse.WorkersDispatchNamespaceBinding
57-
| SettingEditResponse.WorkersMTLSCertBinding
57+
| SettingEditResponse.WorkersMTLSCERTBinding
5858
>;
5959

6060
/**
@@ -280,7 +280,7 @@ export namespace SettingEditResponse {
280280
}
281281
}
282282

283-
export interface WorkersMTLSCertBinding {
283+
export interface WorkersMTLSCERTBinding {
284284
/**
285285
* A JavaScript variable name for the binding.
286286
*/
@@ -451,7 +451,7 @@ export interface SettingGetResponse {
451451
| SettingGetResponse.WorkersQueueBinding
452452
| SettingGetResponse.WorkersD1Binding
453453
| SettingGetResponse.WorkersDispatchNamespaceBinding
454-
| SettingGetResponse.WorkersMTLSCertBinding
454+
| SettingGetResponse.WorkersMTLSCERTBinding
455455
>;
456456

457457
/**
@@ -677,7 +677,7 @@ export namespace SettingGetResponse {
677677
}
678678
}
679679

680-
export interface WorkersMTLSCertBinding {
680+
export interface WorkersMTLSCERTBinding {
681681
/**
682682
* A JavaScript variable name for the binding.
683683
*/
@@ -888,7 +888,7 @@ export namespace SettingEditParams {
888888
| Result.WorkersQueueBinding
889889
| Result.WorkersD1Binding
890890
| Result.WorkersDispatchNamespaceBinding
891-
| Result.WorkersMTLSCertBinding
891+
| Result.WorkersMTLSCERTBinding
892892
>;
893893

894894
/**
@@ -1069,7 +1069,7 @@ export namespace SettingEditParams {
10691069
}
10701070
}
10711071

1072-
export interface WorkersMTLSCertBinding {
1072+
export interface WorkersMTLSCERTBinding {
10731073
/**
10741074
* The class of resource that the binding provides.
10751075
*/

src/resources/workers/scripts/settings.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export interface SettingEditResponse {
5353
| SettingEditResponse.WorkersQueueBinding
5454
| SettingEditResponse.WorkersD1Binding
5555
| SettingEditResponse.WorkersDispatchNamespaceBinding
56-
| SettingEditResponse.WorkersMTLSCertBinding
56+
| SettingEditResponse.WorkersMTLSCERTBinding
5757
>;
5858

5959
/**
@@ -279,7 +279,7 @@ export namespace SettingEditResponse {
279279
}
280280
}
281281

282-
export interface WorkersMTLSCertBinding {
282+
export interface WorkersMTLSCERTBinding {
283283
/**
284284
* A JavaScript variable name for the binding.
285285
*/
@@ -450,7 +450,7 @@ export interface SettingGetResponse {
450450
| SettingGetResponse.WorkersQueueBinding
451451
| SettingGetResponse.WorkersD1Binding
452452
| SettingGetResponse.WorkersDispatchNamespaceBinding
453-
| SettingGetResponse.WorkersMTLSCertBinding
453+
| SettingGetResponse.WorkersMTLSCERTBinding
454454
>;
455455

456456
/**
@@ -676,7 +676,7 @@ export namespace SettingGetResponse {
676676
}
677677
}
678678

679-
export interface WorkersMTLSCertBinding {
679+
export interface WorkersMTLSCERTBinding {
680680
/**
681681
* A JavaScript variable name for the binding.
682682
*/
@@ -886,7 +886,7 @@ export namespace SettingEditParams {
886886
| Result.WorkersQueueBinding
887887
| Result.WorkersD1Binding
888888
| Result.WorkersDispatchNamespaceBinding
889-
| Result.WorkersMTLSCertBinding
889+
| Result.WorkersMTLSCERTBinding
890890
>;
891891

892892
/**
@@ -1067,7 +1067,7 @@ export namespace SettingEditParams {
10671067
}
10681068
}
10691069

1070-
export interface WorkersMTLSCertBinding {
1070+
export interface WorkersMTLSCERTBinding {
10711071
/**
10721072
* The class of resource that the binding provides.
10731073
*/

src/resources/workers/services/environments/settings.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export interface SettingEditResponse {
5454
| SettingEditResponse.WorkersQueueBinding
5555
| SettingEditResponse.WorkersD1Binding
5656
| SettingEditResponse.WorkersDispatchNamespaceBinding
57-
| SettingEditResponse.WorkersMTLSCertBinding
57+
| SettingEditResponse.WorkersMTLSCERTBinding
5858
>;
5959

6060
/**
@@ -280,7 +280,7 @@ export namespace SettingEditResponse {
280280
}
281281
}
282282

283-
export interface WorkersMTLSCertBinding {
283+
export interface WorkersMTLSCERTBinding {
284284
/**
285285
* A JavaScript variable name for the binding.
286286
*/
@@ -451,7 +451,7 @@ export interface SettingGetResponse {
451451
| SettingGetResponse.WorkersQueueBinding
452452
| SettingGetResponse.WorkersD1Binding
453453
| SettingGetResponse.WorkersDispatchNamespaceBinding
454-
| SettingGetResponse.WorkersMTLSCertBinding
454+
| SettingGetResponse.WorkersMTLSCERTBinding
455455
>;
456456

457457
/**
@@ -677,7 +677,7 @@ export namespace SettingGetResponse {
677677
}
678678
}
679679

680-
export interface WorkersMTLSCertBinding {
680+
export interface WorkersMTLSCERTBinding {
681681
/**
682682
* A JavaScript variable name for the binding.
683683
*/
@@ -888,7 +888,7 @@ export namespace SettingEditParams {
888888
| Result.WorkersQueueBinding
889889
| Result.WorkersD1Binding
890890
| Result.WorkersDispatchNamespaceBinding
891-
| Result.WorkersMTLSCertBinding
891+
| Result.WorkersMTLSCERTBinding
892892
>;
893893

894894
/**
@@ -1069,7 +1069,7 @@ export namespace SettingEditParams {
10691069
}
10701070
}
10711071

1072-
export interface WorkersMTLSCertBinding {
1072+
export interface WorkersMTLSCERTBinding {
10731073
/**
10741074
* The class of resource that the binding provides.
10751075
*/

src/resources/zero-trust/gateway/rules.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ export namespace ZeroTrustGatewayRules {
282282
/**
283283
* Configure behavior when an upstream cert is invalid or an SSL error occurs.
284284
*/
285-
untrusted_cert?: RuleSettings.UntrustedCert;
285+
untrusted_cert?: RuleSettings.UntrustedCERT;
286286
}
287287

288288
export namespace RuleSettings {
@@ -476,7 +476,7 @@ export namespace ZeroTrustGatewayRules {
476476
/**
477477
* Configure behavior when an upstream cert is invalid or an SSL error occurs.
478478
*/
479-
export interface UntrustedCert {
479+
export interface UntrustedCERT {
480480
/**
481481
* The action performed when an untrusted certificate is seen. The default action
482482
* is an error with HTTP code 526.
@@ -750,7 +750,7 @@ export namespace RuleCreateParams {
750750
/**
751751
* Configure behavior when an upstream cert is invalid or an SSL error occurs.
752752
*/
753-
untrusted_cert?: RuleSettings.UntrustedCert;
753+
untrusted_cert?: RuleSettings.UntrustedCERT;
754754
}
755755

756756
export namespace RuleSettings {
@@ -944,7 +944,7 @@ export namespace RuleCreateParams {
944944
/**
945945
* Configure behavior when an upstream cert is invalid or an SSL error occurs.
946946
*/
947-
export interface UntrustedCert {
947+
export interface UntrustedCERT {
948948
/**
949949
* The action performed when an untrusted certificate is seen. The default action
950950
* is an error with HTTP code 526.
@@ -1214,7 +1214,7 @@ export namespace RuleUpdateParams {
12141214
/**
12151215
* Configure behavior when an upstream cert is invalid or an SSL error occurs.
12161216
*/
1217-
untrusted_cert?: RuleSettings.UntrustedCert;
1217+
untrusted_cert?: RuleSettings.UntrustedCERT;
12181218
}
12191219

12201220
export namespace RuleSettings {
@@ -1408,7 +1408,7 @@ export namespace RuleUpdateParams {
14081408
/**
14091409
* Configure behavior when an upstream cert is invalid or an SSL error occurs.
14101410
*/
1411-
export interface UntrustedCert {
1411+
export interface UntrustedCERT {
14121412
/**
14131413
* The action performed when an untrusted certificate is seen. The default action
14141414
* is an error with HTTP code 526.

0 commit comments

Comments
 (0)