Skip to content

Commit

Permalink
feat: OpenAPI spec update via Stainless API
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-bot committed Mar 10, 2024
1 parent 32d2349 commit 25e30c0
Show file tree
Hide file tree
Showing 14 changed files with 476 additions and 371 deletions.
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
configured_endpoints: 1256
configured_endpoints: 1255
21 changes: 6 additions & 15 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -2954,14 +2954,6 @@ Methods:

# AuditLogs

Types:

- <code><a href="./src/resources/audit-logs.ts">AuditLogListResponse</a></code>

Methods:

- <code title="get /accounts/{account_identifier}/audit_logs">client.auditLogs.<a href="./src/resources/audit-logs.ts">list</a>(accountIdentifier, { ...params }) -> AuditLogListResponsesV4PagePaginationArray</code>

# Billing

## Profiles
Expand Down Expand Up @@ -3784,7 +3776,6 @@ Methods:

Types:

- <code><a href="./src/resources/alerting/v3/destinations/pagerduty.ts">AaaPagerduty</a></code>
- <code><a href="./src/resources/alerting/v3/destinations/pagerduty.ts">PagerdutyCreateResponse</a></code>
- <code><a href="./src/resources/alerting/v3/destinations/pagerduty.ts">PagerdutyDeleteResponse</a></code>
- <code><a href="./src/resources/alerting/v3/destinations/pagerduty.ts">PagerdutyGetResponse</a></code>
Expand All @@ -3801,47 +3792,47 @@ Methods:

Types:

- <code><a href="./src/resources/alerting/v3/destinations/webhooks.ts">AaaWebhooks</a></code>
- <code><a href="./src/resources/alerting/v3/destinations/webhooks.ts">WebhookCreateResponse</a></code>
- <code><a href="./src/resources/alerting/v3/destinations/webhooks.ts">WebhookUpdateResponse</a></code>
- <code><a href="./src/resources/alerting/v3/destinations/webhooks.ts">WebhookListResponse</a></code>
- <code><a href="./src/resources/alerting/v3/destinations/webhooks.ts">WebhookDeleteResponse</a></code>
- <code><a href="./src/resources/alerting/v3/destinations/webhooks.ts">WebhookGetResponse</a></code>

Methods:

- <code title="post /accounts/{account_id}/alerting/v3/destinations/webhooks">client.alerting.v3.destinations.webhooks.<a href="./src/resources/alerting/v3/destinations/webhooks.ts">create</a>({ ...params }) -> WebhookCreateResponse</code>
- <code title="put /accounts/{account_id}/alerting/v3/destinations/webhooks/{webhook_id}">client.alerting.v3.destinations.webhooks.<a href="./src/resources/alerting/v3/destinations/webhooks.ts">update</a>(webhookId, { ...params }) -> WebhookUpdateResponse</code>
- <code title="get /accounts/{account_id}/alerting/v3/destinations/webhooks">client.alerting.v3.destinations.webhooks.<a href="./src/resources/alerting/v3/destinations/webhooks.ts">list</a>({ ...params }) -> WebhookListResponse | null</code>
- <code title="delete /accounts/{account_id}/alerting/v3/destinations/webhooks/{webhook_id}">client.alerting.v3.destinations.webhooks.<a href="./src/resources/alerting/v3/destinations/webhooks.ts">delete</a>(webhookId, { ...params }) -> WebhookDeleteResponse | null</code>
- <code title="get /accounts/{account_id}/alerting/v3/destinations/webhooks/{webhook_id}">client.alerting.v3.destinations.webhooks.<a href="./src/resources/alerting/v3/destinations/webhooks.ts">get</a>(webhookId, { ...params }) -> AaaWebhooks</code>
- <code title="get /accounts/{account_id}/alerting/v3/destinations/webhooks/{webhook_id}">client.alerting.v3.destinations.webhooks.<a href="./src/resources/alerting/v3/destinations/webhooks.ts">get</a>(webhookId, { ...params }) -> WebhookGetResponse</code>

### Histories

Types:

- <code><a href="./src/resources/alerting/v3/histories.ts">AaaHistory</a></code>
- <code><a href="./src/resources/alerting/v3/histories.ts">HistoryListResponse</a></code>

Methods:

