@authsome/client 0.0.3 → 0.0.4
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 +86 -37
- package/dist/client.js +65 -17
- package/dist/index.d.ts +21 -17
- package/dist/index.js +65 -53
- package/dist/plugins/admin.d.ts +18 -6
- package/dist/plugins/admin.js +12 -12
- package/dist/plugins/apikey.d.ts +13 -5
- package/dist/plugins/apikey.js +12 -14
- package/dist/plugins/backupauth.d.ts +15 -5
- package/dist/plugins/backupauth.js +10 -10
- package/dist/plugins/cms.d.ts +54 -0
- package/dist/plugins/cms.js +139 -0
- package/dist/plugins/compliance.d.ts +90 -30
- package/dist/plugins/compliance.js +60 -60
- package/dist/plugins/consent.d.ts +24 -8
- package/dist/plugins/consent.js +16 -16
- package/dist/plugins/emailverification.d.ts +12 -0
- package/dist/plugins/emailverification.js +33 -0
- package/dist/plugins/idverification.d.ts +21 -7
- package/dist/plugins/idverification.js +14 -14
- package/dist/plugins/impersonation.d.ts +3 -1
- package/dist/plugins/impersonation.js +2 -2
- package/dist/plugins/mfa.d.ts +21 -7
- package/dist/plugins/mfa.js +14 -14
- package/dist/plugins/multiapp.d.ts +40 -13
- package/dist/plugins/multiapp.js +26 -26
- package/dist/plugins/multisession.d.ts +11 -1
- package/dist/plugins/multisession.js +28 -2
- package/dist/plugins/notification.d.ts +25 -9
- package/dist/plugins/notification.js +16 -16
- package/dist/plugins/oidcprovider.d.ts +9 -3
- package/dist/plugins/oidcprovider.js +6 -6
- package/dist/plugins/organization.d.ts +30 -10
- 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 +63 -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 +15 -5
- package/dist/plugins/stepup.js +10 -10
- package/dist/types.d.ts +2878 -2453
- package/package.json +2 -1
- package/src/client.ts +96 -37
- package/src/index.ts +21 -17
- package/src/plugins/admin.ts +12 -12
- package/src/plugins/apikey.ts +13 -15
- package/src/plugins/backupauth.ts +10 -10
- package/src/plugins/cms.ts +170 -0
- package/src/plugins/compliance.ts +60 -60
- package/src/plugins/consent.ts +16 -16
- package/src/plugins/emailverification.ts +38 -0
- package/src/plugins/idverification.ts +14 -14
- package/src/plugins/impersonation.ts +2 -2
- package/src/plugins/mfa.ts +14 -14
- package/src/plugins/multiapp.ts +26 -26
- package/src/plugins/multisession.ts +34 -2
- package/src/plugins/notification.ts +18 -18
- package/src/plugins/oidcprovider.ts +6 -6
- package/src/plugins/organization.ts +20 -20
- package/src/plugins/passkey.ts +4 -4
- package/src/plugins/permissions.ts +38 -0
- package/src/plugins/secrets.ts +76 -0
- package/src/plugins/social.ts +7 -5
- package/src/plugins/sso.ts +8 -8
- package/src/plugins/stepup.ts +10 -10
- package/src/types.ts +2989 -2486
- 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.4",
|
|
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 {
|
|
6
|
+
import { AdminPlugin } from './plugins/admin';
|
|
7
|
+
import { CmsPlugin } from './plugins/cms';
|
|
8
|
+
import { CompliancePlugin } from './plugins/compliance';
|
|
9
|
+
import { StepupPlugin } from './plugins/stepup';
|
|
8
10
|
import { PasskeyPlugin } from './plugins/passkey';
|
|
9
|
-
import { UsernamePlugin } from './plugins/username';
|
|
10
11
|
import { ApikeyPlugin } from './plugins/apikey';
|
|
12
|
+
import { EmailverificationPlugin } from './plugins/emailverification';
|
|
13
|
+
import { MultisessionPlugin } from './plugins/multisession';
|
|
14
|
+
import { OidcproviderPlugin } from './plugins/oidcprovider';
|
|
15
|
+
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
|
+
import { SsoPlugin } from './plugins/sso';
|
|
21
|
+
import { AnonymousPlugin } from './plugins/anonymous';
|
|
11
22
|
import { BackupauthPlugin } from './plugins/backupauth';
|
|
12
|
-
import { ConsentPlugin } from './plugins/consent';
|
|
13
23
|
import { IdverificationPlugin } from './plugins/idverification';
|
|
14
|
-
import {
|
|
15
|
-
import { OidcproviderPlugin } from './plugins/oidcprovider';
|
|
16
|
-
import { PhonePlugin } from './plugins/phone';
|
|
17
|
-
import { AdminPlugin } from './plugins/admin';
|
|
24
|
+
import { TwofaPlugin } from './plugins/twofa';
|
|
18
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';
|
|
19
30
|
import { MfaPlugin } from './plugins/mfa';
|
|
20
|
-
import { OrganizationPlugin } from './plugins/organization';
|
|
21
31
|
import { SocialPlugin } from './plugins/social';
|
|
22
|
-
import { SsoPlugin } from './plugins/sso';
|
|
23
|
-
import { AnonymousPlugin } from './plugins/anonymous';
|
|
24
|
-
import { StepupPlugin } from './plugins/stepup';
|
|
25
32
|
import { JwtPlugin } from './plugins/jwt';
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import { WebhookPlugin } from './plugins/webhook';
|
|
29
|
-
import { CompliancePlugin } from './plugins/compliance';
|
|
30
|
-
import { ImpersonationPlugin } from './plugins/impersonation';
|
|
33
|
+
import { MultiappPlugin } from './plugins/multiapp';
|
|
34
|
+
import { PhonePlugin } from './plugins/phone';
|
|
31
35
|
|
|
32
36
|
/**
|
|
33
37
|
* AuthSome client configuration
|
|
@@ -144,31 +148,35 @@ export class AuthsomeClient {
|
|
|
144
148
|
}
|
|
145
149
|
|
|
146
150
|
public readonly $plugins = {
|
|
147
|
-
|
|
148
|
-
|
|
151
|
+
admin: (): AdminPlugin | undefined => this.getPlugin<AdminPlugin>('admin'),
|
|
152
|
+
cms: (): CmsPlugin | undefined => this.getPlugin<CmsPlugin>('cms'),
|
|
153
|
+
compliance: (): CompliancePlugin | undefined => this.getPlugin<CompliancePlugin>('compliance'),
|
|
154
|
+
stepup: (): StepupPlugin | undefined => this.getPlugin<StepupPlugin>('stepup'),
|
|
149
155
|
passkey: (): PasskeyPlugin | undefined => this.getPlugin<PasskeyPlugin>('passkey'),
|
|
150
|
-
username: (): UsernamePlugin | undefined => this.getPlugin<UsernamePlugin>('username'),
|
|
151
156
|
apikey: (): ApikeyPlugin | undefined => this.getPlugin<ApikeyPlugin>('apikey'),
|
|
157
|
+
emailverification: (): EmailverificationPlugin | undefined => this.getPlugin<EmailverificationPlugin>('emailverification'),
|
|
158
|
+
multisession: (): MultisessionPlugin | undefined => this.getPlugin<MultisessionPlugin>('multisession'),
|
|
159
|
+
oidcprovider: (): OidcproviderPlugin | undefined => this.getPlugin<OidcproviderPlugin>('oidcprovider'),
|
|
160
|
+
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
|
+
sso: (): SsoPlugin | undefined => this.getPlugin<SsoPlugin>('sso'),
|
|
166
|
+
anonymous: (): AnonymousPlugin | undefined => this.getPlugin<AnonymousPlugin>('anonymous'),
|
|
152
167
|
backupauth: (): BackupauthPlugin | undefined => this.getPlugin<BackupauthPlugin>('backupauth'),
|
|
153
|
-
consent: (): ConsentPlugin | undefined => this.getPlugin<ConsentPlugin>('consent'),
|
|
154
168
|
idverification: (): IdverificationPlugin | undefined => this.getPlugin<IdverificationPlugin>('idverification'),
|
|
155
|
-
|
|
156
|
-
oidcprovider: (): OidcproviderPlugin | undefined => this.getPlugin<OidcproviderPlugin>('oidcprovider'),
|
|
157
|
-
phone: (): PhonePlugin | undefined => this.getPlugin<PhonePlugin>('phone'),
|
|
158
|
-
admin: (): AdminPlugin | undefined => this.getPlugin<AdminPlugin>('admin'),
|
|
169
|
+
twofa: (): TwofaPlugin | undefined => this.getPlugin<TwofaPlugin>('twofa'),
|
|
159
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'),
|
|
160
175
|
mfa: (): MfaPlugin | undefined => this.getPlugin<MfaPlugin>('mfa'),
|
|
161
|
-
organization: (): OrganizationPlugin | undefined => this.getPlugin<OrganizationPlugin>('organization'),
|
|
162
176
|
social: (): SocialPlugin | undefined => this.getPlugin<SocialPlugin>('social'),
|
|
163
|
-
sso: (): SsoPlugin | undefined => this.getPlugin<SsoPlugin>('sso'),
|
|
164
|
-
anonymous: (): AnonymousPlugin | undefined => this.getPlugin<AnonymousPlugin>('anonymous'),
|
|
165
|
-
stepup: (): StepupPlugin | undefined => this.getPlugin<StepupPlugin>('stepup'),
|
|
166
177
|
jwt: (): JwtPlugin | undefined => this.getPlugin<JwtPlugin>('jwt'),
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
webhook: (): WebhookPlugin | undefined => this.getPlugin<WebhookPlugin>('webhook'),
|
|
170
|
-
compliance: (): CompliancePlugin | undefined => this.getPlugin<CompliancePlugin>('compliance'),
|
|
171
|
-
impersonation: (): ImpersonationPlugin | undefined => this.getPlugin<ImpersonationPlugin>('impersonation'),
|
|
178
|
+
multiapp: (): MultiappPlugin | undefined => this.getPlugin<MultiappPlugin>('multiapp'),
|
|
179
|
+
phone: (): PhonePlugin | undefined => this.getPlugin<PhonePlugin>('phone'),
|
|
172
180
|
};
|
|
173
181
|
|
|
174
182
|
public async request<T>(
|
|
@@ -223,7 +231,7 @@ export class AuthsomeClient {
|
|
|
223
231
|
});
|
|
224
232
|
}
|
|
225
233
|
|
|
226
|
-
async signIn(request: { email: string; password: string }): Promise<{
|
|
234
|
+
async signIn(request: { email: string; password: string }): Promise<{ session: types.Session; requiresTwoFactor: boolean; user: types.User }> {
|
|
227
235
|
const path = '/signin';
|
|
228
236
|
return this.request<{ user: types.User; session: types.Session; requiresTwoFactor: boolean }>('POST', path, {
|
|
229
237
|
body: request,
|
|
@@ -259,12 +267,63 @@ export class AuthsomeClient {
|
|
|
259
267
|
});
|
|
260
268
|
}
|
|
261
269
|
|
|
262
|
-
async revokeDevice(request: {
|
|
270
|
+
async revokeDevice(request: { fingerprint: string }): Promise<{ status: string }> {
|
|
263
271
|
const path = '/devices/revoke';
|
|
264
|
-
return this.request<{
|
|
272
|
+
return this.request<{ status: string }>('POST', path, {
|
|
265
273
|
body: request,
|
|
266
274
|
auth: true,
|
|
267
275
|
});
|
|
268
276
|
}
|
|
269
277
|
|
|
278
|
+
async refreshSession(request: { refreshToken: string }): Promise<{ expiresAt: string; refreshExpiresAt: string; session: any; accessToken: string; refreshToken: string }> {
|
|
279
|
+
const path = '/refresh';
|
|
280
|
+
return this.request<{ session: any; accessToken: string; refreshToken: string; expiresAt: string; refreshExpiresAt: string }>('POST', path, {
|
|
281
|
+
body: request,
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
async requestPasswordReset(request: { email: string }): Promise<{ message: string }> {
|
|
286
|
+
const path = '/password/reset/request';
|
|
287
|
+
return this.request<{ message: string }>('POST', path, {
|
|
288
|
+
body: request,
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
async resetPassword(request: { token: string; newPassword: string }): Promise<{ message: string }> {
|
|
293
|
+
const path = '/password/reset/confirm';
|
|
294
|
+
return this.request<{ message: string }>('POST', path, {
|
|
295
|
+
body: request,
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
async validateResetToken(query?: { token?: string }): Promise<{ valid: boolean }> {
|
|
300
|
+
const path = '/password/reset/validate';
|
|
301
|
+
return this.request<{ valid: boolean }>('GET', path, {
|
|
302
|
+
query,
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
async changePassword(request: { oldPassword: string; newPassword: string }): Promise<{ message: string }> {
|
|
307
|
+
const path = '/password/change';
|
|
308
|
+
return this.request<{ message: string }>('POST', path, {
|
|
309
|
+
body: request,
|
|
310
|
+
auth: true,
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
async requestEmailChange(request: { newEmail: string }): Promise<{ message: string }> {
|
|
315
|
+
const path = '/email/change/request';
|
|
316
|
+
return this.request<{ message: string }>('POST', path, {
|
|
317
|
+
body: request,
|
|
318
|
+
auth: true,
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
async confirmEmailChange(request: { token: string }): Promise<{ message: string }> {
|
|
323
|
+
const path = '/email/change/confirm';
|
|
324
|
+
return this.request<{ message: string }>('POST', path, {
|
|
325
|
+
body: request,
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
|
|
270
329
|
}
|
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 {
|
|
9
|
+
export { AdminPlugin, adminClient } from './plugins/admin';
|
|
10
|
+
export { CmsPlugin, cmsClient } from './plugins/cms';
|
|
11
|
+
export { CompliancePlugin, complianceClient } from './plugins/compliance';
|
|
12
|
+
export { StepupPlugin, stepupClient } from './plugins/stepup';
|
|
11
13
|
export { PasskeyPlugin, passkeyClient } from './plugins/passkey';
|
|
12
|
-
export { UsernamePlugin, usernameClient } from './plugins/username';
|
|
13
14
|
export { ApikeyPlugin, apikeyClient } from './plugins/apikey';
|
|
15
|
+
export { EmailverificationPlugin, emailverificationClient } from './plugins/emailverification';
|
|
16
|
+
export { MultisessionPlugin, multisessionClient } from './plugins/multisession';
|
|
17
|
+
export { OidcproviderPlugin, oidcproviderClient } from './plugins/oidcprovider';
|
|
18
|
+
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
|
+
export { SsoPlugin, ssoClient } from './plugins/sso';
|
|
24
|
+
export { AnonymousPlugin, anonymousClient } from './plugins/anonymous';
|
|
14
25
|
export { BackupauthPlugin, backupauthClient } from './plugins/backupauth';
|
|
15
|
-
export { ConsentPlugin, consentClient } from './plugins/consent';
|
|
16
26
|
export { IdverificationPlugin, idverificationClient } from './plugins/idverification';
|
|
17
|
-
export {
|
|
18
|
-
export { OidcproviderPlugin, oidcproviderClient } from './plugins/oidcprovider';
|
|
19
|
-
export { PhonePlugin, phoneClient } from './plugins/phone';
|
|
20
|
-
export { AdminPlugin, adminClient } from './plugins/admin';
|
|
27
|
+
export { TwofaPlugin, twofaClient } from './plugins/twofa';
|
|
21
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';
|
|
22
33
|
export { MfaPlugin, mfaClient } from './plugins/mfa';
|
|
23
|
-
export { OrganizationPlugin, organizationClient } from './plugins/organization';
|
|
24
34
|
export { SocialPlugin, socialClient } from './plugins/social';
|
|
25
|
-
export { SsoPlugin, ssoClient } from './plugins/sso';
|
|
26
|
-
export { AnonymousPlugin, anonymousClient } from './plugins/anonymous';
|
|
27
|
-
export { StepupPlugin, stepupClient } from './plugins/stepup';
|
|
28
35
|
export { JwtPlugin, jwtClient } from './plugins/jwt';
|
|
29
|
-
export {
|
|
30
|
-
export {
|
|
31
|
-
export { WebhookPlugin, webhookClient } from './plugins/webhook';
|
|
32
|
-
export { CompliancePlugin, complianceClient } from './plugins/compliance';
|
|
33
|
-
export { ImpersonationPlugin, impersonationClient } from './plugins/impersonation';
|
|
36
|
+
export { MultiappPlugin, multiappClient } from './plugins/multiapp';
|
|
37
|
+
export { PhonePlugin, phoneClient } from './plugins/phone';
|
package/src/plugins/admin.ts
CHANGED
|
@@ -24,34 +24,34 @@ export class AdminPlugin implements ClientPlugin {
|
|
|
24
24
|
return this.client.request<void>('GET', path);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
async deleteUser(): Promise<types.MessageResponse> {
|
|
28
|
-
const path =
|
|
27
|
+
async deleteUser(params: { id: string }): Promise<types.MessageResponse> {
|
|
28
|
+
const path = `/users/${params.id}`;
|
|
29
29
|
return this.client.request<types.MessageResponse>('DELETE', path);
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
async banUser(request: types.BanUser_reqBody): Promise<types.MessageResponse> {
|
|
33
|
-
const path =
|
|
32
|
+
async banUser(params: { id: string }, request: types.BanUser_reqBody): Promise<types.MessageResponse> {
|
|
33
|
+
const path = `/users/${params.id}/ban`;
|
|
34
34
|
return this.client.request<types.MessageResponse>('POST', path, {
|
|
35
35
|
body: request,
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
async unbanUser(request: types.UnbanUser_reqBody): Promise<types.MessageResponse> {
|
|
40
|
-
const path =
|
|
39
|
+
async unbanUser(params: { id: string }, request: types.UnbanUser_reqBody): Promise<types.MessageResponse> {
|
|
40
|
+
const path = `/users/${params.id}/unban`;
|
|
41
41
|
return this.client.request<types.MessageResponse>('POST', path, {
|
|
42
42
|
body: request,
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
async impersonateUser(request: types.ImpersonateUser_reqBody): Promise<void> {
|
|
47
|
-
const path =
|
|
46
|
+
async impersonateUser(params: { id: string }, request: types.ImpersonateUser_reqBody): Promise<void> {
|
|
47
|
+
const path = `/users/${params.id}/impersonate`;
|
|
48
48
|
return this.client.request<void>('POST', path, {
|
|
49
49
|
body: request,
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
async setUserRole(request: types.SetUserRole_reqBody): Promise<types.MessageResponse> {
|
|
54
|
-
const path =
|
|
53
|
+
async setUserRole(params: { id: string }, request: types.SetUserRole_reqBody): Promise<types.MessageResponse> {
|
|
54
|
+
const path = `/users/${params.id}/role`;
|
|
55
55
|
return this.client.request<types.MessageResponse>('POST', path, {
|
|
56
56
|
body: request,
|
|
57
57
|
});
|
|
@@ -62,8 +62,8 @@ export class AdminPlugin implements ClientPlugin {
|
|
|
62
62
|
return this.client.request<void>('GET', path);
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
async revokeSession(): Promise<types.MessageResponse> {
|
|
66
|
-
const path =
|
|
65
|
+
async revokeSession(params: { id: string }): Promise<types.MessageResponse> {
|
|
66
|
+
const path = `/sessions/${params.id}`;
|
|
67
67
|
return this.client.request<types.MessageResponse>('DELETE', path);
|
|
68
68
|
}
|
|
69
69
|
|
package/src/plugins/apikey.ts
CHANGED
|
@@ -12,11 +12,14 @@ export class ApikeyPlugin implements ClientPlugin {
|
|
|
12
12
|
this.client = client;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
async createAPIKey(
|
|
15
|
+
async createAPIKey(): Promise<void> {
|
|
16
16
|
const path = '/createapikey';
|
|
17
|
-
return this.client.request<
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
return this.client.request<void>('POST', path);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
async rotateAPIKey(params: { id: string }): Promise<void> {
|
|
21
|
+
const path = `/${params.id}/rotate`;
|
|
22
|
+
return this.client.request<void>('POST', path);
|
|
20
23
|
}
|
|
21
24
|
|
|
22
25
|
async listAPIKeys(): Promise<void> {
|
|
@@ -24,26 +27,21 @@ export class ApikeyPlugin implements ClientPlugin {
|
|
|
24
27
|
return this.client.request<void>('GET', path);
|
|
25
28
|
}
|
|
26
29
|
|
|
27
|
-
async getAPIKey(): Promise<void> {
|
|
28
|
-
const path =
|
|
30
|
+
async getAPIKey(params: { id: string }): Promise<void> {
|
|
31
|
+
const path = `/${params.id}`;
|
|
29
32
|
return this.client.request<void>('GET', path);
|
|
30
33
|
}
|
|
31
34
|
|
|
32
|
-
async updateAPIKey(): Promise<void> {
|
|
33
|
-
const path =
|
|
35
|
+
async updateAPIKey(params: { id: string }): Promise<void> {
|
|
36
|
+
const path = `/${params.id}`;
|
|
34
37
|
return this.client.request<void>('PUT', path);
|
|
35
38
|
}
|
|
36
39
|
|
|
37
|
-
async deleteAPIKey(): Promise<types.MessageResponse> {
|
|
38
|
-
const path =
|
|
40
|
+
async deleteAPIKey(params: { id: string }): Promise<types.MessageResponse> {
|
|
41
|
+
const path = `/${params.id}`;
|
|
39
42
|
return this.client.request<types.MessageResponse>('DELETE', path);
|
|
40
43
|
}
|
|
41
44
|
|
|
42
|
-
async rotateAPIKey(): Promise<types.RotateAPIKeyResponse> {
|
|
43
|
-
const path = '/:id/rotate';
|
|
44
|
-
return this.client.request<types.RotateAPIKeyResponse>('POST', path);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
45
|
async verifyAPIKey(): Promise<void> {
|
|
48
46
|
const path = '/verify';
|
|
49
47
|
return this.client.request<void>('POST', path);
|
|
@@ -101,8 +101,8 @@ export class BackupauthPlugin implements ClientPlugin {
|
|
|
101
101
|
});
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
async removeTrustedContact(): Promise<types.SuccessResponse> {
|
|
105
|
-
const path =
|
|
104
|
+
async removeTrustedContact(params: { id: string }): Promise<types.SuccessResponse> {
|
|
105
|
+
const path = `/trusted-contacts/${params.id}`;
|
|
106
106
|
return this.client.request<types.SuccessResponse>('DELETE', path);
|
|
107
107
|
}
|
|
108
108
|
|
|
@@ -148,13 +148,13 @@ export class BackupauthPlugin implements ClientPlugin {
|
|
|
148
148
|
});
|
|
149
149
|
}
|
|
150
150
|
|
|
151
|
-
async getDocumentVerification(): Promise<types.ErrorResponse> {
|
|
152
|
-
const path =
|
|
151
|
+
async getDocumentVerification(params: { id: string }): Promise<types.ErrorResponse> {
|
|
152
|
+
const path = `/documents/${params.id}`;
|
|
153
153
|
return this.client.request<types.ErrorResponse>('GET', path);
|
|
154
154
|
}
|
|
155
155
|
|
|
156
|
-
async reviewDocument(request: types.ReviewDocumentRequest): Promise<types.SuccessResponse> {
|
|
157
|
-
const path =
|
|
156
|
+
async reviewDocument(params: { id: string }, request: types.ReviewDocumentRequest): Promise<types.SuccessResponse> {
|
|
157
|
+
const path = `/documents/${params.id}/review`;
|
|
158
158
|
return this.client.request<types.SuccessResponse>('POST', path, {
|
|
159
159
|
body: request,
|
|
160
160
|
});
|
|
@@ -165,15 +165,15 @@ export class BackupauthPlugin implements ClientPlugin {
|
|
|
165
165
|
return this.client.request<void>('GET', path);
|
|
166
166
|
}
|
|
167
167
|
|
|
168
|
-
async approveRecovery(request: types.ApproveRecoveryRequest): Promise<types.ErrorResponse> {
|
|
169
|
-
const path =
|
|
168
|
+
async approveRecovery(params: { id: string }, request: types.ApproveRecoveryRequest): Promise<types.ErrorResponse> {
|
|
169
|
+
const path = `/sessions/${params.id}/approve`;
|
|
170
170
|
return this.client.request<types.ErrorResponse>('POST', path, {
|
|
171
171
|
body: request,
|
|
172
172
|
});
|
|
173
173
|
}
|
|
174
174
|
|
|
175
|
-
async rejectRecovery(request: types.RejectRecoveryRequest): Promise<types.ErrorResponse> {
|
|
176
|
-
const path =
|
|
175
|
+
async rejectRecovery(params: { id: string }, request: types.RejectRecoveryRequest): Promise<types.ErrorResponse> {
|
|
176
|
+
const path = `/sessions/${params.id}/reject`;
|
|
177
177
|
return this.client.request<types.ErrorResponse>('POST', path, {
|
|
178
178
|
body: request,
|
|
179
179
|
});
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
// Auto-generated cms plugin
|
|
2
|
+
|
|
3
|
+
import { ClientPlugin } from '../plugin';
|
|
4
|
+
import { AuthsomeClient } from '../client';
|
|
5
|
+
import * as types from '../types';
|
|
6
|
+
|
|
7
|
+
export class CmsPlugin implements ClientPlugin {
|
|
8
|
+
readonly id = 'cms';
|
|
9
|
+
private client!: AuthsomeClient;
|
|
10
|
+
|
|
11
|
+
init(client: AuthsomeClient): void {
|
|
12
|
+
this.client = client;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
async listEntries(): Promise<void> {
|
|
16
|
+
const path = '/listentries';
|
|
17
|
+
return this.client.request<void>('GET', path);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
async createEntry(): Promise<void> {
|
|
21
|
+
const path = '/createentry';
|
|
22
|
+
return this.client.request<void>('POST', path);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
async getEntry(): Promise<void> {
|
|
26
|
+
const path = '/getentry';
|
|
27
|
+
return this.client.request<void>('GET', path);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
async updateEntry(): Promise<void> {
|
|
31
|
+
const path = '/updateentry';
|
|
32
|
+
return this.client.request<void>('PUT', path);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
async deleteEntry(): Promise<void> {
|
|
36
|
+
const path = '/deleteentry';
|
|
37
|
+
return this.client.request<void>('DELETE', path);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
async publishEntry(): Promise<void> {
|
|
41
|
+
const path = '/publish';
|
|
42
|
+
return this.client.request<void>('POST', path);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
async unpublishEntry(): Promise<void> {
|
|
46
|
+
const path = '/unpublish';
|
|
47
|
+
return this.client.request<void>('POST', path);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
async archiveEntry(): Promise<void> {
|
|
51
|
+
const path = '/archive';
|
|
52
|
+
return this.client.request<void>('POST', path);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
async queryEntries(): Promise<void> {
|
|
56
|
+
const path = '/query';
|
|
57
|
+
return this.client.request<void>('POST', path);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
async bulkPublish(request: types.BulkRequest): Promise<void> {
|
|
61
|
+
const path = '/publish';
|
|
62
|
+
return this.client.request<void>('POST', path, {
|
|
63
|
+
body: request,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
async bulkUnpublish(request: types.BulkRequest): Promise<void> {
|
|
68
|
+
const path = '/unpublish';
|
|
69
|
+
return this.client.request<void>('POST', path, {
|
|
70
|
+
body: request,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
async bulkDelete(request: types.BulkRequest): Promise<void> {
|
|
75
|
+
const path = '/delete';
|
|
76
|
+
return this.client.request<void>('POST', path, {
|
|
77
|
+
body: request,
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
async getEntryStats(): Promise<void> {
|
|
82
|
+
const path = '/stats';
|
|
83
|
+
return this.client.request<void>('GET', path);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
async listContentTypes(): Promise<void> {
|
|
87
|
+
const path = '/listcontenttypes';
|
|
88
|
+
return this.client.request<void>('GET', path);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
async createContentType(): Promise<void> {
|
|
92
|
+
const path = '/createcontenttype';
|
|
93
|
+
return this.client.request<void>('POST', path);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
async getContentType(params: { slug: string }): Promise<void> {
|
|
97
|
+
const path = `/${params.slug}`;
|
|
98
|
+
return this.client.request<void>('GET', path);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
async updateContentType(params: { slug: string }): Promise<void> {
|
|
102
|
+
const path = `/${params.slug}`;
|
|
103
|
+
return this.client.request<void>('PUT', path);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
async deleteContentType(params: { slug: string }): Promise<void> {
|
|
107
|
+
const path = `/${params.slug}`;
|
|
108
|
+
return this.client.request<void>('DELETE', path);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
async listFields(): Promise<void> {
|
|
112
|
+
const path = '/listfields';
|
|
113
|
+
return this.client.request<void>('GET', path);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
async addField(): Promise<void> {
|
|
117
|
+
const path = '/addfield';
|
|
118
|
+
return this.client.request<void>('POST', path);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
async getField(params: { fieldSlug: string }): Promise<void> {
|
|
122
|
+
const path = `/${params.fieldSlug}`;
|
|
123
|
+
return this.client.request<void>('GET', path);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
async updateField(params: { fieldSlug: string }): Promise<void> {
|
|
127
|
+
const path = `/${params.fieldSlug}`;
|
|
128
|
+
return this.client.request<void>('PUT', path);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
async deleteField(params: { fieldSlug: string }): Promise<void> {
|
|
132
|
+
const path = `/${params.fieldSlug}`;
|
|
133
|
+
return this.client.request<void>('DELETE', path);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
async reorderFields(): Promise<void> {
|
|
137
|
+
const path = '/reorder';
|
|
138
|
+
return this.client.request<void>('POST', path);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
async getFieldTypes(): Promise<void> {
|
|
142
|
+
const path = '/field-types';
|
|
143
|
+
return this.client.request<void>('GET', path);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
async listRevisions(): Promise<void> {
|
|
147
|
+
const path = '/listrevisions';
|
|
148
|
+
return this.client.request<void>('GET', path);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
async getRevision(params: { version: number }): Promise<void> {
|
|
152
|
+
const path = `/${params.version}`;
|
|
153
|
+
return this.client.request<void>('GET', path);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
async restoreRevision(params: { version: number }): Promise<void> {
|
|
157
|
+
const path = `/${params.version}/restore`;
|
|
158
|
+
return this.client.request<void>('POST', path);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
async compareRevisions(): Promise<void> {
|
|
162
|
+
const path = '/compare';
|
|
163
|
+
return this.client.request<void>('GET', path);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export function cmsClient(): CmsPlugin {
|
|
169
|
+
return new CmsPlugin();
|
|
170
|
+
}
|