Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Change Log

## 17.0.0

* [BREAKING] Changed `$sequence` type from `int` to `string` for rows and documents
* [BREAKING] Removed `--key` required option from `appwrite project update-variable` (now optional)
* [BREAKING] Removed billing/payment commands from `appwrite account`: `list-billing-addresses`, `create-billing-address`, `get-billing-address`, `update-billing-address`, `delete-billing-address`, `get-coupon`, `list-invoices`, `list-payment-methods`, `create-payment-method`, `get-payment-method`, `update-payment-method`, `delete-payment-method`, `update-payment-method-provider`, `update-payment-method-mandate-options`
* [BREAKING] Removed cloud-specific health commands: `get-console-pausing`, `get-queue-billing-project-aggregation`, `get-queue-billing-team-aggregation`, `get-queue-priority-builds`, `get-queue-region-manager`, `get-queue-threats`
* [BREAKING] Removed `appwrite projects update-console-access` command
* Added `--variable-id` required parameter to `appwrite project create-variable`
* Added `--queries` and `--total` optional parameters to `appwrite project list-variables`
* Added new `appwrite users update-impersonator` command
* Added `impersonator` as a filterable attribute in `appwrite users list`
* Updated API version badge to `1.9.0` and compatibility to server version `1.9.x`

## 16.0.0

* Breaking: Moved webhook commands from `projects` to new `webhooks` service.
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Appwrite Command Line SDK

