@authsome/client 0.0.3 → 0.0.5
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 +90 -37
- package/dist/client.js +79 -17
- package/dist/index.d.ts +21 -17
- package/dist/index.js +65 -53
- package/dist/plugins/admin.d.ts +19 -7
- package/dist/plugins/admin.js +18 -28
- package/dist/plugins/anonymous.d.ts +1 -1
- package/dist/plugins/anonymous.js +4 -2
- package/dist/plugins/apikey.d.ts +15 -7
- package/dist/plugins/apikey.js +29 -17
- package/dist/plugins/backupauth.d.ts +38 -28
- package/dist/plugins/backupauth.js +10 -10
- package/dist/plugins/cms.d.ts +54 -0
- package/dist/plugins/cms.js +149 -0
- package/dist/plugins/compliance.d.ts +93 -33
- package/dist/plugins/compliance.js +63 -61
- package/dist/plugins/consent.d.ts +34 -18
- package/dist/plugins/consent.js +16 -16
- package/dist/plugins/emailverification.d.ts +12 -0
- package/dist/plugins/emailverification.js +35 -0
- package/dist/plugins/idverification.d.ts +25 -11
- package/dist/plugins/idverification.js +14 -14
- package/dist/plugins/impersonation.d.ts +8 -6
- package/dist/plugins/impersonation.js +6 -10
- package/dist/plugins/jwt.d.ts +6 -5
- package/dist/plugins/jwt.js +16 -8
- package/dist/plugins/mfa.d.ts +26 -12
- package/dist/plugins/mfa.js +17 -21
- package/dist/plugins/multiapp.d.ts +46 -19
- package/dist/plugins/multiapp.js +40 -32
- package/dist/plugins/multisession.d.ts +13 -3
- package/dist/plugins/multisession.js +32 -4
- package/dist/plugins/notification.d.ts +31 -15
- package/dist/plugins/notification.js +27 -21
- package/dist/plugins/oidcprovider.d.ts +18 -12
- package/dist/plugins/oidcprovider.js +18 -12
- package/dist/plugins/organization.d.ts +32 -12
- package/dist/plugins/organization.js +20 -20
- package/dist/plugins/passkey.d.ts +6 -2
- package/dist/plugins/passkey.js +4 -4
- package/dist/plugins/permissions.d.ts +12 -0
- package/dist/plugins/permissions.js +33 -0
- package/dist/plugins/secrets.d.ts +33 -0
- package/dist/plugins/secrets.js +79 -0
- package/dist/plugins/social.d.ts +11 -2
- package/dist/plugins/social.js +7 -5
- package/dist/plugins/sso.d.ts +12 -4
- package/dist/plugins/sso.js +8 -8
- package/dist/plugins/stepup.d.ts +23 -13
- package/dist/plugins/stepup.js +10 -10
- 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/types.d.ts +3443 -2470
- package/package.json +2 -1
- package/src/client.ts +111 -37
- package/src/index.ts +21 -17
- package/src/plugins/admin.ts +18 -28
- package/src/plugins/anonymous.ts +4 -2
- package/src/plugins/apikey.ts +30 -18
- package/src/plugins/backupauth.ts +61 -61
- package/src/plugins/cms.ts +180 -0
- package/src/plugins/compliance.ts +98 -96
- package/src/plugins/consent.ts +44 -44
- package/src/plugins/emailverification.ts +40 -0
- package/src/plugins/idverification.ts +29 -29
- package/src/plugins/impersonation.ts +13 -17
- package/src/plugins/jwt.ts +18 -10
- package/src/plugins/mfa.ts +28 -32
- package/src/plugins/multiapp.ts +59 -51
- package/src/plugins/multisession.ts +39 -5
- package/src/plugins/notification.ts +44 -38
- package/src/plugins/oidcprovider.ts +32 -26
- package/src/plugins/organization.ts +27 -27
- package/src/plugins/passkey.ts +4 -4
- package/src/plugins/permissions.ts +38 -0
- package/src/plugins/secrets.ts +92 -0
- package/src/plugins/social.ts +7 -5
- package/src/plugins/sso.ts +8 -8
- package/src/plugins/stepup.ts +31 -31
- package/src/plugins/twofa.ts +12 -24
- package/src/plugins/username.ts +8 -4
- package/src/types.ts +3773 -2545
- package/authsome-client-0.0.2.tgz +0 -0
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@authsome/client",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
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
|
+
"publish": "npm publish --access public",
|
|
9
10
|
"prepublishOnly": "npm run build"
|
|
10
11
|
},
|
|
11
12
|
"keywords": ["authsome", "authentication", "client"],
|
package/src/client.ts
CHANGED
|
@@ -3,31 +3,35 @@
|
|
|
3
3
|
import { ClientPlugin } from './plugin';
|
|
4
4
|
import { createErrorFromResponse } from './errors';
|
|
5
5
|
import * as types from './types';
|
|
6
|
-
import {
|
|
7
|
-
import { NotificationPlugin } from './plugins/notification';
|
|
8
|
-
import { PasskeyPlugin } from './plugins/passkey';
|
|
6
|
+
import { SsoPlugin } from './plugins/sso';
|
|
9
7
|
import { UsernamePlugin } from './plugins/username';
|
|
10
|
-
import {
|
|
8
|
+
import { WebhookPlugin } from './plugins/webhook';
|
|
9
|
+
import { EmailverificationPlugin } from './plugins/emailverification';
|
|
11
10
|
import { BackupauthPlugin } from './plugins/backupauth';
|
|
12
|
-
import {
|
|
11
|
+
import { JwtPlugin } from './plugins/jwt';
|
|
12
|
+
import { SecretsPlugin } from './plugins/secrets';
|
|
13
|
+
import { EmailotpPlugin } from './plugins/emailotp';
|
|
13
14
|
import { IdverificationPlugin } from './plugins/idverification';
|
|
14
|
-
import {
|
|
15
|
+
import { MultisessionPlugin } from './plugins/multisession';
|
|
15
16
|
import { OidcproviderPlugin } from './plugins/oidcprovider';
|
|
16
|
-
import { PhonePlugin } from './plugins/phone';
|
|
17
|
-
import { AdminPlugin } from './plugins/admin';
|
|
18
|
-
import { EmailotpPlugin } from './plugins/emailotp';
|
|
19
|
-
import { MfaPlugin } from './plugins/mfa';
|
|
20
|
-
import { OrganizationPlugin } from './plugins/organization';
|
|
21
|
-
import { SocialPlugin } from './plugins/social';
|
|
22
|
-
import { SsoPlugin } from './plugins/sso';
|
|
23
17
|
import { AnonymousPlugin } from './plugins/anonymous';
|
|
24
|
-
import {
|
|
25
|
-
import { JwtPlugin } from './plugins/jwt';
|
|
26
|
-
import { MultisessionPlugin } from './plugins/multisession';
|
|
18
|
+
import { MfaPlugin } from './plugins/mfa';
|
|
27
19
|
import { TwofaPlugin } from './plugins/twofa';
|
|
28
|
-
import {
|
|
20
|
+
import { AdminPlugin } from './plugins/admin';
|
|
21
|
+
import { ApikeyPlugin } from './plugins/apikey';
|
|
29
22
|
import { CompliancePlugin } from './plugins/compliance';
|
|
23
|
+
import { ConsentPlugin } from './plugins/consent';
|
|
24
|
+
import { MagiclinkPlugin } from './plugins/magiclink';
|
|
25
|
+
import { CmsPlugin } from './plugins/cms';
|
|
26
|
+
import { PermissionsPlugin } from './plugins/permissions';
|
|
27
|
+
import { StepupPlugin } from './plugins/stepup';
|
|
30
28
|
import { ImpersonationPlugin } from './plugins/impersonation';
|
|
29
|
+
import { MultiappPlugin } from './plugins/multiapp';
|
|
30
|
+
import { PasskeyPlugin } from './plugins/passkey';
|
|
31
|
+
import { SocialPlugin } from './plugins/social';
|
|
32
|
+
import { NotificationPlugin } from './plugins/notification';
|
|
33
|
+
import { OrganizationPlugin } from './plugins/organization';
|
|
34
|
+
import { PhonePlugin } from './plugins/phone';
|
|
31
35
|
|
|
32
36
|
/**
|
|
33
37
|
* AuthSome client configuration
|
|
@@ -126,6 +130,21 @@ export class AuthsomeClient {
|
|
|
126
130
|
this.basePath = basePath;
|
|
127
131
|
}
|
|
128
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
|
+
|
|
129
148
|
/**
|
|
130
149
|
* Set global headers for all requests
|
|
131
150
|
* @param headers - Headers to set
|
|
@@ -144,31 +163,35 @@ export class AuthsomeClient {
|
|
|
144
163
|
}
|
|
145
164
|
|
|
146
165
|
public readonly $plugins = {
|
|
147
|
-
|
|
148
|
-
notification: (): NotificationPlugin | undefined => this.getPlugin<NotificationPlugin>('notification'),
|
|
149
|
-
passkey: (): PasskeyPlugin | undefined => this.getPlugin<PasskeyPlugin>('passkey'),
|
|
166
|
+
sso: (): SsoPlugin | undefined => this.getPlugin<SsoPlugin>('sso'),
|
|
150
167
|
username: (): UsernamePlugin | undefined => this.getPlugin<UsernamePlugin>('username'),
|
|
151
|
-
|
|
168
|
+
webhook: (): WebhookPlugin | undefined => this.getPlugin<WebhookPlugin>('webhook'),
|
|
169
|
+
emailverification: (): EmailverificationPlugin | undefined => this.getPlugin<EmailverificationPlugin>('emailverification'),
|
|
152
170
|
backupauth: (): BackupauthPlugin | undefined => this.getPlugin<BackupauthPlugin>('backupauth'),
|
|
153
|
-
|
|
171
|
+
jwt: (): JwtPlugin | undefined => this.getPlugin<JwtPlugin>('jwt'),
|
|
172
|
+
secrets: (): SecretsPlugin | undefined => this.getPlugin<SecretsPlugin>('secrets'),
|
|
173
|
+
emailotp: (): EmailotpPlugin | undefined => this.getPlugin<EmailotpPlugin>('emailotp'),
|
|
154
174
|
idverification: (): IdverificationPlugin | undefined => this.getPlugin<IdverificationPlugin>('idverification'),
|
|
155
|
-
|
|
175
|
+
multisession: (): MultisessionPlugin | undefined => this.getPlugin<MultisessionPlugin>('multisession'),
|
|
156
176
|
oidcprovider: (): OidcproviderPlugin | undefined => this.getPlugin<OidcproviderPlugin>('oidcprovider'),
|
|
157
|
-
phone: (): PhonePlugin | undefined => this.getPlugin<PhonePlugin>('phone'),
|
|
158
|
-
admin: (): AdminPlugin | undefined => this.getPlugin<AdminPlugin>('admin'),
|
|
159
|
-
emailotp: (): EmailotpPlugin | undefined => this.getPlugin<EmailotpPlugin>('emailotp'),
|
|
160
|
-
mfa: (): MfaPlugin | undefined => this.getPlugin<MfaPlugin>('mfa'),
|
|
161
|
-
organization: (): OrganizationPlugin | undefined => this.getPlugin<OrganizationPlugin>('organization'),
|
|
162
|
-
social: (): SocialPlugin | undefined => this.getPlugin<SocialPlugin>('social'),
|
|
163
|
-
sso: (): SsoPlugin | undefined => this.getPlugin<SsoPlugin>('sso'),
|
|
164
177
|
anonymous: (): AnonymousPlugin | undefined => this.getPlugin<AnonymousPlugin>('anonymous'),
|
|
165
|
-
|
|
166
|
-
jwt: (): JwtPlugin | undefined => this.getPlugin<JwtPlugin>('jwt'),
|
|
167
|
-
multisession: (): MultisessionPlugin | undefined => this.getPlugin<MultisessionPlugin>('multisession'),
|
|
178
|
+
mfa: (): MfaPlugin | undefined => this.getPlugin<MfaPlugin>('mfa'),
|
|
168
179
|
twofa: (): TwofaPlugin | undefined => this.getPlugin<TwofaPlugin>('twofa'),
|
|
169
|
-
|
|
180
|
+
admin: (): AdminPlugin | undefined => this.getPlugin<AdminPlugin>('admin'),
|
|
181
|
+
apikey: (): ApikeyPlugin | undefined => this.getPlugin<ApikeyPlugin>('apikey'),
|
|
170
182
|
compliance: (): CompliancePlugin | undefined => this.getPlugin<CompliancePlugin>('compliance'),
|
|
183
|
+
consent: (): ConsentPlugin | undefined => this.getPlugin<ConsentPlugin>('consent'),
|
|
184
|
+
magiclink: (): MagiclinkPlugin | undefined => this.getPlugin<MagiclinkPlugin>('magiclink'),
|
|
185
|
+
cms: (): CmsPlugin | undefined => this.getPlugin<CmsPlugin>('cms'),
|
|
186
|
+
permissions: (): PermissionsPlugin | undefined => this.getPlugin<PermissionsPlugin>('permissions'),
|
|
187
|
+
stepup: (): StepupPlugin | undefined => this.getPlugin<StepupPlugin>('stepup'),
|
|
171
188
|
impersonation: (): ImpersonationPlugin | undefined => this.getPlugin<ImpersonationPlugin>('impersonation'),
|
|
189
|
+
multiapp: (): MultiappPlugin | undefined => this.getPlugin<MultiappPlugin>('multiapp'),
|
|
190
|
+
passkey: (): PasskeyPlugin | undefined => this.getPlugin<PasskeyPlugin>('passkey'),
|
|
191
|
+
social: (): SocialPlugin | undefined => this.getPlugin<SocialPlugin>('social'),
|
|
192
|
+
notification: (): NotificationPlugin | undefined => this.getPlugin<NotificationPlugin>('notification'),
|
|
193
|
+
organization: (): OrganizationPlugin | undefined => this.getPlugin<OrganizationPlugin>('organization'),
|
|
194
|
+
phone: (): PhonePlugin | undefined => this.getPlugin<PhonePlugin>('phone'),
|
|
172
195
|
};
|
|
173
196
|
|
|
174
197
|
public async request<T>(
|
|
@@ -244,7 +267,7 @@ export class AuthsomeClient {
|
|
|
244
267
|
});
|
|
245
268
|
}
|
|
246
269
|
|
|
247
|
-
async updateUser(request: {
|
|
270
|
+
async updateUser(request: { name?: string; email?: string }): Promise<{ user: types.User }> {
|
|
248
271
|
const path = '/user/update';
|
|
249
272
|
return this.request<{ user: types.User }>('POST', path, {
|
|
250
273
|
body: request,
|
|
@@ -259,12 +282,63 @@ export class AuthsomeClient {
|
|
|
259
282
|
});
|
|
260
283
|
}
|
|
261
284
|
|
|
262
|
-
async revokeDevice(request: {
|
|
285
|
+
async revokeDevice(request: { fingerprint: string }): Promise<{ status: string }> {
|
|
263
286
|
const path = '/devices/revoke';
|
|
264
|
-
return this.request<{
|
|
287
|
+
return this.request<{ status: string }>('POST', path, {
|
|
288
|
+
body: request,
|
|
289
|
+
auth: true,
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
async refreshSession(request: { refreshToken: string }): Promise<{ refreshExpiresAt: string; session: any; accessToken: string; refreshToken: string; expiresAt: string }> {
|
|
294
|
+
const path = '/refresh';
|
|
295
|
+
return this.request<{ session: any; accessToken: string; refreshToken: string; expiresAt: string; refreshExpiresAt: string }>('POST', path, {
|
|
296
|
+
body: request,
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
async requestPasswordReset(request: { email: string }): Promise<{ message: string }> {
|
|
301
|
+
const path = '/password/reset/request';
|
|
302
|
+
return this.request<{ message: string }>('POST', path, {
|
|
303
|
+
body: request,
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
async resetPassword(request: { token: string; newPassword: string }): Promise<{ message: string }> {
|
|
308
|
+
const path = '/password/reset/confirm';
|
|
309
|
+
return this.request<{ message: string }>('POST', path, {
|
|
310
|
+
body: request,
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
async validateResetToken(query?: { token?: string }): Promise<{ valid: boolean }> {
|
|
315
|
+
const path = '/password/reset/validate';
|
|
316
|
+
return this.request<{ valid: boolean }>('GET', path, {
|
|
317
|
+
query,
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
async changePassword(request: { oldPassword: string; newPassword: string }): Promise<{ message: string }> {
|
|
322
|
+
const path = '/password/change';
|
|
323
|
+
return this.request<{ message: string }>('POST', path, {
|
|
265
324
|
body: request,
|
|
266
325
|
auth: true,
|
|
267
326
|
});
|
|
268
327
|
}
|
|
269
328
|
|
|
329
|
+
async requestEmailChange(request: { newEmail: string }): Promise<{ message: string }> {
|
|
330
|
+
const path = '/email/change/request';
|
|
331
|
+
return this.request<{ message: string }>('POST', path, {
|
|
332
|
+
body: request,
|
|
333
|
+
auth: true,
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
async confirmEmailChange(request: { token: string }): Promise<{ message: string }> {
|
|
338
|
+
const path = '/email/change/confirm';
|
|
339
|
+
return this.request<{ message: string }>('POST', path, {
|
|
340
|
+
body: request,
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
|
|
270
344
|
}
|
package/src/index.ts
CHANGED
|
@@ -6,28 +6,32 @@ export * from './types';
|
|
|
6
6
|
export * from './errors';
|
|
7
7
|
|
|
8
8
|
// Plugin exports
|
|
9
|
-
export {
|
|
10
|
-
export { NotificationPlugin, notificationClient } from './plugins/notification';
|
|
11
|
-
export { PasskeyPlugin, passkeyClient } from './plugins/passkey';
|
|
9
|
+
export { SsoPlugin, ssoClient } from './plugins/sso';
|
|
12
10
|
export { UsernamePlugin, usernameClient } from './plugins/username';
|
|
13
|
-
export {
|
|
11
|
+
export { WebhookPlugin, webhookClient } from './plugins/webhook';
|
|
12
|
+
export { EmailverificationPlugin, emailverificationClient } from './plugins/emailverification';
|
|
14
13
|
export { BackupauthPlugin, backupauthClient } from './plugins/backupauth';
|
|
15
|
-
export {
|
|
14
|
+
export { JwtPlugin, jwtClient } from './plugins/jwt';
|
|
15
|
+
export { SecretsPlugin, secretsClient } from './plugins/secrets';
|
|
16
|
+
export { EmailotpPlugin, emailotpClient } from './plugins/emailotp';
|
|
16
17
|
export { IdverificationPlugin, idverificationClient } from './plugins/idverification';
|
|
17
|
-
export {
|
|
18
|
+
export { MultisessionPlugin, multisessionClient } from './plugins/multisession';
|
|
18
19
|
export { OidcproviderPlugin, oidcproviderClient } from './plugins/oidcprovider';
|
|
19
|
-
export { PhonePlugin, phoneClient } from './plugins/phone';
|
|
20
|
-
export { AdminPlugin, adminClient } from './plugins/admin';
|
|
21
|
-
export { EmailotpPlugin, emailotpClient } from './plugins/emailotp';
|
|
22
|
-
export { MfaPlugin, mfaClient } from './plugins/mfa';
|
|
23
|
-
export { OrganizationPlugin, organizationClient } from './plugins/organization';
|
|
24
|
-
export { SocialPlugin, socialClient } from './plugins/social';
|
|
25
|
-
export { SsoPlugin, ssoClient } from './plugins/sso';
|
|
26
20
|
export { AnonymousPlugin, anonymousClient } from './plugins/anonymous';
|
|
27
|
-
export {
|
|
28
|
-
export { JwtPlugin, jwtClient } from './plugins/jwt';
|
|
29
|
-
export { MultisessionPlugin, multisessionClient } from './plugins/multisession';
|
|
21
|
+
export { MfaPlugin, mfaClient } from './plugins/mfa';
|
|
30
22
|
export { TwofaPlugin, twofaClient } from './plugins/twofa';
|
|
31
|
-
export {
|
|
23
|
+
export { AdminPlugin, adminClient } from './plugins/admin';
|
|
24
|
+
export { ApikeyPlugin, apikeyClient } from './plugins/apikey';
|
|
32
25
|
export { CompliancePlugin, complianceClient } from './plugins/compliance';
|
|
26
|
+
export { ConsentPlugin, consentClient } from './plugins/consent';
|
|
27
|
+
export { MagiclinkPlugin, magiclinkClient } from './plugins/magiclink';
|
|
28
|
+
export { CmsPlugin, cmsClient } from './plugins/cms';
|
|
29
|
+
export { PermissionsPlugin, permissionsClient } from './plugins/permissions';
|
|
30
|
+
export { StepupPlugin, stepupClient } from './plugins/stepup';
|
|
33
31
|
export { ImpersonationPlugin, impersonationClient } from './plugins/impersonation';
|
|
32
|
+
export { MultiappPlugin, multiappClient } from './plugins/multiapp';
|
|
33
|
+
export { PasskeyPlugin, passkeyClient } from './plugins/passkey';
|
|
34
|
+
export { SocialPlugin, socialClient } from './plugins/social';
|
|
35
|
+
export { NotificationPlugin, notificationClient } from './plugins/notification';
|
|
36
|
+
export { OrganizationPlugin, organizationClient } from './plugins/organization';
|
|
37
|
+
export { PhonePlugin, phoneClient } from './plugins/phone';
|
package/src/plugins/admin.ts
CHANGED
|
@@ -12,11 +12,9 @@ export class AdminPlugin implements ClientPlugin {
|
|
|
12
12
|
this.client = client;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
async createUser(
|
|
15
|
+
async createUser(): Promise<void> {
|
|
16
16
|
const path = '/users';
|
|
17
|
-
return this.client.request<void>('POST', path
|
|
18
|
-
body: request,
|
|
19
|
-
});
|
|
17
|
+
return this.client.request<void>('POST', path);
|
|
20
18
|
}
|
|
21
19
|
|
|
22
20
|
async listUsers(): Promise<void> {
|
|
@@ -24,37 +22,29 @@ export class AdminPlugin implements ClientPlugin {
|
|
|
24
22
|
return this.client.request<void>('GET', path);
|
|
25
23
|
}
|
|
26
24
|
|
|
27
|
-
async deleteUser(): Promise<types.MessageResponse> {
|
|
28
|
-
const path =
|
|
25
|
+
async deleteUser(params: { id: string }): Promise<types.MessageResponse> {
|
|
26
|
+
const path = `/users/${params.id}`;
|
|
29
27
|
return this.client.request<types.MessageResponse>('DELETE', path);
|
|
30
28
|
}
|
|
31
29
|
|
|
32
|
-
async banUser(
|
|
33
|
-
const path =
|
|
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 = `/users/${params.id}/ban`;
|
|
32
|
+
return this.client.request<types.MessageResponse>('POST', path);
|
|
37
33
|
}
|
|
38
34
|
|
|
39
|
-
async unbanUser(
|
|
40
|
-
const path =
|
|
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 = `/users/${params.id}/unban`;
|
|
37
|
+
return this.client.request<types.MessageResponse>('POST', path);
|
|
44
38
|
}
|
|
45
39
|
|
|
46
|
-
async impersonateUser(
|
|
47
|
-
const path =
|
|
48
|
-
return this.client.request<void>('POST', path
|
|
49
|
-
body: request,
|
|
50
|
-
});
|
|
40
|
+
async impersonateUser(params: { id: string }): Promise<void> {
|
|
41
|
+
const path = `/users/${params.id}/impersonate`;
|
|
42
|
+
return this.client.request<void>('POST', path);
|
|
51
43
|
}
|
|
52
44
|
|
|
53
|
-
async setUserRole(
|
|
54
|
-
const path =
|
|
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 = `/users/${params.id}/role`;
|
|
47
|
+
return this.client.request<types.MessageResponse>('POST', path);
|
|
58
48
|
}
|
|
59
49
|
|
|
60
50
|
async listSessions(): Promise<void> {
|
|
@@ -62,8 +52,8 @@ export class AdminPlugin implements ClientPlugin {
|
|
|
62
52
|
return this.client.request<void>('GET', path);
|
|
63
53
|
}
|
|
64
54
|
|
|
65
|
-
async revokeSession(): Promise<types.MessageResponse> {
|
|
66
|
-
const path =
|
|
55
|
+
async revokeSession(params: { id: string }): Promise<types.MessageResponse> {
|
|
56
|
+
const path = `/sessions/${params.id}`;
|
|
67
57
|
return this.client.request<types.MessageResponse>('DELETE', path);
|
|
68
58
|
}
|
|
69
59
|
|
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,41 +12,53 @@ export class ApikeyPlugin implements ClientPlugin {
|
|
|
12
12
|
this.client = client;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
async createAPIKey(request: types.
|
|
15
|
+
async createAPIKey(request: types.CreateAPIKeyRequest): Promise<types.CreateAPIKeyResponse> {
|
|
16
16
|
const path = '/createapikey';
|
|
17
17
|
return this.client.request<types.CreateAPIKeyResponse>('POST', path, {
|
|
18
18
|
body: request,
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
async
|
|
23
|
-
const path =
|
|
24
|
-
return this.client.request<
|
|
22
|
+
async rotateAPIKey(params: { id: string }, request: types.RotateAPIKeyRequest): Promise<types.RotateAPIKeyResponse> {
|
|
23
|
+
const path = `/${params.id}/rotate`;
|
|
24
|
+
return this.client.request<types.RotateAPIKeyResponse>('POST', path, {
|
|
25
|
+
body: request,
|
|
26
|
+
});
|
|
25
27
|
}
|
|
26
28
|
|
|
27
|
-
async
|
|
28
|
-
const path = '
|
|
29
|
-
return this.client.request<
|
|
29
|
+
async listAPIKeys(request?: types.ListAPIKeysRequest): Promise<types.ListAPIKeysResponse> {
|
|
30
|
+
const path = '/listapikeys';
|
|
31
|
+
return this.client.request<types.ListAPIKeysResponse>('GET', path, {
|
|
32
|
+
query: this.client.toQueryParams(request),
|
|
33
|
+
});
|
|
30
34
|
}
|
|
31
35
|
|
|
32
|
-
async
|
|
33
|
-
const path =
|
|
34
|
-
return this.client.request<
|
|
36
|
+
async getAPIKey(params: { id: string }, request?: types.GetAPIKeyRequest): Promise<types.APIKey> {
|
|
37
|
+
const path = `/${params.id}`;
|
|
38
|
+
return this.client.request<types.APIKey>('GET', path, {
|
|
39
|
+
query: this.client.toQueryParams(request),
|
|
40
|
+
});
|
|
35
41
|
}
|
|
36
42
|
|
|
37
|
-
async
|
|
38
|
-
const path =
|
|
39
|
-
return this.client.request<types.
|
|
43
|
+
async updateAPIKey(params: { id: string }, request: types.UpdateAPIKeyRequest): Promise<types.APIKey> {
|
|
44
|
+
const path = `/${params.id}`;
|
|
45
|
+
return this.client.request<types.APIKey>('PUT', path, {
|
|
46
|
+
body: request,
|
|
47
|
+
});
|
|
40
48
|
}
|
|
41
49
|
|
|
42
|
-
async
|
|
43
|
-
const path =
|
|
44
|
-
return this.client.request<types.
|
|
50
|
+
async deleteAPIKey(params: { id: string }, request?: types.DeleteAPIKeyRequest): Promise<types.MessageResponse> {
|
|
51
|
+
const path = `/${params.id}`;
|
|
52
|
+
return this.client.request<types.MessageResponse>('DELETE', path, {
|
|
53
|
+
query: this.client.toQueryParams(request),
|
|
54
|
+
});
|
|
45
55
|
}
|
|
46
56
|
|
|
47
|
-
async verifyAPIKey(): Promise<
|
|
57
|
+
async verifyAPIKey(request: types.VerifyAPIKeyRequest): Promise<types.VerifyAPIKeyResponse> {
|
|
48
58
|
const path = '/verify';
|
|
49
|
-
return this.client.request<
|
|
59
|
+
return this.client.request<types.VerifyAPIKeyResponse>('POST', path, {
|
|
60
|
+
body: request,
|
|
61
|
+
});
|
|
50
62
|
}
|
|
51
63
|
|
|
52
64
|
}
|