@appwrite.io/console 0.6.4 → 0.7.0-rc.2

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 (408) hide show
  1. package/README.md +3 -3
  2. package/dist/cjs/sdk.js +2513 -2350
  3. package/dist/cjs/sdk.js.map +1 -1
  4. package/dist/esm/sdk.js +2513 -2350
  5. package/dist/esm/sdk.js.map +1 -1
  6. package/dist/iife/sdk.js +2513 -2350
  7. package/docs/examples/account/create-anonymous-session.md +1 -1
  8. package/docs/examples/account/create-email-password-session.md +1 -1
  9. package/docs/examples/account/create-email-token.md +1 -1
  10. package/docs/examples/account/create-j-w-t.md +1 -1
  11. package/docs/examples/account/create-magic-u-r-l-token.md +1 -1
  12. package/docs/examples/account/create-mfa-authenticator.md +1 -1
  13. package/docs/examples/account/create-mfa-challenge.md +1 -1
  14. package/docs/examples/account/create-mfa-recovery-codes.md +1 -1
  15. package/docs/examples/account/create-phone-token.md +1 -1
  16. package/docs/examples/account/create-phone-verification.md +1 -1
  17. package/docs/examples/account/create-push-target.md +1 -1
  18. package/docs/examples/account/create-recovery.md +1 -1
  19. package/docs/examples/account/create-session.md +1 -1
  20. package/docs/examples/account/create-verification.md +1 -1
  21. package/docs/examples/account/create.md +1 -1
  22. package/docs/examples/account/delete-identity.md +1 -1
  23. package/docs/examples/account/delete-mfa-authenticator.md +2 -3
  24. package/docs/examples/account/delete-push-target.md +1 -1
  25. package/docs/examples/account/delete-session.md +1 -1
  26. package/docs/examples/account/delete-sessions.md +1 -1
  27. package/docs/examples/account/delete.md +1 -1
  28. package/docs/examples/account/get-mfa-recovery-codes.md +1 -1
  29. package/docs/examples/account/get-prefs.md +1 -1
  30. package/docs/examples/account/get-session.md +1 -1
  31. package/docs/examples/account/get.md +1 -1
  32. package/docs/examples/account/list-identities.md +1 -1
  33. package/docs/examples/account/list-logs.md +1 -1
  34. package/docs/examples/account/list-mfa-factors.md +1 -1
  35. package/docs/examples/account/list-sessions.md +1 -1
  36. package/docs/examples/account/update-email.md +1 -1
  37. package/docs/examples/account/update-m-f-a.md +1 -1
  38. package/docs/examples/account/update-magic-u-r-l-session.md +1 -1
  39. package/docs/examples/account/update-mfa-authenticator.md +1 -1
  40. package/docs/examples/account/update-mfa-challenge.md +1 -1
  41. package/docs/examples/account/update-mfa-recovery-codes.md +1 -1
  42. package/docs/examples/account/update-name.md +1 -1
  43. package/docs/examples/account/update-password.md +1 -1
  44. package/docs/examples/account/update-phone-session.md +1 -1
  45. package/docs/examples/account/update-phone-verification.md +1 -1
  46. package/docs/examples/account/update-phone.md +1 -1
  47. package/docs/examples/account/update-prefs.md +1 -1
  48. package/docs/examples/account/update-push-target.md +1 -1
  49. package/docs/examples/account/update-recovery.md +1 -1
  50. package/docs/examples/account/update-session.md +1 -1
  51. package/docs/examples/account/update-status.md +1 -1
  52. package/docs/examples/account/update-verification.md +1 -1
  53. package/docs/examples/assistant/chat.md +1 -1
  54. package/docs/examples/console/variables.md +1 -1
  55. package/docs/examples/databases/create-boolean-attribute.md +1 -1
  56. package/docs/examples/databases/create-collection.md +1 -1
  57. package/docs/examples/databases/create-datetime-attribute.md +1 -1
  58. package/docs/examples/databases/create-document.md +1 -1
  59. package/docs/examples/databases/create-email-attribute.md +1 -1
  60. package/docs/examples/databases/create-enum-attribute.md +1 -1
  61. package/docs/examples/databases/create-float-attribute.md +1 -1
  62. package/docs/examples/databases/create-index.md +1 -1
  63. package/docs/examples/databases/create-integer-attribute.md +1 -1
  64. package/docs/examples/databases/create-ip-attribute.md +1 -1
  65. package/docs/examples/databases/create-relationship-attribute.md +1 -1
  66. package/docs/examples/databases/create-string-attribute.md +1 -1
  67. package/docs/examples/databases/create-url-attribute.md +1 -1
  68. package/docs/examples/databases/create.md +1 -1
  69. package/docs/examples/databases/delete-attribute.md +1 -1
  70. package/docs/examples/databases/delete-collection.md +1 -1
  71. package/docs/examples/databases/delete-document.md +1 -1
  72. package/docs/examples/databases/delete-index.md +1 -1
  73. package/docs/examples/databases/delete.md +1 -1
  74. package/docs/examples/databases/get-attribute.md +1 -1
  75. package/docs/examples/databases/get-collection-usage.md +1 -1
  76. package/docs/examples/databases/get-collection.md +1 -1
  77. package/docs/examples/databases/get-database-usage.md +1 -1
  78. package/docs/examples/databases/get-document.md +1 -1
  79. package/docs/examples/databases/get-index.md +1 -1
  80. package/docs/examples/databases/get-usage.md +1 -1
  81. package/docs/examples/databases/get.md +1 -1
  82. package/docs/examples/databases/list-attributes.md +1 -1
  83. package/docs/examples/databases/list-collection-logs.md +1 -1
  84. package/docs/examples/databases/list-collections.md +1 -1
  85. package/docs/examples/databases/list-document-logs.md +1 -1
  86. package/docs/examples/databases/list-documents.md +1 -1
  87. package/docs/examples/databases/list-indexes.md +1 -1
  88. package/docs/examples/databases/list-logs.md +1 -1
  89. package/docs/examples/databases/list.md +1 -1
  90. package/docs/examples/databases/update-boolean-attribute.md +1 -1
  91. package/docs/examples/databases/update-collection.md +1 -1
  92. package/docs/examples/databases/update-datetime-attribute.md +1 -1
  93. package/docs/examples/databases/update-document.md +1 -1
  94. package/docs/examples/databases/update-email-attribute.md +1 -1
  95. package/docs/examples/databases/update-enum-attribute.md +1 -1
  96. package/docs/examples/databases/update-float-attribute.md +1 -1
  97. package/docs/examples/databases/update-integer-attribute.md +1 -1
  98. package/docs/examples/databases/update-ip-attribute.md +1 -1
  99. package/docs/examples/databases/update-relationship-attribute.md +1 -1
  100. package/docs/examples/databases/update-string-attribute.md +1 -1
  101. package/docs/examples/databases/update-url-attribute.md +1 -1
  102. package/docs/examples/databases/update.md +1 -1
  103. package/docs/examples/functions/create-build.md +2 -2
  104. package/docs/examples/functions/create-deployment.md +1 -1
  105. package/docs/examples/functions/create-execution.md +3 -2
  106. package/docs/examples/functions/create-variable.md +1 -1
  107. package/docs/examples/functions/create.md +3 -3
  108. package/docs/examples/functions/delete-deployment.md +1 -1
  109. package/docs/examples/functions/delete-execution.md +14 -0
  110. package/docs/examples/functions/delete-variable.md +1 -1
  111. package/docs/examples/functions/delete.md +1 -1
  112. package/docs/examples/functions/{download-deployment.md → get-deployment-download.md} +1 -1
  113. package/docs/examples/functions/get-deployment.md +1 -1
  114. package/docs/examples/functions/get-execution.md +1 -1
  115. package/docs/examples/functions/get-function-usage.md +1 -1
  116. package/docs/examples/functions/{get-specifications.md → get-template.md} +4 -2
  117. package/docs/examples/functions/get-usage.md +1 -1
  118. package/docs/examples/functions/get-variable.md +1 -1
  119. package/docs/examples/functions/get.md +1 -1
  120. package/docs/examples/functions/list-deployments.md +1 -1
  121. package/docs/examples/functions/list-executions.md +1 -1
  122. package/docs/examples/functions/list-runtimes.md +1 -1
  123. package/docs/examples/functions/list-templates.md +16 -0
  124. package/docs/examples/functions/list-variables.md +1 -1
  125. package/docs/examples/functions/list.md +1 -1
  126. package/docs/examples/functions/update-deployment-build.md +14 -0
  127. package/docs/examples/functions/update-deployment.md +1 -1
  128. package/docs/examples/functions/update-variable.md +1 -1
  129. package/docs/examples/functions/update.md +3 -3
  130. package/docs/examples/graphql/mutation.md +1 -1
  131. package/docs/examples/graphql/query.md +1 -1
  132. package/docs/examples/health/get-antivirus.md +1 -1
  133. package/docs/examples/health/get-cache.md +1 -1
  134. package/docs/examples/health/get-certificate.md +1 -1
  135. package/docs/examples/health/get-d-b.md +1 -1
  136. package/docs/examples/health/get-failed-jobs.md +1 -1
  137. package/docs/examples/health/get-pub-sub.md +1 -1
  138. package/docs/examples/health/get-queue-builds.md +1 -1
  139. package/docs/examples/health/get-queue-certificates.md +1 -1
  140. package/docs/examples/health/get-queue-databases.md +1 -1
  141. package/docs/examples/health/get-queue-deletes.md +1 -1
  142. package/docs/examples/health/get-queue-functions.md +1 -1
  143. package/docs/examples/health/get-queue-logs.md +1 -1
  144. package/docs/examples/health/get-queue-mails.md +1 -1
  145. package/docs/examples/health/get-queue-messaging.md +1 -1
  146. package/docs/examples/health/get-queue-migrations.md +1 -1
  147. package/docs/examples/health/get-queue-usage-dump.md +1 -1
  148. package/docs/examples/health/get-queue-usage.md +1 -1
  149. package/docs/examples/health/get-queue-webhooks.md +1 -1
  150. package/docs/examples/health/get-queue.md +1 -1
  151. package/docs/examples/health/get-storage-local.md +1 -1
  152. package/docs/examples/health/get-storage.md +1 -1
  153. package/docs/examples/health/get-time.md +1 -1
  154. package/docs/examples/health/get.md +1 -1
  155. package/docs/examples/locale/get.md +1 -1
  156. package/docs/examples/locale/list-codes.md +1 -1
  157. package/docs/examples/locale/list-continents.md +1 -1
  158. package/docs/examples/locale/list-countries-e-u.md +1 -1
  159. package/docs/examples/locale/list-countries-phones.md +1 -1
  160. package/docs/examples/locale/list-countries.md +1 -1
  161. package/docs/examples/locale/list-currencies.md +1 -1
  162. package/docs/examples/locale/list-languages.md +1 -1
  163. package/docs/examples/messaging/create-apns-provider.md +1 -1
  164. package/docs/examples/messaging/create-email.md +1 -1
  165. package/docs/examples/messaging/create-fcm-provider.md +1 -1
  166. package/docs/examples/messaging/create-mailgun-provider.md +1 -1
  167. package/docs/examples/messaging/create-msg91provider.md +1 -1
  168. package/docs/examples/messaging/create-push.md +1 -1
  169. package/docs/examples/messaging/create-sendgrid-provider.md +1 -1
  170. package/docs/examples/messaging/create-sms.md +1 -1
  171. package/docs/examples/messaging/create-smtp-provider.md +1 -1
  172. package/docs/examples/messaging/create-subscriber.md +1 -1
  173. package/docs/examples/messaging/create-telesign-provider.md +1 -1
  174. package/docs/examples/messaging/create-textmagic-provider.md +1 -1
  175. package/docs/examples/messaging/create-topic.md +1 -1
  176. package/docs/examples/messaging/create-twilio-provider.md +1 -1
  177. package/docs/examples/messaging/create-vonage-provider.md +1 -1
  178. package/docs/examples/messaging/delete-provider.md +1 -1
  179. package/docs/examples/messaging/delete-subscriber.md +1 -1
  180. package/docs/examples/messaging/delete-topic.md +1 -1
  181. package/docs/examples/messaging/delete.md +1 -1
  182. package/docs/examples/messaging/get-message.md +1 -1
  183. package/docs/examples/messaging/get-provider.md +1 -1
  184. package/docs/examples/messaging/get-subscriber.md +1 -1
  185. package/docs/examples/messaging/get-topic.md +1 -1
  186. package/docs/examples/messaging/list-message-logs.md +1 -1
  187. package/docs/examples/messaging/list-messages.md +1 -1
  188. package/docs/examples/messaging/list-provider-logs.md +1 -1
  189. package/docs/examples/messaging/list-providers.md +1 -1
  190. package/docs/examples/messaging/list-subscriber-logs.md +1 -1
  191. package/docs/examples/messaging/list-subscribers.md +1 -1
  192. package/docs/examples/messaging/list-targets.md +1 -1
  193. package/docs/examples/messaging/list-topic-logs.md +1 -1
  194. package/docs/examples/messaging/list-topics.md +1 -1
  195. package/docs/examples/messaging/update-apns-provider.md +1 -1
  196. package/docs/examples/messaging/update-email.md +1 -1
  197. package/docs/examples/messaging/update-fcm-provider.md +1 -1
  198. package/docs/examples/messaging/update-mailgun-provider.md +1 -1
  199. package/docs/examples/messaging/update-msg91provider.md +1 -1
  200. package/docs/examples/messaging/update-push.md +1 -1
  201. package/docs/examples/messaging/update-sendgrid-provider.md +1 -1
  202. package/docs/examples/messaging/update-sms.md +1 -1
  203. package/docs/examples/messaging/update-smtp-provider.md +1 -1
  204. package/docs/examples/messaging/update-telesign-provider.md +1 -1
  205. package/docs/examples/messaging/update-textmagic-provider.md +1 -1
  206. package/docs/examples/messaging/update-topic.md +1 -1
  207. package/docs/examples/messaging/update-twilio-provider.md +1 -1
  208. package/docs/examples/messaging/update-vonage-provider.md +1 -1
  209. package/docs/examples/migrations/create-appwrite-migration.md +1 -1
  210. package/docs/examples/migrations/create-firebase-migration.md +1 -1
  211. package/docs/examples/migrations/create-firebase-o-auth-migration.md +1 -1
  212. package/docs/examples/migrations/create-n-host-migration.md +1 -1
  213. package/docs/examples/migrations/create-supabase-migration.md +1 -1
  214. package/docs/examples/migrations/delete-firebase-auth.md +1 -1
  215. package/docs/examples/migrations/delete.md +1 -1
  216. package/docs/examples/migrations/get-appwrite-report.md +1 -1
  217. package/docs/examples/migrations/get-firebase-report-o-auth.md +1 -1
  218. package/docs/examples/migrations/get-firebase-report.md +1 -1
  219. package/docs/examples/migrations/get-n-host-report.md +1 -1
  220. package/docs/examples/migrations/get-supabase-report.md +1 -1
  221. package/docs/examples/migrations/get.md +1 -1
  222. package/docs/examples/migrations/list-firebase-projects.md +1 -1
  223. package/docs/examples/migrations/list.md +1 -1
  224. package/docs/examples/migrations/retry.md +1 -1
  225. package/docs/examples/project/create-variable.md +1 -1
  226. package/docs/examples/project/delete-variable.md +1 -1
  227. package/docs/examples/project/get-usage.md +1 -1
  228. package/docs/examples/project/get-variable.md +1 -1
  229. package/docs/examples/project/list-variables.md +1 -1
  230. package/docs/examples/project/update-variable.md +1 -1
  231. package/docs/examples/projects/create-j-w-t.md +15 -0
  232. package/docs/examples/projects/create-key.md +1 -1
  233. package/docs/examples/projects/create-platform.md +1 -1
  234. package/docs/examples/projects/create-smtp-test.md +1 -1
  235. package/docs/examples/projects/create-webhook.md +1 -1
  236. package/docs/examples/projects/create.md +1 -1
  237. package/docs/examples/projects/delete-email-template.md +1 -1
  238. package/docs/examples/projects/delete-key.md +1 -1
  239. package/docs/examples/projects/delete-platform.md +1 -1
  240. package/docs/examples/projects/delete-sms-template.md +1 -1
  241. package/docs/examples/projects/delete-webhook.md +1 -1
  242. package/docs/examples/projects/delete.md +1 -1
  243. package/docs/examples/projects/get-email-template.md +1 -1
  244. package/docs/examples/projects/get-key.md +1 -1
  245. package/docs/examples/projects/get-platform.md +1 -1
  246. package/docs/examples/projects/get-sms-template.md +1 -1
  247. package/docs/examples/projects/get-webhook.md +1 -1
  248. package/docs/examples/projects/get.md +1 -1
  249. package/docs/examples/projects/list-keys.md +1 -1
  250. package/docs/examples/projects/list-platforms.md +1 -1
  251. package/docs/examples/projects/list-webhooks.md +1 -1
  252. package/docs/examples/projects/list.md +1 -1
  253. package/docs/examples/projects/update-api-status-all.md +1 -1
  254. package/docs/examples/projects/update-api-status.md +1 -1
  255. package/docs/examples/projects/update-auth-duration.md +1 -1
  256. package/docs/examples/projects/update-auth-limit.md +1 -1
  257. package/docs/examples/projects/update-auth-password-dictionary.md +1 -1
  258. package/docs/examples/projects/update-auth-password-history.md +1 -1
  259. package/docs/examples/projects/update-auth-sessions-limit.md +1 -1
  260. package/docs/examples/projects/update-auth-status.md +1 -1
  261. package/docs/examples/projects/update-email-template.md +1 -1
  262. package/docs/examples/projects/update-key.md +1 -1
  263. package/docs/examples/projects/update-mock-numbers.md +14 -0
  264. package/docs/examples/projects/update-o-auth2.md +1 -1
  265. package/docs/examples/projects/update-personal-data-check.md +1 -1
  266. package/docs/examples/projects/update-platform.md +1 -1
  267. package/docs/examples/projects/update-service-status-all.md +1 -1
  268. package/docs/examples/projects/update-service-status.md +1 -1
  269. package/docs/examples/projects/update-session-alerts.md +14 -0
  270. package/docs/examples/projects/update-sms-template.md +1 -1
  271. package/docs/examples/projects/update-smtp.md +1 -1
  272. package/docs/examples/projects/update-team.md +1 -1
  273. package/docs/examples/projects/update-webhook-signature.md +1 -1
  274. package/docs/examples/projects/update-webhook.md +1 -1
  275. package/docs/examples/projects/update.md +1 -1
  276. package/docs/examples/proxy/create-rule.md +1 -1
  277. package/docs/examples/proxy/delete-rule.md +1 -1
  278. package/docs/examples/proxy/get-rule.md +1 -1
  279. package/docs/examples/proxy/list-rules.md +1 -1
  280. package/docs/examples/proxy/update-rule-verification.md +1 -1
  281. package/docs/examples/storage/create-bucket.md +1 -1
  282. package/docs/examples/storage/create-file.md +1 -1
  283. package/docs/examples/storage/delete-bucket.md +1 -1
  284. package/docs/examples/storage/delete-file.md +1 -1
  285. package/docs/examples/storage/get-bucket-usage.md +1 -1
  286. package/docs/examples/storage/get-bucket.md +1 -1
  287. package/docs/examples/storage/get-file.md +1 -1
  288. package/docs/examples/storage/get-usage.md +1 -1
  289. package/docs/examples/storage/list-buckets.md +1 -1
  290. package/docs/examples/storage/list-files.md +1 -1
  291. package/docs/examples/storage/update-bucket.md +1 -1
  292. package/docs/examples/storage/update-file.md +1 -1
  293. package/docs/examples/teams/create-membership.md +1 -1
  294. package/docs/examples/teams/create.md +1 -1
  295. package/docs/examples/teams/delete-membership.md +1 -1
  296. package/docs/examples/teams/delete.md +1 -1
  297. package/docs/examples/teams/get-membership.md +1 -1
  298. package/docs/examples/teams/get-prefs.md +1 -1
  299. package/docs/examples/teams/get.md +1 -1
  300. package/docs/examples/teams/list-logs.md +1 -1
  301. package/docs/examples/teams/list-memberships.md +1 -1
  302. package/docs/examples/teams/list.md +1 -1
  303. package/docs/examples/teams/update-membership-status.md +1 -1
  304. package/docs/examples/teams/update-membership.md +1 -1
  305. package/docs/examples/teams/update-name.md +1 -1
  306. package/docs/examples/teams/update-prefs.md +1 -1
  307. package/docs/examples/users/create-argon2user.md +1 -1
  308. package/docs/examples/users/create-bcrypt-user.md +1 -1
  309. package/docs/examples/users/create-j-w-t.md +15 -0
  310. package/docs/examples/users/create-m-d5user.md +1 -1
  311. package/docs/examples/users/create-mfa-recovery-codes.md +1 -1
  312. package/docs/examples/users/create-p-h-pass-user.md +1 -1
  313. package/docs/examples/users/create-s-h-a-user.md +1 -1
  314. package/docs/examples/users/create-scrypt-modified-user.md +1 -1
  315. package/docs/examples/users/create-scrypt-user.md +1 -1
  316. package/docs/examples/users/create-session.md +1 -1
  317. package/docs/examples/users/create-target.md +1 -1
  318. package/docs/examples/users/create-token.md +1 -1
  319. package/docs/examples/users/create.md +1 -1
  320. package/docs/examples/users/delete-identity.md +1 -1
  321. package/docs/examples/users/delete-mfa-authenticator.md +1 -1
  322. package/docs/examples/users/delete-session.md +1 -1
  323. package/docs/examples/users/delete-sessions.md +1 -1
  324. package/docs/examples/users/delete-target.md +1 -1
  325. package/docs/examples/users/delete.md +1 -1
  326. package/docs/examples/users/get-mfa-recovery-codes.md +1 -1
  327. package/docs/examples/users/get-prefs.md +1 -1
  328. package/docs/examples/users/get-target.md +1 -1
  329. package/docs/examples/users/get-usage.md +1 -1
  330. package/docs/examples/users/get.md +1 -1
  331. package/docs/examples/users/list-identities.md +1 -1
  332. package/docs/examples/users/list-logs.md +1 -1
  333. package/docs/examples/users/list-memberships.md +1 -1
  334. package/docs/examples/users/list-mfa-factors.md +1 -1
  335. package/docs/examples/users/list-sessions.md +1 -1
  336. package/docs/examples/users/list-targets.md +1 -1
  337. package/docs/examples/users/list.md +1 -1
  338. package/docs/examples/users/update-email-verification.md +1 -1
  339. package/docs/examples/users/update-email.md +1 -1
  340. package/docs/examples/users/update-labels.md +1 -1
  341. package/docs/examples/users/update-mfa-recovery-codes.md +1 -1
  342. package/docs/examples/users/update-mfa.md +1 -1
  343. package/docs/examples/users/update-name.md +1 -1
  344. package/docs/examples/users/update-password.md +1 -1
  345. package/docs/examples/users/update-phone-verification.md +1 -1
  346. package/docs/examples/users/update-phone.md +1 -1
  347. package/docs/examples/users/update-prefs.md +1 -1
  348. package/docs/examples/users/update-status.md +1 -1
  349. package/docs/examples/users/update-target.md +1 -1
  350. package/docs/examples/vcs/create-repository-detection.md +1 -1
  351. package/docs/examples/vcs/create-repository.md +1 -1
  352. package/docs/examples/vcs/delete-installation.md +1 -1
  353. package/docs/examples/vcs/get-installation.md +1 -1
  354. package/docs/examples/vcs/get-repository-contents.md +15 -0
  355. package/docs/examples/vcs/get-repository.md +1 -1
  356. package/docs/examples/vcs/list-installations.md +1 -1
  357. package/docs/examples/vcs/list-repositories.md +1 -1
  358. package/docs/examples/vcs/list-repository-branches.md +1 -1
  359. package/docs/examples/vcs/update-external-deployments.md +1 -1
  360. package/package.json +1 -1
  361. package/src/client.ts +124 -66
  362. package/src/enums/email-template-type.ts +2 -0
  363. package/src/enums/platform-type.ts +2 -0
  364. package/src/enums/runtime.ts +1 -0
  365. package/src/index.ts +1 -1
  366. package/src/models.ts +230 -28
  367. package/src/services/account.ts +651 -644
  368. package/src/services/assistant.ts +19 -16
  369. package/src/services/avatars.ts +111 -152
  370. package/src/services/console.ts +19 -14
  371. package/src/services/databases.ts +628 -638
  372. package/src/services/functions.ts +435 -339
  373. package/src/services/graphql.ts +31 -24
  374. package/src/services/health.ts +299 -199
  375. package/src/services/locale.ts +113 -77
  376. package/src/services/messaging.ts +568 -583
  377. package/src/services/migrations.ts +199 -197
  378. package/src/services/project.ts +82 -65
  379. package/src/services/projects.ts +615 -459
  380. package/src/services/proxy.ts +68 -50
  381. package/src/services/storage.ts +198 -253
  382. package/src/services/teams.ts +198 -188
  383. package/src/services/users.ts +568 -478
  384. package/src/services/vcs.ts +149 -83
  385. package/types/client.d.ts +13 -17
  386. package/types/enums/email-template-type.d.ts +3 -1
  387. package/types/enums/platform-type.d.ts +3 -1
  388. package/types/enums/runtime.d.ts +2 -1
  389. package/types/index.d.ts +1 -1
  390. package/types/models.d.ts +230 -28
  391. package/types/services/account.d.ts +162 -317
  392. package/types/services/assistant.d.ts +4 -4
  393. package/types/services/avatars.d.ts +50 -84
  394. package/types/services/console.d.ts +4 -4
  395. package/types/services/databases.d.ts +143 -173
  396. package/types/services/functions.d.ts +112 -97
  397. package/types/services/graphql.d.ts +6 -6
  398. package/types/services/health.d.ts +64 -85
  399. package/types/services/locale.d.ts +28 -39
  400. package/types/services/messaging.d.ts +103 -104
  401. package/types/services/migrations.d.ts +34 -34
  402. package/types/services/project.d.ts +17 -20
  403. package/types/services/projects.d.ts +118 -87
  404. package/types/services/proxy.d.ts +13 -14
  405. package/types/services/storage.d.ts +53 -78
  406. package/types/services/teams.d.ts +53 -83
  407. package/types/services/users.d.ts +120 -157
  408. package/types/services/vcs.d.ts +31 -20
