chirag-appwrite-cli 0.1.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 (491) hide show
  1. package/.github/workflows/npm-publish.yml +49 -0
  2. package/CHANGELOG.md +1 -0
  3. package/Formula/appwrite.rb +19 -0
  4. package/LICENSE.md +1 -0
  5. package/README.md +104 -0
  6. package/appwrite.json +164 -0
  7. package/docs/examples/account/create-anonymous-session.md +1 -0
  8. package/docs/examples/account/create-email-password-session.md +3 -0
  9. package/docs/examples/account/create-email-token.md +4 -0
  10. package/docs/examples/account/create-j-w-t.md +1 -0
  11. package/docs/examples/account/create-magic-u-r-l-token.md +5 -0
  12. package/docs/examples/account/create-mfa-authenticator.md +2 -0
  13. package/docs/examples/account/create-mfa-challenge.md +2 -0
  14. package/docs/examples/account/create-mfa-recovery-codes.md +1 -0
  15. package/docs/examples/account/create-o-auth2session.md +5 -0
  16. package/docs/examples/account/create-o-auth2token.md +5 -0
  17. package/docs/examples/account/create-phone-token.md +3 -0
  18. package/docs/examples/account/create-phone-verification.md +1 -0
  19. package/docs/examples/account/create-push-target.md +4 -0
  20. package/docs/examples/account/create-recovery.md +3 -0
  21. package/docs/examples/account/create-session.md +3 -0
  22. package/docs/examples/account/create-verification.md +2 -0
  23. package/docs/examples/account/create.md +5 -0
  24. package/docs/examples/account/delete-identity.md +2 -0
  25. package/docs/examples/account/delete-mfa-authenticator.md +2 -0
  26. package/docs/examples/account/delete-push-target.md +2 -0
  27. package/docs/examples/account/delete-session.md +2 -0
  28. package/docs/examples/account/delete-sessions.md +1 -0
  29. package/docs/examples/account/delete.md +1 -0
  30. package/docs/examples/account/get-mfa-recovery-codes.md +1 -0
  31. package/docs/examples/account/get-prefs.md +1 -0
  32. package/docs/examples/account/get-session.md +2 -0
  33. package/docs/examples/account/get.md +1 -0
  34. package/docs/examples/account/list-identities.md +2 -0
  35. package/docs/examples/account/list-logs.md +2 -0
  36. package/docs/examples/account/list-mfa-factors.md +1 -0
  37. package/docs/examples/account/list-sessions.md +1 -0
  38. package/docs/examples/account/update-email.md +3 -0
  39. package/docs/examples/account/update-m-f-a.md +2 -0
  40. package/docs/examples/account/update-magic-u-r-l-session.md +3 -0
  41. package/docs/examples/account/update-mfa-authenticator.md +3 -0
  42. package/docs/examples/account/update-mfa-challenge.md +3 -0
  43. package/docs/examples/account/update-mfa-recovery-codes.md +1 -0
  44. package/docs/examples/account/update-name.md +2 -0
  45. package/docs/examples/account/update-password.md +3 -0
  46. package/docs/examples/account/update-phone-session.md +3 -0
  47. package/docs/examples/account/update-phone-verification.md +3 -0
  48. package/docs/examples/account/update-phone.md +3 -0
  49. package/docs/examples/account/update-prefs.md +2 -0
  50. package/docs/examples/account/update-push-target.md +3 -0
  51. package/docs/examples/account/update-recovery.md +4 -0
  52. package/docs/examples/account/update-session.md +2 -0
  53. package/docs/examples/account/update-status.md +1 -0
  54. package/docs/examples/account/update-verification.md +3 -0
  55. package/docs/examples/avatars/get-browser.md +5 -0
  56. package/docs/examples/avatars/get-credit-card.md +5 -0
  57. package/docs/examples/avatars/get-favicon.md +2 -0
  58. package/docs/examples/avatars/get-flag.md +5 -0
  59. package/docs/examples/avatars/get-image.md +4 -0
  60. package/docs/examples/avatars/get-initials.md +5 -0
  61. package/docs/examples/avatars/get-q-r.md +5 -0
  62. package/docs/examples/console/get-resource.md +3 -0
  63. package/docs/examples/console/variables.md +1 -0
  64. package/docs/examples/databases/create-boolean-attribute.md +7 -0
  65. package/docs/examples/databases/create-collection.md +7 -0
  66. package/docs/examples/databases/create-datetime-attribute.md +7 -0
  67. package/docs/examples/databases/create-document.md +6 -0
  68. package/docs/examples/databases/create-documents.md +4 -0
  69. package/docs/examples/databases/create-email-attribute.md +7 -0
  70. package/docs/examples/databases/create-enum-attribute.md +8 -0
  71. package/docs/examples/databases/create-float-attribute.md +9 -0
  72. package/docs/examples/databases/create-index.md +8 -0
  73. package/docs/examples/databases/create-integer-attribute.md +9 -0
  74. package/docs/examples/databases/create-ip-attribute.md +7 -0
  75. package/docs/examples/databases/create-relationship-attribute.md +9 -0
  76. package/docs/examples/databases/create-string-attribute.md +9 -0
  77. package/docs/examples/databases/create-url-attribute.md +7 -0
  78. package/docs/examples/databases/create.md +4 -0
  79. package/docs/examples/databases/decrement-document-attribute.md +7 -0
  80. package/docs/examples/databases/delete-attribute.md +4 -0
  81. package/docs/examples/databases/delete-collection.md +3 -0
  82. package/docs/examples/databases/delete-document.md +4 -0
  83. package/docs/examples/databases/delete-documents.md +4 -0
  84. package/docs/examples/databases/delete-index.md +4 -0
  85. package/docs/examples/databases/delete.md +2 -0
  86. package/docs/examples/databases/get-attribute.md +4 -0
  87. package/docs/examples/databases/get-collection-usage.md +4 -0
  88. package/docs/examples/databases/get-collection.md +3 -0
  89. package/docs/examples/databases/get-database-usage.md +3 -0
  90. package/docs/examples/databases/get-document.md +5 -0
  91. package/docs/examples/databases/get-index.md +4 -0
  92. package/docs/examples/databases/get-usage.md +2 -0
  93. package/docs/examples/databases/get.md +2 -0
  94. package/docs/examples/databases/increment-document-attribute.md +7 -0
  95. package/docs/examples/databases/list-attributes.md +4 -0
  96. package/docs/examples/databases/list-collection-logs.md +4 -0
  97. package/docs/examples/databases/list-collections.md +4 -0
  98. package/docs/examples/databases/list-document-logs.md +5 -0
  99. package/docs/examples/databases/list-documents.md +4 -0
  100. package/docs/examples/databases/list-indexes.md +4 -0
  101. package/docs/examples/databases/list-logs.md +3 -0
  102. package/docs/examples/databases/list.md +3 -0
  103. package/docs/examples/databases/update-boolean-attribute.md +7 -0
  104. package/docs/examples/databases/update-collection.md +7 -0
  105. package/docs/examples/databases/update-datetime-attribute.md +7 -0
  106. package/docs/examples/databases/update-document.md +6 -0
  107. package/docs/examples/databases/update-documents.md +5 -0
  108. package/docs/examples/databases/update-email-attribute.md +7 -0
  109. package/docs/examples/databases/update-enum-attribute.md +8 -0
  110. package/docs/examples/databases/update-float-attribute.md +9 -0
  111. package/docs/examples/databases/update-integer-attribute.md +9 -0
  112. package/docs/examples/databases/update-ip-attribute.md +7 -0
  113. package/docs/examples/databases/update-relationship-attribute.md +6 -0
  114. package/docs/examples/databases/update-string-attribute.md +8 -0
  115. package/docs/examples/databases/update-url-attribute.md +7 -0
  116. package/docs/examples/databases/update.md +4 -0
  117. package/docs/examples/databases/upsert-document.md +6 -0
  118. package/docs/examples/databases/upsert-documents.md +4 -0
  119. package/docs/examples/functions/create-deployment.md +6 -0
  120. package/docs/examples/functions/create-duplicate-deployment.md +4 -0
  121. package/docs/examples/functions/create-execution.md +8 -0
  122. package/docs/examples/functions/create-template-deployment.md +7 -0
  123. package/docs/examples/functions/create-variable.md +5 -0
  124. package/docs/examples/functions/create-vcs-deployment.md +5 -0
  125. package/docs/examples/functions/create.md +19 -0
  126. package/docs/examples/functions/delete-deployment.md +3 -0
  127. package/docs/examples/functions/delete-execution.md +3 -0
  128. package/docs/examples/functions/delete-variable.md +3 -0
  129. package/docs/examples/functions/delete.md +2 -0
  130. package/docs/examples/functions/get-deployment-download.md +4 -0
  131. package/docs/examples/functions/get-deployment.md +3 -0
  132. package/docs/examples/functions/get-execution.md +3 -0
  133. package/docs/examples/functions/get-template.md +2 -0
  134. package/docs/examples/functions/get-usage.md +3 -0
  135. package/docs/examples/functions/get-variable.md +3 -0
  136. package/docs/examples/functions/get.md +2 -0
  137. package/docs/examples/functions/list-deployments.md +4 -0
  138. package/docs/examples/functions/list-executions.md +3 -0
  139. package/docs/examples/functions/list-runtimes.md +1 -0
  140. package/docs/examples/functions/list-specifications.md +1 -0
  141. package/docs/examples/functions/list-templates.md +5 -0
  142. package/docs/examples/functions/list-usage.md +2 -0
  143. package/docs/examples/functions/list-variables.md +2 -0
  144. package/docs/examples/functions/list.md +3 -0
  145. package/docs/examples/functions/update-deployment-status.md +3 -0
  146. package/docs/examples/functions/update-function-deployment.md +3 -0
  147. package/docs/examples/functions/update-variable.md +6 -0
  148. package/docs/examples/functions/update.md +19 -0
  149. package/docs/examples/graphql/mutation.md +2 -0
  150. package/docs/examples/graphql/query.md +2 -0
  151. package/docs/examples/health/get-antivirus.md +1 -0
  152. package/docs/examples/health/get-cache.md +1 -0
  153. package/docs/examples/health/get-certificate.md +2 -0
  154. package/docs/examples/health/get-d-b.md +1 -0
  155. package/docs/examples/health/get-failed-jobs.md +3 -0
  156. package/docs/examples/health/get-pub-sub.md +1 -0
  157. package/docs/examples/health/get-queue-builds.md +2 -0
  158. package/docs/examples/health/get-queue-certificates.md +2 -0
  159. package/docs/examples/health/get-queue-databases.md +3 -0
  160. package/docs/examples/health/get-queue-deletes.md +2 -0
  161. package/docs/examples/health/get-queue-functions.md +2 -0
  162. package/docs/examples/health/get-queue-logs.md +2 -0
  163. package/docs/examples/health/get-queue-mails.md +2 -0
  164. package/docs/examples/health/get-queue-messaging.md +2 -0
  165. package/docs/examples/health/get-queue-migrations.md +2 -0
  166. package/docs/examples/health/get-queue-stats-resources.md +2 -0
  167. package/docs/examples/health/get-queue-usage.md +2 -0
  168. package/docs/examples/health/get-queue-webhooks.md +2 -0
  169. package/docs/examples/health/get-storage-local.md +1 -0
  170. package/docs/examples/health/get-storage.md +1 -0
  171. package/docs/examples/health/get-time.md +1 -0
  172. package/docs/examples/health/get.md +1 -0
  173. package/docs/examples/locale/get.md +1 -0
  174. package/docs/examples/locale/list-codes.md +1 -0
  175. package/docs/examples/locale/list-continents.md +1 -0
  176. package/docs/examples/locale/list-countries-e-u.md +1 -0
  177. package/docs/examples/locale/list-countries-phones.md +1 -0
  178. package/docs/examples/locale/list-countries.md +1 -0
  179. package/docs/examples/locale/list-currencies.md +1 -0
  180. package/docs/examples/locale/list-languages.md +1 -0
  181. package/docs/examples/messaging/create-apns-provider.md +9 -0
  182. package/docs/examples/messaging/create-email.md +13 -0
  183. package/docs/examples/messaging/create-fcm-provider.md +5 -0
  184. package/docs/examples/messaging/create-mailgun-provider.md +11 -0
  185. package/docs/examples/messaging/create-msg91provider.md +7 -0
  186. package/docs/examples/messaging/create-push.md +20 -0
  187. package/docs/examples/messaging/create-sendgrid-provider.md +9 -0
  188. package/docs/examples/messaging/create-sms.md +8 -0
  189. package/docs/examples/messaging/create-smtp-provider.md +15 -0
  190. package/docs/examples/messaging/create-subscriber.md +4 -0
  191. package/docs/examples/messaging/create-telesign-provider.md +7 -0
  192. package/docs/examples/messaging/create-textmagic-provider.md +7 -0
  193. package/docs/examples/messaging/create-topic.md +4 -0
  194. package/docs/examples/messaging/create-twilio-provider.md +7 -0
  195. package/docs/examples/messaging/create-vonage-provider.md +7 -0
  196. package/docs/examples/messaging/delete-provider.md +2 -0
  197. package/docs/examples/messaging/delete-subscriber.md +3 -0
  198. package/docs/examples/messaging/delete-topic.md +2 -0
  199. package/docs/examples/messaging/delete.md +2 -0
  200. package/docs/examples/messaging/get-message.md +2 -0
  201. package/docs/examples/messaging/get-provider.md +2 -0
  202. package/docs/examples/messaging/get-subscriber.md +3 -0
  203. package/docs/examples/messaging/get-topic.md +2 -0
  204. package/docs/examples/messaging/list-message-logs.md +3 -0
  205. package/docs/examples/messaging/list-messages.md +3 -0
  206. package/docs/examples/messaging/list-provider-logs.md +3 -0
  207. package/docs/examples/messaging/list-providers.md +3 -0
  208. package/docs/examples/messaging/list-subscriber-logs.md +3 -0
  209. package/docs/examples/messaging/list-subscribers.md +4 -0
  210. package/docs/examples/messaging/list-targets.md +3 -0
  211. package/docs/examples/messaging/list-topic-logs.md +3 -0
  212. package/docs/examples/messaging/list-topics.md +3 -0
  213. package/docs/examples/messaging/update-apns-provider.md +9 -0
  214. package/docs/examples/messaging/update-email.md +13 -0
  215. package/docs/examples/messaging/update-fcm-provider.md +5 -0
  216. package/docs/examples/messaging/update-mailgun-provider.md +11 -0
  217. package/docs/examples/messaging/update-msg91provider.md +7 -0
  218. package/docs/examples/messaging/update-push.md +20 -0
  219. package/docs/examples/messaging/update-sendgrid-provider.md +9 -0
  220. package/docs/examples/messaging/update-sms.md +8 -0
  221. package/docs/examples/messaging/update-smtp-provider.md +15 -0
  222. package/docs/examples/messaging/update-telesign-provider.md +7 -0
  223. package/docs/examples/messaging/update-textmagic-provider.md +7 -0
  224. package/docs/examples/messaging/update-topic.md +4 -0
  225. package/docs/examples/messaging/update-twilio-provider.md +7 -0
  226. package/docs/examples/messaging/update-vonage-provider.md +7 -0
  227. package/docs/examples/migrations/create-appwrite-migration.md +5 -0
  228. package/docs/examples/migrations/create-csv-migration.md +4 -0
  229. package/docs/examples/migrations/create-firebase-migration.md +3 -0
  230. package/docs/examples/migrations/create-n-host-migration.md +9 -0
  231. package/docs/examples/migrations/create-supabase-migration.md +8 -0
  232. package/docs/examples/migrations/delete.md +2 -0
  233. package/docs/examples/migrations/get-appwrite-report.md +5 -0
  234. package/docs/examples/migrations/get-firebase-report.md +3 -0
  235. package/docs/examples/migrations/get-n-host-report.md +9 -0
  236. package/docs/examples/migrations/get-supabase-report.md +8 -0
  237. package/docs/examples/migrations/get.md +2 -0
  238. package/docs/examples/migrations/list.md +3 -0
  239. package/docs/examples/migrations/retry.md +2 -0
  240. package/docs/examples/project/create-variable.md +4 -0
  241. package/docs/examples/project/delete-variable.md +2 -0
  242. package/docs/examples/project/get-usage.md +4 -0
  243. package/docs/examples/project/get-variable.md +2 -0
  244. package/docs/examples/project/list-variables.md +1 -0
  245. package/docs/examples/project/update-variable.md +5 -0
  246. package/docs/examples/projects/create-dev-key.md +4 -0
  247. package/docs/examples/projects/create-j-w-t.md +4 -0
  248. package/docs/examples/projects/create-key.md +5 -0
  249. package/docs/examples/projects/create-platform.md +7 -0
  250. package/docs/examples/projects/create-smtp-test.md +11 -0
  251. package/docs/examples/projects/create-webhook.md +9 -0
  252. package/docs/examples/projects/create.md +14 -0
  253. package/docs/examples/projects/delete-dev-key.md +3 -0
  254. package/docs/examples/projects/delete-email-template.md +4 -0
  255. package/docs/examples/projects/delete-key.md +3 -0
  256. package/docs/examples/projects/delete-platform.md +3 -0
  257. package/docs/examples/projects/delete-sms-template.md +4 -0
  258. package/docs/examples/projects/delete-webhook.md +3 -0
  259. package/docs/examples/projects/delete.md +2 -0
  260. package/docs/examples/projects/get-dev-key.md +3 -0
  261. package/docs/examples/projects/get-email-template.md +4 -0
  262. package/docs/examples/projects/get-key.md +3 -0
  263. package/docs/examples/projects/get-platform.md +3 -0
  264. package/docs/examples/projects/get-sms-template.md +4 -0
  265. package/docs/examples/projects/get-webhook.md +3 -0
  266. package/docs/examples/projects/get.md +2 -0
  267. package/docs/examples/projects/list-dev-keys.md +3 -0
  268. package/docs/examples/projects/list-keys.md +2 -0
  269. package/docs/examples/projects/list-platforms.md +2 -0
  270. package/docs/examples/projects/list-webhooks.md +2 -0
  271. package/docs/examples/projects/list.md +3 -0
  272. package/docs/examples/projects/update-api-status-all.md +3 -0
  273. package/docs/examples/projects/update-api-status.md +4 -0
  274. package/docs/examples/projects/update-auth-duration.md +3 -0
  275. package/docs/examples/projects/update-auth-limit.md +3 -0
  276. package/docs/examples/projects/update-auth-password-dictionary.md +3 -0
  277. package/docs/examples/projects/update-auth-password-history.md +3 -0
  278. package/docs/examples/projects/update-auth-sessions-limit.md +3 -0
  279. package/docs/examples/projects/update-auth-status.md +4 -0
  280. package/docs/examples/projects/update-dev-key.md +5 -0
  281. package/docs/examples/projects/update-email-template.md +9 -0
  282. package/docs/examples/projects/update-key.md +6 -0
  283. package/docs/examples/projects/update-memberships-privacy.md +5 -0
  284. package/docs/examples/projects/update-mock-numbers.md +3 -0
  285. package/docs/examples/projects/update-o-auth2.md +6 -0
  286. package/docs/examples/projects/update-personal-data-check.md +3 -0
  287. package/docs/examples/projects/update-platform.md +7 -0
  288. package/docs/examples/projects/update-service-status-all.md +3 -0
  289. package/docs/examples/projects/update-service-status.md +4 -0
  290. package/docs/examples/projects/update-session-alerts.md +3 -0
  291. package/docs/examples/projects/update-sms-template.md +5 -0
  292. package/docs/examples/projects/update-smtp.md +11 -0
  293. package/docs/examples/projects/update-team.md +3 -0
  294. package/docs/examples/projects/update-webhook-signature.md +3 -0
  295. package/docs/examples/projects/update-webhook.md +10 -0
  296. package/docs/examples/projects/update.md +12 -0
  297. package/docs/examples/proxy/create-a-p-i-rule.md +2 -0
  298. package/docs/examples/proxy/create-function-rule.md +4 -0
  299. package/docs/examples/proxy/create-redirect-rule.md +6 -0
  300. package/docs/examples/proxy/create-site-rule.md +4 -0
  301. package/docs/examples/proxy/delete-rule.md +2 -0
  302. package/docs/examples/proxy/get-rule.md +2 -0
  303. package/docs/examples/proxy/list-rules.md +3 -0
  304. package/docs/examples/proxy/update-rule-verification.md +2 -0
  305. package/docs/examples/sites/create-deployment.md +7 -0
  306. package/docs/examples/sites/create-duplicate-deployment.md +3 -0
  307. package/docs/examples/sites/create-template-deployment.md +7 -0
  308. package/docs/examples/sites/create-variable.md +5 -0
  309. package/docs/examples/sites/create-vcs-deployment.md +5 -0
  310. package/docs/examples/sites/create.md +19 -0
  311. package/docs/examples/sites/delete-deployment.md +3 -0
  312. package/docs/examples/sites/delete-log.md +3 -0
  313. package/docs/examples/sites/delete-variable.md +3 -0
  314. package/docs/examples/sites/delete.md +2 -0
  315. package/docs/examples/sites/get-deployment-download.md +4 -0
  316. package/docs/examples/sites/get-deployment.md +3 -0
  317. package/docs/examples/sites/get-log.md +3 -0
  318. package/docs/examples/sites/get-template.md +2 -0
  319. package/docs/examples/sites/get-usage.md +3 -0
  320. package/docs/examples/sites/get-variable.md +3 -0
  321. package/docs/examples/sites/get.md +2 -0
  322. package/docs/examples/sites/list-deployments.md +4 -0
  323. package/docs/examples/sites/list-frameworks.md +1 -0
  324. package/docs/examples/sites/list-logs.md +3 -0
  325. package/docs/examples/sites/list-specifications.md +1 -0
  326. package/docs/examples/sites/list-templates.md +5 -0
  327. package/docs/examples/sites/list-usage.md +2 -0
  328. package/docs/examples/sites/list-variables.md +2 -0
  329. package/docs/examples/sites/list.md +3 -0
  330. package/docs/examples/sites/update-deployment-status.md +3 -0
  331. package/docs/examples/sites/update-site-deployment.md +3 -0
  332. package/docs/examples/sites/update-variable.md +6 -0
  333. package/docs/examples/sites/update.md +19 -0
  334. package/docs/examples/storage/create-bucket.md +11 -0
  335. package/docs/examples/storage/create-file.md +5 -0
  336. package/docs/examples/storage/delete-bucket.md +2 -0
  337. package/docs/examples/storage/delete-file.md +3 -0
  338. package/docs/examples/storage/get-bucket-usage.md +3 -0
  339. package/docs/examples/storage/get-bucket.md +2 -0
  340. package/docs/examples/storage/get-file-download.md +4 -0
  341. package/docs/examples/storage/get-file-preview.md +15 -0
  342. package/docs/examples/storage/get-file-view.md +4 -0
  343. package/docs/examples/storage/get-file.md +3 -0
  344. package/docs/examples/storage/get-usage.md +2 -0
  345. package/docs/examples/storage/list-buckets.md +3 -0
  346. package/docs/examples/storage/list-files.md +4 -0
  347. package/docs/examples/storage/update-bucket.md +11 -0
  348. package/docs/examples/storage/update-file.md +5 -0
  349. package/docs/examples/teams/create-membership.md +8 -0
  350. package/docs/examples/teams/create.md +4 -0
  351. package/docs/examples/teams/delete-membership.md +3 -0
  352. package/docs/examples/teams/delete.md +2 -0
  353. package/docs/examples/teams/get-membership.md +3 -0
  354. package/docs/examples/teams/get-prefs.md +2 -0
  355. package/docs/examples/teams/get.md +2 -0
  356. package/docs/examples/teams/list-logs.md +3 -0
  357. package/docs/examples/teams/list-memberships.md +4 -0
  358. package/docs/examples/teams/list.md +3 -0
  359. package/docs/examples/teams/update-membership-status.md +5 -0
  360. package/docs/examples/teams/update-membership.md +4 -0
  361. package/docs/examples/teams/update-name.md +3 -0
  362. package/docs/examples/teams/update-prefs.md +3 -0
  363. package/docs/examples/tokens/create-file-token.md +4 -0
  364. package/docs/examples/tokens/delete.md +2 -0
  365. package/docs/examples/tokens/get.md +2 -0
  366. package/docs/examples/tokens/list.md +4 -0
  367. package/docs/examples/tokens/update.md +3 -0
  368. package/docs/examples/users/create-argon2user.md +5 -0
  369. package/docs/examples/users/create-bcrypt-user.md +5 -0
  370. package/docs/examples/users/create-j-w-t.md +4 -0
  371. package/docs/examples/users/create-m-d5user.md +5 -0
  372. package/docs/examples/users/create-mfa-recovery-codes.md +2 -0
  373. package/docs/examples/users/create-p-h-pass-user.md +5 -0
  374. package/docs/examples/users/create-s-h-a-user.md +6 -0
  375. package/docs/examples/users/create-scrypt-modified-user.md +8 -0
  376. package/docs/examples/users/create-scrypt-user.md +10 -0
  377. package/docs/examples/users/create-session.md +2 -0
  378. package/docs/examples/users/create-target.md +7 -0
  379. package/docs/examples/users/create-token.md +4 -0
  380. package/docs/examples/users/create.md +6 -0
  381. package/docs/examples/users/delete-identity.md +2 -0
  382. package/docs/examples/users/delete-mfa-authenticator.md +3 -0
  383. package/docs/examples/users/delete-session.md +3 -0
  384. package/docs/examples/users/delete-sessions.md +2 -0
  385. package/docs/examples/users/delete-target.md +3 -0
  386. package/docs/examples/users/delete.md +2 -0
  387. package/docs/examples/users/get-mfa-recovery-codes.md +2 -0
  388. package/docs/examples/users/get-prefs.md +2 -0
  389. package/docs/examples/users/get-target.md +3 -0
  390. package/docs/examples/users/get-usage.md +2 -0
  391. package/docs/examples/users/get.md +2 -0
  392. package/docs/examples/users/list-identities.md +3 -0
  393. package/docs/examples/users/list-logs.md +3 -0
  394. package/docs/examples/users/list-memberships.md +4 -0
  395. package/docs/examples/users/list-mfa-factors.md +2 -0
  396. package/docs/examples/users/list-sessions.md +2 -0
  397. package/docs/examples/users/list-targets.md +3 -0
  398. package/docs/examples/users/list.md +3 -0
  399. package/docs/examples/users/update-email-verification.md +3 -0
  400. package/docs/examples/users/update-email.md +3 -0
  401. package/docs/examples/users/update-labels.md +3 -0
  402. package/docs/examples/users/update-mfa-recovery-codes.md +2 -0
  403. package/docs/examples/users/update-mfa.md +3 -0
  404. package/docs/examples/users/update-name.md +3 -0
  405. package/docs/examples/users/update-password.md +3 -0
  406. package/docs/examples/users/update-phone-verification.md +3 -0
  407. package/docs/examples/users/update-phone.md +3 -0
  408. package/docs/examples/users/update-prefs.md +3 -0
  409. package/docs/examples/users/update-status.md +3 -0
  410. package/docs/examples/users/update-target.md +6 -0
  411. package/docs/examples/vcs/create-repository-detection.md +5 -0
  412. package/docs/examples/vcs/create-repository.md +4 -0
  413. package/docs/examples/vcs/delete-installation.md +2 -0
  414. package/docs/examples/vcs/get-installation.md +2 -0
  415. package/docs/examples/vcs/get-repository-contents.md +5 -0
  416. package/docs/examples/vcs/get-repository.md +3 -0
  417. package/docs/examples/vcs/list-installations.md +3 -0
  418. package/docs/examples/vcs/list-repositories.md +4 -0
  419. package/docs/examples/vcs/list-repository-branches.md +3 -0
  420. package/docs/examples/vcs/update-external-deployments.md +4 -0
  421. package/functions/Starter function/.prettierrc.json +6 -0
  422. package/functions/Starter function/README.md +48 -0
  423. package/functions/Starter function/package-lock.json +60 -0
  424. package/functions/Starter function/package.json +16 -0
  425. package/functions/Starter function/src/main.js +35 -0
  426. package/generate/appwrite.d.ts +18 -0
  427. package/index.js +109 -0
  428. package/install.ps1 +98 -0
  429. package/install.sh +157 -0
  430. package/lib/client.js +259 -0
  431. package/lib/commands/account.js +2074 -0
  432. package/lib/commands/avatars.js +491 -0
  433. package/lib/commands/console.js +129 -0
  434. package/lib/commands/databases.js +2972 -0
  435. package/lib/commands/functions.js +1737 -0
  436. package/lib/commands/generic.js +328 -0
  437. package/lib/commands/graphql.js +128 -0
  438. package/lib/commands/health.js +891 -0
  439. package/lib/commands/init.js +566 -0
  440. package/lib/commands/locale.js +324 -0
  441. package/lib/commands/messaging.js +2970 -0
  442. package/lib/commands/migrations.js +751 -0
  443. package/lib/commands/organizations.js +48 -0
  444. package/lib/commands/project.js +308 -0
  445. package/lib/commands/projects.js +2615 -0
  446. package/lib/commands/proxy.js +406 -0
  447. package/lib/commands/pull.js +474 -0
  448. package/lib/commands/push.js +2117 -0
  449. package/lib/commands/run.js +330 -0
  450. package/lib/commands/sites.js +1663 -0
  451. package/lib/commands/storage.js +990 -0
  452. package/lib/commands/teams.js +682 -0
  453. package/lib/commands/tokens.js +261 -0
  454. package/lib/commands/types.js +156 -0
  455. package/lib/commands/users.js +2035 -0
  456. package/lib/commands/vcs.js +484 -0
  457. package/lib/config.js +705 -0
  458. package/lib/emulation/docker.js +264 -0
  459. package/lib/emulation/utils.js +186 -0
  460. package/lib/exception.js +9 -0
  461. package/lib/id.js +30 -0
  462. package/lib/paginate.js +52 -0
  463. package/lib/parser.js +246 -0
  464. package/lib/questions.js +1006 -0
  465. package/lib/sdks.js +60 -0
  466. package/lib/spinner.js +104 -0
  467. package/lib/type-generation/attribute.js +16 -0
  468. package/lib/type-generation/languages/dart.js +196 -0
  469. package/lib/type-generation/languages/java.js +130 -0
  470. package/lib/type-generation/languages/javascript.js +102 -0
  471. package/lib/type-generation/languages/kotlin.js +84 -0
  472. package/lib/type-generation/languages/language.js +125 -0
  473. package/lib/type-generation/languages/php.js +109 -0
  474. package/lib/type-generation/languages/swift.js +169 -0
  475. package/lib/type-generation/languages/typescript.js +102 -0
  476. package/lib/utils.js +289 -0
  477. package/lib/validations.js +17 -0
  478. package/package.json +50 -0
  479. package/scoop/appwrite.json +30 -0
  480. package/sites/JavaScript starter/.env.example +3 -0
  481. package/sites/JavaScript starter/LICENSE +21 -0
  482. package/sites/JavaScript starter/images/appwrite.svg +8 -0
  483. package/sites/JavaScript starter/images/javascript.svg +5 -0
  484. package/sites/JavaScript starter/index.html +250 -0
  485. package/sites/JavaScript starter/lib/appwrite.js +10 -0
  486. package/sites/JavaScript starter/package-lock.json +1431 -0
  487. package/sites/JavaScript starter/package.json +21 -0
  488. package/sites/JavaScript starter/readme.md +26 -0
  489. package/sites/JavaScript starter/src/javascript.svg +1 -0
  490. package/sites/JavaScript starter/style/app.css +20 -0
  491. package/sites/JavaScript starter/vite.config.js +7 -0