- <code title="get /accounts/{account_id}/alerting/v3/history">client.alerting.v3.histories.<a href="./src/resources/alerting/v3/histories.ts">list</a>({ ...params }) -> AaaHistoriesV4PagePaginationArray</code>
- <code title="get /accounts/{account_id}/alerting/v3/history">client.alerting.v3.histories.<a href="./src/resources/alerting/v3/histories.ts">list</a>({ ...params }) -> HistoryListResponsesV4PagePaginationArray</code>

### Policies

Types:

- <code><a href="./src/resources/alerting/v3/policies.ts">AaaPolicies</a></code>
- <code><a href="./src/resources/alerting/v3/policies.ts">PolicyCreateResponse</a></code>
- <code><a href="./src/resources/alerting/v3/policies.ts">PolicyUpdateResponse</a></code>
- <code><a href="./src/resources/alerting/v3/policies.ts">PolicyListResponse</a></code>
- <code><a href="./src/resources/alerting/v3/policies.ts">PolicyDeleteResponse</a></code>
- <code><a href="./src/resources/alerting/v3/policies.ts">PolicyGetResponse</a></code>

Methods:

- <code title="post /accounts/{account_id}/alerting/v3/policies">client.alerting.v3.policies.<a href="./src/resources/alerting/v3/policies.ts">create</a>({ ...params }) -> PolicyCreateResponse</code>
- <code title="put /accounts/{account_id}/alerting/v3/policies/{policy_id}">client.alerting.v3.policies.<a href="./src/resources/alerting/v3/policies.ts">update</a>(policyId, { ...params }) -> PolicyUpdateResponse</code>
- <code title="get /accounts/{account_id}/alerting/v3/policies">client.alerting.v3.policies.<a href="./src/resources/alerting/v3/policies.ts">list</a>({ ...params }) -> PolicyListResponse | null</code>
- <code title="delete /accounts/{account_id}/alerting/v3/policies/{policy_id}">client.alerting.v3.policies.<a href="./src/resources/alerting/v3/policies.ts">delete</a>(policyId, { ...params }) -> PolicyDeleteResponse | null</code>
- <code title="get /accounts/{account_id}/alerting/v3/policies/{policy_id}">client.alerting.v3.policies.<a href="./src/resources/alerting/v3/policies.ts">get</a>(policyId, { ...params }) -> AaaPolicies</code>
- <code title="get /accounts/{account_id}/alerting/v3/policies/{policy_id}">client.alerting.v3.policies.<a href="./src/resources/alerting/v3/policies.ts">get</a>(policyId, { ...params }) -> PolicyGetResponse</code>

# D1

