@authsome/client 0.0.4 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client.d.ts +41 -37
- package/dist/client.js +32 -18
- package/dist/index.d.ts +18 -18
- package/dist/index.js +56 -56
- package/dist/plugins/admin.d.ts +5 -5
- package/dist/plugins/admin.js +21 -31
- package/dist/plugins/anonymous.d.ts +1 -1
- package/dist/plugins/anonymous.js +4 -2
- package/dist/plugins/apikey.d.ts +7 -7
- package/dist/plugins/apikey.js +41 -27
- package/dist/plugins/backupauth.d.ts +28 -28
- package/dist/plugins/backupauth.js +29 -29
- package/dist/plugins/cms.d.ts +11 -11
- package/dist/plugins/cms.js +67 -57
- package/dist/plugins/compliance.d.ts +33 -33
- package/dist/plugins/compliance.js +4 -2
- package/dist/plugins/consent.d.ts +18 -18
- package/dist/plugins/emailverification.d.ts +2 -2
- package/dist/plugins/emailverification.js +4 -2
- package/dist/plugins/idverification.d.ts +11 -11
- package/dist/plugins/idverification.js +11 -11
- package/dist/plugins/impersonation.d.ts +6 -6
- package/dist/plugins/impersonation.js +11 -15
- package/dist/plugins/jwt.d.ts +6 -5
- package/dist/plugins/jwt.js +21 -13
- package/dist/plugins/mfa.d.ts +9 -9
- package/dist/plugins/mfa.js +4 -8
- package/dist/plugins/multiapp.d.ts +19 -19
- package/dist/plugins/multiapp.js +35 -27
- package/dist/plugins/multisession.d.ts +5 -5
- package/dist/plugins/multisession.js +13 -11
- package/dist/plugins/notification.d.ts +15 -15
- package/dist/plugins/notification.js +12 -6
- package/dist/plugins/oidcprovider.d.ts +11 -11
- package/dist/plugins/oidcprovider.js +25 -19
- package/dist/plugins/organization.d.ts +5 -5
- package/dist/plugins/organization.js +16 -16
- package/dist/plugins/passkey.js +7 -7
- package/dist/plugins/permissions.js +3 -3
- package/dist/plugins/secrets.d.ts +10 -10
- package/dist/plugins/secrets.js +43 -27
- package/dist/plugins/social.js +1 -1
- package/dist/plugins/sso.js +6 -6
- package/dist/plugins/stepup.d.ts +13 -13
- package/dist/plugins/stepup.js +14 -14
- package/dist/plugins/twofa.d.ts +6 -6
- package/dist/plugins/twofa.js +12 -24
- package/dist/plugins/username.d.ts +2 -2
- package/dist/plugins/username.js +8 -4
- package/dist/plugins/webhook.js +4 -4
- package/dist/types.d.ts +3316 -2791
- package/package.json +3 -3
- package/src/client.ts +52 -37
- package/src/index.ts +18 -18
- package/src/plugins/admin.ts +21 -31
- package/src/plugins/anonymous.ts +4 -2
- package/src/plugins/apikey.ts +35 -21
- package/src/plugins/backupauth.ts +85 -85
- package/src/plugins/cms.ts +67 -57
- package/src/plugins/compliance.ts +68 -66
- package/src/plugins/consent.ts +36 -36
- package/src/plugins/emailverification.ts +6 -4
- package/src/plugins/idverification.ts +33 -33
- package/src/plugins/impersonation.ts +18 -22
- package/src/plugins/jwt.ts +23 -15
- package/src/plugins/mfa.ts +18 -22
- package/src/plugins/multiapp.ts +65 -57
- package/src/plugins/multisession.ts +20 -18
- package/src/plugins/notification.ts +36 -30
- package/src/plugins/oidcprovider.ts +41 -35
- package/src/plugins/organization.ts +26 -26
- package/src/plugins/passkey.ts +7 -7
- package/src/plugins/permissions.ts +3 -3
- package/src/plugins/secrets.ts +47 -31
- package/src/plugins/social.ts +1 -1
- package/src/plugins/sso.ts +6 -6
- package/src/plugins/stepup.ts +40 -40
- package/src/plugins/twofa.ts +12 -24
- package/src/plugins/username.ts +8 -4
- package/src/plugins/webhook.ts +4 -4
- package/src/types.ts +3576 -2874
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@authsome/client",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "TypeScript client for AuthSome authentication",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"build": "tsc",
|
|
9
|
-
"
|
|
10
|
-
"
|
|
9
|
+
"prepublishOnly": "npm run build",
|
|
10
|
+
"publish": "npm publish --access public"
|
|
11
11
|
},
|
|
12
12
|
"keywords": ["authsome", "authentication", "client"],
|
|
13
13
|
"author": "",
|
package/src/client.ts
CHANGED
|
@@ -4,34 +4,34 @@ import { ClientPlugin } from './plugin';
|
|
|
4
4
|
import { createErrorFromResponse } from './errors';
|
|
5
5
|
import * as types from './types';
|
|
6
6
|
import { AdminPlugin } from './plugins/admin';
|
|
7
|
+
import { PermissionsPlugin } from './plugins/permissions';
|
|
8
|
+
import { WebhookPlugin } from './plugins/webhook';
|
|
7
9
|
import { CmsPlugin } from './plugins/cms';
|
|
10
|
+
import { EmailverificationPlugin } from './plugins/emailverification';
|
|
11
|
+
import { IdverificationPlugin } from './plugins/idverification';
|
|
12
|
+
import { MagiclinkPlugin } from './plugins/magiclink';
|
|
13
|
+
import { NotificationPlugin } from './plugins/notification';
|
|
14
|
+
import { TwofaPlugin } from './plugins/twofa';
|
|
15
|
+
import { ApikeyPlugin } from './plugins/apikey';
|
|
16
|
+
import { EmailotpPlugin } from './plugins/emailotp';
|
|
17
|
+
import { BackupauthPlugin } from './plugins/backupauth';
|
|
8
18
|
import { CompliancePlugin } from './plugins/compliance';
|
|
9
19
|
import { StepupPlugin } from './plugins/stepup';
|
|
20
|
+
import { MfaPlugin } from './plugins/mfa';
|
|
21
|
+
import { MultiappPlugin } from './plugins/multiapp';
|
|
22
|
+
import { PhonePlugin } from './plugins/phone';
|
|
23
|
+
import { AnonymousPlugin } from './plugins/anonymous';
|
|
10
24
|
import { PasskeyPlugin } from './plugins/passkey';
|
|
11
|
-
import {
|
|
12
|
-
import { EmailverificationPlugin } from './plugins/emailverification';
|
|
25
|
+
import { UsernamePlugin } from './plugins/username';
|
|
13
26
|
import { MultisessionPlugin } from './plugins/multisession';
|
|
27
|
+
import { ConsentPlugin } from './plugins/consent';
|
|
28
|
+
import { ImpersonationPlugin } from './plugins/impersonation';
|
|
14
29
|
import { OidcproviderPlugin } from './plugins/oidcprovider';
|
|
15
30
|
import { OrganizationPlugin } from './plugins/organization';
|
|
16
|
-
import { WebhookPlugin } from './plugins/webhook';
|
|
17
|
-
import { ImpersonationPlugin } from './plugins/impersonation';
|
|
18
|
-
import { MagiclinkPlugin } from './plugins/magiclink';
|
|
19
|
-
import { SecretsPlugin } from './plugins/secrets';
|
|
20
31
|
import { SsoPlugin } from './plugins/sso';
|
|
21
|
-
import {
|
|
22
|
-
import { BackupauthPlugin } from './plugins/backupauth';
|
|
23
|
-
import { IdverificationPlugin } from './plugins/idverification';
|
|
24
|
-
import { TwofaPlugin } from './plugins/twofa';
|
|
25
|
-
import { EmailotpPlugin } from './plugins/emailotp';
|
|
26
|
-
import { NotificationPlugin } from './plugins/notification';
|
|
27
|
-
import { PermissionsPlugin } from './plugins/permissions';
|
|
28
|
-
import { UsernamePlugin } from './plugins/username';
|
|
29
|
-
import { ConsentPlugin } from './plugins/consent';
|
|
30
|
-
import { MfaPlugin } from './plugins/mfa';
|
|
32
|
+
import { SecretsPlugin } from './plugins/secrets';
|
|
31
33
|
import { SocialPlugin } from './plugins/social';
|
|
32
34
|
import { JwtPlugin } from './plugins/jwt';
|
|
33
|
-
import { MultiappPlugin } from './plugins/multiapp';
|
|
34
|
-
import { PhonePlugin } from './plugins/phone';
|
|
35
35
|
|
|
36
36
|
/**
|
|
37
37
|
* AuthSome client configuration
|
|
@@ -130,6 +130,21 @@ export class AuthsomeClient {
|
|
|
130
130
|
this.basePath = basePath;
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
+
/**
|
|
134
|
+
* Convert an object to query parameters, handling optional values and type conversion
|
|
135
|
+
*/
|
|
136
|
+
public toQueryParams(obj?: Record<string, any>): Record<string, string> | undefined {
|
|
137
|
+
if (!obj) return undefined;
|
|
138
|
+
|
|
139
|
+
const params: Record<string, string> = {};
|
|
140
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
141
|
+
if (value !== undefined && value !== null) {
|
|
142
|
+
params[key] = String(value);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
return Object.keys(params).length > 0 ? params : undefined;
|
|
146
|
+
}
|
|
147
|
+
|
|
133
148
|
/**
|
|
134
149
|
* Set global headers for all requests
|
|
135
150
|
* @param headers - Headers to set
|
|
@@ -149,34 +164,34 @@ export class AuthsomeClient {
|
|
|
149
164
|
|
|
150
165
|
public readonly $plugins = {
|
|
151
166
|
admin: (): AdminPlugin | undefined => this.getPlugin<AdminPlugin>('admin'),
|
|
167
|
+
permissions: (): PermissionsPlugin | undefined => this.getPlugin<PermissionsPlugin>('permissions'),
|
|
168
|
+
webhook: (): WebhookPlugin | undefined => this.getPlugin<WebhookPlugin>('webhook'),
|
|
152
169
|
cms: (): CmsPlugin | undefined => this.getPlugin<CmsPlugin>('cms'),
|
|
170
|
+
emailverification: (): EmailverificationPlugin | undefined => this.getPlugin<EmailverificationPlugin>('emailverification'),
|
|
171
|
+
idverification: (): IdverificationPlugin | undefined => this.getPlugin<IdverificationPlugin>('idverification'),
|
|
172
|
+
magiclink: (): MagiclinkPlugin | undefined => this.getPlugin<MagiclinkPlugin>('magiclink'),
|
|
173
|
+
notification: (): NotificationPlugin | undefined => this.getPlugin<NotificationPlugin>('notification'),
|
|
174
|
+
twofa: (): TwofaPlugin | undefined => this.getPlugin<TwofaPlugin>('twofa'),
|
|
175
|
+
apikey: (): ApikeyPlugin | undefined => this.getPlugin<ApikeyPlugin>('apikey'),
|
|
176
|
+
emailotp: (): EmailotpPlugin | undefined => this.getPlugin<EmailotpPlugin>('emailotp'),
|
|
177
|
+
backupauth: (): BackupauthPlugin | undefined => this.getPlugin<BackupauthPlugin>('backupauth'),
|
|
153
178
|
compliance: (): CompliancePlugin | undefined => this.getPlugin<CompliancePlugin>('compliance'),
|
|
154
179
|
stepup: (): StepupPlugin | undefined => this.getPlugin<StepupPlugin>('stepup'),
|
|
180
|
+
mfa: (): MfaPlugin | undefined => this.getPlugin<MfaPlugin>('mfa'),
|
|
181
|
+
multiapp: (): MultiappPlugin | undefined => this.getPlugin<MultiappPlugin>('multiapp'),
|
|
182
|
+
phone: (): PhonePlugin | undefined => this.getPlugin<PhonePlugin>('phone'),
|
|
183
|
+
anonymous: (): AnonymousPlugin | undefined => this.getPlugin<AnonymousPlugin>('anonymous'),
|
|
155
184
|
passkey: (): PasskeyPlugin | undefined => this.getPlugin<PasskeyPlugin>('passkey'),
|
|
156
|
-
|
|
157
|
-
emailverification: (): EmailverificationPlugin | undefined => this.getPlugin<EmailverificationPlugin>('emailverification'),
|
|
185
|
+
username: (): UsernamePlugin | undefined => this.getPlugin<UsernamePlugin>('username'),
|
|
158
186
|
multisession: (): MultisessionPlugin | undefined => this.getPlugin<MultisessionPlugin>('multisession'),
|
|
187
|
+
consent: (): ConsentPlugin | undefined => this.getPlugin<ConsentPlugin>('consent'),
|
|
188
|
+
impersonation: (): ImpersonationPlugin | undefined => this.getPlugin<ImpersonationPlugin>('impersonation'),
|
|
159
189
|
oidcprovider: (): OidcproviderPlugin | undefined => this.getPlugin<OidcproviderPlugin>('oidcprovider'),
|
|
160
190
|
organization: (): OrganizationPlugin | undefined => this.getPlugin<OrganizationPlugin>('organization'),
|
|
161
|
-
webhook: (): WebhookPlugin | undefined => this.getPlugin<WebhookPlugin>('webhook'),
|
|
162
|
-
impersonation: (): ImpersonationPlugin | undefined => this.getPlugin<ImpersonationPlugin>('impersonation'),
|
|
163
|
-
magiclink: (): MagiclinkPlugin | undefined => this.getPlugin<MagiclinkPlugin>('magiclink'),
|
|
164
|
-
secrets: (): SecretsPlugin | undefined => this.getPlugin<SecretsPlugin>('secrets'),
|
|
165
191
|
sso: (): SsoPlugin | undefined => this.getPlugin<SsoPlugin>('sso'),
|
|
166
|
-
|
|
167
|
-
backupauth: (): BackupauthPlugin | undefined => this.getPlugin<BackupauthPlugin>('backupauth'),
|
|
168
|
-
idverification: (): IdverificationPlugin | undefined => this.getPlugin<IdverificationPlugin>('idverification'),
|
|
169
|
-
twofa: (): TwofaPlugin | undefined => this.getPlugin<TwofaPlugin>('twofa'),
|
|
170
|
-
emailotp: (): EmailotpPlugin | undefined => this.getPlugin<EmailotpPlugin>('emailotp'),
|
|
171
|
-
notification: (): NotificationPlugin | undefined => this.getPlugin<NotificationPlugin>('notification'),
|
|
172
|
-
permissions: (): PermissionsPlugin | undefined => this.getPlugin<PermissionsPlugin>('permissions'),
|
|
173
|
-
username: (): UsernamePlugin | undefined => this.getPlugin<UsernamePlugin>('username'),
|
|
174
|
-
consent: (): ConsentPlugin | undefined => this.getPlugin<ConsentPlugin>('consent'),
|
|
175
|
-
mfa: (): MfaPlugin | undefined => this.getPlugin<MfaPlugin>('mfa'),
|
|
192
|
+
secrets: (): SecretsPlugin | undefined => this.getPlugin<SecretsPlugin>('secrets'),
|
|
176
193
|
social: (): SocialPlugin | undefined => this.getPlugin<SocialPlugin>('social'),
|
|
177
194
|
jwt: (): JwtPlugin | undefined => this.getPlugin<JwtPlugin>('jwt'),
|
|
178
|
-
multiapp: (): MultiappPlugin | undefined => this.getPlugin<MultiappPlugin>('multiapp'),
|
|
179
|
-
phone: (): PhonePlugin | undefined => this.getPlugin<PhonePlugin>('phone'),
|
|
180
195
|
};
|
|
181
196
|
|
|
182
197
|
public async request<T>(
|
|
@@ -231,7 +246,7 @@ export class AuthsomeClient {
|
|
|
231
246
|
});
|
|
232
247
|
}
|
|
233
248
|
|
|
234
|
-
async signIn(request: { email: string; password: string }): Promise<{ session: types.Session; requiresTwoFactor: boolean
|
|
249
|
+
async signIn(request: { email: string; password: string }): Promise<{ user: types.User; session: types.Session; requiresTwoFactor: boolean }> {
|
|
235
250
|
const path = '/signin';
|
|
236
251
|
return this.request<{ user: types.User; session: types.Session; requiresTwoFactor: boolean }>('POST', path, {
|
|
237
252
|
body: request,
|
package/src/index.ts
CHANGED
|
@@ -7,31 +7,31 @@ export * from './errors';
|
|
|
7
7
|
|
|
8
8
|
// Plugin exports
|
|
9
9
|
export { AdminPlugin, adminClient } from './plugins/admin';
|
|
10
|
+
export { PermissionsPlugin, permissionsClient } from './plugins/permissions';
|
|
11
|
+
export { WebhookPlugin, webhookClient } from './plugins/webhook';
|
|
10
12
|
export { CmsPlugin, cmsClient } from './plugins/cms';
|
|
13
|
+
export { EmailverificationPlugin, emailverificationClient } from './plugins/emailverification';
|
|
14
|
+
export { IdverificationPlugin, idverificationClient } from './plugins/idverification';
|
|
15
|
+
export { MagiclinkPlugin, magiclinkClient } from './plugins/magiclink';
|
|
16
|
+
export { NotificationPlugin, notificationClient } from './plugins/notification';
|
|
17
|
+
export { TwofaPlugin, twofaClient } from './plugins/twofa';
|
|
18
|
+
export { ApikeyPlugin, apikeyClient } from './plugins/apikey';
|
|
19
|
+
export { EmailotpPlugin, emailotpClient } from './plugins/emailotp';
|
|
20
|
+
export { BackupauthPlugin, backupauthClient } from './plugins/backupauth';
|
|
11
21
|
export { CompliancePlugin, complianceClient } from './plugins/compliance';
|
|
12
22
|
export { StepupPlugin, stepupClient } from './plugins/stepup';
|
|
23
|
+
export { MfaPlugin, mfaClient } from './plugins/mfa';
|
|
24
|
+
export { MultiappPlugin, multiappClient } from './plugins/multiapp';
|
|
25
|
+
export { PhonePlugin, phoneClient } from './plugins/phone';
|
|
26
|
+
export { AnonymousPlugin, anonymousClient } from './plugins/anonymous';
|
|
13
27
|
export { PasskeyPlugin, passkeyClient } from './plugins/passkey';
|
|
14
|
-
export {
|
|
15
|
-
export { EmailverificationPlugin, emailverificationClient } from './plugins/emailverification';
|
|
28
|
+
export { UsernamePlugin, usernameClient } from './plugins/username';
|
|
16
29
|
export { MultisessionPlugin, multisessionClient } from './plugins/multisession';
|
|
30
|
+
export { ConsentPlugin, consentClient } from './plugins/consent';
|
|
31
|
+
export { ImpersonationPlugin, impersonationClient } from './plugins/impersonation';
|
|
17
32
|
export { OidcproviderPlugin, oidcproviderClient } from './plugins/oidcprovider';
|
|
18
33
|
export { OrganizationPlugin, organizationClient } from './plugins/organization';
|
|
19
|
-
export { WebhookPlugin, webhookClient } from './plugins/webhook';
|
|
20
|
-
export { ImpersonationPlugin, impersonationClient } from './plugins/impersonation';
|
|
21
|
-
export { MagiclinkPlugin, magiclinkClient } from './plugins/magiclink';
|
|
22
|
-
export { SecretsPlugin, secretsClient } from './plugins/secrets';
|
|
23
34
|
export { SsoPlugin, ssoClient } from './plugins/sso';
|
|
24
|
-
export {
|
|
25
|
-
export { BackupauthPlugin, backupauthClient } from './plugins/backupauth';
|
|
26
|
-
export { IdverificationPlugin, idverificationClient } from './plugins/idverification';
|
|
27
|
-
export { TwofaPlugin, twofaClient } from './plugins/twofa';
|
|
28
|
-
export { EmailotpPlugin, emailotpClient } from './plugins/emailotp';
|
|
29
|
-
export { NotificationPlugin, notificationClient } from './plugins/notification';
|
|
30
|
-
export { PermissionsPlugin, permissionsClient } from './plugins/permissions';
|
|
31
|
-
export { UsernamePlugin, usernameClient } from './plugins/username';
|
|
32
|
-
export { ConsentPlugin, consentClient } from './plugins/consent';
|
|
33
|
-
export { MfaPlugin, mfaClient } from './plugins/mfa';
|
|
35
|
+
export { SecretsPlugin, secretsClient } from './plugins/secrets';
|
|
34
36
|
export { SocialPlugin, socialClient } from './plugins/social';
|
|
35
37
|
export { JwtPlugin, jwtClient } from './plugins/jwt';
|
|
36
|
-
export { MultiappPlugin, multiappClient } from './plugins/multiapp';
|
|
37
|
-
export { PhonePlugin, phoneClient } from './plugins/phone';
|
package/src/plugins/admin.ts
CHANGED
|
@@ -12,68 +12,58 @@ export class AdminPlugin implements ClientPlugin {
|
|
|
12
12
|
this.client = client;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
async createUser(
|
|
16
|
-
const path = '/users';
|
|
17
|
-
return this.client.request<void>('POST', path
|
|
18
|
-
body: request,
|
|
19
|
-
});
|
|
15
|
+
async createUser(): Promise<void> {
|
|
16
|
+
const path = '/admin/users';
|
|
17
|
+
return this.client.request<void>('POST', path);
|
|
20
18
|
}
|
|
21
19
|
|
|
22
20
|
async listUsers(): Promise<void> {
|
|
23
|
-
const path = '/users';
|
|
21
|
+
const path = '/admin/users';
|
|
24
22
|
return this.client.request<void>('GET', path);
|
|
25
23
|
}
|
|
26
24
|
|
|
27
25
|
async deleteUser(params: { id: string }): Promise<types.MessageResponse> {
|
|
28
|
-
const path = `/users/${params.id}`;
|
|
26
|
+
const path = `/admin/users/${params.id}`;
|
|
29
27
|
return this.client.request<types.MessageResponse>('DELETE', path);
|
|
30
28
|
}
|
|
31
29
|
|
|
32
|
-
async banUser(params: { id: string }
|
|
33
|
-
const path = `/users/${params.id}/ban`;
|
|
34
|
-
return this.client.request<types.MessageResponse>('POST', path
|
|
35
|
-
body: request,
|
|
36
|
-
});
|
|
30
|
+
async banUser(params: { id: string }): Promise<types.MessageResponse> {
|
|
31
|
+
const path = `/admin/users/${params.id}/ban`;
|
|
32
|
+
return this.client.request<types.MessageResponse>('POST', path);
|
|
37
33
|
}
|
|
38
34
|
|
|
39
|
-
async unbanUser(params: { id: string }
|
|
40
|
-
const path = `/users/${params.id}/unban`;
|
|
41
|
-
return this.client.request<types.MessageResponse>('POST', path
|
|
42
|
-
body: request,
|
|
43
|
-
});
|
|
35
|
+
async unbanUser(params: { id: string }): Promise<types.MessageResponse> {
|
|
36
|
+
const path = `/admin/users/${params.id}/unban`;
|
|
37
|
+
return this.client.request<types.MessageResponse>('POST', path);
|
|
44
38
|
}
|
|
45
39
|
|
|
46
|
-
async impersonateUser(params: { id: string }
|
|
47
|
-
const path = `/users/${params.id}/impersonate`;
|
|
48
|
-
return this.client.request<void>('POST', path
|
|
49
|
-
body: request,
|
|
50
|
-
});
|
|
40
|
+
async impersonateUser(params: { id: string }): Promise<void> {
|
|
41
|
+
const path = `/admin/users/${params.id}/impersonate`;
|
|
42
|
+
return this.client.request<void>('POST', path);
|
|
51
43
|
}
|
|
52
44
|
|
|
53
|
-
async setUserRole(params: { id: string }
|
|
54
|
-
const path = `/users/${params.id}/role`;
|
|
55
|
-
return this.client.request<types.MessageResponse>('POST', path
|
|
56
|
-
body: request,
|
|
57
|
-
});
|
|
45
|
+
async setUserRole(params: { id: string }): Promise<types.MessageResponse> {
|
|
46
|
+
const path = `/admin/users/${params.id}/role`;
|
|
47
|
+
return this.client.request<types.MessageResponse>('POST', path);
|
|
58
48
|
}
|
|
59
49
|
|
|
60
50
|
async listSessions(): Promise<void> {
|
|
61
|
-
const path = '/sessions';
|
|
51
|
+
const path = '/admin/sessions';
|
|
62
52
|
return this.client.request<void>('GET', path);
|
|
63
53
|
}
|
|
64
54
|
|
|
65
55
|
async revokeSession(params: { id: string }): Promise<types.MessageResponse> {
|
|
66
|
-
const path = `/sessions/${params.id}`;
|
|
56
|
+
const path = `/admin/sessions/${params.id}`;
|
|
67
57
|
return this.client.request<types.MessageResponse>('DELETE', path);
|
|
68
58
|
}
|
|
69
59
|
|
|
70
60
|
async getStats(): Promise<void> {
|
|
71
|
-
const path = '/stats';
|
|
61
|
+
const path = '/admin/stats';
|
|
72
62
|
return this.client.request<void>('GET', path);
|
|
73
63
|
}
|
|
74
64
|
|
|
75
65
|
async getAuditLogs(): Promise<void> {
|
|
76
|
-
const path = '/audit-logs';
|
|
66
|
+
const path = '/admin/audit-logs';
|
|
77
67
|
return this.client.request<void>('GET', path);
|
|
78
68
|
}
|
|
79
69
|
|
package/src/plugins/anonymous.ts
CHANGED
|
@@ -12,9 +12,11 @@ export class AnonymousPlugin implements ClientPlugin {
|
|
|
12
12
|
this.client = client;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
async signIn(): Promise<types.SignInResponse> {
|
|
15
|
+
async signIn(request: types.SignInRequest): Promise<types.SignInResponse> {
|
|
16
16
|
const path = '/anonymous/signin';
|
|
17
|
-
return this.client.request<types.SignInResponse>('POST', path
|
|
17
|
+
return this.client.request<types.SignInResponse>('POST', path, {
|
|
18
|
+
body: request,
|
|
19
|
+
});
|
|
18
20
|
}
|
|
19
21
|
|
|
20
22
|
async link(request: types.LinkRequest): Promise<types.LinkResponse> {
|
package/src/plugins/apikey.ts
CHANGED
|
@@ -12,39 +12,53 @@ export class ApikeyPlugin implements ClientPlugin {
|
|
|
12
12
|
this.client = client;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
async createAPIKey(): Promise<
|
|
16
|
-
const path = '/createapikey';
|
|
17
|
-
return this.client.request<
|
|
15
|
+
async createAPIKey(request: types.CreateAPIKeyRequest): Promise<types.CreateAPIKeyResponse> {
|
|
16
|
+
const path = '/api-keys/createapikey';
|
|
17
|
+
return this.client.request<types.CreateAPIKeyResponse>('POST', path, {
|
|
18
|
+
body: request,
|
|
19
|
+
});
|
|
18
20
|
}
|
|
19
21
|
|
|
20
|
-
async rotateAPIKey(params: { id: string }): Promise<
|
|
21
|
-
const path =
|
|
22
|
-
return this.client.request<
|
|
22
|
+
async rotateAPIKey(params: { id: string }, request: types.RotateAPIKeyRequest): Promise<types.RotateAPIKeyResponse> {
|
|
23
|
+
const path = `/api-keys/${params.id}/rotate`;
|
|
24
|
+
return this.client.request<types.RotateAPIKeyResponse>('POST', path, {
|
|
25
|
+
body: request,
|
|
26
|
+
});
|
|
23
27
|
}
|
|
24
28
|
|
|
25
|
-
async listAPIKeys(): Promise<
|
|
26
|
-
const path = '/listapikeys';
|
|
27
|
-
return this.client.request<
|
|
29
|
+
async listAPIKeys(request?: types.ListAPIKeysRequest): Promise<types.ListAPIKeysResponse> {
|
|
30
|
+
const path = '/api-keys/listapikeys';
|
|
31
|
+
return this.client.request<types.ListAPIKeysResponse>('GET', path, {
|
|
32
|
+
query: this.client.toQueryParams(request),
|
|
33
|
+
});
|
|
28
34
|
}
|
|
29
35
|
|
|
30
|
-
async getAPIKey(params: { id: string }): Promise<
|
|
31
|
-
const path =
|
|
32
|
-
return this.client.request<
|
|
36
|
+
async getAPIKey(params: { id: string }, request?: types.GetAPIKeyRequest): Promise<types.APIKey> {
|
|
37
|
+
const path = `/api-keys/${params.id}`;
|
|
38
|
+
return this.client.request<types.APIKey>('GET', path, {
|
|
39
|
+
query: this.client.toQueryParams(request),
|
|
40
|
+
});
|
|
33
41
|
}
|
|
34
42
|
|
|
35
|
-
async updateAPIKey(params: { id: string }): Promise<
|
|
36
|
-
const path =
|
|
37
|
-
return this.client.request<
|
|
43
|
+
async updateAPIKey(params: { id: string }, request: types.UpdateAPIKeyRequest): Promise<types.APIKey> {
|
|
44
|
+
const path = `/api-keys/${params.id}`;
|
|
45
|
+
return this.client.request<types.APIKey>('PUT', path, {
|
|
46
|
+
body: request,
|
|
47
|
+
});
|
|
38
48
|
}
|
|
39
49
|
|
|
40
|
-
async deleteAPIKey(params: { id: string }): Promise<types.MessageResponse> {
|
|
41
|
-
const path =
|
|
42
|
-
return this.client.request<types.MessageResponse>('DELETE', path
|
|
50
|
+
async deleteAPIKey(params: { id: string }, request?: types.DeleteAPIKeyRequest): Promise<types.MessageResponse> {
|
|
51
|
+
const path = `/api-keys/${params.id}`;
|
|
52
|
+
return this.client.request<types.MessageResponse>('DELETE', path, {
|
|
53
|
+
query: this.client.toQueryParams(request),
|
|
54
|
+
});
|
|
43
55
|
}
|
|
44
56
|
|
|
45
|
-
async verifyAPIKey(): Promise<
|
|
46
|
-
const path = '/verify';
|
|
47
|
-
return this.client.request<
|
|
57
|
+
async verifyAPIKey(request: types.VerifyAPIKeyRequest): Promise<types.VerifyAPIKeyResponse> {
|
|
58
|
+
const path = '/api-keys/verify';
|
|
59
|
+
return this.client.request<types.VerifyAPIKeyResponse>('POST', path, {
|
|
60
|
+
body: request,
|
|
61
|
+
});
|
|
48
62
|
}
|
|
49
63
|
|
|
50
64
|
}
|