1
0
Fork 0
mirror of synced 2024-05-16 10:42:34 +12:00

chore: update sdks

This commit is contained in:
Torsten Dittmann 2022-01-03 10:41:47 +01:00
parent a50b7fcbf4
commit 4248cec43d
2 changed files with 82 additions and 77 deletions

View file

@ -30,38 +30,38 @@ $cli
$production = ($git) ? (Console::confirm('Type "Appwrite" to push code to production git repos') == 'Appwrite') : false;
$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');
}
foreach($platforms as $key => $platform) {
foreach($platform['languages'] as $language) {
if($selected !== $language['key'] && $selected !== '*') {
foreach ($platforms as $key => $platform) {
foreach ($platform['languages'] as $language) {
if ($selected !== $language['key'] && $selected !== '*') {
continue;
}
if(!$language['enabled']) {
Console::warning($language['name'].' for '.$platform['name'] . ' is disabled');
if (!$language['enabled']) {
Console::warning($language['name'] . ' for ' . $platform['name'] . ' is disabled');
continue;
}
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');
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');
$cover = 'https://appwrite.io/images/github.png';
$result = \realpath(__DIR__.'/..').'/sdks/'.$key.'-'.$language['key'];
$resultExamples = \realpath(__DIR__.'/../..').'/docs/examples/'.$version.'/'.$key.'-'.$language['key'];
$target = \realpath(__DIR__.'/..').'/sdks/git/'.$language['key'].'/';
$readme = \realpath(__DIR__ . '/../../docs/sdks/'.$language['key'].'/README.md');
$result = \realpath(__DIR__ . '/..') . '/sdks/' . $key . '-' . $language['key'];
$resultExamples = \realpath(__DIR__ . '/../..') . '/docs/examples/' . $version . '/' . $key . '-' . $language['key'];
$target = \realpath(__DIR__ . '/..') . '/sdks/git/' . $language['key'] . '/';
$readme = \realpath(__DIR__ . '/../../docs/sdks/' . $language['key'] . '/README.md');
$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) : '';
$examples = \realpath(__DIR__ . '/../../docs/sdks/'.$language['key'].'/EXAMPLES.md');
$examples = \realpath(__DIR__ . '/../../docs/sdks/' . $language['key'] . '/EXAMPLES.md');
$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';
$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';
$licenseContent = 'Copyright (c) ' . date('Y') . ' Appwrite (https://appwrite.io) and individual contributors.
All rights reserved.
@ -105,7 +105,7 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
$config = new Node();
$config->setNPMPackage('node-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)";
break;
case 'deno':
@ -115,7 +115,7 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
$config = new Python();
$config->setPipPackage('appwrite');
$license = 'BSD License'; // license edited due to classifiers in pypi
break;
break;
case 'ruby':
$config = new Ruby();
$config->setGemPackage('appwrite');
@ -131,14 +131,14 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
case 'dart':
$config = new Dart();
$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;
case 'go':
$config = new Go();
break;
case '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;
case 'apple':
$config = new SwiftClient();
@ -152,10 +152,10 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
break;
case '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;
default:
throw new Exception('Language "'.$language['key'].'" not supported');
throw new Exception('Language "' . $language['key'] . '" not supported');
break;
}
@ -189,10 +189,9 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
->setTwitter(APP_SOCIAL_TWITTER_HANDLE)
->setDiscord(APP_SOCIAL_DISCORD_CHANNEL, APP_SOCIAL_DISCORD)
->setDefaultHeaders([
'X-Appwrite-Response-Format' => '0.11.0',
])
;
'X-Appwrite-Response-Format' => '0.12.0',
]);
try {
$sdk->generate($result);
} catch (Exception $exception) {
@ -204,38 +203,43 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
$gitUrl = $language['gitUrl'];
$gitBranch = $language['gitBranch'];
if(!$production) {
$gitUrl = 'git@github.com:aw-tests/'.$language['gitRepoName'].'.git';
if (!$production) {
$gitUrl = 'git@github.com:aw-tests/' . $language['gitRepoName'] . '.git';
}
if($git && !empty($gitUrl)) {
\exec('rm -rf '.$target.' && \
mkdir -p '.$target.' && \
cd '.$target.' && \
git init --initial-branch='.$gitBranch.' && \
git remote add origin '.$gitUrl.' && \
if ($git && !empty($gitUrl)) {
\exec('rm -rf ' . $target . ' && \
mkdir -p ' . $target . ' && \
cd ' . $target . ' && \
git init --initial-branch=' . $gitBranch . ' && \
git remote add origin ' . $gitUrl . ' && \
git fetch && \
git pull '.$gitUrl.' && \
rm -rf '.$target.'/* && \
cp -r '.$result.'/ '.$target.'/ && \
git pull ' . $gitUrl . ' && \
rm -rf ' . $target . '/* && \
cp -r ' . $result . '/ ' . $target . '/ && \
git add . && \
git commit -m "'.$message.'" && \
git push -u origin '.$gitBranch.'
git commit -m "' . $message . '" && \
git push -u origin ' . $gitBranch . '
');
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");
}
$docDirectories = $language['docDirectories'] ?? [''];
if($version === 'latest') {
continue;
}
foreach ($docDirectories as $languageTitle => $path) {
$languagePath = strtolower($languageTitle !== 0 ? '/'.$languageTitle : '');
$languagePath = strtolower($languageTitle !== 0 ? '/' . $languageTitle : '');
\exec(
'mkdir -p '.$resultExamples.$languagePath.' && \
cp -r '.$result.'/docs/examples'.$languagePath.' '.$resultExamples
'mkdir -p ' . $resultExamples . $languagePath . ' && \
cp -r ' . $result . '/docs/examples' . $languagePath . ' ' . $resultExamples
);
Console::success("Copied code examples for {$language['name']} SDK to: {$resultExamples}");
}

View file

@ -38,7 +38,7 @@
class Appwrite {
constructor() {
this.config = {
endpoint: 'https://appwrite.io/v1',
endpoint: 'https://HOSTNAME/v1',
endpointRealtime: '',
project: '',
key: '',
@ -48,7 +48,7 @@
};
this.headers = {
'x-sdk-version': 'appwrite:web:4.0.4',
'X-Appwrite-Response-Format': '0.11.0',
'X-Appwrite-Response-Format': '0.12.0',
};
this.realtime = {
socket: undefined,
@ -2647,14 +2647,14 @@
}, 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}
* @returns {Promise}
*/
getAntiVirus: () => __awaiter(this, void 0, void 0, function* () {
getAntivirus: () => __awaiter(this, void 0, void 0, function* () {
let path = '/health/anti-virus';
let payload = {};
const uri = new URL(this.config.endpoint + path);
@ -4214,10 +4214,11 @@
/**
* List Teams
*
* Get a list of all the current user teams. You can use the query params to
* filter your results. On admin mode, this endpoint will return a list of all
* of the project's teams. [Learn more about different API
* modes](/docs/admin).
* Get a list of all the teams in which the current user is a member. You can
* use the parameters to filter your results.
*
* 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 {number} limit
@ -4258,9 +4259,8 @@
* Create Team
*
* 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,
* who will be able add new owners and update or delete the team from your
* project.
* assigned as the owner of the team. Only the users with the owner role can
* invite new members, add new owners and delete or update the team.
*
* @param {string} teamId
* @param {string} name
@ -4294,8 +4294,7 @@
/**
* Get Team
*
* Get a team by its unique ID. All team members have read access for this
* resource.
* Get a team by its ID. All team members have read access for this resource.
*
* @param {string} teamId
* @throws {AppwriteException}
@ -4315,8 +4314,8 @@
/**
* Update Team
*
* Update a team by its unique ID. Only team owners have write access for this
* resource.
* Update a team using its ID. Only members with the owner role can update the
* team.
*
* @param {string} teamId
* @param {string} name
@ -4343,8 +4342,8 @@
/**
* Delete Team
*
* Delete a team by its unique ID. Only team owners have write access for this
* resource.
* Delete a team using its ID. Only team members with the owner role can
* delete the team.
*
* @param {string} teamId
* @throws {AppwriteException}
@ -4364,8 +4363,8 @@
/**
* Get Team Memberships
*
* Get a team members by the team unique ID. All team members have read access
* for this list of resources.
* Use this endpoint to list a team's members using the team's ID. All team
* members have read access to this endpoint.
*
* @param {string} teamId
* @param {string} search
@ -4409,22 +4408,21 @@
/**
* Create Team Membership
*
* Use this endpoint to invite a new member to join your team. If initiated
* from Client SDK, an email with a link to join the team will be sent to the
* new member's email address if the member doesn't exist in the project it
* will be created automatically. If initiated from server side SDKs, new
* member will automatically be added to the team.
* Invite a new member to join your team. If initiated from the client SDK, an
* email with a link to join the team will be sent to the member's email
* address and an account will be created for them should they not be signed
* up already. If initiated from server-side SDKs, the new member will
* 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
* Status](/docs/client/teams#teamsUpdateMembershipStatus) endpoint to allow
* the user to accept the invitation to the team. While calling from side
* SDKs the redirect url can be empty string.
* the user to accept the invitation to the team.
*
* Please note that in order to avoid a [Redirect
* Attacks](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md)
* Please note that to avoid a [Redirect
* 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
* added your platforms in the console interface.
* adding your platforms in the console interface.
*
* @param {string} teamId
* @param {string} email
@ -4494,6 +4492,9 @@
/**
* 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} membershipId