appwrite-cli 4.2.1 → 5.0.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.
Files changed (320) hide show
  1. package/.github/workflows/npm-publish.yml +1 -1
  2. package/README.md +6 -9
  3. package/docs/examples/account/{create-email-session.md → create-email-password-session.md} +1 -1
  4. package/docs/examples/account/create-email-token.md +4 -0
  5. package/docs/examples/account/create-magic-u-r-l-token.md +5 -0
  6. package/docs/examples/account/create-mfa-authenticator.md +2 -0
  7. package/docs/examples/account/create-mfa-challenge.md +2 -0
  8. package/docs/examples/account/create-mfa-recovery-codes.md +1 -0
  9. package/docs/examples/account/create-o-auth2token.md +5 -0
  10. package/docs/examples/account/create-phone-token.md +3 -0
  11. package/docs/examples/account/create-push-target.md +4 -0
  12. package/docs/examples/account/create-session.md +3 -0
  13. package/docs/examples/account/create.md +1 -1
  14. package/docs/examples/account/delete-identity.md +1 -1
  15. package/docs/examples/account/delete-mfa-authenticator.md +3 -0
  16. package/docs/examples/account/delete-push-target.md +2 -0
  17. package/docs/examples/account/delete-session.md +1 -1
  18. package/docs/examples/account/delete.md +1 -0
  19. package/docs/examples/account/get-mfa-recovery-codes.md +1 -0
  20. package/docs/examples/account/get-session.md +1 -1
  21. package/docs/examples/account/list-mfa-factors.md +1 -0
  22. package/docs/examples/account/update-m-f-a.md +2 -0
  23. package/docs/examples/account/update-magic-u-r-l-session.md +2 -2
  24. package/docs/examples/account/update-mfa-authenticator.md +3 -0
  25. package/docs/examples/account/update-mfa-challenge.md +3 -0
  26. package/docs/examples/account/update-mfa-recovery-codes.md +1 -0
  27. package/docs/examples/account/update-name.md +1 -1
  28. package/docs/examples/account/update-phone-session.md +2 -2
  29. package/docs/examples/account/update-phone-verification.md +2 -2
  30. package/docs/examples/account/update-push-target.md +3 -0
  31. package/docs/examples/account/update-recovery.md +3 -4
  32. package/docs/examples/account/update-session.md +1 -1
  33. package/docs/examples/account/update-verification.md +2 -2
  34. package/docs/examples/assistant/chat.md +1 -1
  35. package/docs/examples/avatars/get-q-r.md +1 -1
  36. package/docs/examples/databases/create-boolean-attribute.md +2 -2
  37. package/docs/examples/databases/create-collection.md +3 -3
  38. package/docs/examples/databases/create-datetime-attribute.md +2 -2
  39. package/docs/examples/databases/create-document.md +3 -3
  40. package/docs/examples/databases/create-email-attribute.md +2 -2
  41. package/docs/examples/databases/create-enum-attribute.md +2 -2
  42. package/docs/examples/databases/create-float-attribute.md +2 -2
  43. package/docs/examples/databases/create-index.md +2 -2
  44. package/docs/examples/databases/create-integer-attribute.md +2 -2
  45. package/docs/examples/databases/create-ip-attribute.md +2 -2
  46. package/docs/examples/databases/create-relationship-attribute.md +3 -3
  47. package/docs/examples/databases/create-string-attribute.md +2 -2
  48. package/docs/examples/databases/create-url-attribute.md +2 -2
  49. package/docs/examples/databases/create.md +2 -2
  50. package/docs/examples/databases/delete-attribute.md +2 -2
  51. package/docs/examples/databases/delete-collection.md +2 -2
  52. package/docs/examples/databases/delete-document.md +3 -3
  53. package/docs/examples/databases/delete-index.md +2 -2
  54. package/docs/examples/databases/delete.md +1 -1
  55. package/docs/examples/databases/get-attribute.md +2 -2
  56. package/docs/examples/databases/get-collection-usage.md +2 -2
  57. package/docs/examples/databases/get-collection.md +2 -2
  58. package/docs/examples/databases/get-database-usage.md +1 -1
  59. package/docs/examples/databases/get-document.md +3 -3
  60. package/docs/examples/databases/get-index.md +2 -2
  61. package/docs/examples/databases/get.md +1 -1
  62. package/docs/examples/databases/list-attributes.md +2 -2
  63. package/docs/examples/databases/list-collection-logs.md +2 -2
  64. package/docs/examples/databases/list-collections.md +1 -1
  65. package/docs/examples/databases/list-document-logs.md +3 -3
  66. package/docs/examples/databases/list-documents.md +2 -2
  67. package/docs/examples/databases/list-indexes.md +2 -2
  68. package/docs/examples/databases/list-logs.md +1 -1
  69. package/docs/examples/databases/update-boolean-attribute.md +2 -2
  70. package/docs/examples/databases/update-collection.md +3 -3
  71. package/docs/examples/databases/update-datetime-attribute.md +2 -2
  72. package/docs/examples/databases/update-document.md +3 -3
  73. package/docs/examples/databases/update-email-attribute.md +2 -2
  74. package/docs/examples/databases/update-enum-attribute.md +3 -3
  75. package/docs/examples/databases/update-float-attribute.md +2 -2
  76. package/docs/examples/databases/update-integer-attribute.md +2 -2
  77. package/docs/examples/databases/update-ip-attribute.md +2 -2
  78. package/docs/examples/databases/update-relationship-attribute.md +2 -2
  79. package/docs/examples/databases/update-string-attribute.md +3 -3
  80. package/docs/examples/databases/update-url-attribute.md +2 -2
  81. package/docs/examples/databases/update.md +2 -2
  82. package/docs/examples/functions/create-build.md +3 -3
  83. package/docs/examples/functions/create-deployment.md +1 -1
  84. package/docs/examples/functions/create-execution.md +1 -1
  85. package/docs/examples/functions/create-variable.md +3 -3
  86. package/docs/examples/functions/create.md +3 -3
  87. package/docs/examples/functions/delete-deployment.md +2 -2
  88. package/docs/examples/functions/delete-variable.md +2 -2
  89. package/docs/examples/functions/delete.md +1 -1
  90. package/docs/examples/functions/download-deployment.md +2 -2
  91. package/docs/examples/functions/get-deployment.md +2 -2
  92. package/docs/examples/functions/get-execution.md +2 -2
  93. package/docs/examples/functions/get-function-usage.md +1 -1
  94. package/docs/examples/functions/get-variable.md +2 -2
  95. package/docs/examples/functions/get.md +1 -1
  96. package/docs/examples/functions/list-deployments.md +1 -1
  97. package/docs/examples/functions/list-executions.md +1 -1
  98. package/docs/examples/functions/list-variables.md +1 -1
  99. package/docs/examples/functions/update-deployment.md +2 -2
  100. package/docs/examples/functions/update-variable.md +3 -3
  101. package/docs/examples/functions/update.md +2 -2
  102. package/docs/examples/health/get-certificate.md +2 -0
  103. package/docs/examples/health/get-failed-jobs.md +3 -0
  104. package/docs/examples/health/get-queue-usage-dump.md +2 -0
  105. package/docs/examples/health/get-queue-usage.md +2 -0
  106. package/docs/examples/health/get-storage.md +1 -0
  107. package/docs/examples/messaging/create-apns-provider.md +9 -0
  108. package/docs/examples/messaging/create-email.md +13 -0
  109. package/docs/examples/messaging/create-fcm-provider.md +5 -0
  110. package/docs/examples/messaging/create-mailgun-provider.md +11 -0
  111. package/docs/examples/messaging/create-msg91provider.md +7 -0
  112. package/docs/examples/messaging/create-push.md +17 -0
  113. package/docs/examples/messaging/create-sendgrid-provider.md +9 -0
  114. package/docs/examples/messaging/create-sms.md +8 -0
  115. package/docs/examples/messaging/create-smtp-provider.md +15 -0
  116. package/docs/examples/messaging/create-subscriber.md +4 -0
  117. package/docs/examples/messaging/create-telesign-provider.md +7 -0
  118. package/docs/examples/messaging/create-textmagic-provider.md +7 -0
  119. package/docs/examples/messaging/create-topic.md +4 -0
  120. package/docs/examples/messaging/create-twilio-provider.md +7 -0
  121. package/docs/examples/messaging/create-vonage-provider.md +7 -0
  122. package/docs/examples/messaging/delete-provider.md +2 -0
  123. package/docs/examples/messaging/delete-subscriber.md +3 -0
  124. package/docs/examples/messaging/delete-topic.md +2 -0
  125. package/docs/examples/messaging/delete.md +2 -0
  126. package/docs/examples/messaging/get-message.md +2 -0
  127. package/docs/examples/messaging/get-provider.md +2 -0
  128. package/docs/examples/messaging/get-subscriber.md +3 -0
  129. package/docs/examples/messaging/get-topic.md +2 -0
  130. package/docs/examples/messaging/list-message-logs.md +3 -0
  131. package/docs/examples/messaging/list-messages.md +3 -0
  132. package/docs/examples/messaging/list-provider-logs.md +3 -0
  133. package/docs/examples/messaging/list-providers.md +3 -0
  134. package/docs/examples/messaging/list-subscriber-logs.md +3 -0
  135. package/docs/examples/messaging/list-subscribers.md +4 -0
  136. package/docs/examples/messaging/list-targets.md +3 -0
  137. package/docs/examples/messaging/list-topic-logs.md +3 -0
  138. package/docs/examples/messaging/list-topics.md +3 -0
  139. package/docs/examples/messaging/update-apns-provider.md +9 -0
  140. package/docs/examples/messaging/update-email.md +12 -0
  141. package/docs/examples/messaging/update-fcm-provider.md +5 -0
  142. package/docs/examples/messaging/update-mailgun-provider.md +11 -0
  143. package/docs/examples/messaging/update-msg91provider.md +7 -0
  144. package/docs/examples/messaging/update-push.md +17 -0
  145. package/docs/examples/messaging/update-sendgrid-provider.md +9 -0
  146. package/docs/examples/messaging/update-sms.md +8 -0
  147. package/docs/examples/messaging/update-smtp-provider.md +15 -0
  148. package/docs/examples/messaging/update-telesign-provider.md +7 -0
  149. package/docs/examples/messaging/update-textmagic-provider.md +7 -0
  150. package/docs/examples/messaging/update-topic.md +4 -0
  151. package/docs/examples/messaging/update-twilio-provider.md +7 -0
  152. package/docs/examples/messaging/update-vonage-provider.md +7 -0
  153. package/docs/examples/migrations/create-appwrite-migration.md +2 -2
  154. package/docs/examples/migrations/create-firebase-migration.md +1 -1
  155. package/docs/examples/migrations/create-firebase-o-auth-migration.md +1 -1
  156. package/docs/examples/migrations/create-n-host-migration.md +6 -6
  157. package/docs/examples/migrations/create-supabase-migration.md +4 -4
  158. package/docs/examples/migrations/delete.md +1 -1
  159. package/docs/examples/migrations/get-appwrite-report.md +2 -2
  160. package/docs/examples/migrations/get-firebase-report-o-auth.md +1 -1
  161. package/docs/examples/migrations/get-firebase-report.md +1 -1
  162. package/docs/examples/migrations/get-n-host-report.md +6 -6
  163. package/docs/examples/migrations/get-supabase-report.md +4 -4
  164. package/docs/examples/migrations/get.md +1 -1
  165. package/docs/examples/migrations/retry.md +1 -1
  166. package/docs/examples/project/create-variable.md +2 -2
  167. package/docs/examples/project/delete-variable.md +1 -1
  168. package/docs/examples/project/get-usage.md +2 -0
  169. package/docs/examples/project/get-variable.md +1 -1
  170. package/docs/examples/project/update-variable.md +2 -2
  171. package/docs/examples/projects/create-key.md +2 -2
  172. package/docs/examples/projects/create-platform.md +2 -2
  173. package/docs/examples/projects/create-smtp-test.md +11 -0
  174. package/docs/examples/projects/create-webhook.md +4 -3
  175. package/docs/examples/projects/create.md +2 -2
  176. package/docs/examples/projects/delete-email-template.md +1 -1
  177. package/docs/examples/projects/delete-key.md +2 -2
  178. package/docs/examples/projects/delete-platform.md +2 -2
  179. package/docs/examples/projects/delete-sms-template.md +1 -1
  180. package/docs/examples/projects/delete-webhook.md +2 -2
  181. package/docs/examples/projects/delete.md +1 -1
  182. package/docs/examples/projects/get-email-template.md +1 -1
  183. package/docs/examples/projects/get-key.md +2 -2
  184. package/docs/examples/projects/get-platform.md +2 -2
  185. package/docs/examples/projects/get-sms-template.md +1 -1
  186. package/docs/examples/projects/get-webhook.md +2 -2
  187. package/docs/examples/projects/get.md +1 -1
  188. package/docs/examples/projects/list-keys.md +1 -1
  189. package/docs/examples/projects/list-platforms.md +1 -1
  190. package/docs/examples/projects/list-webhooks.md +1 -1
  191. package/docs/examples/projects/update-api-status-all.md +3 -0
  192. package/docs/examples/projects/update-api-status.md +4 -0
  193. package/docs/examples/projects/update-auth-duration.md +1 -1
  194. package/docs/examples/projects/update-auth-limit.md +1 -1
  195. package/docs/examples/projects/update-auth-password-dictionary.md +1 -1
  196. package/docs/examples/projects/update-auth-password-history.md +1 -1
  197. package/docs/examples/projects/update-auth-sessions-limit.md +1 -1
  198. package/docs/examples/projects/update-auth-status.md +1 -1
  199. package/docs/examples/projects/update-email-template.md +3 -3
  200. package/docs/examples/projects/update-key.md +3 -3
  201. package/docs/examples/projects/update-o-auth2.md +1 -1
  202. package/docs/examples/projects/update-personal-data-check.md +1 -1
  203. package/docs/examples/projects/update-platform.md +3 -3
  204. package/docs/examples/projects/update-service-status-all.md +1 -1
  205. package/docs/examples/projects/update-service-status.md +1 -1
  206. package/docs/examples/projects/update-sms-template.md +2 -2
  207. package/docs/examples/projects/update-smtp.md +11 -0
  208. package/docs/examples/projects/update-team.md +2 -2
  209. package/docs/examples/projects/update-webhook-signature.md +2 -2
  210. package/docs/examples/projects/update-webhook.md +5 -4
  211. package/docs/examples/projects/update.md +2 -2
  212. package/docs/examples/proxy/delete-rule.md +1 -1
  213. package/docs/examples/proxy/get-rule.md +1 -1
  214. package/docs/examples/proxy/update-rule-verification.md +1 -1
  215. package/docs/examples/storage/create-bucket.md +2 -2
  216. package/docs/examples/storage/create-file.md +2 -2
  217. package/docs/examples/storage/delete-bucket.md +1 -1
  218. package/docs/examples/storage/delete-file.md +2 -2
  219. package/docs/examples/storage/get-bucket-usage.md +1 -1
  220. package/docs/examples/storage/get-bucket.md +1 -1
  221. package/docs/examples/storage/get-file-download.md +2 -2
  222. package/docs/examples/storage/get-file-preview.md +2 -2
  223. package/docs/examples/storage/get-file-view.md +2 -2
  224. package/docs/examples/storage/get-file.md +2 -2
  225. package/docs/examples/storage/list-files.md +1 -1
  226. package/docs/examples/storage/update-bucket.md +2 -2
  227. package/docs/examples/storage/update-file.md +2 -2
  228. package/docs/examples/teams/create-membership.md +1 -1
  229. package/docs/examples/teams/create.md +2 -2
  230. package/docs/examples/teams/delete-membership.md +2 -2
  231. package/docs/examples/teams/delete.md +1 -1
  232. package/docs/examples/teams/get-membership.md +2 -2
  233. package/docs/examples/teams/get-prefs.md +1 -1
  234. package/docs/examples/teams/get.md +1 -1
  235. package/docs/examples/teams/list-logs.md +1 -1
  236. package/docs/examples/teams/list-memberships.md +1 -1
  237. package/docs/examples/teams/update-membership-status.md +4 -4
  238. package/docs/examples/teams/update-membership.md +2 -2
  239. package/docs/examples/teams/update-name.md +2 -2
  240. package/docs/examples/teams/update-prefs.md +1 -1
  241. package/docs/examples/users/create-argon2user.md +1 -1
  242. package/docs/examples/users/create-bcrypt-user.md +1 -1
  243. package/docs/examples/users/create-m-d5user.md +1 -1
  244. package/docs/examples/users/create-mfa-recovery-codes.md +2 -0
  245. package/docs/examples/users/create-p-h-pass-user.md +1 -1
  246. package/docs/examples/users/create-s-h-a-user.md +1 -1
  247. package/docs/examples/users/create-scrypt-modified-user.md +4 -4
  248. package/docs/examples/users/create-scrypt-user.md +2 -2
  249. package/docs/examples/users/create-session.md +2 -0
  250. package/docs/examples/users/create-target.md +7 -0
  251. package/docs/examples/users/create-token.md +4 -0
  252. package/docs/examples/users/create.md +1 -1
  253. package/docs/examples/users/delete-identity.md +1 -1
  254. package/docs/examples/users/delete-mfa-authenticator.md +3 -0
  255. package/docs/examples/users/delete-session.md +2 -2
  256. package/docs/examples/users/delete-sessions.md +1 -1
  257. package/docs/examples/users/delete-target.md +3 -0
  258. package/docs/examples/users/delete.md +1 -1
  259. package/docs/examples/users/get-mfa-recovery-codes.md +2 -0
  260. package/docs/examples/users/get-prefs.md +1 -1
  261. package/docs/examples/users/get-target.md +3 -0
  262. package/docs/examples/users/get-usage.md +0 -1
  263. package/docs/examples/users/get.md +1 -1
  264. package/docs/examples/users/list-logs.md +1 -1
  265. package/docs/examples/users/list-memberships.md +1 -1
  266. package/docs/examples/users/list-mfa-factors.md +2 -0
  267. package/docs/examples/users/list-sessions.md +1 -1
  268. package/docs/examples/users/list-targets.md +3 -0
  269. package/docs/examples/users/update-email-verification.md +1 -1
  270. package/docs/examples/users/update-email.md +1 -1
  271. package/docs/examples/users/update-labels.md +1 -1
  272. package/docs/examples/users/update-mfa-recovery-codes.md +2 -0
  273. package/docs/examples/users/update-mfa.md +3 -0
  274. package/docs/examples/users/update-name.md +2 -2
  275. package/docs/examples/users/update-password.md +1 -1
  276. package/docs/examples/users/update-phone-verification.md +1 -1
  277. package/docs/examples/users/update-phone.md +1 -1
  278. package/docs/examples/users/update-prefs.md +1 -1
  279. package/docs/examples/users/update-status.md +1 -1
  280. package/docs/examples/users/update-target.md +6 -0
  281. package/docs/examples/vcs/create-repository-detection.md +2 -2
  282. package/docs/examples/vcs/create-repository.md +2 -2
  283. package/docs/examples/vcs/delete-installation.md +1 -1
  284. package/docs/examples/vcs/get-installation.md +1 -1
  285. package/docs/examples/vcs/get-repository.md +2 -2
  286. package/docs/examples/vcs/list-repositories.md +1 -1
  287. package/docs/examples/vcs/list-repository-branches.md +2 -2
  288. package/docs/examples/vcs/update-external-deployments.md +3 -3
  289. package/index.js +2 -0
  290. package/install.ps1 +2 -2
  291. package/install.sh +1 -1
  292. package/lib/client.js +9 -4
  293. package/lib/commands/account.js +966 -381
  294. package/lib/commands/assistant.js +3 -8
  295. package/lib/commands/avatars.js +32 -48
  296. package/lib/commands/console.js +3 -8
  297. package/lib/commands/databases.js +119 -265
  298. package/lib/commands/deploy.js +45 -6
  299. package/lib/commands/functions.js +59 -124
  300. package/lib/commands/generic.js +0 -1
  301. package/lib/commands/graphql.js +5 -13
  302. package/lib/commands/health.js +225 -89
  303. package/lib/commands/locale.js +17 -43
  304. package/lib/commands/messaging.js +2815 -0
  305. package/lib/commands/migrations.js +35 -85
  306. package/lib/commands/project.js +28 -38
  307. package/lib/commands/projects.js +286 -270
  308. package/lib/commands/proxy.js +12 -29
  309. package/lib/commands/storage.js +42 -87
  310. package/lib/commands/teams.js +31 -75
  311. package/lib/commands/users.js +677 -235
  312. package/lib/commands/vcs.js +19 -48
  313. package/lib/paginate.js +2 -2
  314. package/lib/parser.js +1 -0
  315. package/package.json +1 -1
  316. package/scoop/appwrite.json +3 -3
  317. package/docs/examples/account/create-magic-u-r-l-session.md +0 -4
  318. package/docs/examples/account/create-phone-session.md +0 -3
  319. package/docs/examples/projects/get-usage.md +0 -3
  320. package/docs/examples/projects/update-smtp-configuration.md +0 -11