@@ -0,0 +1,2972 @@
1
+ const fs = require('fs');
2
+ const pathLib = require('path');
3
+ const tar = require("tar");
4
+ const ignore = require("ignore");
5
+ const { promisify } = require('util');
6
+ const libClient = require('../client.js');
7
+ const { getAllFiles, showConsoleLink } = require('../utils.js');
8
+ const { Command } = require('commander');
9
+ const { sdkForProject, sdkForConsole } = require('../sdks')
10
+ const { parse, actionRunner, parseInteger, parseBool, commandDescriptions, success, log } = require('../parser')
11
+ const { localConfig, globalConfig } = require("../config");
12
+ const { File } = require('undici');
13
+ const { ReadableStream } = require('stream/web');
14
+
15
+ /**
16
+ * @param {fs.ReadStream} readStream
17
+ * @returns {ReadableStream}
18
+ */
19
+ function convertReadStreamToReadableStream(readStream) {
20
+ return new ReadableStream({
21
+ start(controller) {
22
+ readStream.on("data", (chunk) => {
23
+ controller.enqueue(chunk);
24
+ });
25
+ readStream.on("end", () => {
26
+ controller.close();
27
+ });
28
+ readStream.on("error", (err) => {
29
+ controller.error(err);
30
+ });
31
+ },
32
+ cancel() {
33
+ readStream.destroy();
34
+ },
35
+ });
36
+ }
37
+
38
+ const databases = new Command("databases").description(commandDescriptions['databases'] ?? '').configureHelp({
39
+ helpWidth: process.stdout.columns || 80
40
+ })
41
+
42
+ /**
43
+ * @typedef {Object} DatabasesListRequestParams
44
+ * @property {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. You may filter on the following attributes: name
45
+ * @property {string} search Search term to filter your list results. Max length: 256 chars.
46
+ * @property {boolean} overrideForCli
47
+ * @property {boolean} parseOutput
48
+ * @property {libClient | undefined} sdk
49
+ */
50
+
51
+ /**
52
+ * @param {DatabasesListRequestParams} params
53
+ */
54
+ const databasesList = async ({queries,search,parseOutput = true, overrideForCli = false, sdk = undefined, console}) => {
55
+ let client = !sdk ? await sdkForProject() :
56
+ sdk;
57
+ let apiPath = '/databases';
58
+ let payload = {};
59
+ if (typeof queries !== 'undefined') {
60
+ payload['queries'] = queries;
61
+ }
62
+ if (typeof search !== 'undefined') {
63
+ payload['search'] = search;
64
+ }
65
+
66
+ let response = undefined;
67
+
68
+ response = await client.call('get', apiPath, {
69
+ }, payload);
70
+
71
+ if (parseOutput) {
72
+ if(console) {
73
+ showConsoleLink('databases', 'list');
74
+ } else {
75
+ parse(response)
76
+ }
77
+ }
78
+
79
+ return response;
80
+
81
+ }
82
+
83
+ /**
84
+ * @typedef {Object} DatabasesCreateRequestParams
85
+ * @property {string} databaseId 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.
86
+ * @property {string} name Database name. Max length: 128 chars.
87
+ * @property {boolean} enabled Is the database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled.
88
+ * @property {boolean} overrideForCli
89
+ * @property {boolean} parseOutput
90
+ * @property {libClient | undefined} sdk
91
+ */
92
+
93
+ /**
94
+ * @param {DatabasesCreateRequestParams} params
95
+ */
96
+ const databasesCreate = async ({databaseId,name,enabled,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
97
+ let client = !sdk ? await sdkForProject() :
98
+ sdk;
99
+ let apiPath = '/databases';
100
+ let payload = {};
101
+ if (typeof databaseId !== 'undefined') {
102
+ payload['databaseId'] = databaseId;
103
+ }
104
+ if (typeof name !== 'undefined') {
105
+ payload['name'] = name;
106
+ }
107
+ if (typeof enabled !== 'undefined') {
108
+ payload['enabled'] = enabled;
109
+ }
110
+
111
+ let response = undefined;
112
+
113
+ response = await client.call('post', apiPath, {
114
+ 'content-type': 'application/json',
115
+ }, payload);
116
+
117
+ if (parseOutput) {
118
+ parse(response)
119
+ }
120
+
121
+ return response;
122
+
123
+ }
124
+
125
+ /**
126
+ * @typedef {Object} DatabasesGetUsageRequestParams
127
+ * @property {DatabaseUsageRange} range 'Date range.
128
+ * @property {boolean} overrideForCli
129
+ * @property {boolean} parseOutput
130
+ * @property {libClient | undefined} sdk
131
+ */
132
+
133
+ /**
134
+ * @param {DatabasesGetUsageRequestParams} params
135
+ */
136
+ const databasesGetUsage = async ({range,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
137
+ let client = !sdk ? await sdkForProject() :
138
+ sdk;
139
+ let apiPath = '/databases/usage';
140
+ let payload = {};
141
+ if (typeof range !== 'undefined') {
142
+ payload['range'] = range;
143
+ }
144
+
145
+ let response = undefined;
146
+
147
+ response = await client.call('get', apiPath, {
148
+ }, payload);
149
+
150
+ if (parseOutput) {
151
+ parse(response)
152
+ }
153
+
154
+ return response;
155
+
156
+ }
157
+
158
+ /**
159
+ * @typedef {Object} DatabasesGetRequestParams
160
+ * @property {string} databaseId Database ID.
161
+ * @property {boolean} overrideForCli
162
+ * @property {boolean} parseOutput
163
+ * @property {libClient | undefined} sdk
164
+ */
165
+
166
+ /**
167
+ * @param {DatabasesGetRequestParams} params
168
+ */
169
+ const databasesGet = async ({databaseId,parseOutput = true, overrideForCli = false, sdk = undefined, console}) => {
170
+ let client = !sdk ? await sdkForProject() :
171
+ sdk;
172
+ let apiPath = '/databases/{databaseId}'.replace('{databaseId}', databaseId);
173
+ let payload = {};
174
+
175
+ let response = undefined;
176
+
177
+ response = await client.call('get', apiPath, {
178
+ }, payload);
179
+
180
+ if (parseOutput) {
181
+ if(console) {
182
+ showConsoleLink('databases', 'get', databaseId);
183
+ } else {
184
+ parse(response)
185
+ }
186
+ }
187
+
188
+ return response;
189
+
190
+ }
191
+
192
+ /**
193
+ * @typedef {Object} DatabasesUpdateRequestParams
194
+ * @property {string} databaseId Database ID.
195
+ * @property {string} name Database name. Max length: 128 chars.
196
+ * @property {boolean} enabled Is database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled.
197
+ * @property {boolean} overrideForCli
198
+ * @property {boolean} parseOutput
199
+ * @property {libClient | undefined} sdk
200
+ */
201
+
202
+ /**
203
+ * @param {DatabasesUpdateRequestParams} params
204
+ */
205
+ const databasesUpdate = async ({databaseId,name,enabled,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
206
+ let client = !sdk ? await sdkForProject() :
207
+ sdk;
208
+ let apiPath = '/databases/{databaseId}'.replace('{databaseId}', databaseId);
209
+ let payload = {};
210
+ if (typeof name !== 'undefined') {
211
+ payload['name'] = name;
212
+ }
213
+ if (typeof enabled !== 'undefined') {
214
+ payload['enabled'] = enabled;
215
+ }
216
+
217
+ let response = undefined;
218
+
219
+ response = await client.call('put', apiPath, {
220
+ 'content-type': 'application/json',
221
+ }, payload);
222
+
223
+ if (parseOutput) {
224
+ parse(response)
225
+ }
226
+
227
+ return response;
228
+
229
+ }
230
+
231
+ /**
232
+ * @typedef {Object} DatabasesDeleteRequestParams
233
+ * @property {string} databaseId Database ID.
234
+ * @property {boolean} overrideForCli
235
+ * @property {boolean} parseOutput
236
+ * @property {libClient | undefined} sdk
237
+ */
238
+
239
+ /**
240
+ * @param {DatabasesDeleteRequestParams} params
241
+ */
242
+ const databasesDelete = async ({databaseId,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
243
+ let client = !sdk ? await sdkForProject() :
244
+ sdk;
245
+ let apiPath = '/databases/{databaseId}'.replace('{databaseId}', databaseId);
246
+ let payload = {};
247
+
248
+ let response = undefined;
249
+
250
+ response = await client.call('delete', apiPath, {
251
+ 'content-type': 'application/json',
252
+ }, payload);
253
+
254
+ if (parseOutput) {
255
+ parse(response)
256
+ }
257
+
258
+ return response;
259
+
260
+ }
261
+
262
+ /**
263
+ * @typedef {Object} DatabasesListCollectionsRequestParams
264
+ * @property {string} databaseId Database ID.
265
+ * @property {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. You may filter on the following attributes: name, enabled, documentSecurity
266
+ * @property {string} search Search term to filter your list results. Max length: 256 chars.
267
+ * @property {boolean} overrideForCli
268
+ * @property {boolean} parseOutput
269
+ * @property {libClient | undefined} sdk
270
+ */
271
+
272
+ /**
273
+ * @param {DatabasesListCollectionsRequestParams} params
274
+ */
275
+ const databasesListCollections = async ({databaseId,queries,search,parseOutput = true, overrideForCli = false, sdk = undefined, console}) => {
276
+ let client = !sdk ? await sdkForProject() :
277
+ sdk;
278
+ let apiPath = '/databases/{databaseId}/collections'.replace('{databaseId}', databaseId);
279
+ let payload = {};
280
+ if (typeof queries !== 'undefined') {
281
+ payload['queries'] = queries;
282
+ }
283
+ if (typeof search !== 'undefined') {
284
+ payload['search'] = search;
285
+ }
286
+
287
+ let response = undefined;
288
+
289
+ response = await client.call('get', apiPath, {
290
+ }, payload);
291
+
292
+ if (parseOutput) {
293
+ if(console) {
294
+ showConsoleLink('databases', 'listCollections', databaseId);
295
+ } else {
296
+ parse(response)
297
+ }
298
+ }
299
+
300
+ return response;
301
+
302
+ }
303
+
304
+ /**
305
+ * @typedef {Object} DatabasesCreateCollectionRequestParams
306
+ * @property {string} databaseId Database ID.
307
+ * @property {string} collectionId 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.
308
+ * @property {string} name Collection name. Max length: 128 chars.
309
+ * @property {string[]} permissions An array of permissions strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).
310
+ * @property {boolean} documentSecurity Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions).
311
+ * @property {boolean} enabled Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled.
312
+ * @property {boolean} overrideForCli
313
+ * @property {boolean} parseOutput
314
+ * @property {libClient | undefined} sdk
315
+ */
316
+
317
+ /**
318
+ * @param {DatabasesCreateCollectionRequestParams} params
319
+ */
320
+ const databasesCreateCollection = async ({databaseId,collectionId,name,permissions,documentSecurity,enabled,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
321
+ let client = !sdk ? await sdkForProject() :
322
+ sdk;
323
+ let apiPath = '/databases/{databaseId}/collections'.replace('{databaseId}', databaseId);
324
+ let payload = {};
325
+ if (typeof collectionId !== 'undefined') {
326
+ payload['collectionId'] = collectionId;
327
+ }
328
+ if (typeof name !== 'undefined') {
329
+ payload['name'] = name;
330
+ }
331
+ permissions = permissions === true ? [] : permissions;
332
+ if (typeof permissions !== 'undefined') {
333
+ payload['permissions'] = permissions;
334
+ }
335
+ if (typeof documentSecurity !== 'undefined') {
336
+ payload['documentSecurity'] = documentSecurity;
337
+ }
338
+ if (typeof enabled !== 'undefined') {
339
+ payload['enabled'] = enabled;
340
+ }
341
+
342
+ let response = undefined;
343
+
344
+ response = await client.call('post', apiPath, {
345
+ 'content-type': 'application/json',
346
+ }, payload);
347
+
348
+ if (parseOutput) {
349
+ parse(response)
350
+ }
351
+
352
+ return response;
353
+
354
+ }
355
+
356
+ /**
357
+ * @typedef {Object} DatabasesGetCollectionRequestParams
358
+ * @property {string} databaseId Database ID.
359
+ * @property {string} collectionId Collection ID.
360
+ * @property {boolean} overrideForCli
361
+ * @property {boolean} parseOutput
362
+ * @property {libClient | undefined} sdk
363
+ */
364
+
365
+ /**
366
+ * @param {DatabasesGetCollectionRequestParams} params
367
+ */
368
+ const databasesGetCollection = async ({databaseId,collectionId,parseOutput = true, overrideForCli = false, sdk = undefined, console}) => {
369
+ let client = !sdk ? await sdkForProject() :
370
+ sdk;
371
+ let apiPath = '/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
372
+ let payload = {};
373
+
374
+ let response = undefined;
375
+
376
+ response = await client.call('get', apiPath, {
377
+ }, payload);
378
+
379
+ if (parseOutput) {
380
+ if(console) {
381
+ showConsoleLink('databases', 'getCollection', databaseId, collectionId);
382
+ } else {
383
+ parse(response)
384
+ }
385
+ }
386
+
387
+ return response;
388
+
389
+ }
390
+
391
+ /**
392
+ * @typedef {Object} DatabasesUpdateCollectionRequestParams
393
+ * @property {string} databaseId Database ID.
394
+ * @property {string} collectionId Collection ID.
395
+ * @property {string} name Collection name. Max length: 128 chars.
396
+ * @property {string[]} permissions An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).
397
+ * @property {boolean} documentSecurity Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions).
398
+ * @property {boolean} enabled Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled.
399
+ * @property {boolean} overrideForCli
400
+ * @property {boolean} parseOutput
401
+ * @property {libClient | undefined} sdk
402
+ */
403
+
404
+ /**
405
+ * @param {DatabasesUpdateCollectionRequestParams} params
406
+ */
407
+ const databasesUpdateCollection = async ({databaseId,collectionId,name,permissions,documentSecurity,enabled,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
408
+ let client = !sdk ? await sdkForProject() :
409
+ sdk;
410
+ let apiPath = '/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
411
+ let payload = {};
412
+ if (typeof name !== 'undefined') {
413
+ payload['name'] = name;
414
+ }
415
+ permissions = permissions === true ? [] : permissions;
416
+ if (typeof permissions !== 'undefined') {
417
+ payload['permissions'] = permissions;
418
+ }
419
+ if (typeof documentSecurity !== 'undefined') {
420
+ payload['documentSecurity'] = documentSecurity;
421
+ }
422
+ if (typeof enabled !== 'undefined') {
423
+ payload['enabled'] = enabled;
424
+ }
425
+
426
+ let response = undefined;
427
+
428
+ response = await client.call('put', apiPath, {
429
+ 'content-type': 'application/json',
430
+ }, payload);
431
+
432
+ if (parseOutput) {
433
+ parse(response)
434
+ }
435
+
436
+ return response;
437
+
438
+ }
439
+
440
+ /**
441
+ * @typedef {Object} DatabasesDeleteCollectionRequestParams
442
+ * @property {string} databaseId Database ID.
443
+ * @property {string} collectionId Collection ID.
444
+ * @property {boolean} overrideForCli
445
+ * @property {boolean} parseOutput
446
+ * @property {libClient | undefined} sdk
447
+ */
448
+
449
+ /**
450
+ * @param {DatabasesDeleteCollectionRequestParams} params
451
+ */
452
+ const databasesDeleteCollection = async ({databaseId,collectionId,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
453
+ let client = !sdk ? await sdkForProject() :
454
+ sdk;
455
+ let apiPath = '/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
456
+ let payload = {};
457
+
458
+ let response = undefined;
459
+
460
+ response = await client.call('delete', apiPath, {
461
+ 'content-type': 'application/json',
462
+ }, payload);
463
+
464
+ if (parseOutput) {
465
+ parse(response)
466
+ }
467
+
468
+ return response;
469
+
470
+ }
471
+
472
+ /**
473
+ * @typedef {Object} DatabasesListAttributesRequestParams
474
+ * @property {string} databaseId Database ID.
475
+ * @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
476
+ * @property {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. You may filter on the following attributes: key, type, size, required, array, status, error
477
+ * @property {boolean} overrideForCli
478
+ * @property {boolean} parseOutput
479
+ * @property {libClient | undefined} sdk
480
+ */
481
+
482
+ /**
483
+ * @param {DatabasesListAttributesRequestParams} params
484
+ */
485
+ const databasesListAttributes = async ({databaseId,collectionId,queries,parseOutput = true, overrideForCli = false, sdk = undefined, console}) => {
486
+ let client = !sdk ? await sdkForProject() :
487
+ sdk;
488
+ let apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
489
+ let payload = {};
490
+ if (typeof queries !== 'undefined') {
491
+ payload['queries'] = queries;
492
+ }
493
+
494
+ let response = undefined;
495
+
496
+ response = await client.call('get', apiPath, {
497
+ }, payload);
498
+
499
+ if (parseOutput) {
500
+ if(console) {
501
+ showConsoleLink('databases', 'listAttributes', databaseId, collectionId);
502
+ } else {
503
+ parse(response)
504
+ }
505
+ }
506
+
507
+ return response;
508
+
509
+ }
510
+
511
+ /**
512
+ * @typedef {Object} DatabasesCreateBooleanAttributeRequestParams
513
+ * @property {string} databaseId Database ID.
514
+ * @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
515
+ * @property {string} key Attribute Key.
516
+ * @property {boolean} required Is attribute required?
517
+ * @property {boolean} xdefault Default value for attribute when not provided. Cannot be set when attribute is required.
518
+ * @property {boolean} array Is attribute an array?
519
+ * @property {boolean} overrideForCli
520
+ * @property {boolean} parseOutput
521
+ * @property {libClient | undefined} sdk
522
+ */
523
+
524
+ /**
525
+ * @param {DatabasesCreateBooleanAttributeRequestParams} params
526
+ */
527
+ const databasesCreateBooleanAttribute = async ({databaseId,collectionId,key,required,xdefault,array,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
528
+ let client = !sdk ? await sdkForProject() :
529
+ sdk;
530
+ let apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/boolean'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
531
+ let payload = {};
532
+ if (typeof key !== 'undefined') {
533
+ payload['key'] = key;
534
+ }
535
+ if (typeof required !== 'undefined') {
536
+ payload['required'] = required;
537
+ }
538
+ if (typeof xdefault !== 'undefined') {
539
+ payload['default'] = xdefault;
540
+ }
541
+ if (typeof array !== 'undefined') {
542
+ payload['array'] = array;
543
+ }
544
+
545
+ let response = undefined;
546
+
547
+ response = await client.call('post', apiPath, {
548
+ 'content-type': 'application/json',
549
+ }, payload);
550
+
551
+ if (parseOutput) {
552
+ parse(response)
553
+ }
554
+
555
+ return response;
556
+
557
+ }
558
+
559
+ /**
560
+ * @typedef {Object} DatabasesUpdateBooleanAttributeRequestParams
561
+ * @property {string} databaseId Database ID.
562
+ * @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
563
+ * @property {string} key Attribute Key.
564
+ * @property {boolean} required Is attribute required?
565
+ * @property {boolean} xdefault Default value for attribute when not provided. Cannot be set when attribute is required.
566
+ * @property {string} newKey New attribute key.
567
+ * @property {boolean} overrideForCli
568
+ * @property {boolean} parseOutput
569
+ * @property {libClient | undefined} sdk
570
+ */
571
+
572
+ /**
573
+ * @param {DatabasesUpdateBooleanAttributeRequestParams} params
574
+ */
575
+ const databasesUpdateBooleanAttribute = async ({databaseId,collectionId,key,required,xdefault,newKey,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
576
+ let client = !sdk ? await sdkForProject() :
577
+ sdk;
578
+ let apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/boolean/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
579
+ let payload = {};
580
+ if (typeof required !== 'undefined') {
581
+ payload['required'] = required;
582
+ }
583
+ if (typeof xdefault !== 'undefined') {
584
+ payload['default'] = xdefault;
585
+ }
586
+ if (typeof newKey !== 'undefined') {
587
+ payload['newKey'] = newKey;
588
+ }
589
+
590
+ let response = undefined;
591
+
592
+ response = await client.call('patch', apiPath, {
593
+ 'content-type': 'application/json',
594
+ }, payload);
595
+
596
+ if (parseOutput) {
597
+ parse(response)
598
+ }
599
+
600
+ return response;
601
+
602
+ }
603
+
604
+ /**
605
+ * @typedef {Object} DatabasesCreateDatetimeAttributeRequestParams
606
+ * @property {string} databaseId Database ID.
607
+ * @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
608
+ * @property {string} key Attribute Key.
609
+ * @property {boolean} required Is attribute required?
610
+ * @property {string} xdefault Default value for the attribute in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Cannot be set when attribute is required.
611
+ * @property {boolean} array Is attribute an array?
612
+ * @property {boolean} overrideForCli
613
+ * @property {boolean} parseOutput
614
+ * @property {libClient | undefined} sdk
615
+ */
616
+
617
+ /**
618
+ * @param {DatabasesCreateDatetimeAttributeRequestParams} params
619
+ */
620
+ const databasesCreateDatetimeAttribute = async ({databaseId,collectionId,key,required,xdefault,array,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
621
+ let client = !sdk ? await sdkForProject() :
622
+ sdk;
623
+ let apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/datetime'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
624
+ let payload = {};
625
+ if (typeof key !== 'undefined') {
626
+ payload['key'] = key;
627
+ }
628
+ if (typeof required !== 'undefined') {
629
+ payload['required'] = required;
630
+ }
631
+ if (typeof xdefault !== 'undefined') {
632
+ payload['default'] = xdefault;
633
+ }
634
+ if (typeof array !== 'undefined') {
635
+ payload['array'] = array;
636
+ }
637
+
638
+ let response = undefined;
639
+
640
+ response = await client.call('post', apiPath, {
641
+ 'content-type': 'application/json',
642
+ }, payload);
643
+
644
+ if (parseOutput) {
645
+ parse(response)
646
+ }
647
+
648
+ return response;
649
+
650
+ }
651
+
652
+ /**
653
+ * @typedef {Object} DatabasesUpdateDatetimeAttributeRequestParams
654
+ * @property {string} databaseId Database ID.
655
+ * @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
656
+ * @property {string} key Attribute Key.
657
+ * @property {boolean} required Is attribute required?
658
+ * @property {string} xdefault Default value for attribute when not provided. Cannot be set when attribute is required.
659
+ * @property {string} newKey New attribute key.
660
+ * @property {boolean} overrideForCli
661
+ * @property {boolean} parseOutput
662
+ * @property {libClient | undefined} sdk
663
+ */
664
+
665
+ /**
666
+ * @param {DatabasesUpdateDatetimeAttributeRequestParams} params
667
+ */
668
+ const databasesUpdateDatetimeAttribute = async ({databaseId,collectionId,key,required,xdefault,newKey,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
669
+ let client = !sdk ? await sdkForProject() :
670
+ sdk;
671
+ let apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/datetime/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
672
+ let payload = {};
673
+ if (typeof required !== 'undefined') {
674
+ payload['required'] = required;
675
+ }
676
+ if (typeof xdefault !== 'undefined') {
677
+ payload['default'] = xdefault;
678
+ }
679
+ if (typeof newKey !== 'undefined') {
680
+ payload['newKey'] = newKey;
681
+ }
682
+
683
+ let response = undefined;
684
+
685
+ response = await client.call('patch', apiPath, {
686
+ 'content-type': 'application/json',
687
+ }, payload);
688
+
689
+ if (parseOutput) {
690
+ parse(response)
691
+ }
692
+
693
+ return response;
694
+
695
+ }
696
+
697
+ /**
698
+ * @typedef {Object} DatabasesCreateEmailAttributeRequestParams
699
+ * @property {string} databaseId Database ID.
700
+ * @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
701
+ * @property {string} key Attribute Key.
702
+ * @property {boolean} required Is attribute required?
703
+ * @property {string} xdefault Default value for attribute when not provided. Cannot be set when attribute is required.
704
+ * @property {boolean} array Is attribute an array?
705
+ * @property {boolean} overrideForCli
706
+ * @property {boolean} parseOutput
707
+ * @property {libClient | undefined} sdk
708
+ */
709
+
710
+ /**
711
+ * @param {DatabasesCreateEmailAttributeRequestParams} params
712
+ */
713
+ const databasesCreateEmailAttribute = async ({databaseId,collectionId,key,required,xdefault,array,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
714
+ let client = !sdk ? await sdkForProject() :
715
+ sdk;
716
+ let apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/email'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
717
+ let payload = {};
718
+ if (typeof key !== 'undefined') {
719
+ payload['key'] = key;
720
+ }
721
+ if (typeof required !== 'undefined') {
722
+ payload['required'] = required;
723
+ }
724
+ if (typeof xdefault !== 'undefined') {
725
+ payload['default'] = xdefault;
726
+ }
727
+ if (typeof array !== 'undefined') {
728
+ payload['array'] = array;
729
+ }
730
+
731
+ let response = undefined;
732
+
733
+ response = await client.call('post', apiPath, {
734
+ 'content-type': 'application/json',
735
+ }, payload);
736
+
737
+ if (parseOutput) {
738
+ parse(response)
739
+ }
740
+
741
+ return response;
742
+
743
+ }
744
+
745
+ /**
746
+ * @typedef {Object} DatabasesUpdateEmailAttributeRequestParams
747
+ * @property {string} databaseId Database ID.
748
+ * @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
749
+ * @property {string} key Attribute Key.
750
+ * @property {boolean} required Is attribute required?
751
+ * @property {string} xdefault Default value for attribute when not provided. Cannot be set when attribute is required.
752
+ * @property {string} newKey New attribute key.
753
+ * @property {boolean} overrideForCli
754
+ * @property {boolean} parseOutput
755
+ * @property {libClient | undefined} sdk
756
+ */
757
+
758
+ /**
759
+ * @param {DatabasesUpdateEmailAttributeRequestParams} params
760
+ */
761
+ const databasesUpdateEmailAttribute = async ({databaseId,collectionId,key,required,xdefault,newKey,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
762
+ let client = !sdk ? await sdkForProject() :
763
+ sdk;
764
+ let apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/email/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
765
+ let payload = {};
766
+ if (typeof required !== 'undefined') {
767
+ payload['required'] = required;
768
+ }
769
+ if (typeof xdefault !== 'undefined') {
770
+ payload['default'] = xdefault;
771
+ }
772
+ if (typeof newKey !== 'undefined') {
773
+ payload['newKey'] = newKey;
774
+ }
775
+
776
+ let response = undefined;
777
+
778
+ response = await client.call('patch', apiPath, {
779
+ 'content-type': 'application/json',
780
+ }, payload);
781
+
782
+ if (parseOutput) {
783
+ parse(response)
784
+ }
785
+
786
+ return response;
787
+
788
+ }
789
+
790
+ /**
791
+ * @typedef {Object} DatabasesCreateEnumAttributeRequestParams
792
+ * @property {string} databaseId Database ID.
793
+ * @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
794
+ * @property {string} key Attribute Key.
795
+ * @property {string[]} elements Array of elements in enumerated type. Uses length of longest element to determine size. Maximum of 100 elements are allowed, each 255 characters long.
796
+ * @property {boolean} required Is attribute required?
797
+ * @property {string} xdefault Default value for attribute when not provided. Cannot be set when attribute is required.
798
+ * @property {boolean} array Is attribute an array?
799
+ * @property {boolean} overrideForCli
800
+ * @property {boolean} parseOutput
801
+ * @property {libClient | undefined} sdk
802
+ */
803
+
804
+ /**
805
+ * @param {DatabasesCreateEnumAttributeRequestParams} params
806
+ */
807
+ const databasesCreateEnumAttribute = async ({databaseId,collectionId,key,elements,required,xdefault,array,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
808
+ let client = !sdk ? await sdkForProject() :
809
+ sdk;
810
+ let apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/enum'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
811
+ let payload = {};
812
+ if (typeof key !== 'undefined') {
813
+ payload['key'] = key;
814
+ }
815
+ elements = elements === true ? [] : elements;
816
+ if (typeof elements !== 'undefined') {
817
+ payload['elements'] = elements;
818
+ }
819
+ if (typeof required !== 'undefined') {
820
+ payload['required'] = required;
821
+ }
822
+ if (typeof xdefault !== 'undefined') {
823
+ payload['default'] = xdefault;
824
+ }
825
+ if (typeof array !== 'undefined') {
826
+ payload['array'] = array;
827
+ }
828
+
829
+ let response = undefined;
830
+
831
+ response = await client.call('post', apiPath, {
832
+ 'content-type': 'application/json',
833
+ }, payload);
834
+
835
+ if (parseOutput) {
836
+ parse(response)
837
+ }
838
+
839
+ return response;
840
+
841
+ }
842
+
843
+ /**
844
+ * @typedef {Object} DatabasesUpdateEnumAttributeRequestParams
845
+ * @property {string} databaseId Database ID.
846
+ * @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
847
+ * @property {string} key Attribute Key.
848
+ * @property {string[]} elements Array of elements in enumerated type. Uses length of longest element to determine size. Maximum of 100 elements are allowed, each 255 characters long.
849
+ * @property {boolean} required Is attribute required?
850
+ * @property {string} xdefault Default value for attribute when not provided. Cannot be set when attribute is required.
851
+ * @property {string} newKey New attribute key.
852
+ * @property {boolean} overrideForCli
853
+ * @property {boolean} parseOutput
854
+ * @property {libClient | undefined} sdk
855
+ */
856
+
857
+ /**
858
+ * @param {DatabasesUpdateEnumAttributeRequestParams} params
859
+ */
860
+ const databasesUpdateEnumAttribute = async ({databaseId,collectionId,key,elements,required,xdefault,newKey,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
861
+ let client = !sdk ? await sdkForProject() :
862
+ sdk;
863
+ let apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/enum/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
864
+ let payload = {};
865
+ elements = elements === true ? [] : elements;
866
+ if (typeof elements !== 'undefined') {
867
+ payload['elements'] = elements;
868
+ }
869
+ if (typeof required !== 'undefined') {
870
+ payload['required'] = required;
871
+ }
872
+ if (typeof xdefault !== 'undefined') {
873
+ payload['default'] = xdefault;
874
+ }
875
+ if (typeof newKey !== 'undefined') {
876
+ payload['newKey'] = newKey;
877
+ }
878
+
879
+ let response = undefined;
880
+
881
+ response = await client.call('patch', apiPath, {
882
+ 'content-type': 'application/json',
883
+ }, payload);
884
+
885
+ if (parseOutput) {
886
+ parse(response)
887
+ }
888
+
889
+ return response;
890
+
891
+ }
892
+
893
+ /**
894
+ * @typedef {Object} DatabasesCreateFloatAttributeRequestParams
895
+ * @property {string} databaseId Database ID.
896
+ * @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
897
+ * @property {string} key Attribute Key.
898
+ * @property {boolean} required Is attribute required?
899
+ * @property {number} min Minimum value to enforce on new documents
900
+ * @property {number} max Maximum value to enforce on new documents
901
+ * @property {number} xdefault Default value for attribute when not provided. Cannot be set when attribute is required.
902
+ * @property {boolean} array Is attribute an array?
903
+ * @property {boolean} overrideForCli
904
+ * @property {boolean} parseOutput
905
+ * @property {libClient | undefined} sdk
906
+ */
907
+
908
+ /**
909
+ * @param {DatabasesCreateFloatAttributeRequestParams} params
910
+ */
911
+ const databasesCreateFloatAttribute = async ({databaseId,collectionId,key,required,min,max,xdefault,array,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
912
+ let client = !sdk ? await sdkForProject() :
913
+ sdk;
914
+ let apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/float'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
915
+ let payload = {};
916
+ if (typeof key !== 'undefined') {
917
+ payload['key'] = key;
918
+ }
919
+ if (typeof required !== 'undefined') {
920
+ payload['required'] = required;
921
+ }
922
+ if (typeof min !== 'undefined') {
923
+ payload['min'] = min;
924
+ }
925
+ if (typeof max !== 'undefined') {
926
+ payload['max'] = max;
927
+ }
928
+ if (typeof xdefault !== 'undefined') {
929
+ payload['default'] = xdefault;
930
+ }
931
+ if (typeof array !== 'undefined') {
932
+ payload['array'] = array;
933
+ }
934
+
935
+ let response = undefined;
936
+
937
+ response = await client.call('post', apiPath, {
938
+ 'content-type': 'application/json',
939
+ }, payload);
940
+
941
+ if (parseOutput) {
942
+ parse(response)
943
+ }
944
+
945
+ return response;
946
+
947
+ }
948
+
949
+ /**
950
+ * @typedef {Object} DatabasesUpdateFloatAttributeRequestParams
951
+ * @property {string} databaseId Database ID.
952
+ * @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
953
+ * @property {string} key Attribute Key.
954
+ * @property {boolean} required Is attribute required?
955
+ * @property {number} xdefault Default value for attribute when not provided. Cannot be set when attribute is required.
956
+ * @property {number} min Minimum value to enforce on new documents
957
+ * @property {number} max Maximum value to enforce on new documents
958
+ * @property {string} newKey New attribute key.
959
+ * @property {boolean} overrideForCli
960
+ * @property {boolean} parseOutput
961
+ * @property {libClient | undefined} sdk
962
+ */
963
+
964
+ /**
965
+ * @param {DatabasesUpdateFloatAttributeRequestParams} params
966
+ */
967
+ const databasesUpdateFloatAttribute = async ({databaseId,collectionId,key,required,xdefault,min,max,newKey,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
968
+ let client = !sdk ? await sdkForProject() :
969
+ sdk;
970
+ let apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/float/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
971
+ let payload = {};
972
+ if (typeof required !== 'undefined') {
973
+ payload['required'] = required;
974
+ }
975
+ if (typeof min !== 'undefined') {
976
+ payload['min'] = min;
977
+ }
978
+ if (typeof max !== 'undefined') {
979
+ payload['max'] = max;
980
+ }
981
+ if (typeof xdefault !== 'undefined') {
982
+ payload['default'] = xdefault;
983
+ }
984
+ if (typeof newKey !== 'undefined') {
985
+ payload['newKey'] = newKey;
986
+ }
987
+
988
+ let response = undefined;
989
+
990
+ response = await client.call('patch', apiPath, {
991
+ 'content-type': 'application/json',
992
+ }, payload);
993
+
994
+ if (parseOutput) {
995
+ parse(response)
996
+ }
997
+
998
+ return response;
999
+
1000
+ }
1001
+
1002
+ /**
1003
+ * @typedef {Object} DatabasesCreateIntegerAttributeRequestParams
1004
+ * @property {string} databaseId Database ID.
1005
+ * @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
1006
+ * @property {string} key Attribute Key.
1007
+ * @property {boolean} required Is attribute required?
1008
+ * @property {number} min Minimum value to enforce on new documents
1009
+ * @property {number} max Maximum value to enforce on new documents
1010
+ * @property {number} xdefault Default value for attribute when not provided. Cannot be set when attribute is required.
1011
+ * @property {boolean} array Is attribute an array?
1012
+ * @property {boolean} overrideForCli
1013
+ * @property {boolean} parseOutput
1014
+ * @property {libClient | undefined} sdk
1015
+ */
1016
+
1017
+ /**
1018
+ * @param {DatabasesCreateIntegerAttributeRequestParams} params
1019
+ */
1020
+ const databasesCreateIntegerAttribute = async ({databaseId,collectionId,key,required,min,max,xdefault,array,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1021
+ let client = !sdk ? await sdkForProject() :
1022
+ sdk;
1023
+ let apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/integer'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
1024
+ let payload = {};
1025
+ if (typeof key !== 'undefined') {
1026
+ payload['key'] = key;
1027
+ }
1028
+ if (typeof required !== 'undefined') {
1029
+ payload['required'] = required;
1030
+ }
1031
+ if (typeof min !== 'undefined') {
1032
+ payload['min'] = min;
1033
+ }
1034
+ if (typeof max !== 'undefined') {
1035
+ payload['max'] = max;
1036
+ }
1037
+ if (typeof xdefault !== 'undefined') {
1038
+ payload['default'] = xdefault;
1039
+ }
1040
+ if (typeof array !== 'undefined') {
1041
+ payload['array'] = array;
1042
+ }
1043
+
1044
+ let response = undefined;
1045
+
1046
+ response = await client.call('post', apiPath, {
1047
+ 'content-type': 'application/json',
1048
+ }, payload);
1049
+
1050
+ if (parseOutput) {
1051
+ parse(response)
1052
+ }
1053
+
1054
+ return response;
1055
+
1056
+ }
1057
+
1058
+ /**
1059
+ * @typedef {Object} DatabasesUpdateIntegerAttributeRequestParams
1060
+ * @property {string} databaseId Database ID.
1061
+ * @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
1062
+ * @property {string} key Attribute Key.
1063
+ * @property {boolean} required Is attribute required?
1064
+ * @property {number} xdefault Default value for attribute when not provided. Cannot be set when attribute is required.
1065
+ * @property {number} min Minimum value to enforce on new documents
1066
+ * @property {number} max Maximum value to enforce on new documents
1067
+ * @property {string} newKey New attribute key.
1068
+ * @property {boolean} overrideForCli
1069
+ * @property {boolean} parseOutput
1070
+ * @property {libClient | undefined} sdk
1071
+ */
1072
+
1073
+ /**
1074
+ * @param {DatabasesUpdateIntegerAttributeRequestParams} params
1075
+ */
1076
+ const databasesUpdateIntegerAttribute = async ({databaseId,collectionId,key,required,xdefault,min,max,newKey,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1077
+ let client = !sdk ? await sdkForProject() :
1078
+ sdk;
1079
+ let apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/integer/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
1080
+ let payload = {};
1081
+ if (typeof required !== 'undefined') {
1082
+ payload['required'] = required;
1083
+ }
1084
+ if (typeof min !== 'undefined') {
1085
+ payload['min'] = min;
1086
+ }
1087
+ if (typeof max !== 'undefined') {
1088
+ payload['max'] = max;
1089
+ }
1090
+ if (typeof xdefault !== 'undefined') {
1091
+ payload['default'] = xdefault;
1092
+ }
1093
+ if (typeof newKey !== 'undefined') {
1094
+ payload['newKey'] = newKey;
1095
+ }
1096
+
1097
+ let response = undefined;
1098
+
1099
+ response = await client.call('patch', apiPath, {
1100
+ 'content-type': 'application/json',
1101
+ }, payload);
1102
+
1103
+ if (parseOutput) {
1104
+ parse(response)
1105
+ }
1106
+
1107
+ return response;
1108
+
1109
+ }
1110
+
1111
+ /**
1112
+ * @typedef {Object} DatabasesCreateIpAttributeRequestParams
1113
+ * @property {string} databaseId Database ID.
1114
+ * @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
1115
+ * @property {string} key Attribute Key.
1116
+ * @property {boolean} required Is attribute required?
1117
+ * @property {string} xdefault Default value for attribute when not provided. Cannot be set when attribute is required.
1118
+ * @property {boolean} array Is attribute an array?
1119
+ * @property {boolean} overrideForCli
1120
+ * @property {boolean} parseOutput
1121
+ * @property {libClient | undefined} sdk
1122
+ */
1123
+
1124
+ /**
1125
+ * @param {DatabasesCreateIpAttributeRequestParams} params
1126
+ */
1127
+ const databasesCreateIpAttribute = async ({databaseId,collectionId,key,required,xdefault,array,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1128
+ let client = !sdk ? await sdkForProject() :
1129
+ sdk;
1130
+ let apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/ip'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
1131
+ let payload = {};
1132
+ if (typeof key !== 'undefined') {
1133
+ payload['key'] = key;
1134
+ }
1135
+ if (typeof required !== 'undefined') {
1136
+ payload['required'] = required;
1137
+ }
1138
+ if (typeof xdefault !== 'undefined') {
1139
+ payload['default'] = xdefault;
1140
+ }
1141
+ if (typeof array !== 'undefined') {
1142
+ payload['array'] = array;
1143
+ }
1144
+
1145
+ let response = undefined;
1146
+
1147
+ response = await client.call('post', apiPath, {
1148
+ 'content-type': 'application/json',
1149
+ }, payload);
1150
+
1151
+ if (parseOutput) {
1152
+ parse(response)
1153
+ }
1154
+
1155
+ return response;
1156
+
1157
+ }
1158
+
1159
+ /**
1160
+ * @typedef {Object} DatabasesUpdateIpAttributeRequestParams
1161
+ * @property {string} databaseId Database ID.
1162
+ * @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
1163
+ * @property {string} key Attribute Key.
1164
+ * @property {boolean} required Is attribute required?
1165
+ * @property {string} xdefault Default value for attribute when not provided. Cannot be set when attribute is required.
1166
+ * @property {string} newKey New attribute key.
1167
+ * @property {boolean} overrideForCli
1168
+ * @property {boolean} parseOutput
1169
+ * @property {libClient | undefined} sdk
1170
+ */
1171
+
1172
+ /**
1173
+ * @param {DatabasesUpdateIpAttributeRequestParams} params
1174
+ */
1175
+ const databasesUpdateIpAttribute = async ({databaseId,collectionId,key,required,xdefault,newKey,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1176
+ let client = !sdk ? await sdkForProject() :
1177
+ sdk;
1178
+ let apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/ip/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
1179
+ let payload = {};
1180
+ if (typeof required !== 'undefined') {
1181
+ payload['required'] = required;
1182
+ }
1183
+ if (typeof xdefault !== 'undefined') {
1184
+ payload['default'] = xdefault;
1185
+ }
1186
+ if (typeof newKey !== 'undefined') {
1187
+ payload['newKey'] = newKey;
1188
+ }
1189
+
1190
+ let response = undefined;
1191
+
1192
+ response = await client.call('patch', apiPath, {
1193
+ 'content-type': 'application/json',
1194
+ }, payload);
1195
+
1196
+ if (parseOutput) {
1197
+ parse(response)
1198
+ }
1199
+
1200
+ return response;
1201
+
1202
+ }
1203
+
1204
+ /**
1205
+ * @typedef {Object} DatabasesCreateRelationshipAttributeRequestParams
1206
+ * @property {string} databaseId Database ID.
1207
+ * @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
1208
+ * @property {string} relatedCollectionId Related Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
1209
+ * @property {RelationshipType} type Relation type
1210
+ * @property {boolean} twoWay Is Two Way?
1211
+ * @property {string} key Attribute Key.
1212
+ * @property {string} twoWayKey Two Way Attribute Key.
1213
+ * @property {RelationMutate} onDelete Constraints option
1214
+ * @property {boolean} overrideForCli
1215
+ * @property {boolean} parseOutput
1216
+ * @property {libClient | undefined} sdk
1217
+ */
1218
+
1219
+ /**
1220
+ * @param {DatabasesCreateRelationshipAttributeRequestParams} params
1221
+ */
1222
+ const databasesCreateRelationshipAttribute = async ({databaseId,collectionId,relatedCollectionId,type,twoWay,key,twoWayKey,onDelete,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1223
+ let client = !sdk ? await sdkForProject() :
1224
+ sdk;
1225
+ let apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/relationship'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
1226
+ let payload = {};
1227
+ if (typeof relatedCollectionId !== 'undefined') {
1228
+ payload['relatedCollectionId'] = relatedCollectionId;
1229
+ }
1230
+ if (typeof type !== 'undefined') {
1231
+ payload['type'] = type;
1232
+ }
1233
+ if (typeof twoWay !== 'undefined') {
1234
+ payload['twoWay'] = twoWay;
1235
+ }
1236
+ if (typeof key !== 'undefined') {
1237
+ payload['key'] = key;
1238
+ }
1239
+ if (typeof twoWayKey !== 'undefined') {
1240
+ payload['twoWayKey'] = twoWayKey;
1241
+ }
1242
+ if (typeof onDelete !== 'undefined') {
1243
+ payload['onDelete'] = onDelete;
1244
+ }
1245
+
1246
+ let response = undefined;
1247
+
1248
+ response = await client.call('post', apiPath, {
1249
+ 'content-type': 'application/json',
1250
+ }, payload);
1251
+
1252
+ if (parseOutput) {
1253
+ parse(response)
1254
+ }
1255
+
1256
+ return response;
1257
+
1258
+ }
1259
+
1260
+ /**
1261
+ * @typedef {Object} DatabasesCreateStringAttributeRequestParams
1262
+ * @property {string} databaseId Database ID.
1263
+ * @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
1264
+ * @property {string} key Attribute Key.
1265
+ * @property {number} size Attribute size for text attributes, in number of characters.
1266
+ * @property {boolean} required Is attribute required?
1267
+ * @property {string} xdefault Default value for attribute when not provided. Cannot be set when attribute is required.
1268
+ * @property {boolean} array Is attribute an array?
1269
+ * @property {boolean} encrypt Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried.
1270
+ * @property {boolean} overrideForCli
1271
+ * @property {boolean} parseOutput
1272
+ * @property {libClient | undefined} sdk
1273
+ */
1274
+
1275
+ /**
1276
+ * @param {DatabasesCreateStringAttributeRequestParams} params
1277
+ */
1278
+ const databasesCreateStringAttribute = async ({databaseId,collectionId,key,size,required,xdefault,array,encrypt,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1279
+ let client = !sdk ? await sdkForProject() :
1280
+ sdk;
1281
+ let apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/string'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
1282
+ let payload = {};
1283
+ if (typeof key !== 'undefined') {
1284
+ payload['key'] = key;
1285
+ }
1286
+ if (typeof size !== 'undefined') {
1287
+ payload['size'] = size;
1288
+ }
1289
+ if (typeof required !== 'undefined') {
1290
+ payload['required'] = required;
1291
+ }
1292
+ if (typeof xdefault !== 'undefined') {
1293
+ payload['default'] = xdefault;
1294
+ }
1295
+ if (typeof array !== 'undefined') {
1296
+ payload['array'] = array;
1297
+ }
1298
+ if (typeof encrypt !== 'undefined') {
1299
+ payload['encrypt'] = encrypt;
1300
+ }
1301
+
1302
+ let response = undefined;
1303
+
1304
+ response = await client.call('post', apiPath, {
1305
+ 'content-type': 'application/json',
1306
+ }, payload);
1307
+
1308
+ if (parseOutput) {
1309
+ parse(response)
1310
+ }
1311
+
1312
+ return response;
1313
+
1314
+ }
1315
+
1316
+ /**
1317
+ * @typedef {Object} DatabasesUpdateStringAttributeRequestParams
1318
+ * @property {string} databaseId Database ID.
1319
+ * @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
1320
+ * @property {string} key Attribute Key.
1321
+ * @property {boolean} required Is attribute required?
1322
+ * @property {string} xdefault Default value for attribute when not provided. Cannot be set when attribute is required.
1323
+ * @property {number} size Maximum size of the string attribute.
1324
+ * @property {string} newKey New attribute key.
1325
+ * @property {boolean} overrideForCli
1326
+ * @property {boolean} parseOutput
1327
+ * @property {libClient | undefined} sdk
1328
+ */
1329
+
1330
+ /**
1331
+ * @param {DatabasesUpdateStringAttributeRequestParams} params
1332
+ */
1333
+ const databasesUpdateStringAttribute = async ({databaseId,collectionId,key,required,xdefault,size,newKey,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1334
+ let client = !sdk ? await sdkForProject() :
1335
+ sdk;
1336
+ let apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/string/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
1337
+ let payload = {};
1338
+ if (typeof required !== 'undefined') {
1339
+ payload['required'] = required;
1340
+ }
1341
+ if (typeof xdefault !== 'undefined') {
1342
+ payload['default'] = xdefault;
1343
+ }
1344
+ if (typeof size !== 'undefined') {
1345
+ payload['size'] = size;
1346
+ }
1347
+ if (typeof newKey !== 'undefined') {
1348
+ payload['newKey'] = newKey;
1349
+ }
1350
+
1351
+ let response = undefined;
1352
+
1353
+ response = await client.call('patch', apiPath, {
1354
+ 'content-type': 'application/json',
1355
+ }, payload);
1356
+
1357
+ if (parseOutput) {
1358
+ parse(response)
1359
+ }
1360
+
1361
+ return response;
1362
+
1363
+ }
1364
+
1365
+ /**
1366
+ * @typedef {Object} DatabasesCreateUrlAttributeRequestParams
1367
+ * @property {string} databaseId Database ID.
1368
+ * @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
1369
+ * @property {string} key Attribute Key.
1370
+ * @property {boolean} required Is attribute required?
1371
+ * @property {string} xdefault Default value for attribute when not provided. Cannot be set when attribute is required.
1372
+ * @property {boolean} array Is attribute an array?
1373
+ * @property {boolean} overrideForCli
1374
+ * @property {boolean} parseOutput
1375
+ * @property {libClient | undefined} sdk
1376
+ */
1377
+
1378
+ /**
1379
+ * @param {DatabasesCreateUrlAttributeRequestParams} params
1380
+ */
1381
+ const databasesCreateUrlAttribute = async ({databaseId,collectionId,key,required,xdefault,array,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1382
+ let client = !sdk ? await sdkForProject() :
1383
+ sdk;
1384
+ let apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/url'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
1385
+ let payload = {};
1386
+ if (typeof key !== 'undefined') {
1387
+ payload['key'] = key;
1388
+ }
1389
+ if (typeof required !== 'undefined') {
1390
+ payload['required'] = required;
1391
+ }
1392
+ if (typeof xdefault !== 'undefined') {
1393
+ payload['default'] = xdefault;
1394
+ }
1395
+ if (typeof array !== 'undefined') {
1396
+ payload['array'] = array;
1397
+ }
1398
+
1399
+ let response = undefined;
1400
+
1401
+ response = await client.call('post', apiPath, {
1402
+ 'content-type': 'application/json',
1403
+ }, payload);
1404
+
1405
+ if (parseOutput) {
1406
+ parse(response)
1407
+ }
1408
+
1409
+ return response;
1410
+
1411
+ }
1412
+
1413
+ /**
1414
+ * @typedef {Object} DatabasesUpdateUrlAttributeRequestParams
1415
+ * @property {string} databaseId Database ID.
1416
+ * @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
1417
+ * @property {string} key Attribute Key.
1418
+ * @property {boolean} required Is attribute required?
1419
+ * @property {string} xdefault Default value for attribute when not provided. Cannot be set when attribute is required.
1420
+ * @property {string} newKey New attribute key.
1421
+ * @property {boolean} overrideForCli
1422
+ * @property {boolean} parseOutput
1423
+ * @property {libClient | undefined} sdk
1424
+ */
1425
+
1426
+ /**
1427
+ * @param {DatabasesUpdateUrlAttributeRequestParams} params
1428
+ */
1429
+ const databasesUpdateUrlAttribute = async ({databaseId,collectionId,key,required,xdefault,newKey,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1430
+ let client = !sdk ? await sdkForProject() :
1431
+ sdk;
1432
+ let apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/url/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
1433
+ let payload = {};
1434
+ if (typeof required !== 'undefined') {
1435
+ payload['required'] = required;
1436
+ }
1437
+ if (typeof xdefault !== 'undefined') {
1438
+ payload['default'] = xdefault;
1439
+ }
1440
+ if (typeof newKey !== 'undefined') {
1441
+ payload['newKey'] = newKey;
1442
+ }
1443
+
1444
+ let response = undefined;
1445
+
1446
+ response = await client.call('patch', apiPath, {
1447
+ 'content-type': 'application/json',
1448
+ }, payload);
1449
+
1450
+ if (parseOutput) {
1451
+ parse(response)
1452
+ }
1453
+
1454
+ return response;
1455
+
1456
+ }
1457
+
1458
+ /**
1459
+ * @typedef {Object} DatabasesGetAttributeRequestParams
1460
+ * @property {string} databaseId Database ID.
1461
+ * @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
1462
+ * @property {string} key Attribute Key.
1463
+ * @property {boolean} overrideForCli
1464
+ * @property {boolean} parseOutput
1465
+ * @property {libClient | undefined} sdk
1466
+ */
1467
+
1468
+ /**
1469
+ * @param {DatabasesGetAttributeRequestParams} params
1470
+ */
1471
+ const databasesGetAttribute = async ({databaseId,collectionId,key,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1472
+ let client = !sdk ? await sdkForProject() :
1473
+ sdk;
1474
+ let apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
1475
+ let payload = {};
1476
+
1477
+ let response = undefined;
1478
+
1479
+ response = await client.call('get', apiPath, {
1480
+ }, payload);
1481
+
1482
+ if (parseOutput) {
1483
+ parse(response)
1484
+ }
1485
+
1486
+ return response;
1487
+
1488
+ }
1489
+
1490
+ /**
1491
+ * @typedef {Object} DatabasesDeleteAttributeRequestParams
1492
+ * @property {string} databaseId Database ID.
1493
+ * @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
1494
+ * @property {string} key Attribute Key.
1495
+ * @property {boolean} overrideForCli
1496
+ * @property {boolean} parseOutput
1497
+ * @property {libClient | undefined} sdk
1498
+ */
1499
+
1500
+ /**
1501
+ * @param {DatabasesDeleteAttributeRequestParams} params
1502
+ */
1503
+ const databasesDeleteAttribute = async ({databaseId,collectionId,key,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1504
+ let client = !sdk ? await sdkForProject() :
1505
+ sdk;
1506
+ let apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
1507
+ let payload = {};
1508
+
1509
+ let response = undefined;
1510
+
1511
+ response = await client.call('delete', apiPath, {
1512
+ 'content-type': 'application/json',
1513
+ }, payload);
1514
+
1515
+ if (parseOutput) {
1516
+ parse(response)
1517
+ }
1518
+
1519
+ return response;
1520
+
1521
+ }
1522
+
1523
+ /**
1524
+ * @typedef {Object} DatabasesUpdateRelationshipAttributeRequestParams
1525
+ * @property {string} databaseId Database ID.
1526
+ * @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
1527
+ * @property {string} key Attribute Key.
1528
+ * @property {RelationMutate} onDelete Constraints option
1529
+ * @property {string} newKey New attribute key.
1530
+ * @property {boolean} overrideForCli
1531
+ * @property {boolean} parseOutput
1532
+ * @property {libClient | undefined} sdk
1533
+ */
1534
+
1535
+ /**
1536
+ * @param {DatabasesUpdateRelationshipAttributeRequestParams} params
1537
+ */
1538
+ const databasesUpdateRelationshipAttribute = async ({databaseId,collectionId,key,onDelete,newKey,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1539
+ let client = !sdk ? await sdkForProject() :
1540
+ sdk;
1541
+ let apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}/relationship'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
1542
+ let payload = {};
1543
+ if (typeof onDelete !== 'undefined') {
1544
+ payload['onDelete'] = onDelete;
1545
+ }
1546
+ if (typeof newKey !== 'undefined') {
1547
+ payload['newKey'] = newKey;
1548
+ }
1549
+
1550
+ let response = undefined;
1551
+
1552
+ response = await client.call('patch', apiPath, {
1553
+ 'content-type': 'application/json',
1554
+ }, payload);
1555
+
1556
+ if (parseOutput) {
1557
+ parse(response)
1558
+ }
1559
+
1560
+ return response;
1561
+
1562
+ }
1563
+
1564
+ /**
1565
+ * @typedef {Object} DatabasesListDocumentsRequestParams
1566
+ * @property {string} databaseId Database ID.
1567
+ * @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
1568
+ * @property {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.
1569
+ * @property {boolean} overrideForCli
1570
+ * @property {boolean} parseOutput
1571
+ * @property {libClient | undefined} sdk
1572
+ */
1573
+
1574
+ /**
1575
+ * @param {DatabasesListDocumentsRequestParams} params
1576
+ */
1577
+ const databasesListDocuments = async ({databaseId,collectionId,queries,parseOutput = true, overrideForCli = false, sdk = undefined, console}) => {
1578
+ let client = !sdk ? await sdkForProject() :
1579
+ sdk;
1580
+ let apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
1581
+ let payload = {};
1582
+ if (typeof queries !== 'undefined') {
1583
+ payload['queries'] = queries;
1584
+ }
1585
+
1586
+ let response = undefined;
1587
+
1588
+ response = await client.call('get', apiPath, {
1589
+ }, payload);
1590
+
1591
+ if (parseOutput) {
1592
+ if(console) {
1593
+ showConsoleLink('databases', 'listDocuments', databaseId, collectionId);
1594
+ } else {
1595
+ parse(response)
1596
+ }
1597
+ }
1598
+
1599
+ return response;
1600
+
1601
+ }
1602
+
1603
+ /**
1604
+ * @typedef {Object} DatabasesCreateDocumentRequestParams
1605
+ * @property {string} databaseId Database ID.
1606
+ * @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents.
1607
+ * @property {string} documentId Document 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.
1608
+ * @property {object} data Document data as JSON object.
1609
+ * @property {string[]} permissions An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).
1610
+ * @property {boolean} overrideForCli
1611
+ * @property {boolean} parseOutput
1612
+ * @property {libClient | undefined} sdk
1613
+ */
1614
+
1615
+ /**
1616
+ * @param {DatabasesCreateDocumentRequestParams} params
1617
+ */
1618
+ const databasesCreateDocument = async ({databaseId,collectionId,documentId,data,permissions,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1619
+ let client = !sdk ? await sdkForProject() :
1620
+ sdk;
1621
+ let apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
1622
+ let payload = {};
1623
+ if (typeof documentId !== 'undefined') {
1624
+ payload['documentId'] = documentId;
1625
+ }
1626
+ if (typeof data !== 'undefined') {
1627
+ payload['data'] = JSON.parse(data);
1628
+ }
1629
+ permissions = permissions === true ? [] : permissions;
1630
+ if (typeof permissions !== 'undefined') {
1631
+ payload['permissions'] = permissions;
1632
+ }
1633
+
1634
+ let response = undefined;
1635
+
1636
+ response = await client.call('post', apiPath, {
1637
+ 'content-type': 'application/json',
1638
+ }, payload);
1639
+
1640
+ if (parseOutput) {
1641
+ parse(response)
1642
+ }
1643
+
1644
+ return response;
1645
+
1646
+ }
1647
+
1648
+ /**
1649
+ * @typedef {Object} DatabasesCreateDocumentsRequestParams
1650
+ * @property {string} databaseId Database ID.
1651
+ * @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents.
1652
+ * @property {object[]} documents Array of documents data as JSON objects.
1653
+ * @property {boolean} overrideForCli
1654
+ * @property {boolean} parseOutput
1655
+ * @property {libClient | undefined} sdk
1656
+ */
1657
+
1658
+ /**
1659
+ * @param {DatabasesCreateDocumentsRequestParams} params
1660
+ */
1661
+ const databasesCreateDocuments = async ({databaseId,collectionId,documents,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1662
+ let client = !sdk ? await sdkForProject() :
1663
+ sdk;
1664
+ let apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
1665
+ let payload = {};
1666
+ documents = documents === true ? [] : documents;
1667
+ if (typeof documents !== 'undefined') {
1668
+ payload['documents'] = documents;
1669
+ }
1670
+
1671
+ let response = undefined;
1672
+
1673
+ response = await client.call('post', apiPath, {
1674
+ 'content-type': 'application/json',
1675
+ }, payload);
1676
+
1677
+ if (parseOutput) {
1678
+ parse(response)
1679
+ }
1680
+
1681
+ return response;
1682
+
1683
+ }
1684
+
1685
+ /**
1686
+ * @typedef {Object} DatabasesUpsertDocumentsRequestParams
1687
+ * @property {string} databaseId Database ID.
1688
+ * @property {string} collectionId Collection ID.
1689
+ * @property {object[]} documents Array of document data as JSON objects. May contain partial documents.
1690
+ * @property {boolean} overrideForCli
1691
+ * @property {boolean} parseOutput
1692
+ * @property {libClient | undefined} sdk
1693
+ */
1694
+
1695
+ /**
1696
+ * @param {DatabasesUpsertDocumentsRequestParams} params
1697
+ */
1698
+ const databasesUpsertDocuments = async ({databaseId,collectionId,documents,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1699
+ let client = !sdk ? await sdkForProject() :
1700
+ sdk;
1701
+ let apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
1702
+ let payload = {};
1703
+ documents = documents === true ? [] : documents;
1704
+ if (typeof documents !== 'undefined') {
1705
+ payload['documents'] = documents;
1706
+ }
1707
+
1708
+ let response = undefined;
1709
+
1710
+ response = await client.call('put', apiPath, {
1711
+ 'content-type': 'application/json',
1712
+ }, payload);
1713
+
1714
+ if (parseOutput) {
1715
+ parse(response)
1716
+ }
1717
+
1718
+ return response;
1719
+
1720
+ }
1721
+
1722
+ /**
1723
+ * @typedef {Object} DatabasesUpdateDocumentsRequestParams
1724
+ * @property {string} databaseId Database ID.
1725
+ * @property {string} collectionId Collection ID.
1726
+ * @property {object} data Document data as JSON object. Include only attribute and value pairs to be updated.
1727
+ * @property {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.
1728
+ * @property {boolean} overrideForCli
1729
+ * @property {boolean} parseOutput
1730
+ * @property {libClient | undefined} sdk
1731
+ */
1732
+
1733
+ /**
1734
+ * @param {DatabasesUpdateDocumentsRequestParams} params
1735
+ */
1736
+ const databasesUpdateDocuments = async ({databaseId,collectionId,data,queries,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1737
+ let client = !sdk ? await sdkForProject() :
1738
+ sdk;
1739
+ let apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
1740
+ let payload = {};
1741
+ if (typeof data !== 'undefined') {
1742
+ payload['data'] = JSON.parse(data);
1743
+ }
1744
+ queries = queries === true ? [] : queries;
1745
+ if (typeof queries !== 'undefined') {
1746
+ payload['queries'] = queries;
1747
+ }
1748
+
1749
+ let response = undefined;
1750
+
1751
+ response = await client.call('patch', apiPath, {
1752
+ 'content-type': 'application/json',
1753
+ }, payload);
1754
+
1755
+ if (parseOutput) {
1756
+ parse(response)
1757
+ }
1758
+
1759
+ return response;
1760
+
1761
+ }
1762
+
1763
+ /**
1764
+ * @typedef {Object} DatabasesDeleteDocumentsRequestParams
1765
+ * @property {string} databaseId Database ID.
1766
+ * @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
1767
+ * @property {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.
1768
+ * @property {boolean} overrideForCli
1769
+ * @property {boolean} parseOutput
1770
+ * @property {libClient | undefined} sdk
1771
+ */
1772
+
1773
+ /**
1774
+ * @param {DatabasesDeleteDocumentsRequestParams} params
1775
+ */
1776
+ const databasesDeleteDocuments = async ({databaseId,collectionId,queries,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1777
+ let client = !sdk ? await sdkForProject() :
1778
+ sdk;
1779
+ let apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
1780
+ let payload = {};
1781
+ queries = queries === true ? [] : queries;
1782
+ if (typeof queries !== 'undefined') {
1783
+ payload['queries'] = queries;
1784
+ }
1785
+
1786
+ let response = undefined;
1787
+
1788
+ response = await client.call('delete', apiPath, {
1789
+ 'content-type': 'application/json',
1790
+ }, payload);
1791
+
1792
+ if (parseOutput) {
1793
+ parse(response)
1794
+ }
1795
+
1796
+ return response;
1797
+
1798
+ }
1799
+
1800
+ /**
1801
+ * @typedef {Object} DatabasesGetDocumentRequestParams
1802
+ * @property {string} databaseId Database ID.
1803
+ * @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
1804
+ * @property {string} documentId Document ID.
1805
+ * @property {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.
1806
+ * @property {boolean} overrideForCli
1807
+ * @property {boolean} parseOutput
1808
+ * @property {libClient | undefined} sdk
1809
+ */
1810
+
1811
+ /**
1812
+ * @param {DatabasesGetDocumentRequestParams} params
1813
+ */
1814
+ const databasesGetDocument = async ({databaseId,collectionId,documentId,queries,parseOutput = true, overrideForCli = false, sdk = undefined, console}) => {
1815
+ let client = !sdk ? await sdkForProject() :
1816
+ sdk;
1817
+ let apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId);
1818
+ let payload = {};
1819
+ if (typeof queries !== 'undefined') {
1820
+ payload['queries'] = queries;
1821
+ }
1822
+
1823
+ let response = undefined;
1824
+
1825
+ response = await client.call('get', apiPath, {
1826
+ }, payload);
1827
+
1828
+ if (parseOutput) {
1829
+ if(console) {
1830
+ showConsoleLink('databases', 'getDocument', databaseId, collectionId, documentId);
1831
+ } else {
1832
+ parse(response)
1833
+ }
1834
+ }
1835
+
1836
+ return response;
1837
+
1838
+ }
1839
+
1840
+ /**
1841
+ * @typedef {Object} DatabasesUpsertDocumentRequestParams
1842
+ * @property {string} databaseId Database ID.
1843
+ * @property {string} collectionId Collection ID.
1844
+ * @property {string} documentId Document ID.
1845
+ * @property {object} data Document data as JSON object. Include all required attributes of the document to be created or updated.
1846
+ * @property {string[]} permissions An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).
1847
+ * @property {boolean} overrideForCli
1848
+ * @property {boolean} parseOutput
1849
+ * @property {libClient | undefined} sdk
1850
+ */
1851
+
1852
+ /**
1853
+ * @param {DatabasesUpsertDocumentRequestParams} params
1854
+ */
1855
+ const databasesUpsertDocument = async ({databaseId,collectionId,documentId,data,permissions,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1856
+ let client = !sdk ? await sdkForProject() :
1857
+ sdk;
1858
+ let apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId);
1859
+ let payload = {};
1860
+ if (typeof data !== 'undefined') {
1861
+ payload['data'] = JSON.parse(data);
1862
+ }
1863
+ permissions = permissions === true ? [] : permissions;
1864
+ if (typeof permissions !== 'undefined') {
1865
+ payload['permissions'] = permissions;
1866
+ }
1867
+
1868
+ let response = undefined;
1869
+
1870
+ response = await client.call('put', apiPath, {
1871
+ 'content-type': 'application/json',
1872
+ }, payload);
1873
+
1874
+ if (parseOutput) {
1875
+ parse(response)
1876
+ }
1877
+
1878
+ return response;
1879
+
1880
+ }
1881
+
1882
+ /**
1883
+ * @typedef {Object} DatabasesUpdateDocumentRequestParams
1884
+ * @property {string} databaseId Database ID.
1885
+ * @property {string} collectionId Collection ID.
1886
+ * @property {string} documentId Document ID.
1887
+ * @property {object} data Document data as JSON object. Include only attribute and value pairs to be updated.
1888
+ * @property {string[]} permissions An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).
1889
+ * @property {boolean} overrideForCli
1890
+ * @property {boolean} parseOutput
1891
+ * @property {libClient | undefined} sdk
1892
+ */
1893
+
1894
+ /**
1895
+ * @param {DatabasesUpdateDocumentRequestParams} params
1896
+ */
1897
+ const databasesUpdateDocument = async ({databaseId,collectionId,documentId,data,permissions,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1898
+ let client = !sdk ? await sdkForProject() :
1899
+ sdk;
1900
+ let apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId);
1901
+ let payload = {};
1902
+ if (typeof data !== 'undefined') {
1903
+ payload['data'] = JSON.parse(data);
1904
+ }
1905
+ permissions = permissions === true ? [] : permissions;
1906
+ if (typeof permissions !== 'undefined') {
1907
+ payload['permissions'] = permissions;
1908
+ }
1909
+
1910
+ let response = undefined;
1911
+
1912
+ response = await client.call('patch', apiPath, {
1913
+ 'content-type': 'application/json',
1914
+ }, payload);
1915
+
1916
+ if (parseOutput) {
1917
+ parse(response)
1918
+ }
1919
+
1920
+ return response;
1921
+
1922
+ }
1923
+
1924
+ /**
1925
+ * @typedef {Object} DatabasesDeleteDocumentRequestParams
1926
+ * @property {string} databaseId Database ID.
1927
+ * @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
1928
+ * @property {string} documentId Document ID.
1929
+ * @property {boolean} overrideForCli
1930
+ * @property {boolean} parseOutput
1931
+ * @property {libClient | undefined} sdk
1932
+ */
1933
+
1934
+ /**
1935
+ * @param {DatabasesDeleteDocumentRequestParams} params
1936
+ */
1937
+ const databasesDeleteDocument = async ({databaseId,collectionId,documentId,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1938
+ let client = !sdk ? await sdkForProject() :
1939
+ sdk;
1940
+ let apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId);
1941
+ let payload = {};
1942
+
1943
+ let response = undefined;
1944
+
1945
+ response = await client.call('delete', apiPath, {
1946
+ 'content-type': 'application/json',
1947
+ }, payload);
1948
+
1949
+ if (parseOutput) {
1950
+ parse(response)
1951
+ }
1952
+
1953
+ return response;
1954
+
1955
+ }
1956
+
1957
+ /**
1958
+ * @typedef {Object} DatabasesListDocumentLogsRequestParams
1959
+ * @property {string} databaseId Database ID.
1960
+ * @property {string} collectionId Collection ID.
1961
+ * @property {string} documentId Document ID.
1962
+ * @property {string[]} queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset
1963
+ * @property {boolean} overrideForCli
1964
+ * @property {boolean} parseOutput
1965
+ * @property {libClient | undefined} sdk
1966
+ */
1967
+
1968
+ /**
1969
+ * @param {DatabasesListDocumentLogsRequestParams} params
1970
+ */
1971
+ const databasesListDocumentLogs = async ({databaseId,collectionId,documentId,queries,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1972
+ let client = !sdk ? await sdkForProject() :
1973
+ sdk;
1974
+ let apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/logs'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId);
1975
+ let payload = {};
1976
+ if (typeof queries !== 'undefined') {
1977
+ payload['queries'] = queries;
1978
+ }
1979
+
1980
+ let response = undefined;
1981
+
1982
+ response = await client.call('get', apiPath, {
1983
+ }, payload);
1984
+
1985
+ if (parseOutput) {
1986
+ parse(response)
1987
+ }
1988
+
1989
+ return response;
1990
+
1991
+ }
1992
+
1993
+ /**
1994
+ * @typedef {Object} DatabasesDecrementDocumentAttributeRequestParams
1995
+ * @property {string} databaseId Database ID.
1996
+ * @property {string} collectionId Collection ID.
1997
+ * @property {string} documentId Document ID.
1998
+ * @property {string} attribute Attribute key.
1999
+ * @property {number} value Value to decrement the attribute by. The value must be a number.
2000
+ * @property {number} min Minimum value for the attribute. If the current value is lesser than this value, an exception will be thrown.
2001
+ * @property {boolean} overrideForCli
2002
+ * @property {boolean} parseOutput
2003
+ * @property {libClient | undefined} sdk
2004
+ */
2005
+
2006
+ /**
2007
+ * @param {DatabasesDecrementDocumentAttributeRequestParams} params
2008
+ */
2009
+ const databasesDecrementDocumentAttribute = async ({databaseId,collectionId,documentId,attribute,value,min,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
2010
+ let client = !sdk ? await sdkForProject() :
2011
+ sdk;
2012
+ let apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/decrement'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId).replace('{attribute}', attribute);
2013
+ let payload = {};
2014
+ if (typeof value !== 'undefined') {
2015
+ payload['value'] = value;
2016
+ }
2017
+ if (typeof min !== 'undefined') {
2018
+ payload['min'] = min;
2019
+ }
2020
+
2021
+ let response = undefined;
2022
+
2023
+ response = await client.call('patch', apiPath, {
2024
+ 'content-type': 'application/json',
2025
+ }, payload);
2026
+
2027
+ if (parseOutput) {
2028
+ parse(response)
2029
+ }
2030
+
2031
+ return response;
2032
+
2033
+ }
2034
+
2035
+ /**
2036
+ * @typedef {Object} DatabasesIncrementDocumentAttributeRequestParams
2037
+ * @property {string} databaseId Database ID.
2038
+ * @property {string} collectionId Collection ID.
2039
+ * @property {string} documentId Document ID.
2040
+ * @property {string} attribute Attribute key.
2041
+ * @property {number} value Value to increment the attribute by. The value must be a number.
2042
+ * @property {number} max Maximum value for the attribute. If the current value is greater than this value, an error will be thrown.
2043
+ * @property {boolean} overrideForCli
2044
+ * @property {boolean} parseOutput
2045
+ * @property {libClient | undefined} sdk
2046
+ */
2047
+
2048
+ /**
2049
+ * @param {DatabasesIncrementDocumentAttributeRequestParams} params
2050
+ */
2051
+ const databasesIncrementDocumentAttribute = async ({databaseId,collectionId,documentId,attribute,value,max,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
2052
+ let client = !sdk ? await sdkForProject() :
2053
+ sdk;
2054
+ let apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/increment'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId).replace('{attribute}', attribute);
2055
+ let payload = {};
2056
+ if (typeof value !== 'undefined') {
2057
+ payload['value'] = value;
2058
+ }
2059
+ if (typeof max !== 'undefined') {
2060
+ payload['max'] = max;
2061
+ }
2062
+
2063
+ let response = undefined;
2064
+
2065
+ response = await client.call('patch', apiPath, {
2066
+ 'content-type': 'application/json',
2067
+ }, payload);
2068
+
2069
+ if (parseOutput) {
2070
+ parse(response)
2071
+ }
2072
+
2073
+ return response;
2074
+
2075
+ }
2076
+
2077
+ /**
2078
+ * @typedef {Object} DatabasesListIndexesRequestParams
2079
+ * @property {string} databaseId Database ID.
2080
+ * @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
2081
+ * @property {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. You may filter on the following attributes: key, type, status, attributes, error
2082
+ * @property {boolean} overrideForCli
2083
+ * @property {boolean} parseOutput
2084
+ * @property {libClient | undefined} sdk
2085
+ */
2086
+
2087
+ /**
2088
+ * @param {DatabasesListIndexesRequestParams} params
2089
+ */
2090
+ const databasesListIndexes = async ({databaseId,collectionId,queries,parseOutput = true, overrideForCli = false, sdk = undefined, console}) => {
2091
+ let client = !sdk ? await sdkForProject() :
2092
+ sdk;
2093
+ let apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
2094
+ let payload = {};
2095
+ if (typeof queries !== 'undefined') {
2096
+ payload['queries'] = queries;
2097
+ }
2098
+
2099
+ let response = undefined;
2100
+
2101
+ response = await client.call('get', apiPath, {
2102
+ }, payload);
2103
+
2104
+ if (parseOutput) {
2105
+ if(console) {
2106
+ showConsoleLink('databases', 'listIndexes', databaseId, collectionId);
2107
+ } else {
2108
+ parse(response)
2109
+ }
2110
+ }
2111
+
2112
+ return response;
2113
+
2114
+ }
2115
+
2116
+ /**
2117
+ * @typedef {Object} DatabasesCreateIndexRequestParams
2118
+ * @property {string} databaseId Database ID.
2119
+ * @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
2120
+ * @property {string} key Index Key.
2121
+ * @property {IndexType} type Index type.
2122
+ * @property {string[]} attributes Array of attributes to index. Maximum of 100 attributes are allowed, each 32 characters long.
2123
+ * @property {string[]} orders Array of index orders. Maximum of 100 orders are allowed.
2124
+ * @property {number[]} lengths Length of index. Maximum of 100
2125
+ * @property {boolean} overrideForCli
2126
+ * @property {boolean} parseOutput
2127
+ * @property {libClient | undefined} sdk
2128
+ */
2129
+
2130
+ /**
2131
+ * @param {DatabasesCreateIndexRequestParams} params
2132
+ */
2133
+ const databasesCreateIndex = async ({databaseId,collectionId,key,type,attributes,orders,lengths,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
2134
+ let client = !sdk ? await sdkForProject() :
2135
+ sdk;
2136
+ let apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
2137
+ let payload = {};
2138
+ if (typeof key !== 'undefined') {
2139
+ payload['key'] = key;
2140
+ }
2141
+ if (typeof type !== 'undefined') {
2142
+ payload['type'] = type;
2143
+ }
2144
+ attributes = attributes === true ? [] : attributes;
2145
+ if (typeof attributes !== 'undefined') {
2146
+ payload['attributes'] = attributes;
2147
+ }
2148
+ orders = orders === true ? [] : orders;
2149
+ if (typeof orders !== 'undefined') {
2150
+ payload['orders'] = orders;
2151
+ }
2152
+ lengths = lengths === true ? [] : lengths;
2153
+ if (typeof lengths !== 'undefined') {
2154
+ payload['lengths'] = lengths;
2155
+ }
2156
+
2157
+ let response = undefined;
2158
+
2159
+ response = await client.call('post', apiPath, {
2160
+ 'content-type': 'application/json',
2161
+ }, payload);
2162
+
2163
+ if (parseOutput) {
2164
+ parse(response)
2165
+ }
2166
+
2167
+ return response;
2168
+
2169
+ }
2170
+
2171
+ /**
2172
+ * @typedef {Object} DatabasesGetIndexRequestParams
2173
+ * @property {string} databaseId Database ID.
2174
+ * @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
2175
+ * @property {string} key Index Key.
2176
+ * @property {boolean} overrideForCli
2177
+ * @property {boolean} parseOutput
2178
+ * @property {libClient | undefined} sdk
2179
+ */
2180
+
2181
+ /**
2182
+ * @param {DatabasesGetIndexRequestParams} params
2183
+ */
2184
+ const databasesGetIndex = async ({databaseId,collectionId,key,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
2185
+ let client = !sdk ? await sdkForProject() :
2186
+ sdk;
2187
+ let apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
2188
+ let payload = {};
2189
+
2190
+ let response = undefined;
2191
+
2192
+ response = await client.call('get', apiPath, {
2193
+ }, payload);
2194
+
2195
+ if (parseOutput) {
2196
+ parse(response)
2197
+ }
2198
+
2199
+ return response;
2200
+
2201
+ }
2202
+
2203
+ /**
2204
+ * @typedef {Object} DatabasesDeleteIndexRequestParams
2205
+ * @property {string} databaseId Database ID.
2206
+ * @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
2207
+ * @property {string} key Index Key.
2208
+ * @property {boolean} overrideForCli
2209
+ * @property {boolean} parseOutput
2210
+ * @property {libClient | undefined} sdk
2211
+ */
2212
+
2213
+ /**
2214
+ * @param {DatabasesDeleteIndexRequestParams} params
2215
+ */
2216
+ const databasesDeleteIndex = async ({databaseId,collectionId,key,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
2217
+ let client = !sdk ? await sdkForProject() :
2218
+ sdk;
2219
+ let apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
2220
+ let payload = {};
2221
+
2222
+ let response = undefined;
2223
+
2224
+ response = await client.call('delete', apiPath, {
2225
+ 'content-type': 'application/json',
2226
+ }, payload);
2227
+
2228
+ if (parseOutput) {
2229
+ parse(response)
2230
+ }
2231
+
2232
+ return response;
2233
+
2234
+ }
2235
+
2236
+ /**
2237
+ * @typedef {Object} DatabasesListCollectionLogsRequestParams
2238
+ * @property {string} databaseId Database ID.
2239
+ * @property {string} collectionId Collection ID.
2240
+ * @property {string[]} queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset
2241
+ * @property {boolean} overrideForCli
2242
+ * @property {boolean} parseOutput
2243
+ * @property {libClient | undefined} sdk
2244
+ */
2245
+
2246
+ /**
2247
+ * @param {DatabasesListCollectionLogsRequestParams} params
2248
+ */
2249
+ const databasesListCollectionLogs = async ({databaseId,collectionId,queries,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
2250
+ let client = !sdk ? await sdkForProject() :
2251
+ sdk;
2252
+ let apiPath = '/databases/{databaseId}/collections/{collectionId}/logs'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
2253
+ let payload = {};
2254
+ if (typeof queries !== 'undefined') {
2255
+ payload['queries'] = queries;
2256
+ }
2257
+
2258
+ let response = undefined;
2259
+
2260
+ response = await client.call('get', apiPath, {
2261
+ }, payload);
2262
+
2263
+ if (parseOutput) {
2264
+ parse(response)
2265
+ }
2266
+
2267
+ return response;
2268
+
2269
+ }
2270
+
2271
+ /**
2272
+ * @typedef {Object} DatabasesGetCollectionUsageRequestParams
2273
+ * @property {string} databaseId Database ID.
2274
+ * @property {string} collectionId Collection ID.
2275
+ * @property {DatabaseUsageRange} range Date range.
2276
+ * @property {boolean} overrideForCli
2277
+ * @property {boolean} parseOutput
2278
+ * @property {libClient | undefined} sdk
2279
+ */
2280
+
2281
+ /**
2282
+ * @param {DatabasesGetCollectionUsageRequestParams} params
2283
+ */
2284
+ const databasesGetCollectionUsage = async ({databaseId,collectionId,range,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
2285
+ let client = !sdk ? await sdkForProject() :
2286
+ sdk;
2287
+ let apiPath = '/databases/{databaseId}/collections/{collectionId}/usage'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
2288
+ let payload = {};
2289
+ if (typeof range !== 'undefined') {
2290
+ payload['range'] = range;
2291
+ }
2292
+
2293
+ let response = undefined;
2294
+
2295
+ response = await client.call('get', apiPath, {
2296
+ }, payload);
2297
+
2298
+ if (parseOutput) {
2299
+ parse(response)
2300
+ }
2301
+
2302
+ return response;
2303
+
2304
+ }
2305
+
2306
+ /**
2307
+ * @typedef {Object} DatabasesListLogsRequestParams
2308
+ * @property {string} databaseId Database ID.
2309
+ * @property {string[]} queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset
2310
+ * @property {boolean} overrideForCli
2311
+ * @property {boolean} parseOutput
2312
+ * @property {libClient | undefined} sdk
2313
+ */
2314
+
2315
+ /**
2316
+ * @param {DatabasesListLogsRequestParams} params
2317
+ */
2318
+ const databasesListLogs = async ({databaseId,queries,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
2319
+ let client = !sdk ? await sdkForProject() :
2320
+ sdk;
2321
+ let apiPath = '/databases/{databaseId}/logs'.replace('{databaseId}', databaseId);
2322
+ let payload = {};
2323
+ if (typeof queries !== 'undefined') {
2324
+ payload['queries'] = queries;
2325
+ }
2326
+
2327
+ let response = undefined;
2328
+
2329
+ response = await client.call('get', apiPath, {
2330
+ }, payload);
2331
+
2332
+ if (parseOutput) {
2333
+ parse(response)
2334
+ }
2335
+
2336
+ return response;
2337
+
2338
+ }
2339
+
2340
+ /**
2341
+ * @typedef {Object} DatabasesGetDatabaseUsageRequestParams
2342
+ * @property {string} databaseId Database ID.
2343
+ * @property {DatabaseUsageRange} range 'Date range.
2344
+ * @property {boolean} overrideForCli
2345
+ * @property {boolean} parseOutput
2346
+ * @property {libClient | undefined} sdk
2347
+ */
2348
+
2349
+ /**
2350
+ * @param {DatabasesGetDatabaseUsageRequestParams} params
2351
+ */
2352
+ const databasesGetDatabaseUsage = async ({databaseId,range,parseOutput = true, overrideForCli = false, sdk = undefined, console}) => {
2353
+ let client = !sdk ? await sdkForProject() :
2354
+ sdk;
2355
+ let apiPath = '/databases/{databaseId}/usage'.replace('{databaseId}', databaseId);
2356
+ let payload = {};
2357
+ if (typeof range !== 'undefined') {
2358
+ payload['range'] = range;
2359
+ }
2360
+
2361
+ let response = undefined;
2362
+
2363
+ response = await client.call('get', apiPath, {
2364
+ }, payload);
2365
+
2366
+ if (parseOutput) {
2367
+ if(console) {
2368
+ showConsoleLink('databases', 'getDatabaseUsage', databaseId);
2369
+ } else {
2370
+ parse(response)
2371
+ }
2372
+ }
2373
+
2374
+ return response;
2375
+
2376
+ }
2377
+
2378
+ databases
2379
+ .command(`list`)
2380
+ .description(`Get a list of all databases from the current Appwrite project. You can use the search parameter to filter your results.`)
2381
+ .option(`--queries [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. You may filter on the following attributes: name`)
2382
+ .option(`--search <search>`, `Search term to filter your list results. Max length: 256 chars.`)
2383
+ .option(`--console`, `Get the resource console url`)
2384
+ .action(actionRunner(databasesList))
2385
+
2386
+ databases
2387
+ .command(`create`)
2388
+ .description(`Create a new Database. `)
2389
+ .requiredOption(`--database-id <database-id>`, `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.`)
2390
+ .requiredOption(`--name <name>`, `Database name. Max length: 128 chars.`)
2391
+ .option(`--enabled [value]`, `Is the database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled.`, (value) => value === undefined ? true : parseBool(value))
2392
+ .action(actionRunner(databasesCreate))
2393
+
2394
+ databases
2395
+ .command(`get-usage`)
2396
+ .description(`Get usage metrics and statistics for all databases in the project. You can view the total number of databases, collections, documents, and storage usage. The response includes both current totals and historical data over time. Use the optional range parameter to specify the time window for historical data: 24h (last 24 hours), 30d (last 30 days), or 90d (last 90 days). If not specified, range defaults to 30 days.`)
2397
+ .option(`--range <range>`, `'Date range.`)
2398
+ .action(actionRunner(databasesGetUsage))
2399
+
2400
+ databases
2401
+ .command(`get`)
2402
+ .description(`Get a database by its unique ID. This endpoint response returns a JSON object with the database metadata.`)
2403
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2404
+ .option(`--console`, `Get the resource console url`)
2405
+ .action(actionRunner(databasesGet))
2406
+
2407
+ databases
2408
+ .command(`update`)
2409
+ .description(`Update a database by its unique ID.`)
2410
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2411
+ .requiredOption(`--name <name>`, `Database name. Max length: 128 chars.`)
2412
+ .option(`--enabled [value]`, `Is database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled.`, (value) => value === undefined ? true : parseBool(value))
2413
+ .action(actionRunner(databasesUpdate))
2414
+
2415
+ databases
2416
+ .command(`delete`)
2417
+ .description(`Delete a database by its unique ID. Only API keys with with databases.write scope can delete a database.`)
2418
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2419
+ .action(actionRunner(databasesDelete))
2420
+
2421
+ databases
2422
+ .command(`list-collections`)
2423
+ .description(`Get a list of all collections that belong to the provided databaseId. You can use the search parameter to filter your results.`)
2424
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2425
+ .option(`--queries [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. You may filter on the following attributes: name, enabled, documentSecurity`)
2426
+ .option(`--search <search>`, `Search term to filter your list results. Max length: 256 chars.`)
2427
+ .option(`--console`, `Get the resource console url`)
2428
+ .action(actionRunner(databasesListCollections))
2429
+
2430
+ databases
2431
+ .command(`create-collection`)
2432
+ .description(`Create a new Collection. Before using this route, you should create a new database resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console.`)
2433
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2434
+ .requiredOption(`--collection-id <collection-id>`, `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.`)
2435
+ .requiredOption(`--name <name>`, `Collection name. Max length: 128 chars.`)
2436
+ .option(`--permissions [permissions...]`, `An array of permissions strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).`)
2437
+ .option(`--document-security [value]`, `Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions).`, (value) => value === undefined ? true : parseBool(value))
2438
+ .option(`--enabled [value]`, `Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled.`, (value) => value === undefined ? true : parseBool(value))
2439
+ .action(actionRunner(databasesCreateCollection))
2440
+
2441
+ databases
2442
+ .command(`get-collection`)
2443
+ .description(`Get a collection by its unique ID. This endpoint response returns a JSON object with the collection metadata.`)
2444
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2445
+ .requiredOption(`--collection-id <collection-id>`, `Collection ID.`)
2446
+ .option(`--console`, `Get the resource console url`)
2447
+ .action(actionRunner(databasesGetCollection))
2448
+
2449
+ databases
2450
+ .command(`update-collection`)
2451
+ .description(`Update a collection by its unique ID.`)
2452
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2453
+ .requiredOption(`--collection-id <collection-id>`, `Collection ID.`)
2454
+ .requiredOption(`--name <name>`, `Collection name. Max length: 128 chars.`)
2455
+ .option(`--permissions [permissions...]`, `An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).`)
2456
+ .option(`--document-security [value]`, `Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions).`, (value) => value === undefined ? true : parseBool(value))
2457
+ .option(`--enabled [value]`, `Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled.`, (value) => value === undefined ? true : parseBool(value))
2458
+ .action(actionRunner(databasesUpdateCollection))
2459
+
2460
+ databases
2461
+ .command(`delete-collection`)
2462
+ .description(`Delete a collection by its unique ID. Only users with write permissions have access to delete this resource.`)
2463
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2464
+ .requiredOption(`--collection-id <collection-id>`, `Collection ID.`)
2465
+ .action(actionRunner(databasesDeleteCollection))
2466
+
2467
+ databases
2468
+ .command(`list-attributes`)
2469
+ .description(`List attributes in the collection.`)
2470
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2471
+ .requiredOption(`--collection-id <collection-id>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`)
2472
+ .option(`--queries [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. You may filter on the following attributes: key, type, size, required, array, status, error`)
2473
+ .option(`--console`, `Get the resource console url`)
2474
+ .action(actionRunner(databasesListAttributes))
2475
+
2476
+ databases
2477
+ .command(`create-boolean-attribute`)
2478
+ .description(`Create a boolean attribute. `)
2479
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2480
+ .requiredOption(`--collection-id <collection-id>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`)
2481
+ .requiredOption(`--key <key>`, `Attribute Key.`)
2482
+ .requiredOption(`--required [value]`, `Is attribute required?`, (value) => value === undefined ? true : parseBool(value))
2483
+ .option(`--xdefault [value]`, `Default value for attribute when not provided. Cannot be set when attribute is required.`, (value) => value === undefined ? true : parseBool(value))
2484
+ .option(`--array [value]`, `Is attribute an array?`, (value) => value === undefined ? true : parseBool(value))
2485
+ .action(actionRunner(databasesCreateBooleanAttribute))
2486
+
2487
+ databases
2488
+ .command(`update-boolean-attribute`)
2489
+ .description(`Update a boolean attribute. Changing the 'default' value will not update already existing documents.`)
2490
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2491
+ .requiredOption(`--collection-id <collection-id>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`)
2492
+ .requiredOption(`--key <key>`, `Attribute Key.`)
2493
+ .requiredOption(`--required [value]`, `Is attribute required?`, (value) => value === undefined ? true : parseBool(value))
2494
+ .option(`--xdefault [value]`, `Default value for attribute when not provided. Cannot be set when attribute is required.`, (value) => value === undefined ? true : parseBool(value))
2495
+ .option(`--new-key <new-key>`, `New attribute key.`)
2496
+ .action(actionRunner(databasesUpdateBooleanAttribute))
2497
+
2498
+ databases
2499
+ .command(`create-datetime-attribute`)
2500
+ .description(`Create a date time attribute according to the ISO 8601 standard.`)
2501
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2502
+ .requiredOption(`--collection-id <collection-id>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`)
2503
+ .requiredOption(`--key <key>`, `Attribute Key.`)
2504
+ .requiredOption(`--required [value]`, `Is attribute required?`, (value) => value === undefined ? true : parseBool(value))
2505
+ .option(`--xdefault <xdefault>`, `Default value for the attribute in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Cannot be set when attribute is required.`)
2506
+ .option(`--array [value]`, `Is attribute an array?`, (value) => value === undefined ? true : parseBool(value))
2507
+ .action(actionRunner(databasesCreateDatetimeAttribute))
2508
+
2509
+ databases
2510
+ .command(`update-datetime-attribute`)
2511
+ .description(`Update a date time attribute. Changing the 'default' value will not update already existing documents.`)
2512
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2513
+ .requiredOption(`--collection-id <collection-id>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`)
2514
+ .requiredOption(`--key <key>`, `Attribute Key.`)
2515
+ .requiredOption(`--required [value]`, `Is attribute required?`, (value) => value === undefined ? true : parseBool(value))
2516
+ .option(`--xdefault <xdefault>`, `Default value for attribute when not provided. Cannot be set when attribute is required.`)
2517
+ .option(`--new-key <new-key>`, `New attribute key.`)
2518
+ .action(actionRunner(databasesUpdateDatetimeAttribute))
2519
+
2520
+ databases
2521
+ .command(`create-email-attribute`)
2522
+ .description(`Create an email attribute. `)
2523
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2524
+ .requiredOption(`--collection-id <collection-id>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`)
2525
+ .requiredOption(`--key <key>`, `Attribute Key.`)
2526
+ .requiredOption(`--required [value]`, `Is attribute required?`, (value) => value === undefined ? true : parseBool(value))
2527
+ .option(`--xdefault <xdefault>`, `Default value for attribute when not provided. Cannot be set when attribute is required.`)
2528
+ .option(`--array [value]`, `Is attribute an array?`, (value) => value === undefined ? true : parseBool(value))
2529
+ .action(actionRunner(databasesCreateEmailAttribute))
2530
+
2531
+ databases
2532
+ .command(`update-email-attribute`)
2533
+ .description(`Update an email attribute. Changing the 'default' value will not update already existing documents. `)
2534
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2535
+ .requiredOption(`--collection-id <collection-id>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`)
2536
+ .requiredOption(`--key <key>`, `Attribute Key.`)
2537
+ .requiredOption(`--required [value]`, `Is attribute required?`, (value) => value === undefined ? true : parseBool(value))
2538
+ .option(`--xdefault <xdefault>`, `Default value for attribute when not provided. Cannot be set when attribute is required.`)
2539
+ .option(`--new-key <new-key>`, `New attribute key.`)
2540
+ .action(actionRunner(databasesUpdateEmailAttribute))
2541
+
2542
+ databases
2543
+ .command(`create-enum-attribute`)
2544
+ .description(`Create an enumeration attribute. The 'elements' param acts as a white-list of accepted values for this attribute. `)
2545
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2546
+ .requiredOption(`--collection-id <collection-id>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`)
2547
+ .requiredOption(`--key <key>`, `Attribute Key.`)
2548
+ .requiredOption(`--elements [elements...]`, `Array of elements in enumerated type. Uses length of longest element to determine size. Maximum of 100 elements are allowed, each 255 characters long.`)
2549
+ .requiredOption(`--required [value]`, `Is attribute required?`, (value) => value === undefined ? true : parseBool(value))
2550
+ .option(`--xdefault <xdefault>`, `Default value for attribute when not provided. Cannot be set when attribute is required.`)
2551
+ .option(`--array [value]`, `Is attribute an array?`, (value) => value === undefined ? true : parseBool(value))
2552
+ .action(actionRunner(databasesCreateEnumAttribute))
2553
+
2554
+ databases
2555
+ .command(`update-enum-attribute`)
2556
+ .description(`Update an enum attribute. Changing the 'default' value will not update already existing documents. `)
2557
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2558
+ .requiredOption(`--collection-id <collection-id>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`)
2559
+ .requiredOption(`--key <key>`, `Attribute Key.`)
2560
+ .requiredOption(`--elements [elements...]`, `Array of elements in enumerated type. Uses length of longest element to determine size. Maximum of 100 elements are allowed, each 255 characters long.`)
2561
+ .requiredOption(`--required [value]`, `Is attribute required?`, (value) => value === undefined ? true : parseBool(value))
2562
+ .option(`--xdefault <xdefault>`, `Default value for attribute when not provided. Cannot be set when attribute is required.`)
2563
+ .option(`--new-key <new-key>`, `New attribute key.`)
2564
+ .action(actionRunner(databasesUpdateEnumAttribute))
2565
+
2566
+ databases
2567
+ .command(`create-float-attribute`)
2568
+ .description(`Create a float attribute. Optionally, minimum and maximum values can be provided. `)
2569
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2570
+ .requiredOption(`--collection-id <collection-id>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`)
2571
+ .requiredOption(`--key <key>`, `Attribute Key.`)
2572
+ .requiredOption(`--required [value]`, `Is attribute required?`, (value) => value === undefined ? true : parseBool(value))
2573
+ .option(`--min <min>`, `Minimum value to enforce on new documents`, parseInteger)
2574
+ .option(`--max <max>`, `Maximum value to enforce on new documents`, parseInteger)
2575
+ .option(`--xdefault <xdefault>`, `Default value for attribute when not provided. Cannot be set when attribute is required.`, parseInteger)
2576
+ .option(`--array [value]`, `Is attribute an array?`, (value) => value === undefined ? true : parseBool(value))
2577
+ .action(actionRunner(databasesCreateFloatAttribute))
2578
+
2579
+ databases
2580
+ .command(`update-float-attribute`)
2581
+ .description(`Update a float attribute. Changing the 'default' value will not update already existing documents. `)
2582
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2583
+ .requiredOption(`--collection-id <collection-id>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`)
2584
+ .requiredOption(`--key <key>`, `Attribute Key.`)
2585
+ .requiredOption(`--required [value]`, `Is attribute required?`, (value) => value === undefined ? true : parseBool(value))
2586
+ .option(`--xdefault <xdefault>`, `Default value for attribute when not provided. Cannot be set when attribute is required.`, parseInteger)
2587
+ .option(`--min <min>`, `Minimum value to enforce on new documents`, parseInteger)
2588
+ .option(`--max <max>`, `Maximum value to enforce on new documents`, parseInteger)
2589
+ .option(`--new-key <new-key>`, `New attribute key.`)
2590
+ .action(actionRunner(databasesUpdateFloatAttribute))
2591
+
2592
+ databases
2593
+ .command(`create-integer-attribute`)
2594
+ .description(`Create an integer attribute. Optionally, minimum and maximum values can be provided. `)
2595
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2596
+ .requiredOption(`--collection-id <collection-id>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`)
2597
+ .requiredOption(`--key <key>`, `Attribute Key.`)
2598
+ .requiredOption(`--required [value]`, `Is attribute required?`, (value) => value === undefined ? true : parseBool(value))
2599
+ .option(`--min <min>`, `Minimum value to enforce on new documents`, parseInteger)
2600
+ .option(`--max <max>`, `Maximum value to enforce on new documents`, parseInteger)
2601
+ .option(`--xdefault <xdefault>`, `Default value for attribute when not provided. Cannot be set when attribute is required.`, parseInteger)
2602
+ .option(`--array [value]`, `Is attribute an array?`, (value) => value === undefined ? true : parseBool(value))
2603
+ .action(actionRunner(databasesCreateIntegerAttribute))
2604
+
2605
+ databases
2606
+ .command(`update-integer-attribute`)
2607
+ .description(`Update an integer attribute. Changing the 'default' value will not update already existing documents. `)
2608
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2609
+ .requiredOption(`--collection-id <collection-id>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`)
2610
+ .requiredOption(`--key <key>`, `Attribute Key.`)
2611
+ .requiredOption(`--required [value]`, `Is attribute required?`, (value) => value === undefined ? true : parseBool(value))
2612
+ .option(`--xdefault <xdefault>`, `Default value for attribute when not provided. Cannot be set when attribute is required.`, parseInteger)
2613
+ .option(`--min <min>`, `Minimum value to enforce on new documents`, parseInteger)
2614
+ .option(`--max <max>`, `Maximum value to enforce on new documents`, parseInteger)
2615
+ .option(`--new-key <new-key>`, `New attribute key.`)
2616
+ .action(actionRunner(databasesUpdateIntegerAttribute))
2617
+
2618
+ databases
2619
+ .command(`create-ip-attribute`)
2620
+ .description(`Create IP address attribute. `)
2621
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2622
+ .requiredOption(`--collection-id <collection-id>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`)
2623
+ .requiredOption(`--key <key>`, `Attribute Key.`)
2624
+ .requiredOption(`--required [value]`, `Is attribute required?`, (value) => value === undefined ? true : parseBool(value))
2625
+ .option(`--xdefault <xdefault>`, `Default value for attribute when not provided. Cannot be set when attribute is required.`)
2626
+ .option(`--array [value]`, `Is attribute an array?`, (value) => value === undefined ? true : parseBool(value))
2627
+ .action(actionRunner(databasesCreateIpAttribute))
2628
+
2629
+ databases
2630
+ .command(`update-ip-attribute`)
2631
+ .description(`Update an ip attribute. Changing the 'default' value will not update already existing documents. `)
2632
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2633
+ .requiredOption(`--collection-id <collection-id>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`)
2634
+ .requiredOption(`--key <key>`, `Attribute Key.`)
2635
+ .requiredOption(`--required [value]`, `Is attribute required?`, (value) => value === undefined ? true : parseBool(value))
2636
+ .option(`--xdefault <xdefault>`, `Default value for attribute when not provided. Cannot be set when attribute is required.`)
2637
+ .option(`--new-key <new-key>`, `New attribute key.`)
2638
+ .action(actionRunner(databasesUpdateIpAttribute))
2639
+
2640
+ databases
2641
+ .command(`create-relationship-attribute`)
2642
+ .description(`Create relationship attribute. [Learn more about relationship attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). `)
2643
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2644
+ .requiredOption(`--collection-id <collection-id>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`)
2645
+ .requiredOption(`--related-collection-id <related-collection-id>`, `Related Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`)
2646
+ .requiredOption(`--type <type>`, `Relation type`)
2647
+ .option(`--two-way [value]`, `Is Two Way?`, (value) => value === undefined ? true : parseBool(value))
2648
+ .option(`--key <key>`, `Attribute Key.`)
2649
+ .option(`--two-way-key <two-way-key>`, `Two Way Attribute Key.`)
2650
+ .option(`--on-delete <on-delete>`, `Constraints option`)
2651
+ .action(actionRunner(databasesCreateRelationshipAttribute))
2652
+
2653
+ databases
2654
+ .command(`create-string-attribute`)
2655
+ .description(`Create a string attribute. `)
2656
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2657
+ .requiredOption(`--collection-id <collection-id>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`)
2658
+ .requiredOption(`--key <key>`, `Attribute Key.`)
2659
+ .requiredOption(`--size <size>`, `Attribute size for text attributes, in number of characters.`, parseInteger)
2660
+ .requiredOption(`--required [value]`, `Is attribute required?`, (value) => value === undefined ? true : parseBool(value))
2661
+ .option(`--xdefault <xdefault>`, `Default value for attribute when not provided. Cannot be set when attribute is required.`)
2662
+ .option(`--array [value]`, `Is attribute an array?`, (value) => value === undefined ? true : parseBool(value))
2663
+ .option(`--encrypt [value]`, `Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried.`, (value) => value === undefined ? true : parseBool(value))
2664
+ .action(actionRunner(databasesCreateStringAttribute))
2665
+
2666
+ databases
2667
+ .command(`update-string-attribute`)
2668
+ .description(`Update a string attribute. Changing the 'default' value will not update already existing documents. `)
2669
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2670
+ .requiredOption(`--collection-id <collection-id>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`)
2671
+ .requiredOption(`--key <key>`, `Attribute Key.`)
2672
+ .requiredOption(`--required [value]`, `Is attribute required?`, (value) => value === undefined ? true : parseBool(value))
2673
+ .option(`--xdefault <xdefault>`, `Default value for attribute when not provided. Cannot be set when attribute is required.`)
2674
+ .option(`--size <size>`, `Maximum size of the string attribute.`, parseInteger)
2675
+ .option(`--new-key <new-key>`, `New attribute key.`)
2676
+ .action(actionRunner(databasesUpdateStringAttribute))
2677
+
2678
+ databases
2679
+ .command(`create-url-attribute`)
2680
+ .description(`Create a URL attribute. `)
2681
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2682
+ .requiredOption(`--collection-id <collection-id>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`)
2683
+ .requiredOption(`--key <key>`, `Attribute Key.`)
2684
+ .requiredOption(`--required [value]`, `Is attribute required?`, (value) => value === undefined ? true : parseBool(value))
2685
+ .option(`--xdefault <xdefault>`, `Default value for attribute when not provided. Cannot be set when attribute is required.`)
2686
+ .option(`--array [value]`, `Is attribute an array?`, (value) => value === undefined ? true : parseBool(value))
2687
+ .action(actionRunner(databasesCreateUrlAttribute))
2688
+
2689
+ databases
2690
+ .command(`update-url-attribute`)
2691
+ .description(`Update an url attribute. Changing the 'default' value will not update already existing documents. `)
2692
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2693
+ .requiredOption(`--collection-id <collection-id>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`)
2694
+ .requiredOption(`--key <key>`, `Attribute Key.`)
2695
+ .requiredOption(`--required [value]`, `Is attribute required?`, (value) => value === undefined ? true : parseBool(value))
2696
+ .option(`--xdefault <xdefault>`, `Default value for attribute when not provided. Cannot be set when attribute is required.`)
2697
+ .option(`--new-key <new-key>`, `New attribute key.`)
2698
+ .action(actionRunner(databasesUpdateUrlAttribute))
2699
+
2700
+ databases
2701
+ .command(`get-attribute`)
2702
+ .description(`Get attribute by ID.`)
2703
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2704
+ .requiredOption(`--collection-id <collection-id>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`)
2705
+ .requiredOption(`--key <key>`, `Attribute Key.`)
2706
+ .action(actionRunner(databasesGetAttribute))
2707
+
2708
+ databases
2709
+ .command(`delete-attribute`)
2710
+ .description(`Deletes an attribute.`)
2711
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2712
+ .requiredOption(`--collection-id <collection-id>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`)
2713
+ .requiredOption(`--key <key>`, `Attribute Key.`)
2714
+ .action(actionRunner(databasesDeleteAttribute))
2715
+
2716
+ databases
2717
+ .command(`update-relationship-attribute`)
2718
+ .description(`Update relationship attribute. [Learn more about relationship attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). `)
2719
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2720
+ .requiredOption(`--collection-id <collection-id>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`)
2721
+ .requiredOption(`--key <key>`, `Attribute Key.`)
2722
+ .option(`--on-delete <on-delete>`, `Constraints option`)
2723
+ .option(`--new-key <new-key>`, `New attribute key.`)
2724
+ .action(actionRunner(databasesUpdateRelationshipAttribute))
2725
+
2726
+ databases
2727
+ .command(`list-documents`)
2728
+ .description(`Get a list of all the user's documents in a given collection. You can use the query params to filter your results.`)
2729
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2730
+ .requiredOption(`--collection-id <collection-id>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`)
2731
+ .option(`--queries [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.`)
2732
+ .option(`--console`, `Get the resource console url`)
2733
+ .action(actionRunner(databasesListDocuments))
2734
+
2735
+ databases
2736
+ .command(`create-document`)
2737
+ .description(`Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console.`)
2738
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2739
+ .requiredOption(`--collection-id <collection-id>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents.`)
2740
+ .requiredOption(`--document-id <document-id>`, `Document 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.`)
2741
+ .requiredOption(`--data <data>`, `Document data as JSON object.`)
2742
+ .option(`--permissions [permissions...]`, `An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).`)
2743
+ .action(actionRunner(databasesCreateDocument))
2744
+
2745
+ databases
2746
+ .command(`create-documents`)
2747
+ .description(`**WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions. Create new Documents. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console.`)
2748
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2749
+ .requiredOption(`--collection-id <collection-id>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents.`)
2750
+ .requiredOption(`--documents [documents...]`, `Array of documents data as JSON objects.`)
2751
+ .action(actionRunner(databasesCreateDocuments))
2752
+
2753
+ databases
2754
+ .command(`upsert-documents`)
2755
+ .description(`**WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions. Create or update Documents. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console.`)
2756
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2757
+ .requiredOption(`--collection-id <collection-id>`, `Collection ID.`)
2758
+ .requiredOption(`--documents [documents...]`, `Array of document data as JSON objects. May contain partial documents.`)
2759
+ .action(actionRunner(databasesUpsertDocuments))
2760
+
2761
+ databases
2762
+ .command(`update-documents`)
2763
+ .description(`**WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions. Update all documents that match your queries, if no queries are submitted then all documents are updated. You can pass only specific fields to be updated.`)
2764
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2765
+ .requiredOption(`--collection-id <collection-id>`, `Collection ID.`)
2766
+ .option(`--data <data>`, `Document data as JSON object. Include only attribute and value pairs to be updated.`)
2767
+ .option(`--queries [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.`)
2768
+ .action(actionRunner(databasesUpdateDocuments))
2769
+
2770
+ databases
2771
+ .command(`delete-documents`)
2772
+ .description(`**WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions. Bulk delete documents using queries, if no queries are passed then all documents are deleted.`)
2773
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2774
+ .requiredOption(`--collection-id <collection-id>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`)
2775
+ .option(`--queries [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.`)
2776
+ .action(actionRunner(databasesDeleteDocuments))
2777
+
2778
+ databases
2779
+ .command(`get-document`)
2780
+ .description(`Get a document by its unique ID. This endpoint response returns a JSON object with the document data.`)
2781
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2782
+ .requiredOption(`--collection-id <collection-id>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`)
2783
+ .requiredOption(`--document-id <document-id>`, `Document ID.`)
2784
+ .option(`--queries [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.`)
2785
+ .option(`--console`, `Get the resource console url`)
2786
+ .action(actionRunner(databasesGetDocument))
2787
+
2788
+ databases
2789
+ .command(`upsert-document`)
2790
+ .description(`**WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions. Create or update a Document. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console.`)
2791
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2792
+ .requiredOption(`--collection-id <collection-id>`, `Collection ID.`)
2793
+ .requiredOption(`--document-id <document-id>`, `Document ID.`)
2794
+ .requiredOption(`--data <data>`, `Document data as JSON object. Include all required attributes of the document to be created or updated.`)
2795
+ .option(`--permissions [permissions...]`, `An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).`)
2796
+ .action(actionRunner(databasesUpsertDocument))
2797
+
2798
+ databases
2799
+ .command(`update-document`)
2800
+ .description(`Update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated.`)
2801
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2802
+ .requiredOption(`--collection-id <collection-id>`, `Collection ID.`)
2803
+ .requiredOption(`--document-id <document-id>`, `Document ID.`)
2804
+ .option(`--data <data>`, `Document data as JSON object. Include only attribute and value pairs to be updated.`)
2805
+ .option(`--permissions [permissions...]`, `An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).`)
2806
+ .action(actionRunner(databasesUpdateDocument))
2807
+
2808
+ databases
2809
+ .command(`delete-document`)
2810
+ .description(`Delete a document by its unique ID.`)
2811
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2812
+ .requiredOption(`--collection-id <collection-id>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`)
2813
+ .requiredOption(`--document-id <document-id>`, `Document ID.`)
2814
+ .action(actionRunner(databasesDeleteDocument))
2815
+
2816
+ databases
2817
+ .command(`list-document-logs`)
2818
+ .description(`Get the document activity logs list by its unique ID.`)
2819
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2820
+ .requiredOption(`--collection-id <collection-id>`, `Collection ID.`)
2821
+ .requiredOption(`--document-id <document-id>`, `Document ID.`)
2822
+ .option(`--queries [queries...]`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset`)
2823
+ .action(actionRunner(databasesListDocumentLogs))
2824
+
2825
+ databases
2826
+ .command(`decrement-document-attribute`)
2827
+ .description(`Decrement a specific attribute of a document by a given value.`)
2828
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2829
+ .requiredOption(`--collection-id <collection-id>`, `Collection ID.`)
2830
+ .requiredOption(`--document-id <document-id>`, `Document ID.`)
2831
+ .requiredOption(`--attribute <attribute>`, `Attribute key.`)
2832
+ .option(`--value <value>`, `Value to decrement the attribute by. The value must be a number.`, parseInteger)
2833
+ .option(`--min <min>`, `Minimum value for the attribute. If the current value is lesser than this value, an exception will be thrown.`, parseInteger)
2834
+ .action(actionRunner(databasesDecrementDocumentAttribute))
2835
+
2836
+ databases
2837
+ .command(`increment-document-attribute`)
2838
+ .description(`Increment a specific attribute of a document by a given value.`)
2839
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2840
+ .requiredOption(`--collection-id <collection-id>`, `Collection ID.`)
2841
+ .requiredOption(`--document-id <document-id>`, `Document ID.`)
2842
+ .requiredOption(`--attribute <attribute>`, `Attribute key.`)
2843
+ .option(`--value <value>`, `Value to increment the attribute by. The value must be a number.`, parseInteger)
2844
+ .option(`--max <max>`, `Maximum value for the attribute. If the current value is greater than this value, an error will be thrown.`, parseInteger)
2845
+ .action(actionRunner(databasesIncrementDocumentAttribute))
2846
+
2847
+ databases
2848
+ .command(`list-indexes`)
2849
+ .description(`List indexes in the collection.`)
2850
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2851
+ .requiredOption(`--collection-id <collection-id>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`)
2852
+ .option(`--queries [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. You may filter on the following attributes: key, type, status, attributes, error`)
2853
+ .option(`--console`, `Get the resource console url`)
2854
+ .action(actionRunner(databasesListIndexes))
2855
+
2856
+ databases
2857
+ .command(`create-index`)
2858
+ .description(`Creates an index on the attributes listed. Your index should include all the attributes you will query in a single request. Attributes can be 'key', 'fulltext', and 'unique'.`)
2859
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2860
+ .requiredOption(`--collection-id <collection-id>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`)
2861
+ .requiredOption(`--key <key>`, `Index Key.`)
2862
+ .requiredOption(`--type <type>`, `Index type.`)
2863
+ .requiredOption(`--attributes [attributes...]`, `Array of attributes to index. Maximum of 100 attributes are allowed, each 32 characters long.`)
2864
+ .option(`--orders [orders...]`, `Array of index orders. Maximum of 100 orders are allowed.`)
2865
+ .option(`--lengths [lengths...]`, `Length of index. Maximum of 100`)
2866
+ .action(actionRunner(databasesCreateIndex))
2867
+
2868
+ databases
2869
+ .command(`get-index`)
2870
+ .description(`Get index by ID.`)
2871
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2872
+ .requiredOption(`--collection-id <collection-id>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`)
2873
+ .requiredOption(`--key <key>`, `Index Key.`)
2874
+ .action(actionRunner(databasesGetIndex))
2875
+
2876
+ databases
2877
+ .command(`delete-index`)
2878
+ .description(`Delete an index.`)
2879
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2880
+ .requiredOption(`--collection-id <collection-id>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`)
2881
+ .requiredOption(`--key <key>`, `Index Key.`)
2882
+ .action(actionRunner(databasesDeleteIndex))
2883
+
2884
+ databases
2885
+ .command(`list-collection-logs`)
2886
+ .description(`Get the collection activity logs list by its unique ID.`)
2887
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2888
+ .requiredOption(`--collection-id <collection-id>`, `Collection ID.`)
2889
+ .option(`--queries [queries...]`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset`)
2890
+ .action(actionRunner(databasesListCollectionLogs))
2891
+
2892
+ databases
2893
+ .command(`get-collection-usage`)
2894
+ .description(`Get usage metrics and statistics for a collection. Returning the total number of documents. The response includes both current totals and historical data over time. Use the optional range parameter to specify the time window for historical data: 24h (last 24 hours), 30d (last 30 days), or 90d (last 90 days). If not specified, range defaults to 30 days.`)
2895
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2896
+ .requiredOption(`--collection-id <collection-id>`, `Collection ID.`)
2897
+ .option(`--range <range>`, `Date range.`)
2898
+ .action(actionRunner(databasesGetCollectionUsage))
2899
+
2900
+ databases
2901
+ .command(`list-logs`)
2902
+ .description(`Get the database activity logs list by its unique ID.`)
2903
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2904
+ .option(`--queries [queries...]`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset`)
2905
+ .action(actionRunner(databasesListLogs))
2906
+
2907
+ databases
2908
+ .command(`get-database-usage`)
2909
+ .description(`Get usage metrics and statistics for a database. You can view the total number of collections, documents, and storage usage. The response includes both current totals and historical data over time. Use the optional range parameter to specify the time window for historical data: 24h (last 24 hours), 30d (last 30 days), or 90d (last 90 days). If not specified, range defaults to 30 days.`)
2910
+ .requiredOption(`--database-id <database-id>`, `Database ID.`)
2911
+ .option(`--range <range>`, `'Date range.`)
2912
+ .option(`--console`, `Get the resource console url`)
2913
+ .action(actionRunner(databasesGetDatabaseUsage))
2914
+
2915
+ module.exports = {
2916
+ databases,
2917
+ databasesList,
2918
+ databasesCreate,
2919
+ databasesGetUsage,
2920
+ databasesGet,
2921
+ databasesUpdate,
2922
+ databasesDelete,
2923
+ databasesListCollections,
2924
+ databasesCreateCollection,
2925
+ databasesGetCollection,
2926
+ databasesUpdateCollection,
2927
+ databasesDeleteCollection,
2928
+ databasesListAttributes,
2929
+ databasesCreateBooleanAttribute,
2930
+ databasesUpdateBooleanAttribute,
2931
+ databasesCreateDatetimeAttribute,
2932
+ databasesUpdateDatetimeAttribute,
2933
+ databasesCreateEmailAttribute,
2934
+ databasesUpdateEmailAttribute,
2935
+ databasesCreateEnumAttribute,
2936
+ databasesUpdateEnumAttribute,
2937
+ databasesCreateFloatAttribute,
2938
+ databasesUpdateFloatAttribute,
2939
+ databasesCreateIntegerAttribute,
2940
+ databasesUpdateIntegerAttribute,
2941
+ databasesCreateIpAttribute,
2942
+ databasesUpdateIpAttribute,
2943
+ databasesCreateRelationshipAttribute,
2944
+ databasesCreateStringAttribute,
2945
+ databasesUpdateStringAttribute,
2946
+ databasesCreateUrlAttribute,
2947
+ databasesUpdateUrlAttribute,
2948
+ databasesGetAttribute,
2949
+ databasesDeleteAttribute,
2950
+ databasesUpdateRelationshipAttribute,
2951
+ databasesListDocuments,
2952
+ databasesCreateDocument,
2953
+ databasesCreateDocuments,
2954
+ databasesUpsertDocuments,
2955
+ databasesUpdateDocuments,
2956
+ databasesDeleteDocuments,
2957
+ databasesGetDocument,
2958
+ databasesUpsertDocument,
2959
+ databasesUpdateDocument,
2960
+ databasesDeleteDocument,
2961
+ databasesListDocumentLogs,
2962
+ databasesDecrementDocumentAttribute,
2963
+ databasesIncrementDocumentAttribute,
2964
+ databasesListIndexes,
2965
+ databasesCreateIndex,
2966
+ databasesGetIndex,
2967
+ databasesDeleteIndex,
2968
+ databasesListCollectionLogs,
2969
+ databasesGetCollectionUsage,
2970
+ databasesListLogs,
2971
+ databasesGetDatabaseUsage
2972
+ };