@@ -1,136 +1,147 @@
1
- import { Service } from '../service';
2
- import { AppwriteException, Client } from '../client';
1
+ import { AppwriteException, Client, type Payload, UploadProgress } from '../client';
3
2
  import type { Models } from '../models';
4
- import type { UploadProgress, Payload } from '../client';
5
3
  import { DatabaseUsageRange } from '../enums/database-usage-range';
6
4
  import { RelationshipType } from '../enums/relationship-type';
7
5
  import { RelationMutate } from '../enums/relation-mutate';
8
6
  import { IndexType } from '../enums/index-type';
9
7
 
10
- export class Databases extends Service {
8
+ export class Databases {
9
+ client: Client;
11
10
 
12
- constructor(client: Client)
13
- {
14
- super(client);
15
- }
11
+ constructor(client: Client) {
12
+ this.client = client;
13
+ }
16
14
 
17
15
  /**
18
16
  * List databases
19
17
  *
20
- * Get a list of all databases from the current Appwrite project. You can use
21
- * the search parameter to filter your results.
18
+ * Get a list of all databases from the current Appwrite project. You can use the search parameter to filter your results.
22
19
  *
23
20
  * @param {string[]} queries
24
21
  * @param {string} search
25
22
  * @throws {AppwriteException}
26
- * @returns {Promise}
27
- */
23
+ * @returns {Promise<Models.DatabaseList>}
24
+ */
28
25
  async list(queries?: string[], search?: string): Promise<Models.DatabaseList> {
29
26
  const apiPath = '/databases';
30
27
  const payload: Payload = {};
31
-
32
28
  if (typeof queries !== 'undefined') {
33
29
  payload['queries'] = queries;
34
30
  }
35
-
36
31
  if (typeof search !== 'undefined') {
37
32
  payload['search'] = search;
38
33
  }
39
-
40
34
  const uri = new URL(this.client.config.endpoint + apiPath);
41
- return await this.client.call('get', uri, {
35
+
36
+ const apiHeaders: { [header: string]: string } = {
42
37
  'content-type': 'application/json',
43
- }, payload);
44
- }
38
+ }
45
39
 
40
+ return await this.client.call(
41
+ 'get',
42
+ uri,
43
+ apiHeaders,
44
+ payload
45
+ );
46
+ }
46
47
  /**
47
48
  * Create database
48
49
  *
49
50
  * Create a new Database.
50
- *
51
+
51
52
  *
52
53
  * @param {string} databaseId
53
54
  * @param {string} name
54
55
  * @param {boolean} enabled
55
56
  * @throws {AppwriteException}
56
- * @returns {Promise}
57
- */
57
+ * @returns {Promise<Models.Database>}
58
+ */
58
59
  async create(databaseId: string, name: string, enabled?: boolean): Promise<Models.Database> {
59
60
  if (typeof databaseId === 'undefined') {
60
61
  throw new AppwriteException('Missing required parameter: "databaseId"');
61
62
  }
62
-
63
63
  if (typeof name === 'undefined') {
64
64
  throw new AppwriteException('Missing required parameter: "name"');
65
65
  }
66
-
67
66
  const apiPath = '/databases';
68
67
  const payload: Payload = {};
69
-
70
68
  if (typeof databaseId !== 'undefined') {
71
69
  payload['databaseId'] = databaseId;
72
70
  }
73
-
74
71
  if (typeof name !== 'undefined') {
75
72
  payload['name'] = name;
76
73
  }
77
-
78
74
  if (typeof enabled !== 'undefined') {
79
75
  payload['enabled'] = enabled;
80
76
  }
81
-
82
77
  const uri = new URL(this.client.config.endpoint + apiPath);
83
- return await this.client.call('post', uri, {
78
+
79
+ const apiHeaders: { [header: string]: string } = {
84
80
  'content-type': 'application/json',
85
- }, payload);
86
- }
81
+ }
87
82
 
83
+ return await this.client.call(
84
+ 'post',
85
+ uri,
86
+ apiHeaders,
87
+ payload
88
+ );
89
+ }
88
90
  /**
89
91
  * Get databases usage stats
90
92
  *
91
93
  *
92
94
  * @param {DatabaseUsageRange} range
93
95
  * @throws {AppwriteException}
94
- * @returns {Promise}
95
- */
96
+ * @returns {Promise<Models.UsageDatabases>}
97
+ */
96
98
  async getUsage(range?: DatabaseUsageRange): Promise<Models.UsageDatabases> {
97
99
  const apiPath = '/databases/usage';
98
100
  const payload: Payload = {};
99
-
100
101
  if (typeof range !== 'undefined') {
101
102
  payload['range'] = range;
102
103
  }
103
-
104
104
  const uri = new URL(this.client.config.endpoint + apiPath);
105
- return await this.client.call('get', uri, {
105
+
106
+ const apiHeaders: { [header: string]: string } = {
106
107
  'content-type': 'application/json',
107
- }, payload);
108
- }
108
+ }
109
109
 