@@ -37,7 +37,7 @@ function convertReadStreamToReadableStream(readStream) {
37
37
 
38
38
  const assistant = new Command("assistant").description(commandDescriptions['assistant']).configureHelp({
39
39
  helpWidth: process.stdout.columns || 80
40
- })
40
+ })
41
41
 
42
42
  /**
43
43
  * @typedef {Object} AssistantChatRequestParams
@@ -51,21 +51,18 @@ const assistant = new Command("assistant").description(commandDescriptions['assi
51
51
  */
52
52
  const assistantChat = async ({ prompt, parseOutput = true, sdk = undefined}) => {
53
53
  let client = !sdk ? await sdkForProject() : sdk;
54
-
55
54
  let apiPath = '/console/assistant';
56
55
  let payload = {};
57
56
  if (typeof prompt !== 'undefined') {
58
57
  payload['prompt'] = prompt;
59
58
  }
60
59
 
61
-
62
60
  let response = undefined;
63
-
61
+
64
62
  response = await client.call('post', apiPath, {
65
63
  'content-type': 'application/json',
66
64
  }, payload);
67
65
 
68
-
69
66
  if (parseOutput) {
70
67
  parse(response)
71
68
  success()
@@ -74,15 +71,13 @@ const assistantChat = async ({ prompt, parseOutput = true, sdk = undefined}) =>
74
71
  return response;
75
72
  }
76
73
 
77
-
78
74
  assistant
79
75
  .command(`chat`)
80
76
  .description(``)
81
77
  .requiredOption(`--prompt <prompt>`, `Prompt. A string containing questions asked to the AI assistant.`)
82
78
  .action(actionRunner(assistantChat))
83
79
 
84
-
85
80
  module.exports = {
86
81
  assistant,
87
- assistantChat
82
+ assistantChat
88
83
  };
@@ -37,17 +37,17 @@ function convertReadStreamToReadableStream(readStream) {
37
37
 
38
38
  const avatars = new Command("avatars").description(commandDescriptions['avatars']).configureHelp({
39
39
  helpWidth: process.stdout.columns || 80
40
- })
40
+ })
41
41
 
