Updated all SDKs

This commit is contained in:
Eldad Fux
2020-01-28 15:16:33 +02:00
parent b5a73340c2
commit 007dfbe043
705 changed files with 163 additions and 26466 deletions
+13
View File
@@ -15,6 +15,7 @@ $langDart = [
'url' => 'https://github.com/appwrite/sdk-for-dart',
'enabled' => true,
'beta' => false,
'family' => APP_PLATFORM_CLIENT,
'prism' => 'dart',
'source' => realpath(__DIR__ . '/../sdks/dart'),
'gitUrl' => 'git@github.com:appwrite/sdk-for-dart.git',
@@ -35,6 +36,7 @@ return [
'url' => 'https://github.com/appwrite/sdk-for-js',
'enabled' => true,
'beta' => false,
'family' => APP_PLATFORM_CLIENT,
'prism' => 'javascript',
'source' => realpath(__DIR__ . '/../sdks/javascript'),
'gitUrl' => 'git@github.com:appwrite/sdk-for-js.git',
@@ -47,6 +49,7 @@ return [
'url' => '',
'enabled' => false,
'beta' => false,
'family' => APP_PLATFORM_CLIENT,
'prism' => 'typescript',
'source' => false,
'gitUrl' => 'git@github.com:appwrite/sdk-for-typescript.git',
@@ -67,6 +70,7 @@ return [
'url' => '',
'enabled' => false,
'beta' => false,
'family' => APP_PLATFORM_CLIENT,
'prism' => 'swift',
'source' => false,
'gitUrl' => 'git@github.com:appwrite/sdk-for-swift.git',
@@ -79,6 +83,7 @@ return [
'url' => '',
'enabled' => false,
'beta' => false,
'family' => APP_PLATFORM_CLIENT,
'prism' => '',
'source' => false,
'gitUrl' => 'git@github.com:appwrite/sdk-for-objective-c.git',
@@ -99,6 +104,7 @@ return [
'url' => '',
'enabled' => false,
'beta' => false,
'family' => APP_PLATFORM_CLIENT,
'prism' => 'kotlin',
'source' => false,
'gitUrl' => 'git@github.com:appwrite/sdk-for-kotlin.git',
@@ -111,6 +117,7 @@ return [
'url' => '',
'enabled' => false,
'beta' => false,
'family' => APP_PLATFORM_CLIENT,
'prism' => 'java',
'source' => false,
'gitUrl' => 'git@github.com:appwrite/sdk-for-java.git',
@@ -132,6 +139,7 @@ return [
'url' => 'https://github.com/appwrite/sdk-for-node',
'enabled' => true,
'beta' => false,
'family' => APP_PLATFORM_SERVER,
'prism' => 'javascript',
'source' => realpath(__DIR__ . '/../sdks/node'),
'gitUrl' => 'git@github.com:appwrite/sdk-for-node.git',
@@ -144,6 +152,8 @@ return [
'version' => '1.0.16',
'url' => 'https://github.com/appwrite/sdk-for-php',
'enabled' => true,
'beta' => false,
'family' => APP_PLATFORM_SERVER,
'prism' => 'php',
'source' => realpath(__DIR__ . '/../sdks/php'),
'gitUrl' => 'git@github.com:appwrite/sdk-for-php.git',
@@ -157,6 +167,7 @@ return [
'url' => 'https://github.com/appwrite/sdk-for-python',
'enabled' => true,
'beta' => true,
'family' => APP_PLATFORM_SERVER,
'prism' => 'python',
'source' => realpath(__DIR__ . '/../sdks/python'),
'gitUrl' => 'git@github.com:appwrite/sdk-for-python.git',
@@ -170,6 +181,7 @@ return [
'url' => 'https://github.com/appwrite/sdk-for-go',
'enabled' => true,
'beta' => true,
'family' => APP_PLATFORM_SERVER,
'prism' => 'go',
'source' => realpath(__DIR__ . '/../sdks/go'),
'gitUrl' => 'git@github.com:appwrite/sdk-for-go.git',
@@ -183,6 +195,7 @@ return [
'url' => 'https://github.com/appwrite/sdk-for-ruby',
'enabled' => true,
'beta' => true,
'family' => APP_PLATFORM_SERVER,
'prism' => 'ruby',
'source' => realpath(__DIR__ . '/../sdks/ruby'),
'gitUrl' => 'git@github.com:appwrite/sdk-for-ruby.git',
-14
View File
@@ -1,14 +0,0 @@
# Generated by pub on 2019-12-05 18:55:11.878585.
charcode:file:///Users/eldadfux/.pub-cache/hosted/pub.dartlang.org/charcode-1.1.2/lib/
collection:file:///Users/eldadfux/.pub-cache/hosted/pub.dartlang.org/collection-1.14.12/lib/
cookie_jar:file:///Users/eldadfux/.pub-cache/hosted/pub.dartlang.org/cookie_jar-1.0.1/lib/
dio:file:///Users/eldadfux/.pub-cache/hosted/pub.dartlang.org/dio-3.0.3/lib/
dio_cookie_manager:file:///Users/eldadfux/.pub-cache/hosted/pub.dartlang.org/dio_cookie_manager-1.0.0/lib/
http_parser:file:///Users/eldadfux/.pub-cache/hosted/pub.dartlang.org/http_parser-3.1.3/lib/
meta:file:///Users/eldadfux/.pub-cache/hosted/pub.dartlang.org/meta-1.1.7/lib/
path:file:///Users/eldadfux/.pub-cache/hosted/pub.dartlang.org/path-1.6.4/lib/
source_span:file:///Users/eldadfux/.pub-cache/hosted/pub.dartlang.org/source_span-1.5.5/lib/
string_scanner:file:///Users/eldadfux/.pub-cache/hosted/pub.dartlang.org/string_scanner-1.0.5/lib/
term_glyph:file:///Users/eldadfux/.pub-cache/hosted/pub.dartlang.org/term_glyph-1.1.0/lib/
typed_data:file:///Users/eldadfux/.pub-cache/hosted/pub.dartlang.org/typed_data-1.1.6/lib/
appwrite:lib/
-12
View File
@@ -1,12 +0,0 @@
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.
-31
View File
@@ -1,31 +0,0 @@
# 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)
**WORK IN PROGRESS - NOT READY FOR USAGE - Want to help us improve this client SDK? Send a pull request to Appwrite [SDK generator repository](https://github.com/appwrite/sdk-generator).**
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.
-11
View File
@@ -1,11 +0,0 @@
export 'package:appwrite/services/account.dart';
export 'package:appwrite/services/auth.dart';
export 'package:appwrite/services/avatars.dart';
export 'package:appwrite/services/database.dart';
export 'package:appwrite/services/locale.dart';
export 'package:appwrite/services/projects.dart';
export 'package:appwrite/services/storage.dart';
export 'package:appwrite/services/teams.dart';
export 'package:appwrite/services/users.dart';
export 'package:appwrite/client.dart';
export 'package:dio/dio.dart' show Response;
-100
View File
@@ -1,100 +0,0 @@
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
@@ -1,9 +0,0 @@
import 'package:appwrite/client.dart';
class Service {
Client client;
Service(Client client) {
this.client = client;
}
}
-107
View File
@@ -1,107 +0,0 @@
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);
}
/// 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);
}
/// 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);
}
/// 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> getSecurity() async {
String path = '/account/security';
Map<String, dynamic> params = {
};
return await this.client.call('get', 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);
}
}
-173
View File
@@ -1,173 +0,0 @@
import "package:appwrite/service.dart";
import "package:appwrite/client.dart";
import 'package:dio/dio.dart';
class Auth extends Service {
Auth(Client client): super(client);
/// 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 notice 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> login({email, password, success = null, failure = null}) async {
String path = '/auth/login';
Map<String, dynamic> params = {
'email': email,
'password': password,
'success': success,
'failure': failure,
};
return await this.client.call('post', 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> oauth({provider, success, failure}) async {
String path = '/auth/login/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 his account.
/// When successful this endpoint will delete the user session and remove the
/// session secret cookie from the user client.
Future<Response> logout() async {
String path = '/auth/logout';
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 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> logoutBySession({id}) async {
String path = '/auth/logout/{id}'.replaceAll(RegExp('{id}'), id);
Map<String, dynamic> params = {
};
return await this.client.call('delete', path: path, params: params);
}
/// Sends the user an email with a temporary secret token for password reset.
/// When the user clicks the confirmation link he is redirected back to your
/// app password reset redirect URL with a secret token 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> recovery({email, reset}) async {
String path = '/auth/recovery';
Map<String, dynamic> params = {
'email': email,
'reset': reset,
};
return await this.client.call('post', path: path, params: params);
}
/// Use this endpoint to complete the user account password reset. Both the
/// **userId** and **token** arguments will be passed as query parameters to
/// the redirect URL you have provided when sending your request to the
/// /auth/recovery endpoint.
///
/// Please notice 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> recoveryReset({userId, token, passwordA, passwordB}) async {
String path = '/auth/recovery/reset';
Map<String, dynamic> params = {
'userId': userId,
'token': token,
'password-a': passwordA,
'password-b': passwordB,
};
return await this.client.call('put', 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 notice 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> register({email, password, confirm, success = null, failure = null, name = null}) async {
String path = '/auth/register';
Map<String, dynamic> params = {
'email': email,
'password': password,
'confirm': confirm,
'success': success,
'failure': failure,
'name': name,
};
return await this.client.call('post', path: path, params: params);
}
/// Use this endpoint to complete the confirmation of the user account email
/// address. Both the **userId** and **token** arguments will be passed as
/// query parameters to the redirect URL you have provided when sending your
/// request to the /auth/register endpoint.
Future<Response> confirm({userId, token}) async {
String path = '/auth/register/confirm';
Map<String, dynamic> params = {
'userId': userId,
'token': token,
};
return await this.client.call('post', path: path, params: params);
}
/// This endpoint allows the user to request your app to resend him his email
/// confirmation message. The redirect arguments act the same way as in
/// /auth/register endpoint.
///
/// Please notice 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> confirmResend({confirm}) async {
String path = '/auth/register/confirm/resend';
Map<String, dynamic> params = {
'confirm': confirm,
};
return await this.client.call('post', path: path, params: params);
}
}
-93
View File
@@ -1,93 +0,0 @@
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
@@ -1,139 +0,0 @@
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';
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';
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/{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/{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/{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/{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/{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/{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/{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/{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);
}
}
-73
View File
@@ -1,73 +0,0 @@
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.
Future<Response> getLocale() 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. UK brexit date is
/// currently set to 2019-10-31 and will be updated if and when needed.
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);
}
}
-292
View File
@@ -1,292 +0,0 @@
import "package:appwrite/service.dart";
import "package:appwrite/client.dart";
import 'package:dio/dio.dart';
class Projects extends Service {
Projects(Client client): super(client);
Future<Response> listProjects() async {
String path = '/projects';
Map<String, dynamic> params = {
};
return await this.client.call('get', path: path, params: params);
}
Future<Response> createProject({name, teamId, description = null, logo = null, url = null, legalName = null, legalCountry = null, legalState = null, legalCity = null, legalAddress = null, legalTaxId = null}) async {
String path = '/projects';
Map<String, dynamic> params = {
'name': name,
'teamId': teamId,
'description': description,
'logo': logo,
'url': url,
'legalName': legalName,
'legalCountry': legalCountry,
'legalState': legalState,
'legalCity': legalCity,
'legalAddress': legalAddress,
'legalTaxId': legalTaxId,
};
return await this.client.call('post', path: path, params: params);
}
Future<Response> getProject({projectId}) async {
String path = '/projects/{projectId}'.replaceAll(RegExp('{projectId}'), projectId);
Map<String, dynamic> params = {
};
return await this.client.call('get', path: path, params: params);
}
Future<Response> updateProject({projectId, name, description = null, logo = null, url = null, legalName = null, legalCountry = null, legalState = null, legalCity = null, legalAddress = null, legalTaxId = null}) async {
String path = '/projects/{projectId}'.replaceAll(RegExp('{projectId}'), projectId);
Map<String, dynamic> params = {
'name': name,
'description': description,
'logo': logo,
'url': url,
'legalName': legalName,
'legalCountry': legalCountry,
'legalState': legalState,
'legalCity': legalCity,
'legalAddress': legalAddress,
'legalTaxId': legalTaxId,
};
return await this.client.call('patch', path: path, params: params);
}
Future<Response> deleteProject({projectId}) async {
String path = '/projects/{projectId}'.replaceAll(RegExp('{projectId}'), projectId);
Map<String, dynamic> params = {
};
return await this.client.call('delete', path: path, params: params);
}
Future<Response> listKeys({projectId}) async {
String path = '/projects/{projectId}/keys'.replaceAll(RegExp('{projectId}'), projectId);
Map<String, dynamic> params = {
};
return await this.client.call('get', path: path, params: params);
}
Future<Response> createKey({projectId, name, scopes}) async {
String path = '/projects/{projectId}/keys'.replaceAll(RegExp('{projectId}'), projectId);
Map<String, dynamic> params = {
'name': name,
'scopes': scopes,
};
return await this.client.call('post', path: path, params: params);
}
Future<Response> getKey({projectId, keyId}) async {
String path = '/projects/{projectId}/keys/{keyId}'.replaceAll(RegExp('{projectId}'), projectId).replaceAll(RegExp('{keyId}'), keyId);
Map<String, dynamic> params = {
};
return await this.client.call('get', path: path, params: params);
}
Future<Response> updateKey({projectId, keyId, name, scopes}) async {
String path = '/projects/{projectId}/keys/{keyId}'.replaceAll(RegExp('{projectId}'), projectId).replaceAll(RegExp('{keyId}'), keyId);
Map<String, dynamic> params = {
'name': name,
'scopes': scopes,
};
return await this.client.call('put', path: path, params: params);
}
Future<Response> deleteKey({projectId, keyId}) async {
String path = '/projects/{projectId}/keys/{keyId}'.replaceAll(RegExp('{projectId}'), projectId).replaceAll(RegExp('{keyId}'), keyId);
Map<String, dynamic> params = {
};
return await this.client.call('delete', path: path, params: params);
}
Future<Response> updateProjectOAuth({projectId, provider, appId = null, secret = null}) async {
String path = '/projects/{projectId}/oauth'.replaceAll(RegExp('{projectId}'), projectId);
Map<String, dynamic> params = {
'provider': provider,
'appId': appId,
'secret': secret,
};
return await this.client.call('patch', path: path, params: params);
}
Future<Response> listPlatforms({projectId}) async {
String path = '/projects/{projectId}/platforms'.replaceAll(RegExp('{projectId}'), projectId);
Map<String, dynamic> params = {
};
return await this.client.call('get', path: path, params: params);
}
Future<Response> createPlatform({projectId, type, name, key = null, store = null, url = null}) async {
String path = '/projects/{projectId}/platforms'.replaceAll(RegExp('{projectId}'), projectId);
Map<String, dynamic> params = {
'type': type,
'name': name,
'key': key,
'store': store,
'url': url,
};
return await this.client.call('post', path: path, params: params);
}
Future<Response> getPlatform({projectId, platformId}) async {
String path = '/projects/{projectId}/platforms/{platformId}'.replaceAll(RegExp('{projectId}'), projectId).replaceAll(RegExp('{platformId}'), platformId);
Map<String, dynamic> params = {
};
return await this.client.call('get', path: path, params: params);
}
Future<Response> updatePlatform({projectId, platformId, name, key = null, store = null, url = null}) async {
String path = '/projects/{projectId}/platforms/{platformId}'.replaceAll(RegExp('{projectId}'), projectId).replaceAll(RegExp('{platformId}'), platformId);
Map<String, dynamic> params = {
'name': name,
'key': key,
'store': store,
'url': url,
};
return await this.client.call('put', path: path, params: params);
}
Future<Response> deletePlatform({projectId, platformId}) async {
String path = '/projects/{projectId}/platforms/{platformId}'.replaceAll(RegExp('{projectId}'), projectId).replaceAll(RegExp('{platformId}'), platformId);
Map<String, dynamic> params = {
};
return await this.client.call('delete', path: path, params: params);
}
Future<Response> listTasks({projectId}) async {
String path = '/projects/{projectId}/tasks'.replaceAll(RegExp('{projectId}'), projectId);
Map<String, dynamic> params = {
};
return await this.client.call('get', path: path, params: params);
}
Future<Response> createTask({projectId, name, status, schedule, security, httpMethod, httpUrl, httpHeaders = null, httpUser = null, httpPass = null}) async {
String path = '/projects/{projectId}/tasks'.replaceAll(RegExp('{projectId}'), projectId);
Map<String, dynamic> params = {
'name': name,
'status': status,
'schedule': schedule,
'security': security,
'httpMethod': httpMethod,
'httpUrl': httpUrl,
'httpHeaders': httpHeaders,
'httpUser': httpUser,
'httpPass': httpPass,
};
return await this.client.call('post', path: path, params: params);
}
Future<Response> getTask({projectId, taskId}) async {
String path = '/projects/{projectId}/tasks/{taskId}'.replaceAll(RegExp('{projectId}'), projectId).replaceAll(RegExp('{taskId}'), taskId);
Map<String, dynamic> params = {
};
return await this.client.call('get', path: path, params: params);
}
Future<Response> updateTask({projectId, taskId, name, status, schedule, security, httpMethod, httpUrl, httpHeaders = null, httpUser = null, httpPass = null}) async {
String path = '/projects/{projectId}/tasks/{taskId}'.replaceAll(RegExp('{projectId}'), projectId).replaceAll(RegExp('{taskId}'), taskId);
Map<String, dynamic> params = {
'name': name,
'status': status,
'schedule': schedule,
'security': security,
'httpMethod': httpMethod,
'httpUrl': httpUrl,
'httpHeaders': httpHeaders,
'httpUser': httpUser,
'httpPass': httpPass,
};
return await this.client.call('put', path: path, params: params);
}
Future<Response> deleteTask({projectId, taskId}) async {
String path = '/projects/{projectId}/tasks/{taskId}'.replaceAll(RegExp('{projectId}'), projectId).replaceAll(RegExp('{taskId}'), taskId);
Map<String, dynamic> params = {
};
return await this.client.call('delete', path: path, params: params);
}
Future<Response> getProjectUsage({projectId}) async {
String path = '/projects/{projectId}/usage'.replaceAll(RegExp('{projectId}'), projectId);
Map<String, dynamic> params = {
};
return await this.client.call('get', path: path, params: params);
}
Future<Response> listWebhooks({projectId}) async {
String path = '/projects/{projectId}/webhooks'.replaceAll(RegExp('{projectId}'), projectId);
Map<String, dynamic> params = {
};
return await this.client.call('get', path: path, params: params);
}
Future<Response> createWebhook({projectId, name, events, url, security, httpUser = null, httpPass = null}) async {
String path = '/projects/{projectId}/webhooks'.replaceAll(RegExp('{projectId}'), projectId);
Map<String, dynamic> params = {
'name': name,
'events': events,
'url': url,
'security': security,
'httpUser': httpUser,
'httpPass': httpPass,
};
return await this.client.call('post', path: path, params: params);
}
Future<Response> getWebhook({projectId, webhookId}) async {
String path = '/projects/{projectId}/webhooks/{webhookId}'.replaceAll(RegExp('{projectId}'), projectId).replaceAll(RegExp('{webhookId}'), webhookId);
Map<String, dynamic> params = {
};
return await this.client.call('get', path: path, params: params);
}
Future<Response> updateWebhook({projectId, webhookId, name, events, url, security, httpUser = null, httpPass = null}) async {
String path = '/projects/{projectId}/webhooks/{webhookId}'.replaceAll(RegExp('{projectId}'), projectId).replaceAll(RegExp('{webhookId}'), webhookId);
Map<String, dynamic> params = {
'name': name,
'events': events,
'url': url,
'security': security,
'httpUser': httpUser,
'httpPass': httpPass,
};
return await this.client.call('put', path: path, params: params);
}
Future<Response> deleteWebhook({projectId, webhookId}) async {
String path = '/projects/{projectId}/webhooks/{webhookId}'.replaceAll(RegExp('{projectId}'), projectId).replaceAll(RegExp('{webhookId}'), webhookId);
Map<String, dynamic> params = {
};
return await this.client.call('delete', path: path, params: params);
}
}
-109
View File
@@ -1,109 +0,0 @@
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> listFiles({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> createFile({files, read, write}) async {
String path = '/storage/files';
Map<String, dynamic> params = {
'files': files,
'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> getFile({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> updateFile({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> deleteFile({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> getFileDownload({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 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 file icon image. You can also pass query
/// string arguments for cutting and resizing your preview image.
Future<Response> getFilePreview({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> getFileView({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);
}
}
-152
View File
@@ -1,152 +0,0 @@
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> listTeams({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> createTeam({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> getTeam({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> updateTeam({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> deleteTeam({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> getTeamMembers({teamId}) async {
String path = '/teams/{teamId}/members'.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 redirect parameter to redirect the user from the invitation email
/// back to your app. When the user is redirected, use the
/// /teams/{teamId}/memberships/{inviteId}/status endpoint to finally join the
/// user to the team.
///
/// Please notice 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> createTeamMembership({teamId, email, roles, redirect, name = null}) async {
String path = '/teams/{teamId}/memberships'.replaceAll(RegExp('{teamId}'), teamId);
Map<String, dynamic> params = {
'email': email,
'name': name,
'roles': roles,
'redirect': redirect,
};
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.
Future<Response> deleteTeamMembership({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 resend your invitation email for a user to join a
/// team.
Future<Response> createTeamMembershipResend({teamId, inviteId, redirect}) async {
String path = '/teams/{teamId}/memberships/{inviteId}/resend'.replaceAll(RegExp('{teamId}'), teamId).replaceAll(RegExp('{inviteId}'), inviteId);
Map<String, dynamic> params = {
'redirect': redirect,
};
return await this.client.call('post', 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 notice 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 token.
Future<Response> updateTeamMembershipStatus({teamId, inviteId, userId, secret, success = null, failure = null}) async {
String path = '/teams/{teamId}/memberships/{inviteId}/status'.replaceAll(RegExp('{teamId}'), teamId).replaceAll(RegExp('{inviteId}'), inviteId);
Map<String, dynamic> params = {
'userId': userId,
'secret': secret,
'success': success,
'failure': failure,
};
return await this.client.call('patch', path: path, params: params);
}
}
-111
View File
@@ -1,111 +0,0 @@
import "package:appwrite/service.dart";
import "package:appwrite/client.dart";
import 'package:dio/dio.dart';
class Users extends Service {
Users(Client client): super(client);
/// Get a list of all the project users. You can use the query params to filter
/// your results.
Future<Response> listUsers({search = null, limit = 25, offset = null, orderType = 'ASC'}) async {
String path = '/users';
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 user.
Future<Response> createUser({email, password, name = null}) async {
String path = '/users';
Map<String, dynamic> params = {
'email': email,
'password': password,
'name': name,
};
return await this.client.call('post', path: path, params: params);
}
/// Get user by its unique ID.
Future<Response> getUser({userId}) async {
String path = '/users/{userId}'.replaceAll(RegExp('{userId}'), userId);
Map<String, dynamic> params = {
};
return await this.client.call('get', path: path, params: params);
}
/// Get user activity logs list by its unique ID.
Future<Response> getUserLogs({userId}) async {
String path = '/users/{userId}/logs'.replaceAll(RegExp('{userId}'), userId);
Map<String, dynamic> params = {
};
return await this.client.call('get', path: path, params: params);
}
/// Get user preferences by its unique ID.
Future<Response> getUserPrefs({userId}) async {
String path = '/users/{userId}/prefs'.replaceAll(RegExp('{userId}'), userId);
Map<String, dynamic> params = {
};
return await this.client.call('get', path: path, params: params);
}
/// Update user preferences by its unique ID. You can pass only the specific
/// settings you wish to update.
Future<Response> updateUserPrefs({userId, prefs}) async {
String path = '/users/{userId}/prefs'.replaceAll(RegExp('{userId}'), userId);
Map<String, dynamic> params = {
'prefs': prefs,
};
return await this.client.call('patch', path: path, params: params);
}
/// Get user sessions list by its unique ID.
Future<Response> getUserSessions({userId}) async {
String path = '/users/{userId}/sessions'.replaceAll(RegExp('{userId}'), userId);
Map<String, dynamic> params = {
};
return await this.client.call('get', path: path, params: params);
}
/// Delete all user sessions by its unique ID.
Future<Response> deleteUserSessions({userId}) async {
String path = '/users/{userId}/sessions'.replaceAll(RegExp('{userId}'), userId);
Map<String, dynamic> params = {
};
return await this.client.call('delete', path: path, params: params);
}
/// Delete user sessions by its unique ID.
Future<Response> deleteUserSession({userId, sessionId}) async {
String path = '/users/{userId}/sessions/:session'.replaceAll(RegExp('{userId}'), userId);
Map<String, dynamic> params = {
'sessionId': sessionId,
};
return await this.client.call('delete', path: path, params: params);
}
/// Update user status by its unique ID.
Future<Response> updateUserStatus({userId, status}) async {
String path = '/users/{userId}/status'.replaceAll(RegExp('{userId}'), userId);
Map<String, dynamic> params = {
'status': status,
};
return await this.client.call('patch', path: path, params: params);
}
}
-89
View File
@@ -1,89 +0,0 @@
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.2"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.dartlang.org"
source: hosted
version: "1.14.12"
cookie_jar:
dependency: "direct main"
description:
name: cookie_jar
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
dio:
dependency: "direct main"
description:
name: dio
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.3"
dio_cookie_manager:
dependency: "direct main"
description:
name: dio_cookie_manager
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
http_parser:
dependency: transitive
description:
name: http_parser
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.3"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.7"
path:
dependency: transitive
description:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.4"
source_span:
dependency: transitive
description:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.5.5"
string_scanner:
dependency: transitive
description:
name: string_scanner
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.5"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.6"
sdks:
dart: ">2.4.0 <3.0.0"
-11
View File
@@ -1,11 +0,0 @@
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
-307
View File
@@ -1,307 +0,0 @@
package appwrite
import (
"strings"
)
// Account service
type Account struct {
client *Client
}
// GetAccount get currently logged in user data as JSON object.
func (srv *Account) GetAccount() (map[string]interface{}, error) {
path := "/account"
params := map[string]interface{}{
}
return srv.client.Call("GET", path, nil, params)
}
// CreateAccount 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.
func (srv *Account) CreateAccount(Email string, Password string, Name string) (map[string]interface{}, error) {
path := "/account"
params := map[string]interface{}{
"email": Email,
"password": Password,
"name": Name,
}
return srv.client.Call("POST", path, nil, params)
}
// Delete 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.
func (srv *Account) Delete() (map[string]interface{}, error) {
path := "/account"
params := map[string]interface{}{
}
return srv.client.Call("DELETE", path, nil, params)
}
// UpdateEmail 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.
func (srv *Account) UpdateEmail(Email string, Password string) (map[string]interface{}, error) {
path := "/account/email"
params := map[string]interface{}{
"email": Email,
"password": Password,
}
return srv.client.Call("PATCH", path, nil, params)
}
// GetAccountLogs get currently logged in user list of latest security
// activity logs. Each log returns user IP address, location and date and time
// of log.
func (srv *Account) GetAccountLogs() (map[string]interface{}, error) {
path := "/account/logs"
params := map[string]interface{}{
}
return srv.client.Call("GET", path, nil, params)
}
// UpdateAccountName update currently logged in user account name.
func (srv *Account) UpdateAccountName(Name string) (map[string]interface{}, error) {
path := "/account/name"
params := map[string]interface{}{
"name": Name,
}
return srv.client.Call("PATCH", path, nil, params)
}
// UpdateAccountPassword update currently logged in user password. For
// validation, user is required to pass the password twice.
func (srv *Account) UpdateAccountPassword(Password string, OldPassword string) (map[string]interface{}, error) {
path := "/account/password"
params := map[string]interface{}{
"password": Password,
"old-password": OldPassword,
}
return srv.client.Call("PATCH", path, nil, params)
}
// GetAccountPrefs get currently logged in user preferences key-value object.
func (srv *Account) GetAccountPrefs() (map[string]interface{}, error) {
path := "/account/prefs"
params := map[string]interface{}{
}
return srv.client.Call("GET", path, nil, params)
}
// UpdatePrefs update currently logged in user account preferences. You can
// pass only the specific settings you wish to update.
func (srv *Account) UpdatePrefs(Prefs string) (map[string]interface{}, error) {
path := "/account/prefs"
params := map[string]interface{}{
"prefs": Prefs,
}
return srv.client.Call("PATCH", path, nil, params)
}
// CreateAccountRecovery 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.
func (srv *Account) CreateAccountRecovery(Email string, Url string) (map[string]interface{}, error) {
path := "/account/recovery"
params := map[string]interface{}{
"email": Email,
"url": Url,
}
return srv.client.Call("POST", path, nil, params)
}
// UpdateAccountRecovery 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.
func (srv *Account) UpdateAccountRecovery(UserId string, Secret string, PasswordA string, PasswordB string) (map[string]interface{}, error) {
path := "/account/recovery"
params := map[string]interface{}{
"userId": UserId,
"secret": Secret,
"password-a": PasswordA,
"password-b": PasswordB,
}
return srv.client.Call("PUT", path, nil, params)
}
// GetAccountSessions get currently logged in user list of active sessions
// across different devices.
func (srv *Account) GetAccountSessions() (map[string]interface{}, error) {
path := "/account/sessions"
params := map[string]interface{}{
}
return srv.client.Call("GET", path, nil, params)
}
// CreateAccountSession 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.
func (srv *Account) CreateAccountSession(Email string, Password string) (map[string]interface{}, error) {
path := "/account/sessions"
params := map[string]interface{}{
"email": Email,
"password": Password,
}
return srv.client.Call("POST", path, nil, params)
}
// DeleteAccountSessions delete all sessions from the user account and remove
// any sessions cookies from the end client.
func (srv *Account) DeleteAccountSessions() (map[string]interface{}, error) {
path := "/account/sessions"
params := map[string]interface{}{
}
return srv.client.Call("DELETE", path, nil, params)
}
// DeleteAccountCurrentSession 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.
func (srv *Account) DeleteAccountCurrentSession() (map[string]interface{}, error) {
path := "/account/sessions/current"
params := map[string]interface{}{
}
return srv.client.Call("DELETE", path, nil, params)
}
// CreateAccountSessionOAuth 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.
func (srv *Account) CreateAccountSessionOAuth(Provider string, Success string, Failure string) (map[string]interface{}, error) {
r := strings.NewReplacer("{provider}", Provider)
path := r.Replace("/account/sessions/oauth/{provider}")
params := map[string]interface{}{
"success": Success,
"failure": Failure,
}
return srv.client.Call("GET", path, nil, params)
}
// DeleteAccountSession 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.
func (srv *Account) DeleteAccountSession(Id string) (map[string]interface{}, error) {
r := strings.NewReplacer("{id}", Id)
path := r.Replace("/account/sessions/{id}")
params := map[string]interface{}{
}
return srv.client.Call("DELETE", path, nil, params)
}
// CreateAccountVerification use this endpoint to send a verification message
// to your user email address to confirm they are the valid owners of that
// address. Both the **userId** and **secret** arguments will be passed as
// query parameters to the URL you have provider to be attached to the
// verification email. The provided URL should redirect the user back for your
// app and allow you to complete the verification process by verifying both
// the **userId** and **secret** parameters. Learn more about how to [complete
// the verification process](/docs/account#updateAccountVerification).
//
// 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.
func (srv *Account) CreateAccountVerification(Url string) (map[string]interface{}, error) {
path := "/account/verification"
params := map[string]interface{}{
"url": Url,
}
return srv.client.Call("POST", path, nil, params)
}
// UpdateAccountVerification 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.
func (srv *Account) UpdateAccountVerification(UserId string, Secret string, PasswordB string) (map[string]interface{}, error) {
path := "/account/verification"
params := map[string]interface{}{
"userId": UserId,
"secret": Secret,
"password-b": PasswordB,
}
return srv.client.Call("PUT", path, nil, params)
}
-186
View File
@@ -1,186 +0,0 @@
package appwrite
import (
"strings"
)
// Auth service
type Auth struct {
client *Client
}
// Login 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 notice 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.
func (srv *Auth) Login(Email string, Password string, Success string, Failure string) (map[string]interface{}, error) {
path := "/auth/login"
params := map[string]interface{}{
"email": Email,
"password": Password,
"success": Success,
"failure": Failure,
}
return srv.client.Call("POST", path, nil, params)
}
// Oauth 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.
func (srv *Auth) Oauth(Provider string, Success string, Failure string) (map[string]interface{}, error) {
r := strings.NewReplacer("{provider}", Provider)
path := r.Replace("/auth/login/oauth/{provider}")
params := map[string]interface{}{
"success": Success,
"failure": Failure,
}
return srv.client.Call("GET", path, nil, params)
}
// Logout 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.
func (srv *Auth) Logout() (map[string]interface{}, error) {
path := "/auth/logout"
params := map[string]interface{}{
}
return srv.client.Call("DELETE", path, nil, params)
}
// LogoutBySession 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.
func (srv *Auth) LogoutBySession(Id string) (map[string]interface{}, error) {
r := strings.NewReplacer("{id}", Id)
path := r.Replace("/auth/logout/{id}")
params := map[string]interface{}{
}
return srv.client.Call("DELETE", path, nil, params)
}
// Recovery sends the user an email with a temporary secret token for password
// reset. When the user clicks the confirmation link he is redirected back to
// your app password reset redirect URL with a secret token 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.
func (srv *Auth) Recovery(Email string, Reset string) (map[string]interface{}, error) {
path := "/auth/recovery"
params := map[string]interface{}{
"email": Email,
"reset": Reset,
}
return srv.client.Call("POST", path, nil, params)
}
// RecoveryReset use this endpoint to complete the user account password
// reset. Both the **userId** and **token** arguments will be passed as query
// parameters to the redirect URL you have provided when sending your request
// to the /auth/recovery endpoint.
//
// Please notice 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.
func (srv *Auth) RecoveryReset(UserId string, Token string, PasswordA string, PasswordB string) (map[string]interface{}, error) {
path := "/auth/recovery/reset"
params := map[string]interface{}{
"userId": UserId,
"token": Token,
"password-a": PasswordA,
"password-b": PasswordB,
}
return srv.client.Call("PUT", path, nil, params)
}
// Register 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 notice 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.
func (srv *Auth) Register(Email string, Password string, Confirm string, Success string, Failure string, Name string) (map[string]interface{}, error) {
path := "/auth/register"
params := map[string]interface{}{
"email": Email,
"password": Password,
"confirm": Confirm,
"success": Success,
"failure": Failure,
"name": Name,
}
return srv.client.Call("POST", path, nil, params)
}
// Confirm use this endpoint to complete the confirmation of the user account
// email address. Both the **userId** and **token** arguments will be passed
// as query parameters to the redirect URL you have provided when sending your
// request to the /auth/register endpoint.
func (srv *Auth) Confirm(UserId string, Token string) (map[string]interface{}, error) {
path := "/auth/register/confirm"
params := map[string]interface{}{
"userId": UserId,
"token": Token,
}
return srv.client.Call("POST", path, nil, params)
}
// ConfirmResend this endpoint allows the user to request your app to resend
// him his email confirmation message. The redirect arguments act the same way
// as in /auth/register endpoint.
//
// Please notice 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.
func (srv *Auth) ConfirmResend(Confirm string) (map[string]interface{}, error) {
path := "/auth/register/confirm/resend"
params := map[string]interface{}{
"confirm": Confirm,
}
return srv.client.Call("POST", path, nil, params)
}
@@ -1,34 +0,0 @@
# Account Examples
## Delete
```go
package appwrite-delete
import (
"fmt"
"os"
"github.com/appwrite/sdk-for-go"
)
func main() {
// Create a Client
var clt := appwrite.Client{}
// Set Client required headers
clt.SetProject("")
// Create a new Account service passing Client
var srv := appwrite.Account{
client: &clt
}
// Call Delete method and handle results
var res, err := srv.Delete()
if err != nil {
panic(err)
}
fmt.Println(res)
}
```
-35
View File
@@ -1,35 +0,0 @@
# Account Examples
## Get
```go
package appwrite-get
import (
"fmt"
"os"
"github.com/appwrite/sdk-for-go"
)
func main() {
// Create a Client
var clt := appwrite.Client{}
// Set Client required headers
clt.SetProject("")
clt.SetKey("")
// Create a new Account service passing Client
var srv := appwrite.Account{
client: &clt
}
// Call Get method and handle results
var res, err := srv.Get()
if err != nil {
panic(err)
}
fmt.Println(res)
}
```
@@ -1,35 +0,0 @@
# Account Examples
## GetPrefs
```go
package appwrite-getprefs
import (
"fmt"
"os"
"github.com/appwrite/sdk-for-go"
)
func main() {
// Create a Client
var clt := appwrite.Client{}
// Set Client required headers
clt.SetProject("")
clt.SetKey("")
// Create a new Account service passing Client
var srv := appwrite.Account{
client: &clt
}
// Call GetPrefs method and handle results
var res, err := srv.GetPrefs()
if err != nil {
panic(err)
}
fmt.Println(res)
}
```
@@ -1,35 +0,0 @@
# Account Examples
## GetSecurity
```go
package appwrite-getsecurity
import (
"fmt"
"os"
"github.com/appwrite/sdk-for-go"
)
func main() {
// Create a Client
var clt := appwrite.Client{}
// Set Client required headers
clt.SetProject("")
clt.SetKey("")
// Create a new Account service passing Client
var srv := appwrite.Account{
client: &clt
}
// Call GetSecurity method and handle results
var res, err := srv.GetSecurity()
if err != nil {
panic(err)
}
fmt.Println(res)
}
```
@@ -1,35 +0,0 @@
# Account Examples
## GetSessions
```go
package appwrite-getsessions
import (
"fmt"
"os"
"github.com/appwrite/sdk-for-go"
)
func main() {
// Create a Client
var clt := appwrite.Client{}
// Set Client required headers
clt.SetProject("")
clt.SetKey("")
// Create a new Account service passing Client
var srv := appwrite.Account{
client: &clt
}
// Call GetSessions method and handle results
var res, err := srv.GetSessions()
if err != nil {
panic(err)
}
fmt.Println(res)
}
```
@@ -1,35 +0,0 @@
# Account Examples
## UpdateEmail
```go
package appwrite-updateemail
import (
"fmt"
"os"
"github.com/appwrite/sdk-for-go"
)
func main() {
// Create a Client
var clt := appwrite.Client{}
// Set Client required headers
clt.SetProject("")
clt.SetKey("")
// Create a new Account service passing Client
var srv := appwrite.Account{
client: &clt
}
// Call UpdateEmail method and handle results
var res, err := srv.UpdateEmail("email@example.com", "password")
if err != nil {
panic(err)
}
fmt.Println(res)
}
```
@@ -1,35 +0,0 @@
# Account Examples
## UpdateName
```go
package appwrite-updatename
import (
"fmt"
"os"
"github.com/appwrite/sdk-for-go"
)
func main() {
// Create a Client
var clt := appwrite.Client{}
// Set Client required headers
clt.SetProject("")
clt.SetKey("")
// Create a new Account service passing Client
var srv := appwrite.Account{
client: &clt
}
// Call UpdateName method and handle results
var res, err := srv.UpdateName("[NAME]")
if err != nil {
panic(err)
}
fmt.Println(res)
}
```
@@ -1,35 +0,0 @@
# Account Examples
## UpdatePassword
```go
package appwrite-updatepassword
import (
"fmt"
"os"
"github.com/appwrite/sdk-for-go"
)
func main() {
// Create a Client
var clt := appwrite.Client{}
// Set Client required headers
clt.SetProject("")
clt.SetKey("")
// Create a new Account service passing Client
var srv := appwrite.Account{
client: &clt
}
// Call UpdatePassword method and handle results
var res, err := srv.UpdatePassword("password", "password")
if err != nil {
panic(err)
}
fmt.Println(res)
}
```
@@ -1,35 +0,0 @@
# Account Examples
## UpdatePrefs
```go
package appwrite-updateprefs
import (
"fmt"
"os"
"github.com/appwrite/sdk-for-go"
)
func main() {
// Create a Client
var clt := appwrite.Client{}
// Set Client required headers
clt.SetProject("")
clt.SetKey("")
// Create a new Account service passing Client
var srv := appwrite.Account{
client: &clt
}
// Call UpdatePrefs method and handle results
var res, err := srv.UpdatePrefs("{}")
if err != nil {
panic(err)
}
fmt.Println(res)
}
```
@@ -1,33 +0,0 @@
# Account Examples
## CreateAccountRecovery
```go
package appwrite-createaccountrecovery
import (
"fmt"
"os"
"github.com/appwrite/sdk-for-go"
)
func main() {
// Create a Client
var clt := appwrite.Client{}
// Set Client required headers
// Create a new Account service passing Client
var srv := appwrite.Account{
client: &clt
}
// Call CreateAccountRecovery method and handle results
var res, err := srv.CreateAccountRecovery("email@example.com", "https://example.com")
if err != nil {
panic(err)
}
fmt.Println(res)
}
```
@@ -1,33 +0,0 @@
# Account Examples
## CreateAccountSessionOAuth
```go
package appwrite-createaccountsessionoauth
import (
"fmt"
"os"
"github.com/appwrite/sdk-for-go"
)
func main() {
// Create a Client
var clt := appwrite.Client{}
// Set Client required headers
// Create a new Account service passing Client
var srv := appwrite.Account{
client: &clt
}
// Call CreateAccountSessionOAuth method and handle results
var res, err := srv.CreateAccountSessionOAuth("bitbucket", "https://example.com", "https://example.com")
if err != nil {
panic(err)
}
fmt.Println(res)
}
```
@@ -1,33 +0,0 @@
# Account Examples
## CreateAccountSession
```go
package appwrite-createaccountsession
import (
"fmt"
"os"
"github.com/appwrite/sdk-for-go"
)
func main() {
// Create a Client
var clt := appwrite.Client{}
// Set Client required headers
// Create a new Account service passing Client
var srv := appwrite.Account{
client: &clt
}
// Call CreateAccountSession method and handle results
var res, err := srv.CreateAccountSession("email@example.com", "password")
if err != nil {
panic(err)
}
fmt.Println(res)
}
```
@@ -1,34 +0,0 @@
# Account Examples
## CreateAccountVerification
```go
package appwrite-createaccountverification
import (
"fmt"
"os"
"github.com/appwrite/sdk-for-go"
)
func main() {
// Create a Client
var clt := appwrite.Client{}
// Set Client required headers
clt.SetProject("")
// Create a new Account service passing Client
var srv := appwrite.Account{
client: &clt
}
// Call CreateAccountVerification method and handle results
var res, err := srv.CreateAccountVerification("https://example.com")
if err != nil {
panic(err)
}
fmt.Println(res)
}
```
@@ -1,33 +0,0 @@
# Account Examples
## CreateAccount
```go
package appwrite-createaccount
import (
"fmt"
"os"
"github.com/appwrite/sdk-for-go"
)
func main() {
// Create a Client
var clt := appwrite.Client{}
// Set Client required headers
// Create a new Account service passing Client
var srv := appwrite.Account{
client: &clt
}
// Call CreateAccount method and handle results
var res, err := srv.CreateAccount("email@example.com", "password")
if err != nil {
panic(err)
}
fmt.Println(res)
}
```
@@ -1,34 +0,0 @@
# Account Examples
## DeleteAccountCurrentSession
```go
package appwrite-deleteaccountcurrentsession
import (
"fmt"
"os"
"github.com/appwrite/sdk-for-go"
)
func main() {
// Create a Client
var clt := appwrite.Client{}
// Set Client required headers
clt.SetProject("")
// Create a new Account service passing Client
var srv := appwrite.Account{
client: &clt
}
// Call DeleteAccountCurrentSession method and handle results
var res, err := srv.DeleteAccountCurrentSession()
if err != nil {
panic(err)
}
fmt.Println(res)
}
```
@@ -1,34 +0,0 @@
# Account Examples
## DeleteAccountSession
```go
package appwrite-deleteaccountsession
import (
"fmt"
"os"
"github.com/appwrite/sdk-for-go"
)
func main() {
// Create a Client
var clt := appwrite.Client{}
// Set Client required headers
clt.SetProject("")
// Create a new Account service passing Client
var srv := appwrite.Account{
client: &clt
}
// Call DeleteAccountSession method and handle results
var res, err := srv.DeleteAccountSession("[ID]")
if err != nil {
panic(err)
}
fmt.Println(res)
}
```
@@ -1,34 +0,0 @@
# Account Examples
## DeleteAccountSessions
```go
package appwrite-deleteaccountsessions
import (
"fmt"
"os"
"github.com/appwrite/sdk-for-go"
)
func main() {
// Create a Client
var clt := appwrite.Client{}
// Set Client required headers
clt.SetProject("")
// Create a new Account service passing Client
var srv := appwrite.Account{
client: &clt
}
// Call DeleteAccountSessions method and handle results
var res, err := srv.DeleteAccountSessions()
if err != nil {
panic(err)
}
fmt.Println(res)
}
```
@@ -1,34 +0,0 @@
# Account Examples
## GetAccountLogs
```go
package appwrite-getaccountlogs
import (
"fmt"
"os"
"github.com/appwrite/sdk-for-go"
)
func main() {
// Create a Client
var clt := appwrite.Client{}
// Set Client required headers
clt.SetProject("")
// Create a new Account service passing Client
var srv := appwrite.Account{
client: &clt
}
// Call GetAccountLogs method and handle results
var res, err := srv.GetAccountLogs()
if err != nil {
panic(err)
}
fmt.Println(res)
}
```
@@ -1,34 +0,0 @@
# Account Examples
## GetAccountPrefs
```go
package appwrite-getaccountprefs
import (
"fmt"
"os"
"github.com/appwrite/sdk-for-go"
)
func main() {
// Create a Client
var clt := appwrite.Client{}
// Set Client required headers
clt.SetProject("")
// Create a new Account service passing Client
var srv := appwrite.Account{
client: &clt
}
// Call GetAccountPrefs method and handle results
var res, err := srv.GetAccountPrefs()
if err != nil {
panic(err)
}
fmt.Println(res)
}
```
@@ -1,34 +0,0 @@
# Account Examples
## GetAccountSessions
```go
package appwrite-getaccountsessions
import (
"fmt"
"os"
"github.com/appwrite/sdk-for-go"
)
func main() {
// Create a Client
var clt := appwrite.Client{}
// Set Client required headers
clt.SetProject("")
// Create a new Account service passing Client
var srv := appwrite.Account{
client: &clt
}
// Call GetAccountSessions method and handle results
var res, err := srv.GetAccountSessions()
if err != nil {
panic(err)
}
fmt.Println(res)
}
```
@@ -1,34 +0,0 @@
# Account Examples
## GetAccount
```go
package appwrite-getaccount
import (
"fmt"
"os"
"github.com/appwrite/sdk-for-go"
)
func main() {
// Create a Client
var clt := appwrite.Client{}
// Set Client required headers
clt.SetProject("")
// Create a new Account service passing Client
var srv := appwrite.Account{
client: &clt
}
// Call GetAccount method and handle results
var res, err := srv.GetAccount()
if err != nil {
panic(err)
}
fmt.Println(res)
}
```
@@ -1,35 +0,0 @@
# Account Examples
## GetPrefs
```go
package appwrite-getprefs
import (
"fmt"
"os"
"github.com/appwrite/sdk-for-go"
)
func main() {
// Create a Client
var clt := appwrite.Client{}
// Set Client required headers
clt.SetProject("")
clt.SetKey("")
// Create a new Account service passing Client
var srv := appwrite.Account{
client: &clt
}
// Call GetPrefs method and handle results
var res, err := srv.GetPrefs()
if err != nil {
panic(err)
}
fmt.Println(res)
}
```
@@ -1,35 +0,0 @@
# Account Examples
## GetSecurity
```go
package appwrite-getsecurity
import (
"fmt"
"os"
"github.com/appwrite/sdk-for-go"
)
func main() {
// Create a Client
var clt := appwrite.Client{}
// Set Client required headers
clt.SetProject("")
clt.SetKey("")
// Create a new Account service passing Client
var srv := appwrite.Account{
client: &clt
}
// Call GetSecurity method and handle results
var res, err := srv.GetSecurity()
if err != nil {
panic(err)
}
fmt.Println(res)
}
```
@@ -1,35 +0,0 @@
# Account Examples
## GetSessions
```go
package appwrite-getsessions
import (
"fmt"
"os"
"github.com/appwrite/sdk-for-go"
)
func main() {
// Create a Client
var clt := appwrite.Client{}
// Set Client required headers
clt.SetProject("")
clt.SetKey("")
// Create a new Account service passing Client
var srv := appwrite.Account{
client: &clt
}
// Call GetSessions method and handle results
var res, err := srv.GetSessions()
if err != nil {
panic(err)
}
fmt.Println(res)
}
```
@@ -1,34 +0,0 @@
# Account Examples
## UpdateAccountName
```go
package appwrite-updateaccountname
import (
"fmt"
"os"
"github.com/appwrite/sdk-for-go"
)
func main() {
// Create a Client
var clt := appwrite.Client{}
// Set Client required headers
clt.SetProject("")
// Create a new Account service passing Client
var srv := appwrite.Account{
client: &clt
}
// Call UpdateAccountName method and handle results
var res, err := srv.UpdateAccountName("[NAME]")
if err != nil {
panic(err)
}
fmt.Println(res)
}
```
@@ -1,34 +0,0 @@
# Account Examples
## UpdateAccountPassword
```go
package appwrite-updateaccountpassword
import (
"fmt"
"os"
"github.com/appwrite/sdk-for-go"
)
func main() {
// Create a Client
var clt := appwrite.Client{}
// Set Client required headers
clt.SetProject("")
// Create a new Account service passing Client
var srv := appwrite.Account{
client: &clt
}
// Call UpdateAccountPassword method and handle results
var res, err := srv.UpdateAccountPassword("password", "password")
if err != nil {
panic(err)
}
fmt.Println(res)
}
```
@@ -1,33 +0,0 @@
# Account Examples
## UpdateAccountRecovery
```go
package appwrite-updateaccountrecovery
import (
"fmt"
"os"
"github.com/appwrite/sdk-for-go"
)
func main() {
// Create a Client
var clt := appwrite.Client{}
// Set Client required headers
// Create a new Account service passing Client
var srv := appwrite.Account{
client: &clt
}
// Call UpdateAccountRecovery method and handle results
var res, err := srv.UpdateAccountRecovery("[USER_ID]", "[SECRET]", "password", "password")
if err != nil {
panic(err)
}
fmt.Println(res)
}
```
@@ -1,33 +0,0 @@
# Account Examples
## UpdateAccountVerification
```go
package appwrite-updateaccountverification
import (
"fmt"
"os"
"github.com/appwrite/sdk-for-go"
)
func main() {
// Create a Client
var clt := appwrite.Client{}
// Set Client required headers
// Create a new Account service passing Client
var srv := appwrite.Account{
client: &clt
}
// Call UpdateAccountVerification method and handle results
var res, err := srv.UpdateAccountVerification("[USER_ID]", "[SECRET]", "password")
if err != nil {
panic(err)
}
fmt.Println(res)
}
```
@@ -1,34 +0,0 @@
# Account Examples
## UpdateEmail
```go
package appwrite-updateemail
import (
"fmt"
"os"
"github.com/appwrite/sdk-for-go"
)
func main() {
// Create a Client
var clt := appwrite.Client{}
// Set Client required headers
clt.SetProject("")
// Create a new Account service passing Client
var srv := appwrite.Account{
client: &clt
}
// Call UpdateEmail method and handle results
var res, err := srv.UpdateEmail("email@example.com", "password")
if err != nil {
panic(err)
}
fmt.Println(res)
}
```
@@ -1,35 +0,0 @@
# Account Examples
## UpdateName
```go
package appwrite-updatename
import (
"fmt"
"os"
"github.com/appwrite/sdk-for-go"
)
func main() {
// Create a Client
var clt := appwrite.Client{}
// Set Client required headers
clt.SetProject("")
clt.SetKey("")
// Create a new Account service passing Client
var srv := appwrite.Account{
client: &clt
}
// Call UpdateName method and handle results
var res, err := srv.UpdateName("[NAME]")
if err != nil {
panic(err)
}
fmt.Println(res)
}
```
@@ -1,35 +0,0 @@
# Account Examples
## UpdatePassword
```go
package appwrite-updatepassword
import (
"fmt"
"os"
"github.com/appwrite/sdk-for-go"
)
func main() {
// Create a Client
var clt := appwrite.Client{}
// Set Client required headers
clt.SetProject("")
clt.SetKey("")
// Create a new Account service passing Client
var srv := appwrite.Account{
client: &clt
}
// Call UpdatePassword method and handle results
var res, err := srv.UpdatePassword("password", "password")
if err != nil {
panic(err)
}
fmt.Println(res)
}
```
@@ -1,34 +0,0 @@
# Account Examples
## UpdatePrefs
```go
package appwrite-updateprefs
import (
"fmt"
"os"
"github.com/appwrite/sdk-for-go"
)
func main() {
// Create a Client
var clt := appwrite.Client{}
// Set Client required headers
clt.SetProject("")
// Create a new Account service passing Client
var srv := appwrite.Account{
client: &clt
}
// Call UpdatePrefs method and handle results
var res, err := srv.UpdatePrefs("")
if err != nil {
panic(err)
}
fmt.Println(res)
}
```
-33
View File
@@ -1,33 +0,0 @@
# Auth Examples
## Confirm
```go
package appwrite-confirm
import (
"fmt"
"os"
"github.com/appwrite/sdk-for-go"
)
func main() {
// Create a Client
var clt := appwrite.Client{}
// Set Client required headers
// Create a new Auth service passing Client
var srv := appwrite.Auth{
client: &clt
}
// Call Confirm method and handle results
var res, err := srv.Confirm("[USER_ID]", "[TOKEN]")
if err != nil {
panic(err)
}
fmt.Println(res)
}
```
@@ -1,35 +0,0 @@
# Auth Examples
## ConfirmResend
```go
package appwrite-confirmresend
import (
"fmt"
"os"
"github.com/appwrite/sdk-for-go"
)
func main() {
// Create a Client
var clt := appwrite.Client{}
// Set Client required headers
clt.SetProject("")
clt.SetKey("")
// Create a new Auth service passing Client
var srv := appwrite.Auth{
client: &clt
}
// Call ConfirmResend method and handle results
var res, err := srv.ConfirmResend("https://example.com")
if err != nil {
panic(err)
}
fmt.Println(res)
}
```
-35
View File
@@ -1,35 +0,0 @@
# Auth Examples
## Login
```go
package appwrite-login
import (
"fmt"
"os"
"github.com/appwrite/sdk-for-go"
)
func main() {
// Create a Client
var clt := appwrite.Client{}
// Set Client required headers
clt.SetProject("")
clt.SetKey("")
// Create a new Auth service passing Client
var srv := appwrite.Auth{
client: &clt
}
// Call Login method and handle results
var res, err := srv.Login("email@example.com", "password")
if err != nil {
panic(err)
}
fmt.Println(res)
}
```
-35
View File
@@ -1,35 +0,0 @@
# Auth Examples
## Logout
```go
package appwrite-logout
import (
"fmt"
"os"
"github.com/appwrite/sdk-for-go"
)
func main() {
// Create a Client
var clt := appwrite.Client{}
// Set Client required headers
clt.SetProject("")
clt.SetKey("")
// Create a new Auth service passing Client
var srv := appwrite.Auth{
client: &clt
}
// Call Logout method and handle results
var res, err := srv.Logout()
if err != nil {
panic(err)
}
fmt.Println(res)
}
```
@@ -1,35 +0,0 @@
# Auth Examples
## LogoutBySession
```go
package appwrite-logoutbysession
import (
"fmt"
"os"
"github.com/appwrite/sdk-for-go"
)
func main() {
// Create a Client
var clt := appwrite.Client{}
// Set Client required headers
clt.SetProject("")
clt.SetKey("")
// Create a new Auth service passing Client
var srv := appwrite.Auth{
client: &clt
}
// Call LogoutBySession method and handle results
var res, err := srv.LogoutBySession("[ID]")
if err != nil {
panic(err)
}
fmt.Println(res)
}
```
-35
View File
@@ -1,35 +0,0 @@
# Auth Examples
## Oauth
```go
package appwrite-oauth
import (
"fmt"
"os"
"github.com/appwrite/sdk-for-go"
)
func main() {
// Create a Client
var clt := appwrite.Client{}
// Set Client required headers
clt.SetProject("")
clt.SetKey("")
// Create a new Auth service passing Client
var srv := appwrite.Auth{
client: &clt
}
// Call Oauth method and handle results
var res, err := srv.Oauth("bitbucket", "https://example.com", "https://example.com")
if err != nil {
panic(err)
}
fmt.Println(res)
}
```
@@ -1,35 +0,0 @@
# Auth Examples
## Recovery
```go
package appwrite-recovery
import (
"fmt"
"os"
"github.com/appwrite/sdk-for-go"
)
func main() {
// Create a Client
var clt := appwrite.Client{}
// Set Client required headers
clt.SetProject("")
clt.SetKey("")
// Create a new Auth service passing Client
var srv := appwrite.Auth{
client: &clt
}
// Call Recovery method and handle results
var res, err := srv.Recovery("email@example.com", "https://example.com")
if err != nil {
panic(err)
}
fmt.Println(res)
}
```
@@ -1,35 +0,0 @@
# Auth Examples
## RecoveryReset
```go
package appwrite-recoveryreset
import (
"fmt"
"os"
"github.com/appwrite/sdk-for-go"
)
func main() {
// Create a Client
var clt := appwrite.Client{}
// Set Client required headers
clt.SetProject("")
clt.SetKey("")
// Create a new Auth service passing Client
var srv := appwrite.Auth{
client: &clt
}
// Call RecoveryReset method and handle results
var res, err := srv.RecoveryReset("[USER_ID]", "[TOKEN]", "password", "password")
if err != nil {
panic(err)
}
fmt.Println(res)
}
```
@@ -1,35 +0,0 @@
# Auth Examples
## Register
```go
package appwrite-register
import (
"fmt"
"os"
"github.com/appwrite/sdk-for-go"
)
func main() {
// Create a Client
var clt := appwrite.Client{}
// Set Client required headers
clt.SetProject("")
clt.SetKey("")
// Create a new Auth service passing Client
var srv := appwrite.Auth{
client: &clt
}
// Call Register method and handle results
var res, err := srv.Register("email@example.com", "password", "https://example.com")
if err != nil {
panic(err)
}
fmt.Println(res)
}
```
@@ -1,35 +0,0 @@
# Auth Examples
## ConfirmResend
```go
package appwrite-confirmresend
import (
"fmt"
"os"
"github.com/appwrite/sdk-for-go"
)
func main() {
// Create a Client
var clt := appwrite.Client{}
// Set Client required headers
clt.SetProject("")
clt.SetKey("")
// Create a new Auth service passing Client
var srv := appwrite.Auth{
client: &clt
}
// Call ConfirmResend method and handle results
var res, err := srv.ConfirmResend("https://example.com")
if err != nil {
panic(err)
}
fmt.Println(res)
}
```
@@ -1,35 +0,0 @@
# Auth Examples
## LogoutBySession
```go
package appwrite-logoutbysession
import (
"fmt"
"os"
"github.com/appwrite/sdk-for-go"
)
func main() {
// Create a Client
var clt := appwrite.Client{}
// Set Client required headers
clt.SetProject("")
clt.SetKey("")
// Create a new Auth service passing Client
var srv := appwrite.Auth{
client: &clt
}
// Call LogoutBySession method and handle results
var res, err := srv.LogoutBySession("[ID]")
if err != nil {
panic(err)
}
fmt.Println(res)
}
```
@@ -1,35 +0,0 @@
# Auth Examples
## RecoveryReset
```go
package appwrite-recoveryreset
import (
"fmt"
"os"
"github.com/appwrite/sdk-for-go"
)
func main() {
// Create a Client
var clt := appwrite.Client{}
// Set Client required headers
clt.SetProject("")
clt.SetKey("")
// Create a new Auth service passing Client
var srv := appwrite.Auth{
client: &clt
}
// Call RecoveryReset method and handle results
var res, err := srv.RecoveryReset("[USER_ID]", "[TOKEN]", "password", "password")
if err != nil {
panic(err)
}
fmt.Println(res)
}
```
@@ -1,35 +0,0 @@
# Avatars Examples
## GetBrowser
```go
package appwrite-getbrowser
import (
"fmt"
"os"
"github.com/appwrite/sdk-for-go"
)
func main() {
// Create a Client
var clt := appwrite.Client{}
// Set Client required headers
clt.SetProject("")
clt.SetKey("")
// Create a new Avatars service passing Client
var srv := appwrite.Avatars{
client: &clt
}
// Call GetBrowser method and handle results
var res, err := srv.GetBrowser("aa")
if err != nil {
panic(err)
}
fmt.Println(res)
}
```
@@ -1,35 +0,0 @@
# Avatars Examples
## GetCreditCard
```go
package appwrite-getcreditcard
import (
"fmt"
"os"
"github.com/appwrite/sdk-for-go"
)
func main() {
// Create a Client
var clt := appwrite.Client{}
// Set Client required headers
clt.SetProject("")
clt.SetKey("")
// Create a new Avatars service passing Client
var srv := appwrite.Avatars{
client: &clt
}
// Call GetCreditCard method and handle results
var res, err := srv.GetCreditCard("amex")
if err != nil {
panic(err)
}
fmt.Println(res)
}
```
@@ -1,35 +0,0 @@
# Avatars Examples
## GetFavicon
```go
package appwrite-getfavicon
import (
"fmt"
"os"
"github.com/appwrite/sdk-for-go"
)
func main() {
// Create a Client
var clt := appwrite.Client{}
// Set Client required headers
clt.SetProject("")
clt.SetKey("")
// Create a new Avatars service passing Client
var srv := appwrite.Avatars{
client: &clt
}
// Call GetFavicon method and handle results
var res, err := srv.GetFavicon("https://example.com")
if err != nil {
panic(err)
}
fmt.Println(res)
}
```
@@ -1,35 +0,0 @@
# Avatars Examples
## GetFlag
```go
package appwrite-getflag
import (
"fmt"
"os"
"github.com/appwrite/sdk-for-go"
)
func main() {
// Create a Client
var clt := appwrite.Client{}
// Set Client required headers
clt.SetProject("")
clt.SetKey("")
// Create a new Avatars service passing Client
var srv := appwrite.Avatars{
client: &clt
}
// Call GetFlag method and handle results
var res, err := srv.GetFlag("af")
if err != nil {
panic(err)
}
fmt.Println(res)
}
```
@@ -1,35 +0,0 @@
# Avatars Examples
## GetImage
```go
package appwrite-getimage
import (
"fmt"
"os"
"github.com/appwrite/sdk-for-go"
)
func main() {
// Create a Client
var clt := appwrite.Client{}
// Set Client required headers
clt.SetProject("")
clt.SetKey("")
// Create a new Avatars service passing Client
var srv := appwrite.Avatars{
client: &clt
}
// Call GetImage method and handle results
var res, err := srv.GetImage("https://example.com")
if err != nil {
panic(err)
}
fmt.Println(res)
}
```
@@ -1,35 +0,0 @@
# Avatars Examples
## GetQR
```go
package appwrite-getqr
import (
"fmt"
"os"
"github.com/appwrite/sdk-for-go"
)
func main() {
// Create a Client
var clt := appwrite.Client{}
// Set Client required headers
clt.SetProject("")
clt.SetKey("")
// Create a new Avatars service passing Client
var srv := appwrite.Avatars{
client: &clt
}
// Call GetQR method and handle results
var res, err := srv.GetQR("[TEXT]")
if err != nil {
panic(err)
}
fmt.Println(res)
}
```
@@ -17,6 +17,7 @@
// Set Client required headers
clt.SetProject("")
clt.SetKey("")
// Create a new Avatars service passing Client
var srv := appwrite.Avatars{
@@ -17,6 +17,7 @@
// Set Client required headers
clt.SetProject("")
clt.SetKey("")
// Create a new Avatars service passing Client
var srv := appwrite.Avatars{
@@ -17,6 +17,7 @@
// Set Client required headers
clt.SetProject("")
clt.SetKey("")
// Create a new Avatars service passing Client
var srv := appwrite.Avatars{
@@ -17,6 +17,7 @@
// Set Client required headers
clt.SetProject("")
clt.SetKey("")
// Create a new Avatars service passing Client
var srv := appwrite.Avatars{
@@ -17,6 +17,7 @@
// Set Client required headers
clt.SetProject("")
clt.SetKey("")
// Create a new Avatars service passing Client
var srv := appwrite.Avatars{
@@ -17,6 +17,7 @@
// Set Client required headers
clt.SetProject("")
clt.SetKey("")
// Create a new Avatars service passing Client
var srv := appwrite.Avatars{
@@ -1,35 +0,0 @@
# Database Examples
## CreateCollection
```go
package appwrite-createcollection
import (
"fmt"
"os"
"github.com/appwrite/sdk-for-go"
)
func main() {
// Create a Client
var clt := appwrite.Client{}
// Set Client required headers
clt.SetProject("")
clt.SetKey("")
// Create a new Database service passing Client
var srv := appwrite.Database{
client: &clt
}
// Call CreateCollection method and handle results
var res, err := srv.CreateCollection("[NAME]")
if err != nil {
panic(err)
}
fmt.Println(res)
}
```
@@ -1,35 +0,0 @@
# Database Examples
## CreateDocument
```go
package appwrite-createdocument
import (
"fmt"
"os"
"github.com/appwrite/sdk-for-go"
)
func main() {
// Create a Client
var clt := appwrite.Client{}
// Set Client required headers
clt.SetProject("")
clt.SetKey("")
// Create a new Database service passing Client
var srv := appwrite.Database{
client: &clt
}
// Call CreateDocument method and handle results
var res, err := srv.CreateDocument("[COLLECTION_ID]", "{}")
if err != nil {
panic(err)
}
fmt.Println(res)
}
```
@@ -1,35 +0,0 @@
# Database Examples
## DeleteCollection
```go
package appwrite-deletecollection
import (
"fmt"
"os"
"github.com/appwrite/sdk-for-go"
)
func main() {
// Create a Client
var clt := appwrite.Client{}
// Set Client required headers
clt.SetProject("")
clt.SetKey("")
// Create a new Database service passing Client
var srv := appwrite.Database{
client: &clt
}
// Call DeleteCollection method and handle results
var res, err := srv.DeleteCollection("[COLLECTION_ID]")
if err != nil {
panic(err)
}
fmt.Println(res)
}
```
@@ -1,35 +0,0 @@
# Database Examples
## DeleteDocument
```go
package appwrite-deletedocument
import (
"fmt"
"os"
"github.com/appwrite/sdk-for-go"
)
func main() {
// Create a Client
var clt := appwrite.Client{}
// Set Client required headers
clt.SetProject("")
clt.SetKey("")
// Create a new Database service passing Client
var srv := appwrite.Database{
client: &clt
}
// Call DeleteDocument method and handle results
var res, err := srv.DeleteDocument("[COLLECTION_ID]", "[DOCUMENT_ID]")
if err != nil {
panic(err)
}
fmt.Println(res)
}
```
@@ -1,35 +0,0 @@
# Database Examples
## GetCollection
```go
package appwrite-getcollection
import (
"fmt"
"os"
"github.com/appwrite/sdk-for-go"
)
func main() {
// Create a Client
var clt := appwrite.Client{}
// Set Client required headers
clt.SetProject("")
clt.SetKey("")
// Create a new Database service passing Client
var srv := appwrite.Database{
client: &clt
}
// Call GetCollection method and handle results
var res, err := srv.GetCollection("[COLLECTION_ID]")
if err != nil {
panic(err)
}
fmt.Println(res)
}
```
@@ -1,35 +0,0 @@
# Database Examples
## GetDocument
```go
package appwrite-getdocument
import (
"fmt"
"os"
"github.com/appwrite/sdk-for-go"
)
func main() {
// Create a Client
var clt := appwrite.Client{}
// Set Client required headers
clt.SetProject("")
clt.SetKey("")
// Create a new Database service passing Client
var srv := appwrite.Database{
client: &clt
}
// Call GetDocument method and handle results
var res, err := srv.GetDocument("[COLLECTION_ID]", "[DOCUMENT_ID]")
if err != nil {
panic(err)
}
fmt.Println(res)
}
```
@@ -1,35 +0,0 @@
# Database Examples
## ListCollections
```go
package appwrite-listcollections
import (
"fmt"
"os"
"github.com/appwrite/sdk-for-go"
)
func main() {
// Create a Client
var clt := appwrite.Client{}
// Set Client required headers
clt.SetProject("")
clt.SetKey("")
// Create a new Database service passing Client
var srv := appwrite.Database{
client: &clt
}
// Call ListCollections method and handle results
var res, err := srv.ListCollections()
if err != nil {
panic(err)
}
fmt.Println(res)
}
```
@@ -1,35 +0,0 @@
# Database Examples
## ListDocuments
```go
package appwrite-listdocuments
import (
"fmt"
"os"
"github.com/appwrite/sdk-for-go"
)
func main() {
// Create a Client
var clt := appwrite.Client{}
// Set Client required headers
clt.SetProject("")
clt.SetKey("")
// Create a new Database service passing Client
var srv := appwrite.Database{
client: &clt
}
// Call ListDocuments method and handle results
var res, err := srv.ListDocuments("[COLLECTION_ID]")
if err != nil {
panic(err)
}
fmt.Println(res)
}
```
@@ -1,35 +0,0 @@
# Database Examples
## UpdateCollection
```go
package appwrite-updatecollection
import (
"fmt"
"os"
"github.com/appwrite/sdk-for-go"
)
func main() {
// Create a Client
var clt := appwrite.Client{}
// Set Client required headers
clt.SetProject("")
clt.SetKey("")
// Create a new Database service passing Client
var srv := appwrite.Database{
client: &clt
}
// Call UpdateCollection method and handle results
var res, err := srv.UpdateCollection("[COLLECTION_ID]", "[NAME]")
if err != nil {
panic(err)
}
fmt.Println(res)
}
```
@@ -1,35 +0,0 @@
# Database Examples
## UpdateDocument
```go
package appwrite-updatedocument
import (
"fmt"
"os"
"github.com/appwrite/sdk-for-go"
)
func main() {
// Create a Client
var clt := appwrite.Client{}
// Set Client required headers
clt.SetProject("")
clt.SetKey("")
// Create a new Database service passing Client
var srv := appwrite.Database{
client: &clt
}
// Call UpdateDocument method and handle results
var res, err := srv.UpdateDocument("[COLLECTION_ID]", "[DOCUMENT_ID]", "{}")
if err != nil {
panic(err)
}
fmt.Println(res)
}
```
@@ -17,6 +17,7 @@
// Set Client required headers
clt.SetProject("")
clt.SetKey("")
// Create a new Database service passing Client
var srv := appwrite.Database{
@@ -17,6 +17,7 @@
// Set Client required headers
clt.SetProject("")
clt.SetKey("")
// Create a new Database service passing Client
var srv := appwrite.Database{
@@ -17,6 +17,7 @@
// Set Client required headers
clt.SetProject("")
clt.SetKey("")
// Create a new Database service passing Client
var srv := appwrite.Database{
@@ -17,6 +17,7 @@
// Set Client required headers
clt.SetProject("")
clt.SetKey("")
// Create a new Database service passing Client
var srv := appwrite.Database{
@@ -17,6 +17,7 @@
// Set Client required headers
clt.SetProject("")
clt.SetKey("")
// Create a new Database service passing Client
var srv := appwrite.Database{
@@ -17,6 +17,7 @@
// Set Client required headers
clt.SetProject("")
clt.SetKey("")
// Create a new Database service passing Client
var srv := appwrite.Database{
@@ -17,6 +17,7 @@
// Set Client required headers
clt.SetProject("")
clt.SetKey("")
// Create a new Database service passing Client
var srv := appwrite.Database{
@@ -17,6 +17,7 @@
// Set Client required headers
clt.SetProject("")
clt.SetKey("")
// Create a new Database service passing Client
var srv := appwrite.Database{
@@ -17,6 +17,7 @@
// Set Client required headers
clt.SetProject("")
clt.SetKey("")
// Create a new Database service passing Client
var srv := appwrite.Database{
@@ -17,6 +17,7 @@
// Set Client required headers
clt.SetProject("")
clt.SetKey("")
// Create a new Database service passing Client
var srv := appwrite.Database{
@@ -1,35 +0,0 @@
# Locale Examples
## GetCountries
```go
package appwrite-getcountries
import (
"fmt"
"os"
"github.com/appwrite/sdk-for-go"
)
func main() {
// Create a Client
var clt := appwrite.Client{}
// Set Client required headers
clt.SetProject("")
clt.SetKey("")
// Create a new Locale service passing Client
var srv := appwrite.Locale{
client: &clt
}
// Call GetCountries method and handle results
var res, err := srv.GetCountries()
if err != nil {
panic(err)
}
fmt.Println(res)
}
```
@@ -1,35 +0,0 @@
# Locale Examples
## GetCountriesEU
```go
package appwrite-getcountrieseu
import (
"fmt"
"os"
"github.com/appwrite/sdk-for-go"
)
func main() {
// Create a Client
var clt := appwrite.Client{}
// Set Client required headers
clt.SetProject("")
clt.SetKey("")
// Create a new Locale service passing Client
var srv := appwrite.Locale{
client: &clt
}
// Call GetCountriesEU method and handle results
var res, err := srv.GetCountriesEU()
if err != nil {
panic(err)
}
fmt.Println(res)
}
```
@@ -1,35 +0,0 @@
# Locale Examples
## GetCountriesPhones
```go
package appwrite-getcountriesphones
import (
"fmt"
"os"
"github.com/appwrite/sdk-for-go"
)
func main() {
// Create a Client
var clt := appwrite.Client{}
// Set Client required headers
clt.SetProject("")
clt.SetKey("")
// Create a new Locale service passing Client
var srv := appwrite.Locale{
client: &clt
}
// Call GetCountriesPhones method and handle results
var res, err := srv.GetCountriesPhones()
if err != nil {
panic(err)
}
fmt.Println(res)
}
```
@@ -1,35 +0,0 @@
# Locale Examples
## GetCurrencies
```go
package appwrite-getcurrencies
import (
"fmt"
"os"
"github.com/appwrite/sdk-for-go"
)
func main() {
// Create a Client
var clt := appwrite.Client{}
// Set Client required headers
clt.SetProject("")
clt.SetKey("")
// Create a new Locale service passing Client
var srv := appwrite.Locale{
client: &clt
}
// Call GetCurrencies method and handle results
var res, err := srv.GetCurrencies()
if err != nil {
panic(err)
}
fmt.Println(res)
}
```

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