110
+ return await this.client.call(
111
+ 'get',
112
+ uri,
113
+ apiHeaders,
114
+ payload
115
+ );
116
+ }
110
117
  /**
111
118
  * Get database
112
119
  *
113
- * Get a database by its unique ID. This endpoint response returns a JSON
114
- * object with the database metadata.
120
+ * Get a database by its unique ID. This endpoint response returns a JSON object with the database metadata.
115
121
  *
116
122
  * @param {string} databaseId
117
123
  * @throws {AppwriteException}
118
- * @returns {Promise}
119
- */
124
+ * @returns {Promise<Models.Database>}
125
+ */
120
126
  async get(databaseId: string): Promise<Models.Database> {
121
127
  if (typeof databaseId === 'undefined') {
122
128
  throw new AppwriteException('Missing required parameter: "databaseId"');
123
129
  }
124
-
125
130
  const apiPath = '/databases/{databaseId}'.replace('{databaseId}', databaseId);
126
131
  const payload: Payload = {};
127
-
128
132
  const uri = new URL(this.client.config.endpoint + apiPath);
129
- return await this.client.call('get', uri, {
133
+
134
+ const apiHeaders: { [header: string]: string } = {
130
135
  'content-type': 'application/json',
131
- }, payload);
132
- }
136
+ }
133
137
 
138
+ return await this.client.call(
139
+ 'get',
140
+ uri,
141
+ apiHeaders,
142
+ payload
143
+ );
144
+ }
134
145
  /**
135
146
  * Update database
136
147
  *
@@ -140,99 +151,104 @@ export class Databases extends Service {
140
151
  * @param {string} name
141
152
  * @param {boolean} enabled
142
153
  * @throws {AppwriteException}
143
- * @returns {Promise}
144
- */
154
+ * @returns {Promise<Models.Database>}
155
+ */
145
156
  async update(databaseId: string, name: string, enabled?: boolean): Promise<Models.Database> {
146
157
  if (typeof databaseId === 'undefined') {
147
158
  throw new AppwriteException('Missing required parameter: "databaseId"');
148
159
  }
149
-
150
160
  if (typeof name === 'undefined') {
151
161
  throw new AppwriteException('Missing required parameter: "name"');
152
162
  }
153
-
154
163
  const apiPath = '/databases/{databaseId}'.replace('{databaseId}', databaseId);
155
164
  const payload: Payload = {};
156
-
157
165
  if (typeof name !== 'undefined') {
158
166
  payload['name'] = name;
159
167
  }
160
-
161
168
  if (typeof enabled !== 'undefined') {
162
169
  payload['enabled'] = enabled;
163
170
  }
164
-
165
171
  const uri = new URL(this.client.config.endpoint + apiPath);
166
- return await this.client.call('put', uri, {
172
+
173
+ const apiHeaders: { [header: string]: string } = {
167
174
  'content-type': 'application/json',
168
- }, payload);
169
- }
175
+ }
170
176
 
177
+ return await this.client.call(
178
+ 'put',
179
+ uri,
180
+ apiHeaders,
181
+ payload
182
+ );
183
+ }
171
184
  /**
172
185
  * Delete database
173
186
  *
174
- * Delete a database by its unique ID. Only API keys with with databases.write
175
- * scope can delete a database.
187
+ * Delete a database by its unique ID. Only API keys with with databases.write scope can delete a database.
176
188
  *
177
189
  * @param {string} databaseId
178
190
  * @throws {AppwriteException}
179
- * @returns {Promise}
180
- */
191
+ * @returns {Promise<{}>}
192
+ */
181
193
  async delete(databaseId: string): Promise<{}> {
182
194
  if (typeof databaseId === 'undefined') {
183
195
  throw new AppwriteException('Missing required parameter: "databaseId"');
184
196
  }
185
-
186
197
  const apiPath = '/databases/{databaseId}'.replace('{databaseId}', databaseId);
187
198
  const payload: Payload = {};
188
-
189
199
  const uri = new URL(this.client.config.endpoint + apiPath);
190
- return await this.client.call('delete', uri, {
200
+
201
+ const apiHeaders: { [header: string]: string } = {
191
202
  'content-type': 'application/json',
192
- }, payload);
193
- }
203
+ }
194
204
 
205
+ return await this.client.call(
206
+ 'delete',
207
+ uri,
208
+ apiHeaders,
209
+ payload
210
+ );
211
+ }
195
212
  /**
196
213
  * List collections
197
214
  *
198
- * Get a list of all collections that belong to the provided databaseId. You
199
- * can use the search parameter to filter your results.
215
+ * Get a list of all collections that belong to the provided databaseId. You can use the search parameter to filter your results.
200
216
  *
201
217
  * @param {string} databaseId
202
218
  * @param {string[]} queries
203
219
  * @param {string} search
204
220
  * @throws {AppwriteException}
205
- * @returns {Promise}
206
- */
221
+ * @returns {Promise<Models.CollectionList>}
222
+ */
207
223
  async listCollections(databaseId: string, queries?: string[], search?: string): Promise<Models.CollectionList> {
208
224
  if (typeof databaseId === 'undefined') {
209
225
  throw new AppwriteException('Missing required parameter: "databaseId"');
210
226
  }
211
-
212
227
  const apiPath = '/databases/{databaseId}/collections'.replace('{databaseId}', databaseId);
213
228
  const payload: Payload = {};
214
-
215
229
  if (typeof queries !== 'undefined') {
216
230
  payload['queries'] = queries;
217
231
  }
218
-
219
232
  if (typeof search !== 'undefined') {
220
233
  payload['search'] = search;
221
234
  }
222
-
223
235
  const uri = new URL(this.client.config.endpoint + apiPath);
224
- return await this.client.call('get', uri, {
236
+
237
+ const apiHeaders: { [header: string]: string } = {
225
238
  'content-type': 'application/json',
226
- }, payload);
227
- }
239
+ }
228
240
 
241
+ return await this.client.call(
242
+ 'get',
243
+ uri,
244
+ apiHeaders,
245
+ payload
246
+ );
247
+ }
229
248
  /**
230
249
  * Create collection
231
250
  *
232
- * Create a new Collection. Before using this route, you should create a new
233
- * database resource using either a [server
234
- * integration](https://appwrite.io/docs/server/databases#databasesCreateCollection)
235
- * API or directly from your database console.
251
+ * 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.
236
252
  *
237
253
  * @param {string} databaseId
238
254
  * @param {string} collectionId
@@ -241,79 +257,80 @@ export class Databases extends Service {
241
257
  * @param {boolean} documentSecurity
242
258
  * @param {boolean} enabled
243
259
  * @throws {AppwriteException}
244
- * @returns {Promise}
245
- */
260
+ * @returns {Promise<Models.Collection>}
261
+ */
246
262
  async createCollection(databaseId: string, collectionId: string, name: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean): Promise<Models.Collection> {
247
263
  if (typeof databaseId === 'undefined') {
248
264
  throw new AppwriteException('Missing required parameter: "databaseId"');
249
265
  }
250
-
251
266
  if (typeof collectionId === 'undefined') {
252
267
  throw new AppwriteException('Missing required parameter: "collectionId"');
253
268
  }
254
-
255
269
  if (typeof name === 'undefined') {
256
270
  throw new AppwriteException('Missing required parameter: "name"');
257
271
  }
258
-
259
272
  const apiPath = '/databases/{databaseId}/collections'.replace('{databaseId}', databaseId);
260
273
  const payload: Payload = {};
261
-
262
274
  if (typeof collectionId !== 'undefined') {
263
275
  payload['collectionId'] = collectionId;
264
276
  }
265
-
266
277
  if (typeof name !== 'undefined') {
267
278
  payload['name'] = name;
268
279
  }
269
-
270
280
  if (typeof permissions !== 'undefined') {
271
281
  payload['permissions'] = permissions;
272
282
  }
273
-
274
283
  if (typeof documentSecurity !== 'undefined') {
275
284
  payload['documentSecurity'] = documentSecurity;
276
285
  }
277
-
278
286
  if (typeof enabled !== 'undefined') {
279
287
  payload['enabled'] = enabled;
280
288
  }
281
-
282
289
  const uri = new URL(this.client.config.endpoint + apiPath);
283
- return await this.client.call('post', uri, {
290
+
291
+ const apiHeaders: { [header: string]: string } = {
284
292
  'content-type': 'application/json',
285
- }, payload);
286
- }
293
+ }
287
294
 
295
+ return await this.client.call(
296
+ 'post',
297
+ uri,
298
+ apiHeaders,
299
+ payload
300
+ );
301
+ }
288
302
  /**
289
303
  * Get collection
290
304
  *
291
- * Get a collection by its unique ID. This endpoint response returns a JSON
292
- * object with the collection metadata.
305
+ * Get a collection by its unique ID. This endpoint response returns a JSON object with the collection metadata.
293
306
  *
294
307
  * @param {string} databaseId
295
308
  * @param {string} collectionId
296
309
  * @throws {AppwriteException}
297
- * @returns {Promise}
298
- */
310
+ * @returns {Promise<Models.Collection>}
311
+ */
299
312
  async getCollection(databaseId: string, collectionId: string): Promise<Models.Collection> {
300
313
  if (typeof databaseId === 'undefined') {
301
314
  throw new AppwriteException('Missing required parameter: "databaseId"');
302
315
  }
303
-
304
316
  if (typeof collectionId === 'undefined') {
305
317
  throw new AppwriteException('Missing required parameter: "collectionId"');
306
318
  }
307
-
308
319
  const apiPath = '/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
309
320
  const payload: Payload = {};
310
-
311
321
  const uri = new URL(this.client.config.endpoint + apiPath);
312
- return await this.client.call('get', uri, {
322
+
323
+ const apiHeaders: { [header: string]: string } = {
313
324
  'content-type': 'application/json',
314
- }, payload);
315
- }
325
+ }
316
326
 
327
+ return await this.client.call(
328
+ 'get',
329
+ uri,
330
+ apiHeaders,
331
+ payload
332
+ );
333
+ }
317
334
  /**
318
335
  * Update collection
319
336
  *
@@ -326,75 +343,77 @@ export class Databases extends Service {
326
343
  * @param {boolean} documentSecurity
327
344
  * @param {boolean} enabled
328
345
  * @throws {AppwriteException}
329
- * @returns {Promise}
330
- */
346
+ * @returns {Promise<Models.Collection>}
347
+ */
331
348
  async updateCollection(databaseId: string, collectionId: string, name: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean): Promise<Models.Collection> {
332
349
  if (typeof databaseId === 'undefined') {
333
350
  throw new AppwriteException('Missing required parameter: "databaseId"');
334
351
  }
335
-
336
352
  if (typeof collectionId === 'undefined') {
337
353
  throw new AppwriteException('Missing required parameter: "collectionId"');
338
354
  }
339
-
340
355
  if (typeof name === 'undefined') {
341
356
  throw new AppwriteException('Missing required parameter: "name"');
342
357
  }
343
-
344
358
  const apiPath = '/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
345
359
  const payload: Payload = {};
346
-
347
360
  if (typeof name !== 'undefined') {
348
361
  payload['name'] = name;
349
362
  }
350
-
351
363
  if (typeof permissions !== 'undefined') {
352
364
  payload['permissions'] = permissions;
353
365
  }
354
-
355
366
  if (typeof documentSecurity !== 'undefined') {
356
367
  payload['documentSecurity'] = documentSecurity;
357
368
  }
358
-
359
369
  if (typeof enabled !== 'undefined') {
360
370
  payload['enabled'] = enabled;
361
371
  }
362
-
363
372
  const uri = new URL(this.client.config.endpoint + apiPath);
364
- return await this.client.call('put', uri, {
373
+
374
+ const apiHeaders: { [header: string]: string } = {
365
375
  'content-type': 'application/json',
366
- }, payload);
367
- }
376
+ }
368
377
 
378
+ return await this.client.call(
379
+ 'put',
380
+ uri,
381
+ apiHeaders,
382
+ payload
383
+ );
384
+ }
369
385
  /**
370
386
  * Delete collection
371
387
  *
372
- * Delete a collection by its unique ID. Only users with write permissions
373
- * have access to delete this resource.
388
+ * Delete a collection by its unique ID. Only users with write permissions have access to delete this resource.
374
389
  *
375
390
  * @param {string} databaseId
376
391
  * @param {string} collectionId
377
392
  * @throws {AppwriteException}
378
- * @returns {Promise}
379
- */
393
+ * @returns {Promise<{}>}
394
+ */
380
395
  async deleteCollection(databaseId: string, collectionId: string): Promise<{}> {
381
396
  if (typeof databaseId === 'undefined') {
382
397
  throw new AppwriteException('Missing required parameter: "databaseId"');
383
398
  }
384
-
385
399
  if (typeof collectionId === 'undefined') {
386
400
  throw new AppwriteException('Missing required parameter: "collectionId"');
387
401
  }
388
-
389
402
  const apiPath = '/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
390
403
  const payload: Payload = {};
391
-
392
404
  const uri = new URL(this.client.config.endpoint + apiPath);
393
- return await this.client.call('delete', uri, {
405
+
406
+ const apiHeaders: { [header: string]: string } = {
394
407
  'content-type': 'application/json',
395
- }, payload);
396
- }
408
+ }
397
409
 
410
+ return await this.client.call(
411
+ 'delete',
412
+ uri,
413
+ apiHeaders,
414
+ payload
415
+ );
416
+ }
398
417
  /**
399
418
  * List attributes
400
419
  *
@@ -404,35 +423,38 @@ export class Databases extends Service {
404
423
  * @param {string} collectionId
405
424
  * @param {string[]} queries
406
425
  * @throws {AppwriteException}
407
- * @returns {Promise}
408
- */
426
+ * @returns {Promise<Models.AttributeList>}
427
+ */
409
428
  async listAttributes(databaseId: string, collectionId: string, queries?: string[]): Promise<Models.AttributeList> {
410
429
  if (typeof databaseId === 'undefined') {
411
430
  throw new AppwriteException('Missing required parameter: "databaseId"');
412
431
  }
413
-
414
432
  if (typeof collectionId === 'undefined') {
415
433
  throw new AppwriteException('Missing required parameter: "collectionId"');
416
434
  }
417
-
418
435
  const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
419
436
  const payload: Payload = {};
420
-
421
437
  if (typeof queries !== 'undefined') {
422
438
  payload['queries'] = queries;
423
439
  }
424
-
425
440
  const uri = new URL(this.client.config.endpoint + apiPath);
426
- return await this.client.call('get', uri, {
441
+
442
+ const apiHeaders: { [header: string]: string } = {
427
443
  'content-type': 'application/json',
428
- }, payload);
429
- }
444
+ }
430
445
 
446
+ return await this.client.call(
447
+ 'get',
448
+ uri,
449
+ apiHeaders,
450
+ payload
451
+ );
452
+ }
431
453
  /**
432
454
  * Create boolean attribute
433
455
  *
434
456
  * Create a boolean attribute.
435
- *
457
+
436
458
  *
437
459
  * @param {string} databaseId
438
460
  * @param {string} collectionId
@@ -441,55 +463,52 @@ export class Databases extends Service {
441
463
  * @param {boolean} xdefault
442
464
  * @param {boolean} array
443
465
  * @throws {AppwriteException}
444
- * @returns {Promise}
445
- */
466
+ * @returns {Promise<Models.AttributeBoolean>}
467
+ */
446
468
  async createBooleanAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean, array?: boolean): Promise<Models.AttributeBoolean> {
447
469
  if (typeof databaseId === 'undefined') {
448
470
  throw new AppwriteException('Missing required parameter: "databaseId"');
449
471
  }
450
-
451
472
  if (typeof collectionId === 'undefined') {
452
473
  throw new AppwriteException('Missing required parameter: "collectionId"');
453
474
  }
454
-
455
475
  if (typeof key === 'undefined') {
456
476
  throw new AppwriteException('Missing required parameter: "key"');
457
477
  }
458
-
459
478
  if (typeof required === 'undefined') {
460
479
  throw new AppwriteException('Missing required parameter: "required"');
461
480
  }
462
-
463
481
  const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/boolean'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
464
482
  const payload: Payload = {};
465
-
466
483
  if (typeof key !== 'undefined') {
467
484
  payload['key'] = key;
468
485
  }
469
-
470
486
  if (typeof required !== 'undefined') {
471
487
  payload['required'] = required;
472
488
  }
473
-
474
489
  if (typeof xdefault !== 'undefined') {
475
490
  payload['default'] = xdefault;
476
491
  }
477
-
478
492
  if (typeof array !== 'undefined') {
479
493
  payload['array'] = array;
480
494
  }
481
-
482
495
  const uri = new URL(this.client.config.endpoint + apiPath);
483
- return await this.client.call('post', uri, {
496
+
497
+ const apiHeaders: { [header: string]: string } = {
484
498
  'content-type': 'application/json',
485
- }, payload);
486
- }
499
+ }
487
500
 
