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