appwrite-cli 6.2.3 → 8.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. package/README.md +4 -4
  2. package/docs/examples/console/get-resource.md +3 -0
  3. package/docs/examples/databases/create-documents.md +4 -0
  4. package/docs/examples/databases/create-index.md +1 -0
  5. package/docs/examples/databases/delete-documents.md +4 -0
  6. package/docs/examples/databases/update-documents.md +5 -0
  7. package/docs/examples/databases/upsert-document.md +6 -0
  8. package/docs/examples/databases/upsert-documents.md +4 -0
  9. package/docs/examples/functions/{create-build.md → create-duplicate-deployment.md} +1 -1
  10. package/docs/examples/functions/create-template-deployment.md +7 -0
  11. package/docs/examples/functions/create-variable.md +2 -1
  12. package/docs/examples/functions/create-vcs-deployment.md +5 -0
  13. package/docs/examples/functions/create.md +0 -4
  14. package/docs/examples/functions/get-deployment-download.md +2 -1
  15. package/docs/examples/functions/get-usage.md +1 -0
  16. package/docs/examples/functions/list-executions.md +0 -1
  17. package/docs/examples/functions/list-usage.md +2 -0
  18. package/docs/examples/functions/{update-deployment.md → update-deployment-status.md} +1 -1
  19. package/docs/examples/functions/{update-deployment-build.md → update-function-deployment.md} +1 -1
  20. package/docs/examples/functions/update-variable.md +1 -0
  21. package/docs/examples/migrations/create-csv-migration.md +4 -0
  22. package/docs/examples/project/create-variable.md +2 -1
  23. package/docs/examples/project/update-variable.md +1 -0
  24. package/docs/examples/projects/create-dev-key.md +4 -0
  25. package/docs/examples/projects/delete-dev-key.md +3 -0
  26. package/docs/examples/projects/get-dev-key.md +3 -0
  27. package/docs/examples/projects/list-dev-keys.md +3 -0
  28. package/docs/examples/projects/update-dev-key.md +5 -0
  29. package/docs/examples/proxy/create-a-p-i-rule.md +2 -0
  30. package/docs/examples/proxy/create-function-rule.md +4 -0
  31. package/docs/examples/proxy/create-redirect-rule.md +4 -0
  32. package/docs/examples/proxy/create-site-rule.md +4 -0
  33. package/docs/examples/sites/create-deployment.md +7 -0
  34. package/docs/examples/sites/create-duplicate-deployment.md +3 -0
  35. package/docs/examples/sites/create-template-deployment.md +7 -0
  36. package/docs/examples/sites/create-variable.md +5 -0
  37. package/docs/examples/sites/create-vcs-deployment.md +5 -0
  38. package/docs/examples/sites/create.md +19 -0
  39. package/docs/examples/sites/delete-deployment.md +3 -0
  40. package/docs/examples/sites/delete-log.md +3 -0
  41. package/docs/examples/sites/delete-variable.md +3 -0
  42. package/docs/examples/sites/delete.md +2 -0
  43. package/docs/examples/sites/get-deployment-download.md +4 -0
  44. package/docs/examples/sites/get-deployment.md +3 -0
  45. package/docs/examples/sites/get-log.md +3 -0
  46. package/docs/examples/sites/get-template.md +2 -0
  47. package/docs/examples/sites/get-usage.md +3 -0
  48. package/docs/examples/sites/get-variable.md +3 -0
  49. package/docs/examples/sites/get.md +2 -0
  50. package/docs/examples/sites/list-deployments.md +4 -0
  51. package/docs/examples/sites/list-frameworks.md +1 -0
  52. package/docs/examples/sites/list-logs.md +3 -0
  53. package/docs/examples/sites/list-specifications.md +1 -0
  54. package/docs/examples/sites/list-templates.md +5 -0
  55. package/docs/examples/sites/list-usage.md +2 -0
  56. package/docs/examples/sites/list-variables.md +2 -0
  57. package/docs/examples/sites/list.md +3 -0
  58. package/docs/examples/sites/update-deployment-status.md +3 -0
  59. package/docs/examples/sites/update-site-deployment.md +3 -0
  60. package/docs/examples/sites/update-variable.md +6 -0
  61. package/docs/examples/sites/update.md +19 -0
  62. package/docs/examples/storage/get-file-download.md +2 -1
  63. package/docs/examples/storage/get-file-preview.md +1 -0
  64. package/docs/examples/storage/get-file-view.md +2 -1
  65. package/docs/examples/tokens/create-file-token.md +4 -0
  66. package/docs/examples/tokens/delete.md +2 -0
  67. package/docs/examples/tokens/get.md +2 -0
  68. package/docs/examples/tokens/list.md +4 -0
  69. package/docs/examples/tokens/update.md +3 -0
  70. package/docs/examples/users/list-memberships.md +3 -1
  71. package/docs/examples/vcs/create-repository-detection.md +1 -0
  72. package/docs/examples/vcs/list-repositories.md +1 -0
  73. package/index.js +6 -2
  74. package/install.ps1 +2 -2
  75. package/install.sh +1 -1
  76. package/lib/client.js +8 -4
  77. package/lib/commands/account.js +7 -17
  78. package/lib/commands/avatars.js +7 -14
  79. package/lib/commands/console.js +50 -1
  80. package/lib/commands/databases.js +287 -55
  81. package/lib/commands/functions.js +244 -146
  82. package/lib/commands/generic.js +1 -1
  83. package/lib/commands/health.js +0 -63
  84. package/lib/commands/init.js +191 -0
  85. package/lib/commands/locale.js +0 -8
  86. package/lib/commands/messaging.js +38 -51
  87. package/lib/commands/migrations.js +50 -5
  88. package/lib/commands/project.js +12 -5
  89. package/lib/commands/projects.js +246 -27
  90. package/lib/commands/proxy.js +160 -19
  91. package/lib/commands/pull.js +124 -1
  92. package/lib/commands/push.js +338 -5
  93. package/lib/commands/sites.js +1663 -0
  94. package/lib/commands/storage.js +28 -22
  95. package/lib/commands/teams.js +2 -8
  96. package/lib/commands/tokens.js +261 -0
  97. package/lib/commands/types.js +126 -0
  98. package/lib/commands/users.js +15 -17
  99. package/lib/commands/vcs.js +60 -53
  100. package/lib/config.js +50 -0
  101. package/lib/parser.js +2 -2
  102. package/lib/questions.js +110 -1
  103. package/lib/type-generation/attribute.js +16 -0
  104. package/lib/type-generation/languages/dart.js +152 -0
  105. package/lib/type-generation/languages/java.js +121 -0
  106. package/lib/type-generation/languages/javascript.js +84 -0
  107. package/lib/type-generation/languages/kotlin.js +75 -0
  108. package/lib/type-generation/languages/language.js +125 -0
  109. package/lib/type-generation/languages/php.js +100 -0
  110. package/lib/type-generation/languages/swift.js +156 -0
  111. package/lib/type-generation/languages/typescript.js +95 -0
  112. package/package.json +2 -1
  113. package/scoop/appwrite.json +3 -3
  114. package/docs/examples/assistant/chat.md +0 -2
  115. package/docs/examples/functions/get-function-usage.md +0 -3
  116. package/docs/examples/health/get-queue-stats-usage-dump.md +0 -2
  117. package/docs/examples/proxy/create-rule.md +0 -4
  118. package/lib/commands/assistant.js +0 -85