501
+ return await this.client.call(
502
+ 'post',
503
+ uri,
504
+ apiHeaders,
505
+ payload
506
+ );
507
+ }
488
508
  /**
489
509
  * Update boolean attribute
490
510
  *
491
- * Update a boolean attribute. Changing the `default` value will not update
492
- * already existing documents.
511
+ * Update a boolean attribute. Changing the `default` value will not update already existing documents.
493
512
  *
494
513
  * @param {string} databaseId
495
514
  * @param {string} collectionId
@@ -497,46 +516,45 @@ export class Databases extends Service {
497
516
  * @param {boolean} required
498
517
  * @param {boolean} xdefault
499
518
  * @throws {AppwriteException}
500
- * @returns {Promise}
501
- */
519
+ * @returns {Promise<Models.AttributeBoolean>}
520
+ */
502
521
  async updateBooleanAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean): Promise<Models.AttributeBoolean> {
503
522
  if (typeof databaseId === 'undefined') {
504
523
  throw new AppwriteException('Missing required parameter: "databaseId"');
505
524
  }
506
-
507
525
  if (typeof collectionId === 'undefined') {
508
526
  throw new AppwriteException('Missing required parameter: "collectionId"');
509
527
  }
510
-
511
528
  if (typeof key === 'undefined') {
512
529
  throw new AppwriteException('Missing required parameter: "key"');
513
530
  }
514
-
515
531
  if (typeof required === 'undefined') {
516
532
  throw new AppwriteException('Missing required parameter: "required"');
517
533
  }
518
-
519
534
  if (typeof xdefault === 'undefined') {
520
535
  throw new AppwriteException('Missing required parameter: "xdefault"');
521
536
  }
522
-
523
537
  const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/boolean/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
524
538
  const payload: Payload = {};
525
-
526
539
  if (typeof required !== 'undefined') {
527
540
  payload['required'] = required;
528
541
  }
529
-
530
542
  if (typeof xdefault !== 'undefined') {
531
543
  payload['default'] = xdefault;
532
544
  }
533
-
534
545
  const uri = new URL(this.client.config.endpoint + apiPath);
535
- return await this.client.call('patch', uri, {
546
+
547
+ const apiHeaders: { [header: string]: string } = {
536
548
  'content-type': 'application/json',
537
- }, payload);
538
- }
549
+ }
539
550
 
551
+ return await this.client.call(
552
+ 'patch',
553
+ uri,
554
+ apiHeaders,
555
+ payload
556
+ );
557
+ }
540
558
  /**
541
559
  * Create datetime attribute
542
560
  *
@@ -549,55 +567,52 @@ export class Databases extends Service {
549
567
  * @param {string} xdefault
550
568
  * @param {boolean} array
551
569
  * @throws {AppwriteException}
552
- * @returns {Promise}
553
- */
570
+ * @returns {Promise<Models.AttributeDatetime>}
571
+ */
554
572
  async createDatetimeAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeDatetime> {
555
573
  if (typeof databaseId === 'undefined') {
556
574
  throw new AppwriteException('Missing required parameter: "databaseId"');
557
575
  }
558
-
559
576
  if (typeof collectionId === 'undefined') {
560
577
  throw new AppwriteException('Missing required parameter: "collectionId"');
561
578
  }
562
-
563
579
  if (typeof key === 'undefined') {
564
580
  throw new AppwriteException('Missing required parameter: "key"');
565
581
  }
566
-
567
582
  if (typeof required === 'undefined') {
568
583
  throw new AppwriteException('Missing required parameter: "required"');
569
584
  }
570
-
571
585
  const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/datetime'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
572
586
  const payload: Payload = {};
573
-
574
587
  if (typeof key !== 'undefined') {
575
588
  payload['key'] = key;
576
589
  }
577
-
578
590
  if (typeof required !== 'undefined') {
579
591
  payload['required'] = required;
580
592
  }
581
-
582
593
  if (typeof xdefault !== 'undefined') {
583
594
  payload['default'] = xdefault;
584
595
  }
585
-
586
596
  if (typeof array !== 'undefined') {
587
597
  payload['array'] = array;
588
598
  }
589
-
590
599
  const uri = new URL(this.client.config.endpoint + apiPath);
591
- return await this.client.call('post', uri, {
600
+
601
+ const apiHeaders: { [header: string]: string } = {
592
602
  'content-type': 'application/json',
593
- }, payload);
594
- }
603
+ }
595
604
 
605
+ return await this.client.call(
606
+ 'post',
607
+ uri,
608
+ apiHeaders,
609
+ payload
610
+ );
611
+ }
596
612
  /**
597
613
  * Update dateTime attribute
598
614
  *
599
- * Update a date time attribute. Changing the `default` value will not update
600
- * already existing documents.
615
+ * Update a date time attribute. Changing the `default` value will not update already existing documents.
601
616
  *
602
617
  * @param {string} databaseId
603
618
  * @param {string} collectionId
@@ -605,51 +620,50 @@ export class Databases extends Service {
605
620
  * @param {boolean} required
606
621
  * @param {string} xdefault
607
622
  * @throws {AppwriteException}
608
- * @returns {Promise}
609
- */
623
+ * @returns {Promise<Models.AttributeDatetime>}
624
+ */
610
625
  async updateDatetimeAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string): Promise<Models.AttributeDatetime> {
611
626
  if (typeof databaseId === 'undefined') {
612
627
  throw new AppwriteException('Missing required parameter: "databaseId"');
613
628
  }
614
-
615
629
  if (typeof collectionId === 'undefined') {
616
630
  throw new AppwriteException('Missing required parameter: "collectionId"');
617
631
  }
618
-
619
632
  if (typeof key === 'undefined') {
620
633
  throw new AppwriteException('Missing required parameter: "key"');
621
634
  }
622
-
623
635
  if (typeof required === 'undefined') {
624
636
  throw new AppwriteException('Missing required parameter: "required"');
625
637
  }
626
-
627
638
  if (typeof xdefault === 'undefined') {
628
639
  throw new AppwriteException('Missing required parameter: "xdefault"');
629
640
  }
630
-
631
641
  const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/datetime/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
632
642
  const payload: Payload = {};
633
-
634
643
  if (typeof required !== 'undefined') {
635
644
  payload['required'] = required;
636
645
  }
637
-
638
646
  if (typeof xdefault !== 'undefined') {
639
647
  payload['default'] = xdefault;
640
648
  }
641
-
642
649
  const uri = new URL(this.client.config.endpoint + apiPath);
643
- return await this.client.call('patch', uri, {
650
+
651
+ const apiHeaders: { [header: string]: string } = {
644
652
  'content-type': 'application/json',
645
- }, payload);
646
- }
653
+ }
647
654
 
655
+ return await this.client.call(
656
+ 'patch',
657
+ uri,
658
+ apiHeaders,
659
+ payload
660
+ );
661
+ }
648
662
  /**
649
663
  * Create email attribute
650
664
  *
651
665
  * Create an email attribute.
652
- *
666
+
653
667
  *
654
668
  * @param {string} databaseId
655
669
  * @param {string} collectionId
@@ -658,56 +672,53 @@ export class Databases extends Service {
658
672
  * @param {string} xdefault
659
673
  * @param {boolean} array
660
674
  * @throws {AppwriteException}
661
- * @returns {Promise}
662
- */
675
+ * @returns {Promise<Models.AttributeEmail>}
676
+ */
663
677
  async createEmailAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeEmail> {
664
678
  if (typeof databaseId === 'undefined') {
665
679
  throw new AppwriteException('Missing required parameter: "databaseId"');
666
680
  }
667
-
668
681
  if (typeof collectionId === 'undefined') {
669
682
  throw new AppwriteException('Missing required parameter: "collectionId"');
670
683
  }
671
-
672
684
  if (typeof key === 'undefined') {
673
685
  throw new AppwriteException('Missing required parameter: "key"');
674
686
  }
675
-
676
687
  if (typeof required === 'undefined') {
677
688
  throw new AppwriteException('Missing required parameter: "required"');
678
689
  }
679
-
680
690
  const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/email'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
681
691
  const payload: Payload = {};
682
-
683
692
  if (typeof key !== 'undefined') {
684
693
  payload['key'] = key;
685
694
  }
686
-
687
695
  if (typeof required !== 'undefined') {
688
696
  payload['required'] = required;
689
697
  }
690
-
691
698
  if (typeof xdefault !== 'undefined') {
692
699
  payload['default'] = xdefault;
693
700
  }
694
-
695
701
  if (typeof array !== 'undefined') {
696
702
  payload['array'] = array;
697
703
  }
698
-
699
704
  const uri = new URL(this.client.config.endpoint + apiPath);
700
- return await this.client.call('post', uri, {
705
+
706
+ const apiHeaders: { [header: string]: string } = {
701
707
  'content-type': 'application/json',
702
- }, payload);
703
- }
708
+ }
704
709
 
710
+ return await this.client.call(
711
+ 'post',
712
+ uri,
713
+ apiHeaders,
714
+ payload
715
+ );
716
+ }
705
717
  /**
706
718
  * Update email attribute
707
719
  *
708
- * Update an email attribute. Changing the `default` value will not update
709
- * already existing documents.
710
- *
720
+ * Update an email attribute. Changing the `default` value will not update already existing documents.
721
+
711
722
  *
712
723
  * @param {string} databaseId
713
724
  * @param {string} collectionId
@@ -715,52 +726,50 @@ export class Databases extends Service {
715
726
  * @param {boolean} required
716
727
  * @param {string} xdefault
717
728
  * @throws {AppwriteException}
718
- * @returns {Promise}
719
- */
729
+ * @returns {Promise<Models.AttributeEmail>}
730
+ */
720
731
  async updateEmailAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string): Promise<Models.AttributeEmail> {
721
732
  if (typeof databaseId === 'undefined') {
722
733
  throw new AppwriteException('Missing required parameter: "databaseId"');
723
734
  }
724
-
725
735
  if (typeof collectionId === 'undefined') {
726
736
  throw new AppwriteException('Missing required parameter: "collectionId"');
727
737
  }
728
-
729
738
  if (typeof key === 'undefined') {
730
739
  throw new AppwriteException('Missing required parameter: "key"');
731
740
  }
732
-
733
741
  if (typeof required === 'undefined') {
734
742
  throw new AppwriteException('Missing required parameter: "required"');
735
743
  }
736
-
737
744
  if (typeof xdefault === 'undefined') {
738
745
  throw new AppwriteException('Missing required parameter: "xdefault"');
739
746
  }
740
-
741
747
  const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/email/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
742
748
  const payload: Payload = {};
743
-
744
749
  if (typeof required !== 'undefined') {
745
750
  payload['required'] = required;
746
751
  }
747
-
748
752
  if (typeof xdefault !== 'undefined') {
749
753
  payload['default'] = xdefault;
750
754
  }
751
-
752
755
  const uri = new URL(this.client.config.endpoint + apiPath);
753
- return await this.client.call('patch', uri, {
756
+
757
+ const apiHeaders: { [header: string]: string } = {
754
758
  'content-type': 'application/json',
755
- }, payload);
756
- }
759
+ }
757
760
 
761
+ return await this.client.call(
762
+ 'patch',
763
+ uri,
764
+ apiHeaders,
765
+ payload
766
+ );
767
+ }
758
768
  /**
759
769
  * Create enum attribute
760
770
  *
761
- * Create an enumeration attribute. The `elements` param acts as a white-list
762
- * of accepted values for this attribute.
763
- *
771
+ * Create an enumeration attribute. The `elements` param acts as a white-list of accepted values for this attribute.
772
+
764
773
  *
765
774
  * @param {string} databaseId
766
775
  * @param {string} collectionId
@@ -770,64 +779,59 @@ export class Databases extends Service {
770
779
  * @param {string} xdefault
771
780
  * @param {boolean} array
772
781
  * @throws {AppwriteException}
773
- * @returns {Promise}
774
- */
782
+ * @returns {Promise<Models.AttributeEnum>}
783
+ */
775
784
  async createEnumAttribute(databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeEnum> {
776
785
  if (typeof databaseId === 'undefined') {
777
786
  throw new AppwriteException('Missing required parameter: "databaseId"');
778
787
  }
779
-
780
788
  if (typeof collectionId === 'undefined') {
781
789
  throw new AppwriteException('Missing required parameter: "collectionId"');
782
790
  }
783
-
784
791
  if (typeof key === 'undefined') {
785
792
  throw new AppwriteException('Missing required parameter: "key"');
786
793
  }
787
-
788
794
  if (typeof elements === 'undefined') {
789
795
  throw new AppwriteException('Missing required parameter: "elements"');
790
796
  }
791
-
792
797
  if (typeof required === 'undefined') {
793
798
  throw new AppwriteException('Missing required parameter: "required"');
794
799
  }
795
-
796
800
  const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/enum'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
797
801
  const payload: Payload = {};
798
-
799
802
  if (typeof key !== 'undefined') {
800
803
  payload['key'] = key;
801
804
  }
802
-
803
805
  if (typeof elements !== 'undefined') {
804
806
  payload['elements'] = elements;
805
807
  }
806
-
807
808
  if (typeof required !== 'undefined') {
808
809
  payload['required'] = required;
809
810
  }
810
-
811
811
  if (typeof xdefault !== 'undefined') {
812
812
  payload['default'] = xdefault;
813
813
  }
814
-
815
814
  if (typeof array !== 'undefined') {
816
815
  payload['array'] = array;
817
816
  }
818
-
819
817
  const uri = new URL(this.client.config.endpoint + apiPath);
820
- return await this.client.call('post', uri, {
818
+
819
+ const apiHeaders: { [header: string]: string } = {
821
820
  'content-type': 'application/json',
822
- }, payload);
823
- }
821
+ }
824
822
 
823
+ return await this.client.call(
824
+ 'post',
825
+ uri,
826
+ apiHeaders,
827
+ payload
828
+ );
829
+ }
825
830
  /**
826
831
  * Update enum attribute
827
832
  *
828
- * Update an enum attribute. Changing the `default` value will not update
829
- * already existing documents.
830
- *
833
+ * Update an enum attribute. Changing the `default` value will not update already existing documents.
834
+
831
835
  *
832
836
  * @param {string} databaseId
833
837
  * @param {string} collectionId
@@ -836,60 +840,56 @@ export class Databases extends Service {
836
840
  * @param {boolean} required
837
841
  * @param {string} xdefault
838
842
  * @throws {AppwriteException}
839
- * @returns {Promise}
840
- */
843
+ * @returns {Promise<Models.AttributeEnum>}
844
+ */
841
845
  async updateEnumAttribute(databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string): Promise<Models.AttributeEnum> {
842
846
  if (typeof databaseId === 'undefined') {
843
847
  throw new AppwriteException('Missing required parameter: "databaseId"');
844
848
  }
845
-
846
849
  if (typeof collectionId === 'undefined') {
847
850
  throw new AppwriteException('Missing required parameter: "collectionId"');
848
851
  }
849
-
850
852
  if (typeof key === 'undefined') {
851
853
  throw new AppwriteException('Missing required parameter: "key"');
852
854
  }
853
-
854
855
  if (typeof elements === 'undefined') {
855
856
  throw new AppwriteException('Missing required parameter: "elements"');
856
857
  }
857
-
858
858
  if (typeof required === 'undefined') {
859
859
  throw new AppwriteException('Missing required parameter: "required"');
860
860
  }
861
-
862
861
  if (typeof xdefault === 'undefined') {
863
862
  throw new AppwriteException('Missing required parameter: "xdefault"');
864
863
  }
865
-
866
864
  const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/enum/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
867
865
  const payload: Payload = {};
868
-
869
866
  if (typeof elements !== 'undefined') {
870
867
  payload['elements'] = elements;
871
868
  }
872
-
873
869
  if (typeof required !== 'undefined') {
874
870
  payload['required'] = required;
875
871
  }
876
-
877
872
  if (typeof xdefault !== 'undefined') {
878
873
  payload['default'] = xdefault;
879
874
  }
880
-
881
875
  const uri = new URL(this.client.config.endpoint + apiPath);
882
- return await this.client.call('patch', uri, {
876
+
877
+ const apiHeaders: { [header: string]: string } = {
883
878
  'content-type': 'application/json',
884
- }, payload);
885
- }
879
+ }
886
880
 
