Skip to content

Commit

Permalink
feat(api): OpenAPI spec update via Stainless API (#1141)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored and stainless-bot committed Jul 16, 2024
1 parent d6bc55c commit 72020d7
Show file tree
Hide file tree
Showing 18 changed files with 681 additions and 145 deletions.
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 1256
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-74d68374448e03b29a39bb6cdf6c39cdeaaaa691dd9c38f46a26a1d562c8ee37.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-b116e60da4a69a05bc8823c2397e4a33d111c82a6b458ea4f480d0ba52ea8de0.yml
14 changes: 8 additions & 6 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -2086,7 +2086,7 @@ Types:

Methods:

- <code title="get /zones/{zone_id}/api_gateway/discovery/operations">client.apiGateway.discovery.operations.<a href="./src/resources/api-gateway/discovery/operations.ts">list</a>({ ...params }) -> DiscoveryOperationsSinglePage</code>
- <code title="get /zones/{zone_id}/api_gateway/discovery/operations">client.apiGateway.discovery.operations.<a href="./src/resources/api-gateway/discovery/operations.ts">list</a>({ ...params }) -> DiscoveryOperationsV4PagePaginationArray</code>
- <code title="patch /zones/{zone_id}/api_gateway/discovery/operations/{operation_id}">client.apiGateway.discovery.operations.<a href="./src/resources/api-gateway/discovery/operations.ts">edit</a>(operationId, { ...params }) -> OperationEditResponse</code>

## Operations
Expand All @@ -2095,14 +2095,16 @@ Types:

- <code><a href="./src/resources/api-gateway/operations/operations.ts">APIShield</a></code>
- <code><a href="./src/resources/api-gateway/operations/operations.ts">OperationCreateResponse</a></code>
- <code><a href="./src/resources/api-gateway/operations/operations.ts">OperationListResponse</a></code>
- <code><a href="./src/resources/api-gateway/operations/operations.ts">OperationDeleteResponse</a></code>
- <code><a href="./src/resources/api-gateway/operations/operations.ts">OperationGetResponse</a></code>

Methods:

- <code title="post /zones/{zone_id}/api_gateway/operations">client.apiGateway.operations.<a href="./src/resources/api-gateway/operations/operations.ts">create</a>([ ...body ]) -> OperationCreateResponse | null</code>
- <code title="get /zones/{zone_id}/api_gateway/operations">client.apiGateway.operations.<a href="./src/resources/api-gateway/operations/operations.ts">list</a>({ ...params }) -> APIShieldsSinglePage</code>
- <code title="post /zones/{zone_id}/api_gateway/operations">client.apiGateway.operations.<a href="./src/resources/api-gateway/operations/operations.ts">create</a>([ ...body ]) -> OperationCreateResponse</code>
- <code title="get /zones/{zone_id}/api_gateway/operations">client.apiGateway.operations.<a href="./src/resources/api-gateway/operations/operations.ts">list</a>({ ...params }) -> OperationListResponsesV4PagePaginationArray</code>
- <code title="delete /zones/{zone_id}/api_gateway/operations/{operation_id}">client.apiGateway.operations.<a href="./src/resources/api-gateway/operations/operations.ts">delete</a>(operationId, { ...params }) -> OperationDeleteResponse</code>
- <code title="get /zones/{zone_id}/api_gateway/operations/{operation_id}">client.apiGateway.operations.<a href="./src/resources/api-gateway/operations/operations.ts">get</a>(operationId, { ...params }) -> APIShield</code>
- <code title="get /zones/{zone_id}/api_gateway/operations/{operation_id}">client.apiGateway.operations.<a href="./src/resources/api-gateway/operations/operations.ts">get</a>(operationId, { ...params }) -> OperationGetResponse</code>

### SchemaValidation

Expand Down Expand Up @@ -2154,7 +2156,7 @@ Types:
Methods:

- <code title="post /zones/{zone_id}/api_gateway/user_schemas">client.apiGateway.userSchemas.<a href="./src/resources/api-gateway/user-schemas/user-schemas.ts">create</a>({ ...params }) -> SchemaUpload</code>
- <code title="get /zones/{zone_id}/api_gateway/user_schemas">client.apiGateway.userSchemas.<a href="./src/resources/api-gateway/user-schemas/user-schemas.ts">list</a>({ ...params }) -> PublicSchemasSinglePage</code>
- <code title="get /zones/{zone_id}/api_gateway/user_schemas">client.apiGateway.userSchemas.<a href="./src/resources/api-gateway/user-schemas/user-schemas.ts">list</a>({ ...params }) -> PublicSchemasV4PagePaginationArray</code>
- <code title="delete /zones/{zone_id}/api_gateway/user_schemas/{schema_id}">client.apiGateway.userSchemas.<a href="./src/resources/api-gateway/user-schemas/user-schemas.ts">delete</a>(schemaId, { ...params }) -> UserSchemaDeleteResponse</code>
- <code title="patch /zones/{zone_id}/api_gateway/user_schemas/{schema_id}">client.apiGateway.userSchemas.<a href="./src/resources/api-gateway/user-schemas/user-schemas.ts">edit</a>(schemaId, { ...params }) -> PublicSchema</code>
- <code title="get /zones/{zone_id}/api_gateway/user_schemas/{schema_id}">client.apiGateway.userSchemas.<a href="./src/resources/api-gateway/user-schemas/user-schemas.ts">get</a>(schemaId, { ...params }) -> PublicSchema</code>
Expand All @@ -2167,7 +2169,7 @@ Types:

Methods:

- <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>
- <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 }) -> OperationListResponsesV4PagePaginationArray</code>

