Skip to content

Commit

Permalink
js: Replace api/ files by generated files with minor manual changes (#…
Browse files Browse the repository at this point in the history
…1578)

Using our new codegen.

Part of svix/monorepo-private#9576.
  • Loading branch information
svix-jplatte authored Dec 20, 2024
2 parents 86a4c24 + 6c5e3cf commit becab77
Show file tree
Hide file tree
Showing 8 changed files with 364 additions and 190 deletions.
45 changes: 34 additions & 11 deletions javascript/src/api/application.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
// this file is @generated (with the exception of getOrCreate)
import {
Configuration,
ApplicationApi,
ApplicationIn,
ApplicationOut,
ApplicationPatch,
Configuration,
ListResponseApplicationOut,
Ordering,
} from "../openapi";
Expand All @@ -25,18 +26,26 @@ export class Application {
this.api = new ApplicationApi(config);
}

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

/// Create a new application.
public create(
applicationIn: ApplicationIn,
options?: PostOptions
): Promise<ApplicationOut> {
return this.api.v1ApplicationCreate({ applicationIn, ...options });
return this.api.v1ApplicationCreate({
applicationIn,
...options,
});
}

/// 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 @@ -48,22 +57,36 @@ export class Application {
});
}

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

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

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

/// Partially update an application.
public patch(
appId: string,
applicationPatch: ApplicationPatch
): Promise<ApplicationOut> {
return this.api.v1ApplicationPatch({ appId, applicationPatch });
}

public delete(appId: string): Promise<void> {
return this.api.v1ApplicationDelete({ appId });
return this.api.v1ApplicationPatch({
appId,
applicationPatch,
});
}
}
27 changes: 24 additions & 3 deletions javascript/src/api/authentication.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
// this file is @generated (with minor manual changes)
import {
Configuration,
AuthenticationApi,
DashboardAccessOut,
AppPortalAccessOut,
AppPortalAccessIn,
AppPortalAccessOut,
ApplicationTokenExpireIn,
DashboardAccessOut,
} from "../openapi";
import { PostOptions } from "../util";

Expand All @@ -14,6 +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.
public appPortalAccess(
appId: string,
appPortalAccessIn: AppPortalAccessIn,
Expand All @@ -36,7 +39,25 @@ export class Authentication {
});
}

/// Expire all of the tokens associated with a specific Application
public expireAll(
appId: string,
applicationTokenExpireIn: ApplicationTokenExpireIn,
options?: PostOptions
): Promise<void> {
return this.api.v1AuthenticationExpireAll({
appId,
applicationTokenExpireIn,
...options,
});
}

/// Logout an app token.
///
/// Trying to log out other tokens will fail.
public logout(options?: PostOptions): Promise<void> {
return this.api.v1AuthenticationLogout({ ...options });
return this.api.v1AuthenticationLogout({
...options,
});
}
}
Loading

0 comments on commit becab77

Please sign in to comment.