881
+ return await this.client.call(
882
+ 'patch',
883
+ uri,
884
+ apiHeaders,
885
+ payload
886
+ );
887
+ }
887
888
  /**
888
889
  * Create float attribute
889
890
  *
890
- * Create a float attribute. Optionally, minimum and maximum values can be
891
- * provided.
892
- *
891
+ * Create a float attribute. Optionally, minimum and maximum values can be provided.
892
+
893
893
  *
894
894
  * @param {string} databaseId
895
895
  * @param {string} collectionId
@@ -900,64 +900,59 @@ export class Databases extends Service {
900
900
  * @param {number} xdefault
901
901
  * @param {boolean} array
902
902
  * @throws {AppwriteException}
903
- * @returns {Promise}
904
- */
903
+ * @returns {Promise<Models.AttributeFloat>}
904
+ */
905
905
  async createFloatAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean): Promise<Models.AttributeFloat> {
906
906
  if (typeof databaseId === 'undefined') {
907
907
  throw new AppwriteException('Missing required parameter: "databaseId"');
908
908
  }
909
-
910
909
  if (typeof collectionId === 'undefined') {
911
910
  throw new AppwriteException('Missing required parameter: "collectionId"');
912
911
  }
913
-
914
912
  if (typeof key === 'undefined') {
915
913
  throw new AppwriteException('Missing required parameter: "key"');
916
914
  }
917
-
918
915
  if (typeof required === 'undefined') {
919
916
  throw new AppwriteException('Missing required parameter: "required"');
920
917
  }
921
-
922
918
  const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/float'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
923
919
  const payload: Payload = {};
924
-
925
920
  if (typeof key !== 'undefined') {
926
921
  payload['key'] = key;
927
922
  }
928
-
929
923
  if (typeof required !== 'undefined') {
930
924
  payload['required'] = required;
931
925
  }
932
-
933
926
  if (typeof min !== 'undefined') {
934
927
  payload['min'] = min;
935
928
  }
936
-
937
929
  if (typeof max !== 'undefined') {
938
930
  payload['max'] = max;
939
931
  }
940
-
941
932
  if (typeof xdefault !== 'undefined') {
942
933
  payload['default'] = xdefault;
943
934
  }
944
-
945
935
  if (typeof array !== 'undefined') {
946
936
  payload['array'] = array;
947
937
  }
948
-
949
938
  const uri = new URL(this.client.config.endpoint + apiPath);
950
- return await this.client.call('post', uri, {
939
+
940
+ const apiHeaders: { [header: string]: string } = {
951
941
  'content-type': 'application/json',
952
- }, payload);
953
- }
942
+ }
954
943
 
944
+ return await this.client.call(
945
+ 'post',
946
+ uri,
947
+ apiHeaders,
948
+ payload
949
+ );
950
+ }
955
951
  /**
956
952
  * Update float attribute
957
953
  *
958
- * Update a float attribute. Changing the `default` value will not update
959
- * already existing documents.
960
- *
954
+ * Update a float attribute. Changing the `default` value will not update already existing documents.
955
+
961
956
  *
962
957
  * @param {string} databaseId
963
958
  * @param {string} collectionId
@@ -967,68 +962,62 @@ export class Databases extends Service {
967
962
  * @param {number} max
968
963
  * @param {number} xdefault
969
964
  * @throws {AppwriteException}
970
- * @returns {Promise}
971
- */
965
+ * @returns {Promise<Models.AttributeFloat>}
966
+ */
972
967
  async updateFloatAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min: number, max: number, xdefault?: number): Promise<Models.AttributeFloat> {
973
968
  if (typeof databaseId === 'undefined') {
974
969
  throw new AppwriteException('Missing required parameter: "databaseId"');
975
970
  }
976
-
977
971
  if (typeof collectionId === 'undefined') {
978
972
  throw new AppwriteException('Missing required parameter: "collectionId"');
979
973
  }
980
-
981
974
  if (typeof key === 'undefined') {
982
975
  throw new AppwriteException('Missing required parameter: "key"');
983
976
  }
984
-
985
977
  if (typeof required === 'undefined') {
986
978
  throw new AppwriteException('Missing required parameter: "required"');
987
979
  }
988
-
989
980
  if (typeof min === 'undefined') {
990
981
  throw new AppwriteException('Missing required parameter: "min"');
991
982
  }
992
-
993
983
  if (typeof max === 'undefined') {
994
984
  throw new AppwriteException('Missing required parameter: "max"');
995
985
  }
996
-
997
986
  if (typeof xdefault === 'undefined') {
998
987
  throw new AppwriteException('Missing required parameter: "xdefault"');
999
988
  }
1000
-
1001
989
  const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/float/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
1002
990
  const payload: Payload = {};
1003
-
1004
991
  if (typeof required !== 'undefined') {
1005
992
  payload['required'] = required;
1006
993
  }
1007
-
1008
994
  if (typeof min !== 'undefined') {
1009
995
  payload['min'] = min;
1010
996
  }
1011
-
1012
997
  if (typeof max !== 'undefined') {
1013
998
  payload['max'] = max;
1014
999
  }
1015
-
1016
1000
  if (typeof xdefault !== 'undefined') {
1017
1001
  payload['default'] = xdefault;
1018
1002
  }
1019
-
1020
1003
  const uri = new URL(this.client.config.endpoint + apiPath);
1021
- return await this.client.call('patch', uri, {
1004
+
1005
+ const apiHeaders: { [header: string]: string } = {
1022
1006
  'content-type': 'application/json',
1023
- }, payload);
1024
- }
1007
+ }
1025
1008
 
1009
+ return await this.client.call(
1010
+ 'patch',
1011
+ uri,
1012
+ apiHeaders,
1013
+ payload
1014
+ );
1015
+ }
1026
1016
  /**
1027
1017
  * Create integer attribute
1028
1018
  *
1029
- * Create an integer attribute. Optionally, minimum and maximum values can be
1030
- * provided.
1031
- *
1019
+ * Create an integer attribute. Optionally, minimum and maximum values can be provided.
1020
+
1032
1021
  *
1033
1022
  * @param {string} databaseId
1034
1023
  * @param {string} collectionId
@@ -1039,64 +1028,59 @@ export class Databases extends Service {
1039
1028
  * @param {number} xdefault
1040
1029
  * @param {boolean} array
1041
1030
  * @throws {AppwriteException}
1042
- * @returns {Promise}
1043
- */
1031
+ * @returns {Promise<Models.AttributeInteger>}
1032
+ */
1044
1033
  async createIntegerAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean): Promise<Models.AttributeInteger> {
1045
1034
  if (typeof databaseId === 'undefined') {
1046
1035
  throw new AppwriteException('Missing required parameter: "databaseId"');
1047
1036
  }
1048
-
1049
1037
  if (typeof collectionId === 'undefined') {
1050
1038
  throw new AppwriteException('Missing required parameter: "collectionId"');
1051
1039
  }
1052
-
1053
1040
  if (typeof key === 'undefined') {
1054
1041
  throw new AppwriteException('Missing required parameter: "key"');
1055
1042
  }
1056
-
1057
1043
  if (typeof required === 'undefined') {
1058
1044
  throw new AppwriteException('Missing required parameter: "required"');
1059
1045
  }
1060
-
1061
1046
  const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/integer'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
1062
1047
  const payload: Payload = {};
1063
-
1064
1048
  if (typeof key !== 'undefined') {
1065
1049
  payload['key'] = key;
1066
1050
  }
1067
-
1068
1051
  if (typeof required !== 'undefined') {
1069
1052
  payload['required'] = required;
1070
1053
  }
1071
-
1072
1054
  if (typeof min !== 'undefined') {
1073
1055
  payload['min'] = min;
1074
1056
  }
1075
-
1076
1057
  if (typeof max !== 'undefined') {
1077
1058
  payload['max'] = max;
1078
1059
  }
1079
-
1080
1060
  if (typeof xdefault !== 'undefined') {
1081
1061
  payload['default'] = xdefault;
1082
1062
  }
1083
-
1084
1063
  if (typeof array !== 'undefined') {
1085
1064
  payload['array'] = array;
1086
1065
  }
1087
-
1088
1066
  const uri = new URL(this.client.config.endpoint + apiPath);
1089
- return await this.client.call('post', uri, {
1067
+
1068
+ const apiHeaders: { [header: string]: string } = {
1090
1069
  'content-type': 'application/json',
1091
- }, payload);
1092
- }
1070
+ }
1093
1071
 
1072
+ return await this.client.call(
1073
+ 'post',
1074
+ uri,
1075
+ apiHeaders,
1076
+ payload
1077
+ );
1078
+ }
1094
1079
  /**
1095
1080
  * Update integer attribute
1096
1081
  *
1097
- * Update an integer attribute. Changing the `default` value will not update
1098
- * already existing documents.
1099
- *
1082
+ * Update an integer attribute. Changing the `default` value will not update already existing documents.
1083
+
1100
1084
  *
1101
1085
  * @param {string} databaseId
1102
1086
  * @param {string} collectionId
@@ -1106,67 +1090,62 @@ export class Databases extends Service {
1106
1090
  * @param {number} max
1107
1091
  * @param {number} xdefault
1108
1092
  * @throws {AppwriteException}
1109
- * @returns {Promise}
1110
- */
1093
+ * @returns {Promise<Models.AttributeInteger>}
1094
+ */
1111
1095
  async updateIntegerAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min: number, max: number, xdefault?: number): Promise<Models.AttributeInteger> {
1112
1096
  if (typeof databaseId === 'undefined') {
1113
1097
  throw new AppwriteException('Missing required parameter: "databaseId"');
1114
1098
  }
1115
-
1116
1099
  if (typeof collectionId === 'undefined') {
1117
1100
  throw new AppwriteException('Missing required parameter: "collectionId"');
1118
1101
  }
1119
-
1120
1102
  if (typeof key === 'undefined') {
1121
1103
  throw new AppwriteException('Missing required parameter: "key"');
1122
1104
  }
1123
-
1124
1105
  if (typeof required === 'undefined') {
1125
1106
  throw new AppwriteException('Missing required parameter: "required"');
1126
1107
  }
1127
-
1128
1108
  if (typeof min === 'undefined') {
1129
1109
  throw new AppwriteException('Missing required parameter: "min"');
1130
1110
  }
1131
-
1132
1111
  if (typeof max === 'undefined') {
1133
1112
  throw new AppwriteException('Missing required parameter: "max"');
1134
1113
  }
1135
-
1136
1114
  if (typeof xdefault === 'undefined') {
1137
1115
  throw new AppwriteException('Missing required parameter: "xdefault"');
1138
1116
  }
1139
-
1140
1117
  const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/integer/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
1141
1118
  const payload: Payload = {};
1142
-
1143
1119
  if (typeof required !== 'undefined') {
1144
1120
  payload['required'] = required;
1145
1121
  }
1146
-
1147
1122
  if (typeof min !== 'undefined') {
1148
1123
  payload['min'] = min;
1149
1124
  }
1150
-
1151
1125
  if (typeof max !== 'undefined') {
1152
1126
  payload['max'] = max;
1153
1127
  }
1154
-
1155
1128
  if (typeof xdefault !== 'undefined') {
1156
1129
  payload['default'] = xdefault;
1157
1130
  }
1158
-
1159
1131
  const uri = new URL(this.client.config.endpoint + apiPath);
1160
- return await this.client.call('patch', uri, {
1132
+
1133
+ const apiHeaders: { [header: string]: string } = {
1161
1134
  'content-type': 'application/json',
1162
- }, payload);
1163
- }
1135
+ }
1164
1136
 
1137
+ return await this.client.call(
1138
+ 'patch',
1139
+ uri,
1140
+ apiHeaders,
1141
+ payload
1142
+ );
1143
+ }
1165
1144
  /**
1166
1145
  * Create IP address attribute
1167
1146
  *
1168
1147
  * Create IP address attribute.
1169
- *
1148
+
1170
1149
  *
1171
1150
  * @param {string} databaseId
1172
1151
  * @param {string} collectionId
@@ -1175,56 +1154,53 @@ export class Databases extends Service {
1175
1154
  * @param {string} xdefault
1176
1155
  * @param {boolean} array
1177
1156
  * @throws {AppwriteException}
1178
- * @returns {Promise}
1179
- */
1157
+ * @returns {Promise<Models.AttributeIp>}
1158
+ */
1180
1159
  async createIpAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeIp> {
1181
1160
  if (typeof databaseId === 'undefined') {
1182
1161
  throw new AppwriteException('Missing required parameter: "databaseId"');
1183
1162
  }
1184
-
1185
1163
  if (typeof collectionId === 'undefined') {
1186
1164
  throw new AppwriteException('Missing required parameter: "collectionId"');
1187
1165
  }
1188
-
1189
1166
  if (typeof key === 'undefined') {
1190
1167
  throw new AppwriteException('Missing required parameter: "key"');
1191
1168
  }
1192
-
1193
1169
  if (typeof required === 'undefined') {
1194
1170
  throw new AppwriteException('Missing required parameter: "required"');
1195
1171
  }
1196
-
1197
1172
  const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/ip'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
1198
1173
  const payload: Payload = {};
1199
-
1200
1174
  if (typeof key !== 'undefined') {
1201
1175
  payload['key'] = key;
1202
1176
  }
1203
-
1204
1177
  if (typeof required !== 'undefined') {
1205
1178
  payload['required'] = required;
1206
1179
  }
1207
-
1208
1180
  if (typeof xdefault !== 'undefined') {
1209
1181
  payload['default'] = xdefault;
1210
1182
  }
1211
-
1212
1183
  if (typeof array !== 'undefined') {
1213
1184
  payload['array'] = array;
1214
1185
  }
1215
-
1216
1186
  const uri = new URL(this.client.config.endpoint + apiPath);
1217
- return await this.client.call('post', uri, {
1187
+
1188
+ const apiHeaders: { [header: string]: string } = {
1218
1189
  'content-type': 'application/json',
1219
- }, payload);
1220
- }
1190
+ }
1221
1191
 
