chirag-appwrite-cli 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (491) hide show
  1. package/.github/workflows/npm-publish.yml +49 -0
  2. package/CHANGELOG.md +1 -0
  3. package/Formula/appwrite.rb +19 -0
  4. package/LICENSE.md +1 -0
  5. package/README.md +104 -0
  6. package/appwrite.json +164 -0
  7. package/docs/examples/account/create-anonymous-session.md +1 -0
  8. package/docs/examples/account/create-email-password-session.md +3 -0
  9. package/docs/examples/account/create-email-token.md +4 -0
  10. package/docs/examples/account/create-j-w-t.md +1 -0
  11. package/docs/examples/account/create-magic-u-r-l-token.md +5 -0
  12. package/docs/examples/account/create-mfa-authenticator.md +2 -0
  13. package/docs/examples/account/create-mfa-challenge.md +2 -0
  14. package/docs/examples/account/create-mfa-recovery-codes.md +1 -0
  15. package/docs/examples/account/create-o-auth2session.md +5 -0
  16. package/docs/examples/account/create-o-auth2token.md +5 -0
  17. package/docs/examples/account/create-phone-token.md +3 -0
  18. package/docs/examples/account/create-phone-verification.md +1 -0
  19. package/docs/examples/account/create-push-target.md +4 -0
  20. package/docs/examples/account/create-recovery.md +3 -0
  21. package/docs/examples/account/create-session.md +3 -0
  22. package/docs/examples/account/create-verification.md +2 -0
  23. package/docs/examples/account/create.md +5 -0
  24. package/docs/examples/account/delete-identity.md +2 -0
  25. package/docs/examples/account/delete-mfa-authenticator.md +2 -0
  26. package/docs/examples/account/delete-push-target.md +2 -0
  27. package/docs/examples/account/delete-session.md +2 -0
  28. package/docs/examples/account/delete-sessions.md +1 -0
  29. package/docs/examples/account/delete.md +1 -0
  30. package/docs/examples/account/get-mfa-recovery-codes.md +1 -0
  31. package/docs/examples/account/get-prefs.md +1 -0
  32. package/docs/examples/account/get-session.md +2 -0
  33. package/docs/examples/account/get.md +1 -0
  34. package/docs/examples/account/list-identities.md +2 -0
  35. package/docs/examples/account/list-logs.md +2 -0
  36. package/docs/examples/account/list-mfa-factors.md +1 -0
  37. package/docs/examples/account/list-sessions.md +1 -0
  38. package/docs/examples/account/update-email.md +3 -0
  39. package/docs/examples/account/update-m-f-a.md +2 -0
  40. package/docs/examples/account/update-magic-u-r-l-session.md +3 -0
  41. package/docs/examples/account/update-mfa-authenticator.md +3 -0
  42. package/docs/examples/account/update-mfa-challenge.md +3 -0
  43. package/docs/examples/account/update-mfa-recovery-codes.md +1 -0
  44. package/docs/examples/account/update-name.md +2 -0
  45. package/docs/examples/account/update-password.md +3 -0
  46. package/docs/examples/account/update-phone-session.md +3 -0
  47. package/docs/examples/account/update-phone-verification.md +3 -0
  48. package/docs/examples/account/update-phone.md +3 -0
  49. package/docs/examples/account/update-prefs.md +2 -0
  50. package/docs/examples/account/update-push-target.md +3 -0
  51. package/docs/examples/account/update-recovery.md +4 -0
  52. package/docs/examples/account/update-session.md +2 -0
  53. package/docs/examples/account/update-status.md +1 -0
  54. package/docs/examples/account/update-verification.md +3 -0
  55. package/docs/examples/avatars/get-browser.md +5 -0
  56. package/docs/examples/avatars/get-credit-card.md +5 -0
  57. package/docs/examples/avatars/get-favicon.md +2 -0
  58. package/docs/examples/avatars/get-flag.md +5 -0
  59. package/docs/examples/avatars/get-image.md +4 -0
  60. package/docs/examples/avatars/get-initials.md +5 -0
  61. package/docs/examples/avatars/get-q-r.md +5 -0
  62. package/docs/examples/console/get-resource.md +3 -0
  63. package/docs/examples/console/variables.md +1 -0
  64. package/docs/examples/databases/create-boolean-attribute.md +7 -0
  65. package/docs/examples/databases/create-collection.md +7 -0
  66. package/docs/examples/databases/create-datetime-attribute.md +7 -0
  67. package/docs/examples/databases/create-document.md +6 -0
  68. package/docs/examples/databases/create-documents.md +4 -0
  69. package/docs/examples/databases/create-email-attribute.md +7 -0
  70. package/docs/examples/databases/create-enum-attribute.md +8 -0
  71. package/docs/examples/databases/create-float-attribute.md +9 -0
  72. package/docs/examples/databases/create-index.md +8 -0
  73. package/docs/examples/databases/create-integer-attribute.md +9 -0
  74. package/docs/examples/databases/create-ip-attribute.md +7 -0
  75. package/docs/examples/databases/create-relationship-attribute.md +9 -0
  76. package/docs/examples/databases/create-string-attribute.md +9 -0
  77. package/docs/examples/databases/create-url-attribute.md +7 -0
  78. package/docs/examples/databases/create.md +4 -0
  79. package/docs/examples/databases/decrement-document-attribute.md +7 -0
  80. package/docs/examples/databases/delete-attribute.md +4 -0
  81. package/docs/examples/databases/delete-collection.md +3 -0
  82. package/docs/examples/databases/delete-document.md +4 -0
  83. package/docs/examples/databases/delete-documents.md +4 -0
  84. package/docs/examples/databases/delete-index.md +4 -0
  85. package/docs/examples/databases/delete.md +2 -0
  86. package/docs/examples/databases/get-attribute.md +4 -0
  87. package/docs/examples/databases/get-collection-usage.md +4 -0
  88. package/docs/examples/databases/get-collection.md +3 -0
  89. package/docs/examples/databases/get-database-usage.md +3 -0
  90. package/docs/examples/databases/get-document.md +5 -0
  91. package/docs/examples/databases/get-index.md +4 -0
  92. package/docs/examples/databases/get-usage.md +2 -0
  93. package/docs/examples/databases/get.md +2 -0
  94. package/docs/examples/databases/increment-document-attribute.md +7 -0
  95. package/docs/examples/databases/list-attributes.md +4 -0
  96. package/docs/examples/databases/list-collection-logs.md +4 -0
  97. package/docs/examples/databases/list-collections.md +4 -0
  98. package/docs/examples/databases/list-document-logs.md +5 -0
  99. package/docs/examples/databases/list-documents.md +4 -0
  100. package/docs/examples/databases/list-indexes.md +4 -0
  101. package/docs/examples/databases/list-logs.md +3 -0
  102. package/docs/examples/databases/list.md +3 -0
  103. package/docs/examples/databases/update-boolean-attribute.md +7 -0
  104. package/docs/examples/databases/update-collection.md +7 -0
  105. package/docs/examples/databases/update-datetime-attribute.md +7 -0
  106. package/docs/examples/databases/update-document.md +6 -0
  107. package/docs/examples/databases/update-documents.md +5 -0
  108. package/docs/examples/databases/update-email-attribute.md +7 -0
  109. package/docs/examples/databases/update-enum-attribute.md +8 -0
  110. package/docs/examples/databases/update-float-attribute.md +9 -0
  111. package/docs/examples/databases/update-integer-attribute.md +9 -0
  112. package/docs/examples/databases/update-ip-attribute.md +7 -0
  113. package/docs/examples/databases/update-relationship-attribute.md +6 -0
  114. package/docs/examples/databases/update-string-attribute.md +8 -0
  115. package/docs/examples/databases/update-url-attribute.md +7 -0
  116. package/docs/examples/databases/update.md +4 -0
  117. package/docs/examples/databases/upsert-document.md +6 -0
  118. package/docs/examples/databases/upsert-documents.md +4 -0
  119. package/docs/examples/functions/create-deployment.md +6 -0
  120. package/docs/examples/functions/create-duplicate-deployment.md +4 -0
  121. package/docs/examples/functions/create-execution.md +8 -0
  122. package/docs/examples/functions/create-template-deployment.md +7 -0
  123. package/docs/examples/functions/create-variable.md +5 -0
  124. package/docs/examples/functions/create-vcs-deployment.md +5 -0
  125. package/docs/examples/functions/create.md +19 -0
  126. package/docs/examples/functions/delete-deployment.md +3 -0
  127. package/docs/examples/functions/delete-execution.md +3 -0
  128. package/docs/examples/functions/delete-variable.md +3 -0
  129. package/docs/examples/functions/delete.md +2 -0
  130. package/docs/examples/functions/get-deployment-download.md +4 -0
  131. package/docs/examples/functions/get-deployment.md +3 -0
  132. package/docs/examples/functions/get-execution.md +3 -0
  133. package/docs/examples/functions/get-template.md +2 -0
  134. package/docs/examples/functions/get-usage.md +3 -0
  135. package/docs/examples/functions/get-variable.md +3 -0
  136. package/docs/examples/functions/get.md +2 -0
  137. package/docs/examples/functions/list-deployments.md +4 -0
  138. package/docs/examples/functions/list-executions.md +3 -0
  139. package/docs/examples/functions/list-runtimes.md +1 -0
  140. package/docs/examples/functions/list-specifications.md +1 -0
  141. package/docs/examples/functions/list-templates.md +5 -0
  142. package/docs/examples/functions/list-usage.md +2 -0
  143. package/docs/examples/functions/list-variables.md +2 -0
  144. package/docs/examples/functions/list.md +3 -0
  145. package/docs/examples/functions/update-deployment-status.md +3 -0
  146. package/docs/examples/functions/update-function-deployment.md +3 -0
  147. package/docs/examples/functions/update-variable.md +6 -0
  148. package/docs/examples/functions/update.md +19 -0
  149. package/docs/examples/graphql/mutation.md +2 -0
  150. package/docs/examples/graphql/query.md +2 -0
  151. package/docs/examples/health/get-antivirus.md +1 -0
  152. package/docs/examples/health/get-cache.md +1 -0
  153. package/docs/examples/health/get-certificate.md +2 -0
  154. package/docs/examples/health/get-d-b.md +1 -0
  155. package/docs/examples/health/get-failed-jobs.md +3 -0
  156. package/docs/examples/health/get-pub-sub.md +1 -0
  157. package/docs/examples/health/get-queue-builds.md +2 -0
  158. package/docs/examples/health/get-queue-certificates.md +2 -0
  159. package/docs/examples/health/get-queue-databases.md +3 -0
  160. package/docs/examples/health/get-queue-deletes.md +2 -0
  161. package/docs/examples/health/get-queue-functions.md +2 -0
  162. package/docs/examples/health/get-queue-logs.md +2 -0
  163. package/docs/examples/health/get-queue-mails.md +2 -0
  164. package/docs/examples/health/get-queue-messaging.md +2 -0
  165. package/docs/examples/health/get-queue-migrations.md +2 -0
  166. package/docs/examples/health/get-queue-stats-resources.md +2 -0
  167. package/docs/examples/health/get-queue-usage.md +2 -0
  168. package/docs/examples/health/get-queue-webhooks.md +2 -0
  169. package/docs/examples/health/get-storage-local.md +1 -0
  170. package/docs/examples/health/get-storage.md +1 -0
  171. package/docs/examples/health/get-time.md +1 -0
  172. package/docs/examples/health/get.md +1 -0
  173. package/docs/examples/locale/get.md +1 -0
  174. package/docs/examples/locale/list-codes.md +1 -0
  175. package/docs/examples/locale/list-continents.md +1 -0
  176. package/docs/examples/locale/list-countries-e-u.md +1 -0
  177. package/docs/examples/locale/list-countries-phones.md +1 -0
  178. package/docs/examples/locale/list-countries.md +1 -0
  179. package/docs/examples/locale/list-currencies.md +1 -0
  180. package/docs/examples/locale/list-languages.md +1 -0
  181. package/docs/examples/messaging/create-apns-provider.md +9 -0
  182. package/docs/examples/messaging/create-email.md +13 -0
  183. package/docs/examples/messaging/create-fcm-provider.md +5 -0
  184. package/docs/examples/messaging/create-mailgun-provider.md +11 -0
  185. package/docs/examples/messaging/create-msg91provider.md +7 -0
  186. package/docs/examples/messaging/create-push.md +20 -0
  187. package/docs/examples/messaging/create-sendgrid-provider.md +9 -0
  188. package/docs/examples/messaging/create-sms.md +8 -0
  189. package/docs/examples/messaging/create-smtp-provider.md +15 -0
  190. package/docs/examples/messaging/create-subscriber.md +4 -0
  191. package/docs/examples/messaging/create-telesign-provider.md +7 -0
  192. package/docs/examples/messaging/create-textmagic-provider.md +7 -0
  193. package/docs/examples/messaging/create-topic.md +4 -0
  194. package/docs/examples/messaging/create-twilio-provider.md +7 -0
  195. package/docs/examples/messaging/create-vonage-provider.md +7 -0
  196. package/docs/examples/messaging/delete-provider.md +2 -0
  197. package/docs/examples/messaging/delete-subscriber.md +3 -0
  198. package/docs/examples/messaging/delete-topic.md +2 -0
  199. package/docs/examples/messaging/delete.md +2 -0
  200. package/docs/examples/messaging/get-message.md +2 -0
  201. package/docs/examples/messaging/get-provider.md +2 -0
  202. package/docs/examples/messaging/get-subscriber.md +3 -0
  203. package/docs/examples/messaging/get-topic.md +2 -0
  204. package/docs/examples/messaging/list-message-logs.md +3 -0
  205. package/docs/examples/messaging/list-messages.md +3 -0
  206. package/docs/examples/messaging/list-provider-logs.md +3 -0
  207. package/docs/examples/messaging/list-providers.md +3 -0
  208. package/docs/examples/messaging/list-subscriber-logs.md +3 -0
  209. package/docs/examples/messaging/list-subscribers.md +4 -0
  210. package/docs/examples/messaging/list-targets.md +3 -0
  211. package/docs/examples/messaging/list-topic-logs.md +3 -0
  212. package/docs/examples/messaging/list-topics.md +3 -0
  213. package/docs/examples/messaging/update-apns-provider.md +9 -0
  214. package/docs/examples/messaging/update-email.md +13 -0
  215. package/docs/examples/messaging/update-fcm-provider.md +5 -0
  216. package/docs/examples/messaging/update-mailgun-provider.md +11 -0
  217. package/docs/examples/messaging/update-msg91provider.md +7 -0
  218. package/docs/examples/messaging/update-push.md +20 -0
  219. package/docs/examples/messaging/update-sendgrid-provider.md +9 -0
  220. package/docs/examples/messaging/update-sms.md +8 -0
  221. package/docs/examples/messaging/update-smtp-provider.md +15 -0
  222. package/docs/examples/messaging/update-telesign-provider.md +7 -0
  223. package/docs/examples/messaging/update-textmagic-provider.md +7 -0
  224. package/docs/examples/messaging/update-topic.md +4 -0
  225. package/docs/examples/messaging/update-twilio-provider.md +7 -0
  226. package/docs/examples/messaging/update-vonage-provider.md +7 -0
  227. package/docs/examples/migrations/create-appwrite-migration.md +5 -0
  228. package/docs/examples/migrations/create-csv-migration.md +4 -0
  229. package/docs/examples/migrations/create-firebase-migration.md +3 -0
  230. package/docs/examples/migrations/create-n-host-migration.md +9 -0
  231. package/docs/examples/migrations/create-supabase-migration.md +8 -0
  232. package/docs/examples/migrations/delete.md +2 -0
  233. package/docs/examples/migrations/get-appwrite-report.md +5 -0
  234. package/docs/examples/migrations/get-firebase-report.md +3 -0
  235. package/docs/examples/migrations/get-n-host-report.md +9 -0
  236. package/docs/examples/migrations/get-supabase-report.md +8 -0
  237. package/docs/examples/migrations/get.md +2 -0
  238. package/docs/examples/migrations/list.md +3 -0
  239. package/docs/examples/migrations/retry.md +2 -0
  240. package/docs/examples/project/create-variable.md +4 -0
  241. package/docs/examples/project/delete-variable.md +2 -0
  242. package/docs/examples/project/get-usage.md +4 -0
  243. package/docs/examples/project/get-variable.md +2 -0
  244. package/docs/examples/project/list-variables.md +1 -0
  245. package/docs/examples/project/update-variable.md +5 -0
  246. package/docs/examples/projects/create-dev-key.md +4 -0
  247. package/docs/examples/projects/create-j-w-t.md +4 -0
  248. package/docs/examples/projects/create-key.md +5 -0
  249. package/docs/examples/projects/create-platform.md +7 -0
  250. package/docs/examples/projects/create-smtp-test.md +11 -0
  251. package/docs/examples/projects/create-webhook.md +9 -0
  252. package/docs/examples/projects/create.md +14 -0
  253. package/docs/examples/projects/delete-dev-key.md +3 -0
  254. package/docs/examples/projects/delete-email-template.md +4 -0
  255. package/docs/examples/projects/delete-key.md +3 -0
  256. package/docs/examples/projects/delete-platform.md +3 -0
  257. package/docs/examples/projects/delete-sms-template.md +4 -0
  258. package/docs/examples/projects/delete-webhook.md +3 -0
  259. package/docs/examples/projects/delete.md +2 -0
  260. package/docs/examples/projects/get-dev-key.md +3 -0
  261. package/docs/examples/projects/get-email-template.md +4 -0
  262. package/docs/examples/projects/get-key.md +3 -0
  263. package/docs/examples/projects/get-platform.md +3 -0
  264. package/docs/examples/projects/get-sms-template.md +4 -0
  265. package/docs/examples/projects/get-webhook.md +3 -0
  266. package/docs/examples/projects/get.md +2 -0
  267. package/docs/examples/projects/list-dev-keys.md +3 -0
  268. package/docs/examples/projects/list-keys.md +2 -0
  269. package/docs/examples/projects/list-platforms.md +2 -0
  270. package/docs/examples/projects/list-webhooks.md +2 -0
  271. package/docs/examples/projects/list.md +3 -0
  272. package/docs/examples/projects/update-api-status-all.md +3 -0
  273. package/docs/examples/projects/update-api-status.md +4 -0
  274. package/docs/examples/projects/update-auth-duration.md +3 -0
  275. package/docs/examples/projects/update-auth-limit.md +3 -0
  276. package/docs/examples/projects/update-auth-password-dictionary.md +3 -0
  277. package/docs/examples/projects/update-auth-password-history.md +3 -0
  278. package/docs/examples/projects/update-auth-sessions-limit.md +3 -0
  279. package/docs/examples/projects/update-auth-status.md +4 -0
  280. package/docs/examples/projects/update-dev-key.md +5 -0
  281. package/docs/examples/projects/update-email-template.md +9 -0
  282. package/docs/examples/projects/update-key.md +6 -0
  283. package/docs/examples/projects/update-memberships-privacy.md +5 -0
  284. package/docs/examples/projects/update-mock-numbers.md +3 -0
  285. package/docs/examples/projects/update-o-auth2.md +6 -0
  286. package/docs/examples/projects/update-personal-data-check.md +3 -0
  287. package/docs/examples/projects/update-platform.md +7 -0
  288. package/docs/examples/projects/update-service-status-all.md +3 -0
  289. package/docs/examples/projects/update-service-status.md +4 -0
  290. package/docs/examples/projects/update-session-alerts.md +3 -0
  291. package/docs/examples/projects/update-sms-template.md +5 -0
  292. package/docs/examples/projects/update-smtp.md +11 -0
  293. package/docs/examples/projects/update-team.md +3 -0
  294. package/docs/examples/projects/update-webhook-signature.md +3 -0
  295. package/docs/examples/projects/update-webhook.md +10 -0
  296. package/docs/examples/projects/update.md +12 -0
  297. package/docs/examples/proxy/create-a-p-i-rule.md +2 -0
  298. package/docs/examples/proxy/create-function-rule.md +4 -0
  299. package/docs/examples/proxy/create-redirect-rule.md +6 -0
  300. package/docs/examples/proxy/create-site-rule.md +4 -0
  301. package/docs/examples/proxy/delete-rule.md +2 -0
  302. package/docs/examples/proxy/get-rule.md +2 -0
  303. package/docs/examples/proxy/list-rules.md +3 -0
  304. package/docs/examples/proxy/update-rule-verification.md +2 -0
  305. package/docs/examples/sites/create-deployment.md +7 -0
  306. package/docs/examples/sites/create-duplicate-deployment.md +3 -0
  307. package/docs/examples/sites/create-template-deployment.md +7 -0
  308. package/docs/examples/sites/create-variable.md +5 -0
  309. package/docs/examples/sites/create-vcs-deployment.md +5 -0
  310. package/docs/examples/sites/create.md +19 -0
  311. package/docs/examples/sites/delete-deployment.md +3 -0
  312. package/docs/examples/sites/delete-log.md +3 -0
  313. package/docs/examples/sites/delete-variable.md +3 -0
  314. package/docs/examples/sites/delete.md +2 -0
  315. package/docs/examples/sites/get-deployment-download.md +4 -0
  316. package/docs/examples/sites/get-deployment.md +3 -0
  317. package/docs/examples/sites/get-log.md +3 -0
  318. package/docs/examples/sites/get-template.md +2 -0
  319. package/docs/examples/sites/get-usage.md +3 -0
  320. package/docs/examples/sites/get-variable.md +3 -0
  321. package/docs/examples/sites/get.md +2 -0
  322. package/docs/examples/sites/list-deployments.md +4 -0
  323. package/docs/examples/sites/list-frameworks.md +1 -0
  324. package/docs/examples/sites/list-logs.md +3 -0
  325. package/docs/examples/sites/list-specifications.md +1 -0
  326. package/docs/examples/sites/list-templates.md +5 -0
  327. package/docs/examples/sites/list-usage.md +2 -0
  328. package/docs/examples/sites/list-variables.md +2 -0
  329. package/docs/examples/sites/list.md +3 -0
  330. package/docs/examples/sites/update-deployment-status.md +3 -0
  331. package/docs/examples/sites/update-site-deployment.md +3 -0
  332. package/docs/examples/sites/update-variable.md +6 -0
  333. package/docs/examples/sites/update.md +19 -0
  334. package/docs/examples/storage/create-bucket.md +11 -0
  335. package/docs/examples/storage/create-file.md +5 -0
  336. package/docs/examples/storage/delete-bucket.md +2 -0
  337. package/docs/examples/storage/delete-file.md +3 -0
  338. package/docs/examples/storage/get-bucket-usage.md +3 -0
  339. package/docs/examples/storage/get-bucket.md +2 -0
  340. package/docs/examples/storage/get-file-download.md +4 -0
  341. package/docs/examples/storage/get-file-preview.md +15 -0
  342. package/docs/examples/storage/get-file-view.md +4 -0
  343. package/docs/examples/storage/get-file.md +3 -0
  344. package/docs/examples/storage/get-usage.md +2 -0
  345. package/docs/examples/storage/list-buckets.md +3 -0
  346. package/docs/examples/storage/list-files.md +4 -0
  347. package/docs/examples/storage/update-bucket.md +11 -0
  348. package/docs/examples/storage/update-file.md +5 -0
  349. package/docs/examples/teams/create-membership.md +8 -0
  350. package/docs/examples/teams/create.md +4 -0
  351. package/docs/examples/teams/delete-membership.md +3 -0
  352. package/docs/examples/teams/delete.md +2 -0
  353. package/docs/examples/teams/get-membership.md +3 -0
  354. package/docs/examples/teams/get-prefs.md +2 -0
  355. package/docs/examples/teams/get.md +2 -0
  356. package/docs/examples/teams/list-logs.md +3 -0
  357. package/docs/examples/teams/list-memberships.md +4 -0
  358. package/docs/examples/teams/list.md +3 -0
  359. package/docs/examples/teams/update-membership-status.md +5 -0
  360. package/docs/examples/teams/update-membership.md +4 -0
  361. package/docs/examples/teams/update-name.md +3 -0
  362. package/docs/examples/teams/update-prefs.md +3 -0
  363. package/docs/examples/tokens/create-file-token.md +4 -0
  364. package/docs/examples/tokens/delete.md +2 -0
  365. package/docs/examples/tokens/get.md +2 -0
  366. package/docs/examples/tokens/list.md +4 -0
  367. package/docs/examples/tokens/update.md +3 -0
  368. package/docs/examples/users/create-argon2user.md +5 -0
  369. package/docs/examples/users/create-bcrypt-user.md +5 -0
  370. package/docs/examples/users/create-j-w-t.md +4 -0
  371. package/docs/examples/users/create-m-d5user.md +5 -0
  372. package/docs/examples/users/create-mfa-recovery-codes.md +2 -0
  373. package/docs/examples/users/create-p-h-pass-user.md +5 -0
  374. package/docs/examples/users/create-s-h-a-user.md +6 -0
  375. package/docs/examples/users/create-scrypt-modified-user.md +8 -0
  376. package/docs/examples/users/create-scrypt-user.md +10 -0
  377. package/docs/examples/users/create-session.md +2 -0
  378. package/docs/examples/users/create-target.md +7 -0
  379. package/docs/examples/users/create-token.md +4 -0
  380. package/docs/examples/users/create.md +6 -0
  381. package/docs/examples/users/delete-identity.md +2 -0
  382. package/docs/examples/users/delete-mfa-authenticator.md +3 -0
  383. package/docs/examples/users/delete-session.md +3 -0
  384. package/docs/examples/users/delete-sessions.md +2 -0
  385. package/docs/examples/users/delete-target.md +3 -0
  386. package/docs/examples/users/delete.md +2 -0
  387. package/docs/examples/users/get-mfa-recovery-codes.md +2 -0
  388. package/docs/examples/users/get-prefs.md +2 -0
  389. package/docs/examples/users/get-target.md +3 -0
  390. package/docs/examples/users/get-usage.md +2 -0
  391. package/docs/examples/users/get.md +2 -0
  392. package/docs/examples/users/list-identities.md +3 -0
  393. package/docs/examples/users/list-logs.md +3 -0
  394. package/docs/examples/users/list-memberships.md +4 -0
  395. package/docs/examples/users/list-mfa-factors.md +2 -0
  396. package/docs/examples/users/list-sessions.md +2 -0
  397. package/docs/examples/users/list-targets.md +3 -0
  398. package/docs/examples/users/list.md +3 -0
  399. package/docs/examples/users/update-email-verification.md +3 -0
  400. package/docs/examples/users/update-email.md +3 -0
  401. package/docs/examples/users/update-labels.md +3 -0
  402. package/docs/examples/users/update-mfa-recovery-codes.md +2 -0
  403. package/docs/examples/users/update-mfa.md +3 -0
  404. package/docs/examples/users/update-name.md +3 -0
  405. package/docs/examples/users/update-password.md +3 -0
  406. package/docs/examples/users/update-phone-verification.md +3 -0
  407. package/docs/examples/users/update-phone.md +3 -0
  408. package/docs/examples/users/update-prefs.md +3 -0
  409. package/docs/examples/users/update-status.md +3 -0
  410. package/docs/examples/users/update-target.md +6 -0
  411. package/docs/examples/vcs/create-repository-detection.md +5 -0
  412. package/docs/examples/vcs/create-repository.md +4 -0
  413. package/docs/examples/vcs/delete-installation.md +2 -0
  414. package/docs/examples/vcs/get-installation.md +2 -0
  415. package/docs/examples/vcs/get-repository-contents.md +5 -0
  416. package/docs/examples/vcs/get-repository.md +3 -0
  417. package/docs/examples/vcs/list-installations.md +3 -0
  418. package/docs/examples/vcs/list-repositories.md +4 -0
  419. package/docs/examples/vcs/list-repository-branches.md +3 -0
  420. package/docs/examples/vcs/update-external-deployments.md +4 -0
  421. package/functions/Starter function/.prettierrc.json +6 -0
  422. package/functions/Starter function/README.md +48 -0
  423. package/functions/Starter function/package-lock.json +60 -0
  424. package/functions/Starter function/package.json +16 -0
  425. package/functions/Starter function/src/main.js +35 -0
  426. package/generate/appwrite.d.ts +18 -0
  427. package/index.js +109 -0
  428. package/install.ps1 +98 -0
  429. package/install.sh +157 -0
  430. package/lib/client.js +259 -0
  431. package/lib/commands/account.js +2074 -0
  432. package/lib/commands/avatars.js +491 -0
  433. package/lib/commands/console.js +129 -0
  434. package/lib/commands/databases.js +2972 -0
  435. package/lib/commands/functions.js +1737 -0
  436. package/lib/commands/generic.js +328 -0
  437. package/lib/commands/graphql.js +128 -0
  438. package/lib/commands/health.js +891 -0
  439. package/lib/commands/init.js +566 -0
  440. package/lib/commands/locale.js +324 -0
  441. package/lib/commands/messaging.js +2970 -0
  442. package/lib/commands/migrations.js +751 -0
  443. package/lib/commands/organizations.js +48 -0
  444. package/lib/commands/project.js +308 -0
  445. package/lib/commands/projects.js +2615 -0
  446. package/lib/commands/proxy.js +406 -0
  447. package/lib/commands/pull.js +474 -0
  448. package/lib/commands/push.js +2117 -0
  449. package/lib/commands/run.js +330 -0
  450. package/lib/commands/sites.js +1663 -0
  451. package/lib/commands/storage.js +990 -0
  452. package/lib/commands/teams.js +682 -0
  453. package/lib/commands/tokens.js +261 -0
  454. package/lib/commands/types.js +156 -0
  455. package/lib/commands/users.js +2035 -0
  456. package/lib/commands/vcs.js +484 -0
  457. package/lib/config.js +705 -0
  458. package/lib/emulation/docker.js +264 -0
  459. package/lib/emulation/utils.js +186 -0
  460. package/lib/exception.js +9 -0
  461. package/lib/id.js +30 -0
  462. package/lib/paginate.js +52 -0
  463. package/lib/parser.js +246 -0
  464. package/lib/questions.js +1006 -0
  465. package/lib/sdks.js +60 -0
  466. package/lib/spinner.js +104 -0
  467. package/lib/type-generation/attribute.js +16 -0
  468. package/lib/type-generation/languages/dart.js +196 -0
  469. package/lib/type-generation/languages/java.js +130 -0
  470. package/lib/type-generation/languages/javascript.js +102 -0
  471. package/lib/type-generation/languages/kotlin.js +84 -0
  472. package/lib/type-generation/languages/language.js +125 -0
  473. package/lib/type-generation/languages/php.js +109 -0
  474. package/lib/type-generation/languages/swift.js +169 -0
  475. package/lib/type-generation/languages/typescript.js +102 -0
  476. package/lib/utils.js +289 -0
  477. package/lib/validations.js +17 -0
  478. package/package.json +50 -0
  479. package/scoop/appwrite.json +30 -0
  480. package/sites/JavaScript starter/.env.example +3 -0
  481. package/sites/JavaScript starter/LICENSE +21 -0
  482. package/sites/JavaScript starter/images/appwrite.svg +8 -0
  483. package/sites/JavaScript starter/images/javascript.svg +5 -0
  484. package/sites/JavaScript starter/index.html +250 -0
  485. package/sites/JavaScript starter/lib/appwrite.js +10 -0
  486. package/sites/JavaScript starter/package-lock.json +1431 -0
  487. package/sites/JavaScript starter/package.json +21 -0
  488. package/sites/JavaScript starter/readme.md +26 -0
  489. package/sites/JavaScript starter/src/javascript.svg +1 -0
  490. package/sites/JavaScript starter/style/app.css +20 -0
  491. package/sites/JavaScript starter/vite.config.js +7 -0
