Skip to content

Commit f9eb3ae

Browse files
Merge pull request #11 from appwrite/dev
feat: update version
2 parents 03de4d4 + 90efaa0 commit f9eb3ae

34 files changed

+132
-75
lines changed

README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
# Appwrite Command Line SDK
22

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

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

10-
Appwrite is an open-source backend as a service server that abstract and simplify 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.
11-
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.
12-
For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)
11+
Appwrite is an open-source backend as a service server that abstract and simplify 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)
1312

1413
![Appwrite](https://appwrite.io/images/github.png)
1514

app/Appwrite/services/account.php renamed to app/account.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,22 @@
255255
$parser->parseResponse($response);
256256
});
257257

258+
$cli
259+
->task('getSession')
260+
->label('description', "Use this endpoint to get a logged in user's session using a Session ID. Inputting 'current' will return the current session being used.\n\n")
261+
->param('sessionId', '' , new Wildcard() , 'Session unique ID. Use the string 'current' to get the current device session.', false)
262+
->action(function ( $sessionId ) use ($parser) {
263+
/** @var string $sessionId */
264+
265+
$client = new Client();
266+
$path = str_replace(['{sessionId}'], [$sessionId], '/account/sessions/{sessionId}');
267+
$params = [];
268+
$response = $client->call(Client::METHOD_GET, $path, [
269+
'content-type' => 'application/json',
270+
], $params);
271+
$parser->parseResponse($response);
272+
});
273+
258274
$cli
259275
->task('deleteSession')
260276
->label('description', "Use this endpoint to log out the currently logged in user from all their account sessions across all of their different devices. When using the option id argument, only the session unique ID provider will be deleted.\n\n")
@@ -343,6 +359,7 @@
343359
Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface.",
344360
"getSessions" => "Get currently logged in user list of active sessions across different devices.",
345361
"deleteSessions" => "Delete all sessions from the user account and remove any sessions cookies from the end client.",
362+
"getSession" => "Use this endpoint to get a logged in user's session using a Session ID. Inputting 'current' will return the current session being used.",
346363
"deleteSession" => "Use this endpoint to log out the currently logged in user from all their account sessions across all of their different devices. When using the option id argument, only the session unique ID provider will be deleted.",
347364
"createVerification" => "Use this endpoint to send a verification message to your user email address to confirm they are the valid owners of that address. Both the **userId** and **secret** arguments will be passed as query parameters to the URL you have provided to be attached to the verification email. The provided URL should redirect the user back to your app and allow you to complete the verification process by verifying both the **userId** and **secret** parameters. Learn more about how to [complete the verification process](/docs/client/account#accountUpdateVerification). The verification link sent to the user's email address is valid for 7 days.
348365
File renamed without changes.

app/Appwrite/services/client.php renamed to app/client.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@
109109
$cli
110110
->task('version')
111111
->action(function() {
112-
Console::log('CLI Version : 0.10.0');
113-
Console::log('Server Version : 0.8.0');
112+
Console::log('CLI Version : 0.11.0');
113+
Console::log('Server Version : 0.9.0');
114114
});
115115

116116

File renamed without changes.

app/Appwrite/services/functions.php renamed to app/functions.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,15 @@
7474
->label('description', "Create a new function. You can pass a list of [permissions](/docs/permissions) to allow different project users or team with access to execute the function using the client API.\n\n")
7575
->param('name', '' , new Wildcard() , 'Function name. Max length: 128 chars.', false)
7676
->param('execute', '' , new Wildcard() , 'An array of strings with execution permissions. By default no user is granted with any execute permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions.', false)
77-
->param('env', '' , new Wildcard() , 'Execution enviornment.', false)
77+
->param('runtime', '' , new Wildcard() , 'Execution runtime.', false)
7878
->param('vars', [] , new Wildcard() , 'Key-value JSON object.', true)
7979
->param('events', [] , new Wildcard() , 'Events list.', true)
8080
->param('schedule', '' , new Wildcard() , 'Schedule CRON syntax.', true)
8181
->param('timeout', 15 , new Wildcard() , 'Function maximum execution time in seconds.', true)
82-
->action(function ( $name, $execute, $env, $vars, $events, $schedule, $timeout ) use ($parser) {
82+
->action(function ( $name, $execute, $runtime, $vars, $events, $schedule, $timeout ) use ($parser) {
8383
/** @var string $name */
8484
/** @var array $execute */
85-
/** @var string $env */
85+
/** @var string $runtime */
8686
/** @var object $vars */
8787
/** @var array $events */
8888
/** @var string $schedule */
@@ -94,7 +94,7 @@
9494
/** Body Params */
9595
$params['name'] = $name;
9696
$params['execute'] = !is_array($execute) ? array($execute) : $execute;
97-
$params['env'] = $env;
97+
$params['runtime'] = $runtime;
9898
$params['vars'] = $vars;
9999
$params['events'] = !is_array($events) ? array($events) : $events;
100100
$params['schedule'] = $schedule;
@@ -308,14 +308,15 @@
308308
$params = [];
309309
/** Body Params */
310310
$params['command'] = $command;
311-
$cloudFunctionPath = realpath(__DIR__.'/../../../files/'.$code);
312-
$cloudFunctionParentDir = dirname($cloudFunctionPath, 1);
313-
$cloudFunctionDirName = basename($cloudFunctionPath);
311+
$code = \urldecode($code);
312+
$cloudFunctionPath = realpath(__DIR__.'/../files/'.$code);
313+
$cloudFunctionParentDir = escapeshellarg(dirname($cloudFunctionPath, 1));
314+
$cloudFunctionDirName = escapeshellarg(basename($cloudFunctionPath));
314315
if (file_exists($cloudFunctionPath) === false ) {
315316
throw new Exception("Path doesn't exist. Please ensure that the path is within the current directory. ");
316317
}
317318
$archiveName = 'code.tar.gz';
318-
$volumeMountPoint = realpath(__DIR__.'/../../../files/');
319+
$volumeMountPoint = realpath(__DIR__.'/../files/');
319320
exec("tar -zcvf $archiveName -C $cloudFunctionParentDir $cloudFunctionDirName && mv $archiveName $volumeMountPoint");
320321
$archivePath = realpath($volumeMountPoint."/$archiveName");
321322
$cFile = new \CURLFile($archivePath, 'application/x-gzip' , basename($archivePath));
File renamed without changes.
File renamed without changes.

app/Appwrite/services/init.php renamed to app/init.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
use Utopia\CLI\Console;
1111
use Appwrite\Parser;
1212

13-
const USER_PREFERENCES_FILE = __DIR__."/../../.preferences/.prefs.json";
13+
const USER_PREFERENCES_FILE = __DIR__."/.preferences/.prefs.json";
1414
const PREFERENCE_ENDPOINT = "endpoint";
1515

1616
/**
File renamed without changes.

0 commit comments

Comments
 (0)