@authsome/client 0.0.2 → 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.
Files changed (75) hide show
  1. package/dist/client.d.ts +90 -35
  2. package/dist/client.js +77 -16
  3. package/dist/index.d.ts +20 -16
  4. package/dist/index.js +62 -50
  5. package/dist/plugins/admin.d.ts +18 -6
  6. package/dist/plugins/admin.js +12 -12
  7. package/dist/plugins/apikey.d.ts +13 -5
  8. package/dist/plugins/apikey.js +12 -14
  9. package/dist/plugins/backupauth.d.ts +15 -5
  10. package/dist/plugins/backupauth.js +10 -10
  11. package/dist/plugins/cms.d.ts +54 -0
  12. package/dist/plugins/cms.js +139 -0
  13. package/dist/plugins/compliance.d.ts +90 -30
  14. package/dist/plugins/compliance.js +60 -60
  15. package/dist/plugins/consent.d.ts +24 -8
  16. package/dist/plugins/consent.js +16 -16
  17. package/dist/plugins/emailverification.d.ts +12 -0
  18. package/dist/plugins/emailverification.js +33 -0
  19. package/dist/plugins/idverification.d.ts +21 -7
  20. package/dist/plugins/idverification.js +14 -14
  21. package/dist/plugins/impersonation.d.ts +3 -1
  22. package/dist/plugins/impersonation.js +2 -2
  23. package/dist/plugins/mfa.d.ts +21 -7
  24. package/dist/plugins/mfa.js +14 -14
  25. package/dist/plugins/multiapp.d.ts +40 -13
  26. package/dist/plugins/multiapp.js +26 -26
  27. package/dist/plugins/multisession.d.ts +11 -1
  28. package/dist/plugins/multisession.js +28 -2
  29. package/dist/plugins/notification.d.ts +25 -9
  30. package/dist/plugins/notification.js +16 -16
  31. package/dist/plugins/oidcprovider.d.ts +9 -3
  32. package/dist/plugins/oidcprovider.js +6 -6
  33. package/dist/plugins/organization.d.ts +30 -10
  34. package/dist/plugins/organization.js +20 -20
  35. package/dist/plugins/passkey.d.ts +6 -2
  36. package/dist/plugins/passkey.js +4 -4
  37. package/dist/plugins/permissions.d.ts +12 -0
  38. package/dist/plugins/permissions.js +33 -0
  39. package/dist/plugins/secrets.d.ts +33 -0
  40. package/dist/plugins/secrets.js +63 -0
  41. package/dist/plugins/social.d.ts +11 -2
  42. package/dist/plugins/social.js +7 -5
  43. package/dist/plugins/sso.d.ts +12 -4
  44. package/dist/plugins/sso.js +8 -8
  45. package/dist/plugins/stepup.d.ts +15 -5
  46. package/dist/plugins/stepup.js +10 -10
  47. package/dist/plugins/webhook.d.ts +2 -2
  48. package/dist/types.d.ts +2875 -2425
  49. package/package.json +2 -1
  50. package/src/client.ts +108 -36
  51. package/src/index.ts +20 -16
  52. package/src/plugins/admin.ts +12 -12
  53. package/src/plugins/apikey.ts +13 -15
  54. package/src/plugins/backupauth.ts +10 -10
  55. package/src/plugins/cms.ts +170 -0
  56. package/src/plugins/compliance.ts +60 -60
  57. package/src/plugins/consent.ts +16 -16
  58. package/src/plugins/emailverification.ts +38 -0
  59. package/src/plugins/idverification.ts +14 -14
  60. package/src/plugins/impersonation.ts +2 -2
  61. package/src/plugins/mfa.ts +14 -14
  62. package/src/plugins/multiapp.ts +26 -26
  63. package/src/plugins/multisession.ts +34 -2
  64. package/src/plugins/notification.ts +18 -18
  65. package/src/plugins/oidcprovider.ts +6 -6
  66. package/src/plugins/organization.ts +20 -20
  67. package/src/plugins/passkey.ts +4 -4
  68. package/src/plugins/permissions.ts +38 -0
  69. package/src/plugins/secrets.ts +76 -0
  70. package/src/plugins/social.ts +7 -5
  71. package/src/plugins/sso.ts +8 -8
  72. package/src/plugins/stepup.ts +10 -10
  73. package/src/plugins/webhook.ts +1 -1
  74. package/src/types.ts +3026 -2498
  75. 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.2",
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,30 +3,34 @@
3
3
  import { ClientPlugin } from './plugin';
