Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

js: Pull in some codegen changes #1667

Merged
merged 2 commits into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 17 additions & 10 deletions javascript/src/api/authentication.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// this file is @generated (with minor manual changes)
// this file is @generated
import {
Configuration,
AuthenticationApi,
Expand Down Expand Up @@ -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<DashboardAccessOut> {
return this.api.v1AuthenticationDashboardAccess({
): Promise<void> {
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<void> {
return this.api.v1AuthenticationExpireAll({
): Promise<DashboardAccessOut> {
return this.api.v1AuthenticationDashboardAccess({
appId,
applicationTokenExpireIn,
...options,
});
}
Expand Down
35 changes: 29 additions & 6 deletions javascript/src/api/background_task.ts
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -21,13 +29,28 @@ export class BackgroundTask {
this.api = new BackgroundTasksApi(config);
}

/** List background tasks executed in the past 90 days. */
public list(
options?: BackgroundTaskListOptions
): Promise<ListResponseBackgroundTaskOut> {
return this.api.listBackgroundTasks({
...options,
iterator: options?.iterator ?? undefined,
});
}

/**
* List background tasks executed in the past 90 days.
*
* @deprecated Use list instead.
* */
public listByEndpoint(
options?: BackgroundTaskListOptions
): Promise<ListResponseBackgroundTaskOut> {
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<BackgroundTaskOut> {
return this.api.getBackgroundTask({
taskId,
Expand Down
10 changes: 8 additions & 2 deletions javascript/src/api/event_type.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// this file is @generated (with minor manual changes)
// this file is @generated
import {
Configuration,
EventTypeApi,
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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<void> {
public delete(eventTypeName: string, options?: EventTypeDeleteOptions): Promise<void> {
return this.api.v1EventTypeDelete({
eventTypeName,
...options,
});
}

Expand Down
9 changes: 7 additions & 2 deletions javascript/src/api/integration.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// this file is @generated (with minor manual changes)
// this file is @generated
import {
Configuration,
IntegrationApi,
Expand Down Expand Up @@ -81,10 +81,15 @@ export class Integration {
});
}

/**
* Get an integration's key.
*
* @deprecated
*/
public getKey(appId: string, integId: string): Promise<IntegrationKeyOut> {
return this.api.v1IntegrationGetKey({
integId,
appId,
integId,
});
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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;
}

Expand All @@ -27,53 +28,77 @@ export class OperationalWebhookEndpoint {
this.api = new WebhookEndpointApi(config);
}

/** List operational webhook endpoints. */
public list(
options?: OperationalWebhookEndpointListOptions
): Promise<ListResponseOperationalWebhookEndpointOut> {
const iterator = options?.iterator ?? undefined;
return this.api.listOperationalWebhookEndpoints({ ...options, iterator });
return this.api.listOperationalWebhookEndpoints({
...options,
iterator: options?.iterator ?? undefined,
});
}

/** Create an operational webhook endpoint. */
public create(
endpointIn: OperationalWebhookEndpointIn,
operationalWebhookEndpointIn: OperationalWebhookEndpointIn,
options?: PostOptions
): Promise<OperationalWebhookEndpointOut> {
return this.api.createOperationalWebhookEndpoint({
operationalWebhookEndpointIn: endpointIn,
operationalWebhookEndpointIn,
...options,
});
}

/** Get an operational webhook endpoint. */
public get(endpointId: string): Promise<OperationalWebhookEndpointOut> {
return this.api.getOperationalWebhookEndpoint({ endpointId });
return this.api.getOperationalWebhookEndpoint({
endpointId,
});
}

/** Update an operational webhook endpoint. */
public update(
endpointId: string,
endpointUpdate: OperationalWebhookEndpointUpdate
operationalWebhookEndpointUpdate: OperationalWebhookEndpointUpdate
): Promise<OperationalWebhookEndpointOut> {
return this.api.updateOperationalWebhookEndpoint({
endpointId,
operationalWebhookEndpointUpdate: endpointUpdate,
operationalWebhookEndpointUpdate,
});
}

/** Delete an operational webhook endpoint. */
public delete(endpointId: string): Promise<void> {
return this.api.deleteOperationalWebhookEndpoint({ endpointId });
return this.api.deleteOperationalWebhookEndpoint({
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<OperationalWebhookEndpointSecretOut> {
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<void> {
return this.api.rotateOperationalWebhookEndpointSecret({
endpointId,
operationalWebhookEndpointSecretIn: endpointSecretIn,
operationalWebhookEndpointSecretIn,
...options,
});
}
Expand Down
4 changes: 2 additions & 2 deletions javascript/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand 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";

Expand Down