Skip to content

Commit

Permalink
js: Pull in more changes from codegen
Browse files Browse the repository at this point in the history
  • Loading branch information
svix-jplatte committed Jan 30, 2025
1 parent 26795ae commit 0070e1d
Show file tree
Hide file tree
Showing 9 changed files with 134 additions and 28 deletions.
7 changes: 5 additions & 2 deletions javascript/src/api/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
Ordering,
} from "../openapi";
import { HttpMethod, SvixRequest, SvixRequestContext } from "../request";
import { PostOptions } from "../util";

export interface ApplicationListOptions {
/** Limit the number of returned items */
Expand All @@ -18,6 +17,10 @@ export interface ApplicationListOptions {
order?: Ordering;
}

export interface ApplicationCreateOptions {
idempotencyKey?: string;
}

export class Application {
public constructor(private readonly requestCtx: SvixRequestContext) {}

Expand All @@ -35,7 +38,7 @@ export class Application {
/** Create a new application. */
public create(
applicationIn: ApplicationIn,
options?: PostOptions
options?: ApplicationCreateOptions
): Promise<ApplicationOut> {
const request = new SvixRequest(HttpMethod.POST, "/api/v1/app");

Expand Down
25 changes: 20 additions & 5 deletions javascript/src/api/authentication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,22 @@ import {
DashboardAccessOut,
} from "../openapi";
import { HttpMethod, SvixRequest, SvixRequestContext } from "../request";
import { PostOptions } from "../util";

export interface AuthenticationAppPortalAccessOptions {
idempotencyKey?: string;
}

export interface AuthenticationExpireAllOptions {
idempotencyKey?: string;
}

export interface AuthenticationDashboardAccessOptions {
idempotencyKey?: string;
}

export interface AuthenticationLogoutOptions {
idempotencyKey?: string;
}

export class Authentication {
public constructor(private readonly requestCtx: SvixRequestContext) {}
Expand All @@ -15,7 +30,7 @@ export class Authentication {
public appPortalAccess(
appId: string,
appPortalAccessIn: AppPortalAccessIn,
options?: PostOptions
options?: AuthenticationAppPortalAccessOptions
): Promise<AppPortalAccessOut> {
const request = new SvixRequest(
HttpMethod.POST,
Expand All @@ -33,7 +48,7 @@ export class Authentication {
public expireAll(
appId: string,
applicationTokenExpireIn: ApplicationTokenExpireIn,
options?: PostOptions
options?: AuthenticationExpireAllOptions
): Promise<void> {
const request = new SvixRequest(
HttpMethod.POST,
Expand All @@ -56,7 +71,7 @@ export class Authentication {
*/
public dashboardAccess(
appId: string,
options?: PostOptions
options?: AuthenticationDashboardAccessOptions
): Promise<DashboardAccessOut> {
const request = new SvixRequest(
HttpMethod.POST,
Expand All @@ -74,7 +89,7 @@ export class Authentication {
*
* Trying to log out other tokens will fail.
*/
public logout(options?: PostOptions): Promise<void> {
public logout(options?: AuthenticationLogoutOptions): Promise<void> {
const request = new SvixRequest(HttpMethod.POST, "/api/v1/auth/logout");

request.setHeaderParam("idempotency-key", options?.idempotencyKey);
Expand Down
31 changes: 25 additions & 6 deletions javascript/src/api/endpoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import {
ReplayOut,
} from "../openapi";
import { HttpMethod, SvixRequest, SvixRequestContext } from "../request";
import { PostOptions } from "../util";

export interface EndpointListOptions {
/** Limit the number of returned items */
Expand All @@ -34,6 +33,26 @@ export interface EndpointListOptions {
order?: Ordering;
}

export interface EndpointCreateOptions {
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;
Expand Down Expand Up @@ -67,7 +86,7 @@ export class Endpoint {
public create(
appId: string,
endpointIn: EndpointIn,
options?: PostOptions
options?: EndpointCreateOptions
): Promise<EndpointOut> {
const request = new SvixRequest(HttpMethod.POST, "/api/v1/app/{app_id}/endpoint");

Expand Down Expand Up @@ -214,7 +233,7 @@ export class Endpoint {
appId: string,
endpointId: string,
recoverIn: RecoverIn,
options?: PostOptions
options?: EndpointRecoverOptions
): Promise<RecoverOut> {
const request = new SvixRequest(
HttpMethod.POST,
Expand All @@ -239,7 +258,7 @@ export class Endpoint {
appId: string,
endpointId: string,
replayIn: ReplayIn,
options?: PostOptions
options?: EndpointReplayMissingOptions
): Promise<ReplayOut> {
const request = new SvixRequest(
HttpMethod.POST,
Expand Down Expand Up @@ -281,7 +300,7 @@ export class Endpoint {
appId: string,
endpointId: string,
endpointSecretRotateIn: EndpointSecretRotateIn,
options?: PostOptions
options?: EndpointRotateSecretOptions
): Promise<void> {
const request = new SvixRequest(
HttpMethod.POST,
Expand All @@ -301,7 +320,7 @@ export class Endpoint {
appId: string,
endpointId: string,
eventExampleIn: EventExampleIn,
options?: PostOptions
options?: EndpointSendExampleOptions
): Promise<MessageOut> {
const request = new SvixRequest(
HttpMethod.POST,
Expand Down
16 changes: 13 additions & 3 deletions javascript/src/api/event_type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
Ordering,
} from "../openapi";
import { HttpMethod, SvixRequest, SvixRequestContext } from "../request";
import { PostOptions } from "../util";

export interface EventTypeListOptions {
/** Limit the number of returned items */
Expand All @@ -25,6 +24,14 @@ export interface EventTypeListOptions {
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;
Expand Down Expand Up @@ -53,7 +60,10 @@ export class EventType {
* 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?: PostOptions): Promise<EventTypeOut> {
public create(
eventTypeIn: EventTypeIn,
options?: EventTypeCreateOptions
): Promise<EventTypeOut> {
const request = new SvixRequest(HttpMethod.POST, "/api/v1/event-type");

request.setHeaderParam("idempotency-key", options?.idempotencyKey);
Expand All @@ -71,7 +81,7 @@ export class EventType {
*/
public importOpenapi(
eventTypeImportOpenApiIn: EventTypeImportOpenApiIn,
options?: PostOptions
options?: EventTypeImportOpenapiOptions
): Promise<EventTypeImportOpenApiOut> {
const request = new SvixRequest(HttpMethod.POST, "/api/v1/event-type/import/openapi");

Expand Down
13 changes: 10 additions & 3 deletions javascript/src/api/integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
Ordering,
} from "../openapi";
import { HttpMethod, SvixRequest, SvixRequestContext } from "../request";
import { PostOptions } from "../util";

export interface IntegrationListOptions {
/** Limit the number of returned items */
Expand All @@ -19,6 +18,14 @@ export interface IntegrationListOptions {
order?: Ordering;
}

export interface IntegrationCreateOptions {
idempotencyKey?: string;
}

export interface IntegrationRotateKeyOptions {
idempotencyKey?: string;
}

export class Integration {
public constructor(private readonly requestCtx: SvixRequestContext) {}

Expand All @@ -41,7 +48,7 @@ export class Integration {
public create(
appId: string,
integrationIn: IntegrationIn,
options?: PostOptions
options?: IntegrationCreateOptions
): Promise<IntegrationOut> {
const request = new SvixRequest(HttpMethod.POST, "/api/v1/app/{app_id}/integration");

Expand Down Expand Up @@ -117,7 +124,7 @@ export class Integration {
public rotateKey(
appId: string,
integId: string,
options?: PostOptions
options?: IntegrationRotateKeyOptions
): Promise<IntegrationKeyOut> {
const request = new SvixRequest(
HttpMethod.POST,
Expand Down
10 changes: 8 additions & 2 deletions javascript/src/api/message.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// this file is @generated
import { ListResponseMessageOut, MessageIn, MessageOut } from "../openapi";
import { HttpMethod, SvixRequest, SvixRequestContext } from "../request";
import { PostOptions } from "../util";

export interface MessageListOptions {
/** Limit the number of returned items */
Expand All @@ -22,6 +21,12 @@ export interface MessageListOptions {
eventTypes?: string[];
}

export interface MessageCreateOptions {
/** When `true`, message payloads are included in the response. */
withContent?: boolean;
idempotencyKey?: string;
}

export interface MessageGetOptions {
/** When `true` message payloads are included in the response. */
withContent?: boolean;
Expand Down Expand Up @@ -74,11 +79,12 @@ export class Message {
public create(
appId: string,
messageIn: MessageIn,
options?: PostOptions
options?: MessageCreateOptions
): Promise<MessageOut> {
const request = new SvixRequest(HttpMethod.POST, "/api/v1/app/{app_id}/msg");

request.setPathParam("app_id", appId);
request.setQueryParam("with_content", options?.withContent);
request.setHeaderParam("idempotency-key", options?.idempotencyKey);
request.setBody(messageIn, "MessageIn");

Expand Down
7 changes: 5 additions & 2 deletions javascript/src/api/message_attempt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
StatusCodeClass,
} from "../openapi";
import { HttpMethod, SvixRequest, SvixRequestContext } from "../request";
import { PostOptions } from "../util";

export interface MessageAttemptListOptions {
iterator?: string | null;
Expand Down Expand Up @@ -100,6 +99,10 @@ export interface MessageAttemptListAttemptedDestinationsOptions {
iterator?: string | null;
}

export interface MessageAttemptResendOptions {
idempotencyKey?: string;
}

export class MessageAttempt {
public constructor(private readonly requestCtx: SvixRequestContext) {}

Expand Down Expand Up @@ -285,7 +288,7 @@ export class MessageAttempt {
appId: string,
msgId: string,
endpointId: string,
options?: PostOptions
options?: MessageAttemptResendOptions
): Promise<void> {
const request = new SvixRequest(
HttpMethod.POST,
Expand Down
Loading

0 comments on commit 0070e1d

Please sign in to comment.