@@ -58,7 +58,6 @@ const accountGet = async ({parseOutput = true, overrideForCli = false, sdk = und
58
58
  let response = undefined;
59
59
 
60
60
  response = await client.call('get', apiPath, {
61
- 'content-type': 'application/json',
62
61
  }, payload);
63
62
 
64
63
  if (parseOutput) {
@@ -210,7 +209,6 @@ const accountListIdentities = async ({queries,parseOutput = true, overrideForCli
210
209
  let response = undefined;
211
210
 
212
211
  response = await client.call('get', apiPath, {
213
- 'content-type': 'application/json',
214
212
  }, payload);
215
213
 
216
214
  if (parseOutput) {
@@ -305,7 +303,6 @@ const accountListLogs = async ({queries,parseOutput = true, overrideForCli = fal
305
303
  let response = undefined;
306
304
 
307
305
  response = await client.call('get', apiPath, {
308
- 'content-type': 'application/json',
309
306
  }, payload);
310
307
 
311
308
  if (parseOutput) {
@@ -538,7 +535,6 @@ const accountListMfaFactors = async ({parseOutput = true, overrideForCli = false
538
535
  let response = undefined;
539
536
 
540
537
  response = await client.call('get', apiPath, {
541
- 'content-type': 'application/json',
542
538
  }, payload);
543
539
 
544
540
  if (parseOutput) {
@@ -568,7 +564,6 @@ const accountGetMfaRecoveryCodes = async ({parseOutput = true, overrideForCli =
568
564
  let response = undefined;
569
565
 
570
566
  response = await client.call('get', apiPath, {
571
- 'content-type': 'application/json',
572
567
  }, payload);
573
568
 
574
569
  if (parseOutput) {
@@ -768,7 +763,6 @@ const accountGetPrefs = async ({parseOutput = true, overrideForCli = false, sdk
768
763
  let response = undefined;
769
764
 
770
765
  response = await client.call('get', apiPath, {
771
- 'content-type': 'application/json',
772
766
  }, payload);
773
767
 
774
768
  if (parseOutput) {
@@ -912,7 +906,6 @@ const accountListSessions = async ({parseOutput = true, overrideForCli = false,
912
906
  let response = undefined;
913
907
 
914
908
  response = await client.call('get', apiPath, {
915
- 'content-type': 'application/json',
916
909
  }, payload);
917
910
 
918
911
  if (parseOutput) {
@@ -1065,7 +1058,7 @@ const accountUpdateMagicURLSession = async ({userId,secret,parseOutput = true, o
1065
1058
 
1066
1059
  /**
1067
1060
  * @typedef {Object} AccountCreateOAuth2SessionRequestParams
1068
- * @property {OAuthProvider} provider OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, github, gitlab, google, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, yahoo, yammer, yandex, zoho, zoom.
1061
+ * @property {OAuthProvider} provider OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, github, gitlab, google, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, yahoo, yammer, yandex, zoho, zoom.
1069
1062
  * @property {string} success URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
1070
1063
  * @property {string} failure URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
1071
1064
  * @property {string[]} scopes A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes. Maximum of 100 scopes are allowed, each 4096 characters long.
@@ -1095,7 +1088,6 @@ const accountCreateOAuth2Session = async ({provider,success,failure,scopes,parse
1095
1088
  let response = undefined;
1096
1089
 
1097
1090
  response = await client.call('get', apiPath, {
1098
- 'content-type': 'application/json',
1099
1091
  }, payload);
1100
1092
 
1101
1093
  if (parseOutput) {
@@ -1202,7 +1194,6 @@ const accountGetSession = async ({sessionId,parseOutput = true, overrideForCli =
1202
1194
  let response = undefined;
1203
1195
 
1204
1196
  response = await client.call('get', apiPath, {
1205
- 'content-type': 'application/json',
1206
1197
  }, payload);
1207
1198
 
1208
1199
  if (parseOutput) {
@@ -1503,7 +1494,7 @@ const accountCreateMagicURLToken = async ({userId,email,url,phrase,parseOutput =
1503
1494
 
1504
1495
  /**
1505
1496
  * @typedef {Object} AccountCreateOAuth2TokenRequestParams
1506
- * @property {OAuthProvider} provider OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, github, gitlab, google, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, yahoo, yammer, yandex, zoho, zoom.
1497
+ * @property {OAuthProvider} provider OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, github, gitlab, google, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, yahoo, yammer, yandex, zoho, zoom.
1507
1498
  * @property {string} success URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
1508
1499
  * @property {string} failure URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
1509
1500
  * @property {string[]} scopes A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes. Maximum of 100 scopes are allowed, each 4096 characters long.
@@ -1533,7 +1524,6 @@ const accountCreateOAuth2Token = async ({provider,success,failure,scopes,parseOu
1533
1524
  let response = undefined;
1534
1525
 
1535
1526
  response = await client.call('get', apiPath, {
1536
- 'content-type': 'application/json',
1537
1527
  }, payload);
1538
1528
 
1539
1529
  if (parseOutput) {
@@ -1775,7 +1765,7 @@ account
1775
1765
  account
1776
1766
  .command(`update-mfa`)
1777
1767
  .description(`Enable or disable MFA on an account.`)
1778
- .requiredOption(`--mfa <mfa>`, `Enable or disable MFA.`, parseBool)
1768
+ .requiredOption(`--mfa [value]`, `Enable or disable MFA.`, (value) => value === undefined ? true : parseBool(value))
1779
1769
  .action(actionRunner(accountUpdateMFA))
1780
1770
 
1781
1771
  account
@@ -1909,7 +1899,7 @@ account
1909
1899
  account
1910
1900
  .command(`create-o-auth-2-session`)
1911
1901
  .description(`Allow the user to login to their account using the OAuth2 provider of their choice. Each OAuth2 provider should be enabled from the Appwrite console first. Use the success and failure arguments to provide a redirect URL's back to your app when login is completed. If there is already an active session, the new session will be attached to the logged-in account. If there are no active sessions, the server will attempt to look for a user with the same email address as the email received from the OAuth2 provider and attach the new session to the existing user. If no matching user is found - the server will create a new user. A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). `)
1912
- .requiredOption(`--provider <provider>`, `OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, github, gitlab, google, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, yahoo, yammer, yandex, zoho, zoom.`)
1902
+ .requiredOption(`--provider <provider>`, `OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, github, gitlab, google, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, yahoo, yammer, yandex, zoho, zoom.`)
1913
1903
  .option(`--success <success>`, `URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.`)
1914
1904
  .option(`--failure <failure>`, `URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.`)
1915
1905
  .option(`--scopes [scopes...]`, `A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes. Maximum of 100 scopes are allowed, each 4096 characters long.`)
@@ -1978,7 +1968,7 @@ account
1978
1968
  .description(`Sends the user an email with a secret key for creating a session. If the provided user ID has not be registered, a new user will be created. Use the returned user ID and secret and submit a request to the [POST /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The secret sent to the user's email is valid for 15 minutes. A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).`)
1979
1969
  .requiredOption(`--user-id <user-id>`, `User 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.`)
1980
1970
  .requiredOption(`--email <email>`, `User email.`)
1981
- .option(`--phrase <phrase>`, `Toggle for security phrase. If enabled, email will be send with a randomly generated phrase and the phrase will also be included in the response. Confirming phrases match increases the security of your authentication flow.`, parseBool)
1971
+ .option(`--phrase [value]`, `Toggle for security phrase. If enabled, email will be send with a randomly generated phrase and the phrase will also be included in the response. Confirming phrases match increases the security of your authentication flow.`, (value) => value === undefined ? true : parseBool(value))
1982
1972
  .action(actionRunner(accountCreateEmailToken))
1983
1973
 
1984
1974
  account
@@ -1987,13 +1977,13 @@ account
1987
1977
  .requiredOption(`--user-id <user-id>`, `Unique 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.`)
1988
1978
  .requiredOption(`--email <email>`, `User email.`)
1989
1979
  .option(`--url <url>`, `URL to redirect the user back to your app from the magic URL login. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.`)
1990
- .option(`--phrase <phrase>`, `Toggle for security phrase. If enabled, email will be send with a randomly generated phrase and the phrase will also be included in the response. Confirming phrases match increases the security of your authentication flow.`, parseBool)
1980
+ .option(`--phrase [value]`, `Toggle for security phrase. If enabled, email will be send with a randomly generated phrase and the phrase will also be included in the response. Confirming phrases match increases the security of your authentication flow.`, (value) => value === undefined ? true : parseBool(value))
1991
1981
  .action(actionRunner(accountCreateMagicURLToken))
1992
1982
 
1993
1983
  account
1994
1984
  .command(`create-o-auth-2-token`)
1995
1985
  .description(`Allow the user to login to their account using the OAuth2 provider of their choice. Each OAuth2 provider should be enabled from the Appwrite console first. Use the success and failure arguments to provide a redirect URL's back to your app when login is completed. If authentication succeeds, 'userId' and 'secret' of a token will be appended to the success URL as query parameters. These can be used to create a new session using the [Create session](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint. A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).`)
1996
- .requiredOption(`--provider <provider>`, `OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, github, gitlab, google, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, yahoo, yammer, yandex, zoho, zoom.`)
1986
+ .requiredOption(`--provider <provider>`, `OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, github, gitlab, google, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, yahoo, yammer, yandex, zoho, zoom.`)
1997
1987
  .option(`--success <success>`, `URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.`)
1998
1988
  .option(`--failure <failure>`, `URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.`)
1999
1989
  .option(`--scopes [scopes...]`, `A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes. Maximum of 100 scopes are allowed, each 4096 characters long.`)
@@ -44,7 +44,7 @@ const avatars = new Command("avatars").description(commandDescriptions['avatars'
44
44
  * @property {Browser} code Browser Code.
45
45
  * @property {number} width Image width. Pass an integer between 0 to 2000. Defaults to 100.
46
46
  * @property {number} height Image height. Pass an integer between 0 to 2000. Defaults to 100.
47
- * @property {number} quality Image quality. Pass an integer between 0 to 100. Defaults to 100.
47
+ * @property {number} quality Image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality.
48
48
  * @property {boolean} overrideForCli
49
49
  * @property {boolean} parseOutput
50
50
  * @property {libClient | undefined} sdk
@@ -78,7 +78,6 @@ const avatarsGetBrowser = async ({code,width,height,quality,parseOutput = true,
78
78
  let response = undefined;
79
79
 
80
80
  response = await client.call('get', apiPath, {
81
- 'content-type': 'application/json',
82
81
  }, payload, 'arraybuffer');
83
82
 
84
83
  if (overrideForCli) {
@@ -99,7 +98,7 @@ const avatarsGetBrowser = async ({code,width,height,quality,parseOutput = true,
99
98
  * @property {CreditCard} code Credit Card Code. Possible values: amex, argencard, cabal, cencosud, diners, discover, elo, hipercard, jcb, mastercard, naranja, targeta-shopping, union-china-pay, visa, mir, maestro, rupay.
100
99
  * @property {number} width Image width. Pass an integer between 0 to 2000. Defaults to 100.
101
100
  * @property {number} height Image height. Pass an integer between 0 to 2000. Defaults to 100.
102
- * @property {number} quality Image quality. Pass an integer between 0 to 100. Defaults to 100.
101
+ * @property {number} quality Image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality.
103
102
  * @property {boolean} overrideForCli
104
103
  * @property {boolean} parseOutput
105
104
  * @property {libClient | undefined} sdk
@@ -133,7 +132,6 @@ const avatarsGetCreditCard = async ({code,width,height,quality,parseOutput = tru
133
132
  let response = undefined;
134
133
 
135
134
  response = await client.call('get', apiPath, {
136
- 'content-type': 'application/json',
137
135
  }, payload, 'arraybuffer');
138
136
 
139
137
  if (overrideForCli) {
@@ -179,7 +177,6 @@ const avatarsGetFavicon = async ({url,parseOutput = true, overrideForCli = false
179
177
  let response = undefined;
180
178
 
181
179
  response = await client.call('get', apiPath, {
182
- 'content-type': 'application/json',
183
180
  }, payload, 'arraybuffer');
184
181
 
185
182
  if (overrideForCli) {
@@ -200,7 +197,7 @@ const avatarsGetFavicon = async ({url,parseOutput = true, overrideForCli = false
200
197
  * @property {Flag} code Country Code. ISO Alpha-2 country code format.
201
198
  * @property {number} width Image width. Pass an integer between 0 to 2000. Defaults to 100.
202
199
  * @property {number} height Image height. Pass an integer between 0 to 2000. Defaults to 100.
203
- * @property {number} quality Image quality. Pass an integer between 0 to 100. Defaults to 100.
200
+ * @property {number} quality Image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality.
204
201
  * @property {boolean} overrideForCli
205
202
  * @property {boolean} parseOutput
206
203
  * @property {libClient | undefined} sdk
@@ -234,7 +231,6 @@ const avatarsGetFlag = async ({code,width,height,quality,parseOutput = true, ove
234
231
  let response = undefined;
235
232
 
236
233
  response = await client.call('get', apiPath, {
237
- 'content-type': 'application/json',
238
234
  }, payload, 'arraybuffer');
239
235
 
240
236
  if (overrideForCli) {
@@ -288,7 +284,6 @@ const avatarsGetImage = async ({url,width,height,parseOutput = true, overrideFor
288
284
  let response = undefined;
289
285
 
290
286
  response = await client.call('get', apiPath, {
291
- 'content-type': 'application/json',
292
287
  }, payload, 'arraybuffer');
293
288
 
294
289
  if (overrideForCli) {
@@ -346,7 +341,6 @@ const avatarsGetInitials = async ({name,width,height,background,parseOutput = tr
346
341
  let response = undefined;
347
342
 
348
343
  response = await client.call('get', apiPath, {
349
- 'content-type': 'application/json',
350
344
  }, payload, 'arraybuffer');
351
345
 
352
346
  if (overrideForCli) {
@@ -404,7 +398,6 @@ const avatarsGetQR = async ({text,size,margin,download,parseOutput = true, overr
404
398
  let response = undefined;
405
399
 
406
400
  response = await client.call('get', apiPath, {
407
- 'content-type': 'application/json',
408
401
  }, payload, 'arraybuffer');
409
402
 
410
403
  if (overrideForCli) {
@@ -426,7 +419,7 @@ avatars
426
419
  .requiredOption(`--code <code>`, `Browser Code.`)
427
420
  .option(`--width <width>`, `Image width. Pass an integer between 0 to 2000. Defaults to 100.`, parseInteger)
428
421
  .option(`--height <height>`, `Image height. Pass an integer between 0 to 2000. Defaults to 100.`, parseInteger)
429
- .option(`--quality <quality>`, `Image quality. Pass an integer between 0 to 100. Defaults to 100.`, parseInteger)
422
+ .option(`--quality <quality>`, `Image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality.`, parseInteger)
430
423
  .requiredOption(`--destination <path>`, `output file path.`)
431
424
  .action(actionRunner(avatarsGetBrowser))
432
425
 
@@ -436,7 +429,7 @@ avatars
436
429
  .requiredOption(`--code <code>`, `Credit Card Code. Possible values: amex, argencard, cabal, cencosud, diners, discover, elo, hipercard, jcb, mastercard, naranja, targeta-shopping, union-china-pay, visa, mir, maestro, rupay.`)
437
430
  .option(`--width <width>`, `Image width. Pass an integer between 0 to 2000. Defaults to 100.`, parseInteger)
438
431
  .option(`--height <height>`, `Image height. Pass an integer between 0 to 2000. Defaults to 100.`, parseInteger)
439
- .option(`--quality <quality>`, `Image quality. Pass an integer between 0 to 100. Defaults to 100.`, parseInteger)
432
+ .option(`--quality <quality>`, `Image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality.`, parseInteger)
440
433
  .requiredOption(`--destination <path>`, `output file path.`)
441
434
  .action(actionRunner(avatarsGetCreditCard))
442
435
 
@@ -453,7 +446,7 @@ avatars
453
446
  .requiredOption(`--code <code>`, `Country Code. ISO Alpha-2 country code format.`)
454
447
  .option(`--width <width>`, `Image width. Pass an integer between 0 to 2000. Defaults to 100.`, parseInteger)
455
448
  .option(`--height <height>`, `Image height. Pass an integer between 0 to 2000. Defaults to 100.`, parseInteger)
456
- .option(`--quality <quality>`, `Image quality. Pass an integer between 0 to 100. Defaults to 100.`, parseInteger)
449
+ .option(`--quality <quality>`, `Image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality.`, parseInteger)
457
450
  .requiredOption(`--destination <path>`, `output file path.`)
458
451
  .action(actionRunner(avatarsGetFlag))
459
452
 
@@ -482,7 +475,7 @@ avatars
482
475
  .requiredOption(`--text <text>`, `Plain text to be converted to QR code image.`)
483
476
  .option(`--size <size>`, `QR code size. Pass an integer between 1 to 1000. Defaults to 400.`, parseInteger)
484
477
  .option(`--margin <margin>`, `Margin from edge. Pass an integer between 0 to 10. Defaults to 1.`, parseInteger)
485
- .option(`--download <download>`, `Return resulting image with 'Content-Disposition: attachment ' headers for the browser to start downloading it. Pass 0 for no header, or 1 for otherwise. Default value is set to 0.`, parseBool)
478
+ .option(`--download [value]`, `Return resulting image with 'Content-Disposition: attachment ' headers for the browser to start downloading it. Pass 0 for no header, or 1 for otherwise. Default value is set to 0.`, (value) => value === undefined ? true : parseBool(value))
486
479
  .requiredOption(`--destination <path>`, `output file path.`)
487
480
  .action(actionRunner(avatarsGetQR))
488
481
 
@@ -39,6 +39,47 @@ const console = new Command("console").description(commandDescriptions['console'
39
39
  helpWidth: process.stdout.columns || 80
40
40
  })
41
41
 
42
+ /**
43
+ * @typedef {Object} ConsoleGetResourceRequestParams
44
+ * @property {string} value Resource value.
45
+ * @property {ConsoleResourceType} type Resource type.
46
+ * @property {boolean} overrideForCli
47
+ * @property {boolean} parseOutput
48
+ * @property {libClient | undefined} sdk
49
+ */
50
+
51
+ /**
52
+ * @param {ConsoleGetResourceRequestParams} params
53
+ */
54
+ const consoleGetResource = async ({value,type,parseOutput = true, overrideForCli = false, sdk = undefined, console}) => {
55
+ let client = !sdk ? await sdkForProject() :
56
+ sdk;
57
+ let apiPath = '/console/resources';
58
+ let payload = {};
59
+ if (typeof value !== 'undefined') {
60
+ payload['value'] = value;
61
+ }
62
+ if (typeof type !== 'undefined') {
63
+ payload['type'] = type;
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('console', 'getResource');
74
+ } else {
75
+ parse(response)
76
+ }
77
+ }
78
+
79
+ return response;
80
+
81
+ }
82
+
42
83
  /**
43
84
  * @typedef {Object} ConsoleVariablesRequestParams
44
85
  * @property {boolean} overrideForCli
@@ -58,7 +99,6 @@ const consoleVariables = async ({parseOutput = true, overrideForCli = false, sdk
58
99
  let response = undefined;
59
100
 
60
101
  response = await client.call('get', apiPath, {
61
- 'content-type': 'application/json',
62
102
  }, payload);
63
103
 
64
104
  if (parseOutput) {
@@ -69,6 +109,14 @@ const consoleVariables = async ({parseOutput = true, overrideForCli = false, sdk
69
109
 
70
110
  }
71
111
 
112
+ console
113
+ .command(`get-resource`)
114
+ .description(`Check if a resource ID is available.`)
115
+ .requiredOption(`--value <value>`, `Resource value.`)
116
+ .requiredOption(`--type <type>`, `Resource type.`)
117
+ .option(`--console`, `Get the resource console url`)
118
+ .action(actionRunner(consoleGetResource))
119
+
72
120
  console
73
121
  .command(`variables`)
74
122
  .description(`Get all Environment Variables that are relevant for the console.`)
@@ -76,5 +124,6 @@ console
76
124
 
77
125
  module.exports = {
78
126
  console,
127
+ consoleGetResource,
79
128
  consoleVariables
80
129
  };