@appwrite.io/console 0.1.0 → 0.2.0
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/.github/workflows/publish.yml +18 -0
- package/README.md +5 -5
- package/dist/cjs/sdk.js +155 -36
- package/dist/cjs/sdk.js.map +1 -1
- package/dist/esm/sdk.js +154 -37
- package/dist/esm/sdk.js.map +1 -1
- package/dist/iife/sdk.js +155 -36
- package/docs/examples/account/create-with-invite-code.md +18 -0
- package/docs/examples/console/variables.md +18 -0
- package/docs/examples/health/get-pub-sub.md +18 -0
- package/docs/examples/health/get-queue.md +18 -0
- package/docs/examples/{projects → project}/get-usage.md +3 -3
- package/package.json +1 -1
- package/src/client.ts +1 -1
- package/src/index.ts +2 -0
- package/src/models.ts +117 -215
- package/src/query.ts +18 -0
- package/src/services/account.ts +60 -0
- package/src/services/console.ts +30 -0
- package/src/services/databases.ts +11 -11
- package/src/services/health.ts +39 -2
- package/src/services/project.ts +34 -0
- package/src/services/projects.ts +0 -27
- package/src/services/storage.ts +1 -1
- package/src/services/users.ts +1 -6
- package/types/index.d.ts +2 -0
- package/types/models.d.ts +117 -215
- package/types/query.d.ts +6 -0
- package/types/services/account.d.ts +19 -0
- package/types/services/console.d.ts +15 -0
- package/types/services/databases.d.ts +11 -11
- package/types/services/health.d.ts +21 -2
- package/types/services/project.d.ts +15 -0
- package/types/services/projects.d.ts +0 -10
- package/types/services/storage.d.ts +1 -1
- package/types/services/users.d.ts +1 -2
- package/.travis.yml +0 -32
package/src/models.ts
CHANGED
|
@@ -1082,6 +1082,59 @@ export namespace Models {
|
|
|
1082
1082
|
*/
|
|
1083
1083
|
threads: number;
|
|
1084
1084
|
}
|
|
1085
|
+
/**
|
|
1086
|
+
* Account
|
|
1087
|
+
*/
|
|
1088
|
+
export type Account<Preferences extends Models.Preferences> = {
|
|
1089
|
+
/**
|
|
1090
|
+
* User ID.
|
|
1091
|
+
*/
|
|
1092
|
+
$id: string;
|
|
1093
|
+
/**
|
|
1094
|
+
* User creation date in ISO 8601 format.
|
|
1095
|
+
*/
|
|
1096
|
+
$createdAt: string;
|
|
1097
|
+
/**
|
|
1098
|
+
* User update date in ISO 8601 format.
|
|
1099
|
+
*/
|
|
1100
|
+
$updatedAt: string;
|
|
1101
|
+
/**
|
|
1102
|
+
* User name.
|
|
1103
|
+
*/
|
|
1104
|
+
name: string;
|
|
1105
|
+
/**
|
|
1106
|
+
* User registration date in ISO 8601 format.
|
|
1107
|
+
*/
|
|
1108
|
+
registration: string;
|
|
1109
|
+
/**
|
|
1110
|
+
* User status. Pass `true` for enabled and `false` for disabled.
|
|
1111
|
+
*/
|
|
1112
|
+
status: boolean;
|
|
1113
|
+
/**
|
|
1114
|
+
* Password update time in ISO 8601 format.
|
|
1115
|
+
*/
|
|
1116
|
+
passwordUpdate: string;
|
|
1117
|
+
/**
|
|
1118
|
+
* User email address.
|
|
1119
|
+
*/
|
|
1120
|
+
email: string;
|
|
1121
|
+
/**
|
|
1122
|
+
* User phone number in E.164 format.
|
|
1123
|
+
*/
|
|
1124
|
+
phone: string;
|
|
1125
|
+
/**
|
|
1126
|
+
* Email verification status.
|
|
1127
|
+
*/
|
|
1128
|
+
emailVerification: boolean;
|
|
1129
|
+
/**
|
|
1130
|
+
* Phone verification status.
|
|
1131
|
+
*/
|
|
1132
|
+
phoneVerification: boolean;
|
|
1133
|
+
/**
|
|
1134
|
+
* User preferences as a key-value object
|
|
1135
|
+
*/
|
|
1136
|
+
prefs: Preferences;
|
|
1137
|
+
}
|
|
1085
1138
|
/**
|
|
1086
1139
|
* Preferences
|
|
1087
1140
|
*/
|
|
@@ -1492,14 +1545,6 @@ export namespace Models {
|
|
|
1492
1545
|
* Function execution schedult in CRON format.
|
|
1493
1546
|
*/
|
|
1494
1547
|
schedule: string;
|
|
1495
|
-
/**
|
|
1496
|
-
* Function's next scheduled execution time in ISO 8601 format.
|
|
1497
|
-
*/
|
|
1498
|
-
scheduleNext: string;
|
|
1499
|
-
/**
|
|
1500
|
-
* Function's previous scheduled execution time in ISO 8601 format.
|
|
1501
|
-
*/
|
|
1502
|
-
schedulePrevious: string;
|
|
1503
1548
|
/**
|
|
1504
1549
|
* Function execution timeout in seconds.
|
|
1505
1550
|
*/
|
|
@@ -2150,6 +2195,10 @@ export namespace Models {
|
|
|
2150
2195
|
* Health Status
|
|
2151
2196
|
*/
|
|
2152
2197
|
export type HealthStatus = {
|
|
2198
|
+
/**
|
|
2199
|
+
* Name of the service.
|
|
2200
|
+
*/
|
|
2201
|
+
name: string;
|
|
2153
2202
|
/**
|
|
2154
2203
|
* Duration in milliseconds how long the health check took.
|
|
2155
2204
|
*/
|
|
@@ -2200,63 +2249,15 @@ export namespace Models {
|
|
|
2200
2249
|
/**
|
|
2201
2250
|
* Aggregated stats for total number of documents.
|
|
2202
2251
|
*/
|
|
2203
|
-
|
|
2204
|
-
/**
|
|
2205
|
-
* Aggregated stats for total number of documents.
|
|
2206
|
-
*/
|
|
2207
|
-
documentsCount: Metric[];
|
|
2208
|
-
/**
|
|
2209
|
-
* Aggregated stats for total number of collections.
|
|
2210
|
-
*/
|
|
2211
|
-
collectionsCount: Metric[];
|
|
2212
|
-
/**
|
|
2213
|
-
* Aggregated stats for documents created.
|
|
2214
|
-
*/
|
|
2215
|
-
databasesCreate: Metric[];
|
|
2216
|
-
/**
|
|
2217
|
-
* Aggregated stats for documents read.
|
|
2218
|
-
*/
|
|
2219
|
-
databasesRead: Metric[];
|
|
2220
|
-
/**
|
|
2221
|
-
* Aggregated stats for documents updated.
|
|
2222
|
-
*/
|
|
2223
|
-
databasesUpdate: Metric[];
|
|
2252
|
+
databasesTotal: Metric[];
|
|
2224
2253
|
/**
|
|
2225
2254
|
* Aggregated stats for total number of collections.
|
|
2226
2255
|
*/
|
|
2227
|
-
|
|
2228
|
-
/**
|
|
2229
|
-
* Aggregated stats for documents created.
|
|
2230
|
-
*/
|
|
2231
|
-
documentsCreate: Metric[];
|
|
2232
|
-
/**
|
|
2233
|
-
* Aggregated stats for documents read.
|
|
2234
|
-
*/
|
|
2235
|
-
documentsRead: Metric[];
|
|
2236
|
-
/**
|
|
2237
|
-
* Aggregated stats for documents updated.
|
|
2238
|
-
*/
|
|
2239
|
-
documentsUpdate: Metric[];
|
|
2240
|
-
/**
|
|
2241
|
-
* Aggregated stats for documents deleted.
|
|
2242
|
-
*/
|
|
2243
|
-
documentsDelete: Metric[];
|
|
2256
|
+
collectionsTotal: Metric[];
|
|
2244
2257
|
/**
|
|
2245
|
-
* Aggregated stats for
|
|
2246
|
-
*/
|
|
2247
|
-
collectionsCreate: Metric[];
|
|
2248
|
-
/**
|
|
2249
|
-
* Aggregated stats for collections read.
|
|
2250
|
-
*/
|
|
2251
|
-
collectionsRead: Metric[];
|
|
2252
|
-
/**
|
|
2253
|
-
* Aggregated stats for collections updated.
|
|
2254
|
-
*/
|
|
2255
|
-
collectionsUpdate: Metric[];
|
|
2256
|
-
/**
|
|
2257
|
-
* Aggregated stats for collections delete.
|
|
2258
|
+
* Aggregated stats for total number of documents.
|
|
2258
2259
|
*/
|
|
2259
|
-
|
|
2260
|
+
documentsTotal: Metric[];
|
|
2260
2261
|
}
|
|
2261
2262
|
/**
|
|
2262
2263
|
* UsageDatabase
|
|
@@ -2266,46 +2267,14 @@ export namespace Models {
|
|
|
2266
2267
|
* The time range of the usage stats.
|
|
2267
2268
|
*/
|
|
2268
2269
|
range: string;
|
|
2269
|
-
/**
|
|
2270
|
-
* Aggregated stats for total number of documents.
|
|
2271
|
-
*/
|
|
2272
|
-
documentsCount: Metric[];
|
|
2273
2270
|
/**
|
|
2274
2271
|
* Aggregated stats for total number of collections.
|
|
2275
2272
|
*/
|
|
2276
|
-
|
|
2273
|
+
collectionsTotal: Metric[];
|
|
2277
2274
|
/**
|
|
2278
|
-
* Aggregated stats for documents
|
|
2279
|
-
*/
|
|
2280
|
-
documentsCreate: Metric[];
|
|
2281
|
-
/**
|
|
2282
|
-
* Aggregated stats for documents read.
|
|
2283
|
-
*/
|
|
2284
|
-
documentsRead: Metric[];
|
|
2285
|
-
/**
|
|
2286
|
-
* Aggregated stats for documents updated.
|
|
2287
|
-
*/
|
|
2288
|
-
documentsUpdate: Metric[];
|
|
2289
|
-
/**
|
|
2290
|
-
* Aggregated stats for documents deleted.
|
|
2291
|
-
*/
|
|
2292
|
-
documentsDelete: Metric[];
|
|
2293
|
-
/**
|
|
2294
|
-
* Aggregated stats for collections created.
|
|
2295
|
-
*/
|
|
2296
|
-
collectionsCreate: Metric[];
|
|
2297
|
-
/**
|
|
2298
|
-
* Aggregated stats for collections read.
|
|
2299
|
-
*/
|
|
2300
|
-
collectionsRead: Metric[];
|
|
2301
|
-
/**
|
|
2302
|
-
* Aggregated stats for collections updated.
|
|
2303
|
-
*/
|
|
2304
|
-
collectionsUpdate: Metric[];
|
|
2305
|
-
/**
|
|
2306
|
-
* Aggregated stats for collections delete.
|
|
2275
|
+
* Aggregated stats for total number of documents.
|
|
2307
2276
|
*/
|
|
2308
|
-
|
|
2277
|
+
documentsTotal: Metric[];
|
|
2309
2278
|
}
|
|
2310
2279
|
/**
|
|
2311
2280
|
* UsageCollection
|
|
@@ -2318,23 +2287,7 @@ export namespace Models {
|
|
|
2318
2287
|
/**
|
|
2319
2288
|
* Aggregated stats for total number of documents.
|
|
2320
2289
|
*/
|
|
2321
|
-
|
|
2322
|
-
/**
|
|
2323
|
-
* Aggregated stats for documents created.
|
|
2324
|
-
*/
|
|
2325
|
-
documentsCreate: Metric[];
|
|
2326
|
-
/**
|
|
2327
|
-
* Aggregated stats for documents read.
|
|
2328
|
-
*/
|
|
2329
|
-
documentsRead: Metric[];
|
|
2330
|
-
/**
|
|
2331
|
-
* Aggregated stats for documents updated.
|
|
2332
|
-
*/
|
|
2333
|
-
documentsUpdate: Metric[];
|
|
2334
|
-
/**
|
|
2335
|
-
* Aggregated stats for documents deleted.
|
|
2336
|
-
*/
|
|
2337
|
-
documentsDelete: Metric[];
|
|
2290
|
+
documentsTotal: Metric[];
|
|
2338
2291
|
}
|
|
2339
2292
|
/**
|
|
2340
2293
|
* UsageUsers
|
|
@@ -2347,35 +2300,11 @@ export namespace Models {
|
|
|
2347
2300
|
/**
|
|
2348
2301
|
* Aggregated stats for total number of users.
|
|
2349
2302
|
*/
|
|
2350
|
-
|
|
2351
|
-
/**
|
|
2352
|
-
* Aggregated stats for users created.
|
|
2353
|
-
*/
|
|
2354
|
-
usersCreate: Metric[];
|
|
2355
|
-
/**
|
|
2356
|
-
* Aggregated stats for users read.
|
|
2357
|
-
*/
|
|
2358
|
-
usersRead: Metric[];
|
|
2359
|
-
/**
|
|
2360
|
-
* Aggregated stats for users updated.
|
|
2361
|
-
*/
|
|
2362
|
-
usersUpdate: Metric[];
|
|
2363
|
-
/**
|
|
2364
|
-
* Aggregated stats for users deleted.
|
|
2365
|
-
*/
|
|
2366
|
-
usersDelete: Metric[];
|
|
2303
|
+
usersTotal: Metric[];
|
|
2367
2304
|
/**
|
|
2368
2305
|
* Aggregated stats for sessions created.
|
|
2369
2306
|
*/
|
|
2370
|
-
|
|
2371
|
-
/**
|
|
2372
|
-
* Aggregated stats for sessions created for a provider ( email, anonymous or oauth2 ).
|
|
2373
|
-
*/
|
|
2374
|
-
sessionsProviderCreate: Metric[];
|
|
2375
|
-
/**
|
|
2376
|
-
* Aggregated stats for sessions deleted.
|
|
2377
|
-
*/
|
|
2378
|
-
sessionsDelete: Metric[];
|
|
2307
|
+
sessionsTotal: Metric[];
|
|
2379
2308
|
}
|
|
2380
2309
|
/**
|
|
2381
2310
|
* StorageUsage
|
|
@@ -2385,50 +2314,18 @@ export namespace Models {
|
|
|
2385
2314
|
* The time range of the usage stats.
|
|
2386
2315
|
*/
|
|
2387
2316
|
range: string;
|
|
2388
|
-
/**
|
|
2389
|
-
* Aggregated stats for the occupied storage size (in bytes).
|
|
2390
|
-
*/
|
|
2391
|
-
storage: Metric[];
|
|
2392
|
-
/**
|
|
2393
|
-
* Aggregated stats for total number of files.
|
|
2394
|
-
*/
|
|
2395
|
-
filesCount: Metric[];
|
|
2396
2317
|
/**
|
|
2397
2318
|
* Aggregated stats for total number of buckets.
|
|
2398
2319
|
*/
|
|
2399
|
-
|
|
2400
|
-
/**
|
|
2401
|
-
* Aggregated stats for buckets created.
|
|
2402
|
-
*/
|
|
2403
|
-
bucketsCreate: Metric[];
|
|
2404
|
-
/**
|
|
2405
|
-
* Aggregated stats for buckets read.
|
|
2406
|
-
*/
|
|
2407
|
-
bucketsRead: Metric[];
|
|
2320
|
+
bucketsTotal: Metric[];
|
|
2408
2321
|
/**
|
|
2409
|
-
* Aggregated stats for
|
|
2410
|
-
*/
|
|
2411
|
-
bucketsUpdate: Metric[];
|
|
2412
|
-
/**
|
|
2413
|
-
* Aggregated stats for buckets deleted.
|
|
2414
|
-
*/
|
|
2415
|
-
bucketsDelete: Metric[];
|
|
2416
|
-
/**
|
|
2417
|
-
* Aggregated stats for files created.
|
|
2418
|
-
*/
|
|
2419
|
-
filesCreate: Metric[];
|
|
2420
|
-
/**
|
|
2421
|
-
* Aggregated stats for files read.
|
|
2422
|
-
*/
|
|
2423
|
-
filesRead: Metric[];
|
|
2424
|
-
/**
|
|
2425
|
-
* Aggregated stats for files updated.
|
|
2322
|
+
* Aggregated stats for total number of files.
|
|
2426
2323
|
*/
|
|
2427
|
-
|
|
2324
|
+
filesTotal: Metric[];
|
|
2428
2325
|
/**
|
|
2429
|
-
* Aggregated stats for
|
|
2326
|
+
* Aggregated stats for the occupied storage size (in bytes).
|
|
2430
2327
|
*/
|
|
2431
|
-
|
|
2328
|
+
filesStorage: Metric[];
|
|
2432
2329
|
}
|
|
2433
2330
|
/**
|
|
2434
2331
|
* UsageBuckets
|
|
@@ -2441,27 +2338,11 @@ export namespace Models {
|
|
|
2441
2338
|
/**
|
|
2442
2339
|
* Aggregated stats for total number of files in this bucket.
|
|
2443
2340
|
*/
|
|
2444
|
-
|
|
2341
|
+
filesTotal: Metric[];
|
|
2445
2342
|
/**
|
|
2446
2343
|
* Aggregated stats for total storage of files in this bucket.
|
|
2447
2344
|
*/
|
|
2448
2345
|
filesStorage: Metric[];
|
|
2449
|
-
/**
|
|
2450
|
-
* Aggregated stats for files created.
|
|
2451
|
-
*/
|
|
2452
|
-
filesCreate: Metric[];
|
|
2453
|
-
/**
|
|
2454
|
-
* Aggregated stats for files read.
|
|
2455
|
-
*/
|
|
2456
|
-
filesRead: Metric[];
|
|
2457
|
-
/**
|
|
2458
|
-
* Aggregated stats for files updated.
|
|
2459
|
-
*/
|
|
2460
|
-
filesUpdate: Metric[];
|
|
2461
|
-
/**
|
|
2462
|
-
* Aggregated stats for files deleted.
|
|
2463
|
-
*/
|
|
2464
|
-
filesDelete: Metric[];
|
|
2465
2346
|
}
|
|
2466
2347
|
/**
|
|
2467
2348
|
* UsageFunctions
|
|
@@ -2472,37 +2353,37 @@ export namespace Models {
|
|
|
2472
2353
|
*/
|
|
2473
2354
|
range: string;
|
|
2474
2355
|
/**
|
|
2475
|
-
* Aggregated stats for number of
|
|
2476
|
-
*/
|
|
2477
|
-
executionsTotal: Metric[];
|
|
2478
|
-
/**
|
|
2479
|
-
* Aggregated stats for function execution failures.
|
|
2356
|
+
* Aggregated stats for number of functions.
|
|
2480
2357
|
*/
|
|
2481
|
-
|
|
2358
|
+
functionsTotal: Metric[];
|
|
2482
2359
|
/**
|
|
2483
|
-
* Aggregated stats for function
|
|
2360
|
+
* Aggregated stats for number of function deployments.
|
|
2484
2361
|
*/
|
|
2485
|
-
|
|
2362
|
+
deploymentsTotal: Metric[];
|
|
2486
2363
|
/**
|
|
2487
|
-
* Aggregated stats for function
|
|
2364
|
+
* Aggregated stats for function deployments storage.
|
|
2488
2365
|
*/
|
|
2489
|
-
|
|
2366
|
+
deploymentsStorage: Metric[];
|
|
2490
2367
|
/**
|
|
2491
2368
|
* Aggregated stats for number of function builds.
|
|
2492
2369
|
*/
|
|
2493
2370
|
buildsTotal: Metric[];
|
|
2494
2371
|
/**
|
|
2495
|
-
* Aggregated stats for
|
|
2372
|
+
* Aggregated stats for builds storage.
|
|
2496
2373
|
*/
|
|
2497
|
-
|
|
2374
|
+
buildsStorage: Metric[];
|
|
2498
2375
|
/**
|
|
2499
|
-
* Aggregated stats for function build
|
|
2376
|
+
* Aggregated stats for function build compute.
|
|
2500
2377
|
*/
|
|
2501
|
-
|
|
2378
|
+
buildsTime: Metric[];
|
|
2502
2379
|
/**
|
|
2503
|
-
* Aggregated stats for function
|
|
2380
|
+
* Aggregated stats for number of function executions.
|
|
2504
2381
|
*/
|
|
2505
|
-
|
|
2382
|
+
executionsTotal: Metric[];
|
|
2383
|
+
/**
|
|
2384
|
+
* Aggregated stats for function execution compute.
|
|
2385
|
+
*/
|
|
2386
|
+
executionsTime: Metric[];
|
|
2506
2387
|
}
|
|
2507
2388
|
/**
|
|
2508
2389
|
* UsageProject
|
|
@@ -2515,7 +2396,7 @@ export namespace Models {
|
|
|
2515
2396
|
/**
|
|
2516
2397
|
* Aggregated stats for number of requests.
|
|
2517
2398
|
*/
|
|
2518
|
-
|
|
2399
|
+
requestsTotal: Metric[];
|
|
2519
2400
|
/**
|
|
2520
2401
|
* Aggregated stats for consumed bandwidth.
|
|
2521
2402
|
*/
|
|
@@ -2523,26 +2404,47 @@ export namespace Models {
|
|
|
2523
2404
|
/**
|
|
2524
2405
|
* Aggregated stats for function executions.
|
|
2525
2406
|
*/
|
|
2526
|
-
|
|
2407
|
+
executionsTotal: Metric[];
|
|
2527
2408
|
/**
|
|
2528
2409
|
* Aggregated stats for number of documents.
|
|
2529
2410
|
*/
|
|
2530
|
-
|
|
2411
|
+
documentsTotal: Metric[];
|
|
2531
2412
|
/**
|
|
2532
2413
|
* Aggregated stats for number of databases.
|
|
2533
2414
|
*/
|
|
2534
|
-
|
|
2415
|
+
databasesTotal: Metric[];
|
|
2535
2416
|
/**
|
|
2536
2417
|
* Aggregated stats for number of users.
|
|
2537
2418
|
*/
|
|
2538
|
-
|
|
2419
|
+
usersTotal: Metric[];
|
|
2539
2420
|
/**
|
|
2540
2421
|
* Aggregated stats for the occupied storage size (in bytes).
|
|
2541
2422
|
*/
|
|
2542
|
-
|
|
2423
|
+
filesStorage: Metric[];
|
|
2543
2424
|
/**
|
|
2544
2425
|
* Aggregated stats for number of buckets.
|
|
2545
2426
|
*/
|
|
2546
|
-
|
|
2427
|
+
bucketsTotal: Metric[];
|
|
2428
|
+
}
|
|
2429
|
+
/**
|
|
2430
|
+
* Console Variables
|
|
2431
|
+
*/
|
|
2432
|
+
export type ConsoleVariables = {
|
|
2433
|
+
/**
|
|
2434
|
+
* CNAME target for your Appwrite custom domains.
|
|
2435
|
+
*/
|
|
2436
|
+
_APP_DOMAIN_TARGET: string;
|
|
2437
|
+
/**
|
|
2438
|
+
* Maximum file size allowed for file upload in bytes.
|
|
2439
|
+
*/
|
|
2440
|
+
_APP_STORAGE_LIMIT: number;
|
|
2441
|
+
/**
|
|
2442
|
+
* Maximum file size allowed for deployment in bytes.
|
|
2443
|
+
*/
|
|
2444
|
+
_APP_FUNCTIONS_SIZE_LIMIT: number;
|
|
2445
|
+
/**
|
|
2446
|
+
* Defines if usage stats are enabled. This value is set to 'enabled' by default, to disable the usage stats set the value to 'disabled'.
|
|
2447
|
+
*/
|
|
2448
|
+
_APP_USAGE_STATS: string;
|
|
2547
2449
|
}
|
|
2548
2450
|
}
|
package/src/query.ts
CHANGED
|
@@ -21,6 +21,24 @@ export class Query {
|
|
|
21
21
|
static greaterThanEqual = (attribute: string, value: QueryTypes): string =>
|
|
22
22
|
Query.addQuery(attribute, "greaterThanEqual", value);
|
|
23
23
|
|
|
24
|
+
static isNull = (attribute: string): string =>
|
|
25
|
+
`isNull("${attribute}")`;
|
|
26
|
+
|
|
27
|
+
static isNotNull = (attribute: string): string =>
|
|
28
|
+
`isNotNull("${attribute}")`;
|
|
29
|
+
|
|
30
|
+
static between = (attribute: string, start: string|number, end: string|number): string =>
|
|
31
|
+
`between("${attribute}", [${Query.parseValues(start)},${Query.parseValues(end)}])`;
|
|
32
|
+
|
|
33
|
+
static startsWith = (attribute: string, value: string): string =>
|
|
34
|
+
Query.addQuery(attribute, "startsWith", value);
|
|
35
|
+
|
|
36
|
+
static endsWith = (attribute: string, value: string): string =>
|
|
37
|
+
Query.addQuery(attribute, "endsWith", value);
|
|
38
|
+
|
|
39
|
+
static select = (attributes: string[]): string =>
|
|
40
|
+
`select([${attributes.map((attr: string) => `"${attr}"`).join(",")}])`;
|
|
41
|
+
|
|
24
42
|
static search = (attribute: string, value: string): string =>
|
|
25
43
|
Query.addQuery(attribute, "search", value);
|
|
26
44
|
|
package/src/services/account.ts
CHANGED
|
@@ -126,6 +126,66 @@ export class Account extends Service {
|
|
|
126
126
|
}, payload);
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
+
/**
|
|
130
|
+
* Create account using an invite code
|
|
131
|
+
*
|
|
132
|
+
* Use this endpoint to allow a new user to register a new account in your
|
|
133
|
+
* project. After the user registration completes successfully, you can use
|
|
134
|
+
* the [/account/verfication](/docs/client/account#accountCreateVerification)
|
|
135
|
+
* route to start verifying the user email address. To allow the new user to
|
|
136
|
+
* login to their new account, you need to create a new [account
|
|
137
|
+
* session](/docs/client/account#accountCreateSession).
|
|
138
|
+
*
|
|
139
|
+
* @param {string} userId
|
|
140
|
+
* @param {string} email
|
|
141
|
+
* @param {string} password
|
|
142
|
+
* @param {string} name
|
|
143
|
+
* @param {string} code
|
|
144
|
+
* @throws {AppwriteException}
|
|
145
|
+
* @returns {Promise}
|
|
146
|
+
*/
|
|
147
|
+
async createWithInviteCode<Preferences extends Models.Preferences>(userId: string, email: string, password: string, name?: string, code?: string): Promise<Models.Account<Preferences>> {
|
|
148
|
+
if (typeof userId === 'undefined') {
|
|
149
|
+
throw new AppwriteException('Missing required parameter: "userId"');
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
if (typeof email === 'undefined') {
|
|
153
|
+
throw new AppwriteException('Missing required parameter: "email"');
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
if (typeof password === 'undefined') {
|
|
157
|
+
throw new AppwriteException('Missing required parameter: "password"');
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
let path = '/account/invite';
|
|
161
|
+
let payload: Payload = {};
|
|
162
|
+
|
|
163
|
+
if (typeof userId !== 'undefined') {
|
|
164
|
+
payload['userId'] = userId;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
if (typeof email !== 'undefined') {
|
|
168
|
+
payload['email'] = email;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
if (typeof password !== 'undefined') {
|
|
172
|
+
payload['password'] = password;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
if (typeof name !== 'undefined') {
|
|
176
|
+
payload['name'] = name;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
if (typeof code !== 'undefined') {
|
|
180
|
+
payload['code'] = code;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
184
|
+
return await this.client.call('post', uri, {
|
|
185
|
+
'content-type': 'application/json',
|
|
186
|
+
}, payload);
|
|
187
|
+
}
|
|
188
|
+
|
|
129
189
|
/**
|
|
130
190
|
* Create JWT
|
|
131
191
|
*
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Service } from '../service';
|
|
2
|
+
import { AppwriteException, Client } from '../client';
|
|
3
|
+
import type { Models } from '../models';
|
|
4
|
+
import type { UploadProgress, Payload } from '../client';
|
|
5
|
+
|
|
6
|
+
export class Console extends Service {
|
|
7
|
+
|
|
8
|
+
constructor(client: Client)
|
|
9
|
+
{
|
|
10
|
+
super(client);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Get Variables
|
|
15
|
+
*
|
|
16
|
+
* Get all Environment Variables that are relevant for the console.
|
|
17
|
+
*
|
|
18
|
+
* @throws {AppwriteException}
|
|
19
|
+
* @returns {Promise}
|
|
20
|
+
*/
|
|
21
|
+
async variables(): Promise<Models.ConsoleVariables> {
|
|
22
|
+
let path = '/console/variables';
|
|
23
|
+
let payload: Payload = {};
|
|
24
|
+
|
|
25
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
26
|
+
return await this.client.call('get', uri, {
|
|
27
|
+
'content-type': 'application/json',
|
|
28
|
+
}, payload);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
@@ -472,7 +472,7 @@ export class Databases extends Service {
|
|
|
472
472
|
* @throws {AppwriteException}
|
|
473
473
|
* @returns {Promise}
|
|
474
474
|
*/
|
|
475
|
-
async updateBooleanAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault
|
|
475
|
+
async updateBooleanAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean): Promise<Models.AttributeBoolean> {
|
|
476
476
|
if (typeof databaseId === 'undefined') {
|
|
477
477
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
478
478
|
}
|
|
@@ -577,7 +577,7 @@ export class Databases extends Service {
|
|
|
577
577
|
* @throws {AppwriteException}
|
|
578
578
|
* @returns {Promise}
|
|
579
579
|
*/
|
|
580
|
-
async updateDatetimeAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault
|
|
580
|
+
async updateDatetimeAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string): Promise<Models.AttributeDatetime> {
|
|
581
581
|
if (typeof databaseId === 'undefined') {
|
|
582
582
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
583
583
|
}
|
|
@@ -687,7 +687,7 @@ export class Databases extends Service {
|
|
|
687
687
|
* @throws {AppwriteException}
|
|
688
688
|
* @returns {Promise}
|
|
689
689
|
*/
|
|
690
|
-
async updateEmailAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault
|
|
690
|
+
async updateEmailAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string): Promise<Models.AttributeEmail> {
|
|
691
691
|
if (typeof databaseId === 'undefined') {
|
|
692
692
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
693
693
|
}
|
|
@@ -805,7 +805,7 @@ export class Databases extends Service {
|
|
|
805
805
|
* @throws {AppwriteException}
|
|
806
806
|
* @returns {Promise}
|
|
807
807
|
*/
|
|
808
|
-
async updateEnumAttribute(databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault
|
|
808
|
+
async updateEnumAttribute(databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string): Promise<Models.AttributeEnum> {
|
|
809
809
|
if (typeof databaseId === 'undefined') {
|
|
810
810
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
811
811
|
}
|
|
@@ -936,7 +936,7 @@ export class Databases extends Service {
|
|
|
936
936
|
* @throws {AppwriteException}
|
|
937
937
|
* @returns {Promise}
|
|
938
938
|
*/
|
|
939
|
-
async updateFloatAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min: number, max: number, xdefault
|
|
939
|
+
async updateFloatAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min: number, max: number, xdefault?: number): Promise<Models.AttributeFloat> {
|
|
940
940
|
if (typeof databaseId === 'undefined') {
|
|
941
941
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
942
942
|
}
|
|
@@ -1075,7 +1075,7 @@ export class Databases extends Service {
|
|
|
1075
1075
|
* @throws {AppwriteException}
|
|
1076
1076
|
* @returns {Promise}
|
|
1077
1077
|
*/
|
|
1078
|
-
async updateIntegerAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min: number, max: number, xdefault
|
|
1078
|
+
async updateIntegerAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min: number, max: number, xdefault?: number): Promise<Models.AttributeInteger> {
|
|
1079
1079
|
if (typeof databaseId === 'undefined') {
|
|
1080
1080
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
1081
1081
|
}
|
|
@@ -1201,7 +1201,7 @@ export class Databases extends Service {
|
|
|
1201
1201
|
* @throws {AppwriteException}
|
|
1202
1202
|
* @returns {Promise}
|
|
1203
1203
|
*/
|
|
1204
|
-
async updateIpAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault
|
|
1204
|
+
async updateIpAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string): Promise<Models.AttributeIp> {
|
|
1205
1205
|
if (typeof databaseId === 'undefined') {
|
|
1206
1206
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
1207
1207
|
}
|
|
@@ -1243,7 +1243,7 @@ export class Databases extends Service {
|
|
|
1243
1243
|
* Create Relationship Attribute
|
|
1244
1244
|
*
|
|
1245
1245
|
* Create relationship attribute. [Learn more about relationship
|
|
1246
|
-
* attributes](docs/databases-relationships#relationship-attributes).
|
|
1246
|
+
* attributes](/docs/databases-relationships#relationship-attributes).
|
|
1247
1247
|
*
|
|
1248
1248
|
*
|
|
1249
1249
|
* @param {string} databaseId
|
|
@@ -1388,7 +1388,7 @@ export class Databases extends Service {
|
|
|
1388
1388
|
* @throws {AppwriteException}
|
|
1389
1389
|
* @returns {Promise}
|
|
1390
1390
|
*/
|
|
1391
|
-
async updateStringAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault
|
|
1391
|
+
async updateStringAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string): Promise<Models.AttributeString> {
|
|
1392
1392
|
if (typeof databaseId === 'undefined') {
|
|
1393
1393
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
1394
1394
|
}
|
|
@@ -1498,7 +1498,7 @@ export class Databases extends Service {
|
|
|
1498
1498
|
* @throws {AppwriteException}
|
|
1499
1499
|
* @returns {Promise}
|
|
1500
1500
|
*/
|
|
1501
|
-
async updateUrlAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault
|
|
1501
|
+
async updateUrlAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string): Promise<Models.AttributeUrl> {
|
|
1502
1502
|
if (typeof databaseId === 'undefined') {
|
|
1503
1503
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
1504
1504
|
}
|
|
@@ -1604,7 +1604,7 @@ export class Databases extends Service {
|
|
|
1604
1604
|
* Update Relationship Attribute
|
|
1605
1605
|
*
|
|
1606
1606
|
* Update relationship attribute. [Learn more about relationship
|
|
1607
|
-
* attributes](docs/databases-relationships#relationship-attributes).
|
|
1607
|
+
* attributes](/docs/databases-relationships#relationship-attributes).
|
|
1608
1608
|
*
|
|
1609
1609
|
*
|
|
1610
1610
|
* @param {string} databaseId
|