node-appwrite 22.0.0 → 22.1.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 (97) hide show
  1. package/dist/client.js +6 -5
  2. package/dist/client.js.map +1 -1
  3. package/dist/client.mjs +6 -1477
  4. package/dist/client.mjs.map +1 -1
  5. package/dist/enums/backup-services.d.mts +7 -0
  6. package/dist/enums/backup-services.d.ts +7 -0
  7. package/dist/enums/backup-services.js +12 -0
  8. package/dist/enums/backup-services.js.map +1 -0
  9. package/dist/enums/backup-services.mjs +11 -0
  10. package/dist/enums/backup-services.mjs.map +1 -0
  11. package/dist/enums/build-runtime.d.mts +23 -4
  12. package/dist/enums/build-runtime.d.ts +23 -4
  13. package/dist/enums/build-runtime.js +22 -3
  14. package/dist/enums/build-runtime.js.map +1 -1
  15. package/dist/enums/build-runtime.mjs +22 -3
  16. package/dist/enums/build-runtime.mjs.map +1 -1
  17. package/dist/enums/runtime.d.mts +23 -4
  18. package/dist/enums/runtime.d.ts +23 -4
  19. package/dist/enums/runtime.js +22 -3
  20. package/dist/enums/runtime.js.map +1 -1
  21. package/dist/enums/runtime.mjs +22 -3
  22. package/dist/enums/runtime.mjs.map +1 -1
  23. package/dist/enums/scopes.d.mts +12 -1
  24. package/dist/enums/scopes.d.ts +12 -1
  25. package/dist/enums/scopes.js +11 -0
  26. package/dist/enums/scopes.js.map +1 -1
  27. package/dist/enums/scopes.mjs +11 -0
  28. package/dist/enums/scopes.mjs.map +1 -1
  29. package/dist/index.d.mts +3 -1
  30. package/dist/index.d.ts +3 -1
  31. package/dist/index.js +15 -5
  32. package/dist/index.js.map +1 -1
  33. package/dist/index.mjs +3 -1
  34. package/dist/index.mjs.map +1 -1
  35. package/dist/models.d.mts +396 -4
  36. package/dist/models.d.ts +396 -4
  37. package/dist/query.d.mts +22 -0
  38. package/dist/query.d.ts +22 -0
  39. package/dist/query.js +22 -0
  40. package/dist/query.js.map +1 -1
  41. package/dist/query.mjs +22 -0
  42. package/dist/query.mjs.map +1 -1
  43. package/dist/services/account.js +3 -3
  44. package/dist/services/account.js.map +1 -1
  45. package/dist/services/account.mjs +3 -3
  46. package/dist/services/account.mjs.map +1 -1
  47. package/dist/services/activities.d.mts +60 -0
  48. package/dist/services/activities.d.ts +60 -0
  49. package/dist/services/activities.js +61 -0
  50. package/dist/services/activities.js.map +1 -0
  51. package/dist/services/activities.mjs +60 -0
  52. package/dist/services/activities.mjs.map +1 -0
  53. package/dist/services/avatars.js +3 -3
  54. package/dist/services/avatars.js.map +1 -1
  55. package/dist/services/avatars.mjs +3 -3
  56. package/dist/services/avatars.mjs.map +1 -1
  57. package/dist/services/backups.d.mts +291 -0
  58. package/dist/services/backups.d.ts +291 -0
  59. package/dist/services/backups.js +404 -0
  60. package/dist/services/backups.js.map +1 -0
  61. package/dist/services/backups.mjs +403 -0
  62. package/dist/services/backups.mjs.map +1 -0
  63. package/dist/services/databases.d.mts +16 -4
  64. package/dist/services/databases.d.ts +16 -4
  65. package/dist/services/databases.js +24 -4
  66. package/dist/services/databases.js.map +1 -1
  67. package/dist/services/databases.mjs +24 -4
  68. package/dist/services/databases.mjs.map +1 -1
  69. package/dist/services/graphql.js.map +1 -1
  70. package/dist/services/graphql.mjs.map +1 -1
  71. package/dist/services/health.d.mts +95 -0
  72. package/dist/services/health.d.ts +95 -0
  73. package/dist/services/health.js +121 -1
  74. package/dist/services/health.js.map +1 -1
  75. package/dist/services/health.mjs +121 -1
  76. package/dist/services/health.mjs.map +1 -1
  77. package/dist/services/storage.d.mts +4 -4
  78. package/dist/services/storage.d.ts +4 -4
  79. package/dist/services/storage.js.map +1 -1
  80. package/dist/services/storage.mjs.map +1 -1
  81. package/dist/services/tables-db.d.mts +16 -4
  82. package/dist/services/tables-db.d.ts +16 -4
  83. package/dist/services/tables-db.js +24 -4
  84. package/dist/services/tables-db.js.map +1 -1
  85. package/dist/services/tables-db.mjs +24 -4
  86. package/dist/services/tables-db.mjs.map +1 -1
  87. package/dist/services/teams.d.mts +8 -9
  88. package/dist/services/teams.d.ts +8 -9
  89. package/dist/services/teams.js.map +1 -1
  90. package/dist/services/teams.mjs.map +1 -1
  91. package/package.json +1 -1
  92. package/dist/enums/roles.d.mts +0 -7
  93. package/dist/enums/roles.d.ts +0 -7
  94. package/dist/enums/roles.js +0 -12
  95. package/dist/enums/roles.js.map +0 -1
  96. package/dist/enums/roles.mjs +0 -11
  97. package/dist/enums/roles.mjs.map +0 -1