@@ -0,0 +1,1663 @@
1
+ const fs = require('fs');
2
+ const pathLib = require('path');
3
+ const tar = require("tar");
4
+ const ignore = require("ignore");
5
+ const { promisify } = require('util');
6
+ const libClient = require('../client.js');
7
+ const { getAllFiles, showConsoleLink } = require('../utils.js');
8
+ const { Command } = require('commander');
9
+ const { sdkForProject, sdkForConsole } = require('../sdks')
10
+ const { parse, actionRunner, parseInteger, parseBool, commandDescriptions, success, log } = require('../parser')
11
+ const { localConfig, globalConfig } = require("../config");
12
+ const { File } = require('undici');
13
+ const { ReadableStream } = require('stream/web');
14
+
15
+ /**
16
+ * @param {fs.ReadStream} readStream
17
+ * @returns {ReadableStream}
18
+ */
19
+ function convertReadStreamToReadableStream(readStream) {
20
+ return new ReadableStream({
21
+ start(controller) {
22
+ readStream.on("data", (chunk) => {
23
+ controller.enqueue(chunk);
24
+ });
25
+ readStream.on("end", () => {
26
+ controller.close();
27
+ });
28
+ readStream.on("error", (err) => {
29
+ controller.error(err);
30
+ });
31
+ },
32
+ cancel() {
33
+ readStream.destroy();
34
+ },
35
+ });
36
+ }
37
+
38
+ const sites = new Command("sites").description(commandDescriptions['sites'] ?? '').configureHelp({
39
+ helpWidth: process.stdout.columns || 80
40
+ })
41
+
42
+ /**
43
+ * @typedef {Object} SitesListRequestParams
44
+ * @property {string[]} queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, enabled, framework, deploymentId, buildCommand, installCommand, outputDirectory, installationId
45
+ * @property {string} search Search term to filter your list results. Max length: 256 chars.
46
+ * @property {boolean} overrideForCli
47
+ * @property {boolean} parseOutput
48
+ * @property {libClient | undefined} sdk
49
+ */
50
+
51
+ /**
52
+ * @param {SitesListRequestParams} params
53
+ */
54
+ const sitesList = async ({queries,search,parseOutput = true, overrideForCli = false, sdk = undefined, console}) => {
55
+ let client = !sdk ? await sdkForProject() :
56
+ sdk;
57
+ let apiPath = '/sites';
58
+ let payload = {};
59
+ if (typeof queries !== 'undefined') {
60
+ payload['queries'] = queries;
61
+ }
62
+ if (typeof search !== 'undefined') {
63
+ payload['search'] = search;
64
+ }
65
+
66
+ let response = undefined;
67
+
68
+ response = await client.call('get', apiPath, {
69
+ }, payload);
70
+
71
+ if (parseOutput) {
72
+ if(console) {
73
+ showConsoleLink('sites', 'list');
74
+ } else {
75
+ parse(response)
76
+ }
77
+ }
78
+
79
+ return response;
80
+
81
+ }
82
+
83
+ /**
84
+ * @typedef {Object} SitesCreateRequestParams
85
+ * @property {string} siteId Site ID. Choose a custom ID or generate a random ID with 'ID.unique()'. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
86
+ * @property {string} name Site name. Max length: 128 chars.
87
+ * @property {Framework} framework Sites framework.
88
+ * @property {BuildRuntime} buildRuntime Runtime to use during build step.
89
+ * @property {boolean} enabled Is site enabled? When set to 'disabled', users cannot access the site but Server SDKs with and API key can still access the site. No data is lost when this is toggled.
90
+ * @property {boolean} logging When disabled, request logs will exclude logs and errors, and site responses will be slightly faster.
91
+ * @property {number} timeout Maximum request time in seconds.
92
+ * @property {string} installCommand Install Command.
93
+ * @property {string} buildCommand Build Command.
94
+ * @property {string} outputDirectory Output Directory for site.
95
+ * @property {Adapter} adapter Framework adapter defining rendering strategy. Allowed values are: static, ssr
96
+ * @property {string} installationId Appwrite Installation ID for VCS (Version Control System) deployment.
97
+ * @property {string} fallbackFile Fallback file for single page application sites.
98
+ * @property {string} providerRepositoryId Repository ID of the repo linked to the site.
99
+ * @property {string} providerBranch Production branch for the repo linked to the site.
100
+ * @property {boolean} providerSilentMode Is the VCS (Version Control System) connection in silent mode for the repo linked to the site? In silent mode, comments will not be made on commits and pull requests.
101
+ * @property {string} providerRootDirectory Path to site code in the linked repo.
102
+ * @property {string} specification Framework specification for the site and builds.
103
+ * @property {boolean} overrideForCli
104
+ * @property {boolean} parseOutput
105
+ * @property {libClient | undefined} sdk
106
+ */
107
+
108
+ /**
109
+ * @param {SitesCreateRequestParams} params
110
+ */
111
+ const sitesCreate = async ({siteId,name,framework,buildRuntime,enabled,logging,timeout,installCommand,buildCommand,outputDirectory,adapter,installationId,fallbackFile,providerRepositoryId,providerBranch,providerSilentMode,providerRootDirectory,specification,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
112
+ let client = !sdk ? await sdkForProject() :
113
+ sdk;
114
+ let apiPath = '/sites';
115
+ let payload = {};
116
+ if (typeof siteId !== 'undefined') {
117
+ payload['siteId'] = siteId;
118
+ }
119
+ if (typeof name !== 'undefined') {
120
+ payload['name'] = name;
121
+ }
122
+ if (typeof framework !== 'undefined') {
123
+ payload['framework'] = framework;
124
+ }
125
+ if (typeof enabled !== 'undefined') {
126
+ payload['enabled'] = enabled;
127
+ }
128
+ if (typeof logging !== 'undefined') {
129
+ payload['logging'] = logging;
130
+ }
131
+ if (typeof timeout !== 'undefined') {
132
+ payload['timeout'] = timeout;
133
+ }
134
+ if (typeof installCommand !== 'undefined') {
135
+ payload['installCommand'] = installCommand;
136
+ }
137
+ if (typeof buildCommand !== 'undefined') {
138
+ payload['buildCommand'] = buildCommand;
139
+ }
140
+ if (typeof outputDirectory !== 'undefined') {
141
+ payload['outputDirectory'] = outputDirectory;
142
+ }
143
+ if (typeof buildRuntime !== 'undefined') {
144
+ payload['buildRuntime'] = buildRuntime;
145
+ }
146
+ if (typeof adapter !== 'undefined') {
147
+ payload['adapter'] = adapter;
148
+ }
149
+ if (typeof installationId !== 'undefined') {
150
+ payload['installationId'] = installationId;
151
+ }
152
+ if (typeof fallbackFile !== 'undefined') {
153
+ payload['fallbackFile'] = fallbackFile;
154
+ }
155
+ if (typeof providerRepositoryId !== 'undefined') {
156
+ payload['providerRepositoryId'] = providerRepositoryId;
157
+ }
158
+ if (typeof providerBranch !== 'undefined') {
159
+ payload['providerBranch'] = providerBranch;
160
+ }
161
+ if (typeof providerSilentMode !== 'undefined') {
162
+ payload['providerSilentMode'] = providerSilentMode;
163
+ }
164
+ if (typeof providerRootDirectory !== 'undefined') {
165
+ payload['providerRootDirectory'] = providerRootDirectory;
166
+ }
167
+ if (typeof specification !== 'undefined') {
168
+ payload['specification'] = specification;
169
+ }
170
+
171
+ let response = undefined;
172
+
173
+ response = await client.call('post', apiPath, {
174
+ 'content-type': 'application/json',
175
+ }, payload);
176
+
177
+ if (parseOutput) {
178
+ parse(response)
179
+ }
180
+
181
+ return response;
182
+
183
+ }
184
+
185
+ /**
186
+ * @typedef {Object} SitesListFrameworksRequestParams
187
+ * @property {boolean} overrideForCli
188
+ * @property {boolean} parseOutput
189
+ * @property {libClient | undefined} sdk
190
+ */
191
+
192
+ /**
193
+ * @param {SitesListFrameworksRequestParams} params
194
+ */
195
+ const sitesListFrameworks = async ({parseOutput = true, overrideForCli = false, sdk = undefined, console}) => {
196
+ let client = !sdk ? await sdkForProject() :
197
+ sdk;
198
+ let apiPath = '/sites/frameworks';
199
+ let payload = {};
200
+
201
+ let response = undefined;
202
+
203
+ response = await client.call('get', apiPath, {
204
+ }, payload);
205
+
206
+ if (parseOutput) {
207
+ if(console) {
208
+ showConsoleLink('sites', 'listFrameworks');
209
+ } else {
210
+ parse(response)
211
+ }
212
+ }
213
+
214
+ return response;
215
+
216
+ }
217
+
218
+ /**
219
+ * @typedef {Object} SitesListSpecificationsRequestParams
220
+ * @property {boolean} overrideForCli
221
+ * @property {boolean} parseOutput
222
+ * @property {libClient | undefined} sdk
223
+ */
224
+
225
+ /**
226
+ * @param {SitesListSpecificationsRequestParams} params
227
+ */
228
+ const sitesListSpecifications = async ({parseOutput = true, overrideForCli = false, sdk = undefined, console}) => {
229
+ let client = !sdk ? await sdkForProject() :
230
+ sdk;
231
+ let apiPath = '/sites/specifications';
232
+ let payload = {};
233
+
234
+ let response = undefined;
235
+
236
+ response = await client.call('get', apiPath, {
237
+ }, payload);
238
+
239
+ if (parseOutput) {
240
+ if(console) {
241
+ showConsoleLink('sites', 'listSpecifications');
242
+ } else {
243
+ parse(response)
244
+ }
245
+ }
246
+
247
+ return response;
248
+
249
+ }
250
+
251
+ /**
252
+ * @typedef {Object} SitesListTemplatesRequestParams
253
+ * @property {string[]} frameworks List of frameworks allowed for filtering site templates. Maximum of 100 frameworks are allowed.
254
+ * @property {string[]} useCases List of use cases allowed for filtering site templates. Maximum of 100 use cases are allowed.
255
+ * @property {number} limit Limit the number of templates returned in the response. Default limit is 25, and maximum limit is 5000.
256
+ * @property {number} offset Offset the list of returned templates. Maximum offset is 5000.
257
+ * @property {boolean} overrideForCli
258
+ * @property {boolean} parseOutput
259
+ * @property {libClient | undefined} sdk
260
+ */
261
+
262
+ /**
263
+ * @param {SitesListTemplatesRequestParams} params
264
+ */
265
+ const sitesListTemplates = async ({frameworks,useCases,limit,offset,parseOutput = true, overrideForCli = false, sdk = undefined, console}) => {
266
+ let client = !sdk ? await sdkForProject() :
267
+ sdk;
268
+ let apiPath = '/sites/templates';
269
+ let payload = {};
270
+ if (typeof frameworks !== 'undefined') {
271
+ payload['frameworks'] = frameworks;
272
+ }
273
+ if (typeof useCases !== 'undefined') {
274
+ payload['useCases'] = useCases;
275
+ }
276
+ if (typeof limit !== 'undefined') {
277
+ payload['limit'] = limit;
278
+ }
279
+ if (typeof offset !== 'undefined') {
280
+ payload['offset'] = offset;
281
+ }
282
+
283
+ let response = undefined;
284
+
285
+ response = await client.call('get', apiPath, {
286
+ }, payload);
287
+
288
+ if (parseOutput) {
289
+ if(console) {
290
+ showConsoleLink('sites', 'listTemplates');
291
+ } else {
292
+ parse(response)
293
+ }
294
+ }
295
+
296
+ return response;
297
+
298
+ }
299
+
300
+ /**
301
+ * @typedef {Object} SitesGetTemplateRequestParams
302
+ * @property {string} templateId Template ID.
303
+ * @property {boolean} overrideForCli
304
+ * @property {boolean} parseOutput
305
+ * @property {libClient | undefined} sdk
306
+ */
307
+
308
+ /**
309
+ * @param {SitesGetTemplateRequestParams} params
310
+ */
311
+ const sitesGetTemplate = async ({templateId,parseOutput = true, overrideForCli = false, sdk = undefined, console}) => {
312
+ let client = !sdk ? await sdkForProject() :
313
+ sdk;
314
+ let apiPath = '/sites/templates/{templateId}'.replace('{templateId}', templateId);
315
+ let payload = {};
316
+
317
+ let response = undefined;
318
+
319
+ response = await client.call('get', apiPath, {
320
+ }, payload);
321
+
322
+ if (parseOutput) {
323
+ if(console) {
324
+ showConsoleLink('sites', 'getTemplate', templateId);
325
+ } else {
326
+ parse(response)
327
+ }
328
+ }
329
+
330
+ return response;
331
+
332
+ }
333
+
334
+ /**
335
+ * @typedef {Object} SitesListUsageRequestParams
336
+ * @property {SiteUsageRange} range Date range.
337
+ * @property {boolean} overrideForCli
338
+ * @property {boolean} parseOutput
339
+ * @property {libClient | undefined} sdk
340
+ */
341
+
342
+ /**
343
+ * @param {SitesListUsageRequestParams} params
344
+ */
345
+ const sitesListUsage = async ({range,parseOutput = true, overrideForCli = false, sdk = undefined, console}) => {
346
+ let client = !sdk ? await sdkForProject() :
347
+ sdk;
348
+ let apiPath = '/sites/usage';
349
+ let payload = {};
350
+ if (typeof range !== 'undefined') {
351
+ payload['range'] = range;
352
+ }
353
+
354
+ let response = undefined;
355
+
356
+ response = await client.call('get', apiPath, {
357
+ }, payload);
358
+
359
+ if (parseOutput) {
360
+ if(console) {
361
+ showConsoleLink('sites', 'listUsage');
362
+ } else {
363
+ parse(response)
364
+ }
365
+ }
366
+
367
+ return response;
368
+
369
+ }
370
+
371
+ /**
372
+ * @typedef {Object} SitesGetRequestParams
373
+ * @property {string} siteId Site ID.
374
+ * @property {boolean} overrideForCli
375
+ * @property {boolean} parseOutput
376
+ * @property {libClient | undefined} sdk
377
+ */
378
+
379
+ /**
380
+ * @param {SitesGetRequestParams} params
381
+ */
382
+ const sitesGet = async ({siteId,parseOutput = true, overrideForCli = false, sdk = undefined, console}) => {
383
+ let client = !sdk ? await sdkForProject() :
384
+ sdk;
385
+ let apiPath = '/sites/{siteId}'.replace('{siteId}', siteId);
386
+ let payload = {};
387
+
388
+ let response = undefined;
389
+
390
+ response = await client.call('get', apiPath, {
391
+ }, payload);
392
+
393
+ if (parseOutput) {
394
+ if(console) {
395
+ showConsoleLink('sites', 'get', siteId);
396
+ } else {
397
+ parse(response)
398
+ }
399
+ }
400
+
401
+ return response;
402
+
403
+ }
404
+
405
+ /**
406
+ * @typedef {Object} SitesUpdateRequestParams
407
+ * @property {string} siteId Site ID.
408
+ * @property {string} name Site name. Max length: 128 chars.
409
+ * @property {Framework} framework Sites framework.
410
+ * @property {boolean} enabled Is site enabled? When set to 'disabled', users cannot access the site but Server SDKs with and API key can still access the site. No data is lost when this is toggled.
411
+ * @property {boolean} logging When disabled, request logs will exclude logs and errors, and site responses will be slightly faster.
412
+ * @property {number} timeout Maximum request time in seconds.
413
+ * @property {string} installCommand Install Command.
414
+ * @property {string} buildCommand Build Command.
415
+ * @property {string} outputDirectory Output Directory for site.
416
+ * @property {BuildRuntime} buildRuntime Runtime to use during build step.
417
+ * @property {Adapter} adapter Framework adapter defining rendering strategy. Allowed values are: static, ssr
418
+ * @property {string} fallbackFile Fallback file for single page application sites.
419
+ * @property {string} installationId Appwrite Installation ID for VCS (Version Control System) deployment.
420
+ * @property {string} providerRepositoryId Repository ID of the repo linked to the site.
421
+ * @property {string} providerBranch Production branch for the repo linked to the site.
422
+ * @property {boolean} providerSilentMode Is the VCS (Version Control System) connection in silent mode for the repo linked to the site? In silent mode, comments will not be made on commits and pull requests.
423
+ * @property {string} providerRootDirectory Path to site code in the linked repo.
424
+ * @property {string} specification Framework specification for the site and builds.
425
+ * @property {boolean} overrideForCli
426
+ * @property {boolean} parseOutput
427
+ * @property {libClient | undefined} sdk
428
+ */
429
+
430
+ /**
431
+ * @param {SitesUpdateRequestParams} params
432
+ */
433
+ const sitesUpdate = async ({siteId,name,framework,enabled,logging,timeout,installCommand,buildCommand,outputDirectory,buildRuntime,adapter,fallbackFile,installationId,providerRepositoryId,providerBranch,providerSilentMode,providerRootDirectory,specification,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
434
+ let client = !sdk ? await sdkForProject() :
435
+ sdk;
436
+ let apiPath = '/sites/{siteId}'.replace('{siteId}', siteId);
437
+ let payload = {};
438
+ if (typeof name !== 'undefined') {
439
+ payload['name'] = name;
440
+ }
441
+ if (typeof framework !== 'undefined') {
442
+ payload['framework'] = framework;
443
+ }
444
+ if (typeof enabled !== 'undefined') {
445
+ payload['enabled'] = enabled;
446
+ }
447
+ if (typeof logging !== 'undefined') {
448
+ payload['logging'] = logging;
449
+ }
450
+ if (typeof timeout !== 'undefined') {
451
+ payload['timeout'] = timeout;
452
+ }
453
+ if (typeof installCommand !== 'undefined') {
454
+ payload['installCommand'] = installCommand;
455
+ }
456
+ if (typeof buildCommand !== 'undefined') {
457
+ payload['buildCommand'] = buildCommand;
458
+ }
459
+ if (typeof outputDirectory !== 'undefined') {
460
+ payload['outputDirectory'] = outputDirectory;
461
+ }
462
+ if (typeof buildRuntime !== 'undefined') {
463
+ payload['buildRuntime'] = buildRuntime;
464
+ }
465
+ if (typeof adapter !== 'undefined') {
466
+ payload['adapter'] = adapter;
467
+ }
468
+ if (typeof fallbackFile !== 'undefined') {
469
+ payload['fallbackFile'] = fallbackFile;
470
+ }
471
+ if (typeof installationId !== 'undefined') {
472
+ payload['installationId'] = installationId;
473
+ }
474
+ if (typeof providerRepositoryId !== 'undefined') {
475
+ payload['providerRepositoryId'] = providerRepositoryId;
476
+ }
477
+ if (typeof providerBranch !== 'undefined') {
478
+ payload['providerBranch'] = providerBranch;
479
+ }
480
+ if (typeof providerSilentMode !== 'undefined') {
481
+ payload['providerSilentMode'] = providerSilentMode;
482
+ }
483
+ if (typeof providerRootDirectory !== 'undefined') {
484
+ payload['providerRootDirectory'] = providerRootDirectory;
485
+ }
486
+ if (typeof specification !== 'undefined') {
487
+ payload['specification'] = specification;
488
+ }
489
+
490
+ let response = undefined;
491
+
492
+ response = await client.call('put', apiPath, {
493
+ 'content-type': 'application/json',
494
+ }, payload);
495
+
496
+ if (parseOutput) {
497
+ parse(response)
498
+ }
499
+
500
+ return response;
501
+
502
+ }
503
+
504
+ /**
505
+ * @typedef {Object} SitesDeleteRequestParams
506
+ * @property {string} siteId Site ID.
507
+ * @property {boolean} overrideForCli
508
+ * @property {boolean} parseOutput
509
+ * @property {libClient | undefined} sdk
510
+ */
511
+
512
+ /**
513
+ * @param {SitesDeleteRequestParams} params
514
+ */
515
+ const sitesDelete = async ({siteId,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
516
+ let client = !sdk ? await sdkForProject() :
517
+ sdk;
518
+ let apiPath = '/sites/{siteId}'.replace('{siteId}', siteId);
519
+ let payload = {};
520
+
521
+ let response = undefined;
522
+
523
+ response = await client.call('delete', apiPath, {
524
+ 'content-type': 'application/json',
525
+ }, payload);
526
+
527
+ if (parseOutput) {
528
+ parse(response)
529
+ }
530
+
531
+ return response;
532
+
533
+ }
534
+
535
+ /**
536
+ * @typedef {Object} SitesUpdateSiteDeploymentRequestParams
537
+ * @property {string} siteId Site ID.
538
+ * @property {string} deploymentId Deployment ID.
539
+ * @property {boolean} overrideForCli
540
+ * @property {boolean} parseOutput
541
+ * @property {libClient | undefined} sdk
542
+ */
543
+
544
+ /**
545
+ * @param {SitesUpdateSiteDeploymentRequestParams} params
546
+ */
547
+ const sitesUpdateSiteDeployment = async ({siteId,deploymentId,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
548
+ let client = !sdk ? await sdkForProject() :
549
+ sdk;
550
+ let apiPath = '/sites/{siteId}/deployment'.replace('{siteId}', siteId);
551
+ let payload = {};
552
+ if (typeof deploymentId !== 'undefined') {
553
+ payload['deploymentId'] = deploymentId;
554
+ }
555
+
556
+ let response = undefined;
557
+
558
+ response = await client.call('patch', apiPath, {
559
+ 'content-type': 'application/json',
560
+ }, payload);
561
+
562
+ if (parseOutput) {
563
+ parse(response)
564
+ }
565
+
566
+ return response;
567
+
568
+ }
569
+
570
+ /**
571
+ * @typedef {Object} SitesListDeploymentsRequestParams
572
+ * @property {string} siteId Site ID.
573
+ * @property {string[]} queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: buildSize, sourceSize, totalSize, buildDuration, status, activate, type
574
+ * @property {string} search Search term to filter your list results. Max length: 256 chars.
575
+ * @property {boolean} overrideForCli
576
+ * @property {boolean} parseOutput
577
+ * @property {libClient | undefined} sdk
578
+ */
579
+
580
+ /**
581
+ * @param {SitesListDeploymentsRequestParams} params
582
+ */
583
+ const sitesListDeployments = async ({siteId,queries,search,parseOutput = true, overrideForCli = false, sdk = undefined, console}) => {
584
+ let client = !sdk ? await sdkForProject() :
585
+ sdk;
586
+ let apiPath = '/sites/{siteId}/deployments'.replace('{siteId}', siteId);
587
+ let payload = {};
588
+ if (typeof queries !== 'undefined') {
589
+ payload['queries'] = queries;
590
+ }
591
+ if (typeof search !== 'undefined') {
592
+ payload['search'] = search;
593
+ }
594
+
595
+ let response = undefined;
596
+
597
+ response = await client.call('get', apiPath, {
598
+ }, payload);
599
+
600
+ if (parseOutput) {
601
+ if(console) {
602
+ showConsoleLink('sites', 'listDeployments', siteId);
603
+ } else {
604
+ parse(response)
605
+ }
606
+ }
607
+
608
+ return response;
609
+
610
+ }
611
+
612
+ /**
613
+ * @typedef {Object} SitesCreateDeploymentRequestParams
614
+ * @property {string} siteId Site ID.
615
+ * @property {string} code Gzip file with your code package. When used with the Appwrite CLI, pass the path to your code directory, and the CLI will automatically package your code. Use a path that is within the current directory.
616
+ * @property {boolean} activate Automatically activate the deployment when it is finished building.
617
+ * @property {string} installCommand Install Commands.
618
+ * @property {string} buildCommand Build Commands.
619
+ * @property {string} outputDirectory Output Directory.
620
+ * @property {boolean} overrideForCli
621
+ * @property {boolean} parseOutput
622
+ * @property {libClient | undefined} sdk
623
+ * @property {CallableFunction} onProgress
624
+ */
625
+
626
+ /**
627
+ * @param {SitesCreateDeploymentRequestParams} params
628
+ */
629
+ const sitesCreateDeployment = async ({siteId,code,activate,installCommand,buildCommand,outputDirectory,parseOutput = true, overrideForCli = false, sdk = undefined,onProgress = () => {}}) => {
630
+ let client = !sdk ? await sdkForProject() :
631
+ sdk;
632
+ let apiPath = '/sites/{siteId}/deployments'.replace('{siteId}', siteId);
633
+ let payload = {};
634
+ if (typeof installCommand !== 'undefined') {
635
+ payload['installCommand'] = installCommand;
636
+ }
637
+ if (typeof buildCommand !== 'undefined') {
638
+ payload['buildCommand'] = buildCommand;
639
+ }
640
+ if (typeof outputDirectory !== 'undefined') {
641
+ payload['outputDirectory'] = outputDirectory;
642
+ }
643
+ const folderPath = fs.realpathSync(code);
644
+ if (!fs.lstatSync(folderPath).isDirectory()) {
645
+ throw new Error('The path is not a directory.');
646
+ }
647
+
648
+ const ignorer = ignore();
649
+
650
+ const resourceId = siteId;
651
+ const resourceConfig = localConfig.getSite(resourceId);
652
+
653
+ ignorer.add('.appwrite');
654
+
655
+ if (resourceConfig.ignore) {
656
+ ignorer.add(resourceConfig.ignore);
657
+ } else if (fs.existsSync(pathLib.join(code, '.gitignore'))) {
658
+ ignorer.add(fs.readFileSync(pathLib.join(code, '.gitignore')).toString());
659
+ }
660
+
661
+ const files = getAllFiles(code).map((file) => pathLib.relative(code, file)).filter((file) => !ignorer.ignores(file));
662
+
663
+ const archiveFileName = `sites-${resourceId}-code.tar.gz`;
664
+
665
+ await tar
666
+ .create({
667
+ gzip: true,
668
+ sync: true,
669
+ cwd: folderPath,
670
+ file: archiveFileName
671
+ }, files);
672
+
673
+ let archivePath = fs.realpathSync(archiveFileName)
674
+ if (typeof archivePath !== 'undefined') {
675
+ payload['code'] = archivePath;
676
+ code = archivePath;
677
+ }
678
+
679
+ const filePath = fs.realpathSync(code);
680
+ const nodeStream = fs.createReadStream(filePath);
681
+ const stream = convertReadStreamToReadableStream(nodeStream);
682
+
683
+ if (typeof filePath !== 'undefined') {
684
+ code = { type: 'file', stream, filename: pathLib.basename(filePath), size: fs.statSync(filePath).size };
685
+ payload['code'] = code
686
+ }
687
+ if (typeof activate !== 'undefined') {
688
+ payload['activate'] = activate;
689
+ }
690
+
691
+ const size = code.size;
692
+
693
+ const apiHeaders = {
694
+ 'content-type': 'multipart/form-data',
695
+ };
696
+
697
+ let id = undefined;
698
+ let response = undefined;
699
+
700
+ let chunksUploaded = 0;
701
+
702
+ let currentChunk = 1;
703
+ let currentPosition = 0;
704
+ let uploadableChunk = new Uint8Array(client.CHUNK_SIZE);
705
+
706
+ const uploadChunk = async (lastUpload = false) => {
707
+ if(currentChunk <= chunksUploaded) {
708
+ return;
709
+ }
710
+
711
+ const start = ((currentChunk - 1) * client.CHUNK_SIZE);
712
+ let end = start + currentPosition - 1;
713
+
714
+ if(!lastUpload || currentChunk !== 1) {
715
+ apiHeaders['content-range'] = 'bytes ' + start + '-' + end + '/' + size;
716
+ }
717
+
718
+ let uploadableChunkTrimmed;
719
+
720
+ if(currentPosition + 1 >= client.CHUNK_SIZE) {
721
+ uploadableChunkTrimmed = uploadableChunk;
722
+ } else {
723
+ uploadableChunkTrimmed = new Uint8Array(currentPosition);
724
+ for(let i = 0; i <= currentPosition; i++) {
725
+ uploadableChunkTrimmed[i] = uploadableChunk[i];
726
+ }
727
+ }
728
+
729
+ if (id) {
730
+ apiHeaders['x-appwrite-id'] = id;
731
+ }
732
+
733
+ payload['code'] = { type: 'file', file: new File([uploadableChunkTrimmed], code.filename), filename: code.filename };
734
+
735
+ response = await client.call('post', apiPath, apiHeaders, payload);
736
+
737
+ if (!id) {
738
+ id = response['$id'];
739
+ }
740
+
741
+ if (onProgress !== null) {
742
+ onProgress({
743
+ $id: response['$id'],
744
+ progress: Math.min((currentChunk) * client.CHUNK_SIZE, size) / size * 100,
745
+ sizeUploaded: end+1,
746
+ chunksTotal: response['chunksTotal'],
747
+ chunksUploaded: response['chunksUploaded']
748
+ });
749
+ }
750
+
751
+ uploadableChunk = new Uint8Array(client.CHUNK_SIZE);
752
+ currentChunk++;
753
+ currentPosition = 0;
754
+ }
755
+
756
+ for await (const chunk of code.stream) {
757
+ for(const b of chunk) {
758
+ uploadableChunk[currentPosition] = b;
759
+
760
+ currentPosition++;
761
+ if(currentPosition >= client.CHUNK_SIZE) {
762
+ await uploadChunk();
763
+ currentPosition = 0;
764
+ }
765
+ }
766
+ }
767
+
768
+ if (currentPosition > 0) { // Check if there's any remaining data for the last chunk
769
+ await uploadChunk(true);
770
+ }
771
+
772
+ await fs.unlink(filePath,()=>{});
773
+
774
+ if (parseOutput) {
775
+ parse(response)
776
+ }
777
+
778
+ return response;
779
+ }
780
+
781
+ /**
782
+ * @typedef {Object} SitesCreateDuplicateDeploymentRequestParams
783
+ * @property {string} siteId Site ID.
784
+ * @property {string} deploymentId Deployment ID.
785
+ * @property {boolean} overrideForCli
786
+ * @property {boolean} parseOutput
787
+ * @property {libClient | undefined} sdk
788
+ */
789
+
790
+ /**
791
+ * @param {SitesCreateDuplicateDeploymentRequestParams} params
792
+ */
793
+ const sitesCreateDuplicateDeployment = async ({siteId,deploymentId,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
794
+ let client = !sdk ? await sdkForProject() :
795
+ sdk;
796
+ let apiPath = '/sites/{siteId}/deployments/duplicate'.replace('{siteId}', siteId);
797
+ let payload = {};
798
+ if (typeof deploymentId !== 'undefined') {
799
+ payload['deploymentId'] = deploymentId;
800
+ }
801
+
802
+ let response = undefined;
803
+
804
+ response = await client.call('post', apiPath, {
805
+ 'content-type': 'application/json',
806
+ }, payload);
807
+
808
+ if (parseOutput) {
809
+ parse(response)
810
+ }
811
+
812
+ return response;
813
+
814
+ }
815
+
816
+ /**
817
+ * @typedef {Object} SitesCreateTemplateDeploymentRequestParams
818
+ * @property {string} siteId Site ID.
819
+ * @property {string} repository Repository name of the template.
820
+ * @property {string} owner The name of the owner of the template.
821
+ * @property {string} rootDirectory Path to site code in the template repo.
822
+ * @property {string} version Version (tag) for the repo linked to the site template.
823
+ * @property {boolean} activate Automatically activate the deployment when it is finished building.
824
+ * @property {boolean} overrideForCli
825
+ * @property {boolean} parseOutput
826
+ * @property {libClient | undefined} sdk
827
+ */
828
+
829
+ /**
830
+ * @param {SitesCreateTemplateDeploymentRequestParams} params
831
+ */
832
+ const sitesCreateTemplateDeployment = async ({siteId,repository,owner,rootDirectory,version,activate,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
833
+ let client = !sdk ? await sdkForProject() :
834
+ sdk;
835
+ let apiPath = '/sites/{siteId}/deployments/template'.replace('{siteId}', siteId);
836
+ let payload = {};
837
+ if (typeof repository !== 'undefined') {
838
+ payload['repository'] = repository;
839
+ }
840
+ if (typeof owner !== 'undefined') {
841
+ payload['owner'] = owner;
842
+ }
843
+ if (typeof rootDirectory !== 'undefined') {
844
+ payload['rootDirectory'] = rootDirectory;
845
+ }
846
+ if (typeof version !== 'undefined') {
847
+ payload['version'] = version;
848
+ }
849
+ if (typeof activate !== 'undefined') {
850
+ payload['activate'] = activate;
851
+ }
852
+
853
+ let response = undefined;
854
+
855
+ response = await client.call('post', apiPath, {
856
+ 'content-type': 'application/json',
857
+ }, payload);
858
+
859
+ if (parseOutput) {
860
+ parse(response)
861
+ }
862
+
863
+ return response;
864
+
865
+ }
866
+
867
+ /**
868
+ * @typedef {Object} SitesCreateVcsDeploymentRequestParams
869
+ * @property {string} siteId Site ID.
870
+ * @property {VCSDeploymentType} type Type of reference passed. Allowed values are: branch, commit
871
+ * @property {string} reference VCS reference to create deployment from. Depending on type this can be: branch name, commit hash
872
+ * @property {boolean} activate Automatically activate the deployment when it is finished building.
873
+ * @property {boolean} overrideForCli
874
+ * @property {boolean} parseOutput
875
+ * @property {libClient | undefined} sdk
876
+ */
877
+
878
+ /**
879
+ * @param {SitesCreateVcsDeploymentRequestParams} params
880
+ */
881
+ const sitesCreateVcsDeployment = async ({siteId,type,reference,activate,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
882
+ let client = !sdk ? await sdkForProject() :
883
+ sdk;
884
+ let apiPath = '/sites/{siteId}/deployments/vcs'.replace('{siteId}', siteId);
885
+ let payload = {};
886
+ if (typeof type !== 'undefined') {
887
+ payload['type'] = type;
888
+ }
889
+ if (typeof reference !== 'undefined') {
890
+ payload['reference'] = reference;
891
+ }
892
+ if (typeof activate !== 'undefined') {
893
+ payload['activate'] = activate;
894
+ }
895
+
896
+ let response = undefined;
897
+
898
+ response = await client.call('post', apiPath, {
899
+ 'content-type': 'application/json',
900
+ }, payload);
901
+
902
+ if (parseOutput) {
903
+ parse(response)
904
+ }
905
+
906
+ return response;
907
+
908
+ }
909
+
910
+ /**
911
+ * @typedef {Object} SitesGetDeploymentRequestParams
912
+ * @property {string} siteId Site ID.
913
+ * @property {string} deploymentId Deployment ID.
914
+ * @property {boolean} overrideForCli
915
+ * @property {boolean} parseOutput
916
+ * @property {libClient | undefined} sdk
917
+ */
918
+
919
+ /**
920
+ * @param {SitesGetDeploymentRequestParams} params
921
+ */
922
+ const sitesGetDeployment = async ({siteId,deploymentId,parseOutput = true, overrideForCli = false, sdk = undefined, console}) => {
923
+ let client = !sdk ? await sdkForProject() :
924
+ sdk;
925
+ let apiPath = '/sites/{siteId}/deployments/{deploymentId}'.replace('{siteId}', siteId).replace('{deploymentId}', deploymentId);
926
+ let payload = {};
927
+
928
+ let response = undefined;
929
+
930
+ response = await client.call('get', apiPath, {
931
+ }, payload);
932
+
933
+ if (parseOutput) {
934
+ if(console) {
935
+ showConsoleLink('sites', 'getDeployment', siteId, deploymentId);
936
+ } else {
937
+ parse(response)
938
+ }
939
+ }
940
+
941
+ return response;
942
+
943
+ }
944
+
945
+ /**
946
+ * @typedef {Object} SitesDeleteDeploymentRequestParams
947
+ * @property {string} siteId Site ID.
948
+ * @property {string} deploymentId Deployment ID.
949
+ * @property {boolean} overrideForCli
950
+ * @property {boolean} parseOutput
951
+ * @property {libClient | undefined} sdk
952
+ */
953
+
954
+ /**
955
+ * @param {SitesDeleteDeploymentRequestParams} params
956
+ */
957
+ const sitesDeleteDeployment = async ({siteId,deploymentId,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
958
+ let client = !sdk ? await sdkForProject() :
959
+ sdk;
960
+ let apiPath = '/sites/{siteId}/deployments/{deploymentId}'.replace('{siteId}', siteId).replace('{deploymentId}', deploymentId);
961
+ let payload = {};
962
+
963
+ let response = undefined;
964
+
965
+ response = await client.call('delete', apiPath, {
966
+ 'content-type': 'application/json',
967
+ }, payload);
968
+
969
+ if (parseOutput) {
970
+ parse(response)
971
+ }
972
+
973
+ return response;
974
+
975
+ }
976
+
977
+ /**
978
+ * @typedef {Object} SitesGetDeploymentDownloadRequestParams
979
+ * @property {string} siteId Site ID.
980
+ * @property {string} deploymentId Deployment ID.
981
+ * @property {DeploymentDownloadType} type Deployment file to download. Can be: &quot;source&quot;, &quot;output&quot;.
982
+ * @property {boolean} overrideForCli
983
+ * @property {boolean} parseOutput
984
+ * @property {libClient | undefined} sdk
985
+ * @property {string} destination
986
+ */
987
+
988
+ /**
989
+ * @param {SitesGetDeploymentDownloadRequestParams} params
990
+ */
991
+ const sitesGetDeploymentDownload = async ({siteId,deploymentId,type,parseOutput = true, overrideForCli = false, sdk = undefined, destination, console}) => {
992
+ let client = !sdk ? await sdkForProject() :
993
+ sdk;
994
+ let apiPath = '/sites/{siteId}/deployments/{deploymentId}/download'.replace('{siteId}', siteId).replace('{deploymentId}', deploymentId);
995
+ let payload = {};
996
+ if (typeof type !== 'undefined') {
997
+ payload['type'] = type;
998
+ }
999
+ if (!overrideForCli) {
1000
+ payload['project'] = localConfig.getProject().projectId
1001
+ payload['key'] = globalConfig.getKey();
1002
+ const queryParams = new URLSearchParams(payload);
1003
+ apiPath = `${globalConfig.getEndpoint()}${apiPath}?${queryParams.toString()}`;
1004
+ }
1005
+
1006
+ let response = undefined;
1007
+
1008
+ response = await client.call('get', apiPath, {
1009
+ }, payload, 'arraybuffer');
1010
+
1011
+ if (overrideForCli) {
1012
+ response = Buffer.from(response);
1013
+ }
1014
+
1015
+ fs.writeFileSync(destination, response);
1016
+ if (parseOutput) {
1017
+ if(console) {
1018
+ showConsoleLink('sites', 'getDeploymentDownload', siteId, deploymentId);
1019
+ } else {
1020
+ parse(response)
1021
+ }
1022
+ }
1023
+
1024
+ return response;
1025
+
1026
+ }
1027
+
1028
+ /**
1029
+ * @typedef {Object} SitesUpdateDeploymentStatusRequestParams
1030
+ * @property {string} siteId Site ID.
1031
+ * @property {string} deploymentId Deployment ID.
1032
+ * @property {boolean} overrideForCli
1033
+ * @property {boolean} parseOutput
1034
+ * @property {libClient | undefined} sdk
1035
+ */
1036
+
1037
+ /**
1038
+ * @param {SitesUpdateDeploymentStatusRequestParams} params
1039
+ */
1040
+ const sitesUpdateDeploymentStatus = async ({siteId,deploymentId,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1041
+ let client = !sdk ? await sdkForProject() :
1042
+ sdk;
1043
+ let apiPath = '/sites/{siteId}/deployments/{deploymentId}/status'.replace('{siteId}', siteId).replace('{deploymentId}', deploymentId);
1044
+ let payload = {};
1045
+
1046
+ let response = undefined;
1047
+
1048
+ response = await client.call('patch', apiPath, {
1049
+ 'content-type': 'application/json',
1050
+ }, payload);
1051
+
1052
+ if (parseOutput) {
1053
+ parse(response)
1054
+ }
1055
+
1056
+ return response;
1057
+
1058
+ }
1059
+
1060
+ /**
1061
+ * @typedef {Object} SitesListLogsRequestParams
1062
+ * @property {string} siteId Site ID.
1063
+ * @property {string[]} queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: trigger, status, responseStatusCode, duration, requestMethod, requestPath, deploymentId
1064
+ * @property {boolean} overrideForCli
1065
+ * @property {boolean} parseOutput
1066
+ * @property {libClient | undefined} sdk
1067
+ */
1068
+
1069
+ /**
1070
+ * @param {SitesListLogsRequestParams} params
1071
+ */
1072
+ const sitesListLogs = async ({siteId,queries,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1073
+ let client = !sdk ? await sdkForProject() :
1074
+ sdk;
1075
+ let apiPath = '/sites/{siteId}/logs'.replace('{siteId}', siteId);
1076
+ let payload = {};
1077
+ if (typeof queries !== 'undefined') {
1078
+ payload['queries'] = queries;
1079
+ }
1080
+
1081
+ let response = undefined;
1082
+
1083
+ response = await client.call('get', apiPath, {
1084
+ }, payload);
1085
+
1086
+ if (parseOutput) {
1087
+ parse(response)
1088
+ }
1089
+
1090
+ return response;
1091
+
1092
+ }
1093
+
1094
+ /**
1095
+ * @typedef {Object} SitesGetLogRequestParams
1096
+ * @property {string} siteId Site ID.
1097
+ * @property {string} logId Log ID.
1098
+ * @property {boolean} overrideForCli
1099
+ * @property {boolean} parseOutput
1100
+ * @property {libClient | undefined} sdk
1101
+ */
1102
+
1103
+ /**
1104
+ * @param {SitesGetLogRequestParams} params
1105
+ */
1106
+ const sitesGetLog = async ({siteId,logId,parseOutput = true, overrideForCli = false, sdk = undefined, console}) => {
1107
+ let client = !sdk ? await sdkForProject() :
1108
+ sdk;
1109
+ let apiPath = '/sites/{siteId}/logs/{logId}'.replace('{siteId}', siteId).replace('{logId}', logId);
1110
+ let payload = {};
1111
+
1112
+ let response = undefined;
1113
+
1114
+ response = await client.call('get', apiPath, {
1115
+ }, payload);
1116
+
1117
+ if (parseOutput) {
1118
+ if(console) {
1119
+ showConsoleLink('sites', 'getLog', siteId, logId);
1120
+ } else {
1121
+ parse(response)
1122
+ }
1123
+ }
1124
+
1125
+ return response;
1126
+
1127
+ }
1128
+
1129
+ /**
1130
+ * @typedef {Object} SitesDeleteLogRequestParams
1131
+ * @property {string} siteId Site ID.
1132
+ * @property {string} logId Log ID.
1133
+ * @property {boolean} overrideForCli
1134
+ * @property {boolean} parseOutput
1135
+ * @property {libClient | undefined} sdk
1136
+ */
1137
+
1138
+ /**
1139
+ * @param {SitesDeleteLogRequestParams} params
1140
+ */
1141
+ const sitesDeleteLog = async ({siteId,logId,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1142
+ let client = !sdk ? await sdkForProject() :
1143
+ sdk;
1144
+ let apiPath = '/sites/{siteId}/logs/{logId}'.replace('{siteId}', siteId).replace('{logId}', logId);
1145
+ let payload = {};
1146
+
1147
+ let response = undefined;
1148
+
1149
+ response = await client.call('delete', apiPath, {
1150
+ 'content-type': 'application/json',
1151
+ }, payload);
1152
+
1153
+ if (parseOutput) {
1154
+ parse(response)
1155
+ }
1156
+
1157
+ return response;
1158
+
1159
+ }
1160
+
1161
+ /**
1162
+ * @typedef {Object} SitesGetUsageRequestParams
1163
+ * @property {string} siteId Site ID.
1164
+ * @property {SiteUsageRange} range Date range.
1165
+ * @property {boolean} overrideForCli
1166
+ * @property {boolean} parseOutput
1167
+ * @property {libClient | undefined} sdk
1168
+ */
1169
+
1170
+ /**
1171
+ * @param {SitesGetUsageRequestParams} params
1172
+ */
1173
+ const sitesGetUsage = async ({siteId,range,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1174
+ let client = !sdk ? await sdkForProject() :
1175
+ sdk;
1176
+ let apiPath = '/sites/{siteId}/usage'.replace('{siteId}', siteId);
1177
+ let payload = {};
1178
+ if (typeof range !== 'undefined') {
1179
+ payload['range'] = range;
1180
+ }
1181
+
1182
+ let response = undefined;
1183
+
1184
+ response = await client.call('get', apiPath, {
1185
+ }, payload);
1186
+
1187
+ if (parseOutput) {
1188
+ parse(response)
1189
+ }
1190
+
1191
+ return response;
1192
+
1193
+ }
1194
+
1195
+ /**
1196
+ * @typedef {Object} SitesListVariablesRequestParams
1197
+ * @property {string} siteId Site unique ID.
1198
+ * @property {boolean} overrideForCli
1199
+ * @property {boolean} parseOutput
1200
+ * @property {libClient | undefined} sdk
1201
+ */
1202
+
1203
+ /**
1204
+ * @param {SitesListVariablesRequestParams} params
1205
+ */
1206
+ const sitesListVariables = async ({siteId,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1207
+ let client = !sdk ? await sdkForProject() :
1208
+ sdk;
1209
+ let apiPath = '/sites/{siteId}/variables'.replace('{siteId}', siteId);
1210
+ let payload = {};
1211
+
1212
+ let response = undefined;
1213
+
1214
+ response = await client.call('get', apiPath, {
1215
+ }, payload);
1216
+
1217
+ if (parseOutput) {
1218
+ parse(response)
1219
+ }
1220
+
1221
+ return response;
1222
+
1223
+ }
1224
+
1225
+ /**
1226
+ * @typedef {Object} SitesCreateVariableRequestParams
1227
+ * @property {string} siteId Site unique ID.
1228
+ * @property {string} key Variable key. Max length: 255 chars.
1229
+ * @property {string} value Variable value. Max length: 8192 chars.
1230
+ * @property {boolean} secret Secret variables can be updated or deleted, but only sites can read them during build and runtime.
1231
+ * @property {boolean} overrideForCli
1232
+ * @property {boolean} parseOutput
1233
+ * @property {libClient | undefined} sdk
1234
+ */
1235
+
1236
+ /**
1237
+ * @param {SitesCreateVariableRequestParams} params
1238
+ */
1239
+ const sitesCreateVariable = async ({siteId,key,value,secret,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1240
+ let client = !sdk ? await sdkForProject() :
1241
+ sdk;
1242
+ let apiPath = '/sites/{siteId}/variables'.replace('{siteId}', siteId);
1243
+ let payload = {};
1244
+ if (typeof key !== 'undefined') {
1245
+ payload['key'] = key;
1246
+ }
1247
+ if (typeof value !== 'undefined') {
1248
+ payload['value'] = value;
1249
+ }
1250
+ if (typeof secret !== 'undefined') {
1251
+ payload['secret'] = secret;
1252
+ }
1253
+
1254
+ let response = undefined;
1255
+
1256
+ response = await client.call('post', apiPath, {
1257
+ 'content-type': 'application/json',
1258
+ }, payload);
1259
+
1260
+ if (parseOutput) {
1261
+ parse(response)
1262
+ }
1263
+
1264
+ return response;
1265
+
1266
+ }
1267
+
1268
+ /**
1269
+ * @typedef {Object} SitesGetVariableRequestParams
1270
+ * @property {string} siteId Site unique ID.
1271
+ * @property {string} variableId Variable unique ID.
1272
+ * @property {boolean} overrideForCli
1273
+ * @property {boolean} parseOutput
1274
+ * @property {libClient | undefined} sdk
1275
+ */
1276
+
1277
+ /**
1278
+ * @param {SitesGetVariableRequestParams} params
1279
+ */
1280
+ const sitesGetVariable = async ({siteId,variableId,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1281
+ let client = !sdk ? await sdkForProject() :
1282
+ sdk;
1283
+ let apiPath = '/sites/{siteId}/variables/{variableId}'.replace('{siteId}', siteId).replace('{variableId}', variableId);
1284
+ let payload = {};
1285
+
1286
+ let response = undefined;
1287
+
1288
+ response = await client.call('get', apiPath, {
1289
+ }, payload);
1290
+
1291
+ if (parseOutput) {
1292
+ parse(response)
1293
+ }
1294
+
1295
+ return response;
1296
+
1297
+ }
1298
+
1299
+ /**
1300
+ * @typedef {Object} SitesUpdateVariableRequestParams
1301
+ * @property {string} siteId Site unique ID.
1302
+ * @property {string} variableId Variable unique ID.
1303
+ * @property {string} key Variable key. Max length: 255 chars.
1304
+ * @property {string} value Variable value. Max length: 8192 chars.
1305
+ * @property {boolean} secret Secret variables can be updated or deleted, but only sites can read them during build and runtime.
1306
+ * @property {boolean} overrideForCli
1307
+ * @property {boolean} parseOutput
1308
+ * @property {libClient | undefined} sdk
1309
+ */
1310
+
1311
+ /**
1312
+ * @param {SitesUpdateVariableRequestParams} params
1313
+ */
1314
+ const sitesUpdateVariable = async ({siteId,variableId,key,value,secret,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1315
+ let client = !sdk ? await sdkForProject() :
1316
+ sdk;
1317
+ let apiPath = '/sites/{siteId}/variables/{variableId}'.replace('{siteId}', siteId).replace('{variableId}', variableId);
1318
+ let payload = {};
1319
+ if (typeof key !== 'undefined') {
1320
+ payload['key'] = key;
1321
+ }
1322
+ if (typeof value !== 'undefined') {
1323
+ payload['value'] = value;
1324
+ }
1325
+ if (typeof secret !== 'undefined') {
1326
+ payload['secret'] = secret;
1327
+ }
1328
+
1329
+ let response = undefined;
1330
+
1331
+ response = await client.call('put', apiPath, {
1332
+ 'content-type': 'application/json',
1333
+ }, payload);
1334
+
1335
+ if (parseOutput) {
1336
+ parse(response)
1337
+ }
1338
+
1339
+ return response;
1340
+
1341
+ }
1342
+
1343
+ /**
1344
+ * @typedef {Object} SitesDeleteVariableRequestParams
1345
+ * @property {string} siteId Site unique ID.
1346
+ * @property {string} variableId Variable unique ID.
1347
+ * @property {boolean} overrideForCli
1348
+ * @property {boolean} parseOutput
1349
+ * @property {libClient | undefined} sdk
1350
+ */
1351
+
1352
+ /**
1353
+ * @param {SitesDeleteVariableRequestParams} params
1354
+ */
1355
+ const sitesDeleteVariable = async ({siteId,variableId,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
1356
+ let client = !sdk ? await sdkForProject() :
1357
+ sdk;
1358
+ let apiPath = '/sites/{siteId}/variables/{variableId}'.replace('{siteId}', siteId).replace('{variableId}', variableId);
1359
+ let payload = {};
1360
+
1361
+ let response = undefined;
1362
+
1363
+ response = await client.call('delete', apiPath, {
1364
+ 'content-type': 'application/json',
1365
+ }, payload);
1366
+
1367
+ if (parseOutput) {
1368
+ parse(response)
1369
+ }
1370
+
1371
+ return response;
1372
+
1373
+ }
1374
+
1375
+ sites
1376
+ .command(`list`)
1377
+ .description(`Get a list of all the project's sites. You can use the query params to filter your results.`)
1378
+ .option(`--queries [queries...]`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, enabled, framework, deploymentId, buildCommand, installCommand, outputDirectory, installationId`)
1379
+ .option(`--search <search>`, `Search term to filter your list results. Max length: 256 chars.`)
1380
+ .option(`--console`, `Get the resource console url`)
1381
+ .action(actionRunner(sitesList))
1382
+
1383
+ sites
1384
+ .command(`create`)
1385
+ .description(`Create a new site.`)
1386
+ .requiredOption(`--site-id <site-id>`, `Site ID. Choose a custom ID or generate a random ID with 'ID.unique()'. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.`)
1387
+ .requiredOption(`--name <name>`, `Site name. Max length: 128 chars.`)
1388
+ .requiredOption(`--framework <framework>`, `Sites framework.`)
1389
+ .requiredOption(`--build-runtime <build-runtime>`, `Runtime to use during build step.`)
1390
+ .option(`--enabled [value]`, `Is site enabled? When set to 'disabled', users cannot access the site but Server SDKs with and API key can still access the site. No data is lost when this is toggled.`, (value) => value === undefined ? true : parseBool(value))
1391
+ .option(`--logging [value]`, `When disabled, request logs will exclude logs and errors, and site responses will be slightly faster.`, (value) => value === undefined ? true : parseBool(value))
1392
+ .option(`--timeout <timeout>`, `Maximum request time in seconds.`, parseInteger)
1393
+ .option(`--install-command <install-command>`, `Install Command.`)
1394
+ .option(`--build-command <build-command>`, `Build Command.`)
1395
+ .option(`--output-directory <output-directory>`, `Output Directory for site.`)
1396
+ .option(`--adapter <adapter>`, `Framework adapter defining rendering strategy. Allowed values are: static, ssr`)
1397
+ .option(`--installation-id <installation-id>`, `Appwrite Installation ID for VCS (Version Control System) deployment.`)
1398
+ .option(`--fallback-file <fallback-file>`, `Fallback file for single page application sites.`)
1399
+ .option(`--provider-repository-id <provider-repository-id>`, `Repository ID of the repo linked to the site.`)
1400
+ .option(`--provider-branch <provider-branch>`, `Production branch for the repo linked to the site.`)
1401
+ .option(`--provider-silent-mode [value]`, `Is the VCS (Version Control System) connection in silent mode for the repo linked to the site? In silent mode, comments will not be made on commits and pull requests.`, (value) => value === undefined ? true : parseBool(value))
1402
+ .option(`--provider-root-directory <provider-root-directory>`, `Path to site code in the linked repo.`)
1403
+ .option(`--specification <specification>`, `Framework specification for the site and builds.`)
1404
+ .action(actionRunner(sitesCreate))
1405
+
1406
+ sites
1407
+ .command(`list-frameworks`)
1408
+ .description(`Get a list of all frameworks that are currently available on the server instance.`)
1409
+ .option(`--console`, `Get the resource console url`)
1410
+ .action(actionRunner(sitesListFrameworks))
1411
+
1412
+ sites
1413
+ .command(`list-specifications`)
1414
+ .description(`List allowed site specifications for this instance.`)
1415
+ .option(`--console`, `Get the resource console url`)
1416
+ .action(actionRunner(sitesListSpecifications))
1417
+
1418
+ sites
1419
+ .command(`list-templates`)
1420
+ .description(`List available site templates. You can use template details in [createSite](/docs/references/cloud/server-nodejs/sites#create) method.`)
1421
+ .option(`--frameworks [frameworks...]`, `List of frameworks allowed for filtering site templates. Maximum of 100 frameworks are allowed.`)
1422
+ .option(`--use-cases [use-cases...]`, `List of use cases allowed for filtering site templates. Maximum of 100 use cases are allowed.`)
1423
+ .option(`--limit <limit>`, `Limit the number of templates returned in the response. Default limit is 25, and maximum limit is 5000.`, parseInteger)
1424
+ .option(`--offset <offset>`, `Offset the list of returned templates. Maximum offset is 5000.`, parseInteger)
1425
+ .option(`--console`, `Get the resource console url`)
1426
+ .action(actionRunner(sitesListTemplates))
1427
+
1428
+ sites
1429
+ .command(`get-template`)
1430
+ .description(`Get a site template using ID. You can use template details in [createSite](/docs/references/cloud/server-nodejs/sites#create) method.`)
1431
+ .requiredOption(`--template-id <template-id>`, `Template ID.`)
1432
+ .option(`--console`, `Get the resource console url`)
1433
+ .action(actionRunner(sitesGetTemplate))
1434
+
1435
+ sites
1436
+ .command(`list-usage`)
1437
+ .description(`Get usage metrics and statistics for all sites in the project. View statistics including total deployments, builds, logs, storage usage, and compute time. The response includes both current totals and historical data for each metric. Use the optional range parameter to specify the time window for historical data: 24h (last 24 hours), 30d (last 30 days), or 90d (last 90 days). If not specified, defaults to 30 days.`)
1438
+ .option(`--range <range>`, `Date range.`)
1439
+ .option(`--console`, `Get the resource console url`)
1440
+ .action(actionRunner(sitesListUsage))
1441
+
1442
+ sites
1443
+ .command(`get`)
1444
+ .description(`Get a site by its unique ID.`)
1445
+ .requiredOption(`--site-id <site-id>`, `Site ID.`)
1446
+ .option(`--console`, `Get the resource console url`)
1447
+ .action(actionRunner(sitesGet))
1448
+
1449
+ sites
1450
+ .command(`update`)
1451
+ .description(`Update site by its unique ID.`)
1452
+ .requiredOption(`--site-id <site-id>`, `Site ID.`)
1453
+ .requiredOption(`--name <name>`, `Site name. Max length: 128 chars.`)
1454
+ .requiredOption(`--framework <framework>`, `Sites framework.`)
1455
+ .option(`--enabled [value]`, `Is site enabled? When set to 'disabled', users cannot access the site but Server SDKs with and API key can still access the site. No data is lost when this is toggled.`, (value) => value === undefined ? true : parseBool(value))
1456
+ .option(`--logging [value]`, `When disabled, request logs will exclude logs and errors, and site responses will be slightly faster.`, (value) => value === undefined ? true : parseBool(value))
1457
+ .option(`--timeout <timeout>`, `Maximum request time in seconds.`, parseInteger)
1458
+ .option(`--install-command <install-command>`, `Install Command.`)
1459
+ .option(`--build-command <build-command>`, `Build Command.`)
1460
+ .option(`--output-directory <output-directory>`, `Output Directory for site.`)
1461
+ .option(`--build-runtime <build-runtime>`, `Runtime to use during build step.`)
1462
+ .option(`--adapter <adapter>`, `Framework adapter defining rendering strategy. Allowed values are: static, ssr`)
1463
+ .option(`--fallback-file <fallback-file>`, `Fallback file for single page application sites.`)
1464
+ .option(`--installation-id <installation-id>`, `Appwrite Installation ID for VCS (Version Control System) deployment.`)
1465
+ .option(`--provider-repository-id <provider-repository-id>`, `Repository ID of the repo linked to the site.`)
1466
+ .option(`--provider-branch <provider-branch>`, `Production branch for the repo linked to the site.`)
1467
+ .option(`--provider-silent-mode [value]`, `Is the VCS (Version Control System) connection in silent mode for the repo linked to the site? In silent mode, comments will not be made on commits and pull requests.`, (value) => value === undefined ? true : parseBool(value))
1468
+ .option(`--provider-root-directory <provider-root-directory>`, `Path to site code in the linked repo.`)
1469
+ .option(`--specification <specification>`, `Framework specification for the site and builds.`)
1470
+ .action(actionRunner(sitesUpdate))
1471
+
1472
+ sites
1473
+ .command(`delete`)
1474
+ .description(`Delete a site by its unique ID.`)
1475
+ .requiredOption(`--site-id <site-id>`, `Site ID.`)
1476
+ .action(actionRunner(sitesDelete))
1477
+
1478
+ sites
1479
+ .command(`update-site-deployment`)
1480
+ .description(`Update the site active deployment. Use this endpoint to switch the code deployment that should be used when visitor opens your site.`)
1481
+ .requiredOption(`--site-id <site-id>`, `Site ID.`)
1482
+ .requiredOption(`--deployment-id <deployment-id>`, `Deployment ID.`)
1483
+ .action(actionRunner(sitesUpdateSiteDeployment))
1484
+
1485
+ sites
1486
+ .command(`list-deployments`)
1487
+ .description(`Get a list of all the site's code deployments. You can use the query params to filter your results.`)
1488
+ .requiredOption(`--site-id <site-id>`, `Site ID.`)
1489
+ .option(`--queries [queries...]`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: buildSize, sourceSize, totalSize, buildDuration, status, activate, type`)
1490
+ .option(`--search <search>`, `Search term to filter your list results. Max length: 256 chars.`)
1491
+ .option(`--console`, `Get the resource console url`)
1492
+ .action(actionRunner(sitesListDeployments))
1493
+
1494
+ sites
1495
+ .command(`create-deployment`)
1496
+ .description(`Create a new site code deployment. Use this endpoint to upload a new version of your site code. To activate your newly uploaded code, you'll need to update the function's deployment to use your new deployment ID.`)
1497
+ .requiredOption(`--site-id <site-id>`, `Site ID.`)
1498
+ .requiredOption(`--code <code>`, `Gzip file with your code package. When used with the Appwrite CLI, pass the path to your code directory, and the CLI will automatically package your code. Use a path that is within the current directory.`)
1499
+ .requiredOption(`--activate [value]`, `Automatically activate the deployment when it is finished building.`, (value) => value === undefined ? true : parseBool(value))
1500
+ .option(`--install-command <install-command>`, `Install Commands.`)
1501
+ .option(`--build-command <build-command>`, `Build Commands.`)
1502
+ .option(`--output-directory <output-directory>`, `Output Directory.`)
1503
+ .action(actionRunner(sitesCreateDeployment))
1504
+
1505
+ sites
1506
+ .command(`create-duplicate-deployment`)
1507
+ .description(`Create a new build for an existing site deployment. This endpoint allows you to rebuild a deployment with the updated site configuration, including its commands and output directory if they have been modified. The build process will be queued and executed asynchronously. The original deployment's code will be preserved and used for the new build.`)
1508
+ .requiredOption(`--site-id <site-id>`, `Site ID.`)
1509
+ .requiredOption(`--deployment-id <deployment-id>`, `Deployment ID.`)
1510
+ .action(actionRunner(sitesCreateDuplicateDeployment))
1511
+
1512
+ sites
1513
+ .command(`create-template-deployment`)
1514
+ .description(`Create a deployment based on a template. Use this endpoint with combination of [listTemplates](https://appwrite.io/docs/server/sites#listTemplates) to find the template details.`)
1515
+ .requiredOption(`--site-id <site-id>`, `Site ID.`)
1516
+ .requiredOption(`--repository <repository>`, `Repository name of the template.`)
1517
+ .requiredOption(`--owner <owner>`, `The name of the owner of the template.`)
1518
+ .requiredOption(`--root-directory <root-directory>`, `Path to site code in the template repo.`)
1519
+ .requiredOption(`--version <version>`, `Version (tag) for the repo linked to the site template.`)
1520
+ .option(`--activate [value]`, `Automatically activate the deployment when it is finished building.`, (value) => value === undefined ? true : parseBool(value))
1521
+ .action(actionRunner(sitesCreateTemplateDeployment))
1522
+
1523
+ sites
1524
+ .command(`create-vcs-deployment`)
1525
+ .description(`Create a deployment when a site is connected to VCS. This endpoint lets you create deployment from a branch, commit, or a tag.`)
1526
+ .requiredOption(`--site-id <site-id>`, `Site ID.`)
1527
+ .requiredOption(`--type <type>`, `Type of reference passed. Allowed values are: branch, commit`)
1528
+ .requiredOption(`--reference <reference>`, `VCS reference to create deployment from. Depending on type this can be: branch name, commit hash`)
1529
+ .option(`--activate [value]`, `Automatically activate the deployment when it is finished building.`, (value) => value === undefined ? true : parseBool(value))
1530
+ .action(actionRunner(sitesCreateVcsDeployment))
1531
+
1532
+ sites
1533
+ .command(`get-deployment`)
1534
+ .description(`Get a site deployment by its unique ID.`)
1535
+ .requiredOption(`--site-id <site-id>`, `Site ID.`)
1536
+ .requiredOption(`--deployment-id <deployment-id>`, `Deployment ID.`)
1537
+ .option(`--console`, `Get the resource console url`)
1538
+ .action(actionRunner(sitesGetDeployment))
1539
+
1540
+ sites
1541
+ .command(`delete-deployment`)
1542
+ .description(`Delete a site deployment by its unique ID.`)
1543
+ .requiredOption(`--site-id <site-id>`, `Site ID.`)
1544
+ .requiredOption(`--deployment-id <deployment-id>`, `Deployment ID.`)
1545
+ .action(actionRunner(sitesDeleteDeployment))
1546
+
1547
+ sites
1548
+ .command(`get-deployment-download`)
1549
+ .description(`Get a site deployment content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory.`)
1550
+ .requiredOption(`--site-id <site-id>`, `Site ID.`)
1551
+ .requiredOption(`--deployment-id <deployment-id>`, `Deployment ID.`)
1552
+ .option(`--type <type>`, `Deployment file to download. Can be: "source", "output".`)
1553
+ .requiredOption(`--destination <path>`, `output file path.`)
1554
+ .option(`--console`, `Get the resource console url`)
1555
+ .action(actionRunner(sitesGetDeploymentDownload))
1556
+
1557
+ sites
1558
+ .command(`update-deployment-status`)
1559
+ .description(`Cancel an ongoing site deployment build. If the build is already in progress, it will be stopped and marked as canceled. If the build hasn't started yet, it will be marked as canceled without executing. You cannot cancel builds that have already completed (status 'ready') or failed. The response includes the final build status and details.`)
1560
+ .requiredOption(`--site-id <site-id>`, `Site ID.`)
1561
+ .requiredOption(`--deployment-id <deployment-id>`, `Deployment ID.`)
1562
+ .action(actionRunner(sitesUpdateDeploymentStatus))
1563
+
1564
+ sites
1565
+ .command(`list-logs`)
1566
+ .description(`Get a list of all site logs. You can use the query params to filter your results.`)
1567
+ .requiredOption(`--site-id <site-id>`, `Site ID.`)
1568
+ .option(`--queries [queries...]`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: trigger, status, responseStatusCode, duration, requestMethod, requestPath, deploymentId`)
1569
+ .action(actionRunner(sitesListLogs))
1570
+
1571
+ sites
1572
+ .command(`get-log`)
1573
+ .description(`Get a site request log by its unique ID.`)
1574
+ .requiredOption(`--site-id <site-id>`, `Site ID.`)
1575
+ .requiredOption(`--log-id <log-id>`, `Log ID.`)
1576
+ .option(`--console`, `Get the resource console url`)
1577
+ .action(actionRunner(sitesGetLog))
1578
+
1579
+ sites
1580
+ .command(`delete-log`)
1581
+ .description(`Delete a site log by its unique ID.`)
1582
+ .requiredOption(`--site-id <site-id>`, `Site ID.`)
1583
+ .requiredOption(`--log-id <log-id>`, `Log ID.`)
1584
+ .action(actionRunner(sitesDeleteLog))
1585
+
1586
+ sites
1587
+ .command(`get-usage`)
1588
+ .description(`Get usage metrics and statistics for a for a specific site. View statistics including total deployments, builds, executions, storage usage, and compute time. The response includes both current totals and historical data for each metric. Use the optional range parameter to specify the time window for historical data: 24h (last 24 hours), 30d (last 30 days), or 90d (last 90 days). If not specified, defaults to 30 days.`)
1589
+ .requiredOption(`--site-id <site-id>`, `Site ID.`)
1590
+ .option(`--range <range>`, `Date range.`)
1591
+ .action(actionRunner(sitesGetUsage))
1592
+
1593
+ sites
1594
+ .command(`list-variables`)
1595
+ .description(`Get a list of all variables of a specific site.`)
1596
+ .requiredOption(`--site-id <site-id>`, `Site unique ID.`)
1597
+ .action(actionRunner(sitesListVariables))
1598
+
1599
+ sites
1600
+ .command(`create-variable`)
1601
+ .description(`Create a new site variable. These variables can be accessed during build and runtime (server-side rendering) as environment variables.`)
1602
+ .requiredOption(`--site-id <site-id>`, `Site unique ID.`)
1603
+ .requiredOption(`--key <key>`, `Variable key. Max length: 255 chars.`)
1604
+ .requiredOption(`--value <value>`, `Variable value. Max length: 8192 chars.`)
1605
+ .option(`--secret [value]`, `Secret variables can be updated or deleted, but only sites can read them during build and runtime.`, (value) => value === undefined ? true : parseBool(value))
1606
+ .action(actionRunner(sitesCreateVariable))
1607
+
1608
+ sites
1609
+ .command(`get-variable`)
1610
+ .description(`Get a variable by its unique ID.`)
1611
+ .requiredOption(`--site-id <site-id>`, `Site unique ID.`)
1612
+ .requiredOption(`--variable-id <variable-id>`, `Variable unique ID.`)
1613
+ .action(actionRunner(sitesGetVariable))
1614
+
1615
+ sites
1616
+ .command(`update-variable`)
1617
+ .description(`Update variable by its unique ID.`)
1618
+ .requiredOption(`--site-id <site-id>`, `Site unique ID.`)
1619
+ .requiredOption(`--variable-id <variable-id>`, `Variable unique ID.`)
1620
+ .requiredOption(`--key <key>`, `Variable key. Max length: 255 chars.`)
1621
+ .option(`--value <value>`, `Variable value. Max length: 8192 chars.`)
1622
+ .option(`--secret [value]`, `Secret variables can be updated or deleted, but only sites can read them during build and runtime.`, (value) => value === undefined ? true : parseBool(value))
1623
+ .action(actionRunner(sitesUpdateVariable))
1624
+
1625
+ sites
1626
+ .command(`delete-variable`)
1627
+ .description(`Delete a variable by its unique ID.`)
1628
+ .requiredOption(`--site-id <site-id>`, `Site unique ID.`)
1629
+ .requiredOption(`--variable-id <variable-id>`, `Variable unique ID.`)
1630
+ .action(actionRunner(sitesDeleteVariable))
1631
+
1632
+ module.exports = {
1633
+ sites,
1634
+ sitesList,
1635
+ sitesCreate,
1636
+ sitesListFrameworks,
1637
+ sitesListSpecifications,
1638
+ sitesListTemplates,
1639
+ sitesGetTemplate,
1640
+ sitesListUsage,
1641
+ sitesGet,
1642
+ sitesUpdate,
1643
+ sitesDelete,
1644
+ sitesUpdateSiteDeployment,
1645
+ sitesListDeployments,
1646
+ sitesCreateDeployment,
1647
+ sitesCreateDuplicateDeployment,
1648
+ sitesCreateTemplateDeployment,
1649
+ sitesCreateVcsDeployment,
1650
+ sitesGetDeployment,
1651
+ sitesDeleteDeployment,
1652
+ sitesGetDeploymentDownload,
1653
+ sitesUpdateDeploymentStatus,
1654
+ sitesListLogs,
1655
+ sitesGetLog,
1656
+ sitesDeleteLog,
1657
+ sitesGetUsage,
1658
+ sitesListVariables,
1659
+ sitesCreateVariable,
1660
+ sitesGetVariable,
1661
+ sitesUpdateVariable,
1662
+ sitesDeleteVariable
1663
+ };