Skip to content

Commit

Permalink
js: Regenerate high-level API (#1585)
Browse files Browse the repository at this point in the history
  • Loading branch information
svix-jplatte authored Dec 23, 2024
2 parents fa01544 + 62d8b74 commit a40de2e
Show file tree
Hide file tree
Showing 10 changed files with 228 additions and 183 deletions.
3 changes: 3 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@
* Libs/JavaScript **(Breaking)**: Add more precise type annotations for `options` parameters on
`MessageAttempt.list`, `MessageAttempt.listByMsg`, `MessageAttempt.listAttemptedMessages` and
`MessageAttempt.listAttemptedDestinations` ([#1571])
* Libs/JavaScript **(Breaking)**: Rename `EndpointStatsOptions` interface to
`EndpointGetStatsOptions` ([#1585])
* Libs/Rust: Add `api::Authentication::expire_all` ([#1584])
* Libs/Rust: Rename some `Options` types. The old names remain as deprecated type aliases ([#1584])

[#1568]: https://github.com/svix/svix-webhooks/pull/1568
[#1571]: https://github.com/svix/svix-webhooks/pull/1571
[#1584]: https://github.com/svix/svix-webhooks/pull/1584
[#1585]: https://github.com/svix/svix-webhooks/pull/1585

## Version 1.44.0
* Libs/JavaScript: Revert packaging-related change because it broke for some users ([#1556])
Expand Down
20 changes: 10 additions & 10 deletions javascript/src/api/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ import {
import { PostOptions } from "../util";

export interface ApplicationListOptions {
/// Limit the number of returned items
/** Limit the number of returned items */
limit?: number;
/// The iterator returned from a prior invocation
/** The iterator returned from a prior invocation */
iterator?: string | null;
/// The sorting order of the returned items
/** The sorting order of the returned items */
order?: Ordering;
}

Expand All @@ -26,15 +26,15 @@ export class Application {
this.api = new ApplicationApi(config);
}

/// List of all the organization's applications.
/** List of all the organization's applications. */
public list(options?: ApplicationListOptions): Promise<ListResponseApplicationOut> {
return this.api.v1ApplicationList({
...options,
iterator: options?.iterator ?? undefined,
});
}

/// Create a new application.
/** Create a new application. */
public create(
applicationIn: ApplicationIn,
options?: PostOptions
Expand All @@ -45,7 +45,7 @@ export class Application {
});
}

/// Get the application with the UID from `applicationIn`, or create it if it doesn't exist yet.
/** Get the application with the UID from `applicationIn`, or create it if it doesn't exist yet. */
public getOrCreate(
applicationIn: ApplicationIn,
options?: PostOptions
Expand All @@ -57,29 +57,29 @@ export class Application {
});
}

/// Get an application.
/** Get an application. */
public get(appId: string): Promise<ApplicationOut> {
return this.api.v1ApplicationGet({
appId,
});
}

/// Update an application.
/** Update an application. */
public update(appId: string, applicationIn: ApplicationIn): Promise<ApplicationOut> {
return this.api.v1ApplicationUpdate({
appId,
applicationIn,
});
}

/// Delete an application.
/** Delete an application. */
public delete(appId: string): Promise<void> {
return this.api.v1ApplicationDelete({
appId,
});
}

/// Partially update an application.
/** Partially update an application. */
public patch(
appId: string,
applicationPatch: ApplicationPatch
Expand Down
12 changes: 7 additions & 5 deletions javascript/src/api/authentication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class Authentication {
this.api = new AuthenticationApi(config);
}

/// Use this function to get magic links (and authentication codes) for connecting your users to the Consumer Application Portal.
/** 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,
Expand All @@ -39,7 +39,7 @@ export class Authentication {
});
}

/// Expire all of the tokens associated with a specific Application
/** Expire all of the tokens associated with a specific application. */
public expireAll(
appId: string,
applicationTokenExpireIn: ApplicationTokenExpireIn,
Expand All @@ -52,9 +52,11 @@ export class Authentication {
});
}

/// Logout an app token.
///
/// Trying to log out other tokens will fail.
/**
* Logout an app token.
*
* Trying to log out other tokens will fail.
*/
public logout(options?: PostOptions): Promise<void> {
return this.api.v1AuthenticationLogout({
...options,
Expand Down
82 changes: 45 additions & 37 deletions javascript/src/api/endpoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,18 @@ import {
import { PostOptions } from "../util";

export interface EndpointListOptions {
/// Limit the number of returned items
/** Limit the number of returned items */
limit?: number;
/// The iterator returned from a prior invocation
/** The iterator returned from a prior invocation */
iterator?: string | null;
/// The sorting order of the returned items
/** The sorting order of the returned items */
order?: Ordering;
}

export interface EndpointStatsOptions {
/// Filter the range to data starting from this date
export interface EndpointGetStatsOptions {
/** Filter the range to data starting from this date. */
since?: Date | null;
/// Filter the range to data ending by this date
/** Filter the range to data ending by this date. */
until?: Date | null;
}

Expand All @@ -49,7 +49,7 @@ export class Endpoint {
this.api = new EndpointApi(config);
}

/// List the application's endpoints.
/** List the application's endpoints. */
public list(
appId: string,
options?: EndpointListOptions
Expand All @@ -61,9 +61,11 @@ export class Endpoint {
});
}

/// Create a new endpoint for the application.
///
/// When `secret` is `null` the secret is automatically generated (recommended)
/**
* Create a new endpoint for the application.
*
* When `secret` is `null` the secret is automatically generated (recommended).
*/
public create(
appId: string,
endpointIn: EndpointIn,
Expand All @@ -76,15 +78,15 @@ export class Endpoint {
});
}

/// Get an endpoint.
/** Get an endpoint. */
public get(appId: string, endpointId: string): Promise<EndpointOut> {
return this.api.v1EndpointGet({
appId,
endpointId,
});
}

/// Update an endpoint.
/** Update an endpoint. */
public update(
appId: string,
endpointId: string,
Expand All @@ -97,15 +99,15 @@ export class Endpoint {
});
}

/// Delete an endpoint.
/** Delete an endpoint. */
public delete(appId: string, endpointId: string): Promise<void> {
return this.api.v1EndpointDelete({
appId,
endpointId,
});
}

/// Partially update an endpoint.
/** Partially update an endpoint. */
public patch(
appId: string,
endpointId: string,
Expand All @@ -118,17 +120,15 @@ export class Endpoint {
});
}

/// Get the additional headers to be sent with the webhook
/** Get the additional headers to be sent with the webhook. */
public getHeaders(appId: string, endpointId: string): Promise<EndpointHeadersOut> {
return this.api.v1EndpointGetHeaders({
appId,
endpointId,
});
}

/**
* @deprecated Since version 1.30.0. Use `headersUpdate` instead.
*/
/** Set the additional headers to be sent with the webhook. */
public updateHeaders(
appId: string,
endpointId: string,
Expand Down Expand Up @@ -180,9 +180,11 @@ export class Endpoint {
});
}

/// Resend all failed messages since a given time.
///
/// Messages that were sent successfully, even if failed initially, are not resent.
/**
* Resend all failed messages since a given time.
*
* Messages that were sent successfully, even if failed initially, are not resent.
*/
public recover(
appId: string,
endpointId: string,
Expand All @@ -197,10 +199,12 @@ export class Endpoint {
});
}

/// 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.
/**
* 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.
*/
public replayMissing(
appId: string,
endpointId: string,
Expand All @@ -215,20 +219,24 @@ export class Endpoint {
});
}

/// 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/).
/**
* 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> {
return this.api.v1EndpointGetSecret({
appId,
endpointId,
});
}

/// Rotates the endpoint's signing secret.
///
/// The previous secret will remain valid for the next 24 hours.
/**
* Rotates the endpoint's signing secret.
*
* The previous secret will remain valid for the next 24 hours.
*/
public rotateSecret(
appId: string,
endpointId: string,
Expand All @@ -243,7 +251,7 @@ export class Endpoint {
});
}

/// Send an example message for an event
/** Send an example message for an event. */
public sendExample(
appId: string,
endpointId: string,
Expand All @@ -258,11 +266,11 @@ export class Endpoint {
});
}

/// Get basic statistics for the endpoint.
/** Get basic statistics for the endpoint. */
public getStats(
appId: string,
endpointId: string,
options?: EndpointStatsOptions
options?: EndpointGetStatsOptions
): Promise<EndpointStats> {
return this.api.v1EndpointGetStats({
appId,
Expand All @@ -273,7 +281,7 @@ export class Endpoint {
});
}

/// Get the transformation code associated with this endpoint
/** Get the transformation code associated with this endpoint. */
public transformationGet(
appId: string,
endpointId: string
Expand All @@ -284,7 +292,7 @@ export class Endpoint {
});
}

/// Set or unset the transformation code associated with this endpoint
/** Set or unset the transformation code associated with this endpoint. */
public transformationPartialUpdate(
appId: string,
endpointId: string,
Expand Down
Loading

0 comments on commit a40de2e

Please sign in to comment.