1192
+ return await this.client.call(
1193
+ 'post',
1194
+ uri,
1195
+ apiHeaders,
1196
+ payload
1197
+ );
1198
+ }
1222
1199
  /**
1223
1200
  * Update IP address attribute
1224
1201
  *
1225
- * Update an ip attribute. Changing the `default` value will not update
1226
- * already existing documents.
1227
- *
1202
+ * Update an ip attribute. Changing the `default` value will not update already existing documents.
1203
+
1228
1204
  *
1229
1205
  * @param {string} databaseId
1230
1206
  * @param {string} collectionId
@@ -1232,52 +1208,50 @@ export class Databases extends Service {
1232
1208
  * @param {boolean} required
1233
1209
  * @param {string} xdefault
1234
1210
  * @throws {AppwriteException}
1235
- * @returns {Promise}
1236
- */
1211
+ * @returns {Promise<Models.AttributeIp>}
1212
+ */
1237
1213
  async updateIpAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string): Promise<Models.AttributeIp> {
1238
1214
  if (typeof databaseId === 'undefined') {
1239
1215
  throw new AppwriteException('Missing required parameter: "databaseId"');
1240
1216
  }
1241
-
1242
1217
  if (typeof collectionId === 'undefined') {
1243
1218
  throw new AppwriteException('Missing required parameter: "collectionId"');
1244
1219
  }
1245
-
1246
1220
  if (typeof key === 'undefined') {
1247
1221
  throw new AppwriteException('Missing required parameter: "key"');
1248
1222
  }
1249
-
1250
1223
  if (typeof required === 'undefined') {
1251
1224
  throw new AppwriteException('Missing required parameter: "required"');
1252
1225
  }
1253
-
1254
1226
  if (typeof xdefault === 'undefined') {
1255
1227
  throw new AppwriteException('Missing required parameter: "xdefault"');
1256
1228
  }
1257
-
1258
1229
  const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/ip/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
1259
1230
  const payload: Payload = {};
1260
-
1261
1231
  if (typeof required !== 'undefined') {
1262
1232
  payload['required'] = required;
1263
1233
  }
1264
-
1265
1234
  if (typeof xdefault !== 'undefined') {
1266
1235
  payload['default'] = xdefault;
1267
1236
  }
1268
-
1269
1237
  const uri = new URL(this.client.config.endpoint + apiPath);
1270
- return await this.client.call('patch', uri, {
1238
+
1239
+ const apiHeaders: { [header: string]: string } = {
1271
1240
  'content-type': 'application/json',
1272
- }, payload);
1273
- }
1241
+ }
1274
1242
 
1243
+ return await this.client.call(
1244
+ 'patch',
1245
+ uri,
1246
+ apiHeaders,
1247
+ payload
1248
+ );
1249
+ }
1275
1250
  /**
1276
1251
  * Create relationship attribute
1277
1252
  *
1278
- * Create relationship attribute. [Learn more about relationship
1279
- * attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes).
1280
- *
1253
+ * Create relationship attribute. [Learn more about relationship attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes).
1254
+
1281
1255
  *
1282
1256
  * @param {string} databaseId
1283
1257
  * @param {string} collectionId
@@ -1288,63 +1262,59 @@ export class Databases extends Service {
1288
1262
  * @param {string} twoWayKey
1289
1263
  * @param {RelationMutate} onDelete
1290
1264
  * @throws {AppwriteException}
1291
- * @returns {Promise}
1292
- */
1265
+ * @returns {Promise<Models.AttributeRelationship>}
1266
+ */
1293
1267
  async createRelationshipAttribute(databaseId: string, collectionId: string, relatedCollectionId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate): Promise<Models.AttributeRelationship> {
1294
1268
  if (typeof databaseId === 'undefined') {
1295
1269
  throw new AppwriteException('Missing required parameter: "databaseId"');
1296
1270
  }
1297
-
1298
1271
  if (typeof collectionId === 'undefined') {
1299
1272
  throw new AppwriteException('Missing required parameter: "collectionId"');
1300
1273
  }
1301
-
1302
1274
  if (typeof relatedCollectionId === 'undefined') {
1303
1275
  throw new AppwriteException('Missing required parameter: "relatedCollectionId"');
1304
1276
  }
1305
-
1306
1277
  if (typeof type === 'undefined') {
1307
1278
  throw new AppwriteException('Missing required parameter: "type"');
1308
1279
  }
1309
-
1310
1280
  const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/relationship'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
1311
1281
  const payload: Payload = {};
1312
-
1313
1282
  if (typeof relatedCollectionId !== 'undefined') {
1314
1283
  payload['relatedCollectionId'] = relatedCollectionId;
1315
1284
  }
1316
-
1317
1285
  if (typeof type !== 'undefined') {
1318
1286
  payload['type'] = type;
1319
1287
  }
1320
-
1321
1288
  if (typeof twoWay !== 'undefined') {
1322
1289
  payload['twoWay'] = twoWay;
1323
1290
  }
1324
-
1325
1291
  if (typeof key !== 'undefined') {
1326
1292
  payload['key'] = key;
1327
1293
  }
1328
-
1329
1294
  if (typeof twoWayKey !== 'undefined') {
1330
1295
  payload['twoWayKey'] = twoWayKey;
1331
1296
  }
1332
-
1333
1297
  if (typeof onDelete !== 'undefined') {
1334
1298
  payload['onDelete'] = onDelete;
1335
1299
  }
1336
-
1337
1300
  const uri = new URL(this.client.config.endpoint + apiPath);
1338
- return await this.client.call('post', uri, {
1301
+
1302
+ const apiHeaders: { [header: string]: string } = {
1339
1303
  'content-type': 'application/json',
1340
- }, payload);
1341
- }
1304
+ }
1342
1305
 
1306
+ return await this.client.call(
1307
+ 'post',
1308
+ uri,
1309
+ apiHeaders,
1310
+ payload
1311
+ );
1312
+ }
1343
1313
  /**
1344
1314
  * Create string attribute
1345
1315
  *
1346
1316
  * Create a string attribute.
1347
- *
1317
+
1348
1318
  *
1349
1319
  * @param {string} databaseId
1350
1320
  * @param {string} collectionId
@@ -1355,68 +1325,62 @@ export class Databases extends Service {
1355
1325
  * @param {boolean} array
1356
1326
  * @param {boolean} encrypt
1357
1327
  * @throws {AppwriteException}
1358
- * @returns {Promise}
1359
- */
1328
+ * @returns {Promise<Models.AttributeString>}
1329
+ */
1360
1330
  async createStringAttribute(databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise<Models.AttributeString> {
1361
1331
  if (typeof databaseId === 'undefined') {
1362
1332
  throw new AppwriteException('Missing required parameter: "databaseId"');
1363
1333
  }
1364
-
1365
1334
  if (typeof collectionId === 'undefined') {
1366
1335
  throw new AppwriteException('Missing required parameter: "collectionId"');
1367
1336
  }
1368
-
1369
1337
  if (typeof key === 'undefined') {
1370
1338
  throw new AppwriteException('Missing required parameter: "key"');
1371
1339
  }
1372
-
1373
1340
  if (typeof size === 'undefined') {
1374
1341
  throw new AppwriteException('Missing required parameter: "size"');
1375
1342
  }
1376
-
1377
1343
  if (typeof required === 'undefined') {
1378
1344
  throw new AppwriteException('Missing required parameter: "required"');
1379
1345
  }
1380
-
1381
1346
  const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/string'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
1382
1347
  const payload: Payload = {};
1383
-
1384
1348
  if (typeof key !== 'undefined') {
1385
1349
  payload['key'] = key;
1386
1350
  }
1387
-
1388
1351
  if (typeof size !== 'undefined') {
1389
1352
  payload['size'] = size;
1390
1353
  }
1391
-
1392
1354
  if (typeof required !== 'undefined') {
1393
1355
  payload['required'] = required;
1394
1356
  }
1395
-
1396
1357
  if (typeof xdefault !== 'undefined') {
1397
1358
  payload['default'] = xdefault;
1398
1359
  }
1399
-
1400
1360
  if (typeof array !== 'undefined') {
1401
1361
  payload['array'] = array;
1402
1362
  }
1403
-
1404
1363
  if (typeof encrypt !== 'undefined') {
1405
1364
  payload['encrypt'] = encrypt;
1406
1365
  }
1407
-
1408
1366
  const uri = new URL(this.client.config.endpoint + apiPath);
1409
- return await this.client.call('post', uri, {
1367
+
1368
+ const apiHeaders: { [header: string]: string } = {
1410
1369
  'content-type': 'application/json',
1411
- }, payload);
1412
- }
1370
+ }
1413
1371
 
1372
+ return await this.client.call(
1373
+ 'post',
1374
+ uri,
1375
+ apiHeaders,
1376
+ payload
1377
+ );
1378
+ }
1414
1379
  /**
1415
1380
  * Update string attribute
1416
1381
  *
1417
- * Update a string attribute. Changing the `default` value will not update
1418
- * already existing documents.
1419
- *
1382
+ * Update a string attribute. Changing the `default` value will not update already existing documents.
1383
+
1420
1384
  *
1421
1385
  * @param {string} databaseId
1422
1386
  * @param {string} collectionId
@@ -1424,51 +1388,50 @@ export class Databases extends Service {
1424
1388
  * @param {boolean} required
1425
1389
  * @param {string} xdefault
1426
1390
  * @throws {AppwriteException}
1427
- * @returns {Promise}
1428
- */
1391
+ * @returns {Promise<Models.AttributeString>}
1392
+ */
1429
1393
  async updateStringAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string): Promise<Models.AttributeString> {
1430
1394
  if (typeof databaseId === 'undefined') {
1431
1395
  throw new AppwriteException('Missing required parameter: "databaseId"');
1432
1396
  }
1433
-
1434
1397
  if (typeof collectionId === 'undefined') {
1435
1398
  throw new AppwriteException('Missing required parameter: "collectionId"');
1436
1399
  }
1437
-
1438
1400
  if (typeof key === 'undefined') {
1439
1401
  throw new AppwriteException('Missing required parameter: "key"');
1440
1402
  }
1441
-
1442
1403
  if (typeof required === 'undefined') {
1443
1404
  throw new AppwriteException('Missing required parameter: "required"');
1444
1405
  }
1445
-
1446
1406
  if (typeof xdefault === 'undefined') {
1447
1407
  throw new AppwriteException('Missing required parameter: "xdefault"');
1448
1408
  }
1449
-
1450
1409
  const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/string/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
1451
1410
  const payload: Payload = {};
1452
-
1453
1411
  if (typeof required !== 'undefined') {
1454
1412
  payload['required'] = required;
1455
1413
  }
1456
-
1457
1414
  if (typeof xdefault !== 'undefined') {
1458
1415
  payload['default'] = xdefault;
1459
1416
  }
1460
-
1461
1417
  const uri = new URL(this.client.config.endpoint + apiPath);
1462
- return await this.client.call('patch', uri, {
1418
+
1419
+ const apiHeaders: { [header: string]: string } = {
1463
1420
  'content-type': 'application/json',
1464
- }, payload);
1465
- }
1421
+ }
1466
1422
 
1423
+ return await this.client.call(
1424
+ 'patch',
1425
+ uri,
1426
+ apiHeaders,
1427
+ payload
1428
+ );
1429
+ }
1467
1430
  /**
1468
1431
  * Create URL attribute
1469
1432
  *
1470
1433
  * Create a URL attribute.
1471
- *
1434
+
1472
1435
  *
1473
1436
  * @param {string} databaseId
1474
1437
  * @param {string} collectionId
@@ -1477,56 +1440,53 @@ export class Databases extends Service {
1477
1440
  * @param {string} xdefault
1478
1441
  * @param {boolean} array
1479
1442
  * @throws {AppwriteException}
1480
- * @returns {Promise}
1481
- */
1443
+ * @returns {Promise<Models.AttributeUrl>}
1444
+ */
1482
1445
  async createUrlAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeUrl> {
1483
1446
  if (typeof databaseId === 'undefined') {
1484
1447
  throw new AppwriteException('Missing required parameter: "databaseId"');
1485
1448
  }
1486
-
1487
1449
  if (typeof collectionId === 'undefined') {
1488
1450
  throw new AppwriteException('Missing required parameter: "collectionId"');
1489
1451
  }
1490
-
1491
1452
  if (typeof key === 'undefined') {
1492
1453
  throw new AppwriteException('Missing required parameter: "key"');
1493
1454
  }
1494
-
1495
1455
  if (typeof required === 'undefined') {
1496
1456
  throw new AppwriteException('Missing required parameter: "required"');
1497
1457
  }
1498
-
1499
1458
  const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/url'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
1500
1459
  const payload: Payload = {};
1501
-
1502
1460
  if (typeof key !== 'undefined') {
1503
1461
  payload['key'] = key;
1504
1462
  }
1505
-
1506
1463
  if (typeof required !== 'undefined') {
1507
1464
  payload['required'] = required;
1508
1465
  }
1509
-
1510
1466
  if (typeof xdefault !== 'undefined') {
1511
1467
  payload['default'] = xdefault;
1512
1468
  }
1513
-
1514
1469
  if (typeof array !== 'undefined') {
1515
1470
  payload['array'] = array;
1516
1471
  }
1517
-
1518
1472
  const uri = new URL(this.client.config.endpoint + apiPath);
1519
- return await this.client.call('post', uri, {
1473
+
1474
+ const apiHeaders: { [header: string]: string } = {
1520
1475
  'content-type': 'application/json',
1521
- }, payload);
1522
- }
1476
+ }
1523
1477
 
1478
+ return await this.client.call(
1479
+ 'post',
1480
+ uri,
1481
+ apiHeaders,
1482
+ payload
1483
+ );
1484
+ }
1524
1485
  /**
1525
1486
  * Update URL attribute
1526
1487
  *
1527
- * Update an url attribute. Changing the `default` value will not update
1528
- * already existing documents.
1529
- *
1488
+ * Update an url attribute. Changing the `default` value will not update already existing documents.
1489
+
1530
1490
  *
1531
1491
  * @param {string} databaseId
1532
1492
  * @param {string} collectionId
@@ -1534,46 +1494,45 @@ export class Databases extends Service {
1534
1494
  * @param {boolean} required
1535
1495
  * @param {string} xdefault
1536
1496
  * @throws {AppwriteException}
1537
- * @returns {Promise}
1538
- */
1497
+ * @returns {Promise<Models.AttributeUrl>}
1498
+ */
1539
1499
  async updateUrlAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string): Promise<Models.AttributeUrl> {
1540
1500
  if (typeof databaseId === 'undefined') {
1541
1501
  throw new AppwriteException('Missing required parameter: "databaseId"');
1542
1502
  }
1543
-
1544
1503
  if (typeof collectionId === 'undefined') {
1545
1504
  throw new AppwriteException('Missing required parameter: "collectionId"');
1546
1505
  }
1547
-
1548
1506
  if (typeof key === 'undefined') {
1549
1507
  throw new AppwriteException('Missing required parameter: "key"');
1550
1508
  }
1551
-
1552
1509
  if (typeof required === 'undefined') {
1553
1510
  throw new AppwriteException('Missing required parameter: "required"');
1554
1511
  }
1555
-
1556
1512
  if (typeof xdefault === 'undefined') {
1557
1513
  throw new AppwriteException('Missing required parameter: "xdefault"');
1558
1514
  }
1559
-
1560
1515
  const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/url/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
1561
1516
  const payload: Payload = {};
1562
-
1563
1517
  if (typeof required !== 'undefined') {
1564
1518
  payload['required'] = required;
1565
1519
  }
1566
-
1567
1520
  if (typeof xdefault !== 'undefined') {
1568
1521
  payload['default'] = xdefault;
1569
1522
  }
1570
-
1571
1523
  const uri = new URL(this.client.config.endpoint + apiPath);
1572
- return await this.client.call('patch', uri, {
1524
+
1525
+ const apiHeaders: { [header: string]: string } = {
1573
1526
  'content-type': 'application/json',
1574
- }, payload);
1575
- }
1527
+ }
1576
1528
 