4
4
  import { createErrorFromResponse } from './errors';
5
5
  import * as types from './types';
6
- import { SsoPlugin } from './plugins/sso';
7
- import { TwofaPlugin } from './plugins/twofa';
8
- import { WebhookPlugin } from './plugins/webhook';
9
6
  import { AdminPlugin } from './plugins/admin';
10
- import { ApikeyPlugin } from './plugins/apikey';
11
- import { EmailotpPlugin } from './plugins/emailotp';
12
- import { BackupauthPlugin } from './plugins/backupauth';
7
+ import { CmsPlugin } from './plugins/cms';
13
8
  import { CompliancePlugin } from './plugins/compliance';
9
+ import { StepupPlugin } from './plugins/stepup';
10
+ import { PasskeyPlugin } from './plugins/passkey';
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';
14
17
  import { ImpersonationPlugin } from './plugins/impersonation';
15
18
  import { MagiclinkPlugin } from './plugins/magiclink';
16
- import { MultiappPlugin } from './plugins/multiapp';
19
+ import { SecretsPlugin } from './plugins/secrets';
20
+ import { SsoPlugin } from './plugins/sso';
17
21
  import { AnonymousPlugin } from './plugins/anonymous';
18
- import { JwtPlugin } from './plugins/jwt';
19
- import { MfaPlugin } from './plugins/mfa';
20
- import { MultisessionPlugin } from './plugins/multisession';
22
+ import { BackupauthPlugin } from './plugins/backupauth';
23
+ import { IdverificationPlugin } from './plugins/idverification';
24
+ import { TwofaPlugin } from './plugins/twofa';
25
+ import { EmailotpPlugin } from './plugins/emailotp';
21
26
  import { NotificationPlugin } from './plugins/notification';
22
- import { OidcproviderPlugin } from './plugins/oidcprovider';
23
- import { OrganizationPlugin } from './plugins/organization';
24
- import { PasskeyPlugin } from './plugins/passkey';
25
- import { SocialPlugin } from './plugins/social';
27
+ import { PermissionsPlugin } from './plugins/permissions';
26
28
  import { UsernamePlugin } from './plugins/username';
27
29
  import { ConsentPlugin } from './plugins/consent';
28
- import { IdverificationPlugin } from './plugins/idverification';
29
- import { StepupPlugin } from './plugins/stepup';
30
+ import { MfaPlugin } from './plugins/mfa';
31
+ import { SocialPlugin } from './plugins/social';
32
+ import { JwtPlugin } from './plugins/jwt';
33
+ import { MultiappPlugin } from './plugins/multiapp';
30
34
  import { PhonePlugin } from './plugins/phone';
31
35
 
32
36
  /**
@@ -126,35 +130,52 @@ export class AuthsomeClient {
126
130
  this.basePath = basePath;
127
131
  }
128
132
 
133
+ /**
134
+ * Set global headers for all requests
135
+ * @param headers - Headers to set
136
+ * @param replace - If true, replaces all existing headers. If false (default), merges with existing headers
137
+ */
138
+ setGlobalHeaders(headers: Record<string, string>, replace: boolean = false): void {
139
+ if (replace) {
140
+ this.headers = { ...headers };
141
+ } else {
142
+ this.headers = { ...this.headers, ...headers };
143
+ }
144
+ }
145
+
129
146
  getPlugin<T extends ClientPlugin>(id: string): T | undefined {
130
147
  return this.plugins.get(id) as T | undefined;
131
148
  }
132
149
 
