@appwrite.io/console 0.4.2 → 0.6.0-rc.1

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 (83) hide show
  1. package/.github/workflows/publish.yml +2 -2
  2. package/LICENSE +1 -1
  3. package/README.md +1 -1
  4. package/dist/cjs/sdk.js +2115 -109
  5. package/dist/cjs/sdk.js.map +1 -1
  6. package/dist/esm/sdk.js +2115 -110
  7. package/dist/esm/sdk.js.map +1 -1
  8. package/dist/iife/sdk.js +2115 -109
  9. package/docs/examples/account/add-authenticator.md +18 -0
  10. package/docs/examples/account/create-challenge.md +18 -0
  11. package/docs/examples/account/list-providers.md +18 -0
  12. package/docs/examples/account/update-challenge.md +18 -0
  13. package/docs/examples/account/update-m-f-a.md +18 -0
  14. package/docs/examples/account/update-recovery.md +1 -1
  15. package/docs/examples/account/verify-authenticator.md +18 -0
  16. package/docs/examples/messaging/create-apns-provider.md +18 -0
  17. package/docs/examples/messaging/create-email-message.md +18 -0
  18. package/docs/examples/messaging/create-fcm-provider.md +18 -0
  19. package/docs/examples/messaging/create-mailgun-provider.md +18 -0
  20. package/docs/examples/messaging/create-msg91provider.md +18 -0
  21. package/docs/examples/messaging/create-push-message.md +18 -0
  22. package/docs/examples/messaging/create-s-m-s-message.md +18 -0
  23. package/docs/examples/messaging/create-sendgrid-provider.md +18 -0
  24. package/docs/examples/messaging/create-subscriber.md +18 -0
  25. package/docs/examples/messaging/create-telesign-provider.md +18 -0
  26. package/docs/examples/messaging/create-textmagic-provider.md +18 -0
  27. package/docs/examples/messaging/create-topic.md +18 -0
  28. package/docs/examples/messaging/create-twilio-provider.md +18 -0
  29. package/docs/examples/messaging/create-vonage-provider.md +18 -0
  30. package/docs/examples/messaging/delete-provider.md +18 -0
  31. package/docs/examples/messaging/delete-subscriber.md +18 -0
  32. package/docs/examples/messaging/delete-topic.md +18 -0
  33. package/docs/examples/messaging/get-message.md +18 -0
  34. package/docs/examples/messaging/get-provider.md +18 -0
  35. package/docs/examples/messaging/get-subscriber.md +18 -0
  36. package/docs/examples/messaging/get-topic.md +18 -0
  37. package/docs/examples/messaging/list-message-logs.md +18 -0
  38. package/docs/examples/messaging/list-messages.md +18 -0
  39. package/docs/examples/messaging/list-provider-logs.md +18 -0
  40. package/docs/examples/messaging/list-providers.md +18 -0
  41. package/docs/examples/messaging/list-subscriber-logs.md +18 -0
  42. package/docs/examples/messaging/list-subscribers.md +18 -0
  43. package/docs/examples/messaging/list-topic-logs.md +18 -0
  44. package/docs/examples/messaging/list-topics.md +18 -0
  45. package/docs/examples/messaging/update-apns-provider.md +18 -0
  46. package/docs/examples/messaging/update-email.md +18 -0
  47. package/docs/examples/messaging/update-fcm-provider.md +18 -0
  48. package/docs/examples/messaging/update-mailgun-provider.md +18 -0
  49. package/docs/examples/messaging/update-msg91provider.md +18 -0
  50. package/docs/examples/messaging/update-push-notification.md +18 -0
  51. package/docs/examples/messaging/update-s-m-s.md +18 -0
  52. package/docs/examples/messaging/update-sendgrid-provider.md +18 -0
  53. package/docs/examples/messaging/update-telesign-provider.md +18 -0
  54. package/docs/examples/messaging/update-textmagic-provider.md +18 -0
  55. package/docs/examples/messaging/update-topic.md +18 -0
  56. package/docs/examples/messaging/update-twilio-provider.md +18 -0
  57. package/docs/examples/messaging/update-vonage-provider.md +18 -0
  58. package/docs/examples/project/get-usage.md +1 -1
  59. package/docs/examples/projects/get-usage.md +18 -0
  60. package/docs/examples/projects/update-auth-mfa-factors.md +18 -0
  61. package/docs/examples/users/create-target.md +18 -0
  62. package/docs/examples/users/delete-target.md +18 -0
  63. package/docs/examples/users/get-target.md +18 -0
  64. package/docs/examples/users/list-targets.md +18 -0
  65. package/docs/examples/users/update-target.md +18 -0
  66. package/package.json +1 -1
  67. package/src/client.ts +1 -1
  68. package/src/index.ts +1 -0
  69. package/src/models.ts +547 -151
  70. package/src/services/account.ts +158 -0
  71. package/src/services/messaging.ts +1901 -0
  72. package/src/services/project.ts +4 -22
  73. package/src/services/projects.ts +58 -0
  74. package/src/services/storage.ts +1 -1
  75. package/src/services/users.ts +188 -1
  76. package/types/index.d.ts +1 -0
  77. package/types/models.d.ts +547 -151
  78. package/types/services/account.d.ts +56 -0
  79. package/types/services/messaging.d.ts +553 -0
  80. package/types/services/project.d.ts +2 -4
  81. package/types/services/projects.d.ts +20 -0
  82. package/types/services/storage.d.ts +1 -1
  83. package/types/services/users.d.ts +59 -1
