Skip to content

Commit

Permalink
Merge pull request #157 from appwrite/feat-specifications
Browse files Browse the repository at this point in the history
Fix: Missed specifications param when updating a function
  • Loading branch information
christyjacob4 authored Jan 20, 2025
2 parents 1bcf806 + a7be174 commit 91bea6e
Show file tree
Hide file tree
Showing 21 changed files with 139 additions and 216 deletions.
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2024 Appwrite (https://appwrite.io) and individual contributors.
Copyright (c) 2025 Appwrite (https://appwrite.io) and individual contributors.
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# 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.6.0-blue.svg?style=flat-square)
![Version](https://img.shields.io/badge/api%20version-1.6.1-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)
Expand Down Expand Up @@ -29,7 +29,7 @@ Once the installation is complete, you can verify the install using

```sh
$ appwrite -v
6.1.0
6.2.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
6.1.0
6.2.0
```

## Getting Started
Expand Down
7 changes: 5 additions & 2 deletions docs/examples/messaging/create-push.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
appwrite messaging createPush \
--messageId <MESSAGE_ID> \
--title <TITLE> \
--body <BODY> \








Expand Down
3 changes: 3 additions & 0 deletions docs/examples/messaging/update-push.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ appwrite messaging updatePush \






3 changes: 0 additions & 3 deletions docs/examples/migrations/create-firebase-o-auth-migration.md

This file was deleted.

1 change: 0 additions & 1 deletion docs/examples/migrations/delete-firebase-auth.md

This file was deleted.

3 changes: 0 additions & 3 deletions docs/examples/migrations/get-firebase-report-o-auth.md

This file was deleted.

1 change: 0 additions & 1 deletion docs/examples/migrations/list-firebase-projects.md

This file was deleted.

5 changes: 5 additions & 0 deletions docs/examples/projects/update-memberships-privacy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
appwrite projects updateMembershipsPrivacy \
--projectId <PROJECT_ID> \
--userName false \
--userEmail false \
--mfa 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/6.1.0/appwrite-cli-win-x64.exe"
$GITHUB_arm64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/6.1.0/appwrite-cli-win-arm64.exe"
$GITHUB_x64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/6.2.0/appwrite-cli-win-x64.exe"
$GITHUB_arm64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/6.2.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 @@ -97,7 +97,7 @@ printSuccess() {
downloadBinary() {
echo "[2/4] Downloading executable for $OS ($ARCH) ..."

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

Expand Down
4 changes: 2 additions & 2 deletions lib/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ class Client {
'x-sdk-name': 'Command Line',
'x-sdk-platform': 'console',
'x-sdk-language': 'cli',
'x-sdk-version': '6.1.0',
'user-agent' : `AppwriteCLI/6.1.0 (${os.type()} ${os.version()}; ${os.arch()})`,
'x-sdk-version': '6.2.0',
'user-agent' : `AppwriteCLI/6.2.0 (${os.type()} ${os.version()}; ${os.arch()})`,
'X-Appwrite-Response-Format' : '1.6.0',
};
}
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/account.js
Original file line number Diff line number Diff line change
Expand Up @@ -1983,7 +1983,7 @@ account

account
.command(`create-magic-url-token`)
.description(`Sends the user an email with a secret key for creating a session. If the provided user ID has not been registered, a new user will be created. When the user clicks the link in the email, the user is redirected back to the URL you provided with the secret key and userId values attached to the URL query string. Use the query string parameters to 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 link sent to the user's email address is valid for 1 hour. If you are on a mobile device you can leave the URL parameter empty, so that the login completion will be handled by your Appwrite instance by default. 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). `)
.description(`Sends the user an email with a secret key for creating a session. If the provided user ID has not been registered, a new user will be created. When the user clicks the link in the email, the user is redirected back to the URL you provided with the secret key and userId values attached to the URL query string. Use the query string parameters to 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 link sent to the user's email address is valid for 1 hour. 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). `)
.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.`)
.requiredOption(`--email <email>`, `User email.`)
.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.`)
Expand Down
50 changes: 40 additions & 10 deletions lib/commands/messaging.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,16 +254,19 @@ const messagingUpdateEmail = async ({messageId,topics,users,targets,subject,cont
* @property {string[]} topics List of Topic IDs.
* @property {string[]} users List of User IDs.
* @property {string[]} targets List of Targets IDs.
* @property {object} data Additional Data for push notification.
* @property {object} data Additional key-value pair data for push notification.
* @property {string} action Action for push notification.
* @property {string} image Image for push notification. Must be a compound bucket ID to file ID of a jpeg, png, or bmp image in Appwrite Storage. It should be formatted as &lt;BUCKET_ID&gt;:&lt;FILE_ID&gt;.
* @property {string} icon Icon for push notification. Available only for Android and Web Platform.
* @property {string} sound Sound for push notification. Available only for Android and IOS Platform.
* @property {string} sound Sound for push notification. Available only for Android and iOS Platform.
* @property {string} color Color for push notification. Available only for Android Platform.
* @property {string} tag Tag for push notification. Available only for Android Platform.
* @property {string} badge Badge for push notification. Available only for IOS Platform.
* @property {number} badge Badge for push notification. Available only for iOS Platform.
* @property {boolean} draft Is message a draft
* @property {string} scheduledAt Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future.
* @property {boolean} contentAvailable If set to true, the notification will be delivered in the background. Available only for iOS Platform.
* @property {boolean} critical If set to true, the notification will be marked as critical. This requires the app to have the critical notification entitlement. Available only for iOS Platform.
* @property {MessagePriority} priority Set the notification priority. &quot;normal&quot; will consider device state and may not deliver notifications immediately. &quot;high&quot; will always attempt to immediately deliver the notification.
* @property {boolean} overrideForCli
* @property {boolean} parseOutput
* @property {libClient | undefined} sdk
Expand All @@ -272,7 +275,7 @@ const messagingUpdateEmail = async ({messageId,topics,users,targets,subject,cont
/**
* @param {MessagingCreatePushRequestParams} params
*/
const messagingCreatePush = async ({messageId,title,body,topics,users,targets,data,action,image,icon,sound,color,tag,badge,draft,scheduledAt,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
const messagingCreatePush = async ({messageId,title,body,topics,users,targets,data,action,image,icon,sound,color,tag,badge,draft,scheduledAt,contentAvailable,critical,priority,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
let client = !sdk ? await sdkForProject() :
sdk;
let apiPath = '/messaging/messages/push';
Expand Down Expand Up @@ -328,6 +331,15 @@ const messagingCreatePush = async ({messageId,title,body,topics,users,targets,da
if (typeof scheduledAt !== 'undefined') {
payload['scheduledAt'] = scheduledAt;
}
if (typeof contentAvailable !== 'undefined') {
payload['contentAvailable'] = contentAvailable;
}
if (typeof critical !== 'undefined') {
payload['critical'] = critical;
}
if (typeof priority !== 'undefined') {
payload['priority'] = priority;
}

let response = undefined;

Expand Down Expand Up @@ -361,6 +373,9 @@ const messagingCreatePush = async ({messageId,title,body,topics,users,targets,da
* @property {number} badge Badge for push notification. Available only for iOS platforms.
* @property {boolean} draft Is message a draft
* @property {string} scheduledAt Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future.
* @property {boolean} contentAvailable If set to true, the notification will be delivered in the background. Available only for iOS Platform.
* @property {boolean} critical If set to true, the notification will be marked as critical. This requires the app to have the critical notification entitlement. Available only for iOS Platform.
* @property {MessagePriority} priority Set the notification priority. &quot;normal&quot; will consider device battery state and may send notifications later. &quot;high&quot; will always attempt to immediately deliver the notification.
* @property {boolean} overrideForCli
* @property {boolean} parseOutput
* @property {libClient | undefined} sdk
Expand All @@ -369,7 +384,7 @@ const messagingCreatePush = async ({messageId,title,body,topics,users,targets,da
/**
* @param {MessagingUpdatePushRequestParams} params
*/
const messagingUpdatePush = async ({messageId,topics,users,targets,title,body,data,action,image,icon,sound,color,tag,badge,draft,scheduledAt,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
const messagingUpdatePush = async ({messageId,topics,users,targets,title,body,data,action,image,icon,sound,color,tag,badge,draft,scheduledAt,contentAvailable,critical,priority,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
let client = !sdk ? await sdkForProject() :
sdk;
let apiPath = '/messaging/messages/push/{messageId}'.replace('{messageId}', messageId);
Expand Down Expand Up @@ -422,6 +437,15 @@ const messagingUpdatePush = async ({messageId,topics,users,targets,title,body,da
if (typeof scheduledAt !== 'undefined') {
payload['scheduledAt'] = scheduledAt;
}
if (typeof contentAvailable !== 'undefined') {
payload['contentAvailable'] = contentAvailable;
}
if (typeof critical !== 'undefined') {
payload['critical'] = critical;
}
if (typeof priority !== 'undefined') {
payload['priority'] = priority;
}

let response = undefined;

Expand Down Expand Up @@ -2454,21 +2478,24 @@ messaging
.command(`create-push`)
.description(`Create a new push notification.`)
.requiredOption(`--message-id <message-id>`, `Message 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.`)
.requiredOption(`--title <title>`, `Title for push notification.`)
.requiredOption(`--body <body>`, `Body for push notification.`)
.option(`--title <title>`, `Title for push notification.`)
.option(`--body <body>`, `Body for push notification.`)
.option(`--topics [topics...]`, `List of Topic IDs.`)
.option(`--users [users...]`, `List of User IDs.`)
.option(`--targets [targets...]`, `List of Targets IDs.`)
.option(`--data <data>`, `Additional Data for push notification.`)
.option(`--data <data>`, `Additional key-value pair data for push notification.`)
.option(`--action <action>`, `Action for push notification.`)
.option(`--image <image>`, `Image for push notification. Must be a compound bucket ID to file ID of a jpeg, png, or bmp image in Appwrite Storage. It should be formatted as <BUCKET_ID>:<FILE_ID>.`)
.option(`--icon <icon>`, `Icon for push notification. Available only for Android and Web Platform.`)
.option(`--sound <sound>`, `Sound for push notification. Available only for Android and IOS Platform.`)
.option(`--sound <sound>`, `Sound for push notification. Available only for Android and iOS Platform.`)
.option(`--color <color>`, `Color for push notification. Available only for Android Platform.`)
.option(`--tag <tag>`, `Tag for push notification. Available only for Android Platform.`)
.option(`--badge <badge>`, `Badge for push notification. Available only for IOS Platform.`)
.option(`--badge <badge>`, `Badge for push notification. Available only for iOS Platform.`, parseInteger)
.option(`--draft <draft>`, `Is message a draft`, parseBool)
.option(`--scheduled-at <scheduled-at>`, `Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future.`)
.option(`--content-available <content-available>`, `If set to true, the notification will be delivered in the background. Available only for iOS Platform.`, parseBool)
.option(`--critical <critical>`, `If set to true, the notification will be marked as critical. This requires the app to have the critical notification entitlement. Available only for iOS Platform.`, parseBool)
.option(`--priority <priority>`, `Set the notification priority. "normal" will consider device state and may not deliver notifications immediately. "high" will always attempt to immediately deliver the notification.`)
.action(actionRunner(messagingCreatePush))

messaging
Expand All @@ -2490,6 +2517,9 @@ messaging
.option(`--badge <badge>`, `Badge for push notification. Available only for iOS platforms.`, parseInteger)
.option(`--draft <draft>`, `Is message a draft`, parseBool)
.option(`--scheduled-at <scheduled-at>`, `Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future.`)
.option(`--content-available <content-available>`, `If set to true, the notification will be delivered in the background. Available only for iOS Platform.`, parseBool)
.option(`--critical <critical>`, `If set to true, the notification will be marked as critical. This requires the app to have the critical notification entitlement. Available only for iOS Platform.`, parseBool)
.option(`--priority <priority>`, `Set the notification priority. "normal" will consider device battery state and may send notifications later. "high" will always attempt to immediately deliver the notification.`)
.action(actionRunner(messagingUpdatePush))

messaging
Expand Down
Loading

0 comments on commit 91bea6e

Please sign in to comment.