From d5f0d252d2055b7fdd51ac0bb81f2a3b2d9ad735 Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Mon, 27 Jan 2025 17:40:25 +0100 Subject: [PATCH 1/2] js: Pull in some codegen changes --- javascript/src/api/authentication.ts | 27 ++++++---- javascript/src/api/background_task.ts | 37 +++++++++++--- javascript/src/api/event_type.ts | 10 +++- javascript/src/api/integration.ts | 9 +++- javascript/src/api/op_webhook_endpoint.ts | 61 ++++++++++++++++------- 5 files changed, 105 insertions(+), 39 deletions(-) diff --git a/javascript/src/api/authentication.ts b/javascript/src/api/authentication.ts index edbde10c6..d59e2565d 100644 --- a/javascript/src/api/authentication.ts +++ b/javascript/src/api/authentication.ts @@ -1,4 +1,4 @@ -// this file is @generated (with minor manual changes) +// this file is @generated import { Configuration, AuthenticationApi, @@ -29,25 +29,32 @@ export class Authentication { }); } - public dashboardAccess( + /** Expire all of the tokens associated with a specific application. */ + public expireAll( appId: string, + applicationTokenExpireIn: ApplicationTokenExpireIn, options?: PostOptions - ): Promise { - return this.api.v1AuthenticationDashboardAccess({ + ): Promise { + return this.api.v1AuthenticationExpireAll({ appId, + applicationTokenExpireIn, ...options, }); } - /** Expire all of the tokens associated with a specific application. */ - public expireAll( + /** + * DEPRECATED: Please use `app-portal-access` instead. + * + * Use this function to get magic links (and authentication codes) for connecting your users to the Consumer Application Portal. + * + * @deprecated + */ + public dashboardAccess( appId: string, - applicationTokenExpireIn: ApplicationTokenExpireIn, options?: PostOptions - ): Promise { - return this.api.v1AuthenticationExpireAll({ + ): Promise { + return this.api.v1AuthenticationDashboardAccess({ appId, - applicationTokenExpireIn, ...options, }); } diff --git a/javascript/src/api/background_task.ts b/javascript/src/api/background_task.ts index b99102bcb..d3224f1c5 100644 --- a/javascript/src/api/background_task.ts +++ b/javascript/src/api/background_task.ts @@ -1,17 +1,25 @@ +// this file is @generated import { Configuration, + BackgroundTasksApi, + BackgroundTaskOut, BackgroundTaskStatus, BackgroundTaskType, - BackgroundTaskOut, ListResponseBackgroundTaskOut, - BackgroundTasksApi, + Ordering, } from "../openapi"; export interface BackgroundTaskListOptions { - iterator?: string | null; - limit?: number; + /** Filter the response based on the status. */ status?: BackgroundTaskStatus; + /** Filter the response based on the type. */ task?: BackgroundTaskType; + /** Limit the number of returned items */ + limit?: number; + /** The iterator returned from a prior invocation */ + iterator?: string | null; + /** The sorting order of the returned items */ + order?: Ordering; } export class BackgroundTask { @@ -21,15 +29,30 @@ export class BackgroundTask { this.api = new BackgroundTasksApi(config); } + /** List background tasks executed in the past 90 days. */ + public list( + options?: BackgroundTaskListOptions + ): Promise { + return this.api.v1BackgroundTaskList({ + ...options, + iterator: options?.iterator ?? undefined, + }); + } + + /** + * List background tasks executed in the past 90 days. + * + * @deprecated Use list instead. + * */ public listByEndpoint( options?: BackgroundTaskListOptions ): Promise { - const iterator = options?.iterator ?? undefined; - return this.api.listBackgroundTasks({ ...options, iterator }); + return this.list(options); } + /** Get a background task by ID. */ public get(taskId: string): Promise { - return this.api.getBackgroundTask({ + return this.api.v1BackgroundTaskGet({ taskId, }); } diff --git a/javascript/src/api/event_type.ts b/javascript/src/api/event_type.ts index 132103ac1..55dfd903a 100644 --- a/javascript/src/api/event_type.ts +++ b/javascript/src/api/event_type.ts @@ -1,4 +1,4 @@ -// this file is @generated (with minor manual changes) +// this file is @generated import { Configuration, EventTypeApi, @@ -26,6 +26,11 @@ export interface EventTypeListOptions { withContent?: boolean; } +export interface EventTypeDeleteOptions { + /** By default event types are archived when "deleted". Passing this to `true` deletes them entirely. */ + expunge?: boolean; +} + export class EventType { private readonly api: EventTypeApi; @@ -98,9 +103,10 @@ export class EventType { * An event type can be unarchived with the * [create operation](#operation/create_event_type_api_v1_event_type__post). */ - public delete(eventTypeName: string): Promise { + public delete(eventTypeName: string, options?: EventTypeDeleteOptions): Promise { return this.api.v1EventTypeDelete({ eventTypeName, + ...options, }); } diff --git a/javascript/src/api/integration.ts b/javascript/src/api/integration.ts index 22e81937e..ec18275aa 100644 --- a/javascript/src/api/integration.ts +++ b/javascript/src/api/integration.ts @@ -1,4 +1,4 @@ -// this file is @generated (with minor manual changes) +// this file is @generated import { Configuration, IntegrationApi, @@ -81,10 +81,15 @@ export class Integration { }); } + /** + * Get an integration's key. + * + * @deprecated + */ public getKey(appId: string, integId: string): Promise { return this.api.v1IntegrationGetKey({ - integId, appId, + integId, }); } diff --git a/javascript/src/api/op_webhook_endpoint.ts b/javascript/src/api/op_webhook_endpoint.ts index e5b3123c0..af77b09d3 100644 --- a/javascript/src/api/op_webhook_endpoint.ts +++ b/javascript/src/api/op_webhook_endpoint.ts @@ -1,22 +1,23 @@ +// this file is @generated import { Configuration, - Ordering, WebhookEndpointApi, + ListResponseOperationalWebhookEndpointOut, OperationalWebhookEndpointIn, OperationalWebhookEndpointOut, OperationalWebhookEndpointSecretIn, OperationalWebhookEndpointSecretOut, OperationalWebhookEndpointUpdate, - ListResponseOperationalWebhookEndpointOut, + Ordering, } from "../openapi"; import { PostOptions } from "../util"; export interface OperationalWebhookEndpointListOptions { - /// Limit the number of returned items + /** Limit the number of returned items */ limit?: number; - /// The iterator returned from a prior invocation + /** The iterator returned from a prior invocation */ iterator?: string | null; - /// The sorting order of the returned items + /** The sorting order of the returned items */ order?: Ordering; } @@ -27,53 +28,77 @@ export class OperationalWebhookEndpoint { this.api = new WebhookEndpointApi(config); } + /** List operational webhook endpoints. */ public list( options?: OperationalWebhookEndpointListOptions ): Promise { - const iterator = options?.iterator ?? undefined; - return this.api.listOperationalWebhookEndpoints({ ...options, iterator }); + return this.api.v1OperationalWebhookEndpointList({ + ...options, + iterator: options?.iterator ?? undefined, + }); } + /** Create an operational webhook endpoint. */ public create( - endpointIn: OperationalWebhookEndpointIn, + operationalWebhookEndpointIn: OperationalWebhookEndpointIn, options?: PostOptions ): Promise { - return this.api.createOperationalWebhookEndpoint({ - operationalWebhookEndpointIn: endpointIn, + return this.api.v1OperationalWebhookEndpointCreate({ + operationalWebhookEndpointIn, ...options, }); } + /** Get an operational webhook endpoint. */ public get(endpointId: string): Promise { - return this.api.getOperationalWebhookEndpoint({ endpointId }); + return this.api.v1OperationalWebhookEndpointGet({ + endpointId, + }); } + /** Update an operational webhook endpoint. */ public update( endpointId: string, - endpointUpdate: OperationalWebhookEndpointUpdate + operationalWebhookEndpointUpdate: OperationalWebhookEndpointUpdate ): Promise { - return this.api.updateOperationalWebhookEndpoint({ + return this.api.v1OperationalWebhookEndpointUpdate({ endpointId, - operationalWebhookEndpointUpdate: endpointUpdate, + operationalWebhookEndpointUpdate, }); } + /** Delete an operational webhook endpoint. */ public delete(endpointId: string): Promise { - return this.api.deleteOperationalWebhookEndpoint({ endpointId }); + return this.api.v1OperationalWebhookEndpointDelete({ + endpointId, + }); } + /** + * Get an operational webhook endpoint's signing secret. + * + * This is used to verify the authenticity of the webhook. + * For more information please refer to [the consuming webhooks docs](https://docs.svix.com/consuming-webhooks/). + */ public getSecret(endpointId: string): Promise { - return this.api.getOperationalWebhookEndpointSecret({ endpointId }); + return this.api.getOperationalWebhookEndpointSecret({ + endpointId, + }); } + /** + * Rotates an operational webhook endpoint's signing secret. + * + * The previous secret will remain valid for the next 24 hours. + */ public rotateSecret( endpointId: string, - endpointSecretIn: OperationalWebhookEndpointSecretIn, + operationalWebhookEndpointSecretIn: OperationalWebhookEndpointSecretIn, options?: PostOptions ): Promise { return this.api.rotateOperationalWebhookEndpointSecret({ endpointId, - operationalWebhookEndpointSecretIn: endpointSecretIn, + operationalWebhookEndpointSecretIn, ...options, }); } From e8976c7d1c354044e4ada1a8342238037eccd0f0 Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Mon, 27 Jan 2025 17:41:13 +0100 Subject: [PATCH 2/2] js: Rename op_webhook_endpoint.ts => operational_webhook_endpoint.ts --- javascript/src/api/background_task.ts | 4 ++-- ...ook_endpoint.ts => operational_webhook_endpoint.ts} | 10 +++++----- javascript/src/index.ts | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) rename javascript/src/api/{op_webhook_endpoint.ts => operational_webhook_endpoint.ts} (90%) diff --git a/javascript/src/api/background_task.ts b/javascript/src/api/background_task.ts index d3224f1c5..16923cce3 100644 --- a/javascript/src/api/background_task.ts +++ b/javascript/src/api/background_task.ts @@ -33,7 +33,7 @@ export class BackgroundTask { public list( options?: BackgroundTaskListOptions ): Promise { - return this.api.v1BackgroundTaskList({ + return this.api.listBackgroundTasks({ ...options, iterator: options?.iterator ?? undefined, }); @@ -52,7 +52,7 @@ export class BackgroundTask { /** Get a background task by ID. */ public get(taskId: string): Promise { - return this.api.v1BackgroundTaskGet({ + return this.api.getBackgroundTask({ taskId, }); } diff --git a/javascript/src/api/op_webhook_endpoint.ts b/javascript/src/api/operational_webhook_endpoint.ts similarity index 90% rename from javascript/src/api/op_webhook_endpoint.ts rename to javascript/src/api/operational_webhook_endpoint.ts index af77b09d3..92f2edeff 100644 --- a/javascript/src/api/op_webhook_endpoint.ts +++ b/javascript/src/api/operational_webhook_endpoint.ts @@ -32,7 +32,7 @@ export class OperationalWebhookEndpoint { public list( options?: OperationalWebhookEndpointListOptions ): Promise { - return this.api.v1OperationalWebhookEndpointList({ + return this.api.listOperationalWebhookEndpoints({ ...options, iterator: options?.iterator ?? undefined, }); @@ -43,7 +43,7 @@ export class OperationalWebhookEndpoint { operationalWebhookEndpointIn: OperationalWebhookEndpointIn, options?: PostOptions ): Promise { - return this.api.v1OperationalWebhookEndpointCreate({ + return this.api.createOperationalWebhookEndpoint({ operationalWebhookEndpointIn, ...options, }); @@ -51,7 +51,7 @@ export class OperationalWebhookEndpoint { /** Get an operational webhook endpoint. */ public get(endpointId: string): Promise { - return this.api.v1OperationalWebhookEndpointGet({ + return this.api.getOperationalWebhookEndpoint({ endpointId, }); } @@ -61,7 +61,7 @@ export class OperationalWebhookEndpoint { endpointId: string, operationalWebhookEndpointUpdate: OperationalWebhookEndpointUpdate ): Promise { - return this.api.v1OperationalWebhookEndpointUpdate({ + return this.api.updateOperationalWebhookEndpoint({ endpointId, operationalWebhookEndpointUpdate, }); @@ -69,7 +69,7 @@ export class OperationalWebhookEndpoint { /** Delete an operational webhook endpoint. */ public delete(endpointId: string): Promise { - return this.api.v1OperationalWebhookEndpointDelete({ + return this.api.deleteOperationalWebhookEndpoint({ endpointId, }); } diff --git a/javascript/src/index.ts b/javascript/src/index.ts index 086c6d86d..1743a1ef9 100644 --- a/javascript/src/index.ts +++ b/javascript/src/index.ts @@ -15,7 +15,7 @@ import { EventType } from "./api/event_type"; import { Integration } from "./api/integration"; import { Message } from "./api/message"; import { MessageAttempt } from "./api/message_attempt"; -import { OperationalWebhookEndpoint } from "./api/op_webhook_endpoint"; +import { OperationalWebhookEndpoint } from "./api/operational_webhook_endpoint"; import { Statistics } from "./api/statistics"; export * from "./openapi/models/all"; @@ -34,7 +34,7 @@ export { MessageAttemptListByEndpointOptions, MessageAttemptListOptions, } from "./api/message_attempt"; -export { OperationalWebhookEndpointListOptions } from "./api/op_webhook_endpoint"; +export { OperationalWebhookEndpointListOptions } from "./api/operational_webhook_endpoint"; const VERSION = "1.56.0";