Skip to content

Commit 6f020bd

Browse files
stainless-app[bot]stainless-bot
authored andcommitted
feat(api): update via SDK Studio (#1017)
1 parent e0cc0ec commit 6f020bd

File tree

10 files changed

+101
-128
lines changed

10 files changed

+101
-128
lines changed

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
configured_endpoints: 1348
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-36a9d717773ebb507fd0744af578aa64b697030857c602c77458156a911fcab9.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-07c6e460b4a34d21b666d639912027e5225b6d5e98748056a269965b196157ec.yml

api.md

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2631,15 +2631,16 @@ Methods:
26312631

26322632
## Settings
26332633

2634-
### SchemaValidation
2635-
26362634
Types:
26372635

2638-
- <code><a href="./src/resources/api-gateway/settings/schema-validation.ts">Settings</a></code>
2636+
- <code><a href="./src/resources/api-gateway/settings/settings.ts">Settings</a></code>
2637+
2638+
### SchemaValidation
26392639

26402640
Methods:
26412641

26422642
- <code title="put /zones/{zone_id}/api_gateway/settings/schema_validation">client.apiGateway.settings.schemaValidation.<a href="./src/resources/api-gateway/settings/schema-validation.ts">update</a>({ ...params }) -> Settings</code>
2643+
- <code title="patch /zones/{zone_id}/api_gateway/settings/schema_validation">client.apiGateway.settings.schemaValidation.<a href="./src/resources/api-gateway/settings/schema-validation.ts">edit</a>({ ...params }) -> Settings</code>
26432644
- <code title="get /zones/{zone_id}/api_gateway/settings/schema_validation">client.apiGateway.settings.schemaValidation.<a href="./src/resources/api-gateway/settings/schema-validation.ts">get</a>({ ...params }) -> Settings</code>
26442645

26452646
## UserSchemas
@@ -2669,12 +2670,6 @@ Methods:
26692670

26702671
- <code title="get /zones/{zone_id}/api_gateway/user_schemas/{schema_id}/operations">client.apiGateway.userSchemas.operations.<a href="./src/resources/api-gateway/user-schemas/operations.ts">list</a>(schemaId, { ...params }) -> OperationListResponsesSinglePage</code>
26712672

2672-
## SchemaValidation
2673-
2674-
Methods:
2675-
2676-
- <code title="patch /zones/{zone_id}/api_gateway/settings/schema_validation">client.apiGateway.schemaValidation.<a href="./src/resources/api-gateway/schema-validation.ts">edit</a>({ ...params }) -> Settings</code>
2677-
26782673
# ManagedHeaders
26792674

26802675
Types:

src/resources/api-gateway/api-gateway.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import { APIResource } from '../../resource';
44
import * as ConfigurationsAPI from './configurations';
5-
import * as SchemaValidationAPI from './schema-validation';
65
import * as SchemasAPI from './schemas';
76
import * as DiscoveryAPI from './discovery/discovery';
87
import * as OperationsAPI from './operations/operations';
@@ -16,9 +15,6 @@ export class APIGateway extends APIResource {
1615
schemas: SchemasAPI.Schemas = new SchemasAPI.Schemas(this._client);
1716
settings: SettingsAPI.Settings = new SettingsAPI.Settings(this._client);
1817
userSchemas: UserSchemasAPI.UserSchemas = new UserSchemasAPI.UserSchemas(this._client);
19-
schemaValidation: SchemaValidationAPI.SchemaValidation = new SchemaValidationAPI.SchemaValidation(
20-
this._client,
21-
);
2218
}
2319

2420
export namespace APIGateway {
@@ -55,6 +51,4 @@ export namespace APIGateway {
5551
export import UserSchemaDeleteParams = UserSchemasAPI.UserSchemaDeleteParams;
5652
export import UserSchemaEditParams = UserSchemasAPI.UserSchemaEditParams;
5753
export import UserSchemaGetParams = UserSchemasAPI.UserSchemaGetParams;
58-
export import SchemaValidation = SchemaValidationAPI.SchemaValidation;
59-
export import SchemaValidationEditParams = SchemaValidationAPI.SchemaValidationEditParams;
6054
}

src/resources/api-gateway/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,4 @@ export {
4040
UserSchemas,
4141
} from './user-schemas/index';
4242
export { SchemaListResponse, SchemaListParams, Schemas } from './schemas';
43-
export { SchemaValidationEditParams, SchemaValidation } from './schema-validation';
4443
export { Settings } from './settings/index';

src/resources/api-gateway/schema-validation.ts

Lines changed: 0 additions & 59 deletions
This file was deleted.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3-
export { Settings } from './settings';
43
export {
5-
Settings,
64
SchemaValidationUpdateParams,
5+
SchemaValidationEditParams,
76
SchemaValidationGetParams,
87
SchemaValidation,
98
} from './schema-validation';
9+
export { Settings } from './settings';

src/resources/api-gateway/settings/schema-validation.ts

Lines changed: 46 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,55 @@
33
import * as Core from '../../../core';
44
import { APIResource } from '../../../resource';
55
import * as SchemaValidationAPI from './schema-validation';
6+
import * as SettingsAPI from './settings';
67

78
export class SchemaValidation extends APIResource {
89
/**
910
* Updates zone level schema validation settings on the zone
1011
*/
11-
update(params: SchemaValidationUpdateParams, options?: Core.RequestOptions): Core.APIPromise<Settings> {
12+
update(
13+
params: SchemaValidationUpdateParams,
14+
options?: Core.RequestOptions,
15+
): Core.APIPromise<SettingsAPI.Settings> {
1216
const { zone_id, ...body } = params;
1317
return this._client.put(`/zones/${zone_id}/api_gateway/settings/schema_validation`, { body, ...options });
1418
}
1519

20+
/**
21+
* Updates zone level schema validation settings on the zone
22+
*/
23+
edit(
24+
params: SchemaValidationEditParams,
25+
options?: Core.RequestOptions,
26+
): Core.APIPromise<SettingsAPI.Settings> {
27+
const { zone_id, ...body } = params;
28+
return this._client.patch(`/zones/${zone_id}/api_gateway/settings/schema_validation`, {
29+
body,
30+
...options,
31+
});
32+
}
33+
1634
/**
1735
* Retrieves zone level schema validation settings currently set on the zone
1836
*/
19-
get(params: SchemaValidationGetParams, options?: Core.RequestOptions): Core.APIPromise<Settings> {
37+
get(
38+
params: SchemaValidationGetParams,
39+
options?: Core.RequestOptions,
40+
): Core.APIPromise<SettingsAPI.Settings> {
2041
const { zone_id } = params;
2142
return this._client.get(`/zones/${zone_id}/api_gateway/settings/schema_validation`, options);
2243
}
2344
}
2445

25-
export interface Settings {
46+
export interface SchemaValidationUpdateParams {
2647
/**
27-
* The default mitigation action used when there is no mitigation action defined on
28-
* the operation
48+
* Path param: Identifier
49+
*/
50+
zone_id: string;
51+
52+
/**
53+
* Body param: The default mitigation action used when there is no mitigation
54+
* action defined on the operation
2955
*
3056
* Mitigation actions are as follows:
3157
*
@@ -35,45 +61,49 @@ export interface Settings {
3561
* A special value of of `none` will skip running schema validation entirely for
3662
* the request when there is no mitigation action defined on the operation
3763
*/
38-
validation_default_mitigation_action?: 'none' | 'log' | 'block';
64+
validation_default_mitigation_action: 'none' | 'log' | 'block';
3965

4066
/**
41-
* When set, this overrides both zone level and operation level mitigation actions.
67+
* Body param: When set, this overrides both zone level and operation level
68+
* mitigation actions.
4269
*
4370
* - `none` will skip running schema validation entirely for the request
4471
* - `null` indicates that no override is in place
72+
*
73+
* To clear any override, use the special value `disable_override` or `null`
4574
*/
46-
validation_override_mitigation_action?: 'none' | null;
75+
validation_override_mitigation_action?: 'none' | 'disable_override' | null;
4776
}
4877

49-
export interface SchemaValidationUpdateParams {
78+
export interface SchemaValidationEditParams {
5079
/**
5180
* Path param: Identifier
5281
*/
5382
zone_id: string;
5483

5584
/**
5685
* Body param: The default mitigation action used when there is no mitigation
57-
* action defined on the operation
58-
*
59-
* Mitigation actions are as follows:
86+
* action defined on the operation Mitigation actions are as follows:
6087
*
6188
* - `log` - log request when request does not conform to schema
6289
* - `block` - deny access to the site when request does not conform to schema
6390
*
6491
* A special value of of `none` will skip running schema validation entirely for
6592
* the request when there is no mitigation action defined on the operation
93+
*
94+
* `null` will have no effect.
6695
*/
67-
validation_default_mitigation_action: 'none' | 'log' | 'block';
96+
validation_default_mitigation_action?: 'none' | 'log' | 'block' | null;
6897

6998
/**
7099
* Body param: When set, this overrides both zone level and operation level
71100
* mitigation actions.
72101
*
73102
* - `none` will skip running schema validation entirely for the request
74-
* - `null` indicates that no override is in place
75103
*
76-
* To clear any override, use the special value `disable_override` or `null`
104+
* To clear any override, use the special value `disable_override`
105+
*
106+
* `null` will have no effect.
77107
*/
78108
validation_override_mitigation_action?: 'none' | 'disable_override' | null;
79109
}
@@ -86,7 +116,7 @@ export interface SchemaValidationGetParams {
86116
}
87117

88118
export namespace SchemaValidation {
89-
export import Settings = SchemaValidationAPI.Settings;
90119
export import SchemaValidationUpdateParams = SchemaValidationAPI.SchemaValidationUpdateParams;
120+
export import SchemaValidationEditParams = SchemaValidationAPI.SchemaValidationEditParams;
91121
export import SchemaValidationGetParams = SchemaValidationAPI.SchemaValidationGetParams;
92122
}
Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

33
import { APIResource } from '../../../resource';
4+
import * as SettingsAPI from './settings';
45
import * as SchemaValidationAPI from './schema-validation';
56

67
export class Settings extends APIResource {
@@ -9,9 +10,34 @@ export class Settings extends APIResource {
910
);
1011
}
1112

13+
export interface Settings {
14+
/**
15+
* The default mitigation action used when there is no mitigation action defined on
16+
* the operation
17+
*
18+
* Mitigation actions are as follows:
19+
*
20+
* - `log` - log request when request does not conform to schema
21+
* - `block` - deny access to the site when request does not conform to schema
22+
*
23+
* A special value of of `none` will skip running schema validation entirely for
24+
* the request when there is no mitigation action defined on the operation
25+
*/
26+
validation_default_mitigation_action?: 'none' | 'log' | 'block';
27+
28+
/**
29+
* When set, this overrides both zone level and operation level mitigation actions.
30+
*
31+
* - `none` will skip running schema validation entirely for the request
32+
* - `null` indicates that no override is in place
33+
*/
34+
validation_override_mitigation_action?: 'none' | null;
35+
}
36+
1237
export namespace Settings {
38+
export import Settings = SettingsAPI.Settings;
1339
export import SchemaValidation = SchemaValidationAPI.SchemaValidation;
14-
export import Settings = SchemaValidationAPI.Settings;
1540
export import SchemaValidationUpdateParams = SchemaValidationAPI.SchemaValidationUpdateParams;
41+
export import SchemaValidationEditParams = SchemaValidationAPI.SchemaValidationEditParams;
1642
export import SchemaValidationGetParams = SchemaValidationAPI.SchemaValidationGetParams;
1743
}

tests/api-resources/api-gateway/schema-validation.test.ts

Lines changed: 0 additions & 33 deletions
This file was deleted.

tests/api-resources/api-gateway/settings/schema-validation.test.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,27 @@ describe('resource schemaValidation', () => {
3232
});
3333
});
3434

35+
test('edit: only required params', async () => {
36+
const responsePromise = cloudflare.apiGateway.settings.schemaValidation.edit({
37+
zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
38+
});
39+
const rawResponse = await responsePromise.asResponse();
40+
expect(rawResponse).toBeInstanceOf(Response);
41+
const response = await responsePromise;
42+
expect(response).not.toBeInstanceOf(Response);
43+
const dataAndResponse = await responsePromise.withResponse();
44+
expect(dataAndResponse.data).toBe(response);
45+
expect(dataAndResponse.response).toBe(rawResponse);
46+
});
47+
48+
test('edit: required and optional params', async () => {
49+
const response = await cloudflare.apiGateway.settings.schemaValidation.edit({
50+
zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
51+
validation_default_mitigation_action: 'block',
52+
validation_override_mitigation_action: 'none',
53+
});
54+
});
55+
3556
test('get: only required params', async () => {
3657
const responsePromise = cloudflare.apiGateway.settings.schemaValidation.get({
3758
zone_id: '023e105f4ecef8ad9ca31a8372d0c353',

0 commit comments

Comments
 (0)