![License](https://img.shields.io/github/license/appwrite/sdk-for-cli.svg?style=flat-square)
![Version](https://img.shields.io/badge/api%20version-1.8.2-blue.svg?style=flat-square)
![Version](https://img.shields.io/badge/api%20version-1.9.0-blue.svg?style=flat-square)
[![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator)
[![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite)
[![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord)

**This SDK is compatible with Appwrite server version 1.8.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-cli/releases).**
**This SDK is compatible with Appwrite server version 1.9.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-cli/releases).**

Appwrite is an open-source backend as a service server that abstracts and simplifies complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the Command Line SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)

Expand All @@ -29,7 +29,7 @@ Once the installation is complete, you can verify the install using

```sh
$ appwrite -v
16.0.0
17.0.0
```

### Install using prebuilt binaries
Expand Down Expand Up @@ -60,7 +60,7 @@ $ scoop install https://raw.githubusercontent.com/appwrite/sdk-for-cli/master/sc
Once the installation completes, you can verify your install using
```
$ appwrite -v
16.0.0
17.0.0
```

## Getting Started
Expand Down
1 change: 1 addition & 0 deletions docs/examples/project/create-variable.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
```bash
appwrite project create-variable \
--variable-id <VARIABLE_ID> \
--key <KEY> \
--value <VALUE>
```
3 changes: 1 addition & 2 deletions docs/examples/project/update-variable.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
```bash
appwrite project update-variable \
--variable-id <VARIABLE_ID> \
--key <KEY>
--variable-id <VARIABLE_ID>
```
5 changes: 5 additions & 0 deletions docs/examples/users/update-impersonator.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
```bash
appwrite users update-impersonator \
--user-id <USER_ID> \
--impersonator false
```
4 changes: 2 additions & 2 deletions install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
# You can use "View source" of this page to see the full script.

# REPO
$GITHUB_x64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/16.0.0/appwrite-cli-win-x64.exe"
$GITHUB_arm64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/16.0.0/appwrite-cli-win-arm64.exe"
$GITHUB_x64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/17.0.0/appwrite-cli-win-x64.exe"
$GITHUB_arm64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/17.0.0/appwrite-cli-win-arm64.exe"

$APPWRITE_BINARY_NAME = "appwrite.exe"

Expand Down
2 changes: 1 addition & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ printSuccess() {
downloadBinary() {
echo "[2/4] Downloading executable for $OS ($ARCH) ..."

GITHUB_LATEST_VERSION="16.0.0"
GITHUB_LATEST_VERSION="17.0.0"
GITHUB_FILE="appwrite-cli-${OS}-${ARCH}"
GITHUB_URL="https://github.com/$GITHUB_REPOSITORY_NAME/releases/download/$GITHUB_LATEST_VERSION/$GITHUB_FILE"

Expand Down
30 changes: 6 additions & 24 deletions lib/commands/push.ts
Original file line number Diff line number Diff line change
Expand Up @@ -829,18 +829,9 @@ export class Push {
const functionsServiceForVars = await getFunctionsService(
this.projectClient,
);
const { variables } = await paginate(
async (args: any) => {
return await functionsServiceForVars.listVariables({
functionId: args.functionId,
});
},
{
functionId: func["$id"],
},
100,
"variables",
);
const { variables } = await functionsServiceForVars.listVariables({
functionId: func["$id"],
});

await Promise.all(
variables.map(async (variable: any) => {
Expand Down Expand Up @@ -1199,18 +1190,9 @@ export class Push {
.replaceSpinner(SPINNER_DOTS);

const sitesServiceForVars = await getSitesService(this.projectClient);
const { variables } = await paginate(
async (args: any) => {
return await sitesServiceForVars.listVariables({
siteId: args.siteId,
});
},
{
siteId: site["$id"],
},
100,
"variables",
);
const { variables } = await sitesServiceForVars.listVariables({
siteId: site["$id"],
});

await Promise.all(
variables.map(async (variable: any) => {
Expand Down
12 changes: 5 additions & 7 deletions lib/commands/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import inquirer from "inquirer";
import path from "path";
import { Command } from "commander";
import { localConfig, globalConfig } from "../config.js";
import { paginate } from "../paginate.js";
import { getFunctionsService } from "../services.js";
import { questionsRunFunctions } from "../questions.js";
import {
Expand Down Expand Up @@ -177,12 +176,11 @@ const runFunction = async ({

if (withVariables) {
try {
const { variables: remoteVariables } = await paginate(
async () => (await getFunctionsService()).listVariables(func["$id"]),
{},
100,
"variables",
);
const { variables: remoteVariables } = await (
await getFunctionsService()
).listVariables({
functionId: func["$id"],
});

remoteVariables.forEach((v) => {
allVariables[v.key] = v.value;
Expand Down
169 changes: 0 additions & 169 deletions lib/commands/services/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,83 +58,6 @@ account
),
);

account
.command(`list-billing-addresses`)
.description(`List all billing addresses for a user.`)
.option(`--queries [queries...]`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, expired, failed`)
.action(
actionRunner(
async ({ queries }) =>
parse(await (await getAccountClient()).listBillingAddresses(queries)),
),
);

account
.command(`create-billing-address`)
.description(`Add a new billing address to a user's account.`)
.requiredOption(`--country <country>`, `Country`)
.requiredOption(`--city <city>`, `City`)
.requiredOption(`--street-address <street-address>`, `Street address`)
.option(`--address-line-2 <address-line-2>`, `Address line 2`)
.option(`--state <state>`, `State or province`)
.option(`--postal-code <postal-code>`, `Postal code`)
.action(
actionRunner(
async ({ country, city, streetAddress, addressLine2, state, postalCode }) =>
parse(await (await getAccountClient()).createBillingAddress(country, city, streetAddress, addressLine2, state, postalCode)),
),
);

account
.command(`get-billing-address`)
.description(`Get a specific billing address for a user using it's ID.`)
.requiredOption(`--billing-address-id <billing-address-id>`, `Unique ID of billing address`)
.action(
actionRunner(
async ({ billingAddressId }) =>
parse(await (await getAccountClient()).getBillingAddress(billingAddressId)),
),
);

account
.command(`update-billing-address`)
.description(`Update a specific billing address using it's ID.`)
.requiredOption(`--billing-address-id <billing-address-id>`, `Unique ID of billing address`)
.requiredOption(`--country <country>`, `Country`)
.requiredOption(`--city <city>`, `City`)
.requiredOption(`--street-address <street-address>`, `Street address`)
.option(`--address-line-2 <address-line-2>`, `Address line 2`)
.option(`--state <state>`, `State or province`)
.option(`--postal-code <postal-code>`, `Postal code`)
.action(
actionRunner(
async ({ billingAddressId, country, city, streetAddress, addressLine2, state, postalCode }) =>
parse(await (await getAccountClient()).updateBillingAddress(billingAddressId, country, city, streetAddress, addressLine2, state, postalCode)),
),
);

account
.command(`delete-billing-address`)
.description(`Delete a specific billing address using it's ID.`)
.requiredOption(`--billing-address-id <billing-address-id>`, `Billing address unique ID`)
.action(
actionRunner(
async ({ billingAddressId }) =>
parse(await (await getAccountClient()).deleteBillingAddress(billingAddressId)),
),
);

account
.command(`get-coupon`)
.description(`Get coupon details for an account.`)
.requiredOption(`--coupon-id <coupon-id>`, `ID of the coupon`)
.action(
actionRunner(
async ({ couponId }) =>
parse(await (await getAccountClient()).getCoupon(couponId)),
),
);

account
.command(`update-email`)
.description(`Update currently logged in user account email address. After changing user address, the user confirmation status will get reset. A new confirmation email is not sent automatically however you can use the send confirmation email endpoint again to send the confirmation email. For security measures, user password is required to complete this request.
Expand Down Expand Up @@ -177,17 +100,6 @@ account
),
);

account
.command(`list-invoices`)
.description(`List all invoices tied to an account.`)
.option(`--queries [queries...]`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: teamId, aggregationId, type, amount, currency, from, to, dueAt, attempts, status, grossAmount`)
.action(
actionRunner(
async ({ queries }) =>
parse(await (await getAccountClient()).listInvoices(queries)),
),
);

account
.command(`create-jwt`)
.description(`Use this endpoint to create a JSON Web Token. You can use the resulting JWT to authenticate on behalf of the current user when working with the Appwrite server-side API and SDKs. The JWT secret is valid for 15 minutes from its creation and will be invalid if the user will logout in that time frame.`)
Expand Down Expand Up @@ -408,87 +320,6 @@ account
),
);

account
.command(`list-payment-methods`)
.description(`List payment methods for this account.`)
.option(`--queries [queries...]`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, expired, failed`)
.action(
actionRunner(
async ({ queries }) =>
parse(await (await getAccountClient()).listPaymentMethods(queries)),
),
);

account
.command(`create-payment-method`)
.description(`Create a new payment method for the current user account.`)
.action(
actionRunner(
async () => parse(await (await getAccountClient()).createPaymentMethod()),
),
);

account
.command(`get-payment-method`)
.description(`Get a specific payment method for the user.`)
.requiredOption(`--payment-method-id <payment-method-id>`, `Unique ID of payment method`)
.action(
actionRunner(
async ({ paymentMethodId }) =>
parse(await (await getAccountClient()).getPaymentMethod(paymentMethodId)),
),
);

account
.command(`update-payment-method`)
.description(`Update a new payment method for the current user account.`)
.requiredOption(`--payment-method-id <payment-method-id>`, `Unique ID of payment method`)
.requiredOption(`--expiry-month <expiry-month>`, `Payment expiry month`, parseInteger)
.requiredOption(`--expiry-year <expiry-year>`, `Expiry year`, parseInteger)
.option(`--state <state>`, `State of the payment method country`)
.action(
actionRunner(
async ({ paymentMethodId, expiryMonth, expiryYear, state }) =>
parse(await (await getAccountClient()).updatePaymentMethod(paymentMethodId, expiryMonth, expiryYear, state)),
),
);

account
.command(`delete-payment-method`)
.description(`Delete a specific payment method from a user's account.`)
.requiredOption(`--payment-method-id <payment-method-id>`, `Unique ID of payment method`)
.action(
actionRunner(
async ({ paymentMethodId }) =>
parse(await (await getAccountClient()).deletePaymentMethod(paymentMethodId)),
),
);

account
.command(`update-payment-method-provider`)
.description(`Update payment method provider.`)
.requiredOption(`--payment-method-id <payment-method-id>`, `Unique ID of payment method`)
.requiredOption(`--provider-method-id <provider-method-id>`, `Payment method ID from the payment provider`)
.requiredOption(`--name <name>`, `Name in the payment method`)
.option(`--state <state>`, `State of the payment method country`)
.action(
actionRunner(
async ({ paymentMethodId, providerMethodId, name, state }) =>
parse(await (await getAccountClient()).updatePaymentMethodProvider(paymentMethodId, providerMethodId, name, state)),
),
);

account
.command(`update-payment-method-mandate-options`)
.description(`Update payment method mandate options.`)
.requiredOption(`--payment-method-id <payment-method-id>`, `Unique ID of payment method`)
.action(
actionRunner(
async ({ paymentMethodId }) =>
parse(await (await getAccountClient()).updatePaymentMethodMandateOptions(paymentMethodId)),
),
);

account
.command(`update-phone`)
.description(`Update the currently logged in user's phone number. After updating the phone number, the phone verification status will be reset. A confirmation SMS is not sent automatically, however you can use the [POST /account/verification/phone](https://appwrite.io/docs/references/cloud/client-web/account#createPhoneVerification) endpoint to send a confirmation SMS.`)
Expand Down
Loading
Loading