Merge branch '0.16.x' of https://github.com/appwrite/appwrite into feat-refactor-tasks

This commit is contained in:
Damodar Lohani 2022-09-05 06:52:41 +00:00
commit 0b42a564b0
239 changed files with 1377 additions and 306 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -486,8 +486,8 @@ App::post('/v1/databases/:databaseId/collections')
->param('databaseId', '', new UID(), 'Database ID.')
->param('collectionId', '', new CustomId(), 'Unique Id. Choose your own unique ID or pass the string "unique()" to auto generate it. 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.')
->param('name', '', new Text(128), 'Collection name. Max length: 128 chars.')
->param('permissions', null, new Permissions(APP_LIMIT_ARRAY_PARAMS_SIZE), 'An array of permissions strings. By default no user is granted with any permissions. [Learn more about permissions](/docs/permissions).')
->param('documentSecurity', false, new Boolean(true), 'Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](/docs/permissions).')
->param('permissions', null, new Permissions(APP_LIMIT_ARRAY_PARAMS_SIZE), 'An array of permissions strings. By default no user is granted with any permissions. [Learn more about permissions](/docs/permissions).', true)
->param('documentSecurity', false, new Boolean(true), 'Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](/docs/permissions).', true)
->inject('response')
->inject('dbForProject')
->inject('events')
@ -740,7 +740,7 @@ App::put('/v1/databases/:databaseId/collections/:collectionId')
->param('collectionId', '', new UID(), 'Collection ID.')
->param('name', null, new Text(128), 'Collection name. Max length: 128 chars.')
->param('permissions', null, new Permissions(APP_LIMIT_ARRAY_PARAMS_SIZE), 'An array of permission strings. By default the current permission are inherited. [Learn more about permissions](/docs/permissions).', true)
->param('documentSecurity', false, new Boolean(true), 'Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](/docs/permissions).')
->param('documentSecurity', false, new Boolean(true), 'Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](/docs/permissions).', true)
->param('enabled', true, new Boolean(), 'Is collection enabled?', true)
->inject('response')
->inject('dbForProject')
@ -1282,7 +1282,7 @@ App::post('/v1/databases/:databaseId/collections/:collectionId/attributes/dateti
->param('collectionId', '', new UID(), 'Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).')
->param('key', '', new Key(), 'Attribute Key.')
->param('required', null, new Boolean(), 'Is attribute required?')
->param('default', null, new DatetimeValidator(), 'Default value for attribute when not provided. Cannot be set when attribute is required.', true)
->param('default', null, new DatetimeValidator(), 'Default value for the attribute in ISO 8601 format. Cannot be set when attribute is required.', true)
->param('array', false, new Boolean(), 'Is attribute an array?', true)
->inject('response')
->inject('dbForProject')

View file

@ -358,7 +358,9 @@ App::get('/v1/functions/usage')
$requestDocs = $dbForProject->find('stats', [
Query::equal('period', [$period]),
Query::equal('metric', [$metric]),
], $limit, 0, ['time'], [Database::ORDER_DESC]);
Query::limit($limit),
Query::orderDesc('time'),
]);
$stats[$metric] = [];
foreach ($requestDocs as $requestDoc) {
@ -378,7 +380,7 @@ App::get('/v1/functions/usage')
};
$stats[$metric][] = [
'value' => 0,
'date' => ($stats[$metric][$last]['date'] ?? \time()) - $diff, // time of last metric minus period
'date' => DateTime::addSeconds(new \DateTime($stats[$metric][$last]['date'] ?? null), -1 * $diff),
];
$backfill--;
}
@ -1371,7 +1373,8 @@ App::get('/v1/functions/:functionId/variables')
}
// Get cursor document if there was a cursor query
$cursor = reset(Query::getByType($queries, Query::TYPE_CURSORAFTER, Query::TYPE_CURSORBEFORE));
$cursor = Query::getByType($queries, Query::TYPE_CURSORAFTER, Query::TYPE_CURSORBEFORE);
$cursor = reset($cursor);
if ($cursor) {
/** @var Query $cursor */
$variableId = $cursor->getValue();

View file

@ -194,7 +194,8 @@ App::get('/v1/projects')
}
// Get cursor document if there was a cursor query
$cursor = reset(Query::getByType($queries, Query::TYPE_CURSORAFTER, Query::TYPE_CURSORBEFORE));
$cursor = Query::getByType($queries, Query::TYPE_CURSORAFTER, Query::TYPE_CURSORBEFORE);
$cursor = reset($cursor);
if ($cursor) {
/** @var Query $cursor */
$projectId = $cursor->getValue();
@ -838,7 +839,7 @@ App::post('/v1/projects/:projectId/keys')
->param('projectId', null, new UID(), 'Project unique ID.')
->param('name', null, new Text(128), 'Key name. Max length: 128 chars.')
->param('scopes', null, new ArrayList(new WhiteList(array_keys(Config::getParam('scopes')), true), APP_LIMIT_ARRAY_PARAMS_SIZE), 'Key scopes list. Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' scopes are allowed.')
->param('expire', null, new DatetimeValidator(), 'Expiration time in DateTime. Use null for unlimited expiration.', true)
->param('expire', null, new DatetimeValidator(), 'Expiration time in ISO 8601 format. Use null for unlimited expiration.', true)
->inject('response')
->inject('dbForConsole')
->action(function (string $projectId, string $name, array $scopes, ?string $expire, Response $response, Database $dbForConsole) {
@ -954,7 +955,7 @@ App::put('/v1/projects/:projectId/keys/:keyId')
->param('keyId', null, new UID(), 'Key unique ID.')
->param('name', null, new Text(128), 'Key name. Max length: 128 chars.')
->param('scopes', null, new ArrayList(new WhiteList(array_keys(Config::getParam('scopes')), true), APP_LIMIT_ARRAY_PARAMS_SIZE), 'Key scopes list. Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' events are allowed.')
->param('expire', null, new DatetimeValidator(), 'Expiration time in DateTime. Use null for unlimited expiration.', true)
->param('expire', null, new DatetimeValidator(), 'Expiration time in ISO 8601 format. Use null for unlimited expiration.', true)
->inject('response')
->inject('dbForConsole')
->action(function (string $projectId, string $keyId, string $name, array $scopes, ?string $expire, Response $response, Database $dbForConsole) {

View file

@ -60,7 +60,7 @@ App::post('/v1/storage/buckets')
->param('bucketId', '', new CustomId(), 'Unique Id. Choose your own unique ID or pass the string `unique()` to auto generate it. 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.')
->param('name', '', new Text(128), 'Bucket name')
->param('permissions', null, new Permissions(APP_LIMIT_ARRAY_PARAMS_SIZE), 'An array of permission strings. By default no user is granted with any permissions. [Learn more about permissions](/docs/permissions).', true)
->param('fileSecurity', false, new Boolean(true), 'Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](/docs/permissions).')
->param('fileSecurity', false, new Boolean(true), 'Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](/docs/permissions).', true)
->param('enabled', true, new Boolean(true), 'Is bucket enabled?', true)
->param('maximumFileSize', (int) App::getEnv('_APP_STORAGE_LIMIT', 0), new Range(1, (int) App::getEnv('_APP_STORAGE_LIMIT', 0)), 'Maximum file size allowed in bytes. Maximum allowed value is ' . Storage::human(App::getEnv('_APP_STORAGE_LIMIT', 0), 0) . '. For self-hosted setups you can change the max limit by changing the `_APP_STORAGE_LIMIT` environment variable. [Learn more about storage environment variables](docs/environment-variables#storage)', true)
->param('allowedFileExtensions', [], new ArrayList(new Text(64), APP_LIMIT_ARRAY_PARAMS_SIZE), 'Allowed file extensions. Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' extensions are allowed, each 64 characters long.', true)
@ -230,7 +230,7 @@ App::put('/v1/storage/buckets/:bucketId')
->param('bucketId', '', new UID(), 'Bucket unique ID.')
->param('name', null, new Text(128), 'Bucket name', false)
->param('permissions', null, new Permissions(APP_LIMIT_ARRAY_PARAMS_SIZE), 'An array of permission strings. By default the current permissions are inherited. [Learn more about permissions](/docs/permissions).', true)
->param('fileSecurity', false, new Boolean(true), 'Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](/docs/permissions).')
->param('fileSecurity', false, new Boolean(true), 'Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](/docs/permissions).', true)
->param('enabled', true, new Boolean(true), 'Is bucket enabled?', true)
->param('maximumFileSize', null, new Range(1, (int) App::getEnv('_APP_STORAGE_LIMIT', 0)), 'Maximum file size allowed in bytes. Maximum allowed value is ' . Storage::human((int)App::getEnv('_APP_STORAGE_LIMIT', 0), 0) . '. For self hosted version you can change the limit by changing _APP_STORAGE_LIMIT environment variable. [Learn more about storage environment variables](docs/environment-variables#storage)', true)
->param('allowedFileExtensions', [], new ArrayList(new Text(64), APP_LIMIT_ARRAY_PARAMS_SIZE), 'Allowed file extensions. Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' extensions are allowed, each 64 characters long.', true)
@ -1595,6 +1595,7 @@ App::get('/v1/storage/:bucketId/usage')
foreach ($metrics as $metric) {
$limit = $periods[$range]['limit'];
$period = $periods[$range]['period'];
$requestDocs = $dbForProject->find('stats', [
Query::equal('period', [$period]),
Query::equal('metric', [$metric]),

View file

@ -14,6 +14,7 @@ use Utopia\Validator\Integer;
use Utopia\Validator\Text;
use Utopia\Storage\Validator\File;
use Utopia\Validator\WhiteList;
use Utopia\Database\ID;
App::get('/v1/mock/tests/foo')
->desc('Get Foo')

View file

@ -408,7 +408,8 @@ Database::addFilter(
return $database
->find('variables', [
Query::equal('functionInternalId', [$document->getInternalId()]),
], APP_LIMIT_SUBQUERY);
Query::limit(APP_LIMIT_SUBQUERY),
]);
}
);

View file

@ -46,12 +46,12 @@ $escapedPermissions = \array_map(function ($perm) {
<?php endif; ?>
:value="rawPermissions"/>
<table data-ls-attrs="x-init=load({{<?php if (!empty($data)) echo $data . '.$permissions' ?>}})">
<table class="u-table-layout-normal" data-ls-attrs="x-init=load({{<?php if (!empty($data)) echo $data . '.$permissions' ?>}})">
<thead>
<tr>
<th>Role</th>
<?php foreach ($permissions as $permission): ?>
<th><?php echo \ucfirst($permission); ?></th>
<th class="u-no-trim"><?php echo \ucfirst($permission); ?></th>
<?php endforeach; ?>
<th></th>
</tr>

View file

@ -349,7 +349,7 @@ sort($patterns);
</div>
<ul class="chart-notes margin-bottom-large">
<li class="orange">CPU Time <span data-ls-bind="({{usage.executionsTime|statsGetLast|seconds2hum}})"></span></li>
<li class="orange">CPU Time <span data-ls-bind="({{usage.executionsTime|statsGetLast|ms2hum}})"></span></li>
</ul>
<div class="box margin-bottom-small">
@ -730,36 +730,6 @@ sort($patterns);
<input type="text" id="function-schedule" class="full-width" name="schedule" autocomplete="off" data-ls-bind="{{project-function.schedule}}" placeholder="* * * * *" />
<div class="text-size-small text-fade margin-bottom margin-top-negative-small">Leave blank for no schedule</div>
<label class="margin-bottom-small">Variables <span class="tooltip small" data-tooltip="Set variables or secret keys that will be passed as env vars to your function at runtime."><i class="icon-info-circled"></i></span></label>
<div data-ls-if="(!{{project-function.vars.length}})">
<fieldset name="vars" data-cast-to="object">
<div data-ls-loop="project-function.vars" data-ls-as="var" id="project-vars" style="visibility: visible;">
<div class="margin-bottom-small">
<div data-forms-remove class="row thin">
<div class="col span-10">
<input type="hidden" data-forms-key-value data-ls-attrs="name={{$index}}" data-ls-bind="{{var}}" />
</div>
<div class="col span-2">
<button type="button" data-remove class="close pull-end is-margin-top-10"><i class="icon-trash"></i></button>
</div>
</div>
</div>
</div>
<div data-forms-clone="" data-target="project-vars" data-label="Add Variable" data-first="0">
<div class="margin-bottom-small">
<div data-forms-remove class="row thin">
<div class="col span-10">
<input type="hidden" data-ls-attrs="data-forms-key-value"/>
</div>
<div class="col span-2">
<button type="button" data-remove class="close pull-end is-margin-top-10"><i class="icon-trash"></i></button>
</div>
</div>
</div>
</div>
</fieldset>
</div>
<hr class="margin-bottom margin-top-small" />
<button>Update</button>

View file

@ -195,7 +195,7 @@ $usageStatsEnabled = $this->getParam('usageStatsEnabled', true);
</div>
<ul class="chart-notes margin-bottom-large">
<li class="orange">CPU Time <span data-ls-bind="({{usage.executionsTime|statsGetLast|seconds2hum}})"></span></li>
<li class="orange">CPU Time <span data-ls-bind="({{usage.executionsTime|statsGetLast|ms2hum}})"></span></li>
</ul>
<div class="box margin-bottom-small">

View file

@ -130,7 +130,7 @@ $usageStatsEnabled = $this->getParam('usageStatsEnabled', true);
<div class="margin-top-small"><b class="text-size-small unit">Users</b></div>
</div>
<div class="col span-3">
<div class="value"><span class="sum" data-ls-bind="{{usage.functions|statsGetLast|statsTotal}}" data-default="0">0</span></div>
<div class="value"><span class="sum" data-ls-bind="{{usage.executions|statsGetLast|statsTotal}}" data-default="0">0</span></div>
<div class="margin-top-small"><b class="text-size-small unit">Executions</b></div>
</div>
</div>

View file

@ -195,10 +195,10 @@ class BuildsV1 extends Worker
$function->setAttribute('scheduleNext', $next);
$function = $dbForProject->updateDocument('functions', $function->getId(), $function);
} catch (\Throwable $th) {
$endtime = DateTime::now();
$interval = (new \DateTime($endtime))->diff(new \DateTime($startTime));
$build->setAttribute('endTime', $endtime);
$build->setAttribute('duration', $interval->format('%s'));
$endTime = DateTime::now();
$interval = (new \DateTime($endTime))->diff(new \DateTime($startTime));
$build->setAttribute('endTime', $endTime);
$build->setAttribute('duration', $interval->format('%s') + 0);
$build->setAttribute('status', 'failed');
$build->setAttribute('stderr', $th->getMessage());
Console::error($th->getMessage());

View file

@ -82,7 +82,7 @@
}
],
"require-dev": {
"appwrite/sdk-generator": "0.22.0",
"appwrite/sdk-generator": "0.23.0",
"ext-fileinfo": "*",
"phpunit/phpunit": "9.5.20",
"squizlabs/php_codesniffer": "^3.6",

26
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "c45d79c5b91ed06a4a4a93863da93eff",
"content-hash": "c20ca07e12568e9a49c983e2984dedad",
"packages": [
{
"name": "adhocore/jwt",
@ -2900,16 +2900,16 @@
"packages-dev": [
{
"name": "appwrite/sdk-generator",
"version": "0.22.0",
"version": "0.23.0",
"source": {
"type": "git",
"url": "https://github.com/appwrite/sdk-generator.git",
"reference": "805d8ff91656e8bc178a5461b17ee813f30de737"
"reference": "efadccb9abd6263d045ef157881143d3a59dc710"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/805d8ff91656e8bc178a5461b17ee813f30de737",
"reference": "805d8ff91656e8bc178a5461b17ee813f30de737",
"url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/efadccb9abd6263d045ef157881143d3a59dc710",
"reference": "efadccb9abd6263d045ef157881143d3a59dc710",
"shasum": ""
},
"require": {
@ -2944,9 +2944,9 @@
"description": "Appwrite PHP library for generating API SDKs for multiple programming languages and platforms",
"support": {
"issues": "https://github.com/appwrite/sdk-generator/issues",
"source": "https://github.com/appwrite/sdk-generator/tree/0.22.0"
"source": "https://github.com/appwrite/sdk-generator/tree/0.23.0"
},
"time": "2022-09-01T10:48:13+00:00"
"time": "2022-09-04T17:29:33+00:00"
},
{
"name": "doctrine/instantiator",
@ -3202,16 +3202,16 @@
},
{
"name": "nikic/php-parser",
"version": "v4.14.0",
"version": "v4.15.1",
"source": {
"type": "git",
"url": "https://github.com/nikic/PHP-Parser.git",
"reference": "34bea19b6e03d8153165d8f30bba4c3be86184c1"
"reference": "0ef6c55a3f47f89d7a374e6f835197a0b5fcf900"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/34bea19b6e03d8153165d8f30bba4c3be86184c1",
"reference": "34bea19b6e03d8153165d8f30bba4c3be86184c1",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/0ef6c55a3f47f89d7a374e6f835197a0b5fcf900",
"reference": "0ef6c55a3f47f89d7a374e6f835197a0b5fcf900",
"shasum": ""
},
"require": {
@ -3252,9 +3252,9 @@
],
"support": {
"issues": "https://github.com/nikic/PHP-Parser/issues",
"source": "https://github.com/nikic/PHP-Parser/tree/v4.14.0"
"source": "https://github.com/nikic/PHP-Parser/tree/v4.15.1"
},
"time": "2022-05-31T20:59:12+00:00"
"time": "2022-09-04T07:30:47+00:00"
},
{
"name": "phar-io/manifest",

View file

@ -3,6 +3,7 @@ import android.os.Bundle
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
import io.appwrite.Client
import io.appwrite.models.InputFile
import io.appwrite.services.Storage
public class MainActivity extends AppCompatActivity {

View file

@ -3,6 +3,7 @@ import android.os.Bundle
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
import io.appwrite.Client
import io.appwrite.models.InputFile
import io.appwrite.services.Storage
class MainActivity : AppCompatActivity() {

View file

@ -1,7 +1,7 @@
appwrite functions create \
--functionId [FUNCTION_ID] \
--name [NAME] \
--execute one two three \
--execute "role:all" \
--runtime node-14.5 \

View file

@ -1,7 +1,7 @@
appwrite functions update \
--functionId [FUNCTION_ID] \
--name [NAME] \
--execute one two three \
--execute "role:all" \

View file

@ -9,7 +9,7 @@ client
.setProject('5df5acd0d48c2') // Your project ID
;
const promise = functions.create('[FUNCTION_ID]', '[NAME]', [], 'node-14.5');
const promise = functions.create('[FUNCTION_ID]', '[NAME]', ["role:all"], 'node-14.5');
promise.then(function (response) {
console.log(response); // Success

View file

@ -9,7 +9,7 @@ client
.setProject('5df5acd0d48c2') // Your project ID
;
const promise = functions.update('[FUNCTION_ID]', '[NAME]', []);
const promise = functions.update('[FUNCTION_ID]', '[NAME]', ["role:all"]);
promise.then(function (response) {
console.log(response); // Success

View file

@ -13,7 +13,7 @@ void main() { // Init SDK
Future result = functions.create(
functionId: '[FUNCTION_ID]',
name: '[NAME]',
execute: [],
execute: ["role:all"],
runtime: 'node-14.5',
);

View file

@ -13,7 +13,7 @@ void main() { // Init SDK
Future result = functions.update(
functionId: '[FUNCTION_ID]',
name: '[NAME]',
execute: [],
execute: ["role:all"],
);
result

View file

@ -12,7 +12,7 @@ client
;
let promise = functions.createDeployment('[FUNCTION_ID]', '[ENTRYPOINT]', 'file.png', false);
let promise = functions.createDeployment('[FUNCTION_ID]', '[ENTRYPOINT]', InputFile.fromPath('/path/to/file.png', 'file.png'), false);
promise.then(function (response) {
console.log(response);

View file

@ -12,7 +12,7 @@ client
;
let promise = functions.create('[FUNCTION_ID]', '[NAME]', [], 'node-14.5');
let promise = functions.create('[FUNCTION_ID]', '[NAME]', ["role:all"], 'node-14.5');
promise.then(function (response) {
console.log(response);

View file

@ -12,7 +12,7 @@ client
;
let promise = functions.update('[FUNCTION_ID]', '[NAME]', []);
let promise = functions.update('[FUNCTION_ID]', '[NAME]', ["role:all"]);
promise.then(function (response) {
console.log(response);

View file

@ -12,7 +12,7 @@ client
;
let promise = storage.createFile('[BUCKET_ID]', '[FILE_ID]', 'file.png');
let promise = storage.createFile('[BUCKET_ID]', '[FILE_ID]', InputFile.fromPath('/path/to/file.png', 'file.png'));
promise.then(function (response) {
console.log(response);

View file

@ -12,8 +12,8 @@ public void main() {
collectionId = "[COLLECTION_ID]",
name = "[NAME]",
permission = "document",
read = ["role:all"],
write = ["role:all"]
read = listOf("role:all"),
write = listOf("role:all")
new Continuation<Response>() {
@NotNull
@Override

View file

@ -1,4 +1,5 @@
import io.appwrite.Client
import io.appwrite.models.InputFile
import io.appwrite.services.Functions
public void main() {

View file

@ -11,7 +11,7 @@ public void main() {
functions.create(
functionId = "[FUNCTION_ID]",
name = "[NAME]",
execute = listOf(),
execute = listOf("role:all"),
runtime = "node-14.5",
new Continuation<Response>() {
@NotNull

View file

@ -11,7 +11,7 @@ public void main() {
functions.update(
functionId = "[FUNCTION_ID]",
name = "[NAME]",
execute = listOf(),
execute = listOf("role:all"),
new Continuation<Response>() {
@NotNull
@Override

View file

@ -1,4 +1,5 @@
import io.appwrite.Client
import io.appwrite.models.InputFile
import io.appwrite.services.Storage
public void main() {

View file

@ -12,8 +12,8 @@ suspend fun main() {
collectionId = "[COLLECTION_ID]",
name = "[NAME]",
permission = "document",
read = ["role:all"],
write = ["role:all"]
read = listOf("role:all"),
write = listOf("role:all")
)
val json = response.body?.string()
}

View file

@ -1,4 +1,5 @@
import io.appwrite.Client
import io.appwrite.models.InputFile
import io.appwrite.services.Functions
suspend fun main() {

View file

@ -11,7 +11,7 @@ suspend fun main() {
val response = functions.create(
functionId = "[FUNCTION_ID]",
name = "[NAME]",
execute = listOf(),
execute = listOf("role:all"),
runtime = "node-14.5",
)
val json = response.body?.string()

View file

@ -11,7 +11,7 @@ suspend fun main() {
val response = functions.update(
functionId = "[FUNCTION_ID]",
name = "[NAME]",
execute = listOf(),
execute = listOf("role:all"),
)
val json = response.body?.string()
}

View file

@ -1,4 +1,5 @@
import io.appwrite.Client
import io.appwrite.models.InputFile
import io.appwrite.services.Storage
suspend fun main() {

View file

@ -12,7 +12,7 @@ client
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
;
const promise = functions.createDeployment('[FUNCTION_ID]', '[ENTRYPOINT]', 'file.png', false);
const promise = functions.createDeployment('[FUNCTION_ID]', '[ENTRYPOINT]', InputFile.fromPath('/path/to/file.png', 'file.png'), false);
promise.then(function (response) {
console.log(response);

View file

@ -11,7 +11,7 @@ client
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
;
const promise = functions.create('[FUNCTION_ID]', '[NAME]', [], 'node-14.5');
const promise = functions.create('[FUNCTION_ID]', '[NAME]', ["role:all"], 'node-14.5');
promise.then(function (response) {
console.log(response);

View file

@ -11,7 +11,7 @@ client
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
;
const promise = functions.update('[FUNCTION_ID]', '[NAME]', []);
const promise = functions.update('[FUNCTION_ID]', '[NAME]', ["role:all"]);
promise.then(function (response) {
console.log(response);

View file

@ -12,7 +12,7 @@ client
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
;
const promise = storage.createFile('[BUCKET_ID]', '[FILE_ID]', 'file.png');
const promise = storage.createFile('[BUCKET_ID]', '[FILE_ID]', InputFile.fromPath('/path/to/file.png', 'file.png'));
promise.then(function (response) {
console.log(response);

View file

@ -1,6 +1,7 @@
<?php
use Appwrite\Client;
use Appwrite\InputFile;
use Appwrite\Services\Functions;
$client = new Client();
@ -13,4 +14,4 @@ $client
$functions = new Functions($client);
$result = $functions->createDeployment('[FUNCTION_ID]', '[ENTRYPOINT]', 'file.png', false);
$result = $functions->createDeployment('[FUNCTION_ID]', '[ENTRYPOINT]', InputFile::withPath('file.png'), false);

View file

@ -13,4 +13,4 @@ $client
$functions = new Functions($client);
$result = $functions->create('[FUNCTION_ID]', '[NAME]', [], 'node-14.5');
$result = $functions->create('[FUNCTION_ID]', '[NAME]', ["role:all"], 'node-14.5');

View file

@ -13,4 +13,4 @@ $client
$functions = new Functions($client);
$result = $functions->update('[FUNCTION_ID]', '[NAME]', []);
$result = $functions->update('[FUNCTION_ID]', '[NAME]', ["role:all"]);

View file

@ -1,6 +1,7 @@
<?php
use Appwrite\Client;
use Appwrite\InputFile;
use Appwrite\Services\Storage;
$client = new Client();
@ -13,4 +14,4 @@ $client
$storage = new Storage($client);
$result = $storage->createFile('[BUCKET_ID]', '[FILE_ID]', 'file.png');
$result = $storage->createFile('[BUCKET_ID]', '[FILE_ID]', InputFile::withPath('file.png'));

View file

@ -1,4 +1,5 @@
from appwrite.client import Client
from appwrite.input_file import InputFile
from appwrite.services.functions import Functions
client = Client()

View file

@ -11,4 +11,4 @@ client = Client()
functions = Functions(client)
result = functions.create('[FUNCTION_ID]', '[NAME]', [], 'node-14.5')
result = functions.create('[FUNCTION_ID]', '[NAME]', ["role:all"], 'node-14.5')

View file

@ -11,4 +11,4 @@ client = Client()
functions = Functions(client)
result = functions.update('[FUNCTION_ID]', '[NAME]', [])
result = functions.update('[FUNCTION_ID]', '[NAME]', ["role:all"])

View file

@ -1,4 +1,5 @@
from appwrite.client import Client
from appwrite.input_file import InputFile
from appwrite.services.storage import Storage
client = Client()

View file

@ -7,7 +7,7 @@ client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
databases = Appwrite::Databases.new(client, '[DATABASE_ID]')
databases = Appwrite::Databases.new(client, database_id:'[DATABASE_ID]')
response = databases.create_boolean_attribute(collection_id: '[COLLECTION_ID]', key: '', required: false)

View file

@ -7,7 +7,7 @@ client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
databases = Appwrite::Databases.new(client, '[DATABASE_ID]')
databases = Appwrite::Databases.new(client, database_id:'[DATABASE_ID]')
response = databases.create_collection(collection_id: '[COLLECTION_ID]', name: '[NAME]', permission: 'document', read: ["role:all"], write: ["role:all"])

View file

@ -7,7 +7,7 @@ client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
databases = Appwrite::Databases.new(client, '[DATABASE_ID]')
databases = Appwrite::Databases.new(client, database_id:'[DATABASE_ID]')
response = databases.create_document(collection_id: '[COLLECTION_ID]', document_id: '[DOCUMENT_ID]', data: {})

View file

@ -7,7 +7,7 @@ client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
databases = Appwrite::Databases.new(client, '[DATABASE_ID]')
databases = Appwrite::Databases.new(client, database_id:'[DATABASE_ID]')
response = databases.create_email_attribute(collection_id: '[COLLECTION_ID]', key: '', required: false)

View file

@ -7,7 +7,7 @@ client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
databases = Appwrite::Databases.new(client, '[DATABASE_ID]')
databases = Appwrite::Databases.new(client, database_id:'[DATABASE_ID]')
response = databases.create_enum_attribute(collection_id: '[COLLECTION_ID]', key: '', elements: [], required: false)

View file

@ -7,7 +7,7 @@ client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
databases = Appwrite::Databases.new(client, '[DATABASE_ID]')
databases = Appwrite::Databases.new(client, database_id:'[DATABASE_ID]')
response = databases.create_float_attribute(collection_id: '[COLLECTION_ID]', key: '', required: false)

View file

@ -7,7 +7,7 @@ client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
databases = Appwrite::Databases.new(client, '[DATABASE_ID]')
databases = Appwrite::Databases.new(client, database_id:'[DATABASE_ID]')
response = databases.create_index(collection_id: '[COLLECTION_ID]', key: '', type: 'key', attributes: [])

View file

@ -7,7 +7,7 @@ client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
databases = Appwrite::Databases.new(client, '[DATABASE_ID]')
databases = Appwrite::Databases.new(client, database_id:'[DATABASE_ID]')
response = databases.create_integer_attribute(collection_id: '[COLLECTION_ID]', key: '', required: false)

View file

@ -7,7 +7,7 @@ client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
databases = Appwrite::Databases.new(client, '[DATABASE_ID]')
databases = Appwrite::Databases.new(client, database_id:'[DATABASE_ID]')
response = databases.create_ip_attribute(collection_id: '[COLLECTION_ID]', key: '', required: false)

View file

@ -7,7 +7,7 @@ client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
databases = Appwrite::Databases.new(client, '[DATABASE_ID]')
databases = Appwrite::Databases.new(client, database_id:'[DATABASE_ID]')
response = databases.create_string_attribute(collection_id: '[COLLECTION_ID]', key: '', size: 1, required: false)

View file

@ -7,7 +7,7 @@ client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
databases = Appwrite::Databases.new(client, '[DATABASE_ID]')
databases = Appwrite::Databases.new(client, database_id:'[DATABASE_ID]')
response = databases.create_url_attribute(collection_id: '[COLLECTION_ID]', key: '', required: false)

View file

@ -7,7 +7,7 @@ client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
databases = Appwrite::Databases.new(client, '[DATABASE_ID]')
databases = Appwrite::Databases.new(client, database_id:'[DATABASE_ID]')
response = databases.create(name: '[NAME]')

View file

@ -7,7 +7,7 @@ client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
databases = Appwrite::Databases.new(client, '[DATABASE_ID]')
databases = Appwrite::Databases.new(client, database_id:'[DATABASE_ID]')
response = databases.delete_attribute(collection_id: '[COLLECTION_ID]', key: '')

View file

@ -7,7 +7,7 @@ client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
databases = Appwrite::Databases.new(client, '[DATABASE_ID]')
databases = Appwrite::Databases.new(client, database_id:'[DATABASE_ID]')
response = databases.delete_collection(collection_id: '[COLLECTION_ID]')

View file

@ -7,7 +7,7 @@ client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
databases = Appwrite::Databases.new(client, '[DATABASE_ID]')
databases = Appwrite::Databases.new(client, database_id:'[DATABASE_ID]')
response = databases.delete_document(collection_id: '[COLLECTION_ID]', document_id: '[DOCUMENT_ID]')

View file

@ -7,7 +7,7 @@ client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
databases = Appwrite::Databases.new(client, '[DATABASE_ID]')
databases = Appwrite::Databases.new(client, database_id:'[DATABASE_ID]')
response = databases.delete_index(collection_id: '[COLLECTION_ID]', key: '')

View file

@ -7,7 +7,7 @@ client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
databases = Appwrite::Databases.new(client, '[DATABASE_ID]')
databases = Appwrite::Databases.new(client, database_id:'[DATABASE_ID]')
response = databases.delete()

View file

@ -7,7 +7,7 @@ client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
databases = Appwrite::Databases.new(client, '[DATABASE_ID]')
databases = Appwrite::Databases.new(client, database_id:'[DATABASE_ID]')
response = databases.get_attribute(collection_id: '[COLLECTION_ID]', key: '')

View file

@ -7,7 +7,7 @@ client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
databases = Appwrite::Databases.new(client, '[DATABASE_ID]')
databases = Appwrite::Databases.new(client, database_id:'[DATABASE_ID]')
response = databases.get_collection(collection_id: '[COLLECTION_ID]')

View file

@ -7,7 +7,7 @@ client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
databases = Appwrite::Databases.new(client, '[DATABASE_ID]')
databases = Appwrite::Databases.new(client, database_id:'[DATABASE_ID]')
response = databases.get_document(collection_id: '[COLLECTION_ID]', document_id: '[DOCUMENT_ID]')

View file

@ -7,7 +7,7 @@ client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
databases = Appwrite::Databases.new(client, '[DATABASE_ID]')
databases = Appwrite::Databases.new(client, database_id:'[DATABASE_ID]')
response = databases.get_index(collection_id: '[COLLECTION_ID]', key: '')

View file

@ -7,7 +7,7 @@ client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
databases = Appwrite::Databases.new(client, '[DATABASE_ID]')
databases = Appwrite::Databases.new(client, database_id:'[DATABASE_ID]')
response = databases.get()

View file

@ -7,7 +7,7 @@ client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
databases = Appwrite::Databases.new(client, '[DATABASE_ID]')
databases = Appwrite::Databases.new(client, database_id:'[DATABASE_ID]')
response = databases.list_attributes(collection_id: '[COLLECTION_ID]')

View file

@ -7,7 +7,7 @@ client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
databases = Appwrite::Databases.new(client, '[DATABASE_ID]')
databases = Appwrite::Databases.new(client, database_id:'[DATABASE_ID]')
response = databases.list_collections()

View file

@ -7,7 +7,7 @@ client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
databases = Appwrite::Databases.new(client, '[DATABASE_ID]')
databases = Appwrite::Databases.new(client, database_id:'[DATABASE_ID]')
response = databases.list_documents(collection_id: '[COLLECTION_ID]')

View file

@ -7,7 +7,7 @@ client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
databases = Appwrite::Databases.new(client, '[DATABASE_ID]')
databases = Appwrite::Databases.new(client, database_id:'[DATABASE_ID]')
response = databases.list_indexes(collection_id: '[COLLECTION_ID]')

View file

@ -7,7 +7,7 @@ client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
databases = Appwrite::Databases.new(client, '[DATABASE_ID]')
databases = Appwrite::Databases.new(client, database_id:'[DATABASE_ID]')
response = databases.list()

View file

@ -7,7 +7,7 @@ client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
databases = Appwrite::Databases.new(client, '[DATABASE_ID]')
databases = Appwrite::Databases.new(client, database_id:'[DATABASE_ID]')
response = databases.update_collection(collection_id: '[COLLECTION_ID]', name: '[NAME]', permission: 'document')

View file

@ -7,7 +7,7 @@ client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
databases = Appwrite::Databases.new(client, '[DATABASE_ID]')
databases = Appwrite::Databases.new(client, database_id:'[DATABASE_ID]')
response = databases.update_document(collection_id: '[COLLECTION_ID]', document_id: '[DOCUMENT_ID]')

View file

@ -7,7 +7,7 @@ client
.set_project('5df5acd0d48c2') # Your project ID
.set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
databases = Appwrite::Databases.new(client, '[DATABASE_ID]')
databases = Appwrite::Databases.new(client, database_id:'[DATABASE_ID]')
response = databases.update(name: '[NAME]')

View file

@ -9,6 +9,6 @@ client
functions = Appwrite::Functions.new(client)
response = functions.create_deployment(function_id: '[FUNCTION_ID]', entrypoint: '[ENTRYPOINT]', code: InputFile.fromPath('dir/file.png'), activate: false)
response = functions.create_deployment(function_id: '[FUNCTION_ID]', entrypoint: '[ENTRYPOINT]', code: Appwrite::InputFile.from_path('dir/file.png'), activate: false)
puts response.inspect

View file

@ -9,6 +9,6 @@ client
functions = Appwrite::Functions.new(client)
response = functions.create(function_id: '[FUNCTION_ID]', name: '[NAME]', execute: [], runtime: 'node-14.5')
response = functions.create(function_id: '[FUNCTION_ID]', name: '[NAME]', execute: ["role:all"], runtime: 'node-14.5')
puts response.inspect

View file

@ -9,6 +9,6 @@ client
functions = Appwrite::Functions.new(client)
response = functions.update(function_id: '[FUNCTION_ID]', name: '[NAME]', execute: [])
response = functions.update(function_id: '[FUNCTION_ID]', name: '[NAME]', execute: ["role:all"])
puts response.inspect

View file

@ -1,6 +1,7 @@
require 'appwrite'
client = Appwrite::Client.new
InputFile = Appwrite::InputFile
client
.set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
@ -9,6 +10,6 @@ client
storage = Appwrite::Storage.new(client)
response = storage.create_file(bucket_id: '[BUCKET_ID]', file_id: '[FILE_ID]', file: InputFile.fromPath('dir/file.png'))
response = storage.create_file(bucket_id: '[BUCKET_ID]', file_id: '[FILE_ID]', file: Appwrite::InputFile.from_path('dir/file.png'))
puts response.inspect

View file

@ -9,7 +9,7 @@ func main() async throws {
let function = try await functions.create(
functionId: "[FUNCTION_ID]",
name: "[NAME]",
execute: [],
execute: ["role:all"],
runtime: "node-14.5"
)

View file

@ -6,10 +6,10 @@ func main() async throws {
.setProject("5df5acd0d48c2") // Your project ID
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
let functions = Functions(client)
let deploymentList = try await functions.getDeployment(
let deployment = try await functions.getDeployment(
functionId: "[FUNCTION_ID]",
deploymentId: "[DEPLOYMENT_ID]"
)
print(String(describing: deploymentList)
print(String(describing: deployment)
}

View file

@ -9,7 +9,7 @@ func main() async throws {
let function = try await functions.update(
functionId: "[FUNCTION_ID]",
name: "[NAME]",
execute: []
execute: ["role:all"]
)
print(String(describing: function)

View file

@ -0,0 +1,49 @@
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
import io.appwrite.Client
import io.appwrite.services.Account
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Client client = new Client(getApplicationContext())
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
.setProject("5df5acd0d48c2"); // Your project ID
Account account = new Account(client);
account.createSession(
"email@example.com",
"password"
new Continuation<Object>() {
@NotNull
@Override
public CoroutineContext getContext() {
return EmptyCoroutineContext.INSTANCE;
}
@Override
public void resumeWith(@NotNull Object o) {
String json = "";
try {
if (o instanceof Result.Failure) {
Result.Failure failure = (Result.Failure) o;
throw failure.exception;
} else {
Response response = (Response) o;
json = response.body().string();
}
} catch (Throwable th) {
Log.e("ERROR", th.toString());
}
}
}
);
}
}

View file

@ -0,0 +1,50 @@
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
import io.appwrite.Client
import io.appwrite.services.Database
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Client client = new Client(getApplicationContext())
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
.setProject("5df5acd0d48c2"); // Your project ID
Database database = new Database(client);
database.createDocument(
"[COLLECTION_ID]",
"[DOCUMENT_ID]",
mapOf( "a" to "b" ),
new Continuation<Object>() {
@NotNull
@Override
public CoroutineContext getContext() {
return EmptyCoroutineContext.INSTANCE;
}
@Override
public void resumeWith(@NotNull Object o) {
String json = "";
try {
if (o instanceof Result.Failure) {
Result.Failure failure = (Result.Failure) o;
throw failure.exception;
} else {
Response response = (Response) o;
json = response.body().string();
}
} catch (Throwable th) {
Log.e("ERROR", th.toString());
}
}
}
);
}
}

View file

@ -0,0 +1,49 @@
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
import io.appwrite.Client
import io.appwrite.services.Database
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Client client = new Client(getApplicationContext())
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
.setProject("5df5acd0d48c2"); // Your project ID
Database database = new Database(client);
database.deleteDocument(
"[COLLECTION_ID]",
"[DOCUMENT_ID]"
new Continuation<Object>() {
@NotNull
@Override
public CoroutineContext getContext() {
return EmptyCoroutineContext.INSTANCE;
}
@Override
public void resumeWith(@NotNull Object o) {
String json = "";
try {
if (o instanceof Result.Failure) {
Result.Failure failure = (Result.Failure) o;
throw failure.exception;
} else {
Response response = (Response) o;
json = response.body().string();
}
} catch (Throwable th) {
Log.e("ERROR", th.toString());
}
}
}
);
}
}

View file

@ -0,0 +1,49 @@
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
import io.appwrite.Client
import io.appwrite.services.Database
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Client client = new Client(getApplicationContext())
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
.setProject("5df5acd0d48c2"); // Your project ID
Database database = new Database(client);
database.getDocument(
"[COLLECTION_ID]",
"[DOCUMENT_ID]"
new Continuation<Object>() {
@NotNull
@Override
public CoroutineContext getContext() {
return EmptyCoroutineContext.INSTANCE;
}
@Override
public void resumeWith(@NotNull Object o) {
String json = "";
try {
if (o instanceof Result.Failure) {
Result.Failure failure = (Result.Failure) o;
throw failure.exception;
} else {
Response response = (Response) o;
json = response.body().string();
}
} catch (Throwable th) {
Log.e("ERROR", th.toString());
}
}
}
);
}
}

Some files were not shown because too many files have changed in this diff Show more