@@ -0,0 +1,291 @@
1
+ import { Client } from '../client.js';
2
+ import { Models } from '../models.js';
3
+ import { BackupServices } from '../enums/backup-services.js';
4
+ import '../query.js';
5
+ import '../enums/database-type.js';
6
+ import '../enums/attribute-status.js';
7
+ import '../enums/column-status.js';
8
+ import '../enums/index-status.js';
9
+ import '../enums/deployment-status.js';
10
+ import '../enums/execution-trigger.js';
11
+ import '../enums/execution-status.js';
12
+ import '../enums/health-antivirus-status.js';
13
+ import '../enums/health-check-status.js';
14
+ import '../enums/message-status.js';
15
+
16
+ declare class Backups {
17
+ client: Client;
18
+ constructor(client: Client);
19
+ /**
20
+ * List all archives for a project.
21
+ *
22
+ * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long.
23
+ * @throws {AppwriteException}
24
+ * @returns {Promise<Models.BackupArchiveList>}
25
+ */
26
+ listArchives(params?: {
27
+ queries?: string[];
28
+ }): Promise<Models.BackupArchiveList>;
29
+ /**
30
+ * List all archives for a project.
31
+ *
32
+ * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long.
33
+ * @throws {AppwriteException}
34
+ * @returns {Promise<Models.BackupArchiveList>}
35
+ * @deprecated Use the object parameter style method for a better developer experience.
36
+ */
37
+ listArchives(queries?: string[]): Promise<Models.BackupArchiveList>;
38
+ /**
39
+ * Create a new archive asynchronously for a project.
40
+ *
41
+ * @param {BackupServices[]} params.services - Array of services to backup
42
+ * @param {string} params.resourceId - Resource ID. When set, only this single resource will be backed up.
43
+ * @throws {AppwriteException}
44
+ * @returns {Promise<Models.BackupArchive>}
45
+ */
46
+ createArchive(params: {
47
+ services: BackupServices[];
48
+ resourceId?: string;
49
+ }): Promise<Models.BackupArchive>;
50
+ /**
51
+ * Create a new archive asynchronously for a project.
52
+ *
53
+ * @param {BackupServices[]} services - Array of services to backup
54
+ * @param {string} resourceId - Resource ID. When set, only this single resource will be backed up.
55
+ * @throws {AppwriteException}
56
+ * @returns {Promise<Models.BackupArchive>}
57
+ * @deprecated Use the object parameter style method for a better developer experience.
58
+ */
59
+ createArchive(services: BackupServices[], resourceId?: string): Promise<Models.BackupArchive>;
60
+ /**
61
+ * Get a backup archive using it's ID.
62
+ *
63
+ * @param {string} params.archiveId - Archive ID. Choose a custom ID`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
64
+ * @throws {AppwriteException}
65
+ * @returns {Promise<Models.BackupArchive>}
66
+ */
67
+ getArchive(params: {
68
+ archiveId: string;
69
+ }): Promise<Models.BackupArchive>;
70
+ /**
71
+ * Get a backup archive using it's ID.
72
+ *
73
+ * @param {string} archiveId - Archive ID. Choose a custom ID`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
74
+ * @throws {AppwriteException}
75
+ * @returns {Promise<Models.BackupArchive>}
76
+ * @deprecated Use the object parameter style method for a better developer experience.
77
+ */
78
+ getArchive(archiveId: string): Promise<Models.BackupArchive>;
79
+ /**
80
+ * Delete an existing archive for a project.
81
+ *
82
+ * @param {string} params.archiveId - Policy ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
83
+ * @throws {AppwriteException}
84
+ * @returns {Promise<{}>}
85
+ */
86
+ deleteArchive(params: {
87
+ archiveId: string;
88
+ }): Promise<{}>;
89
+ /**
90
+ * Delete an existing archive for a project.
91
+ *
92
+ * @param {string} archiveId - Policy ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
93
+ * @throws {AppwriteException}
94
+ * @returns {Promise<{}>}
95
+ * @deprecated Use the object parameter style method for a better developer experience.
96
+ */
97
+ deleteArchive(archiveId: string): Promise<{}>;
98
+ /**
99
+ * List all policies for a project.
100
+ *
101
+ * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long.
102
+ * @throws {AppwriteException}
103
+ * @returns {Promise<Models.BackupPolicyList>}
104
+ */
105
+ listPolicies(params?: {
106
+ queries?: string[];
107
+ }): Promise<Models.BackupPolicyList>;
108
+ /**
109
+ * List all policies for a project.
110
+ *
111
+ * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long.
112
+ * @throws {AppwriteException}
113
+ * @returns {Promise<Models.BackupPolicyList>}
114
+ * @deprecated Use the object parameter style method for a better developer experience.
115
+ */
116
+ listPolicies(queries?: string[]): Promise<Models.BackupPolicyList>;
117
+ /**
118
+ * Create a new backup policy.
119
+ *
120
+ * @param {string} params.policyId - Policy ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
121
+ * @param {BackupServices[]} params.services - Array of services to backup
122
+ * @param {number} params.retention - Days to keep backups before deletion
123
+ * @param {string} params.schedule - Schedule CRON syntax.
124
+ * @param {string} params.name - Policy name. Max length: 128 chars.
125
+ * @param {string} params.resourceId - Resource ID. When set, only this single resource will be backed up.
126
+ * @param {boolean} params.enabled - Is policy enabled? When set to 'disabled', no backups will be taken
127
+ * @throws {AppwriteException}
128
+ * @returns {Promise<Models.BackupPolicy>}
129
+ */
130
+ createPolicy(params: {
131
+ policyId: string;
132
+ services: BackupServices[];
133
+ retention: number;
134
+ schedule: string;
135
+ name?: string;
136
+ resourceId?: string;
137
+ enabled?: boolean;
138
+ }): Promise<Models.BackupPolicy>;
139
+ /**
140
+ * Create a new backup policy.
141
+ *
142
+ * @param {string} policyId - Policy ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
143
+ * @param {BackupServices[]} services - Array of services to backup
144
+ * @param {number} retention - Days to keep backups before deletion
145
+ * @param {string} schedule - Schedule CRON syntax.
146
+ * @param {string} name - Policy name. Max length: 128 chars.
147
+ * @param {string} resourceId - Resource ID. When set, only this single resource will be backed up.
148
+ * @param {boolean} enabled - Is policy enabled? When set to 'disabled', no backups will be taken
149
+ * @throws {AppwriteException}
150
+ * @returns {Promise<Models.BackupPolicy>}
151
+ * @deprecated Use the object parameter style method for a better developer experience.
152
+ */
153
+ createPolicy(policyId: string, services: BackupServices[], retention: number, schedule: string, name?: string, resourceId?: string, enabled?: boolean): Promise<Models.BackupPolicy>;
154
+ /**
155
+ * Get a backup policy using it's ID.
156
+ *
157
+ * @param {string} params.policyId - Policy ID. Choose a custom ID`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
158
+ * @throws {AppwriteException}
159
+ * @returns {Promise<Models.BackupPolicy>}
160
+ */
161
+ getPolicy(params: {
162
+ policyId: string;
163
+ }): Promise<Models.BackupPolicy>;
164
+ /**
165
+ * Get a backup policy using it's ID.
166
+ *
167
+ * @param {string} policyId - Policy ID. Choose a custom ID`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
168
+ * @throws {AppwriteException}
169
+ * @returns {Promise<Models.BackupPolicy>}
170
+ * @deprecated Use the object parameter style method for a better developer experience.
171
+ */
172
+ getPolicy(policyId: string): Promise<Models.BackupPolicy>;
173
+ /**
174
+ * Update an existing policy using it's ID.
175
+ *
176
+ * @param {string} params.policyId - Policy ID. Choose a custom ID`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
177
+ * @param {string} params.name - Policy name. Max length: 128 chars.
178
+ * @param {number} params.retention - Days to keep backups before deletion
179
+ * @param {string} params.schedule - Cron expression
180
+ * @param {boolean} params.enabled - Is Backup enabled? When set to 'disabled', No backup will be taken
181
+ * @throws {AppwriteException}
182
+ * @returns {Promise<Models.BackupPolicy>}
183
+ */
184
+ updatePolicy(params: {
185
+ policyId: string;
186
+ name?: string;
187
+ retention?: number;
188
+ schedule?: string;
189
+ enabled?: boolean;
190
+ }): Promise<Models.BackupPolicy>;
191
+ /**
192
+ * Update an existing policy using it's ID.
193
+ *
194
+ * @param {string} policyId - Policy ID. Choose a custom ID`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
195
+ * @param {string} name - Policy name. Max length: 128 chars.
196
+ * @param {number} retention - Days to keep backups before deletion
197
+ * @param {string} schedule - Cron expression
198
+ * @param {boolean} enabled - Is Backup enabled? When set to 'disabled', No backup will be taken
199
+ * @throws {AppwriteException}
200
+ * @returns {Promise<Models.BackupPolicy>}
201
+ * @deprecated Use the object parameter style method for a better developer experience.
202
+ */
203
+ updatePolicy(policyId: string, name?: string, retention?: number, schedule?: string, enabled?: boolean): Promise<Models.BackupPolicy>;
204
+ /**
205
+ * Delete a policy using it's ID.
206
+ *
207
+ * @param {string} params.policyId - Policy ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
208
+ * @throws {AppwriteException}
209
+ * @returns {Promise<{}>}
210
+ */
211
+ deletePolicy(params: {
212
+ policyId: string;
213
+ }): Promise<{}>;
214
+ /**
215
+ * Delete a policy using it's ID.
216
+ *
217
+ * @param {string} policyId - Policy ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
218
+ * @throws {AppwriteException}
219
+ * @returns {Promise<{}>}
220
+ * @deprecated Use the object parameter style method for a better developer experience.
221
+ */
222
+ deletePolicy(policyId: string): Promise<{}>;
223
+ /**
224
+ * Create and trigger a new restoration for a backup on a project.
225
+ *
226
+ * @param {string} params.archiveId - Backup archive ID to restore
227
+ * @param {BackupServices[]} params.services - Array of services to restore
228
+ * @param {string} params.newResourceId - Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
229
+ * @param {string} params.newResourceName - Database name. Max length: 128 chars.
230
+ * @throws {AppwriteException}
231
+ * @returns {Promise<Models.BackupRestoration>}
232
+ */
233
+ createRestoration(params: {
234
+ archiveId: string;
235
+ services: BackupServices[];
236
+ newResourceId?: string;
237
+ newResourceName?: string;
238
+ }): Promise<Models.BackupRestoration>;
239
+ /**
240
+ * Create and trigger a new restoration for a backup on a project.
241
+ *
242
+ * @param {string} archiveId - Backup archive ID to restore
243
+ * @param {BackupServices[]} services - Array of services to restore
244
+ * @param {string} newResourceId - Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
245
+ * @param {string} newResourceName - Database name. Max length: 128 chars.
246
+ * @throws {AppwriteException}
247
+ * @returns {Promise<Models.BackupRestoration>}
248
+ * @deprecated Use the object parameter style method for a better developer experience.
249
+ */
250
+ createRestoration(archiveId: string, services: BackupServices[], newResourceId?: string, newResourceName?: string): Promise<Models.BackupRestoration>;
251
+ /**
252
+ * List all backup restorations for a project.
253
+ *
254
+ * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long.
255
+ * @throws {AppwriteException}
256
+ * @returns {Promise<Models.BackupRestorationList>}
257
+ */
258
+ listRestorations(params?: {
259
+ queries?: string[];
260
+ }): Promise<Models.BackupRestorationList>;
261
+ /**
262
+ * List all backup restorations for a project.
263
+ *
264
+ * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long.
265
+ * @throws {AppwriteException}
266
+ * @returns {Promise<Models.BackupRestorationList>}
267
+ * @deprecated Use the object parameter style method for a better developer experience.
268
+ */
269
+ listRestorations(queries?: string[]): Promise<Models.BackupRestorationList>;
270
+ /**
271
+ * Get the current status of a backup restoration.
272
+ *
273
+ * @param {string} params.restorationId - Restoration ID. Choose a custom ID`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
274
+ * @throws {AppwriteException}
275
+ * @returns {Promise<Models.BackupRestoration>}
276
+ */
277
+ getRestoration(params: {
278
+ restorationId: string;
279
+ }): Promise<Models.BackupRestoration>;
280
+ /**
281
+ * Get the current status of a backup restoration.
282
+ *
283
+ * @param {string} restorationId - Restoration ID. Choose a custom ID`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
284
+ * @throws {AppwriteException}
285
+ * @returns {Promise<Models.BackupRestoration>}
286
+ * @deprecated Use the object parameter style method for a better developer experience.
287
+ */
288
+ getRestoration(restorationId: string): Promise<Models.BackupRestoration>;
289
+ }
290
+
291
+ export { Backups };
@@ -0,0 +1,404 @@
1
+ 'use strict';
2
+
3
+ var client = require('../client');
4
+
5
+ class Backups {
6
+ constructor(client) {
7
+ this.client = client;
8
+ }
9
+ listArchives(paramsOrFirst) {
10
+ let params;
11
+ if (!paramsOrFirst || paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
12
+ params = paramsOrFirst || {};
13
+ } else {
14
+ params = {
15
+ queries: paramsOrFirst
16
+ };
17
+ }
18
+ const queries = params.queries;
19
+ const apiPath = "/backups/archives";
20
+ const payload = {};
21
+ if (typeof queries !== "undefined") {
22
+ payload["queries"] = queries;
23
+ }
24
+ const uri = new URL(this.client.config.endpoint + apiPath);
25
+ const apiHeaders = {};
26
+ return this.client.call(
27
+ "get",
28
+ uri,
29
+ apiHeaders,
30
+ payload
31
+ );
32
+ }
33
+ createArchive(paramsOrFirst, ...rest) {
34
+ let params;
35
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst) && ("services" in paramsOrFirst || "resourceId" in paramsOrFirst)) {
36
+ params = paramsOrFirst || {};
37
+ } else {
38
+ params = {
39
+ services: paramsOrFirst,
40
+ resourceId: rest[0]
41
+ };
42
+ }
43
+ const services = params.services;
44
+ const resourceId = params.resourceId;
45
+ if (typeof services === "undefined") {
46
+ throw new client.AppwriteException('Missing required parameter: "services"');
47
+ }
48
+ const apiPath = "/backups/archives";
49
+ const payload = {};
50
+ if (typeof services !== "undefined") {
51
+ payload["services"] = services;
52
+ }
53
+ if (typeof resourceId !== "undefined") {
54
+ payload["resourceId"] = resourceId;
55
+ }
56
+ const uri = new URL(this.client.config.endpoint + apiPath);
57
+ const apiHeaders = {
58
+ "content-type": "application/json"
59
+ };
60
+ return this.client.call(
61
+ "post",
62
+ uri,
63
+ apiHeaders,
64
+ payload
65
+ );
66
+ }
67
+ getArchive(paramsOrFirst) {
68
+ let params;
69
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
70
+ params = paramsOrFirst || {};
71
+ } else {
72
+ params = {
73
+ archiveId: paramsOrFirst
74
+ };
75
+ }
76
+ const archiveId = params.archiveId;
77
+ if (typeof archiveId === "undefined") {
78
+ throw new client.AppwriteException('Missing required parameter: "archiveId"');
79
+ }
80
+ const apiPath = "/backups/archives/{archiveId}".replace("{archiveId}", archiveId);
81
+ const payload = {};
82
+ const uri = new URL(this.client.config.endpoint + apiPath);
83
+ const apiHeaders = {};
84
+ return this.client.call(
85
+ "get",
86
+ uri,
87
+ apiHeaders,
88
+ payload
89
+ );
90
+ }
91
+ deleteArchive(paramsOrFirst) {
92
+ let params;
93
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
94
+ params = paramsOrFirst || {};
95
+ } else {
96
+ params = {
97
+ archiveId: paramsOrFirst
98
+ };
99
+ }
100
+ const archiveId = params.archiveId;
101
+ if (typeof archiveId === "undefined") {
102
+ throw new client.AppwriteException('Missing required parameter: "archiveId"');
103
+ }
104
+ const apiPath = "/backups/archives/{archiveId}".replace("{archiveId}", archiveId);
105
+ const payload = {};
106
+ const uri = new URL(this.client.config.endpoint + apiPath);
107
+ const apiHeaders = {
108
+ "content-type": "application/json"
109
+ };
110
+ return this.client.call(
111
+ "delete",
112
+ uri,
113
+ apiHeaders,
114
+ payload
115
+ );
116
+ }
117
+ listPolicies(paramsOrFirst) {
118
+ let params;
119
+ if (!paramsOrFirst || paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
120
+ params = paramsOrFirst || {};
121
+ } else {
122
+ params = {
123
+ queries: paramsOrFirst
124
+ };
125
+ }
126
+ const queries = params.queries;
127
+ const apiPath = "/backups/policies";
128
+ const payload = {};
129
+ if (typeof queries !== "undefined") {
130
+ payload["queries"] = queries;
131
+ }
132
+ const uri = new URL(this.client.config.endpoint + apiPath);
133
+ const apiHeaders = {};
134
+ return this.client.call(
135
+ "get",
136
+ uri,
137
+ apiHeaders,
138
+ payload
139
+ );
140
+ }
141
+ createPolicy(paramsOrFirst, ...rest) {
142
+ let params;
143
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
144
+ params = paramsOrFirst || {};
145
+ } else {
146
+ params = {
147
+ policyId: paramsOrFirst,
148
+ services: rest[0],
149
+ retention: rest[1],
150
+ schedule: rest[2],
151
+ name: rest[3],
152
+ resourceId: rest[4],
153
+ enabled: rest[5]
154
+ };
155
+ }
156
+ const policyId = params.policyId;
157
+ const services = params.services;
158
+ const retention = params.retention;
159
+ const schedule = params.schedule;
160
+ const name = params.name;
161
+ const resourceId = params.resourceId;
162
+ const enabled = params.enabled;
163
+ if (typeof policyId === "undefined") {
164
+ throw new client.AppwriteException('Missing required parameter: "policyId"');
165
+ }
166
+ if (typeof services === "undefined") {
167
+ throw new client.AppwriteException('Missing required parameter: "services"');
168
+ }
169
+ if (typeof retention === "undefined") {
170
+ throw new client.AppwriteException('Missing required parameter: "retention"');
171
+ }
172
+ if (typeof schedule === "undefined") {
173
+ throw new client.AppwriteException('Missing required parameter: "schedule"');
174
+ }
175
+ const apiPath = "/backups/policies";
176
+ const payload = {};
177
+ if (typeof policyId !== "undefined") {
178
+ payload["policyId"] = policyId;
179
+ }
180
+ if (typeof name !== "undefined") {
181
+ payload["name"] = name;
182
+ }
183
+ if (typeof services !== "undefined") {
184
+ payload["services"] = services;
185
+ }
186
+ if (typeof resourceId !== "undefined") {
187
+ payload["resourceId"] = resourceId;
188
+ }
189
+ if (typeof enabled !== "undefined") {
190
+ payload["enabled"] = enabled;
191
+ }
192
+ if (typeof retention !== "undefined") {
193
+ payload["retention"] = retention;
194
+ }
195
+ if (typeof schedule !== "undefined") {
196
+ payload["schedule"] = schedule;
197
+ }
198
+ const uri = new URL(this.client.config.endpoint + apiPath);
199
+ const apiHeaders = {
200
+ "content-type": "application/json"
201
+ };
202
+ return this.client.call(
203
+ "post",
204
+ uri,
205
+ apiHeaders,
206
+ payload
207
+ );
208
+ }
209
+ getPolicy(paramsOrFirst) {
210
+ let params;
211
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
212
+ params = paramsOrFirst || {};
213
+ } else {
214
+ params = {
215
+ policyId: paramsOrFirst
216
+ };
217
+ }
218
+ const policyId = params.policyId;
219
+ if (typeof policyId === "undefined") {
220
+ throw new client.AppwriteException('Missing required parameter: "policyId"');
221
+ }
222
+ const apiPath = "/backups/policies/{policyId}".replace("{policyId}", policyId);
223
+ const payload = {};
224
+ const uri = new URL(this.client.config.endpoint + apiPath);
225
+ const apiHeaders = {};
226
+ return this.client.call(
227
+ "get",
228
+ uri,
229
+ apiHeaders,
230
+ payload
231
+ );
232
+ }
233
+ updatePolicy(paramsOrFirst, ...rest) {
234
+ let params;
235
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
236
+ params = paramsOrFirst || {};
237
+ } else {
238
+ params = {
239
+ policyId: paramsOrFirst,
240
+ name: rest[0],
241
+ retention: rest[1],
242
+ schedule: rest[2],
243
+ enabled: rest[3]
244
+ };
245
+ }
246
+ const policyId = params.policyId;
247
+ const name = params.name;
248
+ const retention = params.retention;
249
+ const schedule = params.schedule;
250
+ const enabled = params.enabled;
251
+ if (typeof policyId === "undefined") {
252
+ throw new client.AppwriteException('Missing required parameter: "policyId"');
253
+ }
254
+ const apiPath = "/backups/policies/{policyId}".replace("{policyId}", policyId);
255
+ const payload = {};
256
+ if (typeof name !== "undefined") {
257
+ payload["name"] = name;
258
+ }
259
+ if (typeof retention !== "undefined") {
260
+ payload["retention"] = retention;
261
+ }
262
+ if (typeof schedule !== "undefined") {
263
+ payload["schedule"] = schedule;
264
+ }
265
+ if (typeof enabled !== "undefined") {
266
+ payload["enabled"] = enabled;
267
+ }
268
+ const uri = new URL(this.client.config.endpoint + apiPath);
269
+ const apiHeaders = {
270
+ "content-type": "application/json"
271
+ };
272
+ return this.client.call(
273
+ "patch",
274
+ uri,
275
+ apiHeaders,
276
+ payload
277
+ );
278
+ }
279
+ deletePolicy(paramsOrFirst) {
280
+ let params;
281
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
282
+ params = paramsOrFirst || {};
283
+ } else {
284
+ params = {
285
+ policyId: paramsOrFirst
286
+ };
287
+ }
288
+ const policyId = params.policyId;
289
+ if (typeof policyId === "undefined") {
290
+ throw new client.AppwriteException('Missing required parameter: "policyId"');
291
+ }
292
+ const apiPath = "/backups/policies/{policyId}".replace("{policyId}", policyId);
293
+ const payload = {};
294
+ const uri = new URL(this.client.config.endpoint + apiPath);
295
+ const apiHeaders = {
296
+ "content-type": "application/json"
297
+ };
298
+ return this.client.call(
299
+ "delete",
300
+ uri,
301
+ apiHeaders,
302
+ payload
303
+ );
304
+ }
305
+ createRestoration(paramsOrFirst, ...rest) {
306
+ let params;
307
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
308
+ params = paramsOrFirst || {};
309
+ } else {
310
+ params = {
311
+ archiveId: paramsOrFirst,
312
+ services: rest[0],
313
+ newResourceId: rest[1],
314
+ newResourceName: rest[2]
315
+ };
316
+ }
317
+ const archiveId = params.archiveId;
318
+ const services = params.services;
319
+ const newResourceId = params.newResourceId;
320
+ const newResourceName = params.newResourceName;
321
+ if (typeof archiveId === "undefined") {
322
+ throw new client.AppwriteException('Missing required parameter: "archiveId"');
323
+ }
324
+ if (typeof services === "undefined") {
325
+ throw new client.AppwriteException('Missing required parameter: "services"');
326
+ }
327
+ const apiPath = "/backups/restoration";
328
+ const payload = {};
329
+ if (typeof archiveId !== "undefined") {
330
+ payload["archiveId"] = archiveId;
331
+ }
332
+ if (typeof services !== "undefined") {
333
+ payload["services"] = services;
334
+ }
335
+ if (typeof newResourceId !== "undefined") {
336
+ payload["newResourceId"] = newResourceId;
337
+ }
338
+ if (typeof newResourceName !== "undefined") {
339
+ payload["newResourceName"] = newResourceName;
340
+ }
341
+ const uri = new URL(this.client.config.endpoint + apiPath);
342
+ const apiHeaders = {
343
+ "content-type": "application/json"
344
+ };
345
+ return this.client.call(
346
+ "post",
347
+ uri,
348
+ apiHeaders,
349
+ payload
350
+ );
351
+ }
352
+ listRestorations(paramsOrFirst) {
353
+ let params;
354
+ if (!paramsOrFirst || paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
355
+ params = paramsOrFirst || {};
356
+ } else {
357
+ params = {
358
+ queries: paramsOrFirst
359
+ };
360
+ }
361
+ const queries = params.queries;
362
+ const apiPath = "/backups/restorations";
363
+ const payload = {};
364
+ if (typeof queries !== "undefined") {
365
+ payload["queries"] = queries;
366
+ }
367
+ const uri = new URL(this.client.config.endpoint + apiPath);
368
+ const apiHeaders = {};
369
+ return this.client.call(
370
+ "get",
371
+ uri,
372
+ apiHeaders,
373
+ payload
374
+ );
375
+ }
376
+ getRestoration(paramsOrFirst) {
377
+ let params;
378
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
379
+ params = paramsOrFirst || {};
380
+ } else {
381
+ params = {
382
+ restorationId: paramsOrFirst
383
+ };
384
+ }
385
+ const restorationId = params.restorationId;
386
+ if (typeof restorationId === "undefined") {
387
+ throw new client.AppwriteException('Missing required parameter: "restorationId"');
388
+ }
389
+ const apiPath = "/backups/restorations/{restorationId}".replace("{restorationId}", restorationId);
390
+ const payload = {};
391
+ const uri = new URL(this.client.config.endpoint + apiPath);
392
+ const apiHeaders = {};
393
+ return this.client.call(
394
+ "get",
395
+ uri,
396
+ apiHeaders,
397
+ payload
398
+ );
399
+ }
400
+ }
401
+
402
+ exports.Backups = Backups;
403
+ //# sourceMappingURL=out.js.map
404
+ //# sourceMappingURL=backups.js.map