1529
+ return await this.client.call(
1530
+ 'patch',
1531
+ uri,
1532
+ apiHeaders,
1533
+ payload
1534
+ );
1535
+ }
1577
1536
  /**
1578
1537
  * Get attribute
1579
1538
  *
@@ -1583,30 +1542,33 @@ export class Databases extends Service {
1583
1542
  * @param {string} collectionId
1584
1543
  * @param {string} key
1585
1544
  * @throws {AppwriteException}
1586
- * @returns {Promise}
1587
- */
1545
+ * @returns {Promise<{}>}
1546
+ */
1588
1547
  async getAttribute(databaseId: string, collectionId: string, key: string): Promise<{}> {
1589
1548
  if (typeof databaseId === 'undefined') {
1590
1549
  throw new AppwriteException('Missing required parameter: "databaseId"');
1591
1550
  }
1592
-
1593
1551
  if (typeof collectionId === 'undefined') {
1594
1552
  throw new AppwriteException('Missing required parameter: "collectionId"');
1595
1553
  }
1596
-
1597
1554
  if (typeof key === 'undefined') {
1598
1555
  throw new AppwriteException('Missing required parameter: "key"');
1599
1556
  }
1600
-
1601
1557
  const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
1602
1558
  const payload: Payload = {};
1603
-
1604
1559
  const uri = new URL(this.client.config.endpoint + apiPath);
1605
- return await this.client.call('get', uri, {
1560
+
1561
+ const apiHeaders: { [header: string]: string } = {
1606
1562
  'content-type': 'application/json',
1607
- }, payload);
1608
- }
1563
+ }
1609
1564
 
1565
+ return await this.client.call(
1566
+ 'get',
1567
+ uri,
1568
+ apiHeaders,
1569
+ payload
1570
+ );
1571
+ }
1610
1572
  /**
1611
1573
  * Delete attribute
1612
1574
  *
@@ -1616,111 +1578,114 @@ export class Databases extends Service {
1616
1578
  * @param {string} collectionId
1617
1579
  * @param {string} key
1618
1580
  * @throws {AppwriteException}
1619
- * @returns {Promise}
1620
- */
1581
+ * @returns {Promise<{}>}
1582
+ */
1621
1583
  async deleteAttribute(databaseId: string, collectionId: string, key: string): Promise<{}> {
1622
1584
  if (typeof databaseId === 'undefined') {
1623
1585
  throw new AppwriteException('Missing required parameter: "databaseId"');
1624
1586
  }
1625
-
1626
1587
  if (typeof collectionId === 'undefined') {
1627
1588
  throw new AppwriteException('Missing required parameter: "collectionId"');
1628
1589
  }
1629
-
1630
1590
  if (typeof key === 'undefined') {
1631
1591
  throw new AppwriteException('Missing required parameter: "key"');
1632
1592
  }
1633
-
1634
1593
  const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
1635
1594
  const payload: Payload = {};
1636
-
1637
1595
  const uri = new URL(this.client.config.endpoint + apiPath);
1638
- return await this.client.call('delete', uri, {
1596
+
1597
+ const apiHeaders: { [header: string]: string } = {
1639
1598
  'content-type': 'application/json',
1640
- }, payload);
1641
- }
1599
+ }
1642
1600
 
1601
+ return await this.client.call(
1602
+ 'delete',
1603
+ uri,
1604
+ apiHeaders,
1605
+ payload
1606
+ );
1607
+ }
1643
1608
  /**
1644
1609
  * Update relationship attribute
1645
1610
  *
1646
- * Update relationship attribute. [Learn more about relationship
1647
- * attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes).
1648
- *
1611
+ * Update relationship attribute. [Learn more about relationship attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes).
1612
+
1649
1613
  *
1650
1614
  * @param {string} databaseId
1651
1615
  * @param {string} collectionId
1652
1616
  * @param {string} key
1653
1617
  * @param {RelationMutate} onDelete
1654
1618
  * @throws {AppwriteException}
1655
- * @returns {Promise}
1656
- */
1619
+ * @returns {Promise<Models.AttributeRelationship>}
1620
+ */
1657
1621
  async updateRelationshipAttribute(databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate): Promise<Models.AttributeRelationship> {
1658
1622
  if (typeof databaseId === 'undefined') {
1659
1623
  throw new AppwriteException('Missing required parameter: "databaseId"');
1660
1624
  }
1661
-
1662
1625
  if (typeof collectionId === 'undefined') {
1663
1626
  throw new AppwriteException('Missing required parameter: "collectionId"');
1664
1627
  }
1665
-
1666
1628
  if (typeof key === 'undefined') {
1667
1629
  throw new AppwriteException('Missing required parameter: "key"');
1668
1630
  }
1669
-
1670
1631
  const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}/relationship'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
1671
1632
  const payload: Payload = {};
1672
-
1673
1633
  if (typeof onDelete !== 'undefined') {
1674
1634
  payload['onDelete'] = onDelete;
1675
1635
  }
1676
-
1677
1636
  const uri = new URL(this.client.config.endpoint + apiPath);
1678
- return await this.client.call('patch', uri, {
1637
+
1638
+ const apiHeaders: { [header: string]: string } = {
1679
1639
  'content-type': 'application/json',
1680
- }, payload);
1681
- }
1640
+ }
1682
1641
 
1642
+ return await this.client.call(
1643
+ 'patch',
1644
+ uri,
1645
+ apiHeaders,
1646
+ payload
1647
+ );
1648
+ }
1683
1649
  /**
1684
1650
  * List documents
1685
1651
  *
1686
- * Get a list of all the user's documents in a given collection. You can use
1687
- * the query params to filter your results.
1652
+ * Get a list of all the user&#039;s documents in a given collection. You can use the query params to filter your results.
1688
1653
  *
1689
1654
  * @param {string} databaseId
1690
1655
  * @param {string} collectionId
1691
1656
  * @param {string[]} queries
1692
1657
  * @throws {AppwriteException}
1693
- * @returns {Promise}
1694
- */
1658
+ * @returns {Promise<Models.DocumentList<Document>>}
1659
+ */
1695
1660
  async listDocuments<Document extends Models.Document>(databaseId: string, collectionId: string, queries?: string[]): Promise<Models.DocumentList<Document>> {
1696
1661
  if (typeof databaseId === 'undefined') {
1697
1662
  throw new AppwriteException('Missing required parameter: "databaseId"');
1698
1663
  }
1699
-
1700
1664
  if (typeof collectionId === 'undefined') {
1701
1665
  throw new AppwriteException('Missing required parameter: "collectionId"');
1702
1666
  }
1703
-
1704
1667
  const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
1705
1668
  const payload: Payload = {};
1706
-
1707
1669
  if (typeof queries !== 'undefined') {
1708
1670
  payload['queries'] = queries;
1709
1671
  }
1710
-
1711
1672
  const uri = new URL(this.client.config.endpoint + apiPath);
1712
- return await this.client.call('get', uri, {
1673
+
1674
+ const apiHeaders: { [header: string]: string } = {
1713
1675
  'content-type': 'application/json',
1714
- }, payload);
1715
- }
1676
+ }
1716
1677
 
1678
+ return await this.client.call(
1679
+ 'get',
1680
+ uri,
1681
+ apiHeaders,
1682
+ payload
1683
+ );
1684
+ }
1717
1685
  /**
1718
1686
  * Create document
1719
1687
  *
1720
- * Create a new Document. Before using this route, you should create a new
1721
- * collection resource using either a [server
1722
- * integration](https://appwrite.io/docs/server/databases#databasesCreateCollection)
1723
- * API or directly from your database console.
1688
+ * 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.
1724
1689
  *
1725
1690
  * @param {string} databaseId
1726
1691
  * @param {string} collectionId
@@ -1728,90 +1693,89 @@ export class Databases extends Service {
1728
1693
  * @param {Omit<Document, keyof Models.Document>} data
1729
1694
  * @param {string[]} permissions
1730
1695
  * @throws {AppwriteException}
1731
- * @returns {Promise}
1732
- */
1696
+ * @returns {Promise<Document>}
1697
+ */
1733
1698
  async createDocument<Document extends Models.Document>(databaseId: string, collectionId: string, documentId: string, data: Omit<Document, keyof Models.Document>, permissions?: string[]): Promise<Document> {
1734
1699
  if (typeof databaseId === 'undefined') {
1735
1700
  throw new AppwriteException('Missing required parameter: "databaseId"');
1736
1701
  }
1737
-
1738
1702
  if (typeof collectionId === 'undefined') {
1739
1703
  throw new AppwriteException('Missing required parameter: "collectionId"');
1740
1704
  }
1741
-
1742
1705
  if (typeof documentId === 'undefined') {
1743
1706
  throw new AppwriteException('Missing required parameter: "documentId"');
1744
1707
  }
1745
-
1746
1708
  if (typeof data === 'undefined') {
1747
1709
  throw new AppwriteException('Missing required parameter: "data"');
1748
1710
  }
1749
-
1750
1711
  const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
1751
1712
  const payload: Payload = {};
1752
-
1753
1713
  if (typeof documentId !== 'undefined') {
1754
1714
  payload['documentId'] = documentId;
1755
1715
  }
1756
-
1757
1716
  if (typeof data !== 'undefined') {
1758
1717
  payload['data'] = data;
1759
1718
  }
1760
-
1761
1719
  if (typeof permissions !== 'undefined') {
1762
1720
  payload['permissions'] = permissions;
1763
1721
  }
1764
-
1765
1722
  const uri = new URL(this.client.config.endpoint + apiPath);
1766
- return await this.client.call('post', uri, {
1723
+
1724
+ const apiHeaders: { [header: string]: string } = {
1767
1725
  'content-type': 'application/json',
1768
- }, payload);
1769
- }
1726
+ }
1770
1727
 
1728
+ return await this.client.call(
1729
+ 'post',
1730
+ uri,
1731
+ apiHeaders,
1732
+ payload
1733
+ );
1734
+ }
1771
1735
  /**
1772
1736
  * Get document
1773
1737
  *
1774
- * Get a document by its unique ID. This endpoint response returns a JSON
1775
- * object with the document data.
1738
+ * Get a document by its unique ID. This endpoint response returns a JSON object with the document data.
1776
1739
  *
1777
1740
  * @param {string} databaseId
1778
1741
  * @param {string} collectionId
1779
1742
  * @param {string} documentId
1780
1743
  * @param {string[]} queries
1781
1744
  * @throws {AppwriteException}
1782
- * @returns {Promise}
1783
- */
1745
+ * @returns {Promise<Document>}
1746
+ */
1784
1747
  async getDocument<Document extends Models.Document>(databaseId: string, collectionId: string, documentId: string, queries?: string[]): Promise<Document> {
1785
1748
  if (typeof databaseId === 'undefined') {
1786
1749
  throw new AppwriteException('Missing required parameter: "databaseId"');
1787
1750
  }
1788
-
1789
1751
  if (typeof collectionId === 'undefined') {
1790
1752
  throw new AppwriteException('Missing required parameter: "collectionId"');
1791
1753
  }
1792
-
1793
1754
  if (typeof documentId === 'undefined') {
1794
1755
  throw new AppwriteException('Missing required parameter: "documentId"');
1795
1756
  }
1796
-
1797
1757
  const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId);
1798
1758
  const payload: Payload = {};
1799
-
1800
1759
  if (typeof queries !== 'undefined') {
1801
1760
  payload['queries'] = queries;
1802
1761
  }
1803
-
1804
1762
  const uri = new URL(this.client.config.endpoint + apiPath);
1805
- return await this.client.call('get', uri, {
1763
+
1764
+ const apiHeaders: { [header: string]: string } = {
1806
1765
  'content-type': 'application/json',
1807
- }, payload);
1808
- }
1766
+ }
1809
1767
 
1768
+ return await this.client.call(
1769
+ 'get',
1770
+ uri,
1771
+ apiHeaders,
1772
+ payload
1773
+ );
1774
+ }
1810
1775
  /**
1811
1776
  * Update document
1812
1777
  *
1813
- * Update a document by its unique ID. Using the patch method you can pass
1814
- * only specific fields that will get updated.
1778
+ * Update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated.
1815
1779
  *
1816
1780
  * @param {string} databaseId
1817
1781
  * @param {string} collectionId
@@ -1819,38 +1783,39 @@ export class Databases extends Service {
1819
1783
  * @param {Partial<Omit<Document, keyof Models.Document>>} data
1820
1784
  * @param {string[]} permissions
1821
1785
  * @throws {AppwriteException}
1822
- * @returns {Promise}
1823
- */
1786
+ * @returns {Promise<Document>}
1787
+ */
1824
1788
  async updateDocument<Document extends Models.Document>(databaseId: string, collectionId: string, documentId: string, data?: Partial<Omit<Document, keyof Models.Document>>, permissions?: string[]): Promise<Document> {
1825
1789
  if (typeof databaseId === 'undefined') {
1826
1790
  throw new AppwriteException('Missing required parameter: "databaseId"');
1827
1791
  }
1828
-
1829
1792
  if (typeof collectionId === 'undefined') {
1830
1793
  throw new AppwriteException('Missing required parameter: "collectionId"');
1831
1794
  }
1832
-
1833
1795
  if (typeof documentId === 'undefined') {
1834
1796
  throw new AppwriteException('Missing required parameter: "documentId"');
1835
1797
  }
1836
-
1837
1798
  const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId);
1838
1799
  const payload: Payload = {};
1839
-
1840
1800
  if (typeof data !== 'undefined') {
1841
1801
  payload['data'] = data;
1842
1802
  }
1843
-
1844
1803
  if (typeof permissions !== 'undefined') {
1845
1804
  payload['permissions'] = permissions;
1846
1805
  }
1847
-
1848
1806
  const uri = new URL(this.client.config.endpoint + apiPath);
1849
- return await this.client.call('patch', uri, {
1807
+
1808
+ const apiHeaders: { [header: string]: string } = {
1850
1809
  'content-type': 'application/json',
1851
- }, payload);
1852
- }
1810
+ }
1853
1811
 
1812
+ return await this.client.call(
1813
+ 'patch',
1814
+ uri,
1815
+ apiHeaders,
1816
+ payload
1817
+ );
1818
+ }
1854
1819
  /**
1855
1820
  * Delete document
1856
1821
  *
@@ -1860,30 +1825,33 @@ export class Databases extends Service {
1860
1825
  * @param {string} collectionId
1861
1826
  * @param {string} documentId
1862
1827
  * @throws {AppwriteException}
1863
- * @returns {Promise}
1864
- */
1828
+ * @returns {Promise<{}>}
1829
+ */
1865
1830
  async deleteDocument(databaseId: string, collectionId: string, documentId: string): Promise<{}> {
1866
1831
  if (typeof databaseId === 'undefined') {
1867
1832
  throw new AppwriteException('Missing required parameter: "databaseId"');
1868
1833
  }
1869
-
1870
1834
  if (typeof collectionId === 'undefined') {
1871
1835
  throw new AppwriteException('Missing required parameter: "collectionId"');
1872
1836
  }
1873
-
1874
1837
  if (typeof documentId === 'undefined') {
1875
1838
  throw new AppwriteException('Missing required parameter: "documentId"');
1876
1839
  }
1877
-
1878
1840
  const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId);
1879
1841
  const payload: Payload = {};
1880
-
1881
1842
  const uri = new URL(this.client.config.endpoint + apiPath);
1882
- return await this.client.call('delete', uri, {
1843
+
1844
+ const apiHeaders: { [header: string]: string } = {
1883
1845
  'content-type': 'application/json',
1884
- }, payload);
1885
- }
1846
+ }
1886
1847
 
