node-appwrite 12.1.0-rc.4 → 13.0.0

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