@@ -14,34 +14,16 @@ export class Project extends Service {
14
14
  * Get usage stats for a project
15
15
  *
16
16
  *
17
- * @param {string} startDate
18
- * @param {string} endDate
19
- * @param {string} period
17
+ * @param {string} range
20
18
  * @throws {AppwriteException}
21
19
  * @returns {Promise}
22
20
  */
23
- async getUsage(startDate: string, endDate: string, period?: string): Promise<Models.UsageProject> {
24
- if (typeof startDate === 'undefined') {
25
- throw new AppwriteException('Missing required parameter: "startDate"');
26
- }
27
-
28
- if (typeof endDate === 'undefined') {
29
- throw new AppwriteException('Missing required parameter: "endDate"');
30
- }
31
-
21
+ async getUsage(range?: string): Promise<Models.UsageProject> {
32
22
  const apiPath = '/project/usage';
33
23
  const payload: Payload = {};
34
24
 
35
- if (typeof startDate !== 'undefined') {
36
- payload['startDate'] = startDate;
37
- }
38
-
39
- if (typeof endDate !== 'undefined') {
40
- payload['endDate'] = endDate;
41
- }
42
-
43
- if (typeof period !== 'undefined') {
44
- payload['period'] = period;
25
+ if (typeof range !== 'undefined') {
26
+ payload['range'] = range;
45
27
  }
46
28
 
47
29
  const uri = new URL(this.client.config.endpoint + apiPath);
@@ -344,6 +344,37 @@ export class Projects extends Service {
344
344
  }, payload);
345
345
  }
346
346
 
347
+ /**
348
+ * Update Project user minimum sessions factors
349
+ *
350
+ *
351
+ * @param {string} projectId
352
+ * @param {number} factors
353
+ * @throws {AppwriteException}
354
+ * @returns {Promise}
355
+ */
356
+ async updateAuthMfaFactors(projectId: string, factors: number): Promise<Models.Project> {
357
+ if (typeof projectId === 'undefined') {
358
+ throw new AppwriteException('Missing required parameter: "projectId"');
359
+ }
360
+
361
+ if (typeof factors === 'undefined') {
362
+ throw new AppwriteException('Missing required parameter: "factors"');
363
+ }
364
+
365
+ const apiPath = '/projects/{projectId}/auth/mfa/factors'.replace('{projectId}', projectId);
366
+ const payload: Payload = {};
367
+
368
+ if (typeof factors !== 'undefined') {
369
+ payload['factors'] = factors;
370
+ }
371
+
372
+ const uri = new URL(this.client.config.endpoint + apiPath);
373
+ return await this.client.call('patch', uri, {
374
+ 'content-type': 'application/json',
375
+ }, payload);
376
+ }
377
+
347
378
  /**
348
379
  * Update authentication password dictionary status. Use this endpoint to enable or disable the dicitonary check for user password
349
380
  *
@@ -1279,6 +1310,33 @@ export class Projects extends Service {
1279
1310
  }, payload);
1280
1311
  }
1281
1312
 
1313
+ /**
1314
+ * Get usage stats for a project
1315
+ *
1316
+ *
1317
+ * @param {string} projectId
1318
+ * @param {string} range
1319
+ * @throws {AppwriteException}
1320
+ * @returns {Promise}
1321
+ */
1322
+ async getUsage(projectId: string, range?: string): Promise<Models.UsageProject> {
1323
+ if (typeof projectId === 'undefined') {
1324
+ throw new AppwriteException('Missing required parameter: "projectId"');
1325
+ }
1326
+
1327
+ const apiPath = '/projects/{projectId}/usage'.replace('{projectId}', projectId);
1328
+ const payload: Payload = {};
1329
+
1330
+ if (typeof range !== 'undefined') {
1331
+ payload['range'] = range;
1332
+ }
1333
+
1334
+ const uri = new URL(this.client.config.endpoint + apiPath);
1335
+ return await this.client.call('get', uri, {
1336
+ 'content-type': 'application/json',
1337
+ }, payload);
1338
+ }
1339
+
1282
1340
  /**
1283
1341
  * List webhooks
1284
1342
  *
@@ -658,7 +658,7 @@ export class Storage extends Service {
658
658
  }
659
659
 
660
660
  /**
661
- * Get usage stats for storage bucket
661
+ * Get usage stats for a storage bucket
662
662
  *
663
663
  *
664
664
  * @param {string} bucketId
@@ -591,10 +591,11 @@ export class Users extends Service {
591
591
  *
592
592
  *
593
593
  * @param {string} range
594
+ * @param {string} provider
594
595
  * @throws {AppwriteException}
595
596
  * @returns {Promise}
596
597
  */
597
- async getUsage(range?: string): Promise<Models.UsageUsers> {
598
+ async getUsage(range?: string, provider?: string): Promise<Models.UsageUsers> {
598
599
  const apiPath = '/users/usage';
599
600
  const payload: Payload = {};
600
601
 
@@ -602,6 +603,10 @@ export class Users extends Service {
602
603
  payload['range'] = range;
603
604
  }
604
605
 
606
+ if (typeof provider !== 'undefined') {
607
+ payload['provider'] = provider;
608
+ }
609
+
605
610
  const uri = new URL(this.client.config.endpoint + apiPath);
606
611
  return await this.client.call('get', uri, {
607
612
  'content-type': 'application/json',
@@ -1039,6 +1044,188 @@ export class Users extends Service {
1039
1044
  }, payload);
1040
1045
  }
1041
1046
 
1047
+ /**
1048
+ * List User Targets
1049
+ *
1050
+ *
1051
+ * @param {string} userId
1052
+ * @param {string} queries
1053
+ * @throws {AppwriteException}
1054
+ * @returns {Promise}
1055
+ */
1056
+ async listTargets(userId: string, queries?: string): Promise<Models.TargetList> {
1057
+ if (typeof userId === 'undefined') {
1058
+ throw new AppwriteException('Missing required parameter: "userId"');
1059
+ }
1060
+
1061
+ const apiPath = '/users/{userId}/targets'.replace('{userId}', userId);
1062
+ const payload: Payload = {};
1063
+
1064
+ if (typeof queries !== 'undefined') {
1065
+ payload['queries'] = queries;
1066
+ }
1067
+
1068
+ const uri = new URL(this.client.config.endpoint + apiPath);
1069
+ return await this.client.call('get', uri, {
1070
+ 'content-type': 'application/json',
1071
+ }, payload);
1072
+ }
1073
+
1074
+ /**
1075
+ * Create User Target
1076
+ *
1077
+ *
1078
+ * @param {string} userId
1079
+ * @param {string} targetId
1080
+ * @param {string} providerType
1081
+ * @param {string} identifier
1082
+ * @param {string} providerId
1083
+ * @param {string} name
1084
+ * @throws {AppwriteException}
1085
+ * @returns {Promise}
1086
+ */
1087
+ async createTarget(userId: string, targetId: string, providerType: string, identifier: string, providerId?: string, name?: string): Promise<Models.Target> {
1088
+ if (typeof userId === 'undefined') {
1089
+ throw new AppwriteException('Missing required parameter: "userId"');
1090
+ }
1091
+
1092
+ if (typeof targetId === 'undefined') {
1093
+ throw new AppwriteException('Missing required parameter: "targetId"');
1094
+ }
1095
+
1096
+ if (typeof providerType === 'undefined') {
1097
+ throw new AppwriteException('Missing required parameter: "providerType"');
1098
+ }
1099
+
1100
+ if (typeof identifier === 'undefined') {
1101
+ throw new AppwriteException('Missing required parameter: "identifier"');
1102
+ }
1103
+
1104
+ const apiPath = '/users/{userId}/targets'.replace('{userId}', userId);
1105
+ const payload: Payload = {};
1106
+
1107
+ if (typeof targetId !== 'undefined') {
1108
+ payload['targetId'] = targetId;
1109
+ }
1110
+
1111
+ if (typeof providerType !== 'undefined') {
1112
+ payload['providerType'] = providerType;
1113
+ }
1114
+
1115
+ if (typeof identifier !== 'undefined') {
1116
+ payload['identifier'] = identifier;
1117
+ }
1118
+
1119
+ if (typeof providerId !== 'undefined') {
1120
+ payload['providerId'] = providerId;
1121
+ }
1122
+
1123
+ if (typeof name !== 'undefined') {
1124
+ payload['name'] = name;
1125
+ }
1126
+
1127
+ const uri = new URL(this.client.config.endpoint + apiPath);
1128
+ return await this.client.call('post', uri, {
1129
+ 'content-type': 'application/json',
1130
+ }, payload);
1131
+ }
1132
+
1133
+ /**
1134
+ * Get User Target
1135
+ *
1136
+ *
1137
+ * @param {string} userId
1138
+ * @param {string} targetId
1139
+ * @throws {AppwriteException}
1140
+ * @returns {Promise}
1141
+ */
1142
+ async getTarget(userId: string, targetId: string): Promise<Models.Target> {
1143
+ if (typeof userId === 'undefined') {
1144
+ throw new AppwriteException('Missing required parameter: "userId"');
1145
+ }
1146
+
1147
+ if (typeof targetId === 'undefined') {
1148
+ throw new AppwriteException('Missing required parameter: "targetId"');
1149
+ }
1150
+
1151
+ const apiPath = '/users/{userId}/targets/{targetId}'.replace('{userId}', userId).replace('{targetId}', targetId);
1152
+ const payload: Payload = {};
1153
+
1154
+ const uri = new URL(this.client.config.endpoint + apiPath);
1155
+ return await this.client.call('get', uri, {
1156
+ 'content-type': 'application/json',
1157
+ }, payload);
1158
+ }
1159
+
1160
+ /**
1161
+ * Update User target
1162
+ *
1163
+ *
1164
+ * @param {string} userId
1165
+ * @param {string} targetId
1166
+ * @param {string} identifier
1167
+ * @param {string} providerId
1168
+ * @param {string} name
1169
+ * @throws {AppwriteException}
1170
+ * @returns {Promise}
1171
+ */
1172
+ async updateTarget(userId: string, targetId: string, identifier?: string, providerId?: string, name?: string): Promise<Models.Target> {
1173
+ if (typeof userId === 'undefined') {
1174
+ throw new AppwriteException('Missing required parameter: "userId"');
1175
+ }
1176
+
1177
+ if (typeof targetId === 'undefined') {
1178
+ throw new AppwriteException('Missing required parameter: "targetId"');
1179
+ }
1180
+
1181
+ const apiPath = '/users/{userId}/targets/{targetId}'.replace('{userId}', userId).replace('{targetId}', targetId);
1182
+ const payload: Payload = {};
1183
+
1184
+ if (typeof identifier !== 'undefined') {
1185
+ payload['identifier'] = identifier;
1186
+ }
1187
+
1188
+ if (typeof providerId !== 'undefined') {
1189
+ payload['providerId'] = providerId;
1190
+ }
1191
+
1192
+ if (typeof name !== 'undefined') {
1193
+ payload['name'] = name;
1194
+ }
1195
+
1196
+ const uri = new URL(this.client.config.endpoint + apiPath);
1197
+ return await this.client.call('patch', uri, {
1198
+ 'content-type': 'application/json',
1199
+ }, payload);
1200
+ }
1201
+
1202
+ /**
1203
+ * Delete user target
1204
+ *
1205
+ *
1206
+ * @param {string} userId
1207
+ * @param {string} targetId
1208
+ * @throws {AppwriteException}
1209
+ * @returns {Promise}
1210
+ */
1211
+ async deleteTarget(userId: string, targetId: string): Promise<{}> {
1212
+ if (typeof userId === 'undefined') {
1213
+ throw new AppwriteException('Missing required parameter: "userId"');
1214
+ }
1215
+
1216
+ if (typeof targetId === 'undefined') {
1217
+ throw new AppwriteException('Missing required parameter: "targetId"');
1218
+ }
1219
+
1220
+ const apiPath = '/users/{userId}/targets/{targetId}'.replace('{userId}', userId).replace('{targetId}', targetId);
1221
+ const payload: Payload = {};
1222
+
1223
+ const uri = new URL(this.client.config.endpoint + apiPath);
1224
+ return await this.client.call('delete', uri, {
1225
+ 'content-type': 'application/json',
1226
+ }, payload);
1227
+ }
1228
+
1042
1229
  /**
1043
1230
  * Update email verification
1044
1231
  *
package/types/index.d.ts CHANGED
@@ -8,6 +8,7 @@ export { Functions } from './services/functions';
8
8
  export { Graphql } from './services/graphql';
9
9
  export { Health } from './services/health';
10
10
  export { Locale } from './services/locale';
11
+ export { Messaging } from './services/messaging';
11
12
  export { Migrations } from './services/migrations';
12
13
  export { Project } from './services/project';
13
14
  export { Projects } from './services/projects';