Updated SDK examples

This commit is contained in:
Eldad Fux
2020-01-30 18:18:59 +02:00
parent 1beaa237f0
commit d03840bb05
240 changed files with 6299 additions and 1430 deletions
+12
View File
@@ -0,0 +1,12 @@
Copyright (c) 2019 Appwrite (https://appwrite.io) and individual contributors.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name Appwrite nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+29
View File
@@ -0,0 +1,29 @@
# Appwrite SDK for Dart
![License](https://img.shields.io/github/license/appwrite/sdk-for-dart.svg?v=1)
![Version](https://img.shields.io/badge/api%20version-0.4.0-blue.svg?v=1)
Appwrite backend as a service cuts up to 70% of the time and costs required for building a modern application. We abstract and simplify common development tasks behind a REST APIs, to help you develop your app in a fast and secure way. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)
![Appwrite](https://appwrite.io/images/github.png)
## Installation
Add this to your package's pubspec.yaml file:
```yml
dependencies:
appwrite: ^0.0.6
```
You can install packages from the command line:
```bash
pub get
```
## License
Please see the [BSD-3-Clause license](https://raw.githubusercontent.com/appwrite/appwrite/master/LICENSE) file for more information.
+8
View File
@@ -0,0 +1,8 @@
export 'package:appwrite/services/account.dart';
export 'package:appwrite/services/avatars.dart';
export 'package:appwrite/services/database.dart';
export 'package:appwrite/services/locale.dart';
export 'package:appwrite/services/storage.dart';
export 'package:appwrite/services/teams.dart';
export 'package:appwrite/client.dart';
export 'package:dio/dio.dart' show Response;
+100
View File
@@ -0,0 +1,100 @@
import 'package:dio/dio.dart';
import 'package:dio_cookie_manager/dio_cookie_manager.dart';
import 'package:cookie_jar/cookie_jar.dart';
class Client {
String endPoint;
Map<String, String> headers;
bool selfSigned;
Dio http;
Client() {
this.endPoint = 'https://appwrite.io/v1';
this.headers = {
'content-type': 'application/json',
'x-sdk-version': 'appwrite:dart:0.0.6',
};
this.selfSigned = false;
this.http = Dio();
this.http.options.baseUrl = this.endPoint;
this.http.options.validateStatus = (status) => status != 404;
this.http.interceptors.add(CookieManager(CookieJar()));
}
/// Your Appwrite project ID
Client setProject(value) {
this.addHeader('X-Appwrite-Project', value);
return this;
}
/// Your Appwrite project secret key
Client setKey(value) {
this.addHeader('X-Appwrite-Key', value);
return this;
}
Client setLocale(value) {
this.addHeader('X-Appwrite-Locale', value);
return this;
}
Client setMode(value) {
this.addHeader('X-Appwrite-Mode', value);
return this;
}
Client setSelfSigned({bool status = true}) {
this.selfSigned = status;
return this;
}
Client setEndpoint(String endPoint)
{
this.endPoint = endPoint;
this.http.options.baseUrl = this.endPoint;
return this;
}
Client addHeader(String key, String value) {
this.headers[key.toLowerCase()] = value.toLowerCase();
return this;
}
Future<Response> call(String method, {String path = '', Map<String, String> headers = const {}, Map<String, dynamic> params = const {}}) {
if(this.selfSigned) {
// Allow self signed requests
}
String reqPath = path;
bool isGet = method.toUpperCase() == "GET";
// Origin is hardcoded for testing
Options options = Options(
headers: {...this.headers, ...headers, "Origin": "http://localhost"},
method: method.toUpperCase(),
);
if (isGet) {
path += "?";
params.forEach((k, v) {
path += "${k}=${v}&";
});
}
if (!isGet)
return http.request(reqPath, data: params, options: options);
else
return http.request(reqPath, options: options);
}
}
+9
View File
@@ -0,0 +1,9 @@
import 'package:appwrite/client.dart';
class Service {
Client client;
Service(Client client) {
this.client = client;
}
}
+259
View File
@@ -0,0 +1,259 @@
import "package:appwrite/service.dart";
import "package:appwrite/client.dart";
import 'package:dio/dio.dart';
class Account extends Service {
Account(Client client): super(client);
/// Get currently logged in user data as JSON object.
Future<Response> get() async {
String path = '/account';
Map<String, dynamic> params = {
};
return await this.client.call('get', path: path, params: params);
}
/// Use this endpoint to allow a new user to register an account in your
/// project. Use the success and failure URLs to redirect users back to your
/// application after signup completes.
///
/// If registration completes successfully user will be sent with a
/// confirmation email in order to confirm he is the owner of the account email
/// address. Use the confirmation parameter to redirect the user from the
/// confirmation email back to your app. When the user is redirected, use the
/// /auth/confirm endpoint to complete the account confirmation.
///
/// 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.
///
/// When accessing this route using Javascript from the browser, success and
/// failure parameter URLs are required. Appwrite server will respond with a
/// 301 redirect status code and will set the user session cookie. This
/// behavior is enforced because modern browsers are limiting 3rd party cookies
/// in XHR of fetch requests to protect user privacy.
Future<Response> create({email, password, name = null}) async {
String path = '/account';
Map<String, dynamic> params = {
'email': email,
'password': password,
'name': name,
};
return await this.client.call('post', path: path, params: params);
}
/// Delete a currently logged in user account. Behind the scene, the user
/// record is not deleted but permanently blocked from any access. This is done
/// to avoid deleted accounts being overtaken by new users with the same email
/// address. Any user-related resources like documents or storage files should
/// be deleted separately.
Future<Response> delete() async {
String path = '/account';
Map<String, dynamic> params = {
};
return await this.client.call('delete', path: path, params: params);
}
/// Update currently logged in user account email address. After changing user
/// address, user confirmation status is being reset and a new confirmation
/// mail is sent. For security measures, user password is required to complete
/// this request.
Future<Response> updateEmail({email, password}) async {
String path = '/account/email';
Map<String, dynamic> params = {
'email': email,
'password': password,
};
return await this.client.call('patch', path: path, params: params);
}
/// Get currently logged in user list of latest security activity logs. Each
/// log returns user IP address, location and date and time of log.
Future<Response> getLogs() async {
String path = '/account/logs';
Map<String, dynamic> params = {
};
return await this.client.call('get', path: path, params: params);
}
/// Update currently logged in user account name.
Future<Response> updateName({name}) async {
String path = '/account/name';
Map<String, dynamic> params = {
'name': name,
};
return await this.client.call('patch', path: path, params: params);
}
/// Update currently logged in user password. For validation, user is required
/// to pass the password twice.
Future<Response> updatePassword({password, oldPassword}) async {
String path = '/account/password';
Map<String, dynamic> params = {
'password': password,
'old-password': oldPassword,
};
return await this.client.call('patch', path: path, params: params);
}
/// Get currently logged in user preferences key-value object.
Future<Response> getPrefs() async {
String path = '/account/prefs';
Map<String, dynamic> params = {
};
return await this.client.call('get', path: path, params: params);
}
/// Update currently logged in user account preferences. You can pass only the
/// specific settings you wish to update.
Future<Response> updatePrefs({prefs}) async {
String path = '/account/prefs';
Map<String, dynamic> params = {
'prefs': prefs,
};
return await this.client.call('patch', path: path, params: params);
}
/// Sends the user an email with a temporary secret key for password reset.
/// When the user clicks the confirmation link he is redirected back to your
/// app password reset URL with the secret key and email address values
/// attached to the URL query string. Use the query string params to submit a
/// request to the /auth/password/reset endpoint to complete the process.
Future<Response> createRecovery({email, url}) async {
String path = '/account/recovery';
Map<String, dynamic> params = {
'email': email,
'url': url,
};
return await this.client.call('post', path: path, params: params);
}
/// Use this endpoint to complete the user account password reset. Both the
/// **userId** and **secret** arguments will be passed as query parameters to
/// the redirect URL you have provided when sending your request to the
/// /auth/recovery endpoint.
///
/// 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.
Future<Response> updateRecovery({userId, secret, passwordA, passwordB}) async {
String path = '/account/recovery';
Map<String, dynamic> params = {
'userId': userId,
'secret': secret,
'password-a': passwordA,
'password-b': passwordB,
};
return await this.client.call('put', path: path, params: params);
}
/// Get currently logged in user list of active sessions across different
/// devices.
Future<Response> getSessions() async {
String path = '/account/sessions';
Map<String, dynamic> params = {
};
return await this.client.call('get', path: path, params: params);
}
/// Allow the user to login into his account by providing a valid email and
/// password combination. Use the success and failure arguments to provide a
/// redirect URL's back to your app when login is completed.
///
/// 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.
///
/// When accessing this route using Javascript from the browser, success and
/// failure parameter URLs are required. Appwrite server will respond with a
/// 301 redirect status code and will set the user session cookie. This
/// behavior is enforced because modern browsers are limiting 3rd party cookies
/// in XHR of fetch requests to protect user privacy.
Future<Response> createSession({email, password}) async {
String path = '/account/sessions';
Map<String, dynamic> params = {
'email': email,
'password': password,
};
return await this.client.call('post', path: path, params: params);
}
/// Delete all sessions from the user account and remove any sessions cookies
/// from the end client.
Future<Response> deleteSessions() async {
String path = '/account/sessions';
Map<String, dynamic> params = {
};
return await this.client.call('delete', path: path, params: params);
}
/// Use this endpoint to log out the currently logged in user from his account.
/// When successful this endpoint will delete the user session and remove the
/// session secret cookie from the user client.
Future<Response> deleteCurrentSession() async {
String path = '/account/sessions/current';
Map<String, dynamic> params = {
};
return await this.client.call('delete', path: path, params: params);
}
/// Allow the user to login to his account using the OAuth provider of his
/// choice. Each OAuth provider should be enabled from the Appwrite console
/// first. Use the success and failure arguments to provide a redirect URL's
/// back to your app when login is completed.
Future<Response> createOAuthSession({provider, success, failure}) async {
String path = '/account/sessions/oauth/{provider}'.replaceAll(RegExp('{provider}'), provider);
Map<String, dynamic> params = {
'success': success,
'failure': failure,
};
return await this.client.call('get', path: path, params: params);
}
/// Use this endpoint to log out the currently logged in user from all his
/// account sessions across all his different devices. When using the option id
/// argument, only the session unique ID provider will be deleted.
Future<Response> deleteSession({id}) async {
String path = '/account/sessions/{id}'.replaceAll(RegExp('{id}'), id);
Map<String, dynamic> params = {
};
return await this.client.call('delete', path: path, params: params);
}
/// Use this endpoint to complete the user email verification process. Use both
/// the **userId** and **secret** parameters that were attached to your app URL
/// to verify the user email ownership. If confirmed this route will return a
/// 200 status code.
Future<Response> updateVerification({userId, secret, passwordB}) async {
String path = '/account/verification';
Map<String, dynamic> params = {
'userId': userId,
'secret': secret,
'password-b': passwordB,
};
return await this.client.call('put', path: path, params: params);
}
}
+93
View File
@@ -0,0 +1,93 @@
import "package:appwrite/service.dart";
import "package:appwrite/client.dart";
import 'package:dio/dio.dart';
class Avatars extends Service {
Avatars(Client client): super(client);
/// You can use this endpoint to show different browser icons to your users.
/// The code argument receives the browser code as it appears in your user
/// /account/sessions endpoint. Use width, height and quality arguments to
/// change the output settings.
Future<Response> getBrowser({code, width = 100, height = 100, quality = 100}) async {
String path = '/avatars/browsers/{code}'.replaceAll(RegExp('{code}'), code);
Map<String, dynamic> params = {
'width': width,
'height': height,
'quality': quality,
};
return await this.client.call('get', path: path, params: params);
}
/// Need to display your users with your billing method or their payment
/// methods? The credit card endpoint will return you the icon of the credit
/// card provider you need. Use width, height and quality arguments to change
/// the output settings.
Future<Response> getCreditCard({code, width = 100, height = 100, quality = 100}) async {
String path = '/avatars/credit-cards/{code}'.replaceAll(RegExp('{code}'), code);
Map<String, dynamic> params = {
'width': width,
'height': height,
'quality': quality,
};
return await this.client.call('get', path: path, params: params);
}
/// Use this endpoint to fetch the favorite icon (AKA favicon) of a any remote
/// website URL.
Future<Response> getFavicon({url}) async {
String path = '/avatars/favicon';
Map<String, dynamic> params = {
'url': url,
};
return await this.client.call('get', path: path, params: params);
}
/// You can use this endpoint to show different country flags icons to your
/// users. The code argument receives the 2 letter country code. Use width,
/// height and quality arguments to change the output settings.
Future<Response> getFlag({code, width = 100, height = 100, quality = 100}) async {
String path = '/avatars/flags/{code}'.replaceAll(RegExp('{code}'), code);
Map<String, dynamic> params = {
'width': width,
'height': height,
'quality': quality,
};
return await this.client.call('get', path: path, params: params);
}
/// Use this endpoint to fetch a remote image URL and crop it to any image size
/// you want. This endpoint is very useful if you need to crop and display
/// remote images in your app or in case you want to make sure a 3rd party
/// image is properly served using a TLS protocol.
Future<Response> getImage({url, width = 400, height = 400}) async {
String path = '/avatars/image';
Map<String, dynamic> params = {
'url': url,
'width': width,
'height': height,
};
return await this.client.call('get', path: path, params: params);
}
/// Converts a given plain text to a QR code image. You can use the query
/// parameters to change the size and style of the resulting image.
Future<Response> getQR({text, size = 400, margin = 1, download = null}) async {
String path = '/avatars/qr';
Map<String, dynamic> params = {
'text': text,
'size': size,
'margin': margin,
'download': download,
};
return await this.client.call('get', path: path, params: params);
}
}
+139
View File
@@ -0,0 +1,139 @@
import "package:appwrite/service.dart";
import "package:appwrite/client.dart";
import 'package:dio/dio.dart';
class Database extends Service {
Database(Client client): super(client);
/// Get a list of all the user collections. You can use the query params to
/// filter your results. On admin mode, this endpoint will return a list of all
/// of the project collections. [Learn more about different API
/// modes](/docs/admin).
Future<Response> listCollections({search = null, limit = 25, offset = null, orderType = 'ASC'}) async {
String path = '/database/collections';
Map<String, dynamic> params = {
'search': search,
'limit': limit,
'offset': offset,
'orderType': orderType,
};
return await this.client.call('get', path: path, params: params);
}
/// Create a new Collection.
Future<Response> createCollection({name, read, write, rules}) async {
String path = '/database/collections';
Map<String, dynamic> params = {
'name': name,
'read': read,
'write': write,
'rules': rules,
};
return await this.client.call('post', path: path, params: params);
}
/// Get collection by its unique ID. This endpoint response returns a JSON
/// object with the collection metadata.
Future<Response> getCollection({collectionId}) async {
String path = '/database/collections/{collectionId}'.replaceAll(RegExp('{collectionId}'), collectionId);
Map<String, dynamic> params = {
};
return await this.client.call('get', path: path, params: params);
}
/// Update collection by its unique ID.
Future<Response> updateCollection({collectionId, name, read, write, rules = const []}) async {
String path = '/database/collections/{collectionId}'.replaceAll(RegExp('{collectionId}'), collectionId);
Map<String, dynamic> params = {
'name': name,
'read': read,
'write': write,
'rules': rules,
};
return await this.client.call('put', path: path, params: params);
}
/// Delete a collection by its unique ID. Only users with write permissions
/// have access to delete this resource.
Future<Response> deleteCollection({collectionId}) async {
String path = '/database/collections/{collectionId}'.replaceAll(RegExp('{collectionId}'), collectionId);
Map<String, dynamic> params = {
};
return await this.client.call('delete', path: path, params: params);
}
/// Get a list of all the user documents. You can use the query params to
/// filter your results. On admin mode, this endpoint will return a list of all
/// of the project documents. [Learn more about different API
/// modes](/docs/admin).
Future<Response> listDocuments({collectionId, filters = const [], offset = null, limit = 50, orderField = '\$uid', orderType = 'ASC', orderCast = 'string', search = null, first = null, last = null}) async {
String path = '/database/collections/{collectionId}/documents'.replaceAll(RegExp('{collectionId}'), collectionId);
Map<String, dynamic> params = {
'filters': filters,
'offset': offset,
'limit': limit,
'order-field': orderField,
'order-type': orderType,
'order-cast': orderCast,
'search': search,
'first': first,
'last': last,
};
return await this.client.call('get', path: path, params: params);
}
/// Create a new Document.
Future<Response> createDocument({collectionId, data, read, write, parentDocument = null, parentProperty = null, parentPropertyType = 'assign'}) async {
String path = '/database/collections/{collectionId}/documents'.replaceAll(RegExp('{collectionId}'), collectionId);
Map<String, dynamic> params = {
'data': data,
'read': read,
'write': write,
'parentDocument': parentDocument,
'parentProperty': parentProperty,
'parentPropertyType': parentPropertyType,
};
return await this.client.call('post', path: path, params: params);
}
/// Get document by its unique ID. This endpoint response returns a JSON object
/// with the document data.
Future<Response> getDocument({collectionId, documentId}) async {
String path = '/database/collections/{collectionId}/documents/{documentId}'.replaceAll(RegExp('{collectionId}'), collectionId).replaceAll(RegExp('{documentId}'), documentId);
Map<String, dynamic> params = {
};
return await this.client.call('get', path: path, params: params);
}
Future<Response> updateDocument({collectionId, documentId, data, read, write}) async {
String path = '/database/collections/{collectionId}/documents/{documentId}'.replaceAll(RegExp('{collectionId}'), collectionId).replaceAll(RegExp('{documentId}'), documentId);
Map<String, dynamic> params = {
'data': data,
'read': read,
'write': write,
};
return await this.client.call('patch', path: path, params: params);
}
/// Delete document by its unique ID. This endpoint deletes only the parent
/// documents, his attributes and relations to other documents. Child documents
/// **will not** be deleted.
Future<Response> deleteDocument({collectionId, documentId}) async {
String path = '/database/collections/{collectionId}/documents/{documentId}'.replaceAll(RegExp('{collectionId}'), collectionId).replaceAll(RegExp('{documentId}'), documentId);
Map<String, dynamic> params = {
};
return await this.client.call('delete', path: path, params: params);
}
}
+74
View File
@@ -0,0 +1,74 @@
import "package:appwrite/service.dart";
import "package:appwrite/client.dart";
import 'package:dio/dio.dart';
class Locale extends Service {
Locale(Client client): super(client);
/// Get the current user location based on IP. Returns an object with user
/// country code, country name, continent name, continent code, ip address and
/// suggested currency. You can use the locale header to get the data in a
/// supported language.
///
/// ([IP Geolocation by DB-IP](https://db-ip.com))
Future<Response> get() async {
String path = '/locale';
Map<String, dynamic> params = {
};
return await this.client.call('get', path: path, params: params);
}
/// List of all continents. You can use the locale header to get the data in a
/// supported language.
Future<Response> getContinents() async {
String path = '/locale/continents';
Map<String, dynamic> params = {
};
return await this.client.call('get', path: path, params: params);
}
/// List of all countries. You can use the locale header to get the data in a
/// supported language.
Future<Response> getCountries() async {
String path = '/locale/countries';
Map<String, dynamic> params = {
};
return await this.client.call('get', path: path, params: params);
}
/// List of all countries that are currently members of the EU. You can use the
/// locale header to get the data in a supported language.
Future<Response> getCountriesEU() async {
String path = '/locale/countries/eu';
Map<String, dynamic> params = {
};
return await this.client.call('get', path: path, params: params);
}
/// List of all countries phone codes. You can use the locale header to get the
/// data in a supported language.
Future<Response> getCountriesPhones() async {
String path = '/locale/countries/phones';
Map<String, dynamic> params = {
};
return await this.client.call('get', path: path, params: params);
}
/// List of all currencies, including currency symol, name, plural, and decimal
/// digits for all major and minor currencies. You can use the locale header to
/// get the data in a supported language.
Future<Response> getCurrencies() async {
String path = '/locale/currencies';
Map<String, dynamic> params = {
};
return await this.client.call('get', path: path, params: params);
}
}
+109
View File
@@ -0,0 +1,109 @@
import "package:appwrite/service.dart";
import "package:appwrite/client.dart";
import 'package:dio/dio.dart';
class Storage extends Service {
Storage(Client client): super(client);
/// Get a list of all the user files. You can use the query params to filter
/// your results. On admin mode, this endpoint will return a list of all of the
/// project files. [Learn more about different API modes](/docs/admin).
Future<Response> list({search = null, limit = 25, offset = null, orderType = 'ASC'}) async {
String path = '/storage/files';
Map<String, dynamic> params = {
'search': search,
'limit': limit,
'offset': offset,
'orderType': orderType,
};
return await this.client.call('get', path: path, params: params);
}
/// Create a new file. The user who creates the file will automatically be
/// assigned to read and write access unless he has passed custom values for
/// read and write arguments.
Future<Response> create({file, read, write}) async {
String path = '/storage/files';
Map<String, dynamic> params = {
'file': file,
'read': read,
'write': write,
};
return await this.client.call('post', path: path, params: params);
}
/// Get file by its unique ID. This endpoint response returns a JSON object
/// with the file metadata.
Future<Response> get({fileId}) async {
String path = '/storage/files/{fileId}'.replaceAll(RegExp('{fileId}'), fileId);
Map<String, dynamic> params = {
};
return await this.client.call('get', path: path, params: params);
}
/// Update file by its unique ID. Only users with write permissions have access
/// to update this resource.
Future<Response> update({fileId, read, write}) async {
String path = '/storage/files/{fileId}'.replaceAll(RegExp('{fileId}'), fileId);
Map<String, dynamic> params = {
'read': read,
'write': write,
};
return await this.client.call('put', path: path, params: params);
}
/// Delete a file by its unique ID. Only users with write permissions have
/// access to delete this resource.
Future<Response> delete({fileId}) async {
String path = '/storage/files/{fileId}'.replaceAll(RegExp('{fileId}'), fileId);
Map<String, dynamic> params = {
};
return await this.client.call('delete', path: path, params: params);
}
/// Get file content by its unique ID. The endpoint response return with a
/// 'Content-Disposition: attachment' header that tells the browser to start
/// downloading the file to user downloads directory.
Future<Response> getDownload({fileId}) async {
String path = '/storage/files/{fileId}/download'.replaceAll(RegExp('{fileId}'), fileId);
Map<String, dynamic> params = {
};
return await this.client.call('get', path: path, params: params);
}
/// Get a file preview image. Currently, this method supports preview for image
/// files (jpg, png, and gif), other supported formats, like pdf, docs, slides,
/// and spreadsheets, will return the file icon image. You can also pass query
/// string arguments for cutting and resizing your preview image.
Future<Response> getPreview({fileId, width = null, height = null, quality = 100, background = null, output = null}) async {
String path = '/storage/files/{fileId}/preview'.replaceAll(RegExp('{fileId}'), fileId);
Map<String, dynamic> params = {
'width': width,
'height': height,
'quality': quality,
'background': background,
'output': output,
};
return await this.client.call('get', path: path, params: params);
}
/// Get file content by its unique ID. This endpoint is similar to the download
/// method but returns with no 'Content-Disposition: attachment' header.
Future<Response> getView({fileId, as = null}) async {
String path = '/storage/files/{fileId}/view'.replaceAll(RegExp('{fileId}'), fileId);
Map<String, dynamic> params = {
'as': as,
};
return await this.client.call('get', path: path, params: params);
}
}
+140
View File
@@ -0,0 +1,140 @@
import "package:appwrite/service.dart";
import "package:appwrite/client.dart";
import 'package:dio/dio.dart';
class Teams extends Service {
Teams(Client client): super(client);
/// 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 teams. [Learn more about different API modes](/docs/admin).
Future<Response> list({search = null, limit = 25, offset = null, orderType = 'ASC'}) async {
String path = '/teams';
Map<String, dynamic> params = {
'search': search,
'limit': limit,
'offset': offset,
'orderType': orderType,
};
return await this.client.call('get', path: path, params: params);
}
/// 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.
Future<Response> create({name, roles = const ["owner"]}) async {
String path = '/teams';
Map<String, dynamic> params = {
'name': name,
'roles': roles,
};
return await this.client.call('post', path: path, params: params);
}
/// Get team by its unique ID. All team members have read access for this
/// resource.
Future<Response> get({teamId}) async {
String path = '/teams/{teamId}'.replaceAll(RegExp('{teamId}'), teamId);
Map<String, dynamic> params = {
};
return await this.client.call('get', path: path, params: params);
}
/// Update team by its unique ID. Only team owners have write access for this
/// resource.
Future<Response> update({teamId, name}) async {
String path = '/teams/{teamId}'.replaceAll(RegExp('{teamId}'), teamId);
Map<String, dynamic> params = {
'name': name,
};
return await this.client.call('put', path: path, params: params);
}
/// Delete team by its unique ID. Only team owners have write access for this
/// resource.
Future<Response> delete({teamId}) async {
String path = '/teams/{teamId}'.replaceAll(RegExp('{teamId}'), teamId);
Map<String, dynamic> params = {
};
return await this.client.call('delete', path: path, params: params);
}
/// Get team members by the team unique ID. All team members have read access
/// for this list of resources.
Future<Response> getMemberships({teamId}) async {
String path = '/teams/{teamId}/memberships'.replaceAll(RegExp('{teamId}'), teamId);
Map<String, dynamic> params = {
};
return await this.client.call('get', path: path, params: params);
}
/// Use this endpoint to invite a new member to your team. An email with a link
/// to join the team will be sent to the new member email address. If member
/// doesn't exists in the project it will be automatically created.
///
/// 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/teams#updateTeamMembershipStatus) endpoint to finally join
/// the user 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)
/// the only valid redirect URL's are the once from domains you have set when
/// added your platforms in the console interface.
Future<Response> createMembership({teamId, email, roles, url, name = null}) async {
String path = '/teams/{teamId}/memberships'.replaceAll(RegExp('{teamId}'), teamId);
Map<String, dynamic> params = {
'email': email,
'name': name,
'roles': roles,
'url': url,
};
return await this.client.call('post', path: path, params: params);
}
/// This endpoint allows a user to leave a team or for a team owner to delete
/// the membership of any other team member. You can also use this endpoint to
/// delete a user membership even if he didn't accept it.
Future<Response> deleteMembership({teamId, inviteId}) async {
String path = '/teams/{teamId}/memberships/{inviteId}'.replaceAll(RegExp('{teamId}'), teamId).replaceAll(RegExp('{inviteId}'), inviteId);
Map<String, dynamic> params = {
};
return await this.client.call('delete', path: path, params: params);
}
/// Use this endpoint to let user accept an invitation to join a team after he
/// is being redirect back to your app from the invitation email. Use the
/// success and failure URL's to redirect users back to your application after
/// the request completes.
///
/// 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)
/// the only valid redirect URL's are the once from domains you have set when
/// added your platforms in the console interface.
///
/// When not using the success or failure redirect arguments this endpoint will
/// result with a 200 status code on success and with 401 status error on
/// failure. This behavior was applied to help the web clients deal with
/// browsers who don't allow to set 3rd party HTTP cookies needed for saving
/// the account session key.
Future<Response> updateMembershipStatus({teamId, inviteId, userId, secret}) async {
String path = '/teams/{teamId}/memberships/{inviteId}/status'.replaceAll(RegExp('{teamId}'), teamId).replaceAll(RegExp('{inviteId}'), inviteId);
Map<String, dynamic> params = {
'userId': userId,
'secret': secret,
};
return await this.client.call('patch', path: path, params: params);
}
}
+11
View File
@@ -0,0 +1,11 @@
name: appwrite
version: 0.0.6
description: Appwrite backend as a service cuts up to 70% of the time and costs required for building a modern application. We abstract and simplify common development tasks behind a REST APIs, to help you develop your app in a fast and secure way. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)
author: Appwrite Team <team@appwrite.io>
homepage: https://github.com/appwrite/sdk-for-dart
environment:
sdk: '>=2.2.2 <3.0.0'
dependencies:
dio: ^3.0.0
cookie_jar: ^1.0.0
dio_cookie_manager: ^1.0.0
+10 -10
View File
@@ -22,7 +22,7 @@ func NewDatabase(clt Client) Database {
// return a list of all of the project collections. [Learn more about
// different API modes](/docs/admin).
func (srv *Database) ListCollections(Search string, Limit int, Offset int, OrderType string) (map[string]interface{}, error) {
path := "/database"
path := "/database/collections"
params := map[string]interface{}{
"search": Search,
@@ -36,7 +36,7 @@ func (srv *Database) ListCollections(Search string, Limit int, Offset int, Order
// CreateCollection create a new Collection.
func (srv *Database) CreateCollection(Name string, Read []interface{}, Write []interface{}, Rules []interface{}) (map[string]interface{}, error) {
path := "/database"
path := "/database/collections"
params := map[string]interface{}{
"name": Name,
@@ -52,7 +52,7 @@ func (srv *Database) CreateCollection(Name string, Read []interface{}, Write []i
// returns a JSON object with the collection metadata.
func (srv *Database) GetCollection(CollectionId string) (map[string]interface{}, error) {
r := strings.NewReplacer("{collectionId}", CollectionId)
path := r.Replace("/database/{collectionId}")
path := r.Replace("/database/collections/{collectionId}")
params := map[string]interface{}{
}
@@ -63,7 +63,7 @@ func (srv *Database) GetCollection(CollectionId string) (map[string]interface{},
// UpdateCollection update collection by its unique ID.
func (srv *Database) UpdateCollection(CollectionId string, Name string, Read []interface{}, Write []interface{}, Rules []interface{}) (map[string]interface{}, error) {
r := strings.NewReplacer("{collectionId}", CollectionId)
path := r.Replace("/database/{collectionId}")
path := r.Replace("/database/collections/{collectionId}")
params := map[string]interface{}{
"name": Name,
@@ -79,7 +79,7 @@ func (srv *Database) UpdateCollection(CollectionId string, Name string, Read []i
// write permissions have access to delete this resource.
func (srv *Database) DeleteCollection(CollectionId string) (map[string]interface{}, error) {
r := strings.NewReplacer("{collectionId}", CollectionId)
path := r.Replace("/database/{collectionId}")
path := r.Replace("/database/collections/{collectionId}")
params := map[string]interface{}{
}
@@ -93,7 +93,7 @@ func (srv *Database) DeleteCollection(CollectionId string) (map[string]interface
// modes](/docs/admin).
func (srv *Database) ListDocuments(CollectionId string, Filters []interface{}, Offset int, Limit int, OrderField string, OrderType string, OrderCast string, Search string, First int, Last int) (map[string]interface{}, error) {
r := strings.NewReplacer("{collectionId}", CollectionId)
path := r.Replace("/database/{collectionId}/documents")
path := r.Replace("/database/collections/{collectionId}/documents")
params := map[string]interface{}{
"filters": Filters,
@@ -113,7 +113,7 @@ func (srv *Database) ListDocuments(CollectionId string, Filters []interface{}, O
// CreateDocument create a new Document.
func (srv *Database) CreateDocument(CollectionId string, Data string, Read []interface{}, Write []interface{}, ParentDocument string, ParentProperty string, ParentPropertyType string) (map[string]interface{}, error) {
r := strings.NewReplacer("{collectionId}", CollectionId)
path := r.Replace("/database/{collectionId}/documents")
path := r.Replace("/database/collections/{collectionId}/documents")
params := map[string]interface{}{
"data": Data,
@@ -131,7 +131,7 @@ func (srv *Database) CreateDocument(CollectionId string, Data string, Read []int
// JSON object with the document data.
func (srv *Database) GetDocument(CollectionId string, DocumentId string) (map[string]interface{}, error) {
r := strings.NewReplacer("{collectionId}", CollectionId, "{documentId}", DocumentId)
path := r.Replace("/database/{collectionId}/documents/{documentId}")
path := r.Replace("/database/collections/{collectionId}/documents/{documentId}")
params := map[string]interface{}{
}
@@ -142,7 +142,7 @@ func (srv *Database) GetDocument(CollectionId string, DocumentId string) (map[st
// UpdateDocument
func (srv *Database) UpdateDocument(CollectionId string, DocumentId string, Data string, Read []interface{}, Write []interface{}) (map[string]interface{}, error) {
r := strings.NewReplacer("{collectionId}", CollectionId, "{documentId}", DocumentId)
path := r.Replace("/database/{collectionId}/documents/{documentId}")
path := r.Replace("/database/collections/{collectionId}/documents/{documentId}")
params := map[string]interface{}{
"data": Data,
@@ -158,7 +158,7 @@ func (srv *Database) UpdateDocument(CollectionId string, DocumentId string, Data
// Child documents **will not** be deleted.
func (srv *Database) DeleteDocument(CollectionId string, DocumentId string) (map[string]interface{}, error) {
r := strings.NewReplacer("{collectionId}", CollectionId, "{documentId}", DocumentId)
path := r.Replace("/database/{collectionId}/documents/{documentId}")
path := r.Replace("/database/collections/{collectionId}/documents/{documentId}")
params := map[string]interface{}{
}
@@ -15,7 +15,7 @@ func main() {
client: &client
}
var response, error := service.GetLocale()
var response, error := service.Get()
if error != nil {
panic(error)
@@ -15,7 +15,7 @@ func main() {
client: &client
}
var response, error := service.GetFile("[FILE_ID]")
var response, error := service.Create(file, [], [])
if error != nil {
panic(error)
@@ -15,7 +15,7 @@ func main() {
client: &client
}
var response, error := service.DeleteFile("[FILE_ID]")
var response, error := service.Delete("[FILE_ID]")
if error != nil {
panic(error)
@@ -15,7 +15,7 @@ func main() {
client: &client
}
var response, error := service.CreateFile(file, [], [])
var response, error := service.GetDownload("[FILE_ID]")
if error != nil {
panic(error)
@@ -1,25 +0,0 @@
package main
import (
"fmt"
"github.com/appwrite/sdk-for-go"
)
func main() {
var client := appwrite.Client{}
client.SetProject("")
client.SetKey("")
var service := appwrite.Storage{
client: &client
}
var response, error := service.GetFilePreview("[FILE_ID]", 0, 0, 0, "", "jpg")
if error != nil {
panic(error)
}
fmt.Println(response)
}
@@ -15,7 +15,7 @@ func main() {
client: &client
}
var response, error := service.GetFileView("[FILE_ID]", "pdf")
var response, error := service.GetPreview("[FILE_ID]", 0, 0, 0, "", "jpg")
if error != nil {
panic(error)
@@ -15,7 +15,7 @@ func main() {
client: &client
}
var response, error := service.GetFileDownload("[FILE_ID]")
var response, error := service.GetView("[FILE_ID]", "pdf")
if error != nil {
panic(error)
+25
View File
@@ -0,0 +1,25 @@
package main
import (
"fmt"
"github.com/appwrite/sdk-for-go"
)
func main() {
var client := appwrite.Client{}
client.SetProject("")
client.SetKey("")
var service := appwrite.Storage{
client: &client
}
var response, error := service.Get("[FILE_ID]")
if error != nil {
panic(error)
}
fmt.Println(response)
}
@@ -1,25 +0,0 @@
package main
import (
"fmt"
"github.com/appwrite/sdk-for-go"
)
func main() {
var client := appwrite.Client{}
client.SetProject("")
client.SetKey("")
var service := appwrite.Storage{
client: &client
}
var response, error := service.ListFiles("[SEARCH]", 0, 0, "ASC")
if error != nil {
panic(error)
}
fmt.Println(response)
}
+25
View File
@@ -0,0 +1,25 @@
package main
import (
"fmt"
"github.com/appwrite/sdk-for-go"
)
func main() {
var client := appwrite.Client{}
client.SetProject("")
client.SetKey("")
var service := appwrite.Storage{
client: &client
}
var response, error := service.List("[SEARCH]", 0, 0, "ASC")
if error != nil {
panic(error)
}
fmt.Println(response)
}
@@ -1,25 +0,0 @@
package main
import (
"fmt"
"github.com/appwrite/sdk-for-go"
)
func main() {
var client := appwrite.Client{}
client.SetProject("")
client.SetKey("")
var service := appwrite.Storage{
client: &client
}
var response, error := service.UpdateFile("[FILE_ID]", [], [])
if error != nil {
panic(error)
}
fmt.Println(response)
}
@@ -0,0 +1,25 @@
package main
import (
"fmt"
"github.com/appwrite/sdk-for-go"
)
func main() {
var client := appwrite.Client{}
client.SetProject("")
client.SetKey("")
var service := appwrite.Storage{
client: &client
}
var response, error := service.Update("[FILE_ID]", [], [])
if error != nil {
panic(error)
}
fmt.Println(response)
}
@@ -15,7 +15,7 @@ func main() {
client: &client
}
var response, error := service.DeleteTeamMembership("[TEAM_ID]", "[INVITE_ID]")
var response, error := service.CreateMembership("[TEAM_ID]", "email@example.com", [], "https://example.com", "[NAME]")
if error != nil {
panic(error)
@@ -1,25 +0,0 @@
package main
import (
"fmt"
"github.com/appwrite/sdk-for-go"
)
func main() {
var client := appwrite.Client{}
client.SetProject("")
client.SetKey("")
var service := appwrite.Teams{
client: &client
}
var response, error := service.CreateTeamMembership("[TEAM_ID]", "email@example.com", [], "https://example.com", "[NAME]")
if error != nil {
panic(error)
}
fmt.Println(response)
}
@@ -15,7 +15,7 @@ func main() {
client: &client
}
var response, error := service.GetTeam("[TEAM_ID]")
var response, error := service.Create("[NAME]", [])
if error != nil {
panic(error)
@@ -0,0 +1,25 @@
package main
import (
"fmt"
"github.com/appwrite/sdk-for-go"
)
func main() {
var client := appwrite.Client{}
client.SetProject("")
client.SetKey("")
var service := appwrite.Teams{
client: &client
}
var response, error := service.DeleteMembership("[TEAM_ID]", "[INVITE_ID]")
if error != nil {
panic(error)
}
fmt.Println(response)
}
@@ -15,7 +15,7 @@ func main() {
client: &client
}
var response, error := service.DeleteTeam("[TEAM_ID]")
var response, error := service.Delete("[TEAM_ID]")
if error != nil {
panic(error)
@@ -15,7 +15,7 @@ func main() {
client: &client
}
var response, error := service.GetTeamMemberships("[TEAM_ID]")
var response, error := service.GetMemberships("[TEAM_ID]")
if error != nil {
panic(error)
@@ -15,7 +15,7 @@ func main() {
client: &client
}
var response, error := service.CreateTeam("[NAME]", [])
var response, error := service.Get("[TEAM_ID]")
if error != nil {
panic(error)
@@ -1,25 +0,0 @@
package main
import (
"fmt"
"github.com/appwrite/sdk-for-go"
)
func main() {
var client := appwrite.Client{}
client.SetProject("")
client.SetKey("")
var service := appwrite.Teams{
client: &client
}
var response, error := service.ListTeams("[SEARCH]", 0, 0, "ASC")
if error != nil {
panic(error)
}
fmt.Println(response)
}
+25
View File
@@ -0,0 +1,25 @@
package main
import (
"fmt"
"github.com/appwrite/sdk-for-go"
)
func main() {
var client := appwrite.Client{}
client.SetProject("")
client.SetKey("")
var service := appwrite.Teams{
client: &client
}
var response, error := service.List("[SEARCH]", 0, 0, "ASC")
if error != nil {
panic(error)
}
fmt.Println(response)
}
@@ -1,25 +0,0 @@
package main
import (
"fmt"
"github.com/appwrite/sdk-for-go"
)
func main() {
var client := appwrite.Client{}
client.SetProject("")
client.SetKey("")
var service := appwrite.Teams{
client: &client
}
var response, error := service.UpdateTeam("[TEAM_ID]", "[NAME]")
if error != nil {
panic(error)
}
fmt.Println(response)
}
+25
View File
@@ -0,0 +1,25 @@
package main
import (
"fmt"
"github.com/appwrite/sdk-for-go"
)
func main() {
var client := appwrite.Client{}
client.SetProject("")
client.SetKey("")
var service := appwrite.Teams{
client: &client
}
var response, error := service.Update("[TEAM_ID]", "[NAME]")
if error != nil {
panic(error)
}
fmt.Println(response)
}
@@ -1,25 +0,0 @@
package main
import (
"fmt"
"github.com/appwrite/sdk-for-go"
)
func main() {
var client := appwrite.Client{}
client.SetProject("")
client.SetKey("")
var service := appwrite.Users{
client: &client
}
var response, error := service.CreateUser("email@example.com", "password", "[NAME]")
if error != nil {
panic(error)
}
fmt.Println(response)
}
@@ -15,7 +15,7 @@ func main() {
client: &client
}
var response, error := service.DeleteUserSession("[USER_ID]", "[SESSION_ID]")
var response, error := service.Create("email@example.com", "password", "[NAME]")
if error != nil {
panic(error)
@@ -15,7 +15,7 @@ func main() {
client: &client
}
var response, error := service.DeleteUserSessions("[USER_ID]")
var response, error := service.DeleteSession("[USER_ID]", "[SESSION_ID]")
if error != nil {
panic(error)
@@ -15,7 +15,7 @@ func main() {
client: &client
}
var response, error := service.GetUserSessions("[USER_ID]")
var response, error := service.DeleteSessions("[USER_ID]")
if error != nil {
panic(error)
@@ -15,7 +15,7 @@ func main() {
client: &client
}
var response, error := service.GetUser("[USER_ID]")
var response, error := service.GetLogs("[USER_ID]")
if error != nil {
panic(error)
@@ -15,7 +15,7 @@ func main() {
client: &client
}
var response, error := service.GetUserLogs("[USER_ID]")
var response, error := service.GetPrefs("[USER_ID]")
if error != nil {
panic(error)
@@ -15,7 +15,7 @@ func main() {
client: &client
}
var response, error := service.GetUserPrefs("[USER_ID]")
var response, error := service.GetSessions("[USER_ID]")
if error != nil {
panic(error)
+25
View File
@@ -0,0 +1,25 @@
package main
import (
"fmt"
"github.com/appwrite/sdk-for-go"
)
func main() {
var client := appwrite.Client{}
client.SetProject("")
client.SetKey("")
var service := appwrite.Users{
client: &client
}
var response, error := service.Get("[USER_ID]")
if error != nil {
panic(error)
}
fmt.Println(response)
}
@@ -1,25 +0,0 @@
package main
import (
"fmt"
"github.com/appwrite/sdk-for-go"
)
func main() {
var client := appwrite.Client{}
client.SetProject("")
client.SetKey("")
var service := appwrite.Users{
client: &client
}
var response, error := service.ListUsers("[SEARCH]", 0, 0, "ASC")
if error != nil {
panic(error)
}
fmt.Println(response)
}
+25
View File
@@ -0,0 +1,25 @@
package main
import (
"fmt"
"github.com/appwrite/sdk-for-go"
)
func main() {
var client := appwrite.Client{}
client.SetProject("")
client.SetKey("")
var service := appwrite.Users{
client: &client
}
var response, error := service.List("[SEARCH]", 0, 0, "ASC")
if error != nil {
panic(error)
}
fmt.Println(response)
}
@@ -0,0 +1,25 @@
package main
import (
"fmt"
"github.com/appwrite/sdk-for-go"
)
func main() {
var client := appwrite.Client{}
client.SetProject("")
client.SetKey("")
var service := appwrite.Users{
client: &client
}
var response, error := service.UpdatePrefs("[USER_ID]", "")
if error != nil {
panic(error)
}
fmt.Println(response)
}
@@ -0,0 +1,25 @@
package main
import (
"fmt"
"github.com/appwrite/sdk-for-go"
)
func main() {
var client := appwrite.Client{}
client.SetProject("")
client.SetKey("")
var service := appwrite.Users{
client: &client
}
var response, error := service.UpdateStatus("[USER_ID]", "1")
if error != nil {
panic(error)
}
fmt.Println(response)
}
@@ -1,25 +0,0 @@
package main
import (
"fmt"
"github.com/appwrite/sdk-for-go"
)
func main() {
var client := appwrite.Client{}
client.SetProject("")
client.SetKey("")
var service := appwrite.Users{
client: &client
}
var response, error := service.UpdateUserPrefs("[USER_ID]", "")
if error != nil {
panic(error)
}
fmt.Println(response)
}
@@ -1,25 +0,0 @@
package main
import (
"fmt"
"github.com/appwrite/sdk-for-go"
)
func main() {
var client := appwrite.Client{}
client.SetProject("")
client.SetKey("")
var service := appwrite.Users{
client: &client
}
var response, error := service.UpdateUserStatus("[USER_ID]", "1")
if error != nil {
panic(error)
}
fmt.Println(response)
}
+4 -4
View File
@@ -16,13 +16,13 @@ func NewLocale(clt Client) Locale {
return service
}
// GetLocale get the current user location based on IP. Returns an object with
// user country code, country name, continent name, continent code, ip address
// and suggested currency. You can use the locale header to get the data in a
// Get get the current user location based on IP. Returns an object with user
// country code, country name, continent name, continent code, ip address and
// suggested currency. You can use the locale header to get the data in a
// supported language.
//
// ([IP Geolocation by DB-IP](https://db-ip.com))
func (srv *Locale) GetLocale() (map[string]interface{}, error) {
func (srv *Locale) Get() (map[string]interface{}, error) {
path := "/locale"
params := map[string]interface{}{
+24 -24
View File
@@ -17,10 +17,10 @@ func NewStorage(clt Client) Storage {
return service
}
// ListFiles get a list of all the user files. You can use the query params to
// List get a list of all the user files. You can use the query params to
// filter your results. On admin mode, this endpoint will return a list of all
// of the project files. [Learn more about different API modes](/docs/admin).
func (srv *Storage) ListFiles(Search string, Limit int, Offset int, OrderType string) (map[string]interface{}, error) {
func (srv *Storage) List(Search string, Limit int, Offset int, OrderType string) (map[string]interface{}, error) {
path := "/storage/files"
params := map[string]interface{}{
@@ -33,10 +33,10 @@ func (srv *Storage) ListFiles(Search string, Limit int, Offset int, OrderType st
return srv.client.Call("GET", path, nil, params)
}
// CreateFile create a new file. The user who creates the file will
// automatically be assigned to read and write access unless he has passed
// custom values for read and write arguments.
func (srv *Storage) CreateFile(File string, Read []interface{}, Write []interface{}) (map[string]interface{}, error) {
// Create create a new file. The user who creates the file will automatically
// be assigned to read and write access unless he has passed custom values for
// read and write arguments.
func (srv *Storage) Create(File string, Read []interface{}, Write []interface{}) (map[string]interface{}, error) {
path := "/storage/files"
params := map[string]interface{}{
@@ -48,9 +48,9 @@ func (srv *Storage) CreateFile(File string, Read []interface{}, Write []interfac
return srv.client.Call("POST", path, nil, params)
}
// GetFile get file by its unique ID. This endpoint response returns a JSON
// object with the file metadata.
func (srv *Storage) GetFile(FileId string) (map[string]interface{}, error) {
// Get get file by its unique ID. This endpoint response returns a JSON object
// with the file metadata.
func (srv *Storage) Get(FileId string) (map[string]interface{}, error) {
r := strings.NewReplacer("{fileId}", FileId)
path := r.Replace("/storage/files/{fileId}")
@@ -60,9 +60,9 @@ func (srv *Storage) GetFile(FileId string) (map[string]interface{}, error) {
return srv.client.Call("GET", path, nil, params)
}
// UpdateFile update file by its unique ID. Only users with write permissions
// have access to update this resource.
func (srv *Storage) UpdateFile(FileId string, Read []interface{}, Write []interface{}) (map[string]interface{}, error) {
// Update update file by its unique ID. Only users with write permissions have
// access to update this resource.
func (srv *Storage) Update(FileId string, Read []interface{}, Write []interface{}) (map[string]interface{}, error) {
r := strings.NewReplacer("{fileId}", FileId)
path := r.Replace("/storage/files/{fileId}")
@@ -74,9 +74,9 @@ func (srv *Storage) UpdateFile(FileId string, Read []interface{}, Write []interf
return srv.client.Call("PUT", path, nil, params)
}
// DeleteFile delete a file by its unique ID. Only users with write
// permissions have access to delete this resource.
func (srv *Storage) DeleteFile(FileId string) (map[string]interface{}, error) {
// Delete delete a file by its unique ID. Only users with write permissions
// have access to delete this resource.
func (srv *Storage) Delete(FileId string) (map[string]interface{}, error) {
r := strings.NewReplacer("{fileId}", FileId)
path := r.Replace("/storage/files/{fileId}")
@@ -86,10 +86,10 @@ func (srv *Storage) DeleteFile(FileId string) (map[string]interface{}, error) {
return srv.client.Call("DELETE", path, nil, params)
}
// GetFileDownload get file content by its unique ID. The endpoint response
// return with a 'Content-Disposition: attachment' header that tells the
// browser to start downloading the file to user downloads directory.
func (srv *Storage) GetFileDownload(FileId string) (map[string]interface{}, error) {
// GetDownload get file content by its unique ID. The endpoint response return
// with a 'Content-Disposition: attachment' header that tells the browser to
// start downloading the file to user downloads directory.
func (srv *Storage) GetDownload(FileId string) (map[string]interface{}, error) {
r := strings.NewReplacer("{fileId}", FileId)
path := r.Replace("/storage/files/{fileId}/download")
@@ -99,12 +99,12 @@ func (srv *Storage) GetFileDownload(FileId string) (map[string]interface{}, erro
return srv.client.Call("GET", path, nil, params)
}
// GetFilePreview get a file preview image. Currently, this method supports
// GetPreview get a file preview image. Currently, this method supports
// preview for image files (jpg, png, and gif), other supported formats, like
// pdf, docs, slides, and spreadsheets, will return the file icon image. You
// can also pass query string arguments for cutting and resizing your preview
// image.
func (srv *Storage) GetFilePreview(FileId string, Width int, Height int, Quality int, Background string, Output string) (map[string]interface{}, error) {
func (srv *Storage) GetPreview(FileId string, Width int, Height int, Quality int, Background string, Output string) (map[string]interface{}, error) {
r := strings.NewReplacer("{fileId}", FileId)
path := r.Replace("/storage/files/{fileId}/preview")
@@ -119,10 +119,10 @@ func (srv *Storage) GetFilePreview(FileId string, Width int, Height int, Quality
return srv.client.Call("GET", path, nil, params)
}
// GetFileView get file content by its unique ID. This endpoint is similar to
// the download method but returns with no 'Content-Disposition: attachment'
// GetView get file content by its unique ID. This endpoint is similar to the
// download method but returns with no 'Content-Disposition: attachment'
// header.
func (srv *Storage) GetFileView(FileId string, As string) (map[string]interface{}, error) {
func (srv *Storage) GetView(FileId string, As string) (map[string]interface{}, error) {
r := strings.NewReplacer("{fileId}", FileId)
path := r.Replace("/storage/files/{fileId}/view")
+27 -27
View File
@@ -17,11 +17,11 @@ func NewTeams(clt Client) Teams {
return service
}
// ListTeams 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 teams. [Learn more about different API
// List 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 teams. [Learn more about different API
// modes](/docs/admin).
func (srv *Teams) ListTeams(Search string, Limit int, Offset int, OrderType string) (map[string]interface{}, error) {
func (srv *Teams) List(Search string, Limit int, Offset int, OrderType string) (map[string]interface{}, error) {
path := "/teams"
params := map[string]interface{}{
@@ -34,11 +34,11 @@ func (srv *Teams) ListTeams(Search string, Limit int, Offset int, OrderType stri
return srv.client.Call("GET", path, nil, params)
}
// CreateTeam 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.
func (srv *Teams) CreateTeam(Name string, Roles []interface{}) (map[string]interface{}, error) {
// Create 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.
func (srv *Teams) Create(Name string, Roles []interface{}) (map[string]interface{}, error) {
path := "/teams"
params := map[string]interface{}{
@@ -49,9 +49,9 @@ func (srv *Teams) CreateTeam(Name string, Roles []interface{}) (map[string]inter
return srv.client.Call("POST", path, nil, params)
}
// GetTeam get team by its unique ID. All team members have read access for
// this resource.
func (srv *Teams) GetTeam(TeamId string) (map[string]interface{}, error) {
// Get get team by its unique ID. All team members have read access for this
// resource.
func (srv *Teams) Get(TeamId string) (map[string]interface{}, error) {
r := strings.NewReplacer("{teamId}", TeamId)
path := r.Replace("/teams/{teamId}")
@@ -61,9 +61,9 @@ func (srv *Teams) GetTeam(TeamId string) (map[string]interface{}, error) {
return srv.client.Call("GET", path, nil, params)
}
// UpdateTeam update team by its unique ID. Only team owners have write access
// for this resource.
func (srv *Teams) UpdateTeam(TeamId string, Name string) (map[string]interface{}, error) {
// Update update team by its unique ID. Only team owners have write access for
// this resource.
func (srv *Teams) Update(TeamId string, Name string) (map[string]interface{}, error) {
r := strings.NewReplacer("{teamId}", TeamId)
path := r.Replace("/teams/{teamId}")
@@ -74,9 +74,9 @@ func (srv *Teams) UpdateTeam(TeamId string, Name string) (map[string]interface{}
return srv.client.Call("PUT", path, nil, params)
}
// DeleteTeam delete team by its unique ID. Only team owners have write access
// for this resource.
func (srv *Teams) DeleteTeam(TeamId string) (map[string]interface{}, error) {
// Delete delete team by its unique ID. Only team owners have write access for
// this resource.
func (srv *Teams) Delete(TeamId string) (map[string]interface{}, error) {
r := strings.NewReplacer("{teamId}", TeamId)
path := r.Replace("/teams/{teamId}")
@@ -86,9 +86,9 @@ func (srv *Teams) DeleteTeam(TeamId string) (map[string]interface{}, error) {
return srv.client.Call("DELETE", path, nil, params)
}
// GetTeamMemberships get team members by the team unique ID. All team members
// GetMemberships get team members by the team unique ID. All team members
// have read access for this list of resources.
func (srv *Teams) GetTeamMemberships(TeamId string) (map[string]interface{}, error) {
func (srv *Teams) GetMemberships(TeamId string) (map[string]interface{}, error) {
r := strings.NewReplacer("{teamId}", TeamId)
path := r.Replace("/teams/{teamId}/memberships")
@@ -98,8 +98,8 @@ func (srv *Teams) GetTeamMemberships(TeamId string) (map[string]interface{}, err
return srv.client.Call("GET", path, nil, params)
}
// CreateTeamMembership use this endpoint to invite a new member to your team.
// An email with a link to join the team will be sent to the new member email
// CreateMembership use this endpoint to invite a new member to your team. An
// email with a link to join the team will be sent to the new member email
// address. If member doesn't exists in the project it will be automatically
// created.
//
@@ -112,7 +112,7 @@ func (srv *Teams) GetTeamMemberships(TeamId string) (map[string]interface{}, err
// Attacks](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.
func (srv *Teams) CreateTeamMembership(TeamId string, Email string, Roles []interface{}, Url string, Name string) (map[string]interface{}, error) {
func (srv *Teams) CreateMembership(TeamId string, Email string, Roles []interface{}, Url string, Name string) (map[string]interface{}, error) {
r := strings.NewReplacer("{teamId}", TeamId)
path := r.Replace("/teams/{teamId}/memberships")
@@ -126,10 +126,10 @@ func (srv *Teams) CreateTeamMembership(TeamId string, Email string, Roles []inte
return srv.client.Call("POST", path, nil, params)
}
// DeleteTeamMembership this endpoint allows a user to leave a team or for a
// team owner to delete the membership of any other team member. You can also
// use this endpoint to delete a user membership even if he didn't accept it.
func (srv *Teams) DeleteTeamMembership(TeamId string, InviteId string) (map[string]interface{}, error) {
// DeleteMembership this endpoint allows a user to leave a team or for a team
// owner to delete the membership of any other team member. You can also use
// this endpoint to delete a user membership even if he didn't accept it.
func (srv *Teams) DeleteMembership(TeamId string, InviteId string) (map[string]interface{}, error) {
r := strings.NewReplacer("{teamId}", TeamId, "{inviteId}", InviteId)
path := r.Replace("/teams/{teamId}/memberships/{inviteId}")
+22 -22
View File
@@ -17,9 +17,9 @@ func NewUsers(clt Client) Users {
return service
}
// ListUsers get a list of all the project users. You can use the query params
// to filter your results.
func (srv *Users) ListUsers(Search string, Limit int, Offset int, OrderType string) (map[string]interface{}, error) {
// List get a list of all the project users. You can use the query params to
// filter your results.
func (srv *Users) List(Search string, Limit int, Offset int, OrderType string) (map[string]interface{}, error) {
path := "/users"
params := map[string]interface{}{
@@ -32,8 +32,8 @@ func (srv *Users) ListUsers(Search string, Limit int, Offset int, OrderType stri
return srv.client.Call("GET", path, nil, params)
}
// CreateUser create a new user.
func (srv *Users) CreateUser(Email string, Password string, Name string) (map[string]interface{}, error) {
// Create create a new user.
func (srv *Users) Create(Email string, Password string, Name string) (map[string]interface{}, error) {
path := "/users"
params := map[string]interface{}{
@@ -45,8 +45,8 @@ func (srv *Users) CreateUser(Email string, Password string, Name string) (map[st
return srv.client.Call("POST", path, nil, params)
}
// GetUser get user by its unique ID.
func (srv *Users) GetUser(UserId string) (map[string]interface{}, error) {
// Get get user by its unique ID.
func (srv *Users) Get(UserId string) (map[string]interface{}, error) {
r := strings.NewReplacer("{userId}", UserId)
path := r.Replace("/users/{userId}")
@@ -56,8 +56,8 @@ func (srv *Users) GetUser(UserId string) (map[string]interface{}, error) {
return srv.client.Call("GET", path, nil, params)
}
// GetUserLogs get user activity logs list by its unique ID.
func (srv *Users) GetUserLogs(UserId string) (map[string]interface{}, error) {
// GetLogs get user activity logs list by its unique ID.
func (srv *Users) GetLogs(UserId string) (map[string]interface{}, error) {
r := strings.NewReplacer("{userId}", UserId)
path := r.Replace("/users/{userId}/logs")
@@ -67,8 +67,8 @@ func (srv *Users) GetUserLogs(UserId string) (map[string]interface{}, error) {
return srv.client.Call("GET", path, nil, params)
}
// GetUserPrefs get user preferences by its unique ID.
func (srv *Users) GetUserPrefs(UserId string) (map[string]interface{}, error) {
// GetPrefs get user preferences by its unique ID.
func (srv *Users) GetPrefs(UserId string) (map[string]interface{}, error) {
r := strings.NewReplacer("{userId}", UserId)
path := r.Replace("/users/{userId}/prefs")
@@ -78,9 +78,9 @@ func (srv *Users) GetUserPrefs(UserId string) (map[string]interface{}, error) {
return srv.client.Call("GET", path, nil, params)
}
// UpdateUserPrefs update user preferences by its unique ID. You can pass only
// the specific settings you wish to update.
func (srv *Users) UpdateUserPrefs(UserId string, Prefs string) (map[string]interface{}, error) {
// UpdatePrefs update user preferences by its unique ID. You can pass only the
// specific settings you wish to update.
func (srv *Users) UpdatePrefs(UserId string, Prefs string) (map[string]interface{}, error) {
r := strings.NewReplacer("{userId}", UserId)
path := r.Replace("/users/{userId}/prefs")
@@ -91,8 +91,8 @@ func (srv *Users) UpdateUserPrefs(UserId string, Prefs string) (map[string]inter
return srv.client.Call("PATCH", path, nil, params)
}
// GetUserSessions get user sessions list by its unique ID.
func (srv *Users) GetUserSessions(UserId string) (map[string]interface{}, error) {
// GetSessions get user sessions list by its unique ID.
func (srv *Users) GetSessions(UserId string) (map[string]interface{}, error) {
r := strings.NewReplacer("{userId}", UserId)
path := r.Replace("/users/{userId}/sessions")
@@ -102,8 +102,8 @@ func (srv *Users) GetUserSessions(UserId string) (map[string]interface{}, error)
return srv.client.Call("GET", path, nil, params)
}
// DeleteUserSessions delete all user sessions by its unique ID.
func (srv *Users) DeleteUserSessions(UserId string) (map[string]interface{}, error) {
// DeleteSessions delete all user sessions by its unique ID.
func (srv *Users) DeleteSessions(UserId string) (map[string]interface{}, error) {
r := strings.NewReplacer("{userId}", UserId)
path := r.Replace("/users/{userId}/sessions")
@@ -113,8 +113,8 @@ func (srv *Users) DeleteUserSessions(UserId string) (map[string]interface{}, err
return srv.client.Call("DELETE", path, nil, params)
}
// DeleteUserSession delete user sessions by its unique ID.
func (srv *Users) DeleteUserSession(UserId string, SessionId string) (map[string]interface{}, error) {
// DeleteSession delete user sessions by its unique ID.
func (srv *Users) DeleteSession(UserId string, SessionId string) (map[string]interface{}, error) {
r := strings.NewReplacer("{userId}", UserId)
path := r.Replace("/users/{userId}/sessions/:session")
@@ -125,8 +125,8 @@ func (srv *Users) DeleteUserSession(UserId string, SessionId string) (map[string
return srv.client.Call("DELETE", path, nil, params)
}
// UpdateUserStatus update user status by its unique ID.
func (srv *Users) UpdateUserStatus(UserId string, Status string) (map[string]interface{}, error) {
// UpdateStatus update user status by its unique ID.
func (srv *Users) UpdateStatus(UserId string, Status string) (map[string]interface{}, error) {
r := strings.NewReplacer("{userId}", UserId)
path := r.Replace("/users/{userId}/status")
@@ -1,12 +0,0 @@
let sdk = new Appwrite();
sdk
;
let promise = sdk.account.createAccountSessionOAuth('bitbucket', 'https://example.com', 'https://example.com');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
@@ -0,0 +1,12 @@
let sdk = new Appwrite();
sdk
;
let promise = sdk.account.createOAuthSession('bitbucket', 'https://example.com', 'https://example.com');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
@@ -0,0 +1,12 @@
let sdk = new Appwrite();
sdk
;
let promise = sdk.account.createRecovery('email@example.com', 'https://example.com');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
@@ -3,7 +3,7 @@ let sdk = new Appwrite();
sdk
;
let promise = sdk.account.createAccount('email@example.com', 'password');
let promise = sdk.account.createSession('email@example.com', 'password');
promise.then(function (response) {
console.log(response);
@@ -0,0 +1,12 @@
let sdk = new Appwrite();
sdk
;
let promise = sdk.account.create('email@example.com', 'password');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
@@ -0,0 +1,13 @@
let sdk = new Appwrite();
sdk
.setProject('')
;
let promise = sdk.account.deleteCurrentSession();
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
@@ -0,0 +1,13 @@
let sdk = new Appwrite();
sdk
.setProject('')
;
let promise = sdk.account.deleteSession('[ID]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
@@ -4,7 +4,7 @@ sdk
.setProject('')
;
let promise = sdk.account.getAccountLogs();
let promise = sdk.account.deleteSessions();
promise.then(function (response) {
console.log(response);
@@ -4,7 +4,7 @@ sdk
.setProject('')
;
let promise = sdk.teams.listTeams();
let promise = sdk.account.getLogs();
promise.then(function (response) {
console.log(response);
@@ -4,7 +4,7 @@ sdk
.setProject('')
;
let promise = sdk.locale.getLocale();
let promise = sdk.account.getPrefs();
promise.then(function (response) {
console.log(response);
@@ -0,0 +1,13 @@
let sdk = new Appwrite();
sdk
.setProject('')
;
let promise = sdk.account.getSessions();
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
@@ -4,7 +4,7 @@ sdk
.setProject('')
;
let promise = sdk.storage.listFiles();
let promise = sdk.account.get();
promise.then(function (response) {
console.log(response);
@@ -1,13 +0,0 @@
let sdk = new Appwrite();
sdk
.setProject('')
;
let promise = sdk.account.updateAccountName('[NAME]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
@@ -1,13 +0,0 @@
let sdk = new Appwrite();
sdk
.setProject('')
;
let promise = sdk.account.updateAccountPassword('password', 'password');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
@@ -1,12 +0,0 @@
let sdk = new Appwrite();
sdk
;
let promise = sdk.account.updateAccountRecovery('[USER_ID]', '[SECRET]', 'password', 'password');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
@@ -1,12 +0,0 @@
let sdk = new Appwrite();
sdk
;
let promise = sdk.account.updateAccountVerification('[USER_ID]', '[SECRET]', 'password');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
@@ -4,7 +4,7 @@ sdk
.setProject('')
;
let promise = sdk.account.getAccountSessions();
let promise = sdk.account.updateName('[NAME]');
promise.then(function (response) {
console.log(response);
@@ -4,7 +4,7 @@ sdk
.setProject('')
;
let promise = sdk.account.deleteAccountCurrentSession();
let promise = sdk.account.updatePassword('password', 'password');
promise.then(function (response) {
console.log(response);
@@ -0,0 +1,12 @@
let sdk = new Appwrite();
sdk
;
let promise = sdk.account.updateRecovery('[USER_ID]', '[SECRET]', 'password', 'password');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
@@ -3,7 +3,7 @@ let sdk = new Appwrite();
sdk
;
let promise = sdk.account.createAccountSession('email@example.com', 'password');
let promise = sdk.account.updateVerification('[USER_ID]', '[SECRET]', 'password');
promise.then(function (response) {
console.log(response);
@@ -4,7 +4,7 @@ sdk
.setProject('')
;
let promise = sdk.account.getAccount();
let promise = sdk.locale.get();
promise.then(function (response) {
console.log(response);
@@ -1,13 +0,0 @@
let sdk = new Appwrite();
sdk
.setProject('')
;
let promise = sdk.storage.createFile(document.getElementById('uploader').files[0], [], []);
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
@@ -0,0 +1,13 @@
let sdk = new Appwrite();
sdk
.setProject('')
;
let promise = sdk.storage.create(document.getElementById('uploader').files[0], [], []);
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
@@ -1,13 +0,0 @@
let sdk = new Appwrite();
sdk
.setProject('')
;
let promise = sdk.storage.deleteFile('[FILE_ID]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
@@ -0,0 +1,13 @@
let sdk = new Appwrite();
sdk
.setProject('')
;
let promise = sdk.storage.delete('[FILE_ID]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
@@ -0,0 +1,13 @@
let sdk = new Appwrite();
sdk
.setProject('')
;
let promise = sdk.storage.getDownload('[FILE_ID]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
@@ -1,13 +0,0 @@
let sdk = new Appwrite();
sdk
.setProject('')
;
let promise = sdk.storage.getFileDownload('[FILE_ID]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
@@ -1,13 +0,0 @@
let sdk = new Appwrite();
sdk
.setProject('')
;
let promise = sdk.storage.getFilePreview('[FILE_ID]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
@@ -1,13 +0,0 @@
let sdk = new Appwrite();
sdk
.setProject('')
;
let promise = sdk.storage.getFileView('[FILE_ID]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
@@ -1,13 +0,0 @@
let sdk = new Appwrite();
sdk
.setProject('')
;
let promise = sdk.storage.getFile('[FILE_ID]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
@@ -4,7 +4,7 @@ sdk
.setProject('')
;
let promise = sdk.account.deleteAccountSessions();
let promise = sdk.storage.getPreview('[FILE_ID]');
promise.then(function (response) {
console.log(response);
@@ -0,0 +1,13 @@
let sdk = new Appwrite();
sdk
.setProject('')
;
let promise = sdk.storage.getView('[FILE_ID]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
@@ -0,0 +1,13 @@
let sdk = new Appwrite();
sdk
.setProject('')
;
let promise = sdk.storage.get('[FILE_ID]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
@@ -0,0 +1,13 @@
let sdk = new Appwrite();
sdk
.setProject('')
;
let promise = sdk.storage.list();
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
@@ -1,13 +0,0 @@
let sdk = new Appwrite();
sdk
.setProject('')
;
let promise = sdk.storage.updateFile('[FILE_ID]', [], []);
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
@@ -0,0 +1,13 @@
let sdk = new Appwrite();
sdk
.setProject('')
;
let promise = sdk.storage.update('[FILE_ID]', [], []);
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
@@ -0,0 +1,13 @@
let sdk = new Appwrite();
sdk
.setProject('')
;
let promise = sdk.teams.createMembership('[TEAM_ID]', 'email@example.com', [], 'https://example.com');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
@@ -1,13 +0,0 @@
let sdk = new Appwrite();
sdk
.setProject('')
;
let promise = sdk.teams.createTeamMembership('[TEAM_ID]', 'email@example.com', [], 'https://example.com');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
@@ -1,13 +0,0 @@
let sdk = new Appwrite();
sdk
.setProject('')
;
let promise = sdk.teams.createTeam('[NAME]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
@@ -0,0 +1,13 @@
let sdk = new Appwrite();
sdk
.setProject('')
;
let promise = sdk.teams.create('[NAME]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
@@ -4,7 +4,7 @@ sdk
.setProject('')
;
let promise = sdk.account.deleteAccountSession('[ID]');
let promise = sdk.teams.deleteMembership('[TEAM_ID]', '[INVITE_ID]');
promise.then(function (response) {
console.log(response);
@@ -1,13 +0,0 @@
let sdk = new Appwrite();
sdk
.setProject('')
;
let promise = sdk.teams.deleteTeamMembership('[TEAM_ID]', '[INVITE_ID]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
@@ -1,13 +0,0 @@
let sdk = new Appwrite();
sdk
.setProject('')
;
let promise = sdk.teams.deleteTeam('[TEAM_ID]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
@@ -4,7 +4,7 @@ sdk
.setProject('')
;
let promise = sdk.account.getAccountPrefs();
let promise = sdk.teams.delete('[TEAM_ID]');
promise.then(function (response) {
console.log(response);
@@ -0,0 +1,13 @@
let sdk = new Appwrite();
sdk
.setProject('')
;
let promise = sdk.teams.getMemberships('[TEAM_ID]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
@@ -1,13 +0,0 @@
let sdk = new Appwrite();
sdk
.setProject('')
;
let promise = sdk.teams.getTeamMemberships('[TEAM_ID]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});

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