Skip to content

Commit

Permalink
Update OpenAPI spec and regenerate libs (#1769)
Browse files Browse the repository at this point in the history
  • Loading branch information
svix-jplatte authored Feb 28, 2025
2 parents 33e2b6e + 70b1ab7 commit e28add5
Show file tree
Hide file tree
Showing 44 changed files with 13,075 additions and 9,079 deletions.
205 changes: 205 additions & 0 deletions javascript/src/api/ingestEndpoint.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,205 @@
// this file is @generated
import {
IngestEndpointHeadersIn,
IngestEndpointHeadersInSerializer,
} from "../models/ingestEndpointHeadersIn";
import {
IngestEndpointHeadersOut,
IngestEndpointHeadersOutSerializer,
} from "../models/ingestEndpointHeadersOut";
import { IngestEndpointIn, IngestEndpointInSerializer } from "../models/ingestEndpointIn";
import {
IngestEndpointOut,
IngestEndpointOutSerializer,
} from "../models/ingestEndpointOut";
import {
IngestEndpointSecretIn,
IngestEndpointSecretInSerializer,
} from "../models/ingestEndpointSecretIn";
import {
IngestEndpointSecretOut,
IngestEndpointSecretOutSerializer,
} from "../models/ingestEndpointSecretOut";
import {
IngestEndpointUpdate,
IngestEndpointUpdateSerializer,
} from "../models/ingestEndpointUpdate";
import {
ListResponseIngestEndpointOut,
ListResponseIngestEndpointOutSerializer,
} from "../models/listResponseIngestEndpointOut";
import { Ordering } from "../models/ordering";
import { HttpMethod, SvixRequest, 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(
options?: IngestEndpointListOptions
): Promise<ListResponseIngestEndpointOut> {
const request = new SvixRequest(
HttpMethod.GET,
"/ingest/api/v1/source/{source_id}/endpoint"
);

request.setQueryParam("limit", options?.limit);
request.setQueryParam("iterator", options?.iterator);
request.setQueryParam("order", options?.order);

return request.send(
this.requestCtx,
ListResponseIngestEndpointOutSerializer._fromJsonObject
);
}

/** Create an ingest endpoint. */
public create(
ingestEndpointIn: IngestEndpointIn,
options?: IngestEndpointCreateOptions
): Promise<IngestEndpointOut> {
const request = new SvixRequest(
HttpMethod.POST,
"/ingest/api/v1/source/{source_id}/endpoint"
);

request.setHeaderParam("idempotency-key", options?.idempotencyKey);
request.setBody(IngestEndpointInSerializer._toJsonObject(ingestEndpointIn));

return request.send(this.requestCtx, IngestEndpointOutSerializer._fromJsonObject);
}

/** Get an ingest endpoint. */
public get(endpointId: string): Promise<IngestEndpointOut> {
const request = new SvixRequest(
HttpMethod.GET,
"/ingest/api/v1/source/{source_id}/endpoint/{endpoint_id}"
);

request.setPathParam("endpoint_id", endpointId);

return request.send(this.requestCtx, IngestEndpointOutSerializer._fromJsonObject);
}

/** Update an ingest endpoint. */
public update(
endpointId: string,
ingestEndpointUpdate: IngestEndpointUpdate
): Promise<IngestEndpointOut> {
const request = new SvixRequest(
HttpMethod.PUT,
"/ingest/api/v1/source/{source_id}/endpoint/{endpoint_id}"
);

request.setPathParam("endpoint_id", endpointId);
request.setBody(IngestEndpointUpdateSerializer._toJsonObject(ingestEndpointUpdate));

return request.send(this.requestCtx, IngestEndpointOutSerializer._fromJsonObject);
}

/** Delete an ingest endpoint. */
public delete(endpointId: string): Promise<void> {
const request = new SvixRequest(
HttpMethod.DELETE,
"/ingest/api/v1/source/{source_id}/endpoint/{endpoint_id}"
);

request.setPathParam("endpoint_id", endpointId);

return request.sendNoResponseBody(this.requestCtx);
}

/** Get the additional headers to be sent with the ingest. */
public getHeaders(endpointId: string): Promise<IngestEndpointHeadersOut> {
const request = new SvixRequest(
HttpMethod.GET,
"/ingest/api/v1/source/{source_id}/endpoint/{endpoint_id}/headers"
);

request.setPathParam("endpoint_id", endpointId);

return request.send(
this.requestCtx,
IngestEndpointHeadersOutSerializer._fromJsonObject
);
}

/** Set the additional headers to be sent to the endpoint. */
public updateHeaders(
endpointId: string,
ingestEndpointHeadersIn: IngestEndpointHeadersIn
): Promise<void> {
const request = new SvixRequest(
HttpMethod.PUT,
"/ingest/api/v1/source/{source_id}/endpoint/{endpoint_id}/headers"
);

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(endpointId: string): Promise<IngestEndpointSecretOut> {
const request = new SvixRequest(
HttpMethod.GET,
"/ingest/api/v1/source/{source_id}/endpoint/{endpoint_id}/secret"
);

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(
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("endpoint_id", endpointId);
request.setHeaderParam("idempotency-key", options?.idempotencyKey);
request.setBody(
IngestEndpointSecretInSerializer._toJsonObject(ingestEndpointSecretIn)
);

return request.sendNoResponseBody(this.requestCtx);
}
}
10 changes: 5 additions & 5 deletions javascript/src/api/message.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// this file is @generated
import {
ExpungAllContentsOut,
ExpungAllContentsOutSerializer,
} from "../models/expungAllContentsOut";
ExpungeAllContentsOut,
ExpungeAllContentsOutSerializer,
} from "../models/expungeAllContentsOut";
import {
ListResponseMessageOut,
ListResponseMessageOutSerializer,
Expand Down Expand Up @@ -115,7 +115,7 @@ export class Message {
public expungeAllContents(
appId: string,
options?: MessageExpungeAllContentsOptions
): Promise<ExpungAllContentsOut> {
): Promise<ExpungeAllContentsOut> {
const request = new SvixRequest(
HttpMethod.POST,
"/api/v1/app/{app_id}/msg/expunge-all-contents"
Expand All @@ -124,7 +124,7 @@ export class Message {
request.setPathParam("app_id", appId);
request.setHeaderParam("idempotency-key", options?.idempotencyKey);

return request.send(this.requestCtx, ExpungAllContentsOutSerializer._fromJsonObject);
return request.send(this.requestCtx, ExpungeAllContentsOutSerializer._fromJsonObject);
}

/** Get a message by its ID or eventID. */
Expand Down
3 changes: 3 additions & 0 deletions javascript/src/models/endpointIn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export interface EndpointIn {
description?: string;
disabled?: boolean;
filterTypes?: string[] | null;
headers?: { [key: string]: string } | null;
metadata?: { [key: string]: string };
rateLimit?: number | null;
/**
Expand All @@ -29,6 +30,7 @@ export const EndpointInSerializer = {
description: object["description"],
disabled: object["disabled"],
filterTypes: object["filterTypes"],
headers: object["headers"],
metadata: object["metadata"],
rateLimit: object["rateLimit"],
secret: object["secret"],
Expand All @@ -44,6 +46,7 @@ export const EndpointInSerializer = {
description: self.description,
disabled: self.disabled,
filterTypes: self.filterTypes,
headers: self.headers,
metadata: self.metadata,
rateLimit: self.rateLimit,
secret: self.secret,
Expand Down
32 changes: 32 additions & 0 deletions javascript/src/models/expungeAllContentsOut.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// this file is @generated
/* eslint @typescript-eslint/no-explicit-any: 0 */
import {
BackgroundTaskStatus,
BackgroundTaskStatusSerializer,
} from "./backgroundTaskStatus";
import { BackgroundTaskType, BackgroundTaskTypeSerializer } from "./backgroundTaskType";

export interface ExpungeAllContentsOut {
/** The QueueBackgroundTask's ID. */
id: string;
status: BackgroundTaskStatus;
task: BackgroundTaskType;
}

export const ExpungeAllContentsOutSerializer = {
_fromJsonObject(object: any): ExpungeAllContentsOut {
return {
id: object["id"],
status: BackgroundTaskStatusSerializer._fromJsonObject(object["status"]),
task: BackgroundTaskTypeSerializer._fromJsonObject(object["task"]),
};
},

_toJsonObject(self: ExpungeAllContentsOut): any {
return {
id: self.id,
status: BackgroundTaskStatusSerializer._toJsonObject(self.status),
task: BackgroundTaskTypeSerializer._toJsonObject(self.task),
};
},
};
10 changes: 9 additions & 1 deletion javascript/src/models/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,14 @@ export { EventTypeIn } from "./eventTypeIn";
export { EventTypeOut } from "./eventTypeOut";
export { EventTypePatch } from "./eventTypePatch";
export { EventTypeUpdate } from "./eventTypeUpdate";
export { ExpungAllContentsOut } from "./expungAllContentsOut";
export { ExpungeAllContentsOut } from "./expungeAllContentsOut";
export { IngestEndpointHeadersIn } from "./ingestEndpointHeadersIn";
export { IngestEndpointHeadersOut } from "./ingestEndpointHeadersOut";
export { IngestEndpointIn } from "./ingestEndpointIn";
export { IngestEndpointOut } from "./ingestEndpointOut";
export { IngestEndpointSecretIn } from "./ingestEndpointSecretIn";
export { IngestEndpointSecretOut } from "./ingestEndpointSecretOut";
export { IngestEndpointUpdate } from "./ingestEndpointUpdate";
export { IntegrationIn } from "./integrationIn";
export { IntegrationKeyOut } from "./integrationKeyOut";
export { IntegrationOut } from "./integrationOut";
Expand All @@ -48,6 +55,7 @@ export { ListResponseBackgroundTaskOut } from "./listResponseBackgroundTaskOut";
export { ListResponseEndpointMessageOut } from "./listResponseEndpointMessageOut";
export { ListResponseEndpointOut } from "./listResponseEndpointOut";
export { ListResponseEventTypeOut } from "./listResponseEventTypeOut";
export { ListResponseIngestEndpointOut } from "./listResponseIngestEndpointOut";
export { ListResponseIntegrationOut } from "./listResponseIntegrationOut";
export { ListResponseMessageAttemptOut } from "./listResponseMessageAttemptOut";
export { ListResponseMessageEndpointOut } from "./listResponseMessageEndpointOut";
Expand Down
20 changes: 20 additions & 0 deletions javascript/src/models/ingestEndpointHeadersIn.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// this file is @generated
/* eslint @typescript-eslint/no-explicit-any: 0 */

export interface IngestEndpointHeadersIn {
headers: { [key: string]: string };
}

export const IngestEndpointHeadersInSerializer = {
_fromJsonObject(object: any): IngestEndpointHeadersIn {
return {
headers: object["headers"],
};
},

_toJsonObject(self: IngestEndpointHeadersIn): any {
return {
headers: self.headers,
};
},
};
23 changes: 23 additions & 0 deletions javascript/src/models/ingestEndpointHeadersOut.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// this file is @generated
/* eslint @typescript-eslint/no-explicit-any: 0 */

export interface IngestEndpointHeadersOut {
headers: { [key: string]: string };
sensitive: string[];
}

export const IngestEndpointHeadersOutSerializer = {
_fromJsonObject(object: any): IngestEndpointHeadersOut {
return {
headers: object["headers"],
sensitive: object["sensitive"],
};
},

_toJsonObject(self: IngestEndpointHeadersOut): any {
return {
headers: self.headers,
sensitive: self.sensitive,
};
},
};
Loading

0 comments on commit e28add5

Please sign in to comment.