1848
+ return await this.client.call(
1849
+ 'delete',
1850
+ uri,
1851
+ apiHeaders,
1852
+ payload
1853
+ );
1854
+ }
1887
1855
  /**
1888
1856
  * List document logs
1889
1857
  *
@@ -1894,34 +1862,36 @@ export class Databases extends Service {
1894
1862
  * @param {string} documentId
1895
1863
  * @param {string[]} queries
1896
1864
  * @throws {AppwriteException}
1897
- * @returns {Promise}
1898
- */
1865
+ * @returns {Promise<Models.LogList>}
1866
+ */
1899
1867
  async listDocumentLogs(databaseId: string, collectionId: string, documentId: string, queries?: string[]): Promise<Models.LogList> {
1900
1868
  if (typeof databaseId === 'undefined') {
1901
1869
  throw new AppwriteException('Missing required parameter: "databaseId"');
1902
1870
  }
1903
-
1904
1871
  if (typeof collectionId === 'undefined') {
1905
1872
  throw new AppwriteException('Missing required parameter: "collectionId"');
1906
1873
  }
1907
-
1908
1874
  if (typeof documentId === 'undefined') {
1909
1875
  throw new AppwriteException('Missing required parameter: "documentId"');
1910
1876
  }
1911
-
1912
1877
  const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/logs'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId);
1913
1878
  const payload: Payload = {};
1914
-
1915
1879
  if (typeof queries !== 'undefined') {
1916
1880
  payload['queries'] = queries;
1917
1881
  }
1918
-
1919
1882
  const uri = new URL(this.client.config.endpoint + apiPath);
1920
- return await this.client.call('get', uri, {
1883
+
1884
+ const apiHeaders: { [header: string]: string } = {
1921
1885
  'content-type': 'application/json',
1922
- }, payload);
1923
- }
1886
+ }
1924
1887
 
1888
+ return await this.client.call(
1889
+ 'get',
1890
+ uri,
1891
+ apiHeaders,
1892
+ payload
1893
+ );
1894
+ }
1925
1895
  /**
1926
1896
  * List indexes
1927
1897
  *
@@ -1931,36 +1901,38 @@ export class Databases extends Service {
1931
1901
  * @param {string} collectionId
1932
1902
  * @param {string[]} queries
1933
1903
  * @throws {AppwriteException}
1934
- * @returns {Promise}
1935
- */
1904
+ * @returns {Promise<Models.IndexList>}
1905
+ */
1936
1906
  async listIndexes(databaseId: string, collectionId: string, queries?: string[]): Promise<Models.IndexList> {
1937
1907
  if (typeof databaseId === 'undefined') {
1938
1908
  throw new AppwriteException('Missing required parameter: "databaseId"');
1939
1909
  }
1940
-
1941
1910
  if (typeof collectionId === 'undefined') {
1942
1911
  throw new AppwriteException('Missing required parameter: "collectionId"');
1943
1912
  }
1944
-
1945
1913
  const apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
1946
1914
  const payload: Payload = {};
1947
-
1948
1915
  if (typeof queries !== 'undefined') {
1949
1916
  payload['queries'] = queries;
1950
1917
  }
1951
-
1952
1918
  const uri = new URL(this.client.config.endpoint + apiPath);
1953
- return await this.client.call('get', uri, {
1919
+
1920
+ const apiHeaders: { [header: string]: string } = {
1954
1921
  'content-type': 'application/json',
1955
- }, payload);
1956
- }
1922
+ }
1957
1923
 
1924
+ return await this.client.call(
1925
+ 'get',
1926
+ uri,
1927
+ apiHeaders,
1928
+ payload
1929
+ );
1930
+ }
1958
1931
  /**
1959
1932
  * Create index
1960
1933
  *
1961
- * Creates an index on the attributes listed. Your index should include all
1962
- * the attributes you will query in a single request.
1963
- * Attributes can be `key`, `fulltext`, and `unique`.
1934
+ * Creates an index on the attributes listed. Your index should include all the attributes you will query in a single request.
1935
+ Attributes can be `key`, `fulltext`, and `unique`.
1964
1936
  *
1965
1937
  * @param {string} databaseId
1966
1938
  * @param {string} collectionId
@@ -1969,54 +1941,51 @@ export class Databases extends Service {
1969
1941
  * @param {string[]} attributes
1970
1942
  * @param {string[]} orders
1971
1943
  * @throws {AppwriteException}
1972
- * @returns {Promise}
1973
- */
1944
+ * @returns {Promise<Models.Index>}
1945
+ */
1974
1946
  async createIndex(databaseId: string, collectionId: string, key: string, type: IndexType, attributes: string[], orders?: string[]): Promise<Models.Index> {
1975
1947
  if (typeof databaseId === 'undefined') {
1976
1948
  throw new AppwriteException('Missing required parameter: "databaseId"');
1977
1949
  }
1978
-
1979
1950
  if (typeof collectionId === 'undefined') {
1980
1951
  throw new AppwriteException('Missing required parameter: "collectionId"');
1981
1952
  }
1982
-
1983
1953
  if (typeof key === 'undefined') {
1984
1954
  throw new AppwriteException('Missing required parameter: "key"');
1985
1955
  }
1986
-
1987
1956
  if (typeof type === 'undefined') {
1988
1957
  throw new AppwriteException('Missing required parameter: "type"');
1989
1958
  }
1990
-
1991
1959
  if (typeof attributes === 'undefined') {
1992
1960
  throw new AppwriteException('Missing required parameter: "attributes"');
1993
1961
  }
1994
-
1995
1962
  const apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
1996
1963
  const payload: Payload = {};
1997
-
1998
1964
  if (typeof key !== 'undefined') {
1999
1965
  payload['key'] = key;
2000
1966
  }
2001
-
2002
1967
  if (typeof type !== 'undefined') {
2003
1968
  payload['type'] = type;
2004
1969
  }
2005
-
2006
1970
  if (typeof attributes !== 'undefined') {
2007
1971
  payload['attributes'] = attributes;
2008
1972
  }
2009
-
2010
1973
  if (typeof orders !== 'undefined') {
2011
1974
  payload['orders'] = orders;
2012
1975
  }
2013
-
2014
1976
  const uri = new URL(this.client.config.endpoint + apiPath);
2015
- return await this.client.call('post', uri, {
1977
+
1978
+ const apiHeaders: { [header: string]: string } = {
2016
1979
  'content-type': 'application/json',
2017
- }, payload);
2018
- }
1980
+ }
2019
1981
 
1982
+ return await this.client.call(
1983
+ 'post',
1984
+ uri,
1985
+ apiHeaders,
1986
+ payload
1987
+ );
1988
+ }
2020
1989
  /**
2021
1990
  * Get index
2022
1991
  *
@@ -2026,30 +1995,33 @@ export class Databases extends Service {
2026
1995
  * @param {string} collectionId
2027
1996
  * @param {string} key
2028
1997
  * @throws {AppwriteException}
2029
- * @returns {Promise}
2030
- */
1998
+ * @returns {Promise<Models.Index>}
1999
+ */
2031
2000
  async getIndex(databaseId: string, collectionId: string, key: string): Promise<Models.Index> {
2032
2001
  if (typeof databaseId === 'undefined') {
2033
2002
  throw new AppwriteException('Missing required parameter: "databaseId"');
2034
2003
  }
2035
-
2036
2004
  if (typeof collectionId === 'undefined') {
2037
2005
  throw new AppwriteException('Missing required parameter: "collectionId"');
2038
2006
  }
2039
-
2040
2007
  if (typeof key === 'undefined') {
2041
2008
  throw new AppwriteException('Missing required parameter: "key"');
2042
2009
  }
2043
-
2044
2010
  const apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
2045
2011
  const payload: Payload = {};
2046
-
2047
2012
  const uri = new URL(this.client.config.endpoint + apiPath);
2048
- return await this.client.call('get', uri, {
2013
+
2014
+ const apiHeaders: { [header: string]: string } = {
2049
2015
  'content-type': 'application/json',
2050
- }, payload);
2051
- }
2016
+ }
2052
2017
 
2018
+ return await this.client.call(
2019
+ 'get',
2020
+ uri,
2021
+ apiHeaders,
2022
+ payload
2023
+ );
2024
+ }
2053
2025
  /**
2054
2026
  * Delete index
2055
2027
  *
@@ -2059,30 +2031,33 @@ export class Databases extends Service {
2059
2031
  * @param {string} collectionId
2060
2032
  * @param {string} key
2061
2033
  * @throws {AppwriteException}
2062
- * @returns {Promise}
2063
- */
2034
+ * @returns {Promise<{}>}
2035
+ */
2064
2036
  async deleteIndex(databaseId: string, collectionId: string, key: string): Promise<{}> {
2065
2037
  if (typeof databaseId === 'undefined') {
2066
2038
  throw new AppwriteException('Missing required parameter: "databaseId"');
2067
2039
  }
2068
-
2069
2040
  if (typeof collectionId === 'undefined') {
2070
2041
  throw new AppwriteException('Missing required parameter: "collectionId"');
2071
2042
  }
2072
-
2073
2043
  if (typeof key === 'undefined') {
2074
2044
  throw new AppwriteException('Missing required parameter: "key"');
2075
2045
  }
2076
-
2077
2046
  const apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
2078
2047
  const payload: Payload = {};
2079
-
2080
2048
  const uri = new URL(this.client.config.endpoint + apiPath);
2081
- return await this.client.call('delete', uri, {
2049
+
2050
+ const apiHeaders: { [header: string]: string } = {
2082
2051
  'content-type': 'application/json',
2083
- }, payload);
2084
- }
2052
+ }
2085
2053
 
2054
+ return await this.client.call(
2055
+ 'delete',
2056
+ uri,
2057
+ apiHeaders,
2058
+ payload
2059
+ );
2060
+ }
2086
2061
  /**
2087
2062
  * List collection logs
2088
2063
  *
@@ -2092,30 +2067,33 @@ export class Databases extends Service {
2092
2067
  * @param {string} collectionId
2093
2068
  * @param {string[]} queries
2094
2069
  * @throws {AppwriteException}
2095
- * @returns {Promise}
2096
- */
2070
+ * @returns {Promise<Models.LogList>}
2071
+ */
2097
2072
  async listCollectionLogs(databaseId: string, collectionId: string, queries?: string[]): Promise<Models.LogList> {
2098
2073
  if (typeof databaseId === 'undefined') {
2099
2074
  throw new AppwriteException('Missing required parameter: "databaseId"');
2100
2075
  }
2101
-
2102
2076
  if (typeof collectionId === 'undefined') {
2103
2077
  throw new AppwriteException('Missing required parameter: "collectionId"');
2104
2078
  }
2105
-
2106
2079
  const apiPath = '/databases/{databaseId}/collections/{collectionId}/logs'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
2107
2080
  const payload: Payload = {};
2108
-
2109
2081
  if (typeof queries !== 'undefined') {
2110
2082
  payload['queries'] = queries;
2111
2083
  }
2112
-
2113
2084
  const uri = new URL(this.client.config.endpoint + apiPath);
2114
- return await this.client.call('get', uri, {
2085
+
2086
+ const apiHeaders: { [header: string]: string } = {
2115
2087
  'content-type': 'application/json',
2116
- }, payload);
2117
- }
2088
+ }
2118
2089
 
2090
+ return await this.client.call(
2091
+ 'get',
2092
+ uri,
2093
+ apiHeaders,
2094
+ payload
2095
+ );
2096
+ }
2119
2097
  /**
2120
2098
  * Get collection usage stats
2121
2099
  *
@@ -2124,30 +2102,33 @@ export class Databases extends Service {
2124
2102
  * @param {string} collectionId
2125
2103
  * @param {DatabaseUsageRange} range
2126
2104
  * @throws {AppwriteException}
2127
- * @returns {Promise}
2128
- */
2105
+ * @returns {Promise<Models.UsageCollection>}
2106
+ */
2129
2107
  async getCollectionUsage(databaseId: string, collectionId: string, range?: DatabaseUsageRange): Promise<Models.UsageCollection> {
2130
2108
  if (typeof databaseId === 'undefined') {
2131
2109
  throw new AppwriteException('Missing required parameter: "databaseId"');
2132
2110
  }
2133
-
2134
2111
  if (typeof collectionId === 'undefined') {
2135
2112
  throw new AppwriteException('Missing required parameter: "collectionId"');
2136
2113
  }
2137
-
2138
2114
  const apiPath = '/databases/{databaseId}/collections/{collectionId}/usage'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
2139
2115
  const payload: Payload = {};
2140
-
2141
2116
  if (typeof range !== 'undefined') {
2142
2117
  payload['range'] = range;
2143
2118
  }
2144
-
2145
2119
  const uri = new URL(this.client.config.endpoint + apiPath);
2146
- return await this.client.call('get', uri, {
2120
+
2121
+ const apiHeaders: { [header: string]: string } = {
2147
2122
  'content-type': 'application/json',
2148
- }, payload);
2149
- }
2123
+ }
2150
2124
 
2125
+ return await this.client.call(
2126
+ 'get',
2127
+ uri,
2128
+ apiHeaders,
2129
+ payload
2130
+ );
2131
+ }
2151
2132
  /**
2152
2133
  * List database logs
2153
2134
  *
@@ -2156,26 +2137,30 @@ export class Databases extends Service {
2156
2137
  * @param {string} databaseId
2157
2138
  * @param {string[]} queries
2158
2139
  * @throws {AppwriteException}
2159
- * @returns {Promise}
2160
- */
2140
+ * @returns {Promise<Models.LogList>}
2141
+ */
2161
2142
  async listLogs(databaseId: string, queries?: string[]): Promise<Models.LogList> {
2162
2143
  if (typeof databaseId === 'undefined') {
2163
2144
  throw new AppwriteException('Missing required parameter: "databaseId"');
2164
2145
  }
2165
-
2166
2146
  const apiPath = '/databases/{databaseId}/logs'.replace('{databaseId}', databaseId);
2167
2147
  const payload: Payload = {};
2168
-
2169
2148
  if (typeof queries !== 'undefined') {
2170
2149
  payload['queries'] = queries;
2171
2150
  }
2172
-
2173
2151
  const uri = new URL(this.client.config.endpoint + apiPath);
2174
- return await this.client.call('get', uri, {
2152
+
2153
+ const apiHeaders: { [header: string]: string } = {
2175
2154
  'content-type': 'application/json',
2176
- }, payload);
2177
- }
2155
+ }
2178
2156
 
2157
+ return await this.client.call(
2158
+ 'get',
2159
+ uri,
2160
+ apiHeaders,
2161
+ payload
2162
+ );
2163
+ }
2179
2164
  /**
2180
2165
  * Get database usage stats
2181
2166
  *
@@ -2183,23 +2168,28 @@ export class Databases extends Service {
2183
2168
  * @param {string} databaseId
2184
2169
  * @param {DatabaseUsageRange} range
2185
2170
  * @throws {AppwriteException}
2186
- * @returns {Promise}
2187
- */
2171
+ * @returns {Promise<Models.UsageDatabase>}
2172
+ */
2188
2173
  async getDatabaseUsage(databaseId: string, range?: DatabaseUsageRange): Promise<Models.UsageDatabase> {
2189
2174
  if (typeof databaseId === 'undefined') {
2190
2175
  throw new AppwriteException('Missing required parameter: "databaseId"');
2191
2176
  }
2192
-
2193
2177
  const apiPath = '/databases/{databaseId}/usage'.replace('{databaseId}', databaseId);
2194
2178
  const payload: Payload = {};
2195
-
2196
2179
  if (typeof range !== 'undefined') {
2197
2180
  payload['range'] = range;
2198
2181
  }
2199
-
2200
2182
  const uri = new URL(this.client.config.endpoint + apiPath);
2201
- return await this.client.call('get', uri, {
2183
+
2184
+ const apiHeaders: { [header: string]: string } = {
2202
2185
  'content-type': 'application/json',
2203
- }, payload);
2186
+ }
2187
+
2188
+ return await this.client.call(
2189
+ 'get',
2190
+ uri,
2191
+ apiHeaders,
2192
+ payload
2193
+ );
2204
2194
  }
2205
- };
2195
+ }