42
42
  /**
43
43
  * @typedef {Object} AvatarsGetBrowserRequestParams
44
- * @property {string} code Browser Code.
44
+ * @property {Browser} code Browser Code.
45
45
  * @property {number} width Image width. Pass an integer between 0 to 2000. Defaults to 100.
46
46
  * @property {number} height Image height. Pass an integer between 0 to 2000. Defaults to 100.
47
47
  * @property {number} quality Image quality. Pass an integer between 0 to 100. Defaults to 100.
48
48
  * @property {boolean} parseOutput
49
49
  * @property {libClient | undefined} sdk
50
- * @property {string} destination
50
+ * @property {string} destination
51
51
  */
52
52
 
53
53
  /**
@@ -55,7 +55,6 @@ const avatars = new Command("avatars").description(commandDescriptions['avatars'
55
55
  */
56
56
  const avatarsGetBrowser = async ({ code, width, height, quality, parseOutput = true, sdk = undefined, destination}) => {
57
57
  let client = !sdk ? await sdkForProject() : sdk;
58
-
59
58
  let apiPath = '/avatars/browsers/{code}'.replace('{code}', code);
60
59
  let payload = {};
61
60
  if (typeof width !== 'undefined') {
@@ -67,20 +66,19 @@ const avatarsGetBrowser = async ({ code, width, height, quality, parseOutput = t
67
66
  if (typeof quality !== 'undefined') {
68
67
  payload['quality'] = quality;
69
68
  }
70
-
71
69
  payload['project'] = localConfig.getProject().projectId
72
70
  payload['key'] = globalConfig.getKey();
73
71
  const queryParams = new URLSearchParams(payload);
74
72
  apiPath = `${globalConfig.getEndpoint()}${apiPath}?${queryParams.toString()}`;
75
73
 
76
74
  let response = undefined;
77
-
75
+
78
76
  response = await client.call('get', apiPath, {
79
77
  'content-type': 'application/json',
80
78
  }, payload, 'arraybuffer');
81
79
 
82
80
  fs.writeFileSync(destination, response);
83
-
81
+
84
82
  if (parseOutput) {
85
83
  parse(response)
86
84
  success()
@@ -91,13 +89,13 @@ const avatarsGetBrowser = async ({ code, width, height, quality, parseOutput = t
91
89
 
92
90
  /**
93
91
  * @typedef {Object} AvatarsGetCreditCardRequestParams
94
- * @property {string} code Credit Card Code. Possible values: amex, argencard, cabal, censosud, diners, discover, elo, hipercard, jcb, mastercard, naranja, targeta-shopping, union-china-pay, visa, mir, maestro.
92
+ * @property {CreditCard} code Credit Card Code. Possible values: amex, argencard, cabal, censosud, diners, discover, elo, hipercard, jcb, mastercard, naranja, targeta-shopping, union-china-pay, visa, mir, maestro.
95
93
  * @property {number} width Image width. Pass an integer between 0 to 2000. Defaults to 100.
96
94
  * @property {number} height Image height. Pass an integer between 0 to 2000. Defaults to 100.
97
95
  * @property {number} quality Image quality. Pass an integer between 0 to 100. Defaults to 100.
98
96
  * @property {boolean} parseOutput
99
97
  * @property {libClient | undefined} sdk
100
- * @property {string} destination
98
+ * @property {string} destination
101
99
  */
102
100
 
103
101
  /**
@@ -105,7 +103,6 @@ const avatarsGetBrowser = async ({ code, width, height, quality, parseOutput = t
105
103
  */
106
104
  const avatarsGetCreditCard = async ({ code, width, height, quality, parseOutput = true, sdk = undefined, destination}) => {
107
105
  let client = !sdk ? await sdkForProject() : sdk;
108
-
109
106
  let apiPath = '/avatars/credit-cards/{code}'.replace('{code}', code);
110
107
  let payload = {};
111
108
  if (typeof width !== 'undefined') {
@@ -117,20 +114,19 @@ const avatarsGetCreditCard = async ({ code, width, height, quality, parseOutput
117
114
  if (typeof quality !== 'undefined') {
118
115
  payload['quality'] = quality;
119
116
  }
120
-
121
117
  payload['project'] = localConfig.getProject().projectId
122
118
  payload['key'] = globalConfig.getKey();
123
119
  const queryParams = new URLSearchParams(payload);
124
120
  apiPath = `${globalConfig.getEndpoint()}${apiPath}?${queryParams.toString()}`;
125
121
 
126
122
  let response = undefined;
127
-
123
+
128
124
  response = await client.call('get', apiPath, {
129
125
  'content-type': 'application/json',
130
126
  }, payload, 'arraybuffer');
131
127
 
132
128
  fs.writeFileSync(destination, response);
133
-
129
+
134
130
  if (parseOutput) {
135
131
  parse(response)
136
132
  success()
@@ -144,7 +140,7 @@ const avatarsGetCreditCard = async ({ code, width, height, quality, parseOutput
144
140
  * @property {string} url Website URL which you want to fetch the favicon from.
145
141
  * @property {boolean} parseOutput
146
142
  * @property {libClient | undefined} sdk
147
- * @property {string} destination
143
+ * @property {string} destination
148
144
  */
149
145
 
150
146
  /**
@@ -152,26 +148,24 @@ const avatarsGetCreditCard = async ({ code, width, height, quality, parseOutput
152
148
  */
153
149
  const avatarsGetFavicon = async ({ url, parseOutput = true, sdk = undefined, destination}) => {
154
150
  let client = !sdk ? await sdkForProject() : sdk;
155
-
156
151
  let apiPath = '/avatars/favicon';
157
152
  let payload = {};
158
153
  if (typeof url !== 'undefined') {
159
154
  payload['url'] = url;
160
155
  }
161
-
162
156
  payload['project'] = localConfig.getProject().projectId
163
157
  payload['key'] = globalConfig.getKey();
164
158
  const queryParams = new URLSearchParams(payload);
165
159
  apiPath = `${globalConfig.getEndpoint()}${apiPath}?${queryParams.toString()}`;
166
160
 
167
161
  let response = undefined;
168
-
162
+
169
163
  response = await client.call('get', apiPath, {
170
164
  'content-type': 'application/json',
171
165
  }, payload, 'arraybuffer');
172
166
 
173
167
  fs.writeFileSync(destination, response);
174
-
168
+
175
169
  if (parseOutput) {
176
170
  parse(response)
177
171
  success()
@@ -182,13 +176,13 @@ const avatarsGetFavicon = async ({ url, parseOutput = true, sdk = undefined, des
182
176
 
183
177
  /**
184
178
  * @typedef {Object} AvatarsGetFlagRequestParams
185
- * @property {string} code Country Code. ISO Alpha-2 country code format.
179
+ * @property {Flag} code Country Code. ISO Alpha-2 country code format.
186
180
  * @property {number} width Image width. Pass an integer between 0 to 2000. Defaults to 100.
187
181
  * @property {number} height Image height. Pass an integer between 0 to 2000. Defaults to 100.
188
182
  * @property {number} quality Image quality. Pass an integer between 0 to 100. Defaults to 100.
189
183
  * @property {boolean} parseOutput
190
184
  * @property {libClient | undefined} sdk
191
- * @property {string} destination
185
+ * @property {string} destination
192
186
  */
193
187
 
194
188
  /**
@@ -196,7 +190,6 @@ const avatarsGetFavicon = async ({ url, parseOutput = true, sdk = undefined, des
196
190
  */
197
191
  const avatarsGetFlag = async ({ code, width, height, quality, parseOutput = true, sdk = undefined, destination}) => {
198
192
  let client = !sdk ? await sdkForProject() : sdk;
199
-
200
193
  let apiPath = '/avatars/flags/{code}'.replace('{code}', code);
201
194
  let payload = {};
202
195
  if (typeof width !== 'undefined') {
@@ -208,20 +201,19 @@ const avatarsGetFlag = async ({ code, width, height, quality, parseOutput = true
208
201
  if (typeof quality !== 'undefined') {
209
202
  payload['quality'] = quality;
210
203
  }
211
-
212
204
  payload['project'] = localConfig.getProject().projectId
213
205
  payload['key'] = globalConfig.getKey();
214
206
  const queryParams = new URLSearchParams(payload);
215
207
  apiPath = `${globalConfig.getEndpoint()}${apiPath}?${queryParams.toString()}`;
216
208
 
217
209
  let response = undefined;
218
-
210
+
219
211
  response = await client.call('get', apiPath, {
220
212
  'content-type': 'application/json',
221
213
  }, payload, 'arraybuffer');
222
214
 
223
215
  fs.writeFileSync(destination, response);
224
-
216
+
225
217
  if (parseOutput) {
226
218
  parse(response)
227
219
  success()
@@ -237,7 +229,7 @@ const avatarsGetFlag = async ({ code, width, height, quality, parseOutput = true
237
229
  * @property {number} height Resize preview image height, Pass an integer between 0 to 2000. Defaults to 400.
238
230
  * @property {boolean} parseOutput
239
231
  * @property {libClient | undefined} sdk
240
- * @property {string} destination
232
+ * @property {string} destination
241
233
  */
242
234
 
243
235
  /**
@@ -245,7 +237,6 @@ const avatarsGetFlag = async ({ code, width, height, quality, parseOutput = true
245
237
  */
246
238
  const avatarsGetImage = async ({ url, width, height, parseOutput = true, sdk = undefined, destination}) => {
247
239
  let client = !sdk ? await sdkForProject() : sdk;
248
-
249
240
  let apiPath = '/avatars/image';
250
241
  let payload = {};
251
242
  if (typeof url !== 'undefined') {
@@ -257,20 +248,19 @@ const avatarsGetImage = async ({ url, width, height, parseOutput = true, sdk = u
257
248
  if (typeof height !== 'undefined') {
258
249
  payload['height'] = height;
259
250
  }
260
-
261
251
  payload['project'] = localConfig.getProject().projectId
262
252
  payload['key'] = globalConfig.getKey();
263
253
  const queryParams = new URLSearchParams(payload);
264
254
  apiPath = `${globalConfig.getEndpoint()}${apiPath}?${queryParams.toString()}`;
265
255
 
266
256
  let response = undefined;
267
-
257
+
268
258
  response = await client.call('get', apiPath, {
269
259
  'content-type': 'application/json',
270
260
  }, payload, 'arraybuffer');
271
261
 
272
262
  fs.writeFileSync(destination, response);
273
-
263
+
274
264
  if (parseOutput) {
275
265
  parse(response)
276
266
  success()
@@ -287,7 +277,7 @@ const avatarsGetImage = async ({ url, width, height, parseOutput = true, sdk = u
287
277
  * @property {string} background Changes background color. By default a random color will be picked and stay will persistent to the given name.
288
278
  * @property {boolean} parseOutput
289
279
  * @property {libClient | undefined} sdk
290
- * @property {string} destination
280
+ * @property {string} destination
291
281
  */
292
282
 
293
283
  /**
@@ -295,7 +285,6 @@ const avatarsGetImage = async ({ url, width, height, parseOutput = true, sdk = u
295
285
  */
296
286
  const avatarsGetInitials = async ({ name, width, height, background, parseOutput = true, sdk = undefined, destination}) => {
297
287
  let client = !sdk ? await sdkForProject() : sdk;
298
-
299
288
  let apiPath = '/avatars/initials';
300
289
  let payload = {};
301
290
  if (typeof name !== 'undefined') {
@@ -310,20 +299,19 @@ const avatarsGetInitials = async ({ name, width, height, background, parseOutput
310
299
  if (typeof background !== 'undefined') {
311
300
  payload['background'] = background;
312
301
  }
313
-
314
302
  payload['project'] = localConfig.getProject().projectId
315
303
  payload['key'] = globalConfig.getKey();
316
304
  const queryParams = new URLSearchParams(payload);
317
305
  apiPath = `${globalConfig.getEndpoint()}${apiPath}?${queryParams.toString()}`;
318
306
 
319
307
  let response = undefined;
320
-
308
+
321
309
  response = await client.call('get', apiPath, {
322
310
  'content-type': 'application/json',
323
311
  }, payload, 'arraybuffer');
324
312
 
325
313
  fs.writeFileSync(destination, response);
326
-
314
+
327
315
  if (parseOutput) {
328
316
  parse(response)
329
317
  success()
@@ -340,7 +328,7 @@ const avatarsGetInitials = async ({ name, width, height, background, parseOutput
340
328
  * @property {boolean} download Return resulting image with &#039;Content-Disposition: attachment &#039; headers for the browser to start downloading it. Pass 0 for no header, or 1 for otherwise. Default value is set to 0.
341
329
  * @property {boolean} parseOutput
342
330
  * @property {libClient | undefined} sdk
343
- * @property {string} destination
331
+ * @property {string} destination
344
332
  */
345
333
 
346
334
  /**
@@ -348,7 +336,6 @@ const avatarsGetInitials = async ({ name, width, height, background, parseOutput
348
336
  */
349
337
  const avatarsGetQR = async ({ text, size, margin, download, parseOutput = true, sdk = undefined, destination}) => {
350
338
  let client = !sdk ? await sdkForProject() : sdk;
351
-
352
339
  let apiPath = '/avatars/qr';
353
340
  let payload = {};
354
341
  if (typeof text !== 'undefined') {
@@ -363,20 +350,19 @@ const avatarsGetQR = async ({ text, size, margin, download, parseOutput = true,
363
350
  if (typeof download !== 'undefined') {
364
351
  payload['download'] = download;
365
352
  }
366
-
367
353
  payload['project'] = localConfig.getProject().projectId
368
354
  payload['key'] = globalConfig.getKey();
369
355
  const queryParams = new URLSearchParams(payload);
370
356
  apiPath = `${globalConfig.getEndpoint()}${apiPath}?${queryParams.toString()}`;
371
357
 
372
358
  let response = undefined;
373
-
359
+
374
360
  response = await client.call('get', apiPath, {
375
361
  'content-type': 'application/json',
376
362
  }, payload, 'arraybuffer');
377
363
 
378
364
  fs.writeFileSync(destination, response);
379
-
365
+
380
366
  if (parseOutput) {
381
367
  parse(response)
382
368
  success()
@@ -385,7 +371,6 @@ const avatarsGetQR = async ({ text, size, margin, download, parseOutput = true,
385
371
  return response;
386
372
  }
387
373
 
388
-
389
374
  avatars
390
375
  .command(`getBrowser`)
391
376
  .description(`You can use this endpoint to show different browser icons to your users. The code argument receives the browser code as it appears in your user [GET /account/sessions](https://appwrite.io/docs/references/cloud/client-web/account#getSessions) endpoint. Use width, height and quality arguments to change the output settings. When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px.`)
@@ -452,14 +437,13 @@ avatars
452
437
  .requiredOption(`--destination <path>`, `output file path.`)
453
438
  .action(actionRunner(avatarsGetQR))
454
439
 
455
-
456
440
  module.exports = {
457
441
  avatars,
458
- avatarsGetBrowser,
459
- avatarsGetCreditCard,
460
- avatarsGetFavicon,
461
- avatarsGetFlag,
462
- avatarsGetImage,
463
- avatarsGetInitials,
464
- avatarsGetQR
442
+ avatarsGetBrowser,
443
+ avatarsGetCreditCard,
444
+ avatarsGetFavicon,
445
+ avatarsGetFlag,
446
+ avatarsGetImage,
447
+ avatarsGetInitials,
448
+ avatarsGetQR
465
449
  };
@@ -37,7 +37,7 @@ function convertReadStreamToReadableStream(readStream) {
37
37
 
38
38
  const console = new Command("console").description(commandDescriptions['console']).configureHelp({
39
39
  helpWidth: process.stdout.columns || 80
40
- })
40
+ })
41
41
 
42
42
  /**
43
43
  * @typedef {Object} ConsoleVariablesRequestParams
@@ -50,18 +50,15 @@ const console = new Command("console").description(commandDescriptions['console'
50
50
  */
51
51
  const consoleVariables = async ({ parseOutput = true, sdk = undefined}) => {
52
52
  let client = !sdk ? await sdkForProject() : sdk;
53
-
54
53
  let apiPath = '/console/variables';
55
54
  let payload = {};
56
55
 
57
-
58
56
  let response = undefined;
59
-
57
+
60
58
  response = await client.call('get', apiPath, {
61
59
  'content-type': 'application/json',
62
60
  }, payload);
63
61
 
64
-
65
62
  if (parseOutput) {
66
63
  parse(response)
67
64
  success()
@@ -70,14 +67,12 @@ const consoleVariables = async ({ parseOutput = true, sdk = undefined}) => {
70
67
  return response;
71
68
  }
72
69
 
73
-
74
70
  console
75
71
  .command(`variables`)
76
72
  .description(`Get all Environment Variables that are relevant for the console.`)
77
73
  .action(actionRunner(consoleVariables))
78
74
 
79
-
80
75
  module.exports = {
81
76
  console,
82
- consoleVariables
77
+ consoleVariables
83
78
  };