133
150
  public readonly $plugins = {
134
- sso: (): SsoPlugin | undefined => this.getPlugin<SsoPlugin>('sso'),
135
- twofa: (): TwofaPlugin | undefined => this.getPlugin<TwofaPlugin>('twofa'),
136
- webhook: (): WebhookPlugin | undefined => this.getPlugin<WebhookPlugin>('webhook'),
137
151
  admin: (): AdminPlugin | undefined => this.getPlugin<AdminPlugin>('admin'),
138
- apikey: (): ApikeyPlugin | undefined => this.getPlugin<ApikeyPlugin>('apikey'),
139
- emailotp: (): EmailotpPlugin | undefined => this.getPlugin<EmailotpPlugin>('emailotp'),
140
- backupauth: (): BackupauthPlugin | undefined => this.getPlugin<BackupauthPlugin>('backupauth'),
152
+ cms: (): CmsPlugin | undefined => this.getPlugin<CmsPlugin>('cms'),
141
153
  compliance: (): CompliancePlugin | undefined => this.getPlugin<CompliancePlugin>('compliance'),
154
+ stepup: (): StepupPlugin | undefined => this.getPlugin<StepupPlugin>('stepup'),
155
+ passkey: (): PasskeyPlugin | undefined => this.getPlugin<PasskeyPlugin>('passkey'),
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'),
142
162
  impersonation: (): ImpersonationPlugin | undefined => this.getPlugin<ImpersonationPlugin>('impersonation'),
143
163
  magiclink: (): MagiclinkPlugin | undefined => this.getPlugin<MagiclinkPlugin>('magiclink'),
144
- multiapp: (): MultiappPlugin | undefined => this.getPlugin<MultiappPlugin>('multiapp'),
164
+ secrets: (): SecretsPlugin | undefined => this.getPlugin<SecretsPlugin>('secrets'),
165
+ sso: (): SsoPlugin | undefined => this.getPlugin<SsoPlugin>('sso'),
145
166
  anonymous: (): AnonymousPlugin | undefined => this.getPlugin<AnonymousPlugin>('anonymous'),
146
- jwt: (): JwtPlugin | undefined => this.getPlugin<JwtPlugin>('jwt'),
147
- mfa: (): MfaPlugin | undefined => this.getPlugin<MfaPlugin>('mfa'),
148
- multisession: (): MultisessionPlugin | undefined => this.getPlugin<MultisessionPlugin>('multisession'),
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'),
149
171
  notification: (): NotificationPlugin | undefined => this.getPlugin<NotificationPlugin>('notification'),
150
- oidcprovider: (): OidcproviderPlugin | undefined => this.getPlugin<OidcproviderPlugin>('oidcprovider'),
151
- organization: (): OrganizationPlugin | undefined => this.getPlugin<OrganizationPlugin>('organization'),
152
- passkey: (): PasskeyPlugin | undefined => this.getPlugin<PasskeyPlugin>('passkey'),
153
- social: (): SocialPlugin | undefined => this.getPlugin<SocialPlugin>('social'),
172
+ permissions: (): PermissionsPlugin | undefined => this.getPlugin<PermissionsPlugin>('permissions'),
154
173
  username: (): UsernamePlugin | undefined => this.getPlugin<UsernamePlugin>('username'),
155
174
  consent: (): ConsentPlugin | undefined => this.getPlugin<ConsentPlugin>('consent'),
156
- idverification: (): IdverificationPlugin | undefined => this.getPlugin<IdverificationPlugin>('idverification'),
157
- stepup: (): StepupPlugin | undefined => this.getPlugin<StepupPlugin>('stepup'),
175
+ mfa: (): MfaPlugin | undefined => this.getPlugin<MfaPlugin>('mfa'),
176
+ social: (): SocialPlugin | undefined => this.getPlugin<SocialPlugin>('social'),
177
+ jwt: (): JwtPlugin | undefined => this.getPlugin<JwtPlugin>('jwt'),
178
+ multiapp: (): MultiappPlugin | undefined => this.getPlugin<MultiappPlugin>('multiapp'),
158
179
  phone: (): PhonePlugin | undefined => this.getPlugin<PhonePlugin>('phone'),
159
180
  };
160
181
 