Expand Down
3 changes: 0 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -672,9 +672,6 @@ export namespace Cloudflare {
export import Addressing = API.Addressing;

export import AuditLogs = API.AuditLogs;
export import AuditLogListResponse = API.AuditLogListResponse;
export import AuditLogListResponsesV4PagePaginationArray = API.AuditLogListResponsesV4PagePaginationArray;
export import AuditLogListParams = API.AuditLogListParams;

export import Billing = API.Billing;

Expand Down
3 changes: 1 addition & 2 deletions src/resources/alerting/v3/destinations/destinations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export namespace Destinations {
export import EligibleGetResponse = EligibleAPI.EligibleGetResponse;
export import EligibleGetParams = EligibleAPI.EligibleGetParams;
export import Pagerduty = PagerdutyAPI.Pagerduty;
export import AaaPagerduty = PagerdutyAPI.AaaPagerduty;
export import PagerdutyCreateResponse = PagerdutyAPI.PagerdutyCreateResponse;
export import PagerdutyDeleteResponse = PagerdutyAPI.PagerdutyDeleteResponse;
export import PagerdutyGetResponse = PagerdutyAPI.PagerdutyGetResponse;
Expand All @@ -26,11 +25,11 @@ export namespace Destinations {
export import PagerdutyGetParams = PagerdutyAPI.PagerdutyGetParams;
export import PagerdutyLinkParams = PagerdutyAPI.PagerdutyLinkParams;
export import Webhooks = WebhooksAPI.Webhooks;
export import AaaWebhooks = WebhooksAPI.AaaWebhooks;
export import WebhookCreateResponse = WebhooksAPI.WebhookCreateResponse;
export import WebhookUpdateResponse = WebhooksAPI.WebhookUpdateResponse;
export import WebhookListResponse = WebhooksAPI.WebhookListResponse;
export import WebhookDeleteResponse = WebhooksAPI.WebhookDeleteResponse;
export import WebhookGetResponse = WebhooksAPI.WebhookGetResponse;
export import WebhookCreateParams = WebhooksAPI.WebhookCreateParams;
export import WebhookUpdateParams = WebhooksAPI.WebhookUpdateParams;
export import WebhookListParams = WebhooksAPI.WebhookListParams;
Expand Down
7 changes: 3 additions & 4 deletions src/resources/alerting/v3/destinations/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// File generated from our OpenAPI spec by Stainless.

export { Destinations } from './destinations';
export { EligibleGetResponse, EligibleGetParams, Eligible } from './eligible';
export {
AaaPagerduty,
PagerdutyCreateResponse,
PagerdutyDeleteResponse,
PagerdutyGetResponse,
Expand All @@ -13,17 +14,15 @@ export {
Pagerduty,
} from './pagerduty';
export {
AaaWebhooks,
WebhookCreateResponse,
WebhookUpdateResponse,
WebhookListResponse,
WebhookDeleteResponse,
WebhookGetResponse,
WebhookCreateParams,
WebhookUpdateParams,
WebhookListParams,
WebhookDeleteParams,
WebhookGetParams,
Webhooks,
} from './webhooks';
export { Destinations } from './destinations';
export { EligibleGetResponse, EligibleGetParams, Eligible } from './eligible';
31 changes: 16 additions & 15 deletions src/resources/alerting/v3/destinations/pagerduty.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,28 +71,30 @@ export class Pagerduty extends APIResource {
}
}

export interface AaaPagerduty {
/**
* UUID
*/
id?: string;

/**
* The name of the pagerduty service.
*/
name?: string;
}

export interface PagerdutyCreateResponse {
/**
* UUID
* token in form of UUID
*/
id?: string;
}

export type PagerdutyDeleteResponse = unknown | Array<unknown> | string;

export type PagerdutyGetResponse = Array<AaaPagerduty>;
export type PagerdutyGetResponse = Array<PagerdutyGetResponse.PagerdutyGetResponseItem>;

export namespace PagerdutyGetResponse {
export interface PagerdutyGetResponseItem {
/**
* UUID
*/
id?: string;

/**
* The name of the pagerduty service.
*/
name?: string;
}
}

export interface PagerdutyLinkResponse {
/**
Expand Down Expand Up @@ -130,7 +132,6 @@ export interface PagerdutyLinkParams {
}

export namespace Pagerduty {
export import AaaPagerduty = PagerdutyAPI.AaaPagerduty;
export import PagerdutyCreateResponse = PagerdutyAPI.PagerdutyCreateResponse;
export import PagerdutyDeleteResponse = PagerdutyAPI.PagerdutyDeleteResponse;
export import PagerdutyGetResponse = PagerdutyAPI.PagerdutyGetResponse;
Expand Down
93 changes: 71 additions & 22 deletions src/resources/alerting/v3/destinations/webhooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,18 +75,85 @@ export class Webhooks extends APIResource {
webhookId: string,
params: WebhookGetParams,
options?: Core.RequestOptions,
): Core.APIPromise<AaaWebhooks> {
): Core.APIPromise<WebhookGetResponse> {
const { account_id } = params;
return (
this._client.get(
`/accounts/${account_id}/alerting/v3/destinations/webhooks/${webhookId}`,
options,
) as Core.APIPromise<{ result: AaaWebhooks }>
) as Core.APIPromise<{ result: WebhookGetResponse }>
)._thenUnwrap((obj) => obj.result);
}
}

export interface AaaWebhooks {
export interface WebhookCreateResponse {
/**
* UUID
*/
id?: string;
}

export interface WebhookUpdateResponse {
/**
* UUID
*/
id?: string;
}

export type WebhookListResponse = Array<WebhookListResponse.WebhookListResponseItem>;

export namespace WebhookListResponse {
export interface WebhookListResponseItem {
/**
* The unique identifier of a webhook
*/
id?: string;

/**
* Timestamp of when the webhook destination was created.
*/
created_at?: string;

/**
* Timestamp of the last time an attempt to dispatch a notification to this webhook
* failed.
*/
last_failure?: string;

/**
* Timestamp of the last time Cloudflare was able to successfully dispatch a
* notification using this webhook.
*/
last_success?: string;

/**
* The name of the webhook destination. This will be included in the request body
* when you receive a webhook notification.
*/
name?: string;

/**
* Optional secret that will be passed in the `cf-webhook-auth` header when
* dispatching generic webhook notifications or formatted for supported
* destinations. Secrets are not returned in any API response body.
*/
secret?: string;

/**
* Type of webhook endpoint.
*/
type?: 'slack' | 'generic' | 'gchat';

/**
* The POST endpoint to call when dispatching a notification.
*/
url?: string;
}
}

export type WebhookDeleteResponse = unknown | Array<unknown> | string;

export interface WebhookGetResponse {
/**
* The unique identifier of a webhook
*/
Expand Down Expand Up @@ -133,24 +200,6 @@ export interface AaaWebhooks {
url?: string;
}

export interface WebhookCreateResponse {
/**
* UUID
*/
id?: string;
}

export interface WebhookUpdateResponse {
/**
* UUID
*/
id?: string;
}

export type WebhookListResponse = Array<AaaWebhooks>;

export type WebhookDeleteResponse = unknown | Array<unknown> | string;

export interface WebhookCreateParams {
/**
* Path param: The account id
Expand Down Expand Up @@ -223,11 +272,11 @@ export interface WebhookGetParams {
}

export namespace Webhooks {
export import AaaWebhooks = WebhooksAPI.AaaWebhooks;
export import WebhookCreateResponse = WebhooksAPI.WebhookCreateResponse;
export import WebhookUpdateResponse = WebhooksAPI.WebhookUpdateResponse;
export import WebhookListResponse = WebhooksAPI.WebhookListResponse;
export import WebhookDeleteResponse = WebhooksAPI.WebhookDeleteResponse;
export import WebhookGetResponse = WebhooksAPI.WebhookGetResponse;
export import WebhookCreateParams = WebhooksAPI.WebhookCreateParams;
export import WebhookUpdateParams = WebhooksAPI.WebhookUpdateParams;
export import WebhookListParams = WebhooksAPI.WebhookListParams;
Expand Down
12 changes: 6 additions & 6 deletions src/resources/alerting/v3/histories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@ export class Histories extends APIResource {
list(
params: HistoryListParams,
options?: Core.RequestOptions,
): Core.PagePromise<AaaHistoriesV4PagePaginationArray, AaaHistory> {
): Core.PagePromise<HistoryListResponsesV4PagePaginationArray, HistoryListResponse> {
const { account_id, ...query } = params;
return this._client.getAPIList(
`/accounts/${account_id}/alerting/v3/history`,
AaaHistoriesV4PagePaginationArray,
HistoryListResponsesV4PagePaginationArray,
{ query, ...options },
);
}
}

export class AaaHistoriesV4PagePaginationArray extends V4PagePaginationArray<AaaHistory> {}
export class HistoryListResponsesV4PagePaginationArray extends V4PagePaginationArray<HistoryListResponse> {}

export interface AaaHistory {
export interface HistoryListResponse {
/**
* UUID
*/
Expand Down Expand Up @@ -94,7 +94,7 @@ export interface HistoryListParams extends V4PagePaginationArrayParams {
}

export namespace Histories {
export import AaaHistory = HistoriesAPI.AaaHistory;
export import AaaHistoriesV4PagePaginationArray = HistoriesAPI.AaaHistoriesV4PagePaginationArray;
export import HistoryListResponse = HistoriesAPI.HistoryListResponse;
export import HistoryListResponsesV4PagePaginationArray = HistoriesAPI.HistoryListResponsesV4PagePaginationArray;
export import HistoryListParams = HistoriesAPI.HistoryListParams;
}
11 changes: 8 additions & 3 deletions src/resources/alerting/v3/index.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
// File generated from our OpenAPI spec by Stainless.

export { AaaHistory, HistoryListParams, AaaHistoriesV4PagePaginationArray, Histories } from './histories';
export { Destinations } from './destinations/index';
export {
HistoryListResponse,
HistoryListParams,
HistoryListResponsesV4PagePaginationArray,
Histories,
} from './histories';
export {
AaaPolicies,
PolicyCreateResponse,
PolicyUpdateResponse,
PolicyListResponse,
PolicyDeleteResponse,
PolicyGetResponse,
PolicyCreateParams,
PolicyUpdateParams,
PolicyListParams,
PolicyDeleteParams,
PolicyGetParams,
Policies,
} from './policies';
export { Destinations } from './destinations/index';
export { V3ListResponse, V3ListParams, V3 } from './v3';
Loading

0 comments on commit 25e30c0

Please sign in to comment.