# ManagedHeaders

Expand Down
6 changes: 4 additions & 2 deletions src/resources/api-gateway/api-gateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ export namespace APIGateway {
export import Operations = OperationsAPI.Operations;
export import APIShield = OperationsAPI.APIShield;
export import OperationCreateResponse = OperationsAPI.OperationCreateResponse;
export import OperationListResponse = OperationsAPI.OperationListResponse;
export import OperationDeleteResponse = OperationsAPI.OperationDeleteResponse;
export import APIShieldsSinglePage = OperationsAPI.APIShieldsSinglePage;
export import OperationGetResponse = OperationsAPI.OperationGetResponse;
export import OperationListResponsesV4PagePaginationArray = OperationsAPI.OperationListResponsesV4PagePaginationArray;
export import OperationCreateParams = OperationsAPI.OperationCreateParams;
export import OperationListParams = OperationsAPI.OperationListParams;
export import OperationDeleteParams = OperationsAPI.OperationDeleteParams;
Expand All @@ -45,7 +47,7 @@ export namespace APIGateway {
export import PublicSchema = UserSchemasAPI.PublicSchema;
export import SchemaUpload = UserSchemasAPI.SchemaUpload;
export import UserSchemaDeleteResponse = UserSchemasAPI.UserSchemaDeleteResponse;
export import PublicSchemasSinglePage = UserSchemasAPI.PublicSchemasSinglePage;
export import PublicSchemasV4PagePaginationArray = UserSchemasAPI.PublicSchemasV4PagePaginationArray;
export import UserSchemaCreateParams = UserSchemasAPI.UserSchemaCreateParams;
export import UserSchemaListParams = UserSchemasAPI.UserSchemaListParams;
export import UserSchemaDeleteParams = UserSchemasAPI.UserSchemaDeleteParams;
Expand Down
23 changes: 14 additions & 9 deletions src/resources/api-gateway/configurations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import { APIResource } from '../../resource';
import * as Core from '../../core';
import * as ConfigurationsAPI from './configurations';
import * as UserSchemasAPI from './user-schemas/user-schemas';

export class Configurations extends APIResource {
/**
Expand All @@ -13,12 +14,7 @@ export class Configurations extends APIResource {
options?: Core.RequestOptions,
): Core.APIPromise<ConfigurationUpdateResponse> {
const { zone_id, ...body } = params;
return (
this._client.put(`/zones/${zone_id}/api_gateway/configuration`, {
body,
...options,
}) as Core.APIPromise<{ result: ConfigurationUpdateResponse }>
)._thenUnwrap((obj) => obj.result);
return this._client.put(`/zones/${zone_id}/api_gateway/configuration`, { body, ...options });
}

/**
Expand All @@ -36,7 +32,7 @@ export class Configurations extends APIResource {
}

export interface Configuration {
auth_id_characteristics?: Array<
auth_id_characteristics: Array<
Configuration.APIShieldAuthIDCharacteristic | Configuration.APIShieldAuthIDCharacteristicJwtClaim
>;
}
Expand Down Expand Up @@ -79,7 +75,16 @@ export namespace Configuration {
}
}

export type ConfigurationUpdateResponse = unknown | string | null;
export interface ConfigurationUpdateResponse {
errors: UserSchemasAPI.Message;

messages: UserSchemasAPI.Message;

/**
* Whether the API call was successful
*/
success: true;
}

export interface ConfigurationUpdateParams {
/**
Expand All @@ -90,7 +95,7 @@ export interface ConfigurationUpdateParams {
/**
* Body param:
*/
auth_id_characteristics?: Array<
auth_id_characteristics: Array<
| ConfigurationUpdateParams.APIShieldAuthIDCharacteristic
| ConfigurationUpdateParams.APIShieldAuthIDCharacteristicJwtClaim
>;
Expand Down
10 changes: 5 additions & 5 deletions src/resources/api-gateway/discovery/discovery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { APIResource } from '../../../resource';
import * as Core from '../../../core';
import * as DiscoveryAPI from './discovery';
import * as OperationsAPI from './operations';
import { SinglePage } from '../../../pagination';
import { V4PagePaginationArray } from '../../../pagination';

export class Discovery extends APIResource {
operations: OperationsAPI.Operations = new OperationsAPI.Operations(this._client);
Expand All @@ -23,11 +23,11 @@ export class Discovery extends APIResource {
}
}

export class DiscoveryOperationsSinglePage extends SinglePage<DiscoveryOperation> {}
export class DiscoveryOperationsV4PagePaginationArray extends V4PagePaginationArray<DiscoveryOperation> {}

export interface DiscoveryOperation {
/**
* UUID identifier
* UUID
*/
id: string;

Expand Down Expand Up @@ -91,9 +91,9 @@ export namespace DiscoveryOperation {
}

export interface DiscoveryGetResponse {
schemas?: Array<unknown>;
schemas: Array<unknown>;

timestamp?: string;
timestamp: string;
}

export interface DiscoveryGetParams {
Expand Down
2 changes: 1 addition & 1 deletion src/resources/api-gateway/discovery/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export {
DiscoveryOperation,
DiscoveryGetResponse,
DiscoveryGetParams,
DiscoveryOperationsSinglePage,
DiscoveryOperationsV4PagePaginationArray,
Discovery,
} from './discovery';
export { OperationEditResponse, OperationListParams, OperationEditParams, Operations } from './operations';
21 changes: 6 additions & 15 deletions src/resources/api-gateway/discovery/operations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import { APIResource } from '../../../resource';
import * as Core from '../../../core';
import * as OperationsAPI from './operations';
import * as DiscoveryAPI from './discovery';
import { DiscoveryOperationsSinglePage } from './discovery';
import { DiscoveryOperationsV4PagePaginationArray } from './discovery';
import { type V4PagePaginationArrayParams } from '../../../pagination';

export class Operations extends APIResource {
/**
Expand All @@ -13,11 +14,11 @@ export class Operations extends APIResource {
list(
params: OperationListParams,
options?: Core.RequestOptions,
): Core.PagePromise<DiscoveryOperationsSinglePage, DiscoveryAPI.DiscoveryOperation> {
): Core.PagePromise<DiscoveryOperationsV4PagePaginationArray, DiscoveryAPI.DiscoveryOperation> {
const { zone_id, ...query } = params;
return this._client.getAPIList(
`/zones/${zone_id}/api_gateway/discovery/operations`,
DiscoveryOperationsSinglePage,
DiscoveryOperationsV4PagePaginationArray,
{ query, ...options },
);
}
Expand Down Expand Up @@ -51,7 +52,7 @@ export interface OperationEditResponse {
state?: 'review' | 'saved' | 'ignored';
}

export interface OperationListParams {
export interface OperationListParams extends V4PagePaginationArrayParams {
/**
* Path param: Identifier
*/
Expand Down Expand Up @@ -98,16 +99,6 @@ export interface OperationListParams {
*/
origin?: 'ML' | 'SessionIdentifier';

/**
* Query param: Page number of paginated results.
*/
page?: unknown;

/**
* Query param: Maximum number of results per page.
*/
per_page?: unknown;

/**
* Query param: Filter results to only include discovery results in a particular
* state. States are as follows
Expand Down Expand Up @@ -142,4 +133,4 @@ export namespace Operations {
export import OperationEditParams = OperationsAPI.OperationEditParams;
}

export { DiscoveryOperationsSinglePage };
export { DiscoveryOperationsV4PagePaginationArray };
8 changes: 5 additions & 3 deletions src/resources/api-gateway/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ export { APIGateway } from './api-gateway';
export {
APIShield,
OperationCreateResponse,
OperationListResponse,
OperationDeleteResponse,
OperationGetResponse,
OperationCreateParams,
OperationListParams,
OperationDeleteParams,
OperationGetParams,
APIShieldsSinglePage,
OperationListResponsesV4PagePaginationArray,
Operations,
} from './operations/index';
export {
Expand All @@ -23,7 +25,7 @@ export {
DiscoveryOperation,
DiscoveryGetResponse,
DiscoveryGetParams,
DiscoveryOperationsSinglePage,
DiscoveryOperationsV4PagePaginationArray,
Discovery,
} from './discovery/index';
export {
Expand All @@ -36,7 +38,7 @@ export {
UserSchemaDeleteParams,
UserSchemaEditParams,
UserSchemaGetParams,
PublicSchemasSinglePage,
PublicSchemasV4PagePaginationArray,
UserSchemas,
} from './user-schemas/index';
export { SchemaListResponse, SchemaListParams, Schemas } from './schemas';
Expand Down
4 changes: 3 additions & 1 deletion src/resources/api-gateway/operations/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
export {
APIShield,
OperationCreateResponse,
OperationListResponse,
OperationDeleteResponse,
OperationGetResponse,
OperationCreateParams,
OperationListParams,
OperationDeleteParams,
OperationGetParams,
APIShieldsSinglePage,
OperationListResponsesV4PagePaginationArray,
Operations,
} from './operations';
export {
Expand Down
Loading

0 comments on commit 72020d7

Please sign in to comment.