Skip to content

Commit

Permalink
Fix CLI encoding of JSON objects
Browse files Browse the repository at this point in the history
  • Loading branch information
TorstenDittmann committed Oct 18, 2021
1 parent d7365ec commit db246ff
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion app/account.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@
$path = str_replace([], [], '/account/prefs');
$params = [];
/** Body Params */
$params['prefs'] = $prefs;
$params['prefs'] = \json_decode($prefs);
$response = $client->call(Client::METHOD_PATCH, $path, [
'content-type' => 'application/json',
], $params);
Expand Down
4 changes: 2 additions & 2 deletions app/database.php
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@
$path = str_replace(['{collectionId}'], [$collectionId], '/database/collections/{collectionId}/documents');
$params = [];
/** Body Params */
$params['data'] = $data;
$params['data'] = \json_decode($data);
$params['read'] = !is_array($read) ? array($read) : $read;
$params['write'] = !is_array($write) ? array($write) : $write;
$params['parentDocument'] = $parentDocument;
Expand Down Expand Up @@ -267,7 +267,7 @@
$path = str_replace(['{collectionId}', '{documentId}'], [$collectionId, $documentId], '/database/collections/{collectionId}/documents/{documentId}');
$params = [];
/** Body Params */
$params['data'] = $data;
$params['data'] = \json_decode($data);
$params['read'] = !is_array($read) ? array($read) : $read;
$params['write'] = !is_array($write) ? array($write) : $write;
$response = $client->call(Client::METHOD_PATCH, $path, [
Expand Down
4 changes: 2 additions & 2 deletions app/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
$params['name'] = $name;
$params['execute'] = !is_array($execute) ? array($execute) : $execute;
$params['runtime'] = $runtime;
$params['vars'] = $vars;
$params['vars'] = \json_decode($vars);
$params['events'] = !is_array($events) ? array($events) : $events;
$params['schedule'] = $schedule;
$params['timeout'] = (int)$timeout;
Expand Down Expand Up @@ -146,7 +146,7 @@
/** Body Params */
$params['name'] = $name;
$params['execute'] = !is_array($execute) ? array($execute) : $execute;
$params['vars'] = $vars;
$params['vars'] = \json_decode($vars);
$params['events'] = !is_array($events) ? array($events) : $events;
$params['schedule'] = $schedule;
$params['timeout'] = (int)$timeout;
Expand Down
2 changes: 1 addition & 1 deletion app/users.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@
$path = str_replace(['{userId}'], [$userId], '/users/{userId}/prefs');
$params = [];
/** Body Params */
$params['prefs'] = $prefs;
$params['prefs'] = \json_decode($prefs);
$response = $client->call(Client::METHOD_PATCH, $path, [
'content-type' => 'application/json',
], $params);
Expand Down
2 changes: 1 addition & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ APPWRITE_EXECUTABLE_NAME=appwrite
APPWRITE_EXECUTABLE_FILEPATH="$APPWRITE_INSTALL_DIR/$APPWRITE_EXECUTABLE_NAME"

# Appwrite CLI temp name
APPWRITE_TEMP_NAME=temp
APPWRITE_TEMP_NAME=temp-$(date +%s)

# Appwrite CLI image name
APPWRITE_CLI_IMAGE_NAME=appwrite/cli
Expand Down

0 comments on commit db246ff

Please sign in to comment.