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