@@ -212,7 +233,7 @@ export class AuthsomeClient {
212
233
 
213
234
  async signIn(request: { email: string; password: string }): Promise<{ session: types.Session; requiresTwoFactor: boolean; user: types.User }> {
214
235
  const path = '/signin';
215
- return this.request<{ session: types.Session; requiresTwoFactor: boolean; user: types.User }>('POST', path, {
236
+ return this.request<{ user: types.User; session: types.Session; requiresTwoFactor: boolean }>('POST', path, {
216
237
  body: request,
217
238
  });
218
239
  }
@@ -231,7 +252,7 @@ export class AuthsomeClient {
231
252
  });
232
253
  }
233
254
 
234
- async updateUser(request: { name?: string; email?: string }): Promise<{ user: types.User }> {
255
+ async updateUser(request: { email?: string; name?: string }): Promise<{ user: types.User }> {
235
256
  const path = '/user/update';
236
257
  return this.request<{ user: types.User }>('POST', path, {
237
258
  body: request,
@@ -246,12 +267,63 @@ export class AuthsomeClient {
246
267
  });
247
268
  }
248
269
 
249
- async revokeDevice(request: { deviceId: string }): Promise<{ success: boolean }> {
270
+ async revokeDevice(request: { fingerprint: string }): Promise<{ status: string }> {
250
271
  const path = '/devices/revoke';
251
- return this.request<{ success: boolean }>('POST', path, {
272
+ return this.request<{ status: string }>('POST', path, {
252
273
  body: request,
253
274
  auth: true,
254
275
  });
255
276
  }
256
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
+
257
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 { SsoPlugin, ssoClient } from './plugins/sso';
10
- export { TwofaPlugin, twofaClient } from './plugins/twofa';
11
- export { WebhookPlugin, webhookClient } from './plugins/webhook';
12
9
  export { AdminPlugin, adminClient } from './plugins/admin';
13
- export { ApikeyPlugin, apikeyClient } from './plugins/apikey';
14
- export { EmailotpPlugin, emailotpClient } from './plugins/emailotp';
15
- export { BackupauthPlugin, backupauthClient } from './plugins/backupauth';
10
+ export { CmsPlugin, cmsClient } from './plugins/cms';
16
11
  export { CompliancePlugin, complianceClient } from './plugins/compliance';
12
+ export { StepupPlugin, stepupClient } from './plugins/stepup';
13
+ export { PasskeyPlugin, passkeyClient } from './plugins/passkey';
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';
17
20
  export { ImpersonationPlugin, impersonationClient } from './plugins/impersonation';
18
21
  export { MagiclinkPlugin, magiclinkClient } from './plugins/magiclink';
19
- export { MultiappPlugin, multiappClient } from './plugins/multiapp';
22
+ export { SecretsPlugin, secretsClient } from './plugins/secrets';
23
+ export { SsoPlugin, ssoClient } from './plugins/sso';
20
24
  export { AnonymousPlugin, anonymousClient } from './plugins/anonymous';
21
- export { JwtPlugin, jwtClient } from './plugins/jwt';
22
- export { MfaPlugin, mfaClient } from './plugins/mfa';
23
- export { MultisessionPlugin, multisessionClient } from './plugins/multisession';
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';
24
29
  export { NotificationPlugin, notificationClient } from './plugins/notification';
25
- export { OidcproviderPlugin, oidcproviderClient } from './plugins/oidcprovider';
26
- export { OrganizationPlugin, organizationClient } from './plugins/organization';
27
- export { PasskeyPlugin, passkeyClient } from './plugins/passkey';
28
- export { SocialPlugin, socialClient } from './plugins/social';
30
+ export { PermissionsPlugin, permissionsClient } from './plugins/permissions';
29
31
  export { UsernamePlugin, usernameClient } from './plugins/username';
30
32
  export { ConsentPlugin, consentClient } from './plugins/consent';
31
- export { IdverificationPlugin, idverificationClient } from './plugins/idverification';
32
- export { StepupPlugin, stepupClient } from './plugins/stepup';
33
+ export { MfaPlugin, mfaClient } from './plugins/mfa';
34
+ export { SocialPlugin, socialClient } from './plugins/social';
35
+ export { JwtPlugin, jwtClient } from './plugins/jwt';
36
+ export { MultiappPlugin, multiappClient } from './plugins/multiapp';
33
37
  export { PhonePlugin, phoneClient } from './plugins/phone';
@@ -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 = '/users/:id';
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 = '/users/:id/ban';
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 = '/users/:id/unban';
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 = '/users/:id/impersonate';
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 = '/users/:id/role';
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 = '/sessions/:id';
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
 
@@ -12,11 +12,14 @@ export class ApikeyPlugin implements ClientPlugin {
12
12
  this.client = client;
13
13
  }
14
14
 
15
- async createAPIKey(request: types.CreateAPIKey_reqBody): Promise<types.CreateAPIKeyResponse> {
15
+ async createAPIKey(): Promise<void> {
16
16
  const path = '/createapikey';
17
- return this.client.request<types.CreateAPIKeyResponse>('POST', path, {
18
- body: request,
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 = '/:id';
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 = '/:id';
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 = '/:id';
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 = '/trusted-contacts/:id';
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 = '/documents/:id';
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 = '/documents/:id/review';
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 = '/sessions/:id/approve';
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 = '/sessions/:id/reject';
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
+ }