chore: update sdks
This commit is contained in:
parent
a50b7fcbf4
commit
4248cec43d
|
@ -30,38 +30,38 @@ $cli
|
||||||
$production = ($git) ? (Console::confirm('Type "Appwrite" to push code to production git repos') == 'Appwrite') : false;
|
$production = ($git) ? (Console::confirm('Type "Appwrite" to push code to production git repos') == 'Appwrite') : false;
|
||||||
$message = ($git) ? Console::confirm('Please enter your commit message:') : '';
|
$message = ($git) ? Console::confirm('Please enter your commit message:') : '';
|
||||||
|
|
||||||
if(!in_array($version, ['0.6.x', '0.7.x', '0.8.x', '0.9.x', '0.10.x', '0.11.x', '0.12.x'])) {
|
if (!in_array($version, ['0.6.x', '0.7.x', '0.8.x', '0.9.x', '0.10.x', '0.11.x', '0.12.x', 'latest'])) {
|
||||||
throw new Exception('Unknown version given');
|
throw new Exception('Unknown version given');
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($platforms as $key => $platform) {
|
foreach ($platforms as $key => $platform) {
|
||||||
foreach($platform['languages'] as $language) {
|
foreach ($platform['languages'] as $language) {
|
||||||
if($selected !== $language['key'] && $selected !== '*') {
|
if ($selected !== $language['key'] && $selected !== '*') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$language['enabled']) {
|
if (!$language['enabled']) {
|
||||||
Console::warning($language['name'].' for '.$platform['name'] . ' is disabled');
|
Console::warning($language['name'] . ' for ' . $platform['name'] . ' is disabled');
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Console::info('Fetching API Spec for '.$language['name'].' for '.$platform['name'] . ' (version: '.$version.')');
|
Console::info('Fetching API Spec for ' . $language['name'] . ' for ' . $platform['name'] . ' (version: ' . $version . ')');
|
||||||
|
|
||||||
$spec = file_get_contents(__DIR__.'/../config/specs/swagger2-'.$version.'.'.$language['family'].'.json');
|
$spec = file_get_contents(__DIR__ . '/../config/specs/swagger2-' . $version . '-' . $language['family'] . '.json');
|
||||||
|
|
||||||
$cover = 'https://appwrite.io/images/github.png';
|
$cover = 'https://appwrite.io/images/github.png';
|
||||||
$result = \realpath(__DIR__.'/..').'/sdks/'.$key.'-'.$language['key'];
|
$result = \realpath(__DIR__ . '/..') . '/sdks/' . $key . '-' . $language['key'];
|
||||||
$resultExamples = \realpath(__DIR__.'/../..').'/docs/examples/'.$version.'/'.$key.'-'.$language['key'];
|
$resultExamples = \realpath(__DIR__ . '/../..') . '/docs/examples/' . $version . '/' . $key . '-' . $language['key'];
|
||||||
$target = \realpath(__DIR__.'/..').'/sdks/git/'.$language['key'].'/';
|
$target = \realpath(__DIR__ . '/..') . '/sdks/git/' . $language['key'] . '/';
|
||||||
$readme = \realpath(__DIR__ . '/../../docs/sdks/'.$language['key'].'/README.md');
|
$readme = \realpath(__DIR__ . '/../../docs/sdks/' . $language['key'] . '/README.md');
|
||||||
$readme = ($readme) ? \file_get_contents($readme) : '';
|
$readme = ($readme) ? \file_get_contents($readme) : '';
|
||||||
$gettingStarted = \realpath(__DIR__ . '/../../docs/sdks/'.$language['key'].'/GETTING_STARTED.md');
|
$gettingStarted = \realpath(__DIR__ . '/../../docs/sdks/' . $language['key'] . '/GETTING_STARTED.md');
|
||||||
$gettingStarted = ($gettingStarted) ? \file_get_contents($gettingStarted) : '';
|
$gettingStarted = ($gettingStarted) ? \file_get_contents($gettingStarted) : '';
|
||||||
$examples = \realpath(__DIR__ . '/../../docs/sdks/'.$language['key'].'/EXAMPLES.md');
|
$examples = \realpath(__DIR__ . '/../../docs/sdks/' . $language['key'] . '/EXAMPLES.md');
|
||||||
$examples = ($examples) ? \file_get_contents($examples) : '';
|
$examples = ($examples) ? \file_get_contents($examples) : '';
|
||||||
$changelog = \realpath(__DIR__ . '/../../docs/sdks/'.$language['key'].'/CHANGELOG.md');
|
$changelog = \realpath(__DIR__ . '/../../docs/sdks/' . $language['key'] . '/CHANGELOG.md');
|
||||||
$changelog = ($changelog) ? \file_get_contents($changelog) : '# Change Log';
|
$changelog = ($changelog) ? \file_get_contents($changelog) : '# Change Log';
|
||||||
$warning = '**This SDK is compatible with Appwrite server version ' . $version . '. For older versions, please check [previous releases]('.$language['url'].'/releases).**';
|
$warning = '**This SDK is compatible with Appwrite server version ' . $version . '. For older versions, please check [previous releases](' . $language['url'] . '/releases).**';
|
||||||
$license = 'BSD-3-Clause';
|
$license = 'BSD-3-Clause';
|
||||||
$licenseContent = 'Copyright (c) ' . date('Y') . ' Appwrite (https://appwrite.io) and individual contributors.
|
$licenseContent = 'Copyright (c) ' . date('Y') . ' Appwrite (https://appwrite.io) and individual contributors.
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
@ -105,7 +105,7 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
$config = new Node();
|
$config = new Node();
|
||||||
$config->setNPMPackage('node-appwrite');
|
$config->setNPMPackage('node-appwrite');
|
||||||
$config->setBowerPackage('appwrite');
|
$config->setBowerPackage('appwrite');
|
||||||
$warning = $warning."\n\n > This is the Node.js SDK for integrating with Appwrite from your Node.js server-side code.
|
$warning = $warning . "\n\n > This is the Node.js SDK for integrating with Appwrite from your Node.js server-side code.
|
||||||
If you're looking to integrate from the browser, you should check [appwrite/sdk-for-web](https://github.com/appwrite/sdk-for-web)";
|
If you're looking to integrate from the browser, you should check [appwrite/sdk-for-web](https://github.com/appwrite/sdk-for-web)";
|
||||||
break;
|
break;
|
||||||
case 'deno':
|
case 'deno':
|
||||||
|
@ -115,7 +115,7 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
$config = new Python();
|
$config = new Python();
|
||||||
$config->setPipPackage('appwrite');
|
$config->setPipPackage('appwrite');
|
||||||
$license = 'BSD License'; // license edited due to classifiers in pypi
|
$license = 'BSD License'; // license edited due to classifiers in pypi
|
||||||
break;
|
break;
|
||||||
case 'ruby':
|
case 'ruby':
|
||||||
$config = new Ruby();
|
$config = new Ruby();
|
||||||
$config->setGemPackage('appwrite');
|
$config->setGemPackage('appwrite');
|
||||||
|
@ -131,14 +131,14 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
case 'dart':
|
case 'dart':
|
||||||
$config = new Dart();
|
$config = new Dart();
|
||||||
$config->setPackageName('dart_appwrite');
|
$config->setPackageName('dart_appwrite');
|
||||||
$warning = $warning."\n\n > This is the Dart SDK for integrating with Appwrite from your Dart server-side code. If you're looking for the Flutter SDK you should check [appwrite/sdk-for-flutter](https://github.com/appwrite/sdk-for-flutter)";
|
$warning = $warning . "\n\n > This is the Dart SDK for integrating with Appwrite from your Dart server-side code. If you're looking for the Flutter SDK you should check [appwrite/sdk-for-flutter](https://github.com/appwrite/sdk-for-flutter)";
|
||||||
break;
|
break;
|
||||||
case 'go':
|
case 'go':
|
||||||
$config = new Go();
|
$config = new Go();
|
||||||
break;
|
break;
|
||||||
case 'swift':
|
case 'swift':
|
||||||
$config = new Swift();
|
$config = new Swift();
|
||||||
$warning = $warning."\n\n > This is the Swift SDK for integrating with Appwrite from your Swift server-side code. If you're looking for the Apple SDK you should check [appwrite/sdk-for-apple](https://github.com/appwrite/sdk-for-apple)";
|
$warning = $warning . "\n\n > This is the Swift SDK for integrating with Appwrite from your Swift server-side code. If you're looking for the Apple SDK you should check [appwrite/sdk-for-apple](https://github.com/appwrite/sdk-for-apple)";
|
||||||
break;
|
break;
|
||||||
case 'apple':
|
case 'apple':
|
||||||
$config = new SwiftClient();
|
$config = new SwiftClient();
|
||||||
|
@ -152,10 +152,10 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
break;
|
break;
|
||||||
case 'kotlin':
|
case 'kotlin':
|
||||||
$config = new Kotlin();
|
$config = new Kotlin();
|
||||||
$warning = $warning."\n\n > This is the Kotlin SDK for integrating with Appwrite from your Kotlin server-side code. If you're looking for the Android SDK you should check [appwrite/sdk-for-android](https://github.com/appwrite/sdk-for-android)";
|
$warning = $warning . "\n\n > This is the Kotlin SDK for integrating with Appwrite from your Kotlin server-side code. If you're looking for the Android SDK you should check [appwrite/sdk-for-android](https://github.com/appwrite/sdk-for-android)";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new Exception('Language "'.$language['key'].'" not supported');
|
throw new Exception('Language "' . $language['key'] . '" not supported');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,10 +189,9 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
->setTwitter(APP_SOCIAL_TWITTER_HANDLE)
|
->setTwitter(APP_SOCIAL_TWITTER_HANDLE)
|
||||||
->setDiscord(APP_SOCIAL_DISCORD_CHANNEL, APP_SOCIAL_DISCORD)
|
->setDiscord(APP_SOCIAL_DISCORD_CHANNEL, APP_SOCIAL_DISCORD)
|
||||||
->setDefaultHeaders([
|
->setDefaultHeaders([
|
||||||
'X-Appwrite-Response-Format' => '0.11.0',
|
'X-Appwrite-Response-Format' => '0.12.0',
|
||||||
])
|
]);
|
||||||
;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$sdk->generate($result);
|
$sdk->generate($result);
|
||||||
} catch (Exception $exception) {
|
} catch (Exception $exception) {
|
||||||
|
@ -204,38 +203,43 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
$gitUrl = $language['gitUrl'];
|
$gitUrl = $language['gitUrl'];
|
||||||
$gitBranch = $language['gitBranch'];
|
$gitBranch = $language['gitBranch'];
|
||||||
|
|
||||||
|
|
||||||
if(!$production) {
|
if (!$production) {
|
||||||
$gitUrl = 'git@github.com:aw-tests/'.$language['gitRepoName'].'.git';
|
$gitUrl = 'git@github.com:aw-tests/' . $language['gitRepoName'] . '.git';
|
||||||
}
|
}
|
||||||
|
|
||||||
if($git && !empty($gitUrl)) {
|
if ($git && !empty($gitUrl)) {
|
||||||
\exec('rm -rf '.$target.' && \
|
\exec('rm -rf ' . $target . ' && \
|
||||||
mkdir -p '.$target.' && \
|
mkdir -p ' . $target . ' && \
|
||||||
cd '.$target.' && \
|
cd ' . $target . ' && \
|
||||||
git init --initial-branch='.$gitBranch.' && \
|
git init --initial-branch=' . $gitBranch . ' && \
|
||||||
git remote add origin '.$gitUrl.' && \
|
git remote add origin ' . $gitUrl . ' && \
|
||||||
git fetch && \
|
git fetch && \
|
||||||
git pull '.$gitUrl.' && \
|
git pull ' . $gitUrl . ' && \
|
||||||
rm -rf '.$target.'/* && \
|
rm -rf ' . $target . '/* && \
|
||||||
cp -r '.$result.'/ '.$target.'/ && \
|
cp -r ' . $result . '/ ' . $target . '/ && \
|
||||||
git add . && \
|
git add . && \
|
||||||
git commit -m "'.$message.'" && \
|
git commit -m "' . $message . '" && \
|
||||||
git push -u origin '.$gitBranch.'
|
git push -u origin ' . $gitBranch . '
|
||||||
');
|
');
|
||||||
|
|
||||||
Console::success("Pushed {$language['name']} SDK to {$gitUrl}");
|
Console::success("Pushed {$language['name']} SDK to {$gitUrl}");
|
||||||
|
|
||||||
\exec('rm -rf '.$target);
|
\exec('rm -rf ' . $target);
|
||||||
Console::success("Remove temp directory '{$target}' for {$language['name']} SDK");
|
Console::success("Remove temp directory '{$target}' for {$language['name']} SDK");
|
||||||
}
|
}
|
||||||
|
|
||||||
$docDirectories = $language['docDirectories'] ?? [''];
|
$docDirectories = $language['docDirectories'] ?? [''];
|
||||||
|
|
||||||
|
if($version === 'latest') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($docDirectories as $languageTitle => $path) {
|
foreach ($docDirectories as $languageTitle => $path) {
|
||||||
$languagePath = strtolower($languageTitle !== 0 ? '/'.$languageTitle : '');
|
$languagePath = strtolower($languageTitle !== 0 ? '/' . $languageTitle : '');
|
||||||
\exec(
|
\exec(
|
||||||
'mkdir -p '.$resultExamples.$languagePath.' && \
|
'mkdir -p ' . $resultExamples . $languagePath . ' && \
|
||||||
cp -r '.$result.'/docs/examples'.$languagePath.' '.$resultExamples
|
cp -r ' . $result . '/docs/examples' . $languagePath . ' ' . $resultExamples
|
||||||
);
|
);
|
||||||
Console::success("Copied code examples for {$language['name']} SDK to: {$resultExamples}");
|
Console::success("Copied code examples for {$language['name']} SDK to: {$resultExamples}");
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
class Appwrite {
|
class Appwrite {
|
||||||
constructor() {
|
constructor() {
|
||||||
this.config = {
|
this.config = {
|
||||||
endpoint: 'https://appwrite.io/v1',
|
endpoint: 'https://HOSTNAME/v1',
|
||||||
endpointRealtime: '',
|
endpointRealtime: '',
|
||||||
project: '',
|
project: '',
|
||||||
key: '',
|
key: '',
|
||||||
|
@ -48,7 +48,7 @@
|
||||||
};
|
};
|
||||||
this.headers = {
|
this.headers = {
|
||||||
'x-sdk-version': 'appwrite:web:4.0.4',
|
'x-sdk-version': 'appwrite:web:4.0.4',
|
||||||
'X-Appwrite-Response-Format': '0.11.0',
|
'X-Appwrite-Response-Format': '0.12.0',
|
||||||
};
|
};
|
||||||
this.realtime = {
|
this.realtime = {
|
||||||
socket: undefined,
|
socket: undefined,
|
||||||
|
@ -2647,14 +2647,14 @@
|
||||||
}, payload);
|
}, payload);
|
||||||
}),
|
}),
|
||||||
/**
|
/**
|
||||||
* Get Anti virus
|
* Get Antivirus
|
||||||
*
|
*
|
||||||
* Check the Appwrite Anti Virus server is up and connection is successful.
|
* Check the Appwrite Antivirus server is up and connection is successful.
|
||||||
*
|
*
|
||||||
* @throws {AppwriteException}
|
* @throws {AppwriteException}
|
||||||
* @returns {Promise}
|
* @returns {Promise}
|
||||||
*/
|
*/
|
||||||
getAntiVirus: () => __awaiter(this, void 0, void 0, function* () {
|
getAntivirus: () => __awaiter(this, void 0, void 0, function* () {
|
||||||
let path = '/health/anti-virus';
|
let path = '/health/anti-virus';
|
||||||
let payload = {};
|
let payload = {};
|
||||||
const uri = new URL(this.config.endpoint + path);
|
const uri = new URL(this.config.endpoint + path);
|
||||||
|
@ -4214,10 +4214,11 @@
|
||||||
/**
|
/**
|
||||||
* List Teams
|
* List Teams
|
||||||
*
|
*
|
||||||
* Get a list of all the current user teams. You can use the query params to
|
* Get a list of all the teams in which the current user is a member. You can
|
||||||
* filter your results. On admin mode, this endpoint will return a list of all
|
* use the parameters to filter your results.
|
||||||
* of the project's teams. [Learn more about different API
|
*
|
||||||
* modes](/docs/admin).
|
* In admin mode, this endpoint returns a list of all the teams in the current
|
||||||
|
* project. [Learn more about different API modes](/docs/admin).
|
||||||
*
|
*
|
||||||
* @param {string} search
|
* @param {string} search
|
||||||
* @param {number} limit
|
* @param {number} limit
|
||||||
|
@ -4258,9 +4259,8 @@
|
||||||
* Create Team
|
* Create Team
|
||||||
*
|
*
|
||||||
* Create a new team. The user who creates the team will automatically be
|
* Create a new team. The user who creates the team will automatically be
|
||||||
* assigned as the owner of the team. The team owner can invite new members,
|
* assigned as the owner of the team. Only the users with the owner role can
|
||||||
* who will be able add new owners and update or delete the team from your
|
* invite new members, add new owners and delete or update the team.
|
||||||
* project.
|
|
||||||
*
|
*
|
||||||
* @param {string} teamId
|
* @param {string} teamId
|
||||||
* @param {string} name
|
* @param {string} name
|
||||||
|
@ -4294,8 +4294,7 @@
|
||||||
/**
|
/**
|
||||||
* Get Team
|
* Get Team
|
||||||
*
|
*
|
||||||
* Get a team by its unique ID. All team members have read access for this
|
* Get a team by its ID. All team members have read access for this resource.
|
||||||
* resource.
|
|
||||||
*
|
*
|
||||||
* @param {string} teamId
|
* @param {string} teamId
|
||||||
* @throws {AppwriteException}
|
* @throws {AppwriteException}
|
||||||
|
@ -4315,8 +4314,8 @@
|
||||||
/**
|
/**
|
||||||
* Update Team
|
* Update Team
|
||||||
*
|
*
|
||||||
* Update a team by its unique ID. Only team owners have write access for this
|
* Update a team using its ID. Only members with the owner role can update the
|
||||||
* resource.
|
* team.
|
||||||
*
|
*
|
||||||
* @param {string} teamId
|
* @param {string} teamId
|
||||||
* @param {string} name
|
* @param {string} name
|
||||||
|
@ -4343,8 +4342,8 @@
|
||||||
/**
|
/**
|
||||||
* Delete Team
|
* Delete Team
|
||||||
*
|
*
|
||||||
* Delete a team by its unique ID. Only team owners have write access for this
|
* Delete a team using its ID. Only team members with the owner role can
|
||||||
* resource.
|
* delete the team.
|
||||||
*
|
*
|
||||||
* @param {string} teamId
|
* @param {string} teamId
|
||||||
* @throws {AppwriteException}
|
* @throws {AppwriteException}
|
||||||
|
@ -4364,8 +4363,8 @@
|
||||||
/**
|
/**
|
||||||
* Get Team Memberships
|
* Get Team Memberships
|
||||||
*
|
*
|
||||||
* Get a team members by the team unique ID. All team members have read access
|
* Use this endpoint to list a team's members using the team's ID. All team
|
||||||
* for this list of resources.
|
* members have read access to this endpoint.
|
||||||
*
|
*
|
||||||
* @param {string} teamId
|
* @param {string} teamId
|
||||||
* @param {string} search
|
* @param {string} search
|
||||||
|
@ -4409,22 +4408,21 @@
|
||||||
/**
|
/**
|
||||||
* Create Team Membership
|
* Create Team Membership
|
||||||
*
|
*
|
||||||
* Use this endpoint to invite a new member to join your team. If initiated
|
* Invite a new member to join your team. If initiated from the client SDK, an
|
||||||
* from Client SDK, an email with a link to join the team will be sent to the
|
* email with a link to join the team will be sent to the member's email
|
||||||
* new member's email address if the member doesn't exist in the project it
|
* address and an account will be created for them should they not be signed
|
||||||
* will be created automatically. If initiated from server side SDKs, new
|
* up already. If initiated from server-side SDKs, the new member will
|
||||||
* member will automatically be added to the team.
|
* automatically be added to the team.
|
||||||
*
|
*
|
||||||
* Use the 'URL' parameter to redirect the user from the invitation email back
|
* Use the 'url' parameter to redirect the user from the invitation email back
|
||||||
* to your app. When the user is redirected, use the [Update Team Membership
|
* to your app. When the user is redirected, use the [Update Team Membership
|
||||||
* Status](/docs/client/teams#teamsUpdateMembershipStatus) endpoint to allow
|
* Status](/docs/client/teams#teamsUpdateMembershipStatus) endpoint to allow
|
||||||
* the user to accept the invitation to the team. While calling from side
|
* the user to accept the invitation to the team.
|
||||||
* SDKs the redirect url can be empty string.
|
|
||||||
*
|
*
|
||||||
* Please note that in order to avoid a [Redirect
|
* Please note that to avoid a [Redirect
|
||||||
* Attacks](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md)
|
* Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md)
|
||||||
* the only valid redirect URL's are the once from domains you have set when
|
* the only valid redirect URL's are the once from domains you have set when
|
||||||
* added your platforms in the console interface.
|
* adding your platforms in the console interface.
|
||||||
*
|
*
|
||||||
* @param {string} teamId
|
* @param {string} teamId
|
||||||
* @param {string} email
|
* @param {string} email
|
||||||
|
@ -4494,6 +4492,9 @@
|
||||||
/**
|
/**
|
||||||
* Update Membership Roles
|
* Update Membership Roles
|
||||||
*
|
*
|
||||||
|
* Modify the roles of a team member. Only team members with the owner role
|
||||||
|
* have access to this endpoint. Learn more about [roles and
|
||||||
|
* permissions](/docs/permissions).
|
||||||
*
|
*
|
||||||
* @param {string} teamId
|
* @param {string} teamId
|
||||||
* @param {string} membershipId
|
* @param {string} membershipId
|
||||||
|
|
Loading…
Reference in a new issue