FRE-709: Document duplicate recovery wake - FRE-635 already recovered via FRE-708
This commit is contained in:
123
node_modules/svix/src/api/application.ts
generated
vendored
Normal file
123
node_modules/svix/src/api/application.ts
generated
vendored
Normal file
@@ -0,0 +1,123 @@
|
||||
// this file is @generated
|
||||
|
||||
import { type ApplicationIn, ApplicationInSerializer } from "../models/applicationIn";
|
||||
import { type ApplicationOut, ApplicationOutSerializer } from "../models/applicationOut";
|
||||
import {
|
||||
type ApplicationPatch,
|
||||
ApplicationPatchSerializer,
|
||||
} from "../models/applicationPatch";
|
||||
import {
|
||||
type ListResponseApplicationOut,
|
||||
ListResponseApplicationOutSerializer,
|
||||
} from "../models/listResponseApplicationOut";
|
||||
import type { Ordering } from "../models/ordering";
|
||||
import { HttpMethod, SvixRequest, type SvixRequestContext } from "../request";
|
||||
|
||||
export interface ApplicationListOptions {
|
||||
/** Exclude applications that have no endpoints. Default is false. */
|
||||
excludeAppsWithNoEndpoints?: boolean;
|
||||
/** Exclude applications that have only disabled endpoints. Default is false. */
|
||||
excludeAppsWithDisabledEndpoints?: boolean;
|
||||
excludeAppsWithSvixPlayEndpoints?: boolean;
|
||||
/** 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 interface ApplicationCreateOptions {
|
||||
idempotencyKey?: string;
|
||||
}
|
||||
|
||||
export class Application {
|
||||
public constructor(private readonly requestCtx: SvixRequestContext) {}
|
||||
|
||||
/** List of all the organization's applications. */
|
||||
public list(options?: ApplicationListOptions): Promise<ListResponseApplicationOut> {
|
||||
const request = new SvixRequest(HttpMethod.GET, "/api/v1/app");
|
||||
|
||||
request.setQueryParams({
|
||||
exclude_apps_with_no_endpoints: options?.excludeAppsWithNoEndpoints,
|
||||
exclude_apps_with_disabled_endpoints: options?.excludeAppsWithDisabledEndpoints,
|
||||
exclude_apps_with_svix_play_endpoints: options?.excludeAppsWithSvixPlayEndpoints,
|
||||
limit: options?.limit,
|
||||
iterator: options?.iterator,
|
||||
order: options?.order,
|
||||
});
|
||||
|
||||
return request.send(
|
||||
this.requestCtx,
|
||||
ListResponseApplicationOutSerializer._fromJsonObject
|
||||
);
|
||||
}
|
||||
|
||||
/** Create a new application. */
|
||||
public create(
|
||||
applicationIn: ApplicationIn,
|
||||
options?: ApplicationCreateOptions
|
||||
): Promise<ApplicationOut> {
|
||||
const request = new SvixRequest(HttpMethod.POST, "/api/v1/app");
|
||||
|
||||
request.setHeaderParam("idempotency-key", options?.idempotencyKey);
|
||||
request.setBody(ApplicationInSerializer._toJsonObject(applicationIn));
|
||||
|
||||
return request.send(this.requestCtx, ApplicationOutSerializer._fromJsonObject);
|
||||
}
|
||||
|
||||
/** Get the application with the UID from `applicationIn`, or create it if it doesn't exist yet. */
|
||||
public getOrCreate(
|
||||
applicationIn: ApplicationIn,
|
||||
options?: ApplicationCreateOptions
|
||||
): Promise<ApplicationOut> {
|
||||
const request = new SvixRequest(HttpMethod.POST, "/api/v1/app");
|
||||
|
||||
request.setQueryParam("get_if_exists", true);
|
||||
request.setHeaderParam("idempotency-key", options?.idempotencyKey);
|
||||
request.setBody(ApplicationInSerializer._toJsonObject(applicationIn));
|
||||
|
||||
return request.send(this.requestCtx, ApplicationOutSerializer._fromJsonObject);
|
||||
}
|
||||
|
||||
/** Get an application. */
|
||||
public get(appId: string): Promise<ApplicationOut> {
|
||||
const request = new SvixRequest(HttpMethod.GET, "/api/v1/app/{app_id}");
|
||||
|
||||
request.setPathParam("app_id", appId);
|
||||
|
||||
return request.send(this.requestCtx, ApplicationOutSerializer._fromJsonObject);
|
||||
}
|
||||
|
||||
/** Update an application. */
|
||||
public update(appId: string, applicationIn: ApplicationIn): Promise<ApplicationOut> {
|
||||
const request = new SvixRequest(HttpMethod.PUT, "/api/v1/app/{app_id}");
|
||||
|
||||
request.setPathParam("app_id", appId);
|
||||
request.setBody(ApplicationInSerializer._toJsonObject(applicationIn));
|
||||
|
||||
return request.send(this.requestCtx, ApplicationOutSerializer._fromJsonObject);
|
||||
}
|
||||
|
||||
/** Delete an application. */
|
||||
public delete(appId: string): Promise<void> {
|
||||
const request = new SvixRequest(HttpMethod.DELETE, "/api/v1/app/{app_id}");
|
||||
|
||||
request.setPathParam("app_id", appId);
|
||||
|
||||
return request.sendNoResponseBody(this.requestCtx);
|
||||
}
|
||||
|
||||
/** Partially update an application. */
|
||||
public patch(
|
||||
appId: string,
|
||||
applicationPatch: ApplicationPatch
|
||||
): Promise<ApplicationOut> {
|
||||
const request = new SvixRequest(HttpMethod.PATCH, "/api/v1/app/{app_id}");
|
||||
|
||||
request.setPathParam("app_id", appId);
|
||||
request.setBody(ApplicationPatchSerializer._toJsonObject(applicationPatch));
|
||||
|
||||
return request.send(this.requestCtx, ApplicationOutSerializer._fromJsonObject);
|
||||
}
|
||||
}
|
||||
218
node_modules/svix/src/api/authentication.ts
generated
vendored
Normal file
218
node_modules/svix/src/api/authentication.ts
generated
vendored
Normal file
@@ -0,0 +1,218 @@
|
||||
// this file is @generated
|
||||
|
||||
import { type ApiTokenOut, ApiTokenOutSerializer } from "../models/apiTokenOut";
|
||||
import {
|
||||
type AppPortalAccessIn,
|
||||
AppPortalAccessInSerializer,
|
||||
} from "../models/appPortalAccessIn";
|
||||
import {
|
||||
type AppPortalAccessOut,
|
||||
AppPortalAccessOutSerializer,
|
||||
} from "../models/appPortalAccessOut";
|
||||
import {
|
||||
type ApplicationTokenExpireIn,
|
||||
ApplicationTokenExpireInSerializer,
|
||||
} from "../models/applicationTokenExpireIn";
|
||||
import {
|
||||
type RotatePollerTokenIn,
|
||||
RotatePollerTokenInSerializer,
|
||||
} from "../models/rotatePollerTokenIn";
|
||||
import {
|
||||
type StreamPortalAccessIn,
|
||||
StreamPortalAccessInSerializer,
|
||||
} from "../models/streamPortalAccessIn";
|
||||
import {
|
||||
type StreamTokenExpireIn,
|
||||
StreamTokenExpireInSerializer,
|
||||
} from "../models/streamTokenExpireIn";
|
||||
import {
|
||||
type DashboardAccessOut,
|
||||
DashboardAccessOutSerializer,
|
||||
} from "../models/dashboardAccessOut";
|
||||
import { HttpMethod, SvixRequest, type SvixRequestContext } from "../request";
|
||||
|
||||
export interface AuthenticationAppPortalAccessOptions {
|
||||
idempotencyKey?: string;
|
||||
}
|
||||
|
||||
export interface AuthenticationExpireAllOptions {
|
||||
idempotencyKey?: string;
|
||||
}
|
||||
|
||||
export interface AuthenticationLogoutOptions {
|
||||
idempotencyKey?: string;
|
||||
}
|
||||
|
||||
export interface AuthenticationStreamLogoutOptions {
|
||||
idempotencyKey?: string;
|
||||
}
|
||||
|
||||
export interface AuthenticationStreamPortalAccessOptions {
|
||||
idempotencyKey?: string;
|
||||
}
|
||||
|
||||
export interface AuthenticationStreamExpireAllOptions {
|
||||
idempotencyKey?: string;
|
||||
}
|
||||
|
||||
export interface AuthenticationRotateStreamPollerTokenOptions {
|
||||
idempotencyKey?: string;
|
||||
}
|
||||
|
||||
/** @deprecated */
|
||||
export interface AuthenticationDashboardAccessOptions {
|
||||
idempotencyKey?: string;
|
||||
}
|
||||
|
||||
export class Authentication {
|
||||
public constructor(private readonly requestCtx: SvixRequestContext) {}
|
||||
|
||||
/** Use this function to get magic links (and authentication codes) for connecting your users to the Consumer Application Portal. */
|
||||
public appPortalAccess(
|
||||
appId: string,
|
||||
appPortalAccessIn: AppPortalAccessIn,
|
||||
options?: AuthenticationAppPortalAccessOptions
|
||||
): Promise<AppPortalAccessOut> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.POST,
|
||||
"/api/v1/auth/app-portal-access/{app_id}"
|
||||
);
|
||||
|
||||
request.setPathParam("app_id", appId);
|
||||
request.setHeaderParam("idempotency-key", options?.idempotencyKey);
|
||||
request.setBody(AppPortalAccessInSerializer._toJsonObject(appPortalAccessIn));
|
||||
|
||||
return request.send(this.requestCtx, AppPortalAccessOutSerializer._fromJsonObject);
|
||||
}
|
||||
|
||||
/** Expire all of the tokens associated with a specific application. */
|
||||
public expireAll(
|
||||
appId: string,
|
||||
applicationTokenExpireIn: ApplicationTokenExpireIn,
|
||||
options?: AuthenticationExpireAllOptions
|
||||
): Promise<void> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.POST,
|
||||
"/api/v1/auth/app/{app_id}/expire-all"
|
||||
);
|
||||
|
||||
request.setPathParam("app_id", appId);
|
||||
request.setHeaderParam("idempotency-key", options?.idempotencyKey);
|
||||
request.setBody(
|
||||
ApplicationTokenExpireInSerializer._toJsonObject(applicationTokenExpireIn)
|
||||
);
|
||||
|
||||
return request.sendNoResponseBody(this.requestCtx);
|
||||
}
|
||||
|
||||
/** @deprecated Please use `appPortalAccess` instead. */
|
||||
public dashboardAccess(
|
||||
appId: string,
|
||||
options?: AuthenticationDashboardAccessOptions
|
||||
): Promise<DashboardAccessOut> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.POST,
|
||||
"/api/v1/auth/dashboard-access/{app_id}"
|
||||
);
|
||||
|
||||
request.setPathParam("app_id", appId);
|
||||
request.setHeaderParam("idempotency-key", options?.idempotencyKey);
|
||||
|
||||
return request.send(this.requestCtx, DashboardAccessOutSerializer._fromJsonObject);
|
||||
}
|
||||
|
||||
/**
|
||||
* Logout an app token.
|
||||
*
|
||||
* Trying to log out other tokens will fail.
|
||||
*/
|
||||
public logout(options?: AuthenticationLogoutOptions): Promise<void> {
|
||||
const request = new SvixRequest(HttpMethod.POST, "/api/v1/auth/logout");
|
||||
|
||||
request.setHeaderParam("idempotency-key", options?.idempotencyKey);
|
||||
|
||||
return request.sendNoResponseBody(this.requestCtx);
|
||||
}
|
||||
|
||||
/**
|
||||
* Logout a stream token.
|
||||
*
|
||||
* Trying to log out other tokens will fail.
|
||||
*/
|
||||
public streamLogout(options?: AuthenticationStreamLogoutOptions): Promise<void> {
|
||||
const request = new SvixRequest(HttpMethod.POST, "/api/v1/auth/stream-logout");
|
||||
|
||||
request.setHeaderParam("idempotency-key", options?.idempotencyKey);
|
||||
|
||||
return request.sendNoResponseBody(this.requestCtx);
|
||||
}
|
||||
|
||||
/** Use this function to get magic links (and authentication codes) for connecting your users to the Stream Consumer Portal. */
|
||||
public streamPortalAccess(
|
||||
streamId: string,
|
||||
streamPortalAccessIn: StreamPortalAccessIn,
|
||||
options?: AuthenticationStreamPortalAccessOptions
|
||||
): Promise<AppPortalAccessOut> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.POST,
|
||||
"/api/v1/auth/stream-portal-access/{stream_id}"
|
||||
);
|
||||
|
||||
request.setPathParam("stream_id", streamId);
|
||||
request.setHeaderParam("idempotency-key", options?.idempotencyKey);
|
||||
request.setBody(StreamPortalAccessInSerializer._toJsonObject(streamPortalAccessIn));
|
||||
|
||||
return request.send(this.requestCtx, AppPortalAccessOutSerializer._fromJsonObject);
|
||||
}
|
||||
|
||||
/** Expire all of the tokens associated with a specific stream. */
|
||||
public streamExpireAll(
|
||||
streamId: string,
|
||||
streamTokenExpireIn: StreamTokenExpireIn,
|
||||
options?: AuthenticationStreamExpireAllOptions
|
||||
): Promise<void> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.POST,
|
||||
"/api/v1/auth/stream/{stream_id}/expire-all"
|
||||
);
|
||||
|
||||
request.setPathParam("stream_id", streamId);
|
||||
request.setHeaderParam("idempotency-key", options?.idempotencyKey);
|
||||
request.setBody(StreamTokenExpireInSerializer._toJsonObject(streamTokenExpireIn));
|
||||
|
||||
return request.sendNoResponseBody(this.requestCtx);
|
||||
}
|
||||
|
||||
/** Get the current auth token for the stream poller. */
|
||||
public getStreamPollerToken(streamId: string, sinkId: string): Promise<ApiTokenOut> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.GET,
|
||||
"/api/v1/auth/stream/{stream_id}/sink/{sink_id}/poller/token"
|
||||
);
|
||||
|
||||
request.setPathParam("stream_id", streamId);
|
||||
request.setPathParam("sink_id", sinkId);
|
||||
|
||||
return request.send(this.requestCtx, ApiTokenOutSerializer._fromJsonObject);
|
||||
}
|
||||
|
||||
/** Create a new auth token for the stream poller API. */
|
||||
public rotateStreamPollerToken(
|
||||
streamId: string,
|
||||
sinkId: string,
|
||||
rotatePollerTokenIn: RotatePollerTokenIn,
|
||||
options?: AuthenticationRotateStreamPollerTokenOptions
|
||||
): Promise<ApiTokenOut> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.POST,
|
||||
"/api/v1/auth/stream/{stream_id}/sink/{sink_id}/poller/token/rotate"
|
||||
);
|
||||
|
||||
request.setPathParam("stream_id", streamId);
|
||||
request.setPathParam("sink_id", sinkId);
|
||||
request.setHeaderParam("idempotency-key", options?.idempotencyKey);
|
||||
request.setBody(RotatePollerTokenInSerializer._toJsonObject(rotatePollerTokenIn));
|
||||
|
||||
return request.send(this.requestCtx, ApiTokenOutSerializer._fromJsonObject);
|
||||
}
|
||||
}
|
||||
71
node_modules/svix/src/api/backgroundTask.ts
generated
vendored
Normal file
71
node_modules/svix/src/api/backgroundTask.ts
generated
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
// this file is @generated
|
||||
|
||||
import {
|
||||
type BackgroundTaskOut,
|
||||
BackgroundTaskOutSerializer,
|
||||
} from "../models/backgroundTaskOut";
|
||||
import type { BackgroundTaskStatus } from "../models/backgroundTaskStatus";
|
||||
import type { BackgroundTaskType } from "../models/backgroundTaskType";
|
||||
import {
|
||||
type ListResponseBackgroundTaskOut,
|
||||
ListResponseBackgroundTaskOutSerializer,
|
||||
} from "../models/listResponseBackgroundTaskOut";
|
||||
import type { Ordering } from "../models/ordering";
|
||||
import { HttpMethod, SvixRequest, type SvixRequestContext } from "../request";
|
||||
|
||||
export interface BackgroundTaskListOptions {
|
||||
/** 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 {
|
||||
public constructor(private readonly requestCtx: SvixRequestContext) {}
|
||||
|
||||
/** List background tasks executed in the past 90 days. */
|
||||
public list(
|
||||
options?: BackgroundTaskListOptions
|
||||
): Promise<ListResponseBackgroundTaskOut> {
|
||||
const request = new SvixRequest(HttpMethod.GET, "/api/v1/background-task");
|
||||
|
||||
request.setQueryParams({
|
||||
status: options?.status,
|
||||
task: options?.task,
|
||||
limit: options?.limit,
|
||||
iterator: options?.iterator,
|
||||
order: options?.order,
|
||||
});
|
||||
|
||||
return request.send(
|
||||
this.requestCtx,
|
||||
ListResponseBackgroundTaskOutSerializer._fromJsonObject
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* List background tasks executed in the past 90 days.
|
||||
*
|
||||
* @deprecated Use list instead.
|
||||
* */
|
||||
public listByEndpoint(
|
||||
options?: BackgroundTaskListOptions
|
||||
): Promise<ListResponseBackgroundTaskOut> {
|
||||
return this.list(options);
|
||||
}
|
||||
|
||||
/** Get a background task by ID. */
|
||||
public get(taskId: string): Promise<BackgroundTaskOut> {
|
||||
const request = new SvixRequest(HttpMethod.GET, "/api/v1/background-task/{task_id}");
|
||||
|
||||
request.setPathParam("task_id", taskId);
|
||||
|
||||
return request.send(this.requestCtx, BackgroundTaskOutSerializer._fromJsonObject);
|
||||
}
|
||||
}
|
||||
111
node_modules/svix/src/api/connector.ts
generated
vendored
Normal file
111
node_modules/svix/src/api/connector.ts
generated
vendored
Normal file
@@ -0,0 +1,111 @@
|
||||
// this file is @generated
|
||||
|
||||
import { type ConnectorIn, ConnectorInSerializer } from "../models/connectorIn";
|
||||
import { type ConnectorOut, ConnectorOutSerializer } from "../models/connectorOut";
|
||||
import { type ConnectorPatch, ConnectorPatchSerializer } from "../models/connectorPatch";
|
||||
import type { ConnectorProduct } from "../models/connectorProduct";
|
||||
import {
|
||||
type ConnectorUpdate,
|
||||
ConnectorUpdateSerializer,
|
||||
} from "../models/connectorUpdate";
|
||||
import {
|
||||
type ListResponseConnectorOut,
|
||||
ListResponseConnectorOutSerializer,
|
||||
} from "../models/listResponseConnectorOut";
|
||||
import type { Ordering } from "../models/ordering";
|
||||
import { HttpMethod, SvixRequest, type SvixRequestContext } from "../request";
|
||||
|
||||
export interface ConnectorListOptions {
|
||||
/** 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;
|
||||
productType?: ConnectorProduct;
|
||||
}
|
||||
|
||||
export interface ConnectorCreateOptions {
|
||||
idempotencyKey?: string;
|
||||
}
|
||||
|
||||
export class Connector {
|
||||
public constructor(private readonly requestCtx: SvixRequestContext) {}
|
||||
|
||||
/** List all connectors for an application. */
|
||||
public list(options?: ConnectorListOptions): Promise<ListResponseConnectorOut> {
|
||||
const request = new SvixRequest(HttpMethod.GET, "/api/v1/connector");
|
||||
|
||||
request.setQueryParams({
|
||||
limit: options?.limit,
|
||||
iterator: options?.iterator,
|
||||
order: options?.order,
|
||||
product_type: options?.productType,
|
||||
});
|
||||
|
||||
return request.send(
|
||||
this.requestCtx,
|
||||
ListResponseConnectorOutSerializer._fromJsonObject
|
||||
);
|
||||
}
|
||||
|
||||
/** Create a new connector. */
|
||||
public create(
|
||||
connectorIn: ConnectorIn,
|
||||
options?: ConnectorCreateOptions
|
||||
): Promise<ConnectorOut> {
|
||||
const request = new SvixRequest(HttpMethod.POST, "/api/v1/connector");
|
||||
|
||||
request.setHeaderParam("idempotency-key", options?.idempotencyKey);
|
||||
request.setBody(ConnectorInSerializer._toJsonObject(connectorIn));
|
||||
|
||||
return request.send(this.requestCtx, ConnectorOutSerializer._fromJsonObject);
|
||||
}
|
||||
|
||||
/** Get a connector. */
|
||||
public get(connectorId: string): Promise<ConnectorOut> {
|
||||
const request = new SvixRequest(HttpMethod.GET, "/api/v1/connector/{connector_id}");
|
||||
|
||||
request.setPathParam("connector_id", connectorId);
|
||||
|
||||
return request.send(this.requestCtx, ConnectorOutSerializer._fromJsonObject);
|
||||
}
|
||||
|
||||
/** Update a connector. */
|
||||
public update(
|
||||
connectorId: string,
|
||||
connectorUpdate: ConnectorUpdate
|
||||
): Promise<ConnectorOut> {
|
||||
const request = new SvixRequest(HttpMethod.PUT, "/api/v1/connector/{connector_id}");
|
||||
|
||||
request.setPathParam("connector_id", connectorId);
|
||||
request.setBody(ConnectorUpdateSerializer._toJsonObject(connectorUpdate));
|
||||
|
||||
return request.send(this.requestCtx, ConnectorOutSerializer._fromJsonObject);
|
||||
}
|
||||
|
||||
/** Delete a connector. */
|
||||
public delete(connectorId: string): Promise<void> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.DELETE,
|
||||
"/api/v1/connector/{connector_id}"
|
||||
);
|
||||
|
||||
request.setPathParam("connector_id", connectorId);
|
||||
|
||||
return request.sendNoResponseBody(this.requestCtx);
|
||||
}
|
||||
|
||||
/** Partially update a connector. */
|
||||
public patch(
|
||||
connectorId: string,
|
||||
connectorPatch: ConnectorPatch
|
||||
): Promise<ConnectorOut> {
|
||||
const request = new SvixRequest(HttpMethod.PATCH, "/api/v1/connector/{connector_id}");
|
||||
|
||||
request.setPathParam("connector_id", connectorId);
|
||||
request.setBody(ConnectorPatchSerializer._toJsonObject(connectorPatch));
|
||||
|
||||
return request.send(this.requestCtx, ConnectorOutSerializer._fromJsonObject);
|
||||
}
|
||||
}
|
||||
522
node_modules/svix/src/api/endpoint.ts
generated
vendored
Normal file
522
node_modules/svix/src/api/endpoint.ts
generated
vendored
Normal file
@@ -0,0 +1,522 @@
|
||||
// this file is @generated
|
||||
|
||||
import { type BulkReplayIn, BulkReplayInSerializer } from "../models/bulkReplayIn";
|
||||
import {
|
||||
type EndpointHeadersIn,
|
||||
EndpointHeadersInSerializer,
|
||||
} from "../models/endpointHeadersIn";
|
||||
import {
|
||||
type EndpointHeadersOut,
|
||||
EndpointHeadersOutSerializer,
|
||||
} from "../models/endpointHeadersOut";
|
||||
import {
|
||||
type EndpointHeadersPatchIn,
|
||||
EndpointHeadersPatchInSerializer,
|
||||
} from "../models/endpointHeadersPatchIn";
|
||||
import { type EndpointIn, EndpointInSerializer } from "../models/endpointIn";
|
||||
import { type EndpointOut, EndpointOutSerializer } from "../models/endpointOut";
|
||||
import { type EndpointPatch, EndpointPatchSerializer } from "../models/endpointPatch";
|
||||
import {
|
||||
type EndpointSecretOut,
|
||||
EndpointSecretOutSerializer,
|
||||
} from "../models/endpointSecretOut";
|
||||
import {
|
||||
type EndpointSecretRotateIn,
|
||||
EndpointSecretRotateInSerializer,
|
||||
} from "../models/endpointSecretRotateIn";
|
||||
import { type EndpointStats, EndpointStatsSerializer } from "../models/endpointStats";
|
||||
import {
|
||||
type EndpointTransformationIn,
|
||||
EndpointTransformationInSerializer,
|
||||
} from "../models/endpointTransformationIn";
|
||||
import {
|
||||
type EndpointTransformationOut,
|
||||
EndpointTransformationOutSerializer,
|
||||
} from "../models/endpointTransformationOut";
|
||||
import {
|
||||
type EndpointTransformationPatch,
|
||||
EndpointTransformationPatchSerializer,
|
||||
} from "../models/endpointTransformationPatch";
|
||||
import { type EndpointUpdate, EndpointUpdateSerializer } from "../models/endpointUpdate";
|
||||
import { type EventExampleIn, EventExampleInSerializer } from "../models/eventExampleIn";
|
||||
import {
|
||||
type ListResponseEndpointOut,
|
||||
ListResponseEndpointOutSerializer,
|
||||
} from "../models/listResponseEndpointOut";
|
||||
import { type MessageOut, MessageOutSerializer } from "../models/messageOut";
|
||||
import type { Ordering } from "../models/ordering";
|
||||
import { type RecoverIn, RecoverInSerializer } from "../models/recoverIn";
|
||||
import { type RecoverOut, RecoverOutSerializer } from "../models/recoverOut";
|
||||
import { type ReplayIn, ReplayInSerializer } from "../models/replayIn";
|
||||
import { type ReplayOut, ReplayOutSerializer } from "../models/replayOut";
|
||||
import { HttpMethod, SvixRequest, type SvixRequestContext } from "../request";
|
||||
|
||||
export interface EndpointListOptions {
|
||||
/** 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 interface EndpointCreateOptions {
|
||||
idempotencyKey?: string;
|
||||
}
|
||||
|
||||
export interface EndpointBulkReplayOptions {
|
||||
idempotencyKey?: string;
|
||||
}
|
||||
|
||||
export interface EndpointRecoverOptions {
|
||||
idempotencyKey?: string;
|
||||
}
|
||||
|
||||
export interface EndpointReplayMissingOptions {
|
||||
idempotencyKey?: string;
|
||||
}
|
||||
|
||||
export interface EndpointRotateSecretOptions {
|
||||
idempotencyKey?: string;
|
||||
}
|
||||
|
||||
export interface EndpointSendExampleOptions {
|
||||
idempotencyKey?: string;
|
||||
}
|
||||
|
||||
export interface EndpointGetStatsOptions {
|
||||
/** Filter the range to data starting from this date. */
|
||||
since?: Date | null;
|
||||
/** Filter the range to data ending by this date. */
|
||||
until?: Date | null;
|
||||
}
|
||||
|
||||
export class Endpoint {
|
||||
public constructor(private readonly requestCtx: SvixRequestContext) {}
|
||||
|
||||
/** List the application's endpoints. */
|
||||
public list(
|
||||
appId: string,
|
||||
options?: EndpointListOptions
|
||||
): Promise<ListResponseEndpointOut> {
|
||||
const request = new SvixRequest(HttpMethod.GET, "/api/v1/app/{app_id}/endpoint");
|
||||
|
||||
request.setPathParam("app_id", appId);
|
||||
request.setQueryParams({
|
||||
limit: options?.limit,
|
||||
iterator: options?.iterator,
|
||||
order: options?.order,
|
||||
});
|
||||
|
||||
return request.send(
|
||||
this.requestCtx,
|
||||
ListResponseEndpointOutSerializer._fromJsonObject
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new endpoint for the application.
|
||||
*
|
||||
* When `secret` is `null` the secret is automatically generated (recommended).
|
||||
*/
|
||||
public create(
|
||||
appId: string,
|
||||
endpointIn: EndpointIn,
|
||||
options?: EndpointCreateOptions
|
||||
): Promise<EndpointOut> {
|
||||
const request = new SvixRequest(HttpMethod.POST, "/api/v1/app/{app_id}/endpoint");
|
||||
|
||||
request.setPathParam("app_id", appId);
|
||||
request.setHeaderParam("idempotency-key", options?.idempotencyKey);
|
||||
request.setBody(EndpointInSerializer._toJsonObject(endpointIn));
|
||||
|
||||
return request.send(this.requestCtx, EndpointOutSerializer._fromJsonObject);
|
||||
}
|
||||
|
||||
/** Get an endpoint. */
|
||||
public get(appId: string, endpointId: string): Promise<EndpointOut> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.GET,
|
||||
"/api/v1/app/{app_id}/endpoint/{endpoint_id}"
|
||||
);
|
||||
|
||||
request.setPathParam("app_id", appId);
|
||||
request.setPathParam("endpoint_id", endpointId);
|
||||
|
||||
return request.send(this.requestCtx, EndpointOutSerializer._fromJsonObject);
|
||||
}
|
||||
|
||||
/** Update an endpoint. */
|
||||
public update(
|
||||
appId: string,
|
||||
endpointId: string,
|
||||
endpointUpdate: EndpointUpdate
|
||||
): Promise<EndpointOut> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.PUT,
|
||||
"/api/v1/app/{app_id}/endpoint/{endpoint_id}"
|
||||
);
|
||||
|
||||
request.setPathParam("app_id", appId);
|
||||
request.setPathParam("endpoint_id", endpointId);
|
||||
request.setBody(EndpointUpdateSerializer._toJsonObject(endpointUpdate));
|
||||
|
||||
return request.send(this.requestCtx, EndpointOutSerializer._fromJsonObject);
|
||||
}
|
||||
|
||||
/** Delete an endpoint. */
|
||||
public delete(appId: string, endpointId: string): Promise<void> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.DELETE,
|
||||
"/api/v1/app/{app_id}/endpoint/{endpoint_id}"
|
||||
);
|
||||
|
||||
request.setPathParam("app_id", appId);
|
||||
request.setPathParam("endpoint_id", endpointId);
|
||||
|
||||
return request.sendNoResponseBody(this.requestCtx);
|
||||
}
|
||||
|
||||
/** Partially update an endpoint. */
|
||||
public patch(
|
||||
appId: string,
|
||||
endpointId: string,
|
||||
endpointPatch: EndpointPatch
|
||||
): Promise<EndpointOut> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.PATCH,
|
||||
"/api/v1/app/{app_id}/endpoint/{endpoint_id}"
|
||||
);
|
||||
|
||||
request.setPathParam("app_id", appId);
|
||||
request.setPathParam("endpoint_id", endpointId);
|
||||
request.setBody(EndpointPatchSerializer._toJsonObject(endpointPatch));
|
||||
|
||||
return request.send(this.requestCtx, EndpointOutSerializer._fromJsonObject);
|
||||
}
|
||||
|
||||
/**
|
||||
* Bulk replay messages sent to the endpoint.
|
||||
*
|
||||
* Only messages that were created after `since` will be sent.
|
||||
* This will replay both successful, and failed messages
|
||||
*
|
||||
* A completed task will return a payload like the following:
|
||||
* ```json
|
||||
* {
|
||||
* "id": "qtask_33qen93MNuelBAq1T9G7eHLJRsF",
|
||||
* "status": "finished",
|
||||
* "task": "endpoint.bulk-replay",
|
||||
* "data": {
|
||||
* "messagesSent": 2
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
public bulkReplay(
|
||||
appId: string,
|
||||
endpointId: string,
|
||||
bulkReplayIn: BulkReplayIn,
|
||||
options?: EndpointBulkReplayOptions
|
||||
): Promise<ReplayOut> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.POST,
|
||||
"/api/v1/app/{app_id}/endpoint/{endpoint_id}/bulk-replay"
|
||||
);
|
||||
|
||||
request.setPathParam("app_id", appId);
|
||||
request.setPathParam("endpoint_id", endpointId);
|
||||
request.setHeaderParam("idempotency-key", options?.idempotencyKey);
|
||||
request.setBody(BulkReplayInSerializer._toJsonObject(bulkReplayIn));
|
||||
|
||||
return request.send(this.requestCtx, ReplayOutSerializer._fromJsonObject);
|
||||
}
|
||||
|
||||
/** Get the additional headers to be sent with the webhook. */
|
||||
public getHeaders(appId: string, endpointId: string): Promise<EndpointHeadersOut> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.GET,
|
||||
"/api/v1/app/{app_id}/endpoint/{endpoint_id}/headers"
|
||||
);
|
||||
|
||||
request.setPathParam("app_id", appId);
|
||||
request.setPathParam("endpoint_id", endpointId);
|
||||
|
||||
return request.send(this.requestCtx, EndpointHeadersOutSerializer._fromJsonObject);
|
||||
}
|
||||
|
||||
/** Set the additional headers to be sent with the webhook. */
|
||||
public updateHeaders(
|
||||
appId: string,
|
||||
endpointId: string,
|
||||
endpointHeadersIn: EndpointHeadersIn
|
||||
): Promise<void> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.PUT,
|
||||
"/api/v1/app/{app_id}/endpoint/{endpoint_id}/headers"
|
||||
);
|
||||
|
||||
request.setPathParam("app_id", appId);
|
||||
request.setPathParam("endpoint_id", endpointId);
|
||||
request.setBody(EndpointHeadersInSerializer._toJsonObject(endpointHeadersIn));
|
||||
|
||||
return request.sendNoResponseBody(this.requestCtx);
|
||||
}
|
||||
|
||||
public headersUpdate(
|
||||
appId: string,
|
||||
endpointId: string,
|
||||
endpointHeadersIn: EndpointHeadersIn
|
||||
): Promise<void> {
|
||||
return this.updateHeaders(appId, endpointId, endpointHeadersIn);
|
||||
}
|
||||
|
||||
/** Partially set the additional headers to be sent with the webhook. */
|
||||
public patchHeaders(
|
||||
appId: string,
|
||||
endpointId: string,
|
||||
endpointHeadersPatchIn: EndpointHeadersPatchIn
|
||||
): Promise<void> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.PATCH,
|
||||
"/api/v1/app/{app_id}/endpoint/{endpoint_id}/headers"
|
||||
);
|
||||
|
||||
request.setPathParam("app_id", appId);
|
||||
request.setPathParam("endpoint_id", endpointId);
|
||||
request.setBody(
|
||||
EndpointHeadersPatchInSerializer._toJsonObject(endpointHeadersPatchIn)
|
||||
);
|
||||
|
||||
return request.sendNoResponseBody(this.requestCtx);
|
||||
}
|
||||
|
||||
public headersPatch(
|
||||
appId: string,
|
||||
endpointId: string,
|
||||
endpointHeadersPatchIn: EndpointHeadersPatchIn
|
||||
): Promise<void> {
|
||||
return this.patchHeaders(appId, endpointId, endpointHeadersPatchIn);
|
||||
}
|
||||
|
||||
/**
|
||||
* Resend all failed messages since a given time.
|
||||
*
|
||||
* Messages that were sent successfully, even if failed initially, are not resent.
|
||||
*
|
||||
* A completed task will return a payload like the following:
|
||||
* ```json
|
||||
* {
|
||||
* "id": "qtask_33qen93MNuelBAq1T9G7eHLJRsF",
|
||||
* "status": "finished",
|
||||
* "task": "endpoint.recover",
|
||||
* "data": {
|
||||
* "messagesSent": 2
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
public recover(
|
||||
appId: string,
|
||||
endpointId: string,
|
||||
recoverIn: RecoverIn,
|
||||
options?: EndpointRecoverOptions
|
||||
): Promise<RecoverOut> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.POST,
|
||||
"/api/v1/app/{app_id}/endpoint/{endpoint_id}/recover"
|
||||
);
|
||||
|
||||
request.setPathParam("app_id", appId);
|
||||
request.setPathParam("endpoint_id", endpointId);
|
||||
request.setHeaderParam("idempotency-key", options?.idempotencyKey);
|
||||
request.setBody(RecoverInSerializer._toJsonObject(recoverIn));
|
||||
|
||||
return request.send(this.requestCtx, RecoverOutSerializer._fromJsonObject);
|
||||
}
|
||||
|
||||
/**
|
||||
* Replays messages to the endpoint.
|
||||
*
|
||||
* Only messages that were created after `since` will be sent.
|
||||
* Messages that were previously sent to the endpoint are not resent.
|
||||
*
|
||||
* A completed task will return a payload like the following:
|
||||
* ```json
|
||||
* {
|
||||
* "id": "qtask_33qen93MNuelBAq1T9G7eHLJRsF",
|
||||
* "status": "finished",
|
||||
* "task": "endpoint.replay",
|
||||
* "data": {
|
||||
* "messagesSent": 2
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
public replayMissing(
|
||||
appId: string,
|
||||
endpointId: string,
|
||||
replayIn: ReplayIn,
|
||||
options?: EndpointReplayMissingOptions
|
||||
): Promise<ReplayOut> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.POST,
|
||||
"/api/v1/app/{app_id}/endpoint/{endpoint_id}/replay-missing"
|
||||
);
|
||||
|
||||
request.setPathParam("app_id", appId);
|
||||
request.setPathParam("endpoint_id", endpointId);
|
||||
request.setHeaderParam("idempotency-key", options?.idempotencyKey);
|
||||
request.setBody(ReplayInSerializer._toJsonObject(replayIn));
|
||||
|
||||
return request.send(this.requestCtx, ReplayOutSerializer._fromJsonObject);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the 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(appId: string, endpointId: string): Promise<EndpointSecretOut> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.GET,
|
||||
"/api/v1/app/{app_id}/endpoint/{endpoint_id}/secret"
|
||||
);
|
||||
|
||||
request.setPathParam("app_id", appId);
|
||||
request.setPathParam("endpoint_id", endpointId);
|
||||
|
||||
return request.send(this.requestCtx, EndpointSecretOutSerializer._fromJsonObject);
|
||||
}
|
||||
|
||||
/**
|
||||
* Rotates the endpoint's signing secret.
|
||||
*
|
||||
* The previous secret will remain valid for the next 24 hours.
|
||||
*/
|
||||
public rotateSecret(
|
||||
appId: string,
|
||||
endpointId: string,
|
||||
endpointSecretRotateIn: EndpointSecretRotateIn,
|
||||
options?: EndpointRotateSecretOptions
|
||||
): Promise<void> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.POST,
|
||||
"/api/v1/app/{app_id}/endpoint/{endpoint_id}/secret/rotate"
|
||||
);
|
||||
|
||||
request.setPathParam("app_id", appId);
|
||||
request.setPathParam("endpoint_id", endpointId);
|
||||
request.setHeaderParam("idempotency-key", options?.idempotencyKey);
|
||||
request.setBody(
|
||||
EndpointSecretRotateInSerializer._toJsonObject(endpointSecretRotateIn)
|
||||
);
|
||||
|
||||
return request.sendNoResponseBody(this.requestCtx);
|
||||
}
|
||||
|
||||
/** Send an example message for an event. */
|
||||
public sendExample(
|
||||
appId: string,
|
||||
endpointId: string,
|
||||
eventExampleIn: EventExampleIn,
|
||||
options?: EndpointSendExampleOptions
|
||||
): Promise<MessageOut> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.POST,
|
||||
"/api/v1/app/{app_id}/endpoint/{endpoint_id}/send-example"
|
||||
);
|
||||
|
||||
request.setPathParam("app_id", appId);
|
||||
request.setPathParam("endpoint_id", endpointId);
|
||||
request.setHeaderParam("idempotency-key", options?.idempotencyKey);
|
||||
request.setBody(EventExampleInSerializer._toJsonObject(eventExampleIn));
|
||||
|
||||
return request.send(this.requestCtx, MessageOutSerializer._fromJsonObject);
|
||||
}
|
||||
|
||||
/** Get basic statistics for the endpoint. */
|
||||
public getStats(
|
||||
appId: string,
|
||||
endpointId: string,
|
||||
options?: EndpointGetStatsOptions
|
||||
): Promise<EndpointStats> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.GET,
|
||||
"/api/v1/app/{app_id}/endpoint/{endpoint_id}/stats"
|
||||
);
|
||||
|
||||
request.setPathParam("app_id", appId);
|
||||
request.setPathParam("endpoint_id", endpointId);
|
||||
request.setQueryParams({
|
||||
since: options?.since,
|
||||
until: options?.until,
|
||||
});
|
||||
|
||||
return request.send(this.requestCtx, EndpointStatsSerializer._fromJsonObject);
|
||||
}
|
||||
|
||||
/** Get the transformation code associated with this endpoint. */
|
||||
public transformationGet(
|
||||
appId: string,
|
||||
endpointId: string
|
||||
): Promise<EndpointTransformationOut> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.GET,
|
||||
"/api/v1/app/{app_id}/endpoint/{endpoint_id}/transformation"
|
||||
);
|
||||
|
||||
request.setPathParam("app_id", appId);
|
||||
request.setPathParam("endpoint_id", endpointId);
|
||||
|
||||
return request.send(
|
||||
this.requestCtx,
|
||||
EndpointTransformationOutSerializer._fromJsonObject
|
||||
);
|
||||
}
|
||||
|
||||
/** Set or unset the transformation code associated with this endpoint. */
|
||||
public patchTransformation(
|
||||
appId: string,
|
||||
endpointId: string,
|
||||
endpointTransformationPatch: EndpointTransformationPatch
|
||||
): Promise<void> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.PATCH,
|
||||
"/api/v1/app/{app_id}/endpoint/{endpoint_id}/transformation"
|
||||
);
|
||||
|
||||
request.setPathParam("app_id", appId);
|
||||
request.setPathParam("endpoint_id", endpointId);
|
||||
request.setBody(
|
||||
EndpointTransformationPatchSerializer._toJsonObject(endpointTransformationPatch)
|
||||
);
|
||||
|
||||
return request.sendNoResponseBody(this.requestCtx);
|
||||
}
|
||||
|
||||
/**
|
||||
* This operation was renamed to `set-transformation`.
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
public transformationPartialUpdate(
|
||||
appId: string,
|
||||
endpointId: string,
|
||||
endpointTransformationIn: EndpointTransformationIn
|
||||
): Promise<void> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.PATCH,
|
||||
"/api/v1/app/{app_id}/endpoint/{endpoint_id}/transformation"
|
||||
);
|
||||
|
||||
request.setPathParam("app_id", appId);
|
||||
request.setPathParam("endpoint_id", endpointId);
|
||||
request.setBody(
|
||||
EndpointTransformationInSerializer._toJsonObject(endpointTransformationIn)
|
||||
);
|
||||
|
||||
return request.sendNoResponseBody(this.requestCtx);
|
||||
}
|
||||
}
|
||||
51
node_modules/svix/src/api/environment.ts
generated
vendored
Normal file
51
node_modules/svix/src/api/environment.ts
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
// this file is @generated
|
||||
|
||||
import { type EnvironmentIn, EnvironmentInSerializer } from "../models/environmentIn";
|
||||
import { type EnvironmentOut, EnvironmentOutSerializer } from "../models/environmentOut";
|
||||
import { HttpMethod, SvixRequest, type SvixRequestContext } from "../request";
|
||||
|
||||
export interface EnvironmentExportOptions {
|
||||
idempotencyKey?: string;
|
||||
}
|
||||
|
||||
export interface EnvironmentImportOptions {
|
||||
idempotencyKey?: string;
|
||||
}
|
||||
|
||||
export class Environment {
|
||||
public constructor(private readonly requestCtx: SvixRequestContext) {}
|
||||
|
||||
/**
|
||||
* Download a JSON file containing all org-settings and event types.
|
||||
*
|
||||
* Note that the schema for [`EnvironmentOut`] is subject to change. The fields
|
||||
* herein are provided for convenience but should be treated as JSON blobs.
|
||||
*/
|
||||
public export(options?: EnvironmentExportOptions): Promise<EnvironmentOut> {
|
||||
const request = new SvixRequest(HttpMethod.POST, "/api/v1/environment/export");
|
||||
|
||||
request.setHeaderParam("idempotency-key", options?.idempotencyKey);
|
||||
|
||||
return request.send(this.requestCtx, EnvironmentOutSerializer._fromJsonObject);
|
||||
}
|
||||
|
||||
/**
|
||||
* Import a configuration into the active organization.
|
||||
*
|
||||
* It doesn't delete anything, only adds / updates what was passed to it.
|
||||
*
|
||||
* Note that the schema for [`EnvironmentIn`] is subject to change. The fields
|
||||
* herein are provided for convenience but should be treated as JSON blobs.
|
||||
*/
|
||||
public import(
|
||||
environmentIn: EnvironmentIn,
|
||||
options?: EnvironmentImportOptions
|
||||
): Promise<void> {
|
||||
const request = new SvixRequest(HttpMethod.POST, "/api/v1/environment/import");
|
||||
|
||||
request.setHeaderParam("idempotency-key", options?.idempotencyKey);
|
||||
request.setBody(EnvironmentInSerializer._toJsonObject(environmentIn));
|
||||
|
||||
return request.sendNoResponseBody(this.requestCtx);
|
||||
}
|
||||
}
|
||||
180
node_modules/svix/src/api/eventType.ts
generated
vendored
Normal file
180
node_modules/svix/src/api/eventType.ts
generated
vendored
Normal file
@@ -0,0 +1,180 @@
|
||||
// this file is @generated
|
||||
|
||||
import {
|
||||
type EventTypeImportOpenApiIn,
|
||||
EventTypeImportOpenApiInSerializer,
|
||||
} from "../models/eventTypeImportOpenApiIn";
|
||||
import {
|
||||
type EventTypeImportOpenApiOut,
|
||||
EventTypeImportOpenApiOutSerializer,
|
||||
} from "../models/eventTypeImportOpenApiOut";
|
||||
import { type EventTypeIn, EventTypeInSerializer } from "../models/eventTypeIn";
|
||||
import { type EventTypeOut, EventTypeOutSerializer } from "../models/eventTypeOut";
|
||||
import { type EventTypePatch, EventTypePatchSerializer } from "../models/eventTypePatch";
|
||||
import {
|
||||
type EventTypeUpdate,
|
||||
EventTypeUpdateSerializer,
|
||||
} from "../models/eventTypeUpdate";
|
||||
import {
|
||||
type ListResponseEventTypeOut,
|
||||
ListResponseEventTypeOutSerializer,
|
||||
} from "../models/listResponseEventTypeOut";
|
||||
import type { Ordering } from "../models/ordering";
|
||||
import { HttpMethod, SvixRequest, type SvixRequestContext } from "../request";
|
||||
|
||||
export interface EventTypeListOptions {
|
||||
/** 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;
|
||||
/** When `true` archived (deleted but not expunged) items are included in the response. */
|
||||
includeArchived?: boolean;
|
||||
/** When `true` the full item (including the schema) is included in the response. */
|
||||
withContent?: boolean;
|
||||
}
|
||||
|
||||
export interface EventTypeCreateOptions {
|
||||
idempotencyKey?: string;
|
||||
}
|
||||
|
||||
export interface EventTypeImportOpenapiOptions {
|
||||
idempotencyKey?: string;
|
||||
}
|
||||
|
||||
export interface EventTypeDeleteOptions {
|
||||
/** By default event types are archived when "deleted". Passing this to `true` deletes them entirely. */
|
||||
expunge?: boolean;
|
||||
}
|
||||
|
||||
export class EventType {
|
||||
public constructor(private readonly requestCtx: SvixRequestContext) {}
|
||||
|
||||
/** Return the list of event types. */
|
||||
public list(options?: EventTypeListOptions): Promise<ListResponseEventTypeOut> {
|
||||
const request = new SvixRequest(HttpMethod.GET, "/api/v1/event-type");
|
||||
|
||||
request.setQueryParams({
|
||||
limit: options?.limit,
|
||||
iterator: options?.iterator,
|
||||
order: options?.order,
|
||||
include_archived: options?.includeArchived,
|
||||
with_content: options?.withContent,
|
||||
});
|
||||
|
||||
return request.send(
|
||||
this.requestCtx,
|
||||
ListResponseEventTypeOutSerializer._fromJsonObject
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create new or unarchive existing event type.
|
||||
*
|
||||
* Unarchiving an event type will allow endpoints to filter on it and messages to be sent with it.
|
||||
* Endpoints filtering on the event type before archival will continue to filter on it.
|
||||
* This operation does not preserve the description and schemas.
|
||||
*/
|
||||
public create(
|
||||
eventTypeIn: EventTypeIn,
|
||||
options?: EventTypeCreateOptions
|
||||
): Promise<EventTypeOut> {
|
||||
const request = new SvixRequest(HttpMethod.POST, "/api/v1/event-type");
|
||||
|
||||
request.setHeaderParam("idempotency-key", options?.idempotencyKey);
|
||||
request.setBody(EventTypeInSerializer._toJsonObject(eventTypeIn));
|
||||
|
||||
return request.send(this.requestCtx, EventTypeOutSerializer._fromJsonObject);
|
||||
}
|
||||
|
||||
/**
|
||||
* Given an OpenAPI spec, create new or update existing event types.
|
||||
*
|
||||
* If an existing `archived` event type is updated, it will be unarchived.
|
||||
* The importer will convert all webhooks found in the either the `webhooks` or `x-webhooks`
|
||||
* top-level.
|
||||
*/
|
||||
public importOpenapi(
|
||||
eventTypeImportOpenApiIn: EventTypeImportOpenApiIn,
|
||||
options?: EventTypeImportOpenapiOptions
|
||||
): Promise<EventTypeImportOpenApiOut> {
|
||||
const request = new SvixRequest(HttpMethod.POST, "/api/v1/event-type/import/openapi");
|
||||
|
||||
request.setHeaderParam("idempotency-key", options?.idempotencyKey);
|
||||
request.setBody(
|
||||
EventTypeImportOpenApiInSerializer._toJsonObject(eventTypeImportOpenApiIn)
|
||||
);
|
||||
|
||||
return request.send(
|
||||
this.requestCtx,
|
||||
EventTypeImportOpenApiOutSerializer._fromJsonObject
|
||||
);
|
||||
}
|
||||
|
||||
/** Get an event type. */
|
||||
public get(eventTypeName: string): Promise<EventTypeOut> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.GET,
|
||||
"/api/v1/event-type/{event_type_name}"
|
||||
);
|
||||
|
||||
request.setPathParam("event_type_name", eventTypeName);
|
||||
|
||||
return request.send(this.requestCtx, EventTypeOutSerializer._fromJsonObject);
|
||||
}
|
||||
|
||||
/** Update an event type. */
|
||||
public update(
|
||||
eventTypeName: string,
|
||||
eventTypeUpdate: EventTypeUpdate
|
||||
): Promise<EventTypeOut> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.PUT,
|
||||
"/api/v1/event-type/{event_type_name}"
|
||||
);
|
||||
|
||||
request.setPathParam("event_type_name", eventTypeName);
|
||||
request.setBody(EventTypeUpdateSerializer._toJsonObject(eventTypeUpdate));
|
||||
|
||||
return request.send(this.requestCtx, EventTypeOutSerializer._fromJsonObject);
|
||||
}
|
||||
|
||||
/**
|
||||
* Archive an event type.
|
||||
*
|
||||
* Endpoints already configured to filter on an event type will continue to do so after archival.
|
||||
* However, new messages can not be sent with it and endpoints can not filter on it.
|
||||
* An event type can be unarchived with the
|
||||
* [create operation](#operation/create_event_type_api_v1_event_type__post).
|
||||
*/
|
||||
public delete(eventTypeName: string, options?: EventTypeDeleteOptions): Promise<void> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.DELETE,
|
||||
"/api/v1/event-type/{event_type_name}"
|
||||
);
|
||||
|
||||
request.setPathParam("event_type_name", eventTypeName);
|
||||
request.setQueryParams({
|
||||
expunge: options?.expunge,
|
||||
});
|
||||
|
||||
return request.sendNoResponseBody(this.requestCtx);
|
||||
}
|
||||
|
||||
/** Partially update an event type. */
|
||||
public patch(
|
||||
eventTypeName: string,
|
||||
eventTypePatch: EventTypePatch
|
||||
): Promise<EventTypeOut> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.PATCH,
|
||||
"/api/v1/event-type/{event_type_name}"
|
||||
);
|
||||
|
||||
request.setPathParam("event_type_name", eventTypeName);
|
||||
request.setBody(EventTypePatchSerializer._toJsonObject(eventTypePatch));
|
||||
|
||||
return request.send(this.requestCtx, EventTypeOutSerializer._fromJsonObject);
|
||||
}
|
||||
}
|
||||
14
node_modules/svix/src/api/health.ts
generated
vendored
Normal file
14
node_modules/svix/src/api/health.ts
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
// this file is @generated
|
||||
|
||||
import { HttpMethod, SvixRequest, type SvixRequestContext } from "../request";
|
||||
|
||||
export class Health {
|
||||
public constructor(private readonly requestCtx: SvixRequestContext) {}
|
||||
|
||||
/** Verify the API server is up and running. */
|
||||
public get(): Promise<void> {
|
||||
const request = new SvixRequest(HttpMethod.GET, "/api/v1/health");
|
||||
|
||||
return request.sendNoResponseBody(this.requestCtx);
|
||||
}
|
||||
}
|
||||
51
node_modules/svix/src/api/ingest.ts
generated
vendored
Normal file
51
node_modules/svix/src/api/ingest.ts
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
// this file is @generated
|
||||
|
||||
import {
|
||||
type DashboardAccessOut,
|
||||
DashboardAccessOutSerializer,
|
||||
} from "../models/dashboardAccessOut";
|
||||
import {
|
||||
type IngestSourceConsumerPortalAccessIn,
|
||||
IngestSourceConsumerPortalAccessInSerializer,
|
||||
} from "../models/ingestSourceConsumerPortalAccessIn";
|
||||
import { IngestEndpoint } from "./ingestEndpoint";
|
||||
import { IngestSource } from "./ingestSource";
|
||||
import { HttpMethod, SvixRequest, type SvixRequestContext } from "../request";
|
||||
|
||||
export interface IngestDashboardOptions {
|
||||
idempotencyKey?: string;
|
||||
}
|
||||
|
||||
export class Ingest {
|
||||
public constructor(private readonly requestCtx: SvixRequestContext) {}
|
||||
|
||||
public get endpoint() {
|
||||
return new IngestEndpoint(this.requestCtx);
|
||||
}
|
||||
|
||||
public get source() {
|
||||
return new IngestSource(this.requestCtx);
|
||||
}
|
||||
|
||||
/** Get access to the Ingest Source Consumer Portal. */
|
||||
public dashboard(
|
||||
sourceId: string,
|
||||
ingestSourceConsumerPortalAccessIn: IngestSourceConsumerPortalAccessIn,
|
||||
options?: IngestDashboardOptions
|
||||
): Promise<DashboardAccessOut> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.POST,
|
||||
"/ingest/api/v1/source/{source_id}/dashboard"
|
||||
);
|
||||
|
||||
request.setPathParam("source_id", sourceId);
|
||||
request.setHeaderParam("idempotency-key", options?.idempotencyKey);
|
||||
request.setBody(
|
||||
IngestSourceConsumerPortalAccessInSerializer._toJsonObject(
|
||||
ingestSourceConsumerPortalAccessIn
|
||||
)
|
||||
);
|
||||
|
||||
return request.send(this.requestCtx, DashboardAccessOutSerializer._fromJsonObject);
|
||||
}
|
||||
}
|
||||
280
node_modules/svix/src/api/ingestEndpoint.ts
generated
vendored
Normal file
280
node_modules/svix/src/api/ingestEndpoint.ts
generated
vendored
Normal file
@@ -0,0 +1,280 @@
|
||||
// this file is @generated
|
||||
|
||||
import {
|
||||
type IngestEndpointHeadersIn,
|
||||
IngestEndpointHeadersInSerializer,
|
||||
} from "../models/ingestEndpointHeadersIn";
|
||||
import {
|
||||
type IngestEndpointHeadersOut,
|
||||
IngestEndpointHeadersOutSerializer,
|
||||
} from "../models/ingestEndpointHeadersOut";
|
||||
import {
|
||||
type IngestEndpointIn,
|
||||
IngestEndpointInSerializer,
|
||||
} from "../models/ingestEndpointIn";
|
||||
import {
|
||||
type IngestEndpointOut,
|
||||
IngestEndpointOutSerializer,
|
||||
} from "../models/ingestEndpointOut";
|
||||
import {
|
||||
type IngestEndpointSecretIn,
|
||||
IngestEndpointSecretInSerializer,
|
||||
} from "../models/ingestEndpointSecretIn";
|
||||
import {
|
||||
type IngestEndpointSecretOut,
|
||||
IngestEndpointSecretOutSerializer,
|
||||
} from "../models/ingestEndpointSecretOut";
|
||||
import {
|
||||
type IngestEndpointTransformationOut,
|
||||
IngestEndpointTransformationOutSerializer,
|
||||
} from "../models/ingestEndpointTransformationOut";
|
||||
import {
|
||||
type IngestEndpointTransformationPatch,
|
||||
IngestEndpointTransformationPatchSerializer,
|
||||
} from "../models/ingestEndpointTransformationPatch";
|
||||
import {
|
||||
type IngestEndpointUpdate,
|
||||
IngestEndpointUpdateSerializer,
|
||||
} from "../models/ingestEndpointUpdate";
|
||||
import {
|
||||
type ListResponseIngestEndpointOut,
|
||||
ListResponseIngestEndpointOutSerializer,
|
||||
} from "../models/listResponseIngestEndpointOut";
|
||||
import type { Ordering } from "../models/ordering";
|
||||
import { HttpMethod, SvixRequest, type SvixRequestContext } from "../request";
|
||||
|
||||
export interface IngestEndpointListOptions {
|
||||
/** 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 interface IngestEndpointCreateOptions {
|
||||
idempotencyKey?: string;
|
||||
}
|
||||
|
||||
export interface IngestEndpointRotateSecretOptions {
|
||||
idempotencyKey?: string;
|
||||
}
|
||||
|
||||
export class IngestEndpoint {
|
||||
public constructor(private readonly requestCtx: SvixRequestContext) {}
|
||||
|
||||
/** List ingest endpoints. */
|
||||
public list(
|
||||
sourceId: string,
|
||||
options?: IngestEndpointListOptions
|
||||
): Promise<ListResponseIngestEndpointOut> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.GET,
|
||||
"/ingest/api/v1/source/{source_id}/endpoint"
|
||||
);
|
||||
|
||||
request.setPathParam("source_id", sourceId);
|
||||
request.setQueryParams({
|
||||
limit: options?.limit,
|
||||
iterator: options?.iterator,
|
||||
order: options?.order,
|
||||
});
|
||||
|
||||
return request.send(
|
||||
this.requestCtx,
|
||||
ListResponseIngestEndpointOutSerializer._fromJsonObject
|
||||
);
|
||||
}
|
||||
|
||||
/** Create an ingest endpoint. */
|
||||
public create(
|
||||
sourceId: string,
|
||||
ingestEndpointIn: IngestEndpointIn,
|
||||
options?: IngestEndpointCreateOptions
|
||||
): Promise<IngestEndpointOut> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.POST,
|
||||
"/ingest/api/v1/source/{source_id}/endpoint"
|
||||
);
|
||||
|
||||
request.setPathParam("source_id", sourceId);
|
||||
request.setHeaderParam("idempotency-key", options?.idempotencyKey);
|
||||
request.setBody(IngestEndpointInSerializer._toJsonObject(ingestEndpointIn));
|
||||
|
||||
return request.send(this.requestCtx, IngestEndpointOutSerializer._fromJsonObject);
|
||||
}
|
||||
|
||||
/** Get an ingest endpoint. */
|
||||
public get(sourceId: string, endpointId: string): Promise<IngestEndpointOut> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.GET,
|
||||
"/ingest/api/v1/source/{source_id}/endpoint/{endpoint_id}"
|
||||
);
|
||||
|
||||
request.setPathParam("source_id", sourceId);
|
||||
request.setPathParam("endpoint_id", endpointId);
|
||||
|
||||
return request.send(this.requestCtx, IngestEndpointOutSerializer._fromJsonObject);
|
||||
}
|
||||
|
||||
/** Update an ingest endpoint. */
|
||||
public update(
|
||||
sourceId: string,
|
||||
endpointId: string,
|
||||
ingestEndpointUpdate: IngestEndpointUpdate
|
||||
): Promise<IngestEndpointOut> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.PUT,
|
||||
"/ingest/api/v1/source/{source_id}/endpoint/{endpoint_id}"
|
||||
);
|
||||
|
||||
request.setPathParam("source_id", sourceId);
|
||||
request.setPathParam("endpoint_id", endpointId);
|
||||
request.setBody(IngestEndpointUpdateSerializer._toJsonObject(ingestEndpointUpdate));
|
||||
|
||||
return request.send(this.requestCtx, IngestEndpointOutSerializer._fromJsonObject);
|
||||
}
|
||||
|
||||
/** Delete an ingest endpoint. */
|
||||
public delete(sourceId: string, endpointId: string): Promise<void> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.DELETE,
|
||||
"/ingest/api/v1/source/{source_id}/endpoint/{endpoint_id}"
|
||||
);
|
||||
|
||||
request.setPathParam("source_id", sourceId);
|
||||
request.setPathParam("endpoint_id", endpointId);
|
||||
|
||||
return request.sendNoResponseBody(this.requestCtx);
|
||||
}
|
||||
|
||||
/** Get the additional headers to be sent with the ingest. */
|
||||
public getHeaders(
|
||||
sourceId: string,
|
||||
endpointId: string
|
||||
): Promise<IngestEndpointHeadersOut> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.GET,
|
||||
"/ingest/api/v1/source/{source_id}/endpoint/{endpoint_id}/headers"
|
||||
);
|
||||
|
||||
request.setPathParam("source_id", sourceId);
|
||||
request.setPathParam("endpoint_id", endpointId);
|
||||
|
||||
return request.send(
|
||||
this.requestCtx,
|
||||
IngestEndpointHeadersOutSerializer._fromJsonObject
|
||||
);
|
||||
}
|
||||
|
||||
/** Set the additional headers to be sent to the endpoint. */
|
||||
public updateHeaders(
|
||||
sourceId: string,
|
||||
endpointId: string,
|
||||
ingestEndpointHeadersIn: IngestEndpointHeadersIn
|
||||
): Promise<void> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.PUT,
|
||||
"/ingest/api/v1/source/{source_id}/endpoint/{endpoint_id}/headers"
|
||||
);
|
||||
|
||||
request.setPathParam("source_id", sourceId);
|
||||
request.setPathParam("endpoint_id", endpointId);
|
||||
request.setBody(
|
||||
IngestEndpointHeadersInSerializer._toJsonObject(ingestEndpointHeadersIn)
|
||||
);
|
||||
|
||||
return request.sendNoResponseBody(this.requestCtx);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an ingest 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(
|
||||
sourceId: string,
|
||||
endpointId: string
|
||||
): Promise<IngestEndpointSecretOut> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.GET,
|
||||
"/ingest/api/v1/source/{source_id}/endpoint/{endpoint_id}/secret"
|
||||
);
|
||||
|
||||
request.setPathParam("source_id", sourceId);
|
||||
request.setPathParam("endpoint_id", endpointId);
|
||||
|
||||
return request.send(
|
||||
this.requestCtx,
|
||||
IngestEndpointSecretOutSerializer._fromJsonObject
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Rotates an ingest endpoint's signing secret.
|
||||
*
|
||||
* The previous secret will remain valid for the next 24 hours.
|
||||
*/
|
||||
public rotateSecret(
|
||||
sourceId: string,
|
||||
endpointId: string,
|
||||
ingestEndpointSecretIn: IngestEndpointSecretIn,
|
||||
options?: IngestEndpointRotateSecretOptions
|
||||
): Promise<void> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.POST,
|
||||
"/ingest/api/v1/source/{source_id}/endpoint/{endpoint_id}/secret/rotate"
|
||||
);
|
||||
|
||||
request.setPathParam("source_id", sourceId);
|
||||
request.setPathParam("endpoint_id", endpointId);
|
||||
request.setHeaderParam("idempotency-key", options?.idempotencyKey);
|
||||
request.setBody(
|
||||
IngestEndpointSecretInSerializer._toJsonObject(ingestEndpointSecretIn)
|
||||
);
|
||||
|
||||
return request.sendNoResponseBody(this.requestCtx);
|
||||
}
|
||||
|
||||
/** Get the transformation code associated with this ingest endpoint. */
|
||||
public getTransformation(
|
||||
sourceId: string,
|
||||
endpointId: string
|
||||
): Promise<IngestEndpointTransformationOut> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.GET,
|
||||
"/ingest/api/v1/source/{source_id}/endpoint/{endpoint_id}/transformation"
|
||||
);
|
||||
|
||||
request.setPathParam("source_id", sourceId);
|
||||
request.setPathParam("endpoint_id", endpointId);
|
||||
|
||||
return request.send(
|
||||
this.requestCtx,
|
||||
IngestEndpointTransformationOutSerializer._fromJsonObject
|
||||
);
|
||||
}
|
||||
|
||||
/** Set or unset the transformation code associated with this ingest endpoint. */
|
||||
public setTransformation(
|
||||
sourceId: string,
|
||||
endpointId: string,
|
||||
ingestEndpointTransformationPatch: IngestEndpointTransformationPatch
|
||||
): Promise<void> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.PATCH,
|
||||
"/ingest/api/v1/source/{source_id}/endpoint/{endpoint_id}/transformation"
|
||||
);
|
||||
|
||||
request.setPathParam("source_id", sourceId);
|
||||
request.setPathParam("endpoint_id", endpointId);
|
||||
request.setBody(
|
||||
IngestEndpointTransformationPatchSerializer._toJsonObject(
|
||||
ingestEndpointTransformationPatch
|
||||
)
|
||||
);
|
||||
|
||||
return request.sendNoResponseBody(this.requestCtx);
|
||||
}
|
||||
}
|
||||
121
node_modules/svix/src/api/ingestSource.ts
generated
vendored
Normal file
121
node_modules/svix/src/api/ingestSource.ts
generated
vendored
Normal file
@@ -0,0 +1,121 @@
|
||||
// this file is @generated
|
||||
|
||||
import { type IngestSourceIn, IngestSourceInSerializer } from "../models/ingestSourceIn";
|
||||
import {
|
||||
type IngestSourceOut,
|
||||
IngestSourceOutSerializer,
|
||||
} from "../models/ingestSourceOut";
|
||||
import {
|
||||
type ListResponseIngestSourceOut,
|
||||
ListResponseIngestSourceOutSerializer,
|
||||
} from "../models/listResponseIngestSourceOut";
|
||||
import type { Ordering } from "../models/ordering";
|
||||
import { type RotateTokenOut, RotateTokenOutSerializer } from "../models/rotateTokenOut";
|
||||
import { HttpMethod, SvixRequest, type SvixRequestContext } from "../request";
|
||||
|
||||
export interface IngestSourceListOptions {
|
||||
/** 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 interface IngestSourceCreateOptions {
|
||||
idempotencyKey?: string;
|
||||
}
|
||||
|
||||
export interface IngestSourceRotateTokenOptions {
|
||||
idempotencyKey?: string;
|
||||
}
|
||||
|
||||
export class IngestSource {
|
||||
public constructor(private readonly requestCtx: SvixRequestContext) {}
|
||||
|
||||
/** List of all the organization's Ingest Sources. */
|
||||
public list(options?: IngestSourceListOptions): Promise<ListResponseIngestSourceOut> {
|
||||
const request = new SvixRequest(HttpMethod.GET, "/ingest/api/v1/source");
|
||||
|
||||
request.setQueryParams({
|
||||
limit: options?.limit,
|
||||
iterator: options?.iterator,
|
||||
order: options?.order,
|
||||
});
|
||||
|
||||
return request.send(
|
||||
this.requestCtx,
|
||||
ListResponseIngestSourceOutSerializer._fromJsonObject
|
||||
);
|
||||
}
|
||||
|
||||
/** Create Ingest Source. */
|
||||
public create(
|
||||
ingestSourceIn: IngestSourceIn,
|
||||
options?: IngestSourceCreateOptions
|
||||
): Promise<IngestSourceOut> {
|
||||
const request = new SvixRequest(HttpMethod.POST, "/ingest/api/v1/source");
|
||||
|
||||
request.setHeaderParam("idempotency-key", options?.idempotencyKey);
|
||||
request.setBody(IngestSourceInSerializer._toJsonObject(ingestSourceIn));
|
||||
|
||||
return request.send(this.requestCtx, IngestSourceOutSerializer._fromJsonObject);
|
||||
}
|
||||
|
||||
/** Get an Ingest Source by id or uid. */
|
||||
public get(sourceId: string): Promise<IngestSourceOut> {
|
||||
const request = new SvixRequest(HttpMethod.GET, "/ingest/api/v1/source/{source_id}");
|
||||
|
||||
request.setPathParam("source_id", sourceId);
|
||||
|
||||
return request.send(this.requestCtx, IngestSourceOutSerializer._fromJsonObject);
|
||||
}
|
||||
|
||||
/** Update an Ingest Source. */
|
||||
public update(
|
||||
sourceId: string,
|
||||
ingestSourceIn: IngestSourceIn
|
||||
): Promise<IngestSourceOut> {
|
||||
const request = new SvixRequest(HttpMethod.PUT, "/ingest/api/v1/source/{source_id}");
|
||||
|
||||
request.setPathParam("source_id", sourceId);
|
||||
request.setBody(IngestSourceInSerializer._toJsonObject(ingestSourceIn));
|
||||
|
||||
return request.send(this.requestCtx, IngestSourceOutSerializer._fromJsonObject);
|
||||
}
|
||||
|
||||
/** Delete an Ingest Source. */
|
||||
public delete(sourceId: string): Promise<void> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.DELETE,
|
||||
"/ingest/api/v1/source/{source_id}"
|
||||
);
|
||||
|
||||
request.setPathParam("source_id", sourceId);
|
||||
|
||||
return request.sendNoResponseBody(this.requestCtx);
|
||||
}
|
||||
|
||||
/**
|
||||
* Rotate the Ingest Source's Url Token.
|
||||
*
|
||||
* This will rotate the ingest source's token, which is used to
|
||||
* construct the unique `ingestUrl` for the source. Previous tokens
|
||||
* will remain valid for 48 hours after rotation. The token can be
|
||||
* rotated a maximum of three times within the 48-hour period.
|
||||
*/
|
||||
public rotateToken(
|
||||
sourceId: string,
|
||||
options?: IngestSourceRotateTokenOptions
|
||||
): Promise<RotateTokenOut> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.POST,
|
||||
"/ingest/api/v1/source/{source_id}/token/rotate"
|
||||
);
|
||||
|
||||
request.setPathParam("source_id", sourceId);
|
||||
request.setHeaderParam("idempotency-key", options?.idempotencyKey);
|
||||
|
||||
return request.send(this.requestCtx, RotateTokenOutSerializer._fromJsonObject);
|
||||
}
|
||||
}
|
||||
153
node_modules/svix/src/api/integration.ts
generated
vendored
Normal file
153
node_modules/svix/src/api/integration.ts
generated
vendored
Normal file
@@ -0,0 +1,153 @@
|
||||
// this file is @generated
|
||||
|
||||
import { type IntegrationIn, IntegrationInSerializer } from "../models/integrationIn";
|
||||
import {
|
||||
type IntegrationKeyOut,
|
||||
IntegrationKeyOutSerializer,
|
||||
} from "../models/integrationKeyOut";
|
||||
import { type IntegrationOut, IntegrationOutSerializer } from "../models/integrationOut";
|
||||
import {
|
||||
type IntegrationUpdate,
|
||||
IntegrationUpdateSerializer,
|
||||
} from "../models/integrationUpdate";
|
||||
import {
|
||||
type ListResponseIntegrationOut,
|
||||
ListResponseIntegrationOutSerializer,
|
||||
} from "../models/listResponseIntegrationOut";
|
||||
import type { Ordering } from "../models/ordering";
|
||||
import { HttpMethod, SvixRequest, type SvixRequestContext } from "../request";
|
||||
|
||||
export interface IntegrationListOptions {
|
||||
/** 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 interface IntegrationCreateOptions {
|
||||
idempotencyKey?: string;
|
||||
}
|
||||
|
||||
export interface IntegrationRotateKeyOptions {
|
||||
idempotencyKey?: string;
|
||||
}
|
||||
|
||||
export class Integration {
|
||||
public constructor(private readonly requestCtx: SvixRequestContext) {}
|
||||
|
||||
/** List the application's integrations. */
|
||||
public list(
|
||||
appId: string,
|
||||
options?: IntegrationListOptions
|
||||
): Promise<ListResponseIntegrationOut> {
|
||||
const request = new SvixRequest(HttpMethod.GET, "/api/v1/app/{app_id}/integration");
|
||||
|
||||
request.setPathParam("app_id", appId);
|
||||
request.setQueryParams({
|
||||
limit: options?.limit,
|
||||
iterator: options?.iterator,
|
||||
order: options?.order,
|
||||
});
|
||||
|
||||
return request.send(
|
||||
this.requestCtx,
|
||||
ListResponseIntegrationOutSerializer._fromJsonObject
|
||||
);
|
||||
}
|
||||
|
||||
/** Create an integration. */
|
||||
public create(
|
||||
appId: string,
|
||||
integrationIn: IntegrationIn,
|
||||
options?: IntegrationCreateOptions
|
||||
): Promise<IntegrationOut> {
|
||||
const request = new SvixRequest(HttpMethod.POST, "/api/v1/app/{app_id}/integration");
|
||||
|
||||
request.setPathParam("app_id", appId);
|
||||
request.setHeaderParam("idempotency-key", options?.idempotencyKey);
|
||||
request.setBody(IntegrationInSerializer._toJsonObject(integrationIn));
|
||||
|
||||
return request.send(this.requestCtx, IntegrationOutSerializer._fromJsonObject);
|
||||
}
|
||||
|
||||
/** Get an integration. */
|
||||
public get(appId: string, integId: string): Promise<IntegrationOut> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.GET,
|
||||
"/api/v1/app/{app_id}/integration/{integ_id}"
|
||||
);
|
||||
|
||||
request.setPathParam("app_id", appId);
|
||||
request.setPathParam("integ_id", integId);
|
||||
|
||||
return request.send(this.requestCtx, IntegrationOutSerializer._fromJsonObject);
|
||||
}
|
||||
|
||||
/** Update an integration. */
|
||||
public update(
|
||||
appId: string,
|
||||
integId: string,
|
||||
integrationUpdate: IntegrationUpdate
|
||||
): Promise<IntegrationOut> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.PUT,
|
||||
"/api/v1/app/{app_id}/integration/{integ_id}"
|
||||
);
|
||||
|
||||
request.setPathParam("app_id", appId);
|
||||
request.setPathParam("integ_id", integId);
|
||||
request.setBody(IntegrationUpdateSerializer._toJsonObject(integrationUpdate));
|
||||
|
||||
return request.send(this.requestCtx, IntegrationOutSerializer._fromJsonObject);
|
||||
}
|
||||
|
||||
/** Delete an integration. */
|
||||
public delete(appId: string, integId: string): Promise<void> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.DELETE,
|
||||
"/api/v1/app/{app_id}/integration/{integ_id}"
|
||||
);
|
||||
|
||||
request.setPathParam("app_id", appId);
|
||||
request.setPathParam("integ_id", integId);
|
||||
|
||||
return request.sendNoResponseBody(this.requestCtx);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an integration's key.
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
public getKey(appId: string, integId: string): Promise<IntegrationKeyOut> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.GET,
|
||||
"/api/v1/app/{app_id}/integration/{integ_id}/key"
|
||||
);
|
||||
|
||||
request.setPathParam("app_id", appId);
|
||||
request.setPathParam("integ_id", integId);
|
||||
|
||||
return request.send(this.requestCtx, IntegrationKeyOutSerializer._fromJsonObject);
|
||||
}
|
||||
|
||||
/** Rotate the integration's key. The previous key will be immediately revoked. */
|
||||
public rotateKey(
|
||||
appId: string,
|
||||
integId: string,
|
||||
options?: IntegrationRotateKeyOptions
|
||||
): Promise<IntegrationKeyOut> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.POST,
|
||||
"/api/v1/app/{app_id}/integration/{integ_id}/key/rotate"
|
||||
);
|
||||
|
||||
request.setPathParam("app_id", appId);
|
||||
request.setPathParam("integ_id", integId);
|
||||
request.setHeaderParam("idempotency-key", options?.idempotencyKey);
|
||||
|
||||
return request.send(this.requestCtx, IntegrationKeyOutSerializer._fromJsonObject);
|
||||
}
|
||||
}
|
||||
254
node_modules/svix/src/api/message.ts
generated
vendored
Normal file
254
node_modules/svix/src/api/message.ts
generated
vendored
Normal file
@@ -0,0 +1,254 @@
|
||||
// this file is @generated
|
||||
|
||||
import {
|
||||
type ExpungeAllContentsOut,
|
||||
ExpungeAllContentsOutSerializer,
|
||||
} from "../models/expungeAllContentsOut";
|
||||
import {
|
||||
type ListResponseMessageOut,
|
||||
ListResponseMessageOutSerializer,
|
||||
} from "../models/listResponseMessageOut";
|
||||
import { type MessageOut, MessageOutSerializer } from "../models/messageOut";
|
||||
import {
|
||||
type MessagePrecheckIn,
|
||||
MessagePrecheckInSerializer,
|
||||
} from "../models/messagePrecheckIn";
|
||||
import {
|
||||
type MessagePrecheckOut,
|
||||
MessagePrecheckOutSerializer,
|
||||
} from "../models/messagePrecheckOut";
|
||||
import { MessagePoller } from "./messagePoller";
|
||||
import { HttpMethod, SvixRequest, type SvixRequestContext } from "../request";
|
||||
import { type MessageIn, MessageInSerializer } from "../models/messageIn";
|
||||
|
||||
export interface MessageListOptions {
|
||||
/** Limit the number of returned items */
|
||||
limit?: number;
|
||||
/** The iterator returned from a prior invocation */
|
||||
iterator?: string | null;
|
||||
/** Filter response based on the channel. */
|
||||
channel?: string;
|
||||
/** Only include items created before a certain date. */
|
||||
before?: Date | null;
|
||||
/** Only include items created after a certain date. */
|
||||
after?: Date | null;
|
||||
/** When `true` message payloads are included in the response. */
|
||||
withContent?: boolean;
|
||||
/** Filter messages matching the provided tag. */
|
||||
tag?: string;
|
||||
/** Filter response based on the event type */
|
||||
eventTypes?: string[];
|
||||
}
|
||||
|
||||
export interface MessageCreateOptions {
|
||||
/** When `true`, message payloads are included in the response. */
|
||||
withContent?: boolean;
|
||||
idempotencyKey?: string;
|
||||
}
|
||||
|
||||
export interface MessageExpungeAllContentsOptions {
|
||||
idempotencyKey?: string;
|
||||
}
|
||||
|
||||
export interface MessagePrecheckOptions {
|
||||
idempotencyKey?: string;
|
||||
}
|
||||
|
||||
export interface MessageGetOptions {
|
||||
/** When `true` message payloads are included in the response. */
|
||||
withContent?: boolean;
|
||||
}
|
||||
|
||||
export class Message {
|
||||
public constructor(private readonly requestCtx: SvixRequestContext) {}
|
||||
|
||||
public get poller() {
|
||||
return new MessagePoller(this.requestCtx);
|
||||
}
|
||||
|
||||
/**
|
||||
* List all of the application's messages.
|
||||
*
|
||||
* The `before` and `after` parameters let you filter all items created before or after a certain date. These can be
|
||||
* used alongside an iterator to paginate over results within a certain window.
|
||||
*
|
||||
* Note that by default this endpoint is limited to retrieving 90 days' worth of data
|
||||
* relative to now or, if an iterator is provided, 90 days before/after the time indicated
|
||||
* by the iterator ID. If you require data beyond those time ranges, you will need to explicitly
|
||||
* set the `before` or `after` parameter as appropriate.
|
||||
*/
|
||||
public list(
|
||||
appId: string,
|
||||
options?: MessageListOptions
|
||||
): Promise<ListResponseMessageOut> {
|
||||
const request = new SvixRequest(HttpMethod.GET, "/api/v1/app/{app_id}/msg");
|
||||
|
||||
request.setPathParam("app_id", appId);
|
||||
request.setQueryParams({
|
||||
limit: options?.limit,
|
||||
iterator: options?.iterator,
|
||||
channel: options?.channel,
|
||||
before: options?.before,
|
||||
after: options?.after,
|
||||
with_content: options?.withContent,
|
||||
tag: options?.tag,
|
||||
event_types: options?.eventTypes,
|
||||
});
|
||||
|
||||
return request.send(
|
||||
this.requestCtx,
|
||||
ListResponseMessageOutSerializer._fromJsonObject
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new message and dispatches it to all of the application's endpoints.
|
||||
*
|
||||
* The `eventId` is an optional custom unique ID. It's verified to be unique only up to a day, after that no verification will be made.
|
||||
* If a message with the same `eventId` already exists for the application, a 409 conflict error will be returned.
|
||||
*
|
||||
* The `eventType` indicates the type and schema of the event. All messages of a certain `eventType` are expected to have the same schema. Endpoints can choose to only listen to specific event types.
|
||||
* Messages can also have `channels`, which similar to event types let endpoints filter by them. Unlike event types, messages can have multiple channels, and channels don't imply a specific message content or schema.
|
||||
*
|
||||
* The `payload` property is the webhook's body (the actual webhook message). Svix supports payload sizes of up to 1MiB, though it's generally a good idea to keep webhook payloads small, probably no larger than 40kb.
|
||||
*/
|
||||
public create(
|
||||
appId: string,
|
||||
messageIn: MessageIn,
|
||||
options?: MessageCreateOptions
|
||||
): Promise<MessageOut> {
|
||||
const request = new SvixRequest(HttpMethod.POST, "/api/v1/app/{app_id}/msg");
|
||||
|
||||
request.setPathParam("app_id", appId);
|
||||
request.setQueryParams({
|
||||
with_content: options?.withContent,
|
||||
});
|
||||
request.setHeaderParam("idempotency-key", options?.idempotencyKey);
|
||||
request.setBody(MessageInSerializer._toJsonObject(messageIn));
|
||||
|
||||
return request.send(this.requestCtx, MessageOutSerializer._fromJsonObject);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete all message payloads for the application.
|
||||
*
|
||||
* This operation is only available in the <a href="https://svix.com/pricing" target="_blank">Enterprise</a> plan.
|
||||
*
|
||||
* A completed task will return a payload like the following:
|
||||
* ```json
|
||||
* {
|
||||
* "id": "qtask_33qen93MNuelBAq1T9G7eHLJRsF",
|
||||
* "status": "finished",
|
||||
* "task": "application.purge_content",
|
||||
* "data": {
|
||||
* "messagesPurged": 150
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
public expungeAllContents(
|
||||
appId: string,
|
||||
options?: MessageExpungeAllContentsOptions
|
||||
): Promise<ExpungeAllContentsOut> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.POST,
|
||||
"/api/v1/app/{app_id}/msg/expunge-all-contents"
|
||||
);
|
||||
|
||||
request.setPathParam("app_id", appId);
|
||||
request.setHeaderParam("idempotency-key", options?.idempotencyKey);
|
||||
|
||||
return request.send(this.requestCtx, ExpungeAllContentsOutSerializer._fromJsonObject);
|
||||
}
|
||||
|
||||
/**
|
||||
* A pre-check call for `message.create` that checks whether any active endpoints are
|
||||
* listening to this message.
|
||||
*
|
||||
* Note: most people shouldn't be using this API. Svix doesn't bill you for
|
||||
* messages not actually sent, so using this API doesn't save money.
|
||||
* If unsure, please ask Svix support before using this API.
|
||||
*/
|
||||
public precheck(
|
||||
appId: string,
|
||||
messagePrecheckIn: MessagePrecheckIn,
|
||||
options?: MessagePrecheckOptions
|
||||
): Promise<MessagePrecheckOut> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.POST,
|
||||
"/api/v1/app/{app_id}/msg/precheck/active"
|
||||
);
|
||||
|
||||
request.setPathParam("app_id", appId);
|
||||
request.setHeaderParam("idempotency-key", options?.idempotencyKey);
|
||||
request.setBody(MessagePrecheckInSerializer._toJsonObject(messagePrecheckIn));
|
||||
|
||||
return request.send(this.requestCtx, MessagePrecheckOutSerializer._fromJsonObject);
|
||||
}
|
||||
|
||||
/** Get a message by its ID or eventID. */
|
||||
public get(
|
||||
appId: string,
|
||||
msgId: string,
|
||||
options?: MessageGetOptions
|
||||
): Promise<MessageOut> {
|
||||
const request = new SvixRequest(HttpMethod.GET, "/api/v1/app/{app_id}/msg/{msg_id}");
|
||||
|
||||
request.setPathParam("app_id", appId);
|
||||
request.setPathParam("msg_id", msgId);
|
||||
request.setQueryParams({
|
||||
with_content: options?.withContent,
|
||||
});
|
||||
|
||||
return request.send(this.requestCtx, MessageOutSerializer._fromJsonObject);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete the given message's payload.
|
||||
*
|
||||
* Useful in cases when a message was accidentally sent with sensitive content.
|
||||
* The message can't be replayed or resent once its payload has been deleted or expired.
|
||||
*/
|
||||
public expungeContent(appId: string, msgId: string): Promise<void> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.DELETE,
|
||||
"/api/v1/app/{app_id}/msg/{msg_id}/content"
|
||||
);
|
||||
|
||||
request.setPathParam("app_id", appId);
|
||||
request.setPathParam("msg_id", msgId);
|
||||
|
||||
return request.sendNoResponseBody(this.requestCtx);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a `MessageIn` with a raw string payload.
|
||||
*
|
||||
* The payload is not normalized on the server. Normally, payloads are
|
||||
* required to be JSON, and Svix will minify the payload before sending the
|
||||
* webhooks (for example, by removing extraneous whitespace or unnecessarily
|
||||
* escaped characters in strings). With this function, the payload will be
|
||||
* sent "as is", without any minification or other processing.
|
||||
*
|
||||
* @param payload Serialized message payload
|
||||
* @param contentType The value to use for the Content-Type header of the webhook sent by Svix, overwriting the default of `application/json` if specified
|
||||
*
|
||||
* See the class documentation for details about the other parameters.
|
||||
*/
|
||||
export function messageInRaw(
|
||||
eventType: string,
|
||||
payload: string,
|
||||
contentType?: string
|
||||
): MessageIn {
|
||||
const headers = contentType ? { "content-type": contentType } : undefined;
|
||||
|
||||
return {
|
||||
eventType,
|
||||
payload: {},
|
||||
transformationsParams: {
|
||||
rawPayload: payload,
|
||||
headers,
|
||||
},
|
||||
};
|
||||
}
|
||||
314
node_modules/svix/src/api/messageAttempt.ts
generated
vendored
Normal file
314
node_modules/svix/src/api/messageAttempt.ts
generated
vendored
Normal file
@@ -0,0 +1,314 @@
|
||||
// this file is @generated
|
||||
|
||||
import { type EmptyResponse, EmptyResponseSerializer } from "../models/emptyResponse";
|
||||
import {
|
||||
type ListResponseEndpointMessageOut,
|
||||
ListResponseEndpointMessageOutSerializer,
|
||||
} from "../models/listResponseEndpointMessageOut";
|
||||
import {
|
||||
type ListResponseMessageAttemptOut,
|
||||
ListResponseMessageAttemptOutSerializer,
|
||||
} from "../models/listResponseMessageAttemptOut";
|
||||
import {
|
||||
type ListResponseMessageEndpointOut,
|
||||
ListResponseMessageEndpointOutSerializer,
|
||||
} from "../models/listResponseMessageEndpointOut";
|
||||
import {
|
||||
type MessageAttemptOut,
|
||||
MessageAttemptOutSerializer,
|
||||
} from "../models/messageAttemptOut";
|
||||
import type { MessageStatus } from "../models/messageStatus";
|
||||
import type { StatusCodeClass } from "../models/statusCodeClass";
|
||||
import { HttpMethod, SvixRequest, type SvixRequestContext } from "../request";
|
||||
|
||||
export interface MessageAttemptListByEndpointOptions {
|
||||
/** Limit the number of returned items */
|
||||
limit?: number;
|
||||
/** The iterator returned from a prior invocation */
|
||||
iterator?: string | null;
|
||||
/** Filter response based on the status of the attempt: Success (0), Pending (1), Failed (2), or Sending (3) */
|
||||
status?: MessageStatus;
|
||||
/** Filter response based on the HTTP status code */
|
||||
statusCodeClass?: StatusCodeClass;
|
||||
/** Filter response based on the channel */
|
||||
channel?: string;
|
||||
/** Filter response based on the tag */
|
||||
tag?: string;
|
||||
/** Only include items created before a certain date */
|
||||
before?: Date | null;
|
||||
/** Only include items created after a certain date */
|
||||
after?: Date | null;
|
||||
/** When `true` attempt content is included in the response */
|
||||
withContent?: boolean;
|
||||
/** When `true`, the message information is included in the response */
|
||||
withMsg?: boolean;
|
||||
/** Filter response based on the event type */
|
||||
eventTypes?: string[];
|
||||
}
|
||||
|
||||
export interface MessageAttemptListByMsgOptions {
|
||||
/** Limit the number of returned items */
|
||||
limit?: number;
|
||||
/** The iterator returned from a prior invocation */
|
||||
iterator?: string | null;
|
||||
/** Filter response based on the status of the attempt: Success (0), Pending (1), Failed (2), or Sending (3) */
|
||||
status?: MessageStatus;
|
||||
/** Filter response based on the HTTP status code */
|
||||
statusCodeClass?: StatusCodeClass;
|
||||
/** Filter response based on the channel */
|
||||
channel?: string;
|
||||
/** Filter response based on the tag */
|
||||
tag?: string;
|
||||
/** Filter the attempts based on the attempted endpoint */
|
||||
endpointId?: string;
|
||||
/** Only include items created before a certain date */
|
||||
before?: Date | null;
|
||||
/** Only include items created after a certain date */
|
||||
after?: Date | null;
|
||||
/** When `true` attempt content is included in the response */
|
||||
withContent?: boolean;
|
||||
/** Filter response based on the event type */
|
||||
eventTypes?: string[];
|
||||
}
|
||||
|
||||
export interface MessageAttemptListAttemptedMessagesOptions {
|
||||
/** Limit the number of returned items */
|
||||
limit?: number;
|
||||
/** The iterator returned from a prior invocation */
|
||||
iterator?: string | null;
|
||||
/** Filter response based on the channel */
|
||||
channel?: string;
|
||||
/** Filter response based on the message tags */
|
||||
tag?: string;
|
||||
/** Filter response based on the status of the attempt: Success (0), Pending (1), Failed (2), or Sending (3) */
|
||||
status?: MessageStatus;
|
||||
/** Only include items created before a certain date */
|
||||
before?: Date | null;
|
||||
/** Only include items created after a certain date */
|
||||
after?: Date | null;
|
||||
/** When `true` message payloads are included in the response */
|
||||
withContent?: boolean;
|
||||
/** Filter response based on the event type */
|
||||
eventTypes?: string[];
|
||||
}
|
||||
|
||||
export interface MessageAttemptListAttemptedDestinationsOptions {
|
||||
/** Limit the number of returned items */
|
||||
limit?: number;
|
||||
/** The iterator returned from a prior invocation */
|
||||
iterator?: string | null;
|
||||
}
|
||||
|
||||
export interface MessageAttemptResendOptions {
|
||||
idempotencyKey?: string;
|
||||
}
|
||||
|
||||
export class MessageAttempt {
|
||||
public constructor(private readonly requestCtx: SvixRequestContext) {}
|
||||
|
||||
/**
|
||||
* List attempts by endpoint id
|
||||
*
|
||||
* Note that by default this endpoint is limited to retrieving 90 days' worth of data
|
||||
* relative to now or, if an iterator is provided, 90 days before/after the time indicated
|
||||
* by the iterator ID. If you require data beyond those time ranges, you will need to explicitly
|
||||
* set the `before` or `after` parameter as appropriate.
|
||||
*/
|
||||
public listByEndpoint(
|
||||
appId: string,
|
||||
endpointId: string,
|
||||
options?: MessageAttemptListByEndpointOptions
|
||||
): Promise<ListResponseMessageAttemptOut> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.GET,
|
||||
"/api/v1/app/{app_id}/attempt/endpoint/{endpoint_id}"
|
||||
);
|
||||
|
||||
request.setPathParam("app_id", appId);
|
||||
request.setPathParam("endpoint_id", endpointId);
|
||||
request.setQueryParams({
|
||||
limit: options?.limit,
|
||||
iterator: options?.iterator,
|
||||
status: options?.status,
|
||||
status_code_class: options?.statusCodeClass,
|
||||
channel: options?.channel,
|
||||
tag: options?.tag,
|
||||
before: options?.before,
|
||||
after: options?.after,
|
||||
with_content: options?.withContent,
|
||||
with_msg: options?.withMsg,
|
||||
event_types: options?.eventTypes,
|
||||
});
|
||||
|
||||
return request.send(
|
||||
this.requestCtx,
|
||||
ListResponseMessageAttemptOutSerializer._fromJsonObject
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* List attempts by message ID.
|
||||
*
|
||||
* Note that by default this endpoint is limited to retrieving 90 days' worth of data
|
||||
* relative to now or, if an iterator is provided, 90 days before/after the time indicated
|
||||
* by the iterator ID. If you require data beyond those time ranges, you will need to explicitly
|
||||
* set the `before` or `after` parameter as appropriate.
|
||||
*/
|
||||
public listByMsg(
|
||||
appId: string,
|
||||
msgId: string,
|
||||
options?: MessageAttemptListByMsgOptions
|
||||
): Promise<ListResponseMessageAttemptOut> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.GET,
|
||||
"/api/v1/app/{app_id}/attempt/msg/{msg_id}"
|
||||
);
|
||||
|
||||
request.setPathParam("app_id", appId);
|
||||
request.setPathParam("msg_id", msgId);
|
||||
request.setQueryParams({
|
||||
limit: options?.limit,
|
||||
iterator: options?.iterator,
|
||||
status: options?.status,
|
||||
status_code_class: options?.statusCodeClass,
|
||||
channel: options?.channel,
|
||||
tag: options?.tag,
|
||||
endpoint_id: options?.endpointId,
|
||||
before: options?.before,
|
||||
after: options?.after,
|
||||
with_content: options?.withContent,
|
||||
event_types: options?.eventTypes,
|
||||
});
|
||||
|
||||
return request.send(
|
||||
this.requestCtx,
|
||||
ListResponseMessageAttemptOutSerializer._fromJsonObject
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* List messages for a particular endpoint. Additionally includes metadata about the latest message attempt.
|
||||
*
|
||||
* The `before` parameter lets you filter all items created before a certain date and is ignored if an iterator is passed.
|
||||
*
|
||||
* Note that by default this endpoint is limited to retrieving 90 days' worth of data
|
||||
* relative to now or, if an iterator is provided, 90 days before/after the time indicated
|
||||
* by the iterator ID. If you require data beyond those time ranges, you will need to explicitly
|
||||
* set the `before` or `after` parameter as appropriate.
|
||||
*/
|
||||
public listAttemptedMessages(
|
||||
appId: string,
|
||||
endpointId: string,
|
||||
options?: MessageAttemptListAttemptedMessagesOptions
|
||||
): Promise<ListResponseEndpointMessageOut> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.GET,
|
||||
"/api/v1/app/{app_id}/endpoint/{endpoint_id}/msg"
|
||||
);
|
||||
|
||||
request.setPathParam("app_id", appId);
|
||||
request.setPathParam("endpoint_id", endpointId);
|
||||
request.setQueryParams({
|
||||
limit: options?.limit,
|
||||
iterator: options?.iterator,
|
||||
channel: options?.channel,
|
||||
tag: options?.tag,
|
||||
status: options?.status,
|
||||
before: options?.before,
|
||||
after: options?.after,
|
||||
with_content: options?.withContent,
|
||||
event_types: options?.eventTypes,
|
||||
});
|
||||
|
||||
return request.send(
|
||||
this.requestCtx,
|
||||
ListResponseEndpointMessageOutSerializer._fromJsonObject
|
||||
);
|
||||
}
|
||||
|
||||
/** `msg_id`: Use a message id or a message `eventId` */
|
||||
public get(
|
||||
appId: string,
|
||||
msgId: string,
|
||||
attemptId: string
|
||||
): Promise<MessageAttemptOut> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.GET,
|
||||
"/api/v1/app/{app_id}/msg/{msg_id}/attempt/{attempt_id}"
|
||||
);
|
||||
|
||||
request.setPathParam("app_id", appId);
|
||||
request.setPathParam("msg_id", msgId);
|
||||
request.setPathParam("attempt_id", attemptId);
|
||||
|
||||
return request.send(this.requestCtx, MessageAttemptOutSerializer._fromJsonObject);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes the given attempt's response body.
|
||||
*
|
||||
* Useful when an endpoint accidentally returned sensitive content.
|
||||
* The message can't be replayed or resent once its payload has been deleted or expired.
|
||||
*/
|
||||
public expungeContent(appId: string, msgId: string, attemptId: string): Promise<void> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.DELETE,
|
||||
"/api/v1/app/{app_id}/msg/{msg_id}/attempt/{attempt_id}/content"
|
||||
);
|
||||
|
||||
request.setPathParam("app_id", appId);
|
||||
request.setPathParam("msg_id", msgId);
|
||||
request.setPathParam("attempt_id", attemptId);
|
||||
|
||||
return request.sendNoResponseBody(this.requestCtx);
|
||||
}
|
||||
|
||||
/**
|
||||
* List endpoints attempted by a given message.
|
||||
*
|
||||
* Additionally includes metadata about the latest message attempt.
|
||||
* By default, endpoints are listed in ascending order by ID.
|
||||
*/
|
||||
public listAttemptedDestinations(
|
||||
appId: string,
|
||||
msgId: string,
|
||||
options?: MessageAttemptListAttemptedDestinationsOptions
|
||||
): Promise<ListResponseMessageEndpointOut> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.GET,
|
||||
"/api/v1/app/{app_id}/msg/{msg_id}/endpoint"
|
||||
);
|
||||
|
||||
request.setPathParam("app_id", appId);
|
||||
request.setPathParam("msg_id", msgId);
|
||||
request.setQueryParams({
|
||||
limit: options?.limit,
|
||||
iterator: options?.iterator,
|
||||
});
|
||||
|
||||
return request.send(
|
||||
this.requestCtx,
|
||||
ListResponseMessageEndpointOutSerializer._fromJsonObject
|
||||
);
|
||||
}
|
||||
|
||||
/** Resend a message to the specified endpoint. */
|
||||
public resend(
|
||||
appId: string,
|
||||
msgId: string,
|
||||
endpointId: string,
|
||||
options?: MessageAttemptResendOptions
|
||||
): Promise<EmptyResponse> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.POST,
|
||||
"/api/v1/app/{app_id}/msg/{msg_id}/endpoint/{endpoint_id}/resend"
|
||||
);
|
||||
|
||||
request.setPathParam("app_id", appId);
|
||||
request.setPathParam("msg_id", msgId);
|
||||
request.setPathParam("endpoint_id", endpointId);
|
||||
request.setHeaderParam("idempotency-key", options?.idempotencyKey);
|
||||
|
||||
return request.send(this.requestCtx, EmptyResponseSerializer._fromJsonObject);
|
||||
}
|
||||
}
|
||||
119
node_modules/svix/src/api/messagePoller.ts
generated
vendored
Normal file
119
node_modules/svix/src/api/messagePoller.ts
generated
vendored
Normal file
@@ -0,0 +1,119 @@
|
||||
// this file is @generated
|
||||
|
||||
import {
|
||||
type PollingEndpointConsumerSeekIn,
|
||||
PollingEndpointConsumerSeekInSerializer,
|
||||
} from "../models/pollingEndpointConsumerSeekIn";
|
||||
import {
|
||||
type PollingEndpointConsumerSeekOut,
|
||||
PollingEndpointConsumerSeekOutSerializer,
|
||||
} from "../models/pollingEndpointConsumerSeekOut";
|
||||
import {
|
||||
type PollingEndpointOut,
|
||||
PollingEndpointOutSerializer,
|
||||
} from "../models/pollingEndpointOut";
|
||||
import { HttpMethod, SvixRequest, type SvixRequestContext } from "../request";
|
||||
|
||||
export interface MessagePollerPollOptions {
|
||||
/** Limit the number of returned items */
|
||||
limit?: number;
|
||||
/** The iterator returned from a prior invocation */
|
||||
iterator?: string | null;
|
||||
/** Filters messages sent with this event type (optional). */
|
||||
eventType?: string;
|
||||
/** Filters messages sent with this channel (optional). */
|
||||
channel?: string;
|
||||
after?: Date | null;
|
||||
}
|
||||
|
||||
export interface MessagePollerConsumerPollOptions {
|
||||
/** Limit the number of returned items */
|
||||
limit?: number;
|
||||
/** The iterator returned from a prior invocation */
|
||||
iterator?: string | null;
|
||||
}
|
||||
|
||||
export interface MessagePollerConsumerSeekOptions {
|
||||
idempotencyKey?: string;
|
||||
}
|
||||
|
||||
export class MessagePoller {
|
||||
public constructor(private readonly requestCtx: SvixRequestContext) {}
|
||||
|
||||
/** Reads the stream of created messages for an application, filtered on the Sink's event types and Channels. */
|
||||
public poll(
|
||||
appId: string,
|
||||
sinkId: string,
|
||||
options?: MessagePollerPollOptions
|
||||
): Promise<PollingEndpointOut> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.GET,
|
||||
"/api/v1/app/{app_id}/poller/{sink_id}"
|
||||
);
|
||||
|
||||
request.setPathParam("app_id", appId);
|
||||
request.setPathParam("sink_id", sinkId);
|
||||
request.setQueryParams({
|
||||
limit: options?.limit,
|
||||
iterator: options?.iterator,
|
||||
event_type: options?.eventType,
|
||||
channel: options?.channel,
|
||||
after: options?.after,
|
||||
});
|
||||
|
||||
return request.send(this.requestCtx, PollingEndpointOutSerializer._fromJsonObject);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads the stream of created messages for an application, filtered on the Sink's event types and
|
||||
* Channels, using server-managed iterator tracking.
|
||||
*/
|
||||
public consumerPoll(
|
||||
appId: string,
|
||||
sinkId: string,
|
||||
consumerId: string,
|
||||
options?: MessagePollerConsumerPollOptions
|
||||
): Promise<PollingEndpointOut> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.GET,
|
||||
"/api/v1/app/{app_id}/poller/{sink_id}/consumer/{consumer_id}"
|
||||
);
|
||||
|
||||
request.setPathParam("app_id", appId);
|
||||
request.setPathParam("sink_id", sinkId);
|
||||
request.setPathParam("consumer_id", consumerId);
|
||||
request.setQueryParams({
|
||||
limit: options?.limit,
|
||||
iterator: options?.iterator,
|
||||
});
|
||||
|
||||
return request.send(this.requestCtx, PollingEndpointOutSerializer._fromJsonObject);
|
||||
}
|
||||
|
||||
/** Sets the starting offset for the consumer of a polling endpoint. */
|
||||
public consumerSeek(
|
||||
appId: string,
|
||||
sinkId: string,
|
||||
consumerId: string,
|
||||
pollingEndpointConsumerSeekIn: PollingEndpointConsumerSeekIn,
|
||||
options?: MessagePollerConsumerSeekOptions
|
||||
): Promise<PollingEndpointConsumerSeekOut> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.POST,
|
||||
"/api/v1/app/{app_id}/poller/{sink_id}/consumer/{consumer_id}/seek"
|
||||
);
|
||||
|
||||
request.setPathParam("app_id", appId);
|
||||
request.setPathParam("sink_id", sinkId);
|
||||
request.setPathParam("consumer_id", consumerId);
|
||||
request.setHeaderParam("idempotency-key", options?.idempotencyKey);
|
||||
request.setBody(
|
||||
PollingEndpointConsumerSeekInSerializer._toJsonObject(pollingEndpointConsumerSeekIn)
|
||||
);
|
||||
|
||||
return request.send(
|
||||
this.requestCtx,
|
||||
PollingEndpointConsumerSeekOutSerializer._fromJsonObject
|
||||
);
|
||||
}
|
||||
}
|
||||
12
node_modules/svix/src/api/operationalWebhook.ts
generated
vendored
Normal file
12
node_modules/svix/src/api/operationalWebhook.ts
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
// this file is @generated
|
||||
|
||||
import { OperationalWebhookEndpoint } from "./operationalWebhookEndpoint";
|
||||
import type { SvixRequestContext } from "../request";
|
||||
|
||||
export class OperationalWebhook {
|
||||
public constructor(private readonly requestCtx: SvixRequestContext) {}
|
||||
|
||||
public get endpoint() {
|
||||
return new OperationalWebhookEndpoint(this.requestCtx);
|
||||
}
|
||||
}
|
||||
230
node_modules/svix/src/api/operationalWebhookEndpoint.ts
generated
vendored
Normal file
230
node_modules/svix/src/api/operationalWebhookEndpoint.ts
generated
vendored
Normal file
@@ -0,0 +1,230 @@
|
||||
// this file is @generated
|
||||
|
||||
import {
|
||||
type ListResponseOperationalWebhookEndpointOut,
|
||||
ListResponseOperationalWebhookEndpointOutSerializer,
|
||||
} from "../models/listResponseOperationalWebhookEndpointOut";
|
||||
import {
|
||||
type OperationalWebhookEndpointHeadersIn,
|
||||
OperationalWebhookEndpointHeadersInSerializer,
|
||||
} from "../models/operationalWebhookEndpointHeadersIn";
|
||||
import {
|
||||
type OperationalWebhookEndpointHeadersOut,
|
||||
OperationalWebhookEndpointHeadersOutSerializer,
|
||||
} from "../models/operationalWebhookEndpointHeadersOut";
|
||||
import {
|
||||
type OperationalWebhookEndpointIn,
|
||||
OperationalWebhookEndpointInSerializer,
|
||||
} from "../models/operationalWebhookEndpointIn";
|
||||
import {
|
||||
type OperationalWebhookEndpointOut,
|
||||
OperationalWebhookEndpointOutSerializer,
|
||||
} from "../models/operationalWebhookEndpointOut";
|
||||
import {
|
||||
type OperationalWebhookEndpointSecretIn,
|
||||
OperationalWebhookEndpointSecretInSerializer,
|
||||
} from "../models/operationalWebhookEndpointSecretIn";
|
||||
import {
|
||||
type OperationalWebhookEndpointSecretOut,
|
||||
OperationalWebhookEndpointSecretOutSerializer,
|
||||
} from "../models/operationalWebhookEndpointSecretOut";
|
||||
import {
|
||||
type OperationalWebhookEndpointUpdate,
|
||||
OperationalWebhookEndpointUpdateSerializer,
|
||||
} from "../models/operationalWebhookEndpointUpdate";
|
||||
import type { Ordering } from "../models/ordering";
|
||||
import { HttpMethod, SvixRequest, type SvixRequestContext } from "../request";
|
||||
|
||||
export interface OperationalWebhookEndpointListOptions {
|
||||
/** 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 interface OperationalWebhookEndpointCreateOptions {
|
||||
idempotencyKey?: string;
|
||||
}
|
||||
|
||||
export interface OperationalWebhookEndpointRotateSecretOptions {
|
||||
idempotencyKey?: string;
|
||||
}
|
||||
|
||||
export class OperationalWebhookEndpoint {
|
||||
public constructor(private readonly requestCtx: SvixRequestContext) {}
|
||||
|
||||
/** List operational webhook endpoints. */
|
||||
public list(
|
||||
options?: OperationalWebhookEndpointListOptions
|
||||
): Promise<ListResponseOperationalWebhookEndpointOut> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.GET,
|
||||
"/api/v1/operational-webhook/endpoint"
|
||||
);
|
||||
|
||||
request.setQueryParams({
|
||||
limit: options?.limit,
|
||||
iterator: options?.iterator,
|
||||
order: options?.order,
|
||||
});
|
||||
|
||||
return request.send(
|
||||
this.requestCtx,
|
||||
ListResponseOperationalWebhookEndpointOutSerializer._fromJsonObject
|
||||
);
|
||||
}
|
||||
|
||||
/** Create an operational webhook endpoint. */
|
||||
public create(
|
||||
operationalWebhookEndpointIn: OperationalWebhookEndpointIn,
|
||||
options?: OperationalWebhookEndpointCreateOptions
|
||||
): Promise<OperationalWebhookEndpointOut> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.POST,
|
||||
"/api/v1/operational-webhook/endpoint"
|
||||
);
|
||||
|
||||
request.setHeaderParam("idempotency-key", options?.idempotencyKey);
|
||||
request.setBody(
|
||||
OperationalWebhookEndpointInSerializer._toJsonObject(operationalWebhookEndpointIn)
|
||||
);
|
||||
|
||||
return request.send(
|
||||
this.requestCtx,
|
||||
OperationalWebhookEndpointOutSerializer._fromJsonObject
|
||||
);
|
||||
}
|
||||
|
||||
/** Get an operational webhook endpoint. */
|
||||
public get(endpointId: string): Promise<OperationalWebhookEndpointOut> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.GET,
|
||||
"/api/v1/operational-webhook/endpoint/{endpoint_id}"
|
||||
);
|
||||
|
||||
request.setPathParam("endpoint_id", endpointId);
|
||||
|
||||
return request.send(
|
||||
this.requestCtx,
|
||||
OperationalWebhookEndpointOutSerializer._fromJsonObject
|
||||
);
|
||||
}
|
||||
|
||||
/** Update an operational webhook endpoint. */
|
||||
public update(
|
||||
endpointId: string,
|
||||
operationalWebhookEndpointUpdate: OperationalWebhookEndpointUpdate
|
||||
): Promise<OperationalWebhookEndpointOut> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.PUT,
|
||||
"/api/v1/operational-webhook/endpoint/{endpoint_id}"
|
||||
);
|
||||
|
||||
request.setPathParam("endpoint_id", endpointId);
|
||||
request.setBody(
|
||||
OperationalWebhookEndpointUpdateSerializer._toJsonObject(
|
||||
operationalWebhookEndpointUpdate
|
||||
)
|
||||
);
|
||||
|
||||
return request.send(
|
||||
this.requestCtx,
|
||||
OperationalWebhookEndpointOutSerializer._fromJsonObject
|
||||
);
|
||||
}
|
||||
|
||||
/** Delete an operational webhook endpoint. */
|
||||
public delete(endpointId: string): Promise<void> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.DELETE,
|
||||
"/api/v1/operational-webhook/endpoint/{endpoint_id}"
|
||||
);
|
||||
|
||||
request.setPathParam("endpoint_id", endpointId);
|
||||
|
||||
return request.sendNoResponseBody(this.requestCtx);
|
||||
}
|
||||
|
||||
/** Get the additional headers to be sent with the operational webhook. */
|
||||
public getHeaders(endpointId: string): Promise<OperationalWebhookEndpointHeadersOut> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.GET,
|
||||
"/api/v1/operational-webhook/endpoint/{endpoint_id}/headers"
|
||||
);
|
||||
|
||||
request.setPathParam("endpoint_id", endpointId);
|
||||
|
||||
return request.send(
|
||||
this.requestCtx,
|
||||
OperationalWebhookEndpointHeadersOutSerializer._fromJsonObject
|
||||
);
|
||||
}
|
||||
|
||||
/** Set the additional headers to be sent with the operational webhook. */
|
||||
public updateHeaders(
|
||||
endpointId: string,
|
||||
operationalWebhookEndpointHeadersIn: OperationalWebhookEndpointHeadersIn
|
||||
): Promise<void> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.PUT,
|
||||
"/api/v1/operational-webhook/endpoint/{endpoint_id}/headers"
|
||||
);
|
||||
|
||||
request.setPathParam("endpoint_id", endpointId);
|
||||
request.setBody(
|
||||
OperationalWebhookEndpointHeadersInSerializer._toJsonObject(
|
||||
operationalWebhookEndpointHeadersIn
|
||||
)
|
||||
);
|
||||
|
||||
return request.sendNoResponseBody(this.requestCtx);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.GET,
|
||||
"/api/v1/operational-webhook/endpoint/{endpoint_id}/secret"
|
||||
);
|
||||
|
||||
request.setPathParam("endpoint_id", endpointId);
|
||||
|
||||
return request.send(
|
||||
this.requestCtx,
|
||||
OperationalWebhookEndpointSecretOutSerializer._fromJsonObject
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Rotates an operational webhook endpoint's signing secret.
|
||||
*
|
||||
* The previous secret will remain valid for the next 24 hours.
|
||||
*/
|
||||
public rotateSecret(
|
||||
endpointId: string,
|
||||
operationalWebhookEndpointSecretIn: OperationalWebhookEndpointSecretIn,
|
||||
options?: OperationalWebhookEndpointRotateSecretOptions
|
||||
): Promise<void> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.POST,
|
||||
"/api/v1/operational-webhook/endpoint/{endpoint_id}/secret/rotate"
|
||||
);
|
||||
|
||||
request.setPathParam("endpoint_id", endpointId);
|
||||
request.setHeaderParam("idempotency-key", options?.idempotencyKey);
|
||||
request.setBody(
|
||||
OperationalWebhookEndpointSecretInSerializer._toJsonObject(
|
||||
operationalWebhookEndpointSecretIn
|
||||
)
|
||||
);
|
||||
|
||||
return request.sendNoResponseBody(this.requestCtx);
|
||||
}
|
||||
}
|
||||
92
node_modules/svix/src/api/statistics.ts
generated
vendored
Normal file
92
node_modules/svix/src/api/statistics.ts
generated
vendored
Normal file
@@ -0,0 +1,92 @@
|
||||
// this file is @generated
|
||||
|
||||
import {
|
||||
type AggregateEventTypesOut,
|
||||
AggregateEventTypesOutSerializer,
|
||||
} from "../models/aggregateEventTypesOut";
|
||||
import {
|
||||
type AppUsageStatsIn,
|
||||
AppUsageStatsInSerializer,
|
||||
} from "../models/appUsageStatsIn";
|
||||
import {
|
||||
type AppUsageStatsOut,
|
||||
AppUsageStatsOutSerializer,
|
||||
} from "../models/appUsageStatsOut";
|
||||
import { HttpMethod, SvixRequest, type SvixRequestContext } from "../request";
|
||||
|
||||
export interface StatisticsAggregateAppStatsOptions {
|
||||
idempotencyKey?: string;
|
||||
}
|
||||
|
||||
export class Statistics {
|
||||
public constructor(private readonly requestCtx: SvixRequestContext) {}
|
||||
|
||||
/**
|
||||
* Creates a background task to calculate the number of message attempts (`messageDestinations`) made for all applications in the environment.
|
||||
*
|
||||
* Note that this endpoint is asynchronous. You will need to poll the `Get Background Task` endpoint to
|
||||
* retrieve the results of the operation.
|
||||
*
|
||||
* The completed background task will return a payload like the following:
|
||||
* ```json
|
||||
* {
|
||||
* "id": "qtask_33qe39Stble9Rn3ZxFrqL5ZSsjT",
|
||||
* "status": "finished",
|
||||
* "task": "application.stats",
|
||||
* "data": {
|
||||
* "appStats": [
|
||||
* {
|
||||
* "messageDestinations": 2,
|
||||
* "appId": "app_33W1An2Zz5cO9SWbhHsYyDmVC6m",
|
||||
* "appUid": null
|
||||
* }
|
||||
* ]
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
public aggregateAppStats(
|
||||
appUsageStatsIn: AppUsageStatsIn,
|
||||
options?: StatisticsAggregateAppStatsOptions
|
||||
): Promise<AppUsageStatsOut> {
|
||||
const request = new SvixRequest(HttpMethod.POST, "/api/v1/stats/usage/app");
|
||||
|
||||
request.setHeaderParam("idempotency-key", options?.idempotencyKey);
|
||||
request.setBody(AppUsageStatsInSerializer._toJsonObject(appUsageStatsIn));
|
||||
|
||||
return request.send(this.requestCtx, AppUsageStatsOutSerializer._fromJsonObject);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a background task to calculate the listed event types for all apps in the organization.
|
||||
*
|
||||
* Note that this endpoint is asynchronous. You will need to poll the `Get Background Task` endpoint to
|
||||
* retrieve the results of the operation.
|
||||
*
|
||||
* The completed background task will return a payload like the following:
|
||||
* ```json
|
||||
* {
|
||||
* "id": "qtask_33qe39Stble9Rn3ZxFrqL5ZSsjT",
|
||||
* "status": "finished",
|
||||
* "task": "event-type.aggregate",
|
||||
* "data": {
|
||||
* "event_types": [
|
||||
* {
|
||||
* "appId": "app_33W1An2Zz5cO9SWbhHsYyDmVC6m",
|
||||
* "explicitlySubscribedEventTypes": ["user.signup", "user.deleted"],
|
||||
* "hasCatchAllEndpoint": false
|
||||
* }
|
||||
* ]
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
public aggregateEventTypes(): Promise<AggregateEventTypesOut> {
|
||||
const request = new SvixRequest(HttpMethod.PUT, "/api/v1/stats/usage/event-types");
|
||||
|
||||
return request.send(
|
||||
this.requestCtx,
|
||||
AggregateEventTypesOutSerializer._fromJsonObject
|
||||
);
|
||||
}
|
||||
}
|
||||
88
node_modules/svix/src/api/streaming.ts
generated
vendored
Normal file
88
node_modules/svix/src/api/streaming.ts
generated
vendored
Normal file
@@ -0,0 +1,88 @@
|
||||
// this file is @generated
|
||||
|
||||
import {
|
||||
type EndpointHeadersOut,
|
||||
EndpointHeadersOutSerializer,
|
||||
} from "../models/endpointHeadersOut";
|
||||
import {
|
||||
type HttpSinkHeadersPatchIn,
|
||||
HttpSinkHeadersPatchInSerializer,
|
||||
} from "../models/httpSinkHeadersPatchIn";
|
||||
import {
|
||||
type SinkTransformationOut,
|
||||
SinkTransformationOutSerializer,
|
||||
} from "../models/sinkTransformationOut";
|
||||
import { StreamingEventType } from "./streamingEventType";
|
||||
import { StreamingEvents } from "./streamingEvents";
|
||||
import { StreamingSink } from "./streamingSink";
|
||||
import { StreamingStream } from "./streamingStream";
|
||||
import { HttpMethod, SvixRequest, type SvixRequestContext } from "../request";
|
||||
|
||||
export class Streaming {
|
||||
public constructor(private readonly requestCtx: SvixRequestContext) {}
|
||||
|
||||
public get event_type() {
|
||||
return new StreamingEventType(this.requestCtx);
|
||||
}
|
||||
|
||||
public get events() {
|
||||
return new StreamingEvents(this.requestCtx);
|
||||
}
|
||||
|
||||
public get sink() {
|
||||
return new StreamingSink(this.requestCtx);
|
||||
}
|
||||
|
||||
public get stream() {
|
||||
return new StreamingStream(this.requestCtx);
|
||||
}
|
||||
|
||||
/** Get the HTTP sink headers. Only valid for `http` or `otelTracing` sinks. */
|
||||
public sinkHeadersGet(streamId: string, sinkId: string): Promise<EndpointHeadersOut> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.GET,
|
||||
"/api/v1/stream/{stream_id}/sink/{sink_id}/headers"
|
||||
);
|
||||
|
||||
request.setPathParam("stream_id", streamId);
|
||||
request.setPathParam("sink_id", sinkId);
|
||||
|
||||
return request.send(this.requestCtx, EndpointHeadersOutSerializer._fromJsonObject);
|
||||
}
|
||||
|
||||
/** Updates the Sink's headers. Only valid for `http` or `otelTracing` sinks. */
|
||||
public sinkHeadersPatch(
|
||||
streamId: string,
|
||||
sinkId: string,
|
||||
httpSinkHeadersPatchIn: HttpSinkHeadersPatchIn
|
||||
): Promise<EndpointHeadersOut> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.PATCH,
|
||||
"/api/v1/stream/{stream_id}/sink/{sink_id}/headers"
|
||||
);
|
||||
|
||||
request.setPathParam("stream_id", streamId);
|
||||
request.setPathParam("sink_id", sinkId);
|
||||
request.setBody(
|
||||
HttpSinkHeadersPatchInSerializer._toJsonObject(httpSinkHeadersPatchIn)
|
||||
);
|
||||
|
||||
return request.send(this.requestCtx, EndpointHeadersOutSerializer._fromJsonObject);
|
||||
}
|
||||
|
||||
/** Get the transformation code associated with this sink. */
|
||||
public sinkTransformationGet(
|
||||
streamId: string,
|
||||
sinkId: string
|
||||
): Promise<SinkTransformationOut> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.GET,
|
||||
"/api/v1/stream/{stream_id}/sink/{sink_id}/transformation"
|
||||
);
|
||||
|
||||
request.setPathParam("stream_id", streamId);
|
||||
request.setPathParam("sink_id", sinkId);
|
||||
|
||||
return request.send(this.requestCtx, SinkTransformationOutSerializer._fromJsonObject);
|
||||
}
|
||||
}
|
||||
126
node_modules/svix/src/api/streamingEventType.ts
generated
vendored
Normal file
126
node_modules/svix/src/api/streamingEventType.ts
generated
vendored
Normal file
@@ -0,0 +1,126 @@
|
||||
// this file is @generated
|
||||
|
||||
import {
|
||||
type ListResponseStreamEventTypeOut,
|
||||
ListResponseStreamEventTypeOutSerializer,
|
||||
} from "../models/listResponseStreamEventTypeOut";
|
||||
import type { Ordering } from "../models/ordering";
|
||||
import {
|
||||
type StreamEventTypeIn,
|
||||
StreamEventTypeInSerializer,
|
||||
} from "../models/streamEventTypeIn";
|
||||
import {
|
||||
type StreamEventTypeOut,
|
||||
StreamEventTypeOutSerializer,
|
||||
} from "../models/streamEventTypeOut";
|
||||
import {
|
||||
type StreamEventTypePatch,
|
||||
StreamEventTypePatchSerializer,
|
||||
} from "../models/streamEventTypePatch";
|
||||
import { HttpMethod, SvixRequest, type SvixRequestContext } from "../request";
|
||||
|
||||
export interface StreamingEventTypeListOptions {
|
||||
/** 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;
|
||||
/** Include archived (deleted but not expunged) items in the response. */
|
||||
includeArchived?: boolean;
|
||||
}
|
||||
|
||||
export interface StreamingEventTypeCreateOptions {
|
||||
idempotencyKey?: string;
|
||||
}
|
||||
|
||||
export interface StreamingEventTypeDeleteOptions {
|
||||
/** By default, event types are archived when "deleted". With this flag, they are deleted entirely. */
|
||||
expunge?: boolean;
|
||||
}
|
||||
|
||||
export class StreamingEventType {
|
||||
public constructor(private readonly requestCtx: SvixRequestContext) {}
|
||||
|
||||
/** List of all the organization's event types for streaming. */
|
||||
public list(
|
||||
options?: StreamingEventTypeListOptions
|
||||
): Promise<ListResponseStreamEventTypeOut> {
|
||||
const request = new SvixRequest(HttpMethod.GET, "/api/v1/stream/event-type");
|
||||
|
||||
request.setQueryParams({
|
||||
limit: options?.limit,
|
||||
iterator: options?.iterator,
|
||||
order: options?.order,
|
||||
include_archived: options?.includeArchived,
|
||||
});
|
||||
|
||||
return request.send(
|
||||
this.requestCtx,
|
||||
ListResponseStreamEventTypeOutSerializer._fromJsonObject
|
||||
);
|
||||
}
|
||||
|
||||
/** Create an event type for Streams. */
|
||||
public create(
|
||||
streamEventTypeIn: StreamEventTypeIn,
|
||||
options?: StreamingEventTypeCreateOptions
|
||||
): Promise<StreamEventTypeOut> {
|
||||
const request = new SvixRequest(HttpMethod.POST, "/api/v1/stream/event-type");
|
||||
|
||||
request.setHeaderParam("idempotency-key", options?.idempotencyKey);
|
||||
request.setBody(StreamEventTypeInSerializer._toJsonObject(streamEventTypeIn));
|
||||
|
||||
return request.send(this.requestCtx, StreamEventTypeOutSerializer._fromJsonObject);
|
||||
}
|
||||
|
||||
/** Get an event type. */
|
||||
public get(name: string): Promise<StreamEventTypeOut> {
|
||||
const request = new SvixRequest(HttpMethod.GET, "/api/v1/stream/event-type/{name}");
|
||||
|
||||
request.setPathParam("name", name);
|
||||
|
||||
return request.send(this.requestCtx, StreamEventTypeOutSerializer._fromJsonObject);
|
||||
}
|
||||
|
||||
/** Update or create a event type for Streams. */
|
||||
public update(
|
||||
name: string,
|
||||
streamEventTypeIn: StreamEventTypeIn
|
||||
): Promise<StreamEventTypeOut> {
|
||||
const request = new SvixRequest(HttpMethod.PUT, "/api/v1/stream/event-type/{name}");
|
||||
|
||||
request.setPathParam("name", name);
|
||||
request.setBody(StreamEventTypeInSerializer._toJsonObject(streamEventTypeIn));
|
||||
|
||||
return request.send(this.requestCtx, StreamEventTypeOutSerializer._fromJsonObject);
|
||||
}
|
||||
|
||||
/** Delete an event type. */
|
||||
public delete(name: string, options?: StreamingEventTypeDeleteOptions): Promise<void> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.DELETE,
|
||||
"/api/v1/stream/event-type/{name}"
|
||||
);
|
||||
|
||||
request.setPathParam("name", name);
|
||||
request.setQueryParams({
|
||||
expunge: options?.expunge,
|
||||
});
|
||||
|
||||
return request.sendNoResponseBody(this.requestCtx);
|
||||
}
|
||||
|
||||
/** Patch an event type for Streams. */
|
||||
public patch(
|
||||
name: string,
|
||||
streamEventTypePatch: StreamEventTypePatch
|
||||
): Promise<StreamEventTypeOut> {
|
||||
const request = new SvixRequest(HttpMethod.PATCH, "/api/v1/stream/event-type/{name}");
|
||||
|
||||
request.setPathParam("name", name);
|
||||
request.setBody(StreamEventTypePatchSerializer._toJsonObject(streamEventTypePatch));
|
||||
|
||||
return request.send(this.requestCtx, StreamEventTypeOutSerializer._fromJsonObject);
|
||||
}
|
||||
}
|
||||
69
node_modules/svix/src/api/streamingEvents.ts
generated
vendored
Normal file
69
node_modules/svix/src/api/streamingEvents.ts
generated
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
// this file is @generated
|
||||
|
||||
import {
|
||||
type CreateStreamEventsIn,
|
||||
CreateStreamEventsInSerializer,
|
||||
} from "../models/createStreamEventsIn";
|
||||
import {
|
||||
type CreateStreamEventsOut,
|
||||
CreateStreamEventsOutSerializer,
|
||||
} from "../models/createStreamEventsOut";
|
||||
import { type EventStreamOut, EventStreamOutSerializer } from "../models/eventStreamOut";
|
||||
import { HttpMethod, SvixRequest, type SvixRequestContext } from "../request";
|
||||
|
||||
export interface StreamingEventsCreateOptions {
|
||||
idempotencyKey?: string;
|
||||
}
|
||||
|
||||
export interface StreamingEventsGetOptions {
|
||||
/** Limit the number of returned items */
|
||||
limit?: number;
|
||||
/** The iterator returned from a prior invocation */
|
||||
iterator?: string | null;
|
||||
after?: Date | null;
|
||||
}
|
||||
|
||||
export class StreamingEvents {
|
||||
public constructor(private readonly requestCtx: SvixRequestContext) {}
|
||||
|
||||
/** Creates events on the Stream. */
|
||||
public create(
|
||||
streamId: string,
|
||||
createStreamEventsIn: CreateStreamEventsIn,
|
||||
options?: StreamingEventsCreateOptions
|
||||
): Promise<CreateStreamEventsOut> {
|
||||
const request = new SvixRequest(HttpMethod.POST, "/api/v1/stream/{stream_id}/events");
|
||||
|
||||
request.setPathParam("stream_id", streamId);
|
||||
request.setHeaderParam("idempotency-key", options?.idempotencyKey);
|
||||
request.setBody(CreateStreamEventsInSerializer._toJsonObject(createStreamEventsIn));
|
||||
|
||||
return request.send(this.requestCtx, CreateStreamEventsOutSerializer._fromJsonObject);
|
||||
}
|
||||
|
||||
/**
|
||||
* Iterate over a stream of events.
|
||||
*
|
||||
* The sink must be of type `poller` to use the poller endpoint.
|
||||
*/
|
||||
public get(
|
||||
streamId: string,
|
||||
sinkId: string,
|
||||
options?: StreamingEventsGetOptions
|
||||
): Promise<EventStreamOut> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.GET,
|
||||
"/api/v1/stream/{stream_id}/sink/{sink_id}/events"
|
||||
);
|
||||
|
||||
request.setPathParam("stream_id", streamId);
|
||||
request.setPathParam("sink_id", sinkId);
|
||||
request.setQueryParams({
|
||||
limit: options?.limit,
|
||||
iterator: options?.iterator,
|
||||
after: options?.after,
|
||||
});
|
||||
|
||||
return request.send(this.requestCtx, EventStreamOutSerializer._fromJsonObject);
|
||||
}
|
||||
}
|
||||
201
node_modules/svix/src/api/streamingSink.ts
generated
vendored
Normal file
201
node_modules/svix/src/api/streamingSink.ts
generated
vendored
Normal file
@@ -0,0 +1,201 @@
|
||||
// this file is @generated
|
||||
|
||||
import { type EmptyResponse, EmptyResponseSerializer } from "../models/emptyResponse";
|
||||
import {
|
||||
type EndpointSecretRotateIn,
|
||||
EndpointSecretRotateInSerializer,
|
||||
} from "../models/endpointSecretRotateIn";
|
||||
import {
|
||||
type ListResponseStreamSinkOut,
|
||||
ListResponseStreamSinkOutSerializer,
|
||||
} from "../models/listResponseStreamSinkOut";
|
||||
import type { Ordering } from "../models/ordering";
|
||||
import { type SinkSecretOut, SinkSecretOutSerializer } from "../models/sinkSecretOut";
|
||||
import {
|
||||
type SinkTransformIn,
|
||||
SinkTransformInSerializer,
|
||||
} from "../models/sinkTransformIn";
|
||||
import { type StreamSinkIn, StreamSinkInSerializer } from "../models/streamSinkIn";
|
||||
import { type StreamSinkOut, StreamSinkOutSerializer } from "../models/streamSinkOut";
|
||||
import {
|
||||
type StreamSinkPatch,
|
||||
StreamSinkPatchSerializer,
|
||||
} from "../models/streamSinkPatch";
|
||||
import { HttpMethod, SvixRequest, type SvixRequestContext } from "../request";
|
||||
|
||||
export interface StreamingSinkListOptions {
|
||||
/** 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 interface StreamingSinkCreateOptions {
|
||||
idempotencyKey?: string;
|
||||
}
|
||||
|
||||
export interface StreamingSinkRotateSecretOptions {
|
||||
idempotencyKey?: string;
|
||||
}
|
||||
|
||||
export class StreamingSink {
|
||||
public constructor(private readonly requestCtx: SvixRequestContext) {}
|
||||
|
||||
/** List of all the stream's sinks. */
|
||||
public list(
|
||||
streamId: string,
|
||||
options?: StreamingSinkListOptions
|
||||
): Promise<ListResponseStreamSinkOut> {
|
||||
const request = new SvixRequest(HttpMethod.GET, "/api/v1/stream/{stream_id}/sink");
|
||||
|
||||
request.setPathParam("stream_id", streamId);
|
||||
request.setQueryParams({
|
||||
limit: options?.limit,
|
||||
iterator: options?.iterator,
|
||||
order: options?.order,
|
||||
});
|
||||
|
||||
return request.send(
|
||||
this.requestCtx,
|
||||
ListResponseStreamSinkOutSerializer._fromJsonObject
|
||||
);
|
||||
}
|
||||
|
||||
/** Creates a new sink. */
|
||||
public create(
|
||||
streamId: string,
|
||||
streamSinkIn: StreamSinkIn,
|
||||
options?: StreamingSinkCreateOptions
|
||||
): Promise<StreamSinkOut> {
|
||||
const request = new SvixRequest(HttpMethod.POST, "/api/v1/stream/{stream_id}/sink");
|
||||
|
||||
request.setPathParam("stream_id", streamId);
|
||||
request.setHeaderParam("idempotency-key", options?.idempotencyKey);
|
||||
request.setBody(StreamSinkInSerializer._toJsonObject(streamSinkIn));
|
||||
|
||||
return request.send(this.requestCtx, StreamSinkOutSerializer._fromJsonObject);
|
||||
}
|
||||
|
||||
/** Get a sink by id or uid. */
|
||||
public get(streamId: string, sinkId: string): Promise<StreamSinkOut> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.GET,
|
||||
"/api/v1/stream/{stream_id}/sink/{sink_id}"
|
||||
);
|
||||
|
||||
request.setPathParam("stream_id", streamId);
|
||||
request.setPathParam("sink_id", sinkId);
|
||||
|
||||
return request.send(this.requestCtx, StreamSinkOutSerializer._fromJsonObject);
|
||||
}
|
||||
|
||||
/** Update a sink. */
|
||||
public update(
|
||||
streamId: string,
|
||||
sinkId: string,
|
||||
streamSinkIn: StreamSinkIn
|
||||
): Promise<StreamSinkOut> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.PUT,
|
||||
"/api/v1/stream/{stream_id}/sink/{sink_id}"
|
||||
);
|
||||
|
||||
request.setPathParam("stream_id", streamId);
|
||||
request.setPathParam("sink_id", sinkId);
|
||||
request.setBody(StreamSinkInSerializer._toJsonObject(streamSinkIn));
|
||||
|
||||
return request.send(this.requestCtx, StreamSinkOutSerializer._fromJsonObject);
|
||||
}
|
||||
|
||||
/** Delete a sink. */
|
||||
public delete(streamId: string, sinkId: string): Promise<void> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.DELETE,
|
||||
"/api/v1/stream/{stream_id}/sink/{sink_id}"
|
||||
);
|
||||
|
||||
request.setPathParam("stream_id", streamId);
|
||||
request.setPathParam("sink_id", sinkId);
|
||||
|
||||
return request.sendNoResponseBody(this.requestCtx);
|
||||
}
|
||||
|
||||
/** Partially update a sink. */
|
||||
public patch(
|
||||
streamId: string,
|
||||
sinkId: string,
|
||||
streamSinkPatch: StreamSinkPatch
|
||||
): Promise<StreamSinkOut> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.PATCH,
|
||||
"/api/v1/stream/{stream_id}/sink/{sink_id}"
|
||||
);
|
||||
|
||||
request.setPathParam("stream_id", streamId);
|
||||
request.setPathParam("sink_id", sinkId);
|
||||
request.setBody(StreamSinkPatchSerializer._toJsonObject(streamSinkPatch));
|
||||
|
||||
return request.send(this.requestCtx, StreamSinkOutSerializer._fromJsonObject);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the sink's signing secret (only supported for http sinks)
|
||||
*
|
||||
* This is used to verify the authenticity of the delivery.
|
||||
*
|
||||
* For more information please refer to [the consuming webhooks docs](https://docs.svix.com/consuming-webhooks/).
|
||||
*/
|
||||
public getSecret(streamId: string, sinkId: string): Promise<SinkSecretOut> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.GET,
|
||||
"/api/v1/stream/{stream_id}/sink/{sink_id}/secret"
|
||||
);
|
||||
|
||||
request.setPathParam("stream_id", streamId);
|
||||
request.setPathParam("sink_id", sinkId);
|
||||
|
||||
return request.send(this.requestCtx, SinkSecretOutSerializer._fromJsonObject);
|
||||
}
|
||||
|
||||
/** Rotates the signing secret (only supported for http sinks). */
|
||||
public rotateSecret(
|
||||
streamId: string,
|
||||
sinkId: string,
|
||||
endpointSecretRotateIn: EndpointSecretRotateIn,
|
||||
options?: StreamingSinkRotateSecretOptions
|
||||
): Promise<EmptyResponse> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.POST,
|
||||
"/api/v1/stream/{stream_id}/sink/{sink_id}/secret/rotate"
|
||||
);
|
||||
|
||||
request.setPathParam("stream_id", streamId);
|
||||
request.setPathParam("sink_id", sinkId);
|
||||
request.setHeaderParam("idempotency-key", options?.idempotencyKey);
|
||||
request.setBody(
|
||||
EndpointSecretRotateInSerializer._toJsonObject(endpointSecretRotateIn)
|
||||
);
|
||||
|
||||
return request.send(this.requestCtx, EmptyResponseSerializer._fromJsonObject);
|
||||
}
|
||||
|
||||
/** Set or unset the transformation code associated with this sink. */
|
||||
public transformationPartialUpdate(
|
||||
streamId: string,
|
||||
sinkId: string,
|
||||
sinkTransformIn: SinkTransformIn
|
||||
): Promise<EmptyResponse> {
|
||||
const request = new SvixRequest(
|
||||
HttpMethod.PATCH,
|
||||
"/api/v1/stream/{stream_id}/sink/{sink_id}/transformation"
|
||||
);
|
||||
|
||||
request.setPathParam("stream_id", streamId);
|
||||
request.setPathParam("sink_id", sinkId);
|
||||
request.setBody(SinkTransformInSerializer._toJsonObject(sinkTransformIn));
|
||||
|
||||
return request.send(this.requestCtx, EmptyResponseSerializer._fromJsonObject);
|
||||
}
|
||||
}
|
||||
92
node_modules/svix/src/api/streamingStream.ts
generated
vendored
Normal file
92
node_modules/svix/src/api/streamingStream.ts
generated
vendored
Normal file
@@ -0,0 +1,92 @@
|
||||
// this file is @generated
|
||||
|
||||
import {
|
||||
type ListResponseStreamOut,
|
||||
ListResponseStreamOutSerializer,
|
||||
} from "../models/listResponseStreamOut";
|
||||
import type { Ordering } from "../models/ordering";
|
||||
import { type StreamIn, StreamInSerializer } from "../models/streamIn";
|
||||
import { type StreamOut, StreamOutSerializer } from "../models/streamOut";
|
||||
import { type StreamPatch, StreamPatchSerializer } from "../models/streamPatch";
|
||||
import { HttpMethod, SvixRequest, type SvixRequestContext } from "../request";
|
||||
|
||||
export interface StreamingStreamListOptions {
|
||||
/** 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 interface StreamingStreamCreateOptions {
|
||||
idempotencyKey?: string;
|
||||
}
|
||||
|
||||
export class StreamingStream {
|
||||
public constructor(private readonly requestCtx: SvixRequestContext) {}
|
||||
|
||||
/** List of all the organization's streams. */
|
||||
public list(options?: StreamingStreamListOptions): Promise<ListResponseStreamOut> {
|
||||
const request = new SvixRequest(HttpMethod.GET, "/api/v1/stream");
|
||||
|
||||
request.setQueryParams({
|
||||
limit: options?.limit,
|
||||
iterator: options?.iterator,
|
||||
order: options?.order,
|
||||
});
|
||||
|
||||
return request.send(this.requestCtx, ListResponseStreamOutSerializer._fromJsonObject);
|
||||
}
|
||||
|
||||
/** Creates a new stream. */
|
||||
public create(
|
||||
streamIn: StreamIn,
|
||||
options?: StreamingStreamCreateOptions
|
||||
): Promise<StreamOut> {
|
||||
const request = new SvixRequest(HttpMethod.POST, "/api/v1/stream");
|
||||
|
||||
request.setHeaderParam("idempotency-key", options?.idempotencyKey);
|
||||
request.setBody(StreamInSerializer._toJsonObject(streamIn));
|
||||
|
||||
return request.send(this.requestCtx, StreamOutSerializer._fromJsonObject);
|
||||
}
|
||||
|
||||
/** Get a stream by id or uid. */
|
||||
public get(streamId: string): Promise<StreamOut> {
|
||||
const request = new SvixRequest(HttpMethod.GET, "/api/v1/stream/{stream_id}");
|
||||
|
||||
request.setPathParam("stream_id", streamId);
|
||||
|
||||
return request.send(this.requestCtx, StreamOutSerializer._fromJsonObject);
|
||||
}
|
||||
|
||||
/** Update a stream. */
|
||||
public update(streamId: string, streamIn: StreamIn): Promise<StreamOut> {
|
||||
const request = new SvixRequest(HttpMethod.PUT, "/api/v1/stream/{stream_id}");
|
||||
|
||||
request.setPathParam("stream_id", streamId);
|
||||
request.setBody(StreamInSerializer._toJsonObject(streamIn));
|
||||
|
||||
return request.send(this.requestCtx, StreamOutSerializer._fromJsonObject);
|
||||
}
|
||||
|
||||
/** Delete a stream. */
|
||||
public delete(streamId: string): Promise<void> {
|
||||
const request = new SvixRequest(HttpMethod.DELETE, "/api/v1/stream/{stream_id}");
|
||||
|
||||
request.setPathParam("stream_id", streamId);
|
||||
|
||||
return request.sendNoResponseBody(this.requestCtx);
|
||||
}
|
||||
|
||||
/** Partially update a stream. */
|
||||
public patch(streamId: string, streamPatch: StreamPatch): Promise<StreamOut> {
|
||||
const request = new SvixRequest(HttpMethod.PATCH, "/api/v1/stream/{stream_id}");
|
||||
|
||||
request.setPathParam("stream_id", streamId);
|
||||
request.setBody(StreamPatchSerializer._toJsonObject(streamPatch));
|
||||
|
||||
return request.send(this.requestCtx, StreamOutSerializer._fromJsonObject);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user