diff --git a/app/sdks/dart/LICENSE b/app/sdks/dart/LICENSE new file mode 100644 index 0000000000..fc7c051a91 --- /dev/null +++ b/app/sdks/dart/LICENSE @@ -0,0 +1,12 @@ +Copyright (c) 2019 Appwrite (https://appwrite.io) and individual contributors. +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + + 3. Neither the name Appwrite nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/app/sdks/dart/README.md b/app/sdks/dart/README.md new file mode 100644 index 0000000000..5988469846 --- /dev/null +++ b/app/sdks/dart/README.md @@ -0,0 +1,29 @@ +# Appwrite SDK for Dart + +![License](https://img.shields.io/github/license/appwrite/sdk-for-dart.svg?v=1) +![Version](https://img.shields.io/badge/api%20version-0.4.0-blue.svg?v=1) + +Appwrite backend as a service cuts up to 70% of the time and costs required for building a modern application. We abstract and simplify common development tasks behind a REST APIs, to help you develop your app in a fast and secure way. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs) + + + +![Appwrite](https://appwrite.io/images/github.png) + +## Installation + +Add this to your package's pubspec.yaml file: + +```yml +dependencies: + appwrite: ^0.0.6 +``` + +You can install packages from the command line: + +```bash +pub get +``` + +## License + +Please see the [BSD-3-Clause license](https://raw.githubusercontent.com/appwrite/appwrite/master/LICENSE) file for more information. \ No newline at end of file diff --git a/app/sdks/dart/lib/appwrite.dart b/app/sdks/dart/lib/appwrite.dart new file mode 100644 index 0000000000..905f90058b --- /dev/null +++ b/app/sdks/dart/lib/appwrite.dart @@ -0,0 +1,8 @@ +export 'package:appwrite/services/account.dart'; +export 'package:appwrite/services/avatars.dart'; +export 'package:appwrite/services/database.dart'; +export 'package:appwrite/services/locale.dart'; +export 'package:appwrite/services/storage.dart'; +export 'package:appwrite/services/teams.dart'; +export 'package:appwrite/client.dart'; +export 'package:dio/dio.dart' show Response; \ No newline at end of file diff --git a/app/sdks/dart/lib/client.dart b/app/sdks/dart/lib/client.dart new file mode 100644 index 0000000000..05a5370651 --- /dev/null +++ b/app/sdks/dart/lib/client.dart @@ -0,0 +1,100 @@ +import 'package:dio/dio.dart'; +import 'package:dio_cookie_manager/dio_cookie_manager.dart'; +import 'package:cookie_jar/cookie_jar.dart'; + +class Client { + String endPoint; + Map 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 call(String method, {String path = '', Map headers = const {}, Map 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); + } +} \ No newline at end of file diff --git a/app/sdks/dart/lib/service.dart b/app/sdks/dart/lib/service.dart new file mode 100644 index 0000000000..81107c7803 --- /dev/null +++ b/app/sdks/dart/lib/service.dart @@ -0,0 +1,9 @@ +import 'package:appwrite/client.dart'; + +class Service { + Client client; + + Service(Client client) { + this.client = client; + } +} \ No newline at end of file diff --git a/app/sdks/dart/lib/services/account.dart b/app/sdks/dart/lib/services/account.dart new file mode 100644 index 0000000000..d0230c628d --- /dev/null +++ b/app/sdks/dart/lib/services/account.dart @@ -0,0 +1,259 @@ +import "package:appwrite/service.dart"; +import "package:appwrite/client.dart"; +import 'package:dio/dio.dart'; + +class Account extends Service { + + Account(Client client): super(client); + + /// Get currently logged in user data as JSON object. + Future get() async { + String path = '/account'; + + Map params = { + }; + + return await this.client.call('get', path: path, params: params); + } + /// Use this endpoint to allow a new user to register an account in your + /// project. Use the success and failure URLs to redirect users back to your + /// application after signup completes. + /// + /// If registration completes successfully user will be sent with a + /// confirmation email in order to confirm he is the owner of the account email + /// address. Use the confirmation parameter to redirect the user from the + /// confirmation email back to your app. When the user is redirected, use the + /// /auth/confirm endpoint to complete the account confirmation. + /// + /// Please note that in order to avoid a [Redirect + /// Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) + /// the only valid redirect URLs are the ones from domains you have set when + /// adding your platforms in the console interface. + /// + /// When accessing this route using Javascript from the browser, success and + /// failure parameter URLs are required. Appwrite server will respond with a + /// 301 redirect status code and will set the user session cookie. This + /// behavior is enforced because modern browsers are limiting 3rd party cookies + /// in XHR of fetch requests to protect user privacy. + Future create({email, password, name = null}) async { + String path = '/account'; + + Map params = { + 'email': email, + 'password': password, + 'name': name, + }; + + return await this.client.call('post', path: path, params: params); + } + /// Delete a currently logged in user account. Behind the scene, the user + /// record is not deleted but permanently blocked from any access. This is done + /// to avoid deleted accounts being overtaken by new users with the same email + /// address. Any user-related resources like documents or storage files should + /// be deleted separately. + Future delete() async { + String path = '/account'; + + Map 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 updateEmail({email, password}) async { + String path = '/account/email'; + + Map params = { + 'email': email, + 'password': password, + }; + + return await this.client.call('patch', path: path, params: params); + } + /// Get currently logged in user list of latest security activity logs. Each + /// log returns user IP address, location and date and time of log. + Future getLogs() async { + String path = '/account/logs'; + + Map params = { + }; + + return await this.client.call('get', path: path, params: params); + } + /// Update currently logged in user account name. + Future updateName({name}) async { + String path = '/account/name'; + + Map 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 updatePassword({password, oldPassword}) async { + String path = '/account/password'; + + Map 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 getPrefs() async { + String path = '/account/prefs'; + + Map 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 updatePrefs({prefs}) async { + String path = '/account/prefs'; + + Map params = { + 'prefs': prefs, + }; + + return await this.client.call('patch', path: path, params: params); + } + /// Sends the user an email with a temporary secret key for password reset. + /// When the user clicks the confirmation link he is redirected back to your + /// app password reset URL with the secret key and email address values + /// attached to the URL query string. Use the query string params to submit a + /// request to the /auth/password/reset endpoint to complete the process. + Future createRecovery({email, url}) async { + String path = '/account/recovery'; + + Map params = { + 'email': email, + 'url': url, + }; + + return await this.client.call('post', path: path, params: params); + } + /// Use this endpoint to complete the user account password reset. Both the + /// **userId** and **secret** arguments will be passed as query parameters to + /// the redirect URL you have provided when sending your request to the + /// /auth/recovery endpoint. + /// + /// Please note that in order to avoid a [Redirect + /// Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) + /// the only valid redirect URLs are the ones from domains you have set when + /// adding your platforms in the console interface. + Future updateRecovery({userId, secret, passwordA, passwordB}) async { + String path = '/account/recovery'; + + Map params = { + 'userId': userId, + 'secret': secret, + 'password-a': passwordA, + 'password-b': passwordB, + }; + + return await this.client.call('put', path: path, params: params); + } + /// Get currently logged in user list of active sessions across different + /// devices. + Future getSessions() async { + String path = '/account/sessions'; + + Map params = { + }; + + return await this.client.call('get', path: path, params: params); + } + /// Allow the user to login into his account by providing a valid email and + /// password combination. Use the success and failure arguments to provide a + /// redirect URL's back to your app when login is completed. + /// + /// Please note that in order to avoid a [Redirect + /// Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) + /// the only valid redirect URLs are the ones from domains you have set when + /// adding your platforms in the console interface. + /// + /// When accessing this route using Javascript from the browser, success and + /// failure parameter URLs are required. Appwrite server will respond with a + /// 301 redirect status code and will set the user session cookie. This + /// behavior is enforced because modern browsers are limiting 3rd party cookies + /// in XHR of fetch requests to protect user privacy. + Future createSession({email, password}) async { + String path = '/account/sessions'; + + Map params = { + 'email': email, + 'password': password, + }; + + return await this.client.call('post', path: path, params: params); + } + /// Delete all sessions from the user account and remove any sessions cookies + /// from the end client. + Future deleteSessions() async { + String path = '/account/sessions'; + + Map params = { + }; + + return await this.client.call('delete', path: path, params: params); + } + /// Use this endpoint to log out the currently logged in user from his account. + /// When successful this endpoint will delete the user session and remove the + /// session secret cookie from the user client. + Future deleteCurrentSession() async { + String path = '/account/sessions/current'; + + Map params = { + }; + + return await this.client.call('delete', path: path, params: params); + } + /// Allow the user to login to his account using the OAuth provider of his + /// choice. Each OAuth provider should be enabled from the Appwrite console + /// first. Use the success and failure arguments to provide a redirect URL's + /// back to your app when login is completed. + Future createOAuthSession({provider, success, failure}) async { + String path = '/account/sessions/oauth/{provider}'.replaceAll(RegExp('{provider}'), provider); + + Map params = { + 'success': success, + 'failure': failure, + }; + + return await this.client.call('get', path: path, params: params); + } + /// Use this endpoint to log out the currently logged in user from all his + /// account sessions across all his different devices. When using the option id + /// argument, only the session unique ID provider will be deleted. + Future deleteSession({id}) async { + String path = '/account/sessions/{id}'.replaceAll(RegExp('{id}'), id); + + Map params = { + }; + + return await this.client.call('delete', path: path, params: params); + } + /// Use this endpoint to complete the user email verification process. Use both + /// the **userId** and **secret** parameters that were attached to your app URL + /// to verify the user email ownership. If confirmed this route will return a + /// 200 status code. + Future updateVerification({userId, secret, passwordB}) async { + String path = '/account/verification'; + + Map params = { + 'userId': userId, + 'secret': secret, + 'password-b': passwordB, + }; + + return await this.client.call('put', path: path, params: params); + } +} \ No newline at end of file diff --git a/app/sdks/dart/lib/services/avatars.dart b/app/sdks/dart/lib/services/avatars.dart new file mode 100644 index 0000000000..4ffcc6aa15 --- /dev/null +++ b/app/sdks/dart/lib/services/avatars.dart @@ -0,0 +1,93 @@ +import "package:appwrite/service.dart"; +import "package:appwrite/client.dart"; +import 'package:dio/dio.dart'; + +class Avatars extends Service { + + Avatars(Client client): super(client); + + /// You can use this endpoint to show different browser icons to your users. + /// The code argument receives the browser code as it appears in your user + /// /account/sessions endpoint. Use width, height and quality arguments to + /// change the output settings. + Future getBrowser({code, width = 100, height = 100, quality = 100}) async { + String path = '/avatars/browsers/{code}'.replaceAll(RegExp('{code}'), code); + + Map 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 getCreditCard({code, width = 100, height = 100, quality = 100}) async { + String path = '/avatars/credit-cards/{code}'.replaceAll(RegExp('{code}'), code); + + Map 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 getFavicon({url}) async { + String path = '/avatars/favicon'; + + Map 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 getFlag({code, width = 100, height = 100, quality = 100}) async { + String path = '/avatars/flags/{code}'.replaceAll(RegExp('{code}'), code); + + Map 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 getImage({url, width = 400, height = 400}) async { + String path = '/avatars/image'; + + Map 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 getQR({text, size = 400, margin = 1, download = null}) async { + String path = '/avatars/qr'; + + Map params = { + 'text': text, + 'size': size, + 'margin': margin, + 'download': download, + }; + + return await this.client.call('get', path: path, params: params); + } +} \ No newline at end of file diff --git a/app/sdks/dart/lib/services/database.dart b/app/sdks/dart/lib/services/database.dart new file mode 100644 index 0000000000..fe475e2afc --- /dev/null +++ b/app/sdks/dart/lib/services/database.dart @@ -0,0 +1,139 @@ +import "package:appwrite/service.dart"; +import "package:appwrite/client.dart"; +import 'package:dio/dio.dart'; + +class Database extends Service { + + Database(Client client): super(client); + + /// Get a list of all the user collections. You can use the query params to + /// filter your results. On admin mode, this endpoint will return a list of all + /// of the project collections. [Learn more about different API + /// modes](/docs/admin). + Future listCollections({search = null, limit = 25, offset = null, orderType = 'ASC'}) async { + String path = '/database/collections'; + + Map params = { + 'search': search, + 'limit': limit, + 'offset': offset, + 'orderType': orderType, + }; + + return await this.client.call('get', path: path, params: params); + } + /// Create a new Collection. + Future createCollection({name, read, write, rules}) async { + String path = '/database/collections'; + + Map 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 getCollection({collectionId}) async { + String path = '/database/collections/{collectionId}'.replaceAll(RegExp('{collectionId}'), collectionId); + + Map params = { + }; + + return await this.client.call('get', path: path, params: params); + } + /// Update collection by its unique ID. + Future updateCollection({collectionId, name, read, write, rules = const []}) async { + String path = '/database/collections/{collectionId}'.replaceAll(RegExp('{collectionId}'), collectionId); + + Map 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 deleteCollection({collectionId}) async { + String path = '/database/collections/{collectionId}'.replaceAll(RegExp('{collectionId}'), collectionId); + + Map 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 listDocuments({collectionId, filters = const [], offset = null, limit = 50, orderField = '\$uid', orderType = 'ASC', orderCast = 'string', search = null, first = null, last = null}) async { + String path = '/database/collections/{collectionId}/documents'.replaceAll(RegExp('{collectionId}'), collectionId); + + Map 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 createDocument({collectionId, data, read, write, parentDocument = null, parentProperty = null, parentPropertyType = 'assign'}) async { + String path = '/database/collections/{collectionId}/documents'.replaceAll(RegExp('{collectionId}'), collectionId); + + Map 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 getDocument({collectionId, documentId}) async { + String path = '/database/collections/{collectionId}/documents/{documentId}'.replaceAll(RegExp('{collectionId}'), collectionId).replaceAll(RegExp('{documentId}'), documentId); + + Map params = { + }; + + return await this.client.call('get', path: path, params: params); + } + Future updateDocument({collectionId, documentId, data, read, write}) async { + String path = '/database/collections/{collectionId}/documents/{documentId}'.replaceAll(RegExp('{collectionId}'), collectionId).replaceAll(RegExp('{documentId}'), documentId); + + Map 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 deleteDocument({collectionId, documentId}) async { + String path = '/database/collections/{collectionId}/documents/{documentId}'.replaceAll(RegExp('{collectionId}'), collectionId).replaceAll(RegExp('{documentId}'), documentId); + + Map params = { + }; + + return await this.client.call('delete', path: path, params: params); + } +} \ No newline at end of file diff --git a/app/sdks/dart/lib/services/locale.dart b/app/sdks/dart/lib/services/locale.dart new file mode 100644 index 0000000000..208c72bd08 --- /dev/null +++ b/app/sdks/dart/lib/services/locale.dart @@ -0,0 +1,74 @@ +import "package:appwrite/service.dart"; +import "package:appwrite/client.dart"; +import 'package:dio/dio.dart'; + +class Locale extends Service { + + Locale(Client client): super(client); + + /// Get the current user location based on IP. Returns an object with user + /// country code, country name, continent name, continent code, ip address and + /// suggested currency. You can use the locale header to get the data in a + /// supported language. + /// + /// ([IP Geolocation by DB-IP](https://db-ip.com)) + Future get() async { + String path = '/locale'; + + Map 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 getContinents() async { + String path = '/locale/continents'; + + Map 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 getCountries() async { + String path = '/locale/countries'; + + Map params = { + }; + + return await this.client.call('get', path: path, params: params); + } + /// List of all countries that are currently members of the EU. You can use the + /// locale header to get the data in a supported language. + Future getCountriesEU() async { + String path = '/locale/countries/eu'; + + Map 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 getCountriesPhones() async { + String path = '/locale/countries/phones'; + + Map 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 getCurrencies() async { + String path = '/locale/currencies'; + + Map params = { + }; + + return await this.client.call('get', path: path, params: params); + } +} \ No newline at end of file diff --git a/app/sdks/dart/lib/services/storage.dart b/app/sdks/dart/lib/services/storage.dart new file mode 100644 index 0000000000..8e333f689d --- /dev/null +++ b/app/sdks/dart/lib/services/storage.dart @@ -0,0 +1,109 @@ +import "package:appwrite/service.dart"; +import "package:appwrite/client.dart"; +import 'package:dio/dio.dart'; + +class Storage extends Service { + + Storage(Client client): super(client); + + /// Get a list of all the user files. You can use the query params to filter + /// your results. On admin mode, this endpoint will return a list of all of the + /// project files. [Learn more about different API modes](/docs/admin). + Future list({search = null, limit = 25, offset = null, orderType = 'ASC'}) async { + String path = '/storage/files'; + + Map 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 create({file, read, write}) async { + String path = '/storage/files'; + + Map params = { + 'file': file, + 'read': read, + 'write': write, + }; + + return await this.client.call('post', path: path, params: params); + } + /// Get file by its unique ID. This endpoint response returns a JSON object + /// with the file metadata. + Future get({fileId}) async { + String path = '/storage/files/{fileId}'.replaceAll(RegExp('{fileId}'), fileId); + + Map 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 update({fileId, read, write}) async { + String path = '/storage/files/{fileId}'.replaceAll(RegExp('{fileId}'), fileId); + + Map 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 delete({fileId}) async { + String path = '/storage/files/{fileId}'.replaceAll(RegExp('{fileId}'), fileId); + + Map 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 getDownload({fileId}) async { + String path = '/storage/files/{fileId}/download'.replaceAll(RegExp('{fileId}'), fileId); + + Map params = { + }; + + return await this.client.call('get', path: path, params: params); + } + /// Get a file preview image. Currently, this method supports preview for image + /// files (jpg, png, and gif), other supported formats, like pdf, docs, slides, + /// and spreadsheets, will return the file icon image. You can also pass query + /// string arguments for cutting and resizing your preview image. + Future getPreview({fileId, width = null, height = null, quality = 100, background = null, output = null}) async { + String path = '/storage/files/{fileId}/preview'.replaceAll(RegExp('{fileId}'), fileId); + + Map 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 getView({fileId, as = null}) async { + String path = '/storage/files/{fileId}/view'.replaceAll(RegExp('{fileId}'), fileId); + + Map params = { + 'as': as, + }; + + return await this.client.call('get', path: path, params: params); + } +} \ No newline at end of file diff --git a/app/sdks/dart/lib/services/teams.dart b/app/sdks/dart/lib/services/teams.dart new file mode 100644 index 0000000000..486b43a027 --- /dev/null +++ b/app/sdks/dart/lib/services/teams.dart @@ -0,0 +1,140 @@ +import "package:appwrite/service.dart"; +import "package:appwrite/client.dart"; +import 'package:dio/dio.dart'; + +class Teams extends Service { + + Teams(Client client): super(client); + + /// Get a list of all the current user teams. You can use the query params to + /// filter your results. On admin mode, this endpoint will return a list of all + /// of the project teams. [Learn more about different API modes](/docs/admin). + Future list({search = null, limit = 25, offset = null, orderType = 'ASC'}) async { + String path = '/teams'; + + Map 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 create({name, roles = const ["owner"]}) async { + String path = '/teams'; + + Map 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 get({teamId}) async { + String path = '/teams/{teamId}'.replaceAll(RegExp('{teamId}'), teamId); + + Map 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 update({teamId, name}) async { + String path = '/teams/{teamId}'.replaceAll(RegExp('{teamId}'), teamId); + + Map 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 delete({teamId}) async { + String path = '/teams/{teamId}'.replaceAll(RegExp('{teamId}'), teamId); + + Map 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 getMemberships({teamId}) async { + String path = '/teams/{teamId}/memberships'.replaceAll(RegExp('{teamId}'), teamId); + + Map params = { + }; + + return await this.client.call('get', path: path, params: params); + } + /// Use this endpoint to invite a new member to your team. An email with a link + /// to join the team will be sent to the new member email address. If member + /// doesn't exists in the project it will be automatically created. + /// + /// Use the 'url' parameter to redirect the user from the invitation email back + /// to your app. When the user is redirected, use the [Update Team Membership + /// Status](/docs/teams#updateTeamMembershipStatus) endpoint to finally join + /// the user to the team. + /// + /// Please note that in order to avoid a [Redirect + /// Attacks](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) + /// the only valid redirect URL's are the once from domains you have set when + /// added your platforms in the console interface. + Future createMembership({teamId, email, roles, url, name = null}) async { + String path = '/teams/{teamId}/memberships'.replaceAll(RegExp('{teamId}'), teamId); + + Map params = { + 'email': email, + 'name': name, + 'roles': roles, + 'url': url, + }; + + return await this.client.call('post', path: path, params: params); + } + /// This endpoint allows a user to leave a team or for a team owner to delete + /// the membership of any other team member. You can also use this endpoint to + /// delete a user membership even if he didn't accept it. + Future deleteMembership({teamId, inviteId}) async { + String path = '/teams/{teamId}/memberships/{inviteId}'.replaceAll(RegExp('{teamId}'), teamId).replaceAll(RegExp('{inviteId}'), inviteId); + + Map params = { + }; + + return await this.client.call('delete', path: path, params: params); + } + /// Use this endpoint to let user accept an invitation to join a team after he + /// is being redirect back to your app from the invitation email. Use the + /// success and failure URL's to redirect users back to your application after + /// the request completes. + /// + /// Please note that in order to avoid a [Redirect + /// Attacks](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) + /// the only valid redirect URL's are the once from domains you have set when + /// added your platforms in the console interface. + /// + /// When not using the success or failure redirect arguments this endpoint will + /// result with a 200 status code on success and with 401 status error on + /// failure. This behavior was applied to help the web clients deal with + /// browsers who don't allow to set 3rd party HTTP cookies needed for saving + /// the account session key. + Future updateMembershipStatus({teamId, inviteId, userId, secret}) async { + String path = '/teams/{teamId}/memberships/{inviteId}/status'.replaceAll(RegExp('{teamId}'), teamId).replaceAll(RegExp('{inviteId}'), inviteId); + + Map params = { + 'userId': userId, + 'secret': secret, + }; + + return await this.client.call('patch', path: path, params: params); + } +} \ No newline at end of file diff --git a/app/sdks/dart/pubspec.yaml b/app/sdks/dart/pubspec.yaml new file mode 100644 index 0000000000..95225dfda5 --- /dev/null +++ b/app/sdks/dart/pubspec.yaml @@ -0,0 +1,11 @@ +name: appwrite +version: 0.0.6 +description: Appwrite backend as a service cuts up to 70% of the time and costs required for building a modern application. We abstract and simplify common development tasks behind a REST APIs, to help you develop your app in a fast and secure way. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs) +author: Appwrite Team +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 \ No newline at end of file diff --git a/app/sdks/go/database.go b/app/sdks/go/database.go index e67aa130d9..9a26c19374 100644 --- a/app/sdks/go/database.go +++ b/app/sdks/go/database.go @@ -22,7 +22,7 @@ func NewDatabase(clt Client) Database { // return a list of all of the project collections. [Learn more about // different API modes](/docs/admin). func (srv *Database) ListCollections(Search string, Limit int, Offset int, OrderType string) (map[string]interface{}, error) { - path := "/database" + path := "/database/collections" params := map[string]interface{}{ "search": Search, @@ -36,7 +36,7 @@ func (srv *Database) ListCollections(Search string, Limit int, Offset int, Order // CreateCollection create a new Collection. func (srv *Database) CreateCollection(Name string, Read []interface{}, Write []interface{}, Rules []interface{}) (map[string]interface{}, error) { - path := "/database" + path := "/database/collections" params := map[string]interface{}{ "name": Name, @@ -52,7 +52,7 @@ func (srv *Database) CreateCollection(Name string, Read []interface{}, Write []i // returns a JSON object with the collection metadata. func (srv *Database) GetCollection(CollectionId string) (map[string]interface{}, error) { r := strings.NewReplacer("{collectionId}", CollectionId) - path := r.Replace("/database/{collectionId}") + path := r.Replace("/database/collections/{collectionId}") params := map[string]interface{}{ } @@ -63,7 +63,7 @@ func (srv *Database) GetCollection(CollectionId string) (map[string]interface{}, // UpdateCollection update collection by its unique ID. func (srv *Database) UpdateCollection(CollectionId string, Name string, Read []interface{}, Write []interface{}, Rules []interface{}) (map[string]interface{}, error) { r := strings.NewReplacer("{collectionId}", CollectionId) - path := r.Replace("/database/{collectionId}") + path := r.Replace("/database/collections/{collectionId}") params := map[string]interface{}{ "name": Name, @@ -79,7 +79,7 @@ func (srv *Database) UpdateCollection(CollectionId string, Name string, Read []i // write permissions have access to delete this resource. func (srv *Database) DeleteCollection(CollectionId string) (map[string]interface{}, error) { r := strings.NewReplacer("{collectionId}", CollectionId) - path := r.Replace("/database/{collectionId}") + path := r.Replace("/database/collections/{collectionId}") params := map[string]interface{}{ } @@ -93,7 +93,7 @@ func (srv *Database) DeleteCollection(CollectionId string) (map[string]interface // modes](/docs/admin). func (srv *Database) ListDocuments(CollectionId string, Filters []interface{}, Offset int, Limit int, OrderField string, OrderType string, OrderCast string, Search string, First int, Last int) (map[string]interface{}, error) { r := strings.NewReplacer("{collectionId}", CollectionId) - path := r.Replace("/database/{collectionId}/documents") + path := r.Replace("/database/collections/{collectionId}/documents") params := map[string]interface{}{ "filters": Filters, @@ -113,7 +113,7 @@ func (srv *Database) ListDocuments(CollectionId string, Filters []interface{}, O // CreateDocument create a new Document. func (srv *Database) CreateDocument(CollectionId string, Data string, Read []interface{}, Write []interface{}, ParentDocument string, ParentProperty string, ParentPropertyType string) (map[string]interface{}, error) { r := strings.NewReplacer("{collectionId}", CollectionId) - path := r.Replace("/database/{collectionId}/documents") + path := r.Replace("/database/collections/{collectionId}/documents") params := map[string]interface{}{ "data": Data, @@ -131,7 +131,7 @@ func (srv *Database) CreateDocument(CollectionId string, Data string, Read []int // JSON object with the document data. func (srv *Database) GetDocument(CollectionId string, DocumentId string) (map[string]interface{}, error) { r := strings.NewReplacer("{collectionId}", CollectionId, "{documentId}", DocumentId) - path := r.Replace("/database/{collectionId}/documents/{documentId}") + path := r.Replace("/database/collections/{collectionId}/documents/{documentId}") params := map[string]interface{}{ } @@ -142,7 +142,7 @@ func (srv *Database) GetDocument(CollectionId string, DocumentId string) (map[st // UpdateDocument func (srv *Database) UpdateDocument(CollectionId string, DocumentId string, Data string, Read []interface{}, Write []interface{}) (map[string]interface{}, error) { r := strings.NewReplacer("{collectionId}", CollectionId, "{documentId}", DocumentId) - path := r.Replace("/database/{collectionId}/documents/{documentId}") + path := r.Replace("/database/collections/{collectionId}/documents/{documentId}") params := map[string]interface{}{ "data": Data, @@ -158,7 +158,7 @@ func (srv *Database) UpdateDocument(CollectionId string, DocumentId string, Data // Child documents **will not** be deleted. func (srv *Database) DeleteDocument(CollectionId string, DocumentId string) (map[string]interface{}, error) { r := strings.NewReplacer("{collectionId}", CollectionId, "{documentId}", DocumentId) - path := r.Replace("/database/{collectionId}/documents/{documentId}") + path := r.Replace("/database/collections/{collectionId}/documents/{documentId}") params := map[string]interface{}{ } diff --git a/app/sdks/go/docs/examples/locale/get-locale.md b/app/sdks/go/docs/examples/locale/get.md similarity index 87% rename from app/sdks/go/docs/examples/locale/get-locale.md rename to app/sdks/go/docs/examples/locale/get.md index e3596c4939..edca6b6bc7 100644 --- a/app/sdks/go/docs/examples/locale/get-locale.md +++ b/app/sdks/go/docs/examples/locale/get.md @@ -15,7 +15,7 @@ func main() { client: &client } - var response, error := service.GetLocale() + var response, error := service.Get() if error != nil { panic(error) diff --git a/app/sdks/go/docs/examples/storage/get-file.md b/app/sdks/go/docs/examples/storage/create.md similarity index 85% rename from app/sdks/go/docs/examples/storage/get-file.md rename to app/sdks/go/docs/examples/storage/create.md index 18ba1bd623..edfe6466fc 100644 --- a/app/sdks/go/docs/examples/storage/get-file.md +++ b/app/sdks/go/docs/examples/storage/create.md @@ -15,7 +15,7 @@ func main() { client: &client } - var response, error := service.GetFile("[FILE_ID]") + var response, error := service.Create(file, [], []) if error != nil { panic(error) diff --git a/app/sdks/go/docs/examples/storage/delete-file.md b/app/sdks/go/docs/examples/storage/delete.md similarity index 84% rename from app/sdks/go/docs/examples/storage/delete-file.md rename to app/sdks/go/docs/examples/storage/delete.md index 58bdf43fc2..e1d6ebf227 100644 --- a/app/sdks/go/docs/examples/storage/delete-file.md +++ b/app/sdks/go/docs/examples/storage/delete.md @@ -15,7 +15,7 @@ func main() { client: &client } - var response, error := service.DeleteFile("[FILE_ID]") + var response, error := service.Delete("[FILE_ID]") if error != nil { panic(error) diff --git a/app/sdks/go/docs/examples/storage/create-file.md b/app/sdks/go/docs/examples/storage/get-download.md similarity index 84% rename from app/sdks/go/docs/examples/storage/create-file.md rename to app/sdks/go/docs/examples/storage/get-download.md index 167661e740..e4b44e0bef 100644 --- a/app/sdks/go/docs/examples/storage/create-file.md +++ b/app/sdks/go/docs/examples/storage/get-download.md @@ -15,7 +15,7 @@ func main() { client: &client } - var response, error := service.CreateFile(file, [], []) + var response, error := service.GetDownload("[FILE_ID]") if error != nil { panic(error) diff --git a/app/sdks/go/docs/examples/storage/get-file-preview.md b/app/sdks/go/docs/examples/storage/get-file-preview.md deleted file mode 100644 index 6ee4a129cb..0000000000 --- a/app/sdks/go/docs/examples/storage/get-file-preview.md +++ /dev/null @@ -1,25 +0,0 @@ -package main - -import ( - "fmt" - "github.com/appwrite/sdk-for-go" -) - -func main() { - var client := appwrite.Client{} - - client.SetProject("") - client.SetKey("") - - var service := appwrite.Storage{ - client: &client - } - - var response, error := service.GetFilePreview("[FILE_ID]", 0, 0, 0, "", "jpg") - - if error != nil { - panic(error) - } - - fmt.Println(response) -} \ No newline at end of file diff --git a/app/sdks/go/docs/examples/storage/get-file-view.md b/app/sdks/go/docs/examples/storage/get-preview.md similarity index 80% rename from app/sdks/go/docs/examples/storage/get-file-view.md rename to app/sdks/go/docs/examples/storage/get-preview.md index 2a444aa6a5..5c59b45223 100644 --- a/app/sdks/go/docs/examples/storage/get-file-view.md +++ b/app/sdks/go/docs/examples/storage/get-preview.md @@ -15,7 +15,7 @@ func main() { client: &client } - var response, error := service.GetFileView("[FILE_ID]", "pdf") + var response, error := service.GetPreview("[FILE_ID]", 0, 0, 0, "", "jpg") if error != nil { panic(error) diff --git a/app/sdks/go/docs/examples/storage/get-file-download.md b/app/sdks/go/docs/examples/storage/get-view.md similarity index 83% rename from app/sdks/go/docs/examples/storage/get-file-download.md rename to app/sdks/go/docs/examples/storage/get-view.md index 1ac2f94d4d..983b76c05e 100644 --- a/app/sdks/go/docs/examples/storage/get-file-download.md +++ b/app/sdks/go/docs/examples/storage/get-view.md @@ -15,7 +15,7 @@ func main() { client: &client } - var response, error := service.GetFileDownload("[FILE_ID]") + var response, error := service.GetView("[FILE_ID]", "pdf") if error != nil { panic(error) diff --git a/app/sdks/go/docs/examples/storage/get.md b/app/sdks/go/docs/examples/storage/get.md new file mode 100644 index 0000000000..7c203b1092 --- /dev/null +++ b/app/sdks/go/docs/examples/storage/get.md @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go" +) + +func main() { + var client := appwrite.Client{} + + client.SetProject("") + client.SetKey("") + + var service := appwrite.Storage{ + client: &client + } + + var response, error := service.Get("[FILE_ID]") + + if error != nil { + panic(error) + } + + fmt.Println(response) +} \ No newline at end of file diff --git a/app/sdks/go/docs/examples/storage/list-files.md b/app/sdks/go/docs/examples/storage/list-files.md deleted file mode 100644 index 78cf9379a3..0000000000 --- a/app/sdks/go/docs/examples/storage/list-files.md +++ /dev/null @@ -1,25 +0,0 @@ -package main - -import ( - "fmt" - "github.com/appwrite/sdk-for-go" -) - -func main() { - var client := appwrite.Client{} - - client.SetProject("") - client.SetKey("") - - var service := appwrite.Storage{ - client: &client - } - - var response, error := service.ListFiles("[SEARCH]", 0, 0, "ASC") - - if error != nil { - panic(error) - } - - fmt.Println(response) -} \ No newline at end of file diff --git a/app/sdks/go/docs/examples/storage/list.md b/app/sdks/go/docs/examples/storage/list.md new file mode 100644 index 0000000000..836098be57 --- /dev/null +++ b/app/sdks/go/docs/examples/storage/list.md @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go" +) + +func main() { + var client := appwrite.Client{} + + client.SetProject("") + client.SetKey("") + + var service := appwrite.Storage{ + client: &client + } + + var response, error := service.List("[SEARCH]", 0, 0, "ASC") + + if error != nil { + panic(error) + } + + fmt.Println(response) +} \ No newline at end of file diff --git a/app/sdks/go/docs/examples/storage/update-file.md b/app/sdks/go/docs/examples/storage/update-file.md deleted file mode 100644 index 4ef34d4d59..0000000000 --- a/app/sdks/go/docs/examples/storage/update-file.md +++ /dev/null @@ -1,25 +0,0 @@ -package main - -import ( - "fmt" - "github.com/appwrite/sdk-for-go" -) - -func main() { - var client := appwrite.Client{} - - client.SetProject("") - client.SetKey("") - - var service := appwrite.Storage{ - client: &client - } - - var response, error := service.UpdateFile("[FILE_ID]", [], []) - - if error != nil { - panic(error) - } - - fmt.Println(response) -} \ No newline at end of file diff --git a/app/sdks/go/docs/examples/storage/update.md b/app/sdks/go/docs/examples/storage/update.md new file mode 100644 index 0000000000..a46025b485 --- /dev/null +++ b/app/sdks/go/docs/examples/storage/update.md @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go" +) + +func main() { + var client := appwrite.Client{} + + client.SetProject("") + client.SetKey("") + + var service := appwrite.Storage{ + client: &client + } + + var response, error := service.Update("[FILE_ID]", [], []) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} \ No newline at end of file diff --git a/app/sdks/go/docs/examples/teams/delete-team-membership.md b/app/sdks/go/docs/examples/teams/create-membership.md similarity index 72% rename from app/sdks/go/docs/examples/teams/delete-team-membership.md rename to app/sdks/go/docs/examples/teams/create-membership.md index 6d69bfbccc..5d526cdefd 100644 --- a/app/sdks/go/docs/examples/teams/delete-team-membership.md +++ b/app/sdks/go/docs/examples/teams/create-membership.md @@ -15,7 +15,7 @@ func main() { client: &client } - var response, error := service.DeleteTeamMembership("[TEAM_ID]", "[INVITE_ID]") + var response, error := service.CreateMembership("[TEAM_ID]", "email@example.com", [], "https://example.com", "[NAME]") if error != nil { panic(error) diff --git a/app/sdks/go/docs/examples/teams/create-team-membership.md b/app/sdks/go/docs/examples/teams/create-team-membership.md deleted file mode 100644 index 0cc0e4c379..0000000000 --- a/app/sdks/go/docs/examples/teams/create-team-membership.md +++ /dev/null @@ -1,25 +0,0 @@ -package main - -import ( - "fmt" - "github.com/appwrite/sdk-for-go" -) - -func main() { - var client := appwrite.Client{} - - client.SetProject("") - client.SetKey("") - - var service := appwrite.Teams{ - client: &client - } - - var response, error := service.CreateTeamMembership("[TEAM_ID]", "email@example.com", [], "https://example.com", "[NAME]") - - if error != nil { - panic(error) - } - - fmt.Println(response) -} \ No newline at end of file diff --git a/app/sdks/go/docs/examples/teams/get-team.md b/app/sdks/go/docs/examples/teams/create.md similarity index 84% rename from app/sdks/go/docs/examples/teams/get-team.md rename to app/sdks/go/docs/examples/teams/create.md index 27a8505f7d..a9a3684271 100644 --- a/app/sdks/go/docs/examples/teams/get-team.md +++ b/app/sdks/go/docs/examples/teams/create.md @@ -15,7 +15,7 @@ func main() { client: &client } - var response, error := service.GetTeam("[TEAM_ID]") + var response, error := service.Create("[NAME]", []) if error != nil { panic(error) diff --git a/app/sdks/go/docs/examples/teams/delete-membership.md b/app/sdks/go/docs/examples/teams/delete-membership.md new file mode 100644 index 0000000000..ef5517a4d5 --- /dev/null +++ b/app/sdks/go/docs/examples/teams/delete-membership.md @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go" +) + +func main() { + var client := appwrite.Client{} + + client.SetProject("") + client.SetKey("") + + var service := appwrite.Teams{ + client: &client + } + + var response, error := service.DeleteMembership("[TEAM_ID]", "[INVITE_ID]") + + if error != nil { + panic(error) + } + + fmt.Println(response) +} \ No newline at end of file diff --git a/app/sdks/go/docs/examples/teams/delete-team.md b/app/sdks/go/docs/examples/teams/delete.md similarity index 84% rename from app/sdks/go/docs/examples/teams/delete-team.md rename to app/sdks/go/docs/examples/teams/delete.md index 09c3e10f5f..b0dd016239 100644 --- a/app/sdks/go/docs/examples/teams/delete-team.md +++ b/app/sdks/go/docs/examples/teams/delete.md @@ -15,7 +15,7 @@ func main() { client: &client } - var response, error := service.DeleteTeam("[TEAM_ID]") + var response, error := service.Delete("[TEAM_ID]") if error != nil { panic(error) diff --git a/app/sdks/go/docs/examples/teams/get-team-memberships.md b/app/sdks/go/docs/examples/teams/get-memberships.md similarity index 82% rename from app/sdks/go/docs/examples/teams/get-team-memberships.md rename to app/sdks/go/docs/examples/teams/get-memberships.md index 4ca6e7630c..0cfc217436 100644 --- a/app/sdks/go/docs/examples/teams/get-team-memberships.md +++ b/app/sdks/go/docs/examples/teams/get-memberships.md @@ -15,7 +15,7 @@ func main() { client: &client } - var response, error := service.GetTeamMemberships("[TEAM_ID]") + var response, error := service.GetMemberships("[TEAM_ID]") if error != nil { panic(error) diff --git a/app/sdks/go/docs/examples/teams/create-team.md b/app/sdks/go/docs/examples/teams/get.md similarity index 84% rename from app/sdks/go/docs/examples/teams/create-team.md rename to app/sdks/go/docs/examples/teams/get.md index 27aea5d2f5..ffc6013e06 100644 --- a/app/sdks/go/docs/examples/teams/create-team.md +++ b/app/sdks/go/docs/examples/teams/get.md @@ -15,7 +15,7 @@ func main() { client: &client } - var response, error := service.CreateTeam("[NAME]", []) + var response, error := service.Get("[TEAM_ID]") if error != nil { panic(error) diff --git a/app/sdks/go/docs/examples/teams/list-teams.md b/app/sdks/go/docs/examples/teams/list-teams.md deleted file mode 100644 index cf7e13f6a1..0000000000 --- a/app/sdks/go/docs/examples/teams/list-teams.md +++ /dev/null @@ -1,25 +0,0 @@ -package main - -import ( - "fmt" - "github.com/appwrite/sdk-for-go" -) - -func main() { - var client := appwrite.Client{} - - client.SetProject("") - client.SetKey("") - - var service := appwrite.Teams{ - client: &client - } - - var response, error := service.ListTeams("[SEARCH]", 0, 0, "ASC") - - if error != nil { - panic(error) - } - - fmt.Println(response) -} \ No newline at end of file diff --git a/app/sdks/go/docs/examples/teams/list.md b/app/sdks/go/docs/examples/teams/list.md new file mode 100644 index 0000000000..8fb23566bd --- /dev/null +++ b/app/sdks/go/docs/examples/teams/list.md @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go" +) + +func main() { + var client := appwrite.Client{} + + client.SetProject("") + client.SetKey("") + + var service := appwrite.Teams{ + client: &client + } + + var response, error := service.List("[SEARCH]", 0, 0, "ASC") + + if error != nil { + panic(error) + } + + fmt.Println(response) +} \ No newline at end of file diff --git a/app/sdks/go/docs/examples/teams/update-team.md b/app/sdks/go/docs/examples/teams/update-team.md deleted file mode 100644 index 192cae2d0f..0000000000 --- a/app/sdks/go/docs/examples/teams/update-team.md +++ /dev/null @@ -1,25 +0,0 @@ -package main - -import ( - "fmt" - "github.com/appwrite/sdk-for-go" -) - -func main() { - var client := appwrite.Client{} - - client.SetProject("") - client.SetKey("") - - var service := appwrite.Teams{ - client: &client - } - - var response, error := service.UpdateTeam("[TEAM_ID]", "[NAME]") - - if error != nil { - panic(error) - } - - fmt.Println(response) -} \ No newline at end of file diff --git a/app/sdks/go/docs/examples/teams/update.md b/app/sdks/go/docs/examples/teams/update.md new file mode 100644 index 0000000000..32fbc3752c --- /dev/null +++ b/app/sdks/go/docs/examples/teams/update.md @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go" +) + +func main() { + var client := appwrite.Client{} + + client.SetProject("") + client.SetKey("") + + var service := appwrite.Teams{ + client: &client + } + + var response, error := service.Update("[TEAM_ID]", "[NAME]") + + if error != nil { + panic(error) + } + + fmt.Println(response) +} \ No newline at end of file diff --git a/app/sdks/go/docs/examples/users/create-user.md b/app/sdks/go/docs/examples/users/create-user.md deleted file mode 100644 index 098d65800a..0000000000 --- a/app/sdks/go/docs/examples/users/create-user.md +++ /dev/null @@ -1,25 +0,0 @@ -package main - -import ( - "fmt" - "github.com/appwrite/sdk-for-go" -) - -func main() { - var client := appwrite.Client{} - - client.SetProject("") - client.SetKey("") - - var service := appwrite.Users{ - client: &client - } - - var response, error := service.CreateUser("email@example.com", "password", "[NAME]") - - if error != nil { - panic(error) - } - - fmt.Println(response) -} \ No newline at end of file diff --git a/app/sdks/go/docs/examples/users/delete-user-session.md b/app/sdks/go/docs/examples/users/create.md similarity index 78% rename from app/sdks/go/docs/examples/users/delete-user-session.md rename to app/sdks/go/docs/examples/users/create.md index 3ad927b3b0..76c932441c 100644 --- a/app/sdks/go/docs/examples/users/delete-user-session.md +++ b/app/sdks/go/docs/examples/users/create.md @@ -15,7 +15,7 @@ func main() { client: &client } - var response, error := service.DeleteUserSession("[USER_ID]", "[SESSION_ID]") + var response, error := service.Create("email@example.com", "password", "[NAME]") if error != nil { panic(error) diff --git a/app/sdks/go/docs/examples/users/delete-user-sessions.md b/app/sdks/go/docs/examples/users/delete-session.md similarity index 80% rename from app/sdks/go/docs/examples/users/delete-user-sessions.md rename to app/sdks/go/docs/examples/users/delete-session.md index cd6d79d98c..a3c5879b8e 100644 --- a/app/sdks/go/docs/examples/users/delete-user-sessions.md +++ b/app/sdks/go/docs/examples/users/delete-session.md @@ -15,7 +15,7 @@ func main() { client: &client } - var response, error := service.DeleteUserSessions("[USER_ID]") + var response, error := service.DeleteSession("[USER_ID]", "[SESSION_ID]") if error != nil { panic(error) diff --git a/app/sdks/go/docs/examples/users/get-user-sessions.md b/app/sdks/go/docs/examples/users/delete-sessions.md similarity index 83% rename from app/sdks/go/docs/examples/users/get-user-sessions.md rename to app/sdks/go/docs/examples/users/delete-sessions.md index f2beabc22b..d4acdf8fa3 100644 --- a/app/sdks/go/docs/examples/users/get-user-sessions.md +++ b/app/sdks/go/docs/examples/users/delete-sessions.md @@ -15,7 +15,7 @@ func main() { client: &client } - var response, error := service.GetUserSessions("[USER_ID]") + var response, error := service.DeleteSessions("[USER_ID]") if error != nil { panic(error) diff --git a/app/sdks/go/docs/examples/users/get-user.md b/app/sdks/go/docs/examples/users/get-logs.md similarity index 84% rename from app/sdks/go/docs/examples/users/get-user.md rename to app/sdks/go/docs/examples/users/get-logs.md index 8903b422e9..91e6ffe302 100644 --- a/app/sdks/go/docs/examples/users/get-user.md +++ b/app/sdks/go/docs/examples/users/get-logs.md @@ -15,7 +15,7 @@ func main() { client: &client } - var response, error := service.GetUser("[USER_ID]") + var response, error := service.GetLogs("[USER_ID]") if error != nil { panic(error) diff --git a/app/sdks/go/docs/examples/users/get-user-logs.md b/app/sdks/go/docs/examples/users/get-prefs.md similarity index 84% rename from app/sdks/go/docs/examples/users/get-user-logs.md rename to app/sdks/go/docs/examples/users/get-prefs.md index 6fbddb92b5..cc1a409098 100644 --- a/app/sdks/go/docs/examples/users/get-user-logs.md +++ b/app/sdks/go/docs/examples/users/get-prefs.md @@ -15,7 +15,7 @@ func main() { client: &client } - var response, error := service.GetUserLogs("[USER_ID]") + var response, error := service.GetPrefs("[USER_ID]") if error != nil { panic(error) diff --git a/app/sdks/go/docs/examples/users/get-user-prefs.md b/app/sdks/go/docs/examples/users/get-sessions.md similarity index 83% rename from app/sdks/go/docs/examples/users/get-user-prefs.md rename to app/sdks/go/docs/examples/users/get-sessions.md index 18c412dc3e..e071d83e08 100644 --- a/app/sdks/go/docs/examples/users/get-user-prefs.md +++ b/app/sdks/go/docs/examples/users/get-sessions.md @@ -15,7 +15,7 @@ func main() { client: &client } - var response, error := service.GetUserPrefs("[USER_ID]") + var response, error := service.GetSessions("[USER_ID]") if error != nil { panic(error) diff --git a/app/sdks/go/docs/examples/users/get.md b/app/sdks/go/docs/examples/users/get.md new file mode 100644 index 0000000000..f3f2bb94f6 --- /dev/null +++ b/app/sdks/go/docs/examples/users/get.md @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go" +) + +func main() { + var client := appwrite.Client{} + + client.SetProject("") + client.SetKey("") + + var service := appwrite.Users{ + client: &client + } + + var response, error := service.Get("[USER_ID]") + + if error != nil { + panic(error) + } + + fmt.Println(response) +} \ No newline at end of file diff --git a/app/sdks/go/docs/examples/users/list-users.md b/app/sdks/go/docs/examples/users/list-users.md deleted file mode 100644 index a77f46f225..0000000000 --- a/app/sdks/go/docs/examples/users/list-users.md +++ /dev/null @@ -1,25 +0,0 @@ -package main - -import ( - "fmt" - "github.com/appwrite/sdk-for-go" -) - -func main() { - var client := appwrite.Client{} - - client.SetProject("") - client.SetKey("") - - var service := appwrite.Users{ - client: &client - } - - var response, error := service.ListUsers("[SEARCH]", 0, 0, "ASC") - - if error != nil { - panic(error) - } - - fmt.Println(response) -} \ No newline at end of file diff --git a/app/sdks/go/docs/examples/users/list.md b/app/sdks/go/docs/examples/users/list.md new file mode 100644 index 0000000000..de90f8763f --- /dev/null +++ b/app/sdks/go/docs/examples/users/list.md @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go" +) + +func main() { + var client := appwrite.Client{} + + client.SetProject("") + client.SetKey("") + + var service := appwrite.Users{ + client: &client + } + + var response, error := service.List("[SEARCH]", 0, 0, "ASC") + + if error != nil { + panic(error) + } + + fmt.Println(response) +} \ No newline at end of file diff --git a/app/sdks/go/docs/examples/users/update-prefs.md b/app/sdks/go/docs/examples/users/update-prefs.md new file mode 100644 index 0000000000..405d631f8f --- /dev/null +++ b/app/sdks/go/docs/examples/users/update-prefs.md @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go" +) + +func main() { + var client := appwrite.Client{} + + client.SetProject("") + client.SetKey("") + + var service := appwrite.Users{ + client: &client + } + + var response, error := service.UpdatePrefs("[USER_ID]", "") + + if error != nil { + panic(error) + } + + fmt.Println(response) +} \ No newline at end of file diff --git a/app/sdks/go/docs/examples/users/update-status.md b/app/sdks/go/docs/examples/users/update-status.md new file mode 100644 index 0000000000..46ca7eb469 --- /dev/null +++ b/app/sdks/go/docs/examples/users/update-status.md @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go" +) + +func main() { + var client := appwrite.Client{} + + client.SetProject("") + client.SetKey("") + + var service := appwrite.Users{ + client: &client + } + + var response, error := service.UpdateStatus("[USER_ID]", "1") + + if error != nil { + panic(error) + } + + fmt.Println(response) +} \ No newline at end of file diff --git a/app/sdks/go/docs/examples/users/update-user-prefs.md b/app/sdks/go/docs/examples/users/update-user-prefs.md deleted file mode 100644 index 113f12fbb0..0000000000 --- a/app/sdks/go/docs/examples/users/update-user-prefs.md +++ /dev/null @@ -1,25 +0,0 @@ -package main - -import ( - "fmt" - "github.com/appwrite/sdk-for-go" -) - -func main() { - var client := appwrite.Client{} - - client.SetProject("") - client.SetKey("") - - var service := appwrite.Users{ - client: &client - } - - var response, error := service.UpdateUserPrefs("[USER_ID]", "") - - if error != nil { - panic(error) - } - - fmt.Println(response) -} \ No newline at end of file diff --git a/app/sdks/go/docs/examples/users/update-user-status.md b/app/sdks/go/docs/examples/users/update-user-status.md deleted file mode 100644 index 943b401740..0000000000 --- a/app/sdks/go/docs/examples/users/update-user-status.md +++ /dev/null @@ -1,25 +0,0 @@ -package main - -import ( - "fmt" - "github.com/appwrite/sdk-for-go" -) - -func main() { - var client := appwrite.Client{} - - client.SetProject("") - client.SetKey("") - - var service := appwrite.Users{ - client: &client - } - - var response, error := service.UpdateUserStatus("[USER_ID]", "1") - - if error != nil { - panic(error) - } - - fmt.Println(response) -} \ No newline at end of file diff --git a/app/sdks/go/locale.go b/app/sdks/go/locale.go index 5c379fab4a..ecadd889cb 100644 --- a/app/sdks/go/locale.go +++ b/app/sdks/go/locale.go @@ -16,13 +16,13 @@ func NewLocale(clt Client) Locale { return service } -// GetLocale get the current user location based on IP. Returns an object with -// user country code, country name, continent name, continent code, ip address -// and suggested currency. You can use the locale header to get the data in a +// Get get the current user location based on IP. Returns an object with user +// country code, country name, continent name, continent code, ip address and +// suggested currency. You can use the locale header to get the data in a // supported language. // // ([IP Geolocation by DB-IP](https://db-ip.com)) -func (srv *Locale) GetLocale() (map[string]interface{}, error) { +func (srv *Locale) Get() (map[string]interface{}, error) { path := "/locale" params := map[string]interface{}{ diff --git a/app/sdks/go/storage.go b/app/sdks/go/storage.go index 7ede9c3255..898fa7aa0e 100644 --- a/app/sdks/go/storage.go +++ b/app/sdks/go/storage.go @@ -17,10 +17,10 @@ func NewStorage(clt Client) Storage { return service } -// ListFiles get a list of all the user files. You can use the query params to +// List get a list of all the user files. You can use the query params to // filter your results. On admin mode, this endpoint will return a list of all // of the project files. [Learn more about different API modes](/docs/admin). -func (srv *Storage) ListFiles(Search string, Limit int, Offset int, OrderType string) (map[string]interface{}, error) { +func (srv *Storage) List(Search string, Limit int, Offset int, OrderType string) (map[string]interface{}, error) { path := "/storage/files" params := map[string]interface{}{ @@ -33,10 +33,10 @@ func (srv *Storage) ListFiles(Search string, Limit int, Offset int, OrderType st return srv.client.Call("GET", path, nil, params) } -// CreateFile create a new file. The user who creates the file will -// automatically be assigned to read and write access unless he has passed -// custom values for read and write arguments. -func (srv *Storage) CreateFile(File string, Read []interface{}, Write []interface{}) (map[string]interface{}, error) { +// Create create a new file. The user who creates the file will automatically +// be assigned to read and write access unless he has passed custom values for +// read and write arguments. +func (srv *Storage) Create(File string, Read []interface{}, Write []interface{}) (map[string]interface{}, error) { path := "/storage/files" params := map[string]interface{}{ @@ -48,9 +48,9 @@ func (srv *Storage) CreateFile(File string, Read []interface{}, Write []interfac return srv.client.Call("POST", path, nil, params) } -// GetFile get file by its unique ID. This endpoint response returns a JSON -// object with the file metadata. -func (srv *Storage) GetFile(FileId string) (map[string]interface{}, error) { +// Get get file by its unique ID. This endpoint response returns a JSON object +// with the file metadata. +func (srv *Storage) Get(FileId string) (map[string]interface{}, error) { r := strings.NewReplacer("{fileId}", FileId) path := r.Replace("/storage/files/{fileId}") @@ -60,9 +60,9 @@ func (srv *Storage) GetFile(FileId string) (map[string]interface{}, error) { return srv.client.Call("GET", path, nil, params) } -// UpdateFile update file by its unique ID. Only users with write permissions -// have access to update this resource. -func (srv *Storage) UpdateFile(FileId string, Read []interface{}, Write []interface{}) (map[string]interface{}, error) { +// Update update file by its unique ID. Only users with write permissions have +// access to update this resource. +func (srv *Storage) Update(FileId string, Read []interface{}, Write []interface{}) (map[string]interface{}, error) { r := strings.NewReplacer("{fileId}", FileId) path := r.Replace("/storage/files/{fileId}") @@ -74,9 +74,9 @@ func (srv *Storage) UpdateFile(FileId string, Read []interface{}, Write []interf return srv.client.Call("PUT", path, nil, params) } -// DeleteFile delete a file by its unique ID. Only users with write -// permissions have access to delete this resource. -func (srv *Storage) DeleteFile(FileId string) (map[string]interface{}, error) { +// Delete delete a file by its unique ID. Only users with write permissions +// have access to delete this resource. +func (srv *Storage) Delete(FileId string) (map[string]interface{}, error) { r := strings.NewReplacer("{fileId}", FileId) path := r.Replace("/storage/files/{fileId}") @@ -86,10 +86,10 @@ func (srv *Storage) DeleteFile(FileId string) (map[string]interface{}, error) { return srv.client.Call("DELETE", path, nil, params) } -// GetFileDownload get file content by its unique ID. The endpoint response -// return with a 'Content-Disposition: attachment' header that tells the -// browser to start downloading the file to user downloads directory. -func (srv *Storage) GetFileDownload(FileId string) (map[string]interface{}, error) { +// GetDownload get file content by its unique ID. The endpoint response return +// with a 'Content-Disposition: attachment' header that tells the browser to +// start downloading the file to user downloads directory. +func (srv *Storage) GetDownload(FileId string) (map[string]interface{}, error) { r := strings.NewReplacer("{fileId}", FileId) path := r.Replace("/storage/files/{fileId}/download") @@ -99,12 +99,12 @@ func (srv *Storage) GetFileDownload(FileId string) (map[string]interface{}, erro return srv.client.Call("GET", path, nil, params) } -// GetFilePreview get a file preview image. Currently, this method supports +// GetPreview get a file preview image. Currently, this method supports // preview for image files (jpg, png, and gif), other supported formats, like // pdf, docs, slides, and spreadsheets, will return the file icon image. You // can also pass query string arguments for cutting and resizing your preview // image. -func (srv *Storage) GetFilePreview(FileId string, Width int, Height int, Quality int, Background string, Output string) (map[string]interface{}, error) { +func (srv *Storage) GetPreview(FileId string, Width int, Height int, Quality int, Background string, Output string) (map[string]interface{}, error) { r := strings.NewReplacer("{fileId}", FileId) path := r.Replace("/storage/files/{fileId}/preview") @@ -119,10 +119,10 @@ func (srv *Storage) GetFilePreview(FileId string, Width int, Height int, Quality return srv.client.Call("GET", path, nil, params) } -// GetFileView get file content by its unique ID. This endpoint is similar to -// the download method but returns with no 'Content-Disposition: attachment' +// GetView get file content by its unique ID. This endpoint is similar to the +// download method but returns with no 'Content-Disposition: attachment' // header. -func (srv *Storage) GetFileView(FileId string, As string) (map[string]interface{}, error) { +func (srv *Storage) GetView(FileId string, As string) (map[string]interface{}, error) { r := strings.NewReplacer("{fileId}", FileId) path := r.Replace("/storage/files/{fileId}/view") diff --git a/app/sdks/go/teams.go b/app/sdks/go/teams.go index 03e5425d0f..ce0ff645e8 100644 --- a/app/sdks/go/teams.go +++ b/app/sdks/go/teams.go @@ -17,11 +17,11 @@ func NewTeams(clt Client) Teams { return service } -// ListTeams get a list of all the current user teams. You can use the query -// params to filter your results. On admin mode, this endpoint will return a -// list of all of the project teams. [Learn more about different API +// List get a list of all the current user teams. You can use the query params +// to filter your results. On admin mode, this endpoint will return a list of +// all of the project teams. [Learn more about different API // modes](/docs/admin). -func (srv *Teams) ListTeams(Search string, Limit int, Offset int, OrderType string) (map[string]interface{}, error) { +func (srv *Teams) List(Search string, Limit int, Offset int, OrderType string) (map[string]interface{}, error) { path := "/teams" params := map[string]interface{}{ @@ -34,11 +34,11 @@ func (srv *Teams) ListTeams(Search string, Limit int, Offset int, OrderType stri return srv.client.Call("GET", path, nil, params) } -// CreateTeam create a new team. The user who creates the team will -// automatically be assigned as the owner of the team. The team owner can -// invite new members, who will be able add new owners and update or delete -// the team from your project. -func (srv *Teams) CreateTeam(Name string, Roles []interface{}) (map[string]interface{}, error) { +// Create create a new team. The user who creates the team will automatically +// be assigned as the owner of the team. The team owner can invite new +// members, who will be able add new owners and update or delete the team from +// your project. +func (srv *Teams) Create(Name string, Roles []interface{}) (map[string]interface{}, error) { path := "/teams" params := map[string]interface{}{ @@ -49,9 +49,9 @@ func (srv *Teams) CreateTeam(Name string, Roles []interface{}) (map[string]inter return srv.client.Call("POST", path, nil, params) } -// GetTeam get team by its unique ID. All team members have read access for -// this resource. -func (srv *Teams) GetTeam(TeamId string) (map[string]interface{}, error) { +// Get get team by its unique ID. All team members have read access for this +// resource. +func (srv *Teams) Get(TeamId string) (map[string]interface{}, error) { r := strings.NewReplacer("{teamId}", TeamId) path := r.Replace("/teams/{teamId}") @@ -61,9 +61,9 @@ func (srv *Teams) GetTeam(TeamId string) (map[string]interface{}, error) { return srv.client.Call("GET", path, nil, params) } -// UpdateTeam update team by its unique ID. Only team owners have write access -// for this resource. -func (srv *Teams) UpdateTeam(TeamId string, Name string) (map[string]interface{}, error) { +// Update update team by its unique ID. Only team owners have write access for +// this resource. +func (srv *Teams) Update(TeamId string, Name string) (map[string]interface{}, error) { r := strings.NewReplacer("{teamId}", TeamId) path := r.Replace("/teams/{teamId}") @@ -74,9 +74,9 @@ func (srv *Teams) UpdateTeam(TeamId string, Name string) (map[string]interface{} return srv.client.Call("PUT", path, nil, params) } -// DeleteTeam delete team by its unique ID. Only team owners have write access -// for this resource. -func (srv *Teams) DeleteTeam(TeamId string) (map[string]interface{}, error) { +// Delete delete team by its unique ID. Only team owners have write access for +// this resource. +func (srv *Teams) Delete(TeamId string) (map[string]interface{}, error) { r := strings.NewReplacer("{teamId}", TeamId) path := r.Replace("/teams/{teamId}") @@ -86,9 +86,9 @@ func (srv *Teams) DeleteTeam(TeamId string) (map[string]interface{}, error) { return srv.client.Call("DELETE", path, nil, params) } -// GetTeamMemberships get team members by the team unique ID. All team members +// GetMemberships get team members by the team unique ID. All team members // have read access for this list of resources. -func (srv *Teams) GetTeamMemberships(TeamId string) (map[string]interface{}, error) { +func (srv *Teams) GetMemberships(TeamId string) (map[string]interface{}, error) { r := strings.NewReplacer("{teamId}", TeamId) path := r.Replace("/teams/{teamId}/memberships") @@ -98,8 +98,8 @@ func (srv *Teams) GetTeamMemberships(TeamId string) (map[string]interface{}, err return srv.client.Call("GET", path, nil, params) } -// CreateTeamMembership use this endpoint to invite a new member to your team. -// An email with a link to join the team will be sent to the new member email +// CreateMembership use this endpoint to invite a new member to your team. An +// email with a link to join the team will be sent to the new member email // address. If member doesn't exists in the project it will be automatically // created. // @@ -112,7 +112,7 @@ func (srv *Teams) GetTeamMemberships(TeamId string) (map[string]interface{}, err // Attacks](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) // the only valid redirect URL's are the once from domains you have set when // added your platforms in the console interface. -func (srv *Teams) CreateTeamMembership(TeamId string, Email string, Roles []interface{}, Url string, Name string) (map[string]interface{}, error) { +func (srv *Teams) CreateMembership(TeamId string, Email string, Roles []interface{}, Url string, Name string) (map[string]interface{}, error) { r := strings.NewReplacer("{teamId}", TeamId) path := r.Replace("/teams/{teamId}/memberships") @@ -126,10 +126,10 @@ func (srv *Teams) CreateTeamMembership(TeamId string, Email string, Roles []inte return srv.client.Call("POST", path, nil, params) } -// DeleteTeamMembership this endpoint allows a user to leave a team or for a -// team owner to delete the membership of any other team member. You can also -// use this endpoint to delete a user membership even if he didn't accept it. -func (srv *Teams) DeleteTeamMembership(TeamId string, InviteId string) (map[string]interface{}, error) { +// DeleteMembership this endpoint allows a user to leave a team or for a team +// owner to delete the membership of any other team member. You can also use +// this endpoint to delete a user membership even if he didn't accept it. +func (srv *Teams) DeleteMembership(TeamId string, InviteId string) (map[string]interface{}, error) { r := strings.NewReplacer("{teamId}", TeamId, "{inviteId}", InviteId) path := r.Replace("/teams/{teamId}/memberships/{inviteId}") diff --git a/app/sdks/go/users.go b/app/sdks/go/users.go index ecd75f076a..86e4457f1a 100644 --- a/app/sdks/go/users.go +++ b/app/sdks/go/users.go @@ -17,9 +17,9 @@ func NewUsers(clt Client) Users { return service } -// ListUsers get a list of all the project users. You can use the query params -// to filter your results. -func (srv *Users) ListUsers(Search string, Limit int, Offset int, OrderType string) (map[string]interface{}, error) { +// List get a list of all the project users. You can use the query params to +// filter your results. +func (srv *Users) List(Search string, Limit int, Offset int, OrderType string) (map[string]interface{}, error) { path := "/users" params := map[string]interface{}{ @@ -32,8 +32,8 @@ func (srv *Users) ListUsers(Search string, Limit int, Offset int, OrderType stri return srv.client.Call("GET", path, nil, params) } -// CreateUser create a new user. -func (srv *Users) CreateUser(Email string, Password string, Name string) (map[string]interface{}, error) { +// Create create a new user. +func (srv *Users) Create(Email string, Password string, Name string) (map[string]interface{}, error) { path := "/users" params := map[string]interface{}{ @@ -45,8 +45,8 @@ func (srv *Users) CreateUser(Email string, Password string, Name string) (map[st return srv.client.Call("POST", path, nil, params) } -// GetUser get user by its unique ID. -func (srv *Users) GetUser(UserId string) (map[string]interface{}, error) { +// Get get user by its unique ID. +func (srv *Users) Get(UserId string) (map[string]interface{}, error) { r := strings.NewReplacer("{userId}", UserId) path := r.Replace("/users/{userId}") @@ -56,8 +56,8 @@ func (srv *Users) GetUser(UserId string) (map[string]interface{}, error) { return srv.client.Call("GET", path, nil, params) } -// GetUserLogs get user activity logs list by its unique ID. -func (srv *Users) GetUserLogs(UserId string) (map[string]interface{}, error) { +// GetLogs get user activity logs list by its unique ID. +func (srv *Users) GetLogs(UserId string) (map[string]interface{}, error) { r := strings.NewReplacer("{userId}", UserId) path := r.Replace("/users/{userId}/logs") @@ -67,8 +67,8 @@ func (srv *Users) GetUserLogs(UserId string) (map[string]interface{}, error) { return srv.client.Call("GET", path, nil, params) } -// GetUserPrefs get user preferences by its unique ID. -func (srv *Users) GetUserPrefs(UserId string) (map[string]interface{}, error) { +// GetPrefs get user preferences by its unique ID. +func (srv *Users) GetPrefs(UserId string) (map[string]interface{}, error) { r := strings.NewReplacer("{userId}", UserId) path := r.Replace("/users/{userId}/prefs") @@ -78,9 +78,9 @@ func (srv *Users) GetUserPrefs(UserId string) (map[string]interface{}, error) { return srv.client.Call("GET", path, nil, params) } -// UpdateUserPrefs update user preferences by its unique ID. You can pass only -// the specific settings you wish to update. -func (srv *Users) UpdateUserPrefs(UserId string, Prefs string) (map[string]interface{}, error) { +// UpdatePrefs update user preferences by its unique ID. You can pass only the +// specific settings you wish to update. +func (srv *Users) UpdatePrefs(UserId string, Prefs string) (map[string]interface{}, error) { r := strings.NewReplacer("{userId}", UserId) path := r.Replace("/users/{userId}/prefs") @@ -91,8 +91,8 @@ func (srv *Users) UpdateUserPrefs(UserId string, Prefs string) (map[string]inter return srv.client.Call("PATCH", path, nil, params) } -// GetUserSessions get user sessions list by its unique ID. -func (srv *Users) GetUserSessions(UserId string) (map[string]interface{}, error) { +// GetSessions get user sessions list by its unique ID. +func (srv *Users) GetSessions(UserId string) (map[string]interface{}, error) { r := strings.NewReplacer("{userId}", UserId) path := r.Replace("/users/{userId}/sessions") @@ -102,8 +102,8 @@ func (srv *Users) GetUserSessions(UserId string) (map[string]interface{}, error) return srv.client.Call("GET", path, nil, params) } -// DeleteUserSessions delete all user sessions by its unique ID. -func (srv *Users) DeleteUserSessions(UserId string) (map[string]interface{}, error) { +// DeleteSessions delete all user sessions by its unique ID. +func (srv *Users) DeleteSessions(UserId string) (map[string]interface{}, error) { r := strings.NewReplacer("{userId}", UserId) path := r.Replace("/users/{userId}/sessions") @@ -113,8 +113,8 @@ func (srv *Users) DeleteUserSessions(UserId string) (map[string]interface{}, err return srv.client.Call("DELETE", path, nil, params) } -// DeleteUserSession delete user sessions by its unique ID. -func (srv *Users) DeleteUserSession(UserId string, SessionId string) (map[string]interface{}, error) { +// DeleteSession delete user sessions by its unique ID. +func (srv *Users) DeleteSession(UserId string, SessionId string) (map[string]interface{}, error) { r := strings.NewReplacer("{userId}", UserId) path := r.Replace("/users/{userId}/sessions/:session") @@ -125,8 +125,8 @@ func (srv *Users) DeleteUserSession(UserId string, SessionId string) (map[string return srv.client.Call("DELETE", path, nil, params) } -// UpdateUserStatus update user status by its unique ID. -func (srv *Users) UpdateUserStatus(UserId string, Status string) (map[string]interface{}, error) { +// UpdateStatus update user status by its unique ID. +func (srv *Users) UpdateStatus(UserId string, Status string) (map[string]interface{}, error) { r := strings.NewReplacer("{userId}", UserId) path := r.Replace("/users/{userId}/status") diff --git a/app/sdks/javascript/docs/examples/account/create-account-session-o-auth.md b/app/sdks/javascript/docs/examples/account/create-account-session-o-auth.md deleted file mode 100644 index f5fa4781e1..0000000000 --- a/app/sdks/javascript/docs/examples/account/create-account-session-o-auth.md +++ /dev/null @@ -1,12 +0,0 @@ -let sdk = new Appwrite(); - -sdk -; - -let promise = sdk.account.createAccountSessionOAuth('bitbucket', 'https://example.com', 'https://example.com'); - -promise.then(function (response) { - console.log(response); -}, function (error) { - console.log(error); -}); \ No newline at end of file diff --git a/app/sdks/javascript/docs/examples/account/create-o-auth-session.md b/app/sdks/javascript/docs/examples/account/create-o-auth-session.md new file mode 100644 index 0000000000..a6e19c5475 --- /dev/null +++ b/app/sdks/javascript/docs/examples/account/create-o-auth-session.md @@ -0,0 +1,12 @@ +let sdk = new Appwrite(); + +sdk +; + +let promise = sdk.account.createOAuthSession('bitbucket', 'https://example.com', 'https://example.com'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/javascript/docs/examples/account/create-recovery.md b/app/sdks/javascript/docs/examples/account/create-recovery.md new file mode 100644 index 0000000000..a20628d283 --- /dev/null +++ b/app/sdks/javascript/docs/examples/account/create-recovery.md @@ -0,0 +1,12 @@ +let sdk = new Appwrite(); + +sdk +; + +let promise = sdk.account.createRecovery('email@example.com', 'https://example.com'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/javascript/docs/examples/account/create-account.md b/app/sdks/javascript/docs/examples/account/create-session.md similarity index 70% rename from app/sdks/javascript/docs/examples/account/create-account.md rename to app/sdks/javascript/docs/examples/account/create-session.md index 0c10009e12..caef5ee9f2 100644 --- a/app/sdks/javascript/docs/examples/account/create-account.md +++ b/app/sdks/javascript/docs/examples/account/create-session.md @@ -3,7 +3,7 @@ let sdk = new Appwrite(); sdk ; -let promise = sdk.account.createAccount('email@example.com', 'password'); +let promise = sdk.account.createSession('email@example.com', 'password'); promise.then(function (response) { console.log(response); diff --git a/app/sdks/javascript/docs/examples/account/create.md b/app/sdks/javascript/docs/examples/account/create.md new file mode 100644 index 0000000000..a956373ecf --- /dev/null +++ b/app/sdks/javascript/docs/examples/account/create.md @@ -0,0 +1,12 @@ +let sdk = new Appwrite(); + +sdk +; + +let promise = sdk.account.create('email@example.com', 'password'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/javascript/docs/examples/account/delete-current-session.md b/app/sdks/javascript/docs/examples/account/delete-current-session.md new file mode 100644 index 0000000000..a0ba8e88f4 --- /dev/null +++ b/app/sdks/javascript/docs/examples/account/delete-current-session.md @@ -0,0 +1,13 @@ +let sdk = new Appwrite(); + +sdk + .setProject('') +; + +let promise = sdk.account.deleteCurrentSession(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/javascript/docs/examples/account/delete-session.md b/app/sdks/javascript/docs/examples/account/delete-session.md new file mode 100644 index 0000000000..56562c9007 --- /dev/null +++ b/app/sdks/javascript/docs/examples/account/delete-session.md @@ -0,0 +1,13 @@ +let sdk = new Appwrite(); + +sdk + .setProject('') +; + +let promise = sdk.account.deleteSession('[ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/javascript/docs/examples/account/get-account-logs.md b/app/sdks/javascript/docs/examples/account/delete-sessions.md similarity index 79% rename from app/sdks/javascript/docs/examples/account/get-account-logs.md rename to app/sdks/javascript/docs/examples/account/delete-sessions.md index f913b22d34..acc78bcd3f 100644 --- a/app/sdks/javascript/docs/examples/account/get-account-logs.md +++ b/app/sdks/javascript/docs/examples/account/delete-sessions.md @@ -4,7 +4,7 @@ sdk .setProject('') ; -let promise = sdk.account.getAccountLogs(); +let promise = sdk.account.deleteSessions(); promise.then(function (response) { console.log(response); diff --git a/app/sdks/javascript/docs/examples/teams/list-teams.md b/app/sdks/javascript/docs/examples/account/get-logs.md similarity index 81% rename from app/sdks/javascript/docs/examples/teams/list-teams.md rename to app/sdks/javascript/docs/examples/account/get-logs.md index abd4fa420b..5017e74507 100644 --- a/app/sdks/javascript/docs/examples/teams/list-teams.md +++ b/app/sdks/javascript/docs/examples/account/get-logs.md @@ -4,7 +4,7 @@ sdk .setProject('') ; -let promise = sdk.teams.listTeams(); +let promise = sdk.account.getLogs(); promise.then(function (response) { console.log(response); diff --git a/app/sdks/javascript/docs/examples/locale/get-locale.md b/app/sdks/javascript/docs/examples/account/get-prefs.md similarity index 81% rename from app/sdks/javascript/docs/examples/locale/get-locale.md rename to app/sdks/javascript/docs/examples/account/get-prefs.md index 4cc5a3f3b2..39f8950138 100644 --- a/app/sdks/javascript/docs/examples/locale/get-locale.md +++ b/app/sdks/javascript/docs/examples/account/get-prefs.md @@ -4,7 +4,7 @@ sdk .setProject('') ; -let promise = sdk.locale.getLocale(); +let promise = sdk.account.getPrefs(); promise.then(function (response) { console.log(response); diff --git a/app/sdks/javascript/docs/examples/account/get-sessions.md b/app/sdks/javascript/docs/examples/account/get-sessions.md new file mode 100644 index 0000000000..963400deeb --- /dev/null +++ b/app/sdks/javascript/docs/examples/account/get-sessions.md @@ -0,0 +1,13 @@ +let sdk = new Appwrite(); + +sdk + .setProject('') +; + +let promise = sdk.account.getSessions(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/javascript/docs/examples/storage/list-files.md b/app/sdks/javascript/docs/examples/account/get.md similarity index 80% rename from app/sdks/javascript/docs/examples/storage/list-files.md rename to app/sdks/javascript/docs/examples/account/get.md index 0033bb254d..682e09fbd8 100644 --- a/app/sdks/javascript/docs/examples/storage/list-files.md +++ b/app/sdks/javascript/docs/examples/account/get.md @@ -4,7 +4,7 @@ sdk .setProject('') ; -let promise = sdk.storage.listFiles(); +let promise = sdk.account.get(); promise.then(function (response) { console.log(response); diff --git a/app/sdks/javascript/docs/examples/account/update-account-name.md b/app/sdks/javascript/docs/examples/account/update-account-name.md deleted file mode 100644 index e527233999..0000000000 --- a/app/sdks/javascript/docs/examples/account/update-account-name.md +++ /dev/null @@ -1,13 +0,0 @@ -let sdk = new Appwrite(); - -sdk - .setProject('') -; - -let promise = sdk.account.updateAccountName('[NAME]'); - -promise.then(function (response) { - console.log(response); -}, function (error) { - console.log(error); -}); \ No newline at end of file diff --git a/app/sdks/javascript/docs/examples/account/update-account-password.md b/app/sdks/javascript/docs/examples/account/update-account-password.md deleted file mode 100644 index fcf39adf17..0000000000 --- a/app/sdks/javascript/docs/examples/account/update-account-password.md +++ /dev/null @@ -1,13 +0,0 @@ -let sdk = new Appwrite(); - -sdk - .setProject('') -; - -let promise = sdk.account.updateAccountPassword('password', 'password'); - -promise.then(function (response) { - console.log(response); -}, function (error) { - console.log(error); -}); \ No newline at end of file diff --git a/app/sdks/javascript/docs/examples/account/update-account-recovery.md b/app/sdks/javascript/docs/examples/account/update-account-recovery.md deleted file mode 100644 index 2bf315b42e..0000000000 --- a/app/sdks/javascript/docs/examples/account/update-account-recovery.md +++ /dev/null @@ -1,12 +0,0 @@ -let sdk = new Appwrite(); - -sdk -; - -let promise = sdk.account.updateAccountRecovery('[USER_ID]', '[SECRET]', 'password', 'password'); - -promise.then(function (response) { - console.log(response); -}, function (error) { - console.log(error); -}); \ No newline at end of file diff --git a/app/sdks/javascript/docs/examples/account/update-account-verification.md b/app/sdks/javascript/docs/examples/account/update-account-verification.md deleted file mode 100644 index 796e8d2aa5..0000000000 --- a/app/sdks/javascript/docs/examples/account/update-account-verification.md +++ /dev/null @@ -1,12 +0,0 @@ -let sdk = new Appwrite(); - -sdk -; - -let promise = sdk.account.updateAccountVerification('[USER_ID]', '[SECRET]', 'password'); - -promise.then(function (response) { - console.log(response); -}, function (error) { - console.log(error); -}); \ No newline at end of file diff --git a/app/sdks/javascript/docs/examples/account/get-account-sessions.md b/app/sdks/javascript/docs/examples/account/update-name.md similarity index 77% rename from app/sdks/javascript/docs/examples/account/get-account-sessions.md rename to app/sdks/javascript/docs/examples/account/update-name.md index ab550e510f..2e5531e4c3 100644 --- a/app/sdks/javascript/docs/examples/account/get-account-sessions.md +++ b/app/sdks/javascript/docs/examples/account/update-name.md @@ -4,7 +4,7 @@ sdk .setProject('') ; -let promise = sdk.account.getAccountSessions(); +let promise = sdk.account.updateName('[NAME]'); promise.then(function (response) { console.log(response); diff --git a/app/sdks/javascript/docs/examples/account/delete-account-current-session.md b/app/sdks/javascript/docs/examples/account/update-password.md similarity index 71% rename from app/sdks/javascript/docs/examples/account/delete-account-current-session.md rename to app/sdks/javascript/docs/examples/account/update-password.md index 1ec94ce7e6..e4ddc7fc49 100644 --- a/app/sdks/javascript/docs/examples/account/delete-account-current-session.md +++ b/app/sdks/javascript/docs/examples/account/update-password.md @@ -4,7 +4,7 @@ sdk .setProject('') ; -let promise = sdk.account.deleteAccountCurrentSession(); +let promise = sdk.account.updatePassword('password', 'password'); promise.then(function (response) { console.log(response); diff --git a/app/sdks/javascript/docs/examples/account/update-recovery.md b/app/sdks/javascript/docs/examples/account/update-recovery.md new file mode 100644 index 0000000000..a04f31f4d6 --- /dev/null +++ b/app/sdks/javascript/docs/examples/account/update-recovery.md @@ -0,0 +1,12 @@ +let sdk = new Appwrite(); + +sdk +; + +let promise = sdk.account.updateRecovery('[USER_ID]', '[SECRET]', 'password', 'password'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/javascript/docs/examples/account/create-account-session.md b/app/sdks/javascript/docs/examples/account/update-verification.md similarity index 63% rename from app/sdks/javascript/docs/examples/account/create-account-session.md rename to app/sdks/javascript/docs/examples/account/update-verification.md index 030c8a0997..61d7282d11 100644 --- a/app/sdks/javascript/docs/examples/account/create-account-session.md +++ b/app/sdks/javascript/docs/examples/account/update-verification.md @@ -3,7 +3,7 @@ let sdk = new Appwrite(); sdk ; -let promise = sdk.account.createAccountSession('email@example.com', 'password'); +let promise = sdk.account.updateVerification('[USER_ID]', '[SECRET]', 'password'); promise.then(function (response) { console.log(response); diff --git a/app/sdks/javascript/docs/examples/account/get-account.md b/app/sdks/javascript/docs/examples/locale/get.md similarity index 80% rename from app/sdks/javascript/docs/examples/account/get-account.md rename to app/sdks/javascript/docs/examples/locale/get.md index 951c0339c4..0a61e3ae6b 100644 --- a/app/sdks/javascript/docs/examples/account/get-account.md +++ b/app/sdks/javascript/docs/examples/locale/get.md @@ -4,7 +4,7 @@ sdk .setProject('') ; -let promise = sdk.account.getAccount(); +let promise = sdk.locale.get(); promise.then(function (response) { console.log(response); diff --git a/app/sdks/javascript/docs/examples/storage/create-file.md b/app/sdks/javascript/docs/examples/storage/create-file.md deleted file mode 100644 index 53157d19a3..0000000000 --- a/app/sdks/javascript/docs/examples/storage/create-file.md +++ /dev/null @@ -1,13 +0,0 @@ -let sdk = new Appwrite(); - -sdk - .setProject('') -; - -let promise = sdk.storage.createFile(document.getElementById('uploader').files[0], [], []); - -promise.then(function (response) { - console.log(response); -}, function (error) { - console.log(error); -}); \ No newline at end of file diff --git a/app/sdks/javascript/docs/examples/storage/create.md b/app/sdks/javascript/docs/examples/storage/create.md new file mode 100644 index 0000000000..a994d2134b --- /dev/null +++ b/app/sdks/javascript/docs/examples/storage/create.md @@ -0,0 +1,13 @@ +let sdk = new Appwrite(); + +sdk + .setProject('') +; + +let promise = sdk.storage.create(document.getElementById('uploader').files[0], [], []); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/javascript/docs/examples/storage/delete-file.md b/app/sdks/javascript/docs/examples/storage/delete-file.md deleted file mode 100644 index 4e39bd9811..0000000000 --- a/app/sdks/javascript/docs/examples/storage/delete-file.md +++ /dev/null @@ -1,13 +0,0 @@ -let sdk = new Appwrite(); - -sdk - .setProject('') -; - -let promise = sdk.storage.deleteFile('[FILE_ID]'); - -promise.then(function (response) { - console.log(response); -}, function (error) { - console.log(error); -}); \ No newline at end of file diff --git a/app/sdks/javascript/docs/examples/storage/delete.md b/app/sdks/javascript/docs/examples/storage/delete.md new file mode 100644 index 0000000000..eb05232cf6 --- /dev/null +++ b/app/sdks/javascript/docs/examples/storage/delete.md @@ -0,0 +1,13 @@ +let sdk = new Appwrite(); + +sdk + .setProject('') +; + +let promise = sdk.storage.delete('[FILE_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/javascript/docs/examples/storage/get-download.md b/app/sdks/javascript/docs/examples/storage/get-download.md new file mode 100644 index 0000000000..def50c957f --- /dev/null +++ b/app/sdks/javascript/docs/examples/storage/get-download.md @@ -0,0 +1,13 @@ +let sdk = new Appwrite(); + +sdk + .setProject('') +; + +let promise = sdk.storage.getDownload('[FILE_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/javascript/docs/examples/storage/get-file-download.md b/app/sdks/javascript/docs/examples/storage/get-file-download.md deleted file mode 100644 index a53142184c..0000000000 --- a/app/sdks/javascript/docs/examples/storage/get-file-download.md +++ /dev/null @@ -1,13 +0,0 @@ -let sdk = new Appwrite(); - -sdk - .setProject('') -; - -let promise = sdk.storage.getFileDownload('[FILE_ID]'); - -promise.then(function (response) { - console.log(response); -}, function (error) { - console.log(error); -}); \ No newline at end of file diff --git a/app/sdks/javascript/docs/examples/storage/get-file-preview.md b/app/sdks/javascript/docs/examples/storage/get-file-preview.md deleted file mode 100644 index 1cce3acd24..0000000000 --- a/app/sdks/javascript/docs/examples/storage/get-file-preview.md +++ /dev/null @@ -1,13 +0,0 @@ -let sdk = new Appwrite(); - -sdk - .setProject('') -; - -let promise = sdk.storage.getFilePreview('[FILE_ID]'); - -promise.then(function (response) { - console.log(response); -}, function (error) { - console.log(error); -}); \ No newline at end of file diff --git a/app/sdks/javascript/docs/examples/storage/get-file-view.md b/app/sdks/javascript/docs/examples/storage/get-file-view.md deleted file mode 100644 index 4844b22ce3..0000000000 --- a/app/sdks/javascript/docs/examples/storage/get-file-view.md +++ /dev/null @@ -1,13 +0,0 @@ -let sdk = new Appwrite(); - -sdk - .setProject('') -; - -let promise = sdk.storage.getFileView('[FILE_ID]'); - -promise.then(function (response) { - console.log(response); -}, function (error) { - console.log(error); -}); \ No newline at end of file diff --git a/app/sdks/javascript/docs/examples/storage/get-file.md b/app/sdks/javascript/docs/examples/storage/get-file.md deleted file mode 100644 index 32b11a2175..0000000000 --- a/app/sdks/javascript/docs/examples/storage/get-file.md +++ /dev/null @@ -1,13 +0,0 @@ -let sdk = new Appwrite(); - -sdk - .setProject('') -; - -let promise = sdk.storage.getFile('[FILE_ID]'); - -promise.then(function (response) { - console.log(response); -}, function (error) { - console.log(error); -}); \ No newline at end of file diff --git a/app/sdks/javascript/docs/examples/account/delete-account-sessions.md b/app/sdks/javascript/docs/examples/storage/get-preview.md similarity index 76% rename from app/sdks/javascript/docs/examples/account/delete-account-sessions.md rename to app/sdks/javascript/docs/examples/storage/get-preview.md index 5c89537df8..52f7e64a41 100644 --- a/app/sdks/javascript/docs/examples/account/delete-account-sessions.md +++ b/app/sdks/javascript/docs/examples/storage/get-preview.md @@ -4,7 +4,7 @@ sdk .setProject('') ; -let promise = sdk.account.deleteAccountSessions(); +let promise = sdk.storage.getPreview('[FILE_ID]'); promise.then(function (response) { console.log(response); diff --git a/app/sdks/javascript/docs/examples/storage/get-view.md b/app/sdks/javascript/docs/examples/storage/get-view.md new file mode 100644 index 0000000000..93490036ae --- /dev/null +++ b/app/sdks/javascript/docs/examples/storage/get-view.md @@ -0,0 +1,13 @@ +let sdk = new Appwrite(); + +sdk + .setProject('') +; + +let promise = sdk.storage.getView('[FILE_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/javascript/docs/examples/storage/get.md b/app/sdks/javascript/docs/examples/storage/get.md new file mode 100644 index 0000000000..730a62d975 --- /dev/null +++ b/app/sdks/javascript/docs/examples/storage/get.md @@ -0,0 +1,13 @@ +let sdk = new Appwrite(); + +sdk + .setProject('') +; + +let promise = sdk.storage.get('[FILE_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/javascript/docs/examples/storage/list.md b/app/sdks/javascript/docs/examples/storage/list.md new file mode 100644 index 0000000000..1ab4777ce5 --- /dev/null +++ b/app/sdks/javascript/docs/examples/storage/list.md @@ -0,0 +1,13 @@ +let sdk = new Appwrite(); + +sdk + .setProject('') +; + +let promise = sdk.storage.list(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/javascript/docs/examples/storage/update-file.md b/app/sdks/javascript/docs/examples/storage/update-file.md deleted file mode 100644 index 72d6ee3166..0000000000 --- a/app/sdks/javascript/docs/examples/storage/update-file.md +++ /dev/null @@ -1,13 +0,0 @@ -let sdk = new Appwrite(); - -sdk - .setProject('') -; - -let promise = sdk.storage.updateFile('[FILE_ID]', [], []); - -promise.then(function (response) { - console.log(response); -}, function (error) { - console.log(error); -}); \ No newline at end of file diff --git a/app/sdks/javascript/docs/examples/storage/update.md b/app/sdks/javascript/docs/examples/storage/update.md new file mode 100644 index 0000000000..da3c6d4675 --- /dev/null +++ b/app/sdks/javascript/docs/examples/storage/update.md @@ -0,0 +1,13 @@ +let sdk = new Appwrite(); + +sdk + .setProject('') +; + +let promise = sdk.storage.update('[FILE_ID]', [], []); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/javascript/docs/examples/teams/create-membership.md b/app/sdks/javascript/docs/examples/teams/create-membership.md new file mode 100644 index 0000000000..349b229d0d --- /dev/null +++ b/app/sdks/javascript/docs/examples/teams/create-membership.md @@ -0,0 +1,13 @@ +let sdk = new Appwrite(); + +sdk + .setProject('') +; + +let promise = sdk.teams.createMembership('[TEAM_ID]', 'email@example.com', [], 'https://example.com'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/javascript/docs/examples/teams/create-team-membership.md b/app/sdks/javascript/docs/examples/teams/create-team-membership.md deleted file mode 100644 index 60f996c209..0000000000 --- a/app/sdks/javascript/docs/examples/teams/create-team-membership.md +++ /dev/null @@ -1,13 +0,0 @@ -let sdk = new Appwrite(); - -sdk - .setProject('') -; - -let promise = sdk.teams.createTeamMembership('[TEAM_ID]', 'email@example.com', [], 'https://example.com'); - -promise.then(function (response) { - console.log(response); -}, function (error) { - console.log(error); -}); \ No newline at end of file diff --git a/app/sdks/javascript/docs/examples/teams/create-team.md b/app/sdks/javascript/docs/examples/teams/create-team.md deleted file mode 100644 index 2dafeac2ab..0000000000 --- a/app/sdks/javascript/docs/examples/teams/create-team.md +++ /dev/null @@ -1,13 +0,0 @@ -let sdk = new Appwrite(); - -sdk - .setProject('') -; - -let promise = sdk.teams.createTeam('[NAME]'); - -promise.then(function (response) { - console.log(response); -}, function (error) { - console.log(error); -}); \ No newline at end of file diff --git a/app/sdks/javascript/docs/examples/teams/create.md b/app/sdks/javascript/docs/examples/teams/create.md new file mode 100644 index 0000000000..635aafc160 --- /dev/null +++ b/app/sdks/javascript/docs/examples/teams/create.md @@ -0,0 +1,13 @@ +let sdk = new Appwrite(); + +sdk + .setProject('') +; + +let promise = sdk.teams.create('[NAME]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/javascript/docs/examples/account/delete-account-session.md b/app/sdks/javascript/docs/examples/teams/delete-membership.md similarity index 70% rename from app/sdks/javascript/docs/examples/account/delete-account-session.md rename to app/sdks/javascript/docs/examples/teams/delete-membership.md index bd916923e0..4b3f29ae86 100644 --- a/app/sdks/javascript/docs/examples/account/delete-account-session.md +++ b/app/sdks/javascript/docs/examples/teams/delete-membership.md @@ -4,7 +4,7 @@ sdk .setProject('') ; -let promise = sdk.account.deleteAccountSession('[ID]'); +let promise = sdk.teams.deleteMembership('[TEAM_ID]', '[INVITE_ID]'); promise.then(function (response) { console.log(response); diff --git a/app/sdks/javascript/docs/examples/teams/delete-team-membership.md b/app/sdks/javascript/docs/examples/teams/delete-team-membership.md deleted file mode 100644 index 551dfd7dbb..0000000000 --- a/app/sdks/javascript/docs/examples/teams/delete-team-membership.md +++ /dev/null @@ -1,13 +0,0 @@ -let sdk = new Appwrite(); - -sdk - .setProject('') -; - -let promise = sdk.teams.deleteTeamMembership('[TEAM_ID]', '[INVITE_ID]'); - -promise.then(function (response) { - console.log(response); -}, function (error) { - console.log(error); -}); \ No newline at end of file diff --git a/app/sdks/javascript/docs/examples/teams/delete-team.md b/app/sdks/javascript/docs/examples/teams/delete-team.md deleted file mode 100644 index 3f9cd8b6f5..0000000000 --- a/app/sdks/javascript/docs/examples/teams/delete-team.md +++ /dev/null @@ -1,13 +0,0 @@ -let sdk = new Appwrite(); - -sdk - .setProject('') -; - -let promise = sdk.teams.deleteTeam('[TEAM_ID]'); - -promise.then(function (response) { - console.log(response); -}, function (error) { - console.log(error); -}); \ No newline at end of file diff --git a/app/sdks/javascript/docs/examples/account/get-account-prefs.md b/app/sdks/javascript/docs/examples/teams/delete.md similarity index 78% rename from app/sdks/javascript/docs/examples/account/get-account-prefs.md rename to app/sdks/javascript/docs/examples/teams/delete.md index 043c9f2e71..f9ac0b3a98 100644 --- a/app/sdks/javascript/docs/examples/account/get-account-prefs.md +++ b/app/sdks/javascript/docs/examples/teams/delete.md @@ -4,7 +4,7 @@ sdk .setProject('') ; -let promise = sdk.account.getAccountPrefs(); +let promise = sdk.teams.delete('[TEAM_ID]'); promise.then(function (response) { console.log(response); diff --git a/app/sdks/javascript/docs/examples/teams/get-memberships.md b/app/sdks/javascript/docs/examples/teams/get-memberships.md new file mode 100644 index 0000000000..456ee074df --- /dev/null +++ b/app/sdks/javascript/docs/examples/teams/get-memberships.md @@ -0,0 +1,13 @@ +let sdk = new Appwrite(); + +sdk + .setProject('') +; + +let promise = sdk.teams.getMemberships('[TEAM_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/javascript/docs/examples/teams/get-team-memberships.md b/app/sdks/javascript/docs/examples/teams/get-team-memberships.md deleted file mode 100644 index 20ce7b2bea..0000000000 --- a/app/sdks/javascript/docs/examples/teams/get-team-memberships.md +++ /dev/null @@ -1,13 +0,0 @@ -let sdk = new Appwrite(); - -sdk - .setProject('') -; - -let promise = sdk.teams.getTeamMemberships('[TEAM_ID]'); - -promise.then(function (response) { - console.log(response); -}, function (error) { - console.log(error); -}); \ No newline at end of file diff --git a/app/sdks/javascript/docs/examples/teams/get-team.md b/app/sdks/javascript/docs/examples/teams/get-team.md deleted file mode 100644 index 7e1f8254fe..0000000000 --- a/app/sdks/javascript/docs/examples/teams/get-team.md +++ /dev/null @@ -1,13 +0,0 @@ -let sdk = new Appwrite(); - -sdk - .setProject('') -; - -let promise = sdk.teams.getTeam('[TEAM_ID]'); - -promise.then(function (response) { - console.log(response); -}, function (error) { - console.log(error); -}); \ No newline at end of file diff --git a/app/sdks/javascript/docs/examples/teams/get.md b/app/sdks/javascript/docs/examples/teams/get.md new file mode 100644 index 0000000000..c61fb5b89a --- /dev/null +++ b/app/sdks/javascript/docs/examples/teams/get.md @@ -0,0 +1,13 @@ +let sdk = new Appwrite(); + +sdk + .setProject('') +; + +let promise = sdk.teams.get('[TEAM_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/javascript/docs/examples/teams/list.md b/app/sdks/javascript/docs/examples/teams/list.md new file mode 100644 index 0000000000..3944cce2e0 --- /dev/null +++ b/app/sdks/javascript/docs/examples/teams/list.md @@ -0,0 +1,13 @@ +let sdk = new Appwrite(); + +sdk + .setProject('') +; + +let promise = sdk.teams.list(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/javascript/docs/examples/account/create-account-recovery.md b/app/sdks/javascript/docs/examples/teams/update-membership-status.md similarity index 59% rename from app/sdks/javascript/docs/examples/account/create-account-recovery.md rename to app/sdks/javascript/docs/examples/teams/update-membership-status.md index c72cb2e55e..ab01bd36fb 100644 --- a/app/sdks/javascript/docs/examples/account/create-account-recovery.md +++ b/app/sdks/javascript/docs/examples/teams/update-membership-status.md @@ -3,7 +3,7 @@ let sdk = new Appwrite(); sdk ; -let promise = sdk.account.createAccountRecovery('email@example.com', 'https://example.com'); +let promise = sdk.teams.updateMembershipStatus('[TEAM_ID]', '[INVITE_ID]', '[USER_ID]', '[SECRET]'); promise.then(function (response) { console.log(response); diff --git a/app/sdks/javascript/docs/examples/teams/update-team-membership-status.md b/app/sdks/javascript/docs/examples/teams/update-team-membership-status.md deleted file mode 100644 index d4d83e9705..0000000000 --- a/app/sdks/javascript/docs/examples/teams/update-team-membership-status.md +++ /dev/null @@ -1,12 +0,0 @@ -let sdk = new Appwrite(); - -sdk -; - -let promise = sdk.teams.updateTeamMembershipStatus('[TEAM_ID]', '[INVITE_ID]', '[USER_ID]', '[SECRET]'); - -promise.then(function (response) { - console.log(response); -}, function (error) { - console.log(error); -}); \ No newline at end of file diff --git a/app/sdks/javascript/docs/examples/teams/update-team.md b/app/sdks/javascript/docs/examples/teams/update-team.md deleted file mode 100644 index 2ec35ec906..0000000000 --- a/app/sdks/javascript/docs/examples/teams/update-team.md +++ /dev/null @@ -1,13 +0,0 @@ -let sdk = new Appwrite(); - -sdk - .setProject('') -; - -let promise = sdk.teams.updateTeam('[TEAM_ID]', '[NAME]'); - -promise.then(function (response) { - console.log(response); -}, function (error) { - console.log(error); -}); \ No newline at end of file diff --git a/app/sdks/javascript/docs/examples/teams/update.md b/app/sdks/javascript/docs/examples/teams/update.md new file mode 100644 index 0000000000..f2d028d896 --- /dev/null +++ b/app/sdks/javascript/docs/examples/teams/update.md @@ -0,0 +1,13 @@ +let sdk = new Appwrite(); + +sdk + .setProject('') +; + +let promise = sdk.teams.update('[TEAM_ID]', '[NAME]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/javascript/src/sdk.js b/app/sdks/javascript/src/sdk.js index cd3fe716c4..69927295fd 100644 --- a/app/sdks/javascript/src/sdk.js +++ b/app/sdks/javascript/src/sdk.js @@ -307,7 +307,7 @@ * @throws {Error} * @return {Promise} */ - getAccount: function() { + get: function() { let path = '/account'; let payload = {}; @@ -348,7 +348,7 @@ * @throws {Error} * @return {Promise} */ - createAccount: function(email, password, name = '') { + create: function(email, password, name = '') { if(email === undefined) { throw new Error('Missing required parameter: "email"'); } @@ -451,7 +451,7 @@ * @throws {Error} * @return {Promise} */ - getAccountLogs: function() { + getLogs: function() { let path = '/account/logs'; let payload = {}; @@ -471,7 +471,7 @@ * @throws {Error} * @return {Promise} */ - updateAccountName: function(name) { + updateName: function(name) { if(name === undefined) { throw new Error('Missing required parameter: "name"'); } @@ -501,7 +501,7 @@ * @throws {Error} * @return {Promise} */ - updateAccountPassword: function(password, oldPassword) { + updatePassword: function(password, oldPassword) { if(password === undefined) { throw new Error('Missing required parameter: "password"'); } @@ -536,7 +536,7 @@ * @throws {Error} * @return {Promise} */ - getAccountPrefs: function() { + getPrefs: function() { let path = '/account/prefs'; let payload = {}; @@ -590,7 +590,7 @@ * @throws {Error} * @return {Promise} */ - createAccountRecovery: function(email, url) { + createRecovery: function(email, url) { if(email === undefined) { throw new Error('Missing required parameter: "email"'); } @@ -637,7 +637,7 @@ * @throws {Error} * @return {Promise} */ - updateAccountRecovery: function(userId, secret, passwordA, passwordB) { + updateRecovery: function(userId, secret, passwordA, passwordB) { if(userId === undefined) { throw new Error('Missing required parameter: "userId"'); } @@ -689,7 +689,7 @@ * @throws {Error} * @return {Promise} */ - getAccountSessions: function() { + getSessions: function() { let path = '/account/sessions'; let payload = {}; @@ -723,7 +723,7 @@ * @throws {Error} * @return {Promise} */ - createAccountSession: function(email, password) { + createSession: function(email, password) { if(email === undefined) { throw new Error('Missing required parameter: "email"'); } @@ -759,7 +759,7 @@ * @throws {Error} * @return {Promise} */ - deleteAccountSessions: function() { + deleteSessions: function() { let path = '/account/sessions'; let payload = {}; @@ -780,7 +780,7 @@ * @throws {Error} * @return {Promise} */ - deleteAccountCurrentSession: function() { + deleteCurrentSession: function() { let path = '/account/sessions/current'; let payload = {}; @@ -805,7 +805,7 @@ * @throws {Error} * @return {Promise} */ - createAccountSessionOAuth: function(provider, success, failure) { + createOAuthSession: function(provider, success, failure) { if(provider === undefined) { throw new Error('Missing required parameter: "provider"'); } @@ -847,7 +847,7 @@ * @throws {Error} * @return {Promise} */ - deleteAccountSession: function(id) { + deleteSession: function(id) { if(id === undefined) { throw new Error('Missing required parameter: "id"'); } @@ -876,7 +876,7 @@ * @throws {Error} * @return {Promise} */ - updateAccountVerification: function(userId, secret, passwordB) { + updateVerification: function(userId, secret, passwordB) { if(userId === undefined) { throw new Error('Missing required parameter: "userId"'); } @@ -1172,7 +1172,7 @@ * @return {Promise} */ listCollections: function(search = '', limit = 25, offset = 0, orderType = 'ASC') { - let path = '/database'; + let path = '/database/collections'; let payload = {}; @@ -1227,7 +1227,7 @@ throw new Error('Missing required parameter: "rules"'); } - let path = '/database'; + let path = '/database/collections'; let payload = {}; @@ -1268,7 +1268,7 @@ throw new Error('Missing required parameter: "collectionId"'); } - let path = '/database/{collectionId}'.replace(new RegExp('{collectionId}', 'g'), collectionId); + let path = '/database/collections/{collectionId}'.replace(new RegExp('{collectionId}', 'g'), collectionId); let payload = {}; @@ -1308,7 +1308,7 @@ throw new Error('Missing required parameter: "write"'); } - let path = '/database/{collectionId}'.replace(new RegExp('{collectionId}', 'g'), collectionId); + let path = '/database/collections/{collectionId}'.replace(new RegExp('{collectionId}', 'g'), collectionId); let payload = {}; @@ -1349,7 +1349,7 @@ throw new Error('Missing required parameter: "collectionId"'); } - let path = '/database/{collectionId}'.replace(new RegExp('{collectionId}', 'g'), collectionId); + let path = '/database/collections/{collectionId}'.replace(new RegExp('{collectionId}', 'g'), collectionId); let payload = {}; @@ -1385,7 +1385,7 @@ throw new Error('Missing required parameter: "collectionId"'); } - let path = '/database/{collectionId}/documents'.replace(new RegExp('{collectionId}', 'g'), collectionId); + let path = '/database/collections/{collectionId}/documents'.replace(new RegExp('{collectionId}', 'g'), collectionId); let payload = {}; @@ -1463,7 +1463,7 @@ throw new Error('Missing required parameter: "write"'); } - let path = '/database/{collectionId}/documents'.replace(new RegExp('{collectionId}', 'g'), collectionId); + let path = '/database/collections/{collectionId}/documents'.replace(new RegExp('{collectionId}', 'g'), collectionId); let payload = {}; @@ -1517,7 +1517,7 @@ throw new Error('Missing required parameter: "documentId"'); } - let path = '/database/{collectionId}/documents/{documentId}'.replace(new RegExp('{collectionId}', 'g'), collectionId).replace(new RegExp('{documentId}', 'g'), documentId); + let path = '/database/collections/{collectionId}/documents/{documentId}'.replace(new RegExp('{collectionId}', 'g'), collectionId).replace(new RegExp('{documentId}', 'g'), documentId); let payload = {}; @@ -1560,7 +1560,7 @@ throw new Error('Missing required parameter: "write"'); } - let path = '/database/{collectionId}/documents/{documentId}'.replace(new RegExp('{collectionId}', 'g'), collectionId).replace(new RegExp('{documentId}', 'g'), documentId); + let path = '/database/collections/{collectionId}/documents/{documentId}'.replace(new RegExp('{collectionId}', 'g'), collectionId).replace(new RegExp('{documentId}', 'g'), documentId); let payload = {}; @@ -1603,7 +1603,7 @@ throw new Error('Missing required parameter: "documentId"'); } - let path = '/database/{collectionId}/documents/{documentId}'.replace(new RegExp('{collectionId}', 'g'), collectionId).replace(new RegExp('{documentId}', 'g'), documentId); + let path = '/database/collections/{collectionId}/documents/{documentId}'.replace(new RegExp('{collectionId}', 'g'), collectionId).replace(new RegExp('{documentId}', 'g'), documentId); let payload = {}; @@ -1629,7 +1629,7 @@ * @throws {Error} * @return {Promise} */ - getLocale: function() { + get: function() { let path = '/locale'; let payload = {}; @@ -1758,7 +1758,7 @@ * @throws {Error} * @return {Promise} */ - listFiles: function(search = '', limit = 25, offset = 0, orderType = 'ASC') { + list: function(search = '', limit = 25, offset = 0, orderType = 'ASC') { let path = '/storage/files'; let payload = {}; @@ -1798,7 +1798,7 @@ * @throws {Error} * @return {Promise} */ - createFile: function(file, read, write) { + create: function(file, read, write) { if(file === undefined) { throw new Error('Missing required parameter: "file"'); } @@ -1843,7 +1843,7 @@ * @throws {Error} * @return {Promise} */ - getFile: function(fileId) { + get: function(fileId) { if(fileId === undefined) { throw new Error('Missing required parameter: "fileId"'); } @@ -1870,7 +1870,7 @@ * @throws {Error} * @return {Promise} */ - updateFile: function(fileId, read, write) { + update: function(fileId, read, write) { if(fileId === undefined) { throw new Error('Missing required parameter: "fileId"'); } @@ -1911,7 +1911,7 @@ * @throws {Error} * @return {Promise} */ - deleteFile: function(fileId) { + delete: function(fileId) { if(fileId === undefined) { throw new Error('Missing required parameter: "fileId"'); } @@ -1937,7 +1937,7 @@ * @throws {Error} * @return {Promise} */ - getFileDownload: function(fileId) { + getDownload: function(fileId) { if(fileId === undefined) { throw new Error('Missing required parameter: "fileId"'); } @@ -1969,7 +1969,7 @@ * @throws {Error} * @return {Promise} */ - getFilePreview: function(fileId, width = 0, height = 0, quality = 100, background = '', output = '') { + getPreview: function(fileId, width = 0, height = 0, quality = 100, background = '', output = '') { if(fileId === undefined) { throw new Error('Missing required parameter: "fileId"'); } @@ -2015,7 +2015,7 @@ * @throws {Error} * @return {Promise} */ - getFileView: function(fileId, as = '') { + getView: function(fileId, as = '') { if(fileId === undefined) { throw new Error('Missing required parameter: "fileId"'); } @@ -2051,7 +2051,7 @@ * @throws {Error} * @return {Promise} */ - listTeams: function(search = '', limit = 25, offset = 0, orderType = 'ASC') { + list: function(search = '', limit = 25, offset = 0, orderType = 'ASC') { let path = '/teams'; let payload = {}; @@ -2091,7 +2091,7 @@ * @throws {Error} * @return {Promise} */ - createTeam: function(name, roles = ["owner"]) { + create: function(name, roles = ["owner"]) { if(name === undefined) { throw new Error('Missing required parameter: "name"'); } @@ -2124,7 +2124,7 @@ * @throws {Error} * @return {Promise} */ - getTeam: function(teamId) { + get: function(teamId) { if(teamId === undefined) { throw new Error('Missing required parameter: "teamId"'); } @@ -2150,7 +2150,7 @@ * @throws {Error} * @return {Promise} */ - updateTeam: function(teamId, name) { + update: function(teamId, name) { if(teamId === undefined) { throw new Error('Missing required parameter: "teamId"'); } @@ -2183,7 +2183,7 @@ * @throws {Error} * @return {Promise} */ - deleteTeam: function(teamId) { + delete: function(teamId) { if(teamId === undefined) { throw new Error('Missing required parameter: "teamId"'); } @@ -2208,7 +2208,7 @@ * @throws {Error} * @return {Promise} */ - getTeamMemberships: function(teamId) { + getMemberships: function(teamId) { if(teamId === undefined) { throw new Error('Missing required parameter: "teamId"'); } @@ -2248,7 +2248,7 @@ * @throws {Error} * @return {Promise} */ - createTeamMembership: function(teamId, email, roles, url, name = '') { + createMembership: function(teamId, email, roles, url, name = '') { if(teamId === undefined) { throw new Error('Missing required parameter: "teamId"'); } @@ -2303,7 +2303,7 @@ * @throws {Error} * @return {Promise} */ - deleteTeamMembership: function(teamId, inviteId) { + deleteMembership: function(teamId, inviteId) { if(teamId === undefined) { throw new Error('Missing required parameter: "teamId"'); } @@ -2348,7 +2348,7 @@ * @throws {Error} * @return {null} */ - updateTeamMembershipStatus: function(teamId, inviteId, userId, secret) { + updateMembershipStatus: function(teamId, inviteId, userId, secret) { if(teamId === undefined) { throw new Error('Missing required parameter: "teamId"'); } diff --git a/app/sdks/javascript/src/sdk.min.js b/app/sdks/javascript/src/sdk.min.js index 223eb1fcd2..633f0f4684 100644 --- a/app/sdks/javascript/src/sdk.min.js +++ b/app/sdks/javascript/src/sdk.min.js @@ -11,7 +11,7 @@ request.setRequestHeader(key,headers[key])}} request.onload=function(){if(4===request.readyState&&399>=request.status){let data=request.response;let contentType=this.getResponseHeader('content-type')||'';contentType=contentType.substring(0,contentType.indexOf(';'));switch(contentType){case 'application/json':data=JSON.parse(data);break} resolve(data)}else{reject(new Error(request.statusText))}};if(progress){request.addEventListener('progress',progress);request.upload.addEventListener('progress',progress,!1)} request.onerror=function(){reject(new Error("Network Error"))};request.send(params)})};return{'get':function(path,headers={},params={}){return call('GET',path+((Object.keys(params).length>0)?'?'+buildQuery(params):''),headers,{})},'post':function(path,headers={},params={},progress=null){return call('POST',path,headers,params,progress)},'put':function(path,headers={},params={},progress=null){return call('PUT',path,headers,params,progress)},'patch':function(path,headers={},params={},progress=null){return call('PATCH',path,headers,params,progress)},'delete':function(path,headers={},params={},progress=null){return call('DELETE',path,headers,params,progress)},'addGlobalParam':addGlobalParam,'addGlobalHeader':addGlobalHeader}}(window.document);let iframe=function(method,url,params){let form=document.createElement('form');form.setAttribute('method',method);form.setAttribute('action',config.endpoint+url);for(let key in params){if(params.hasOwnProperty(key)){let hiddenField=document.createElement("input");hiddenField.setAttribute("type","hidden");hiddenField.setAttribute("name",key);hiddenField.setAttribute("value",params[key]);form.appendChild(hiddenField)}} -document.body.appendChild(form);return form.submit()};let account={getAccount:function(){let path='/account';let payload={};return http.get(path,{'content-type':'application/json',},payload)},createAccount:function(email,password,name=''){if(email===undefined){throw new Error('Missing required parameter: "email"')} +document.body.appendChild(form);return form.submit()};let account={get:function(){let path='/account';let payload={};return http.get(path,{'content-type':'application/json',},payload)},create:function(email,password,name=''){if(email===undefined){throw new Error('Missing required parameter: "email"')} if(password===undefined){throw new Error('Missing required parameter: "password"')} let path='/account';let payload={};if(email){payload.email=email} if(password){payload.password=password} @@ -20,19 +20,19 @@ return http.post(path,{'content-type':'application/json',},payload)},delete:func if(password===undefined){throw new Error('Missing required parameter: "password"')} let path='/account/email';let payload={};if(email){payload.email=email} if(password){payload.password=password} -return http.patch(path,{'content-type':'application/json',},payload)},getAccountLogs:function(){let path='/account/logs';let payload={};return http.get(path,{'content-type':'application/json',},payload)},updateAccountName:function(name){if(name===undefined){throw new Error('Missing required parameter: "name"')} +return http.patch(path,{'content-type':'application/json',},payload)},getLogs:function(){let path='/account/logs';let payload={};return http.get(path,{'content-type':'application/json',},payload)},updateName:function(name){if(name===undefined){throw new Error('Missing required parameter: "name"')} let path='/account/name';let payload={};if(name){payload.name=name} -return http.patch(path,{'content-type':'application/json',},payload)},updateAccountPassword:function(password,oldPassword){if(password===undefined){throw new Error('Missing required parameter: "password"')} +return http.patch(path,{'content-type':'application/json',},payload)},updatePassword:function(password,oldPassword){if(password===undefined){throw new Error('Missing required parameter: "password"')} if(oldPassword===undefined){throw new Error('Missing required parameter: "oldPassword"')} let path='/account/password';let payload={};if(password){payload.password=password} if(oldPassword){payload['old-password']=oldPassword} -return http.patch(path,{'content-type':'application/json',},payload)},getAccountPrefs:function(){let path='/account/prefs';let payload={};return http.get(path,{'content-type':'application/json',},payload)},updatePrefs:function(prefs){if(prefs===undefined){throw new Error('Missing required parameter: "prefs"')} +return http.patch(path,{'content-type':'application/json',},payload)},getPrefs:function(){let path='/account/prefs';let payload={};return http.get(path,{'content-type':'application/json',},payload)},updatePrefs:function(prefs){if(prefs===undefined){throw new Error('Missing required parameter: "prefs"')} let path='/account/prefs';let payload={};if(prefs){payload.prefs=prefs} -return http.patch(path,{'content-type':'application/json',},payload)},createAccountRecovery:function(email,url){if(email===undefined){throw new Error('Missing required parameter: "email"')} +return http.patch(path,{'content-type':'application/json',},payload)},createRecovery:function(email,url){if(email===undefined){throw new Error('Missing required parameter: "email"')} if(url===undefined){throw new Error('Missing required parameter: "url"')} let path='/account/recovery';let payload={};if(email){payload.email=email} if(url){payload.url=url} -return http.post(path,{'content-type':'application/json',},payload)},updateAccountRecovery:function(userId,secret,passwordA,passwordB){if(userId===undefined){throw new Error('Missing required parameter: "userId"')} +return http.post(path,{'content-type':'application/json',},payload)},updateRecovery:function(userId,secret,passwordA,passwordB){if(userId===undefined){throw new Error('Missing required parameter: "userId"')} if(secret===undefined){throw new Error('Missing required parameter: "secret"')} if(passwordA===undefined){throw new Error('Missing required parameter: "passwordA"')} if(passwordB===undefined){throw new Error('Missing required parameter: "passwordB"')} @@ -40,17 +40,17 @@ let path='/account/recovery';let payload={};if(userId){payload.userId=userId} if(secret){payload.secret=secret} if(passwordA){payload['password-a']=passwordA} if(passwordB){payload['password-b']=passwordB} -return http.put(path,{'content-type':'application/json',},payload)},getAccountSessions:function(){let path='/account/sessions';let payload={};return http.get(path,{'content-type':'application/json',},payload)},createAccountSession:function(email,password){if(email===undefined){throw new Error('Missing required parameter: "email"')} +return http.put(path,{'content-type':'application/json',},payload)},getSessions:function(){let path='/account/sessions';let payload={};return http.get(path,{'content-type':'application/json',},payload)},createSession:function(email,password){if(email===undefined){throw new Error('Missing required parameter: "email"')} if(password===undefined){throw new Error('Missing required parameter: "password"')} let path='/account/sessions';let payload={};if(email){payload.email=email} if(password){payload.password=password} -return http.post(path,{'content-type':'application/json',},payload)},deleteAccountSessions:function(){let path='/account/sessions';let payload={};return http.delete(path,{'content-type':'application/json',},payload)},deleteAccountCurrentSession:function(){let path='/account/sessions/current';let payload={};return http.delete(path,{'content-type':'application/json',},payload)},createAccountSessionOAuth:function(provider,success,failure){if(provider===undefined){throw new Error('Missing required parameter: "provider"')} +return http.post(path,{'content-type':'application/json',},payload)},deleteSessions:function(){let path='/account/sessions';let payload={};return http.delete(path,{'content-type':'application/json',},payload)},deleteCurrentSession:function(){let path='/account/sessions/current';let payload={};return http.delete(path,{'content-type':'application/json',},payload)},createOAuthSession:function(provider,success,failure){if(provider===undefined){throw new Error('Missing required parameter: "provider"')} if(success===undefined){throw new Error('Missing required parameter: "success"')} if(failure===undefined){throw new Error('Missing required parameter: "failure"')} let path='/account/sessions/oauth/{provider}'.replace(new RegExp('{provider}','g'),provider);let payload={};if(success){payload.success=success} if(failure){payload.failure=failure} -return http.get(path,{'content-type':'application/json',},payload)},deleteAccountSession:function(id){if(id===undefined){throw new Error('Missing required parameter: "id"')} -let path='/account/sessions/{id}'.replace(new RegExp('{id}','g'),id);let payload={};return http.delete(path,{'content-type':'application/json',},payload)},updateAccountVerification:function(userId,secret,passwordB){if(userId===undefined){throw new Error('Missing required parameter: "userId"')} +return http.get(path,{'content-type':'application/json',},payload)},deleteSession:function(id){if(id===undefined){throw new Error('Missing required parameter: "id"')} +let path='/account/sessions/{id}'.replace(new RegExp('{id}','g'),id);let payload={};return http.delete(path,{'content-type':'application/json',},payload)},updateVerification:function(userId,secret,passwordB){if(userId===undefined){throw new Error('Missing required parameter: "userId"')} if(secret===undefined){throw new Error('Missing required parameter: "secret"')} if(passwordB===undefined){throw new Error('Missing required parameter: "passwordB"')} let path='/account/verification';let payload={};if(userId){payload.userId=userId} @@ -79,7 +79,7 @@ let path='/avatars/qr';let payload={};if(text){payload.text=text} if(size){payload.size=size} if(margin){payload.margin=margin} if(download){payload.download=download} -return http.get(path,{'content-type':'application/json',},payload)}};let database={listCollections:function(search='',limit=25,offset=0,orderType='ASC'){let path='/database';let payload={};if(search){payload.search=search} +return http.get(path,{'content-type':'application/json',},payload)}};let database={listCollections:function(search='',limit=25,offset=0,orderType='ASC'){let path='/database/collections';let payload={};if(search){payload.search=search} if(limit){payload.limit=limit} if(offset){payload.offset=offset} if(orderType){payload.orderType=orderType} @@ -87,22 +87,22 @@ return http.get(path,{'content-type':'application/json',},payload)},createCollec if(read===undefined){throw new Error('Missing required parameter: "read"')} if(write===undefined){throw new Error('Missing required parameter: "write"')} if(rules===undefined){throw new Error('Missing required parameter: "rules"')} -let path='/database';let payload={};if(name){payload.name=name} +let path='/database/collections';let payload={};if(name){payload.name=name} if(read){payload.read=read} if(write){payload.write=write} if(rules){payload.rules=rules} return http.post(path,{'content-type':'application/json',},payload)},getCollection:function(collectionId){if(collectionId===undefined){throw new Error('Missing required parameter: "collectionId"')} -let path='/database/{collectionId}'.replace(new RegExp('{collectionId}','g'),collectionId);let payload={};return http.get(path,{'content-type':'application/json',},payload)},updateCollection:function(collectionId,name,read,write,rules=[]){if(collectionId===undefined){throw new Error('Missing required parameter: "collectionId"')} +let path='/database/collections/{collectionId}'.replace(new RegExp('{collectionId}','g'),collectionId);let payload={};return http.get(path,{'content-type':'application/json',},payload)},updateCollection:function(collectionId,name,read,write,rules=[]){if(collectionId===undefined){throw new Error('Missing required parameter: "collectionId"')} if(name===undefined){throw new Error('Missing required parameter: "name"')} if(read===undefined){throw new Error('Missing required parameter: "read"')} if(write===undefined){throw new Error('Missing required parameter: "write"')} -let path='/database/{collectionId}'.replace(new RegExp('{collectionId}','g'),collectionId);let payload={};if(name){payload.name=name} +let path='/database/collections/{collectionId}'.replace(new RegExp('{collectionId}','g'),collectionId);let payload={};if(name){payload.name=name} if(read){payload.read=read} if(write){payload.write=write} if(rules){payload.rules=rules} return http.put(path,{'content-type':'application/json',},payload)},deleteCollection:function(collectionId){if(collectionId===undefined){throw new Error('Missing required parameter: "collectionId"')} -let path='/database/{collectionId}'.replace(new RegExp('{collectionId}','g'),collectionId);let payload={};return http.delete(path,{'content-type':'application/json',},payload)},listDocuments:function(collectionId,filters=[],offset=0,limit=50,orderField='$uid',orderType='ASC',orderCast='string',search='',first=0,last=0){if(collectionId===undefined){throw new Error('Missing required parameter: "collectionId"')} -let path='/database/{collectionId}/documents'.replace(new RegExp('{collectionId}','g'),collectionId);let payload={};if(filters){payload.filters=filters} +let path='/database/collections/{collectionId}'.replace(new RegExp('{collectionId}','g'),collectionId);let payload={};return http.delete(path,{'content-type':'application/json',},payload)},listDocuments:function(collectionId,filters=[],offset=0,limit=50,orderField='$uid',orderType='ASC',orderCast='string',search='',first=0,last=0){if(collectionId===undefined){throw new Error('Missing required parameter: "collectionId"')} +let path='/database/collections/{collectionId}/documents'.replace(new RegExp('{collectionId}','g'),collectionId);let payload={};if(filters){payload.filters=filters} if(offset){payload.offset=offset} if(limit){payload.limit=limit} if(orderField){payload['order-field']=orderField} @@ -115,7 +115,7 @@ return http.get(path,{'content-type':'application/json',},payload)},createDocume if(data===undefined){throw new Error('Missing required parameter: "data"')} if(read===undefined){throw new Error('Missing required parameter: "read"')} if(write===undefined){throw new Error('Missing required parameter: "write"')} -let path='/database/{collectionId}/documents'.replace(new RegExp('{collectionId}','g'),collectionId);let payload={};if(data){payload.data=data} +let path='/database/collections/{collectionId}/documents'.replace(new RegExp('{collectionId}','g'),collectionId);let payload={};if(data){payload.data=data} if(read){payload.read=read} if(write){payload.write=write} if(parentDocument){payload.parentDocument=parentDocument} @@ -123,56 +123,56 @@ if(parentProperty){payload.parentProperty=parentProperty} if(parentPropertyType){payload.parentPropertyType=parentPropertyType} return http.post(path,{'content-type':'application/json',},payload)},getDocument:function(collectionId,documentId){if(collectionId===undefined){throw new Error('Missing required parameter: "collectionId"')} if(documentId===undefined){throw new Error('Missing required parameter: "documentId"')} -let path='/database/{collectionId}/documents/{documentId}'.replace(new RegExp('{collectionId}','g'),collectionId).replace(new RegExp('{documentId}','g'),documentId);let payload={};return http.get(path,{'content-type':'application/json',},payload)},updateDocument:function(collectionId,documentId,data,read,write){if(collectionId===undefined){throw new Error('Missing required parameter: "collectionId"')} +let path='/database/collections/{collectionId}/documents/{documentId}'.replace(new RegExp('{collectionId}','g'),collectionId).replace(new RegExp('{documentId}','g'),documentId);let payload={};return http.get(path,{'content-type':'application/json',},payload)},updateDocument:function(collectionId,documentId,data,read,write){if(collectionId===undefined){throw new Error('Missing required parameter: "collectionId"')} if(documentId===undefined){throw new Error('Missing required parameter: "documentId"')} if(data===undefined){throw new Error('Missing required parameter: "data"')} if(read===undefined){throw new Error('Missing required parameter: "read"')} if(write===undefined){throw new Error('Missing required parameter: "write"')} -let path='/database/{collectionId}/documents/{documentId}'.replace(new RegExp('{collectionId}','g'),collectionId).replace(new RegExp('{documentId}','g'),documentId);let payload={};if(data){payload.data=data} +let path='/database/collections/{collectionId}/documents/{documentId}'.replace(new RegExp('{collectionId}','g'),collectionId).replace(new RegExp('{documentId}','g'),documentId);let payload={};if(data){payload.data=data} if(read){payload.read=read} if(write){payload.write=write} return http.patch(path,{'content-type':'application/json',},payload)},deleteDocument:function(collectionId,documentId){if(collectionId===undefined){throw new Error('Missing required parameter: "collectionId"')} if(documentId===undefined){throw new Error('Missing required parameter: "documentId"')} -let path='/database/{collectionId}/documents/{documentId}'.replace(new RegExp('{collectionId}','g'),collectionId).replace(new RegExp('{documentId}','g'),documentId);let payload={};return http.delete(path,{'content-type':'application/json',},payload)}};let locale={getLocale:function(){let path='/locale';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getContinents:function(){let path='/locale/continents';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getCountries:function(){let path='/locale/countries';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getCountriesEU:function(){let path='/locale/countries/eu';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getCountriesPhones:function(){let path='/locale/countries/phones';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getCurrencies:function(){let path='/locale/currencies';let payload={};return http.get(path,{'content-type':'application/json',},payload)}};let storage={listFiles:function(search='',limit=25,offset=0,orderType='ASC'){let path='/storage/files';let payload={};if(search){payload.search=search} +let path='/database/collections/{collectionId}/documents/{documentId}'.replace(new RegExp('{collectionId}','g'),collectionId).replace(new RegExp('{documentId}','g'),documentId);let payload={};return http.delete(path,{'content-type':'application/json',},payload)}};let locale={get:function(){let path='/locale';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getContinents:function(){let path='/locale/continents';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getCountries:function(){let path='/locale/countries';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getCountriesEU:function(){let path='/locale/countries/eu';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getCountriesPhones:function(){let path='/locale/countries/phones';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getCurrencies:function(){let path='/locale/currencies';let payload={};return http.get(path,{'content-type':'application/json',},payload)}};let storage={list:function(search='',limit=25,offset=0,orderType='ASC'){let path='/storage/files';let payload={};if(search){payload.search=search} if(limit){payload.limit=limit} if(offset){payload.offset=offset} if(orderType){payload.orderType=orderType} -return http.get(path,{'content-type':'application/json',},payload)},createFile:function(file,read,write){if(file===undefined){throw new Error('Missing required parameter: "file"')} +return http.get(path,{'content-type':'application/json',},payload)},create:function(file,read,write){if(file===undefined){throw new Error('Missing required parameter: "file"')} if(read===undefined){throw new Error('Missing required parameter: "read"')} if(write===undefined){throw new Error('Missing required parameter: "write"')} let path='/storage/files';let payload={};if(file){payload.file=file} if(read){payload.read=read} if(write){payload.write=write} -return http.post(path,{'content-type':'multipart/form-data',},payload)},getFile:function(fileId){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"')} -let path='/storage/files/{fileId}'.replace(new RegExp('{fileId}','g'),fileId);let payload={};return http.get(path,{'content-type':'application/json',},payload)},updateFile:function(fileId,read,write){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"')} +return http.post(path,{'content-type':'multipart/form-data',},payload)},get:function(fileId){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"')} +let path='/storage/files/{fileId}'.replace(new RegExp('{fileId}','g'),fileId);let payload={};return http.get(path,{'content-type':'application/json',},payload)},update:function(fileId,read,write){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"')} if(read===undefined){throw new Error('Missing required parameter: "read"')} if(write===undefined){throw new Error('Missing required parameter: "write"')} let path='/storage/files/{fileId}'.replace(new RegExp('{fileId}','g'),fileId);let payload={};if(read){payload.read=read} if(write){payload.write=write} -return http.put(path,{'content-type':'application/json',},payload)},deleteFile:function(fileId){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"')} -let path='/storage/files/{fileId}'.replace(new RegExp('{fileId}','g'),fileId);let payload={};return http.delete(path,{'content-type':'application/json',},payload)},getFileDownload:function(fileId){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"')} -let path='/storage/files/{fileId}/download'.replace(new RegExp('{fileId}','g'),fileId);let payload={};return http.get(path,{'content-type':'application/json',},payload)},getFilePreview:function(fileId,width=0,height=0,quality=100,background='',output=''){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"')} +return http.put(path,{'content-type':'application/json',},payload)},delete:function(fileId){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"')} +let path='/storage/files/{fileId}'.replace(new RegExp('{fileId}','g'),fileId);let payload={};return http.delete(path,{'content-type':'application/json',},payload)},getDownload:function(fileId){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"')} +let path='/storage/files/{fileId}/download'.replace(new RegExp('{fileId}','g'),fileId);let payload={};return http.get(path,{'content-type':'application/json',},payload)},getPreview:function(fileId,width=0,height=0,quality=100,background='',output=''){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"')} let path='/storage/files/{fileId}/preview'.replace(new RegExp('{fileId}','g'),fileId);let payload={};if(width){payload.width=width} if(height){payload.height=height} if(quality){payload.quality=quality} if(background){payload.background=background} if(output){payload.output=output} -return http.get(path,{'content-type':'application/json',},payload)},getFileView:function(fileId,as=''){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"')} +return http.get(path,{'content-type':'application/json',},payload)},getView:function(fileId,as=''){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"')} let path='/storage/files/{fileId}/view'.replace(new RegExp('{fileId}','g'),fileId);let payload={};if(as){payload.as=as} -return http.get(path,{'content-type':'application/json',},payload)}};let teams={listTeams:function(search='',limit=25,offset=0,orderType='ASC'){let path='/teams';let payload={};if(search){payload.search=search} +return http.get(path,{'content-type':'application/json',},payload)}};let teams={list:function(search='',limit=25,offset=0,orderType='ASC'){let path='/teams';let payload={};if(search){payload.search=search} if(limit){payload.limit=limit} if(offset){payload.offset=offset} if(orderType){payload.orderType=orderType} -return http.get(path,{'content-type':'application/json',},payload)},createTeam:function(name,roles=["owner"]){if(name===undefined){throw new Error('Missing required parameter: "name"')} +return http.get(path,{'content-type':'application/json',},payload)},create:function(name,roles=["owner"]){if(name===undefined){throw new Error('Missing required parameter: "name"')} let path='/teams';let payload={};if(name){payload.name=name} if(roles){payload.roles=roles} -return http.post(path,{'content-type':'application/json',},payload)},getTeam:function(teamId){if(teamId===undefined){throw new Error('Missing required parameter: "teamId"')} -let path='/teams/{teamId}'.replace(new RegExp('{teamId}','g'),teamId);let payload={};return http.get(path,{'content-type':'application/json',},payload)},updateTeam:function(teamId,name){if(teamId===undefined){throw new Error('Missing required parameter: "teamId"')} +return http.post(path,{'content-type':'application/json',},payload)},get:function(teamId){if(teamId===undefined){throw new Error('Missing required parameter: "teamId"')} +let path='/teams/{teamId}'.replace(new RegExp('{teamId}','g'),teamId);let payload={};return http.get(path,{'content-type':'application/json',},payload)},update:function(teamId,name){if(teamId===undefined){throw new Error('Missing required parameter: "teamId"')} if(name===undefined){throw new Error('Missing required parameter: "name"')} let path='/teams/{teamId}'.replace(new RegExp('{teamId}','g'),teamId);let payload={};if(name){payload.name=name} -return http.put(path,{'content-type':'application/json',},payload)},deleteTeam:function(teamId){if(teamId===undefined){throw new Error('Missing required parameter: "teamId"')} -let path='/teams/{teamId}'.replace(new RegExp('{teamId}','g'),teamId);let payload={};return http.delete(path,{'content-type':'application/json',},payload)},getTeamMemberships:function(teamId){if(teamId===undefined){throw new Error('Missing required parameter: "teamId"')} -let path='/teams/{teamId}/memberships'.replace(new RegExp('{teamId}','g'),teamId);let payload={};return http.get(path,{'content-type':'application/json',},payload)},createTeamMembership:function(teamId,email,roles,url,name=''){if(teamId===undefined){throw new Error('Missing required parameter: "teamId"')} +return http.put(path,{'content-type':'application/json',},payload)},delete:function(teamId){if(teamId===undefined){throw new Error('Missing required parameter: "teamId"')} +let path='/teams/{teamId}'.replace(new RegExp('{teamId}','g'),teamId);let payload={};return http.delete(path,{'content-type':'application/json',},payload)},getMemberships:function(teamId){if(teamId===undefined){throw new Error('Missing required parameter: "teamId"')} +let path='/teams/{teamId}/memberships'.replace(new RegExp('{teamId}','g'),teamId);let payload={};return http.get(path,{'content-type':'application/json',},payload)},createMembership:function(teamId,email,roles,url,name=''){if(teamId===undefined){throw new Error('Missing required parameter: "teamId"')} if(email===undefined){throw new Error('Missing required parameter: "email"')} if(roles===undefined){throw new Error('Missing required parameter: "roles"')} if(url===undefined){throw new Error('Missing required parameter: "url"')} @@ -180,9 +180,9 @@ let path='/teams/{teamId}/memberships'.replace(new RegExp('{teamId}','g'),teamId if(name){payload.name=name} if(roles){payload.roles=roles} if(url){payload.url=url} -return http.post(path,{'content-type':'application/json',},payload)},deleteTeamMembership:function(teamId,inviteId){if(teamId===undefined){throw new Error('Missing required parameter: "teamId"')} +return http.post(path,{'content-type':'application/json',},payload)},deleteMembership:function(teamId,inviteId){if(teamId===undefined){throw new Error('Missing required parameter: "teamId"')} if(inviteId===undefined){throw new Error('Missing required parameter: "inviteId"')} -let path='/teams/{teamId}/memberships/{inviteId}'.replace(new RegExp('{teamId}','g'),teamId).replace(new RegExp('{inviteId}','g'),inviteId);let payload={};return http.delete(path,{'content-type':'application/json',},payload)},updateTeamMembershipStatus:function(teamId,inviteId,userId,secret){if(teamId===undefined){throw new Error('Missing required parameter: "teamId"')} +let path='/teams/{teamId}/memberships/{inviteId}'.replace(new RegExp('{teamId}','g'),teamId).replace(new RegExp('{inviteId}','g'),inviteId);let payload={};return http.delete(path,{'content-type':'application/json',},payload)},updateMembershipStatus:function(teamId,inviteId,userId,secret){if(teamId===undefined){throw new Error('Missing required parameter: "teamId"')} if(inviteId===undefined){throw new Error('Missing required parameter: "inviteId"')} if(userId===undefined){throw new Error('Missing required parameter: "userId"')} if(secret===undefined){throw new Error('Missing required parameter: "secret"')} diff --git a/app/sdks/nodejs/docs/examples/locale/get-locale.md b/app/sdks/nodejs/docs/examples/locale/get.md similarity index 89% rename from app/sdks/nodejs/docs/examples/locale/get-locale.md rename to app/sdks/nodejs/docs/examples/locale/get.md index 57e5d69e78..08c18792f6 100644 --- a/app/sdks/nodejs/docs/examples/locale/get-locale.md +++ b/app/sdks/nodejs/docs/examples/locale/get.md @@ -10,7 +10,7 @@ client .setKey('') ; -let promise = locale.getLocale(); +let promise = locale.get(); promise.then(function (response) { console.log(response); diff --git a/app/sdks/nodejs/docs/examples/storage/create-file.md b/app/sdks/nodejs/docs/examples/storage/create-file.md deleted file mode 100644 index f0c9d4c5a8..0000000000 --- a/app/sdks/nodejs/docs/examples/storage/create-file.md +++ /dev/null @@ -1,19 +0,0 @@ -const sdk = require('node-appwrite'); - -// Init SDK -let client = new sdk.Client(); - -let storage = new sdk.Storage(client); - -client - .setProject('') - .setKey('') -; - -let promise = storage.createFile(document.getElementById('uploader').files[0], [], []); - -promise.then(function (response) { - console.log(response); -}, function (error) { - console.log(error); -}); \ No newline at end of file diff --git a/app/sdks/nodejs/docs/examples/storage/get-file-download.md b/app/sdks/nodejs/docs/examples/storage/create.md similarity index 76% rename from app/sdks/nodejs/docs/examples/storage/get-file-download.md rename to app/sdks/nodejs/docs/examples/storage/create.md index 2967170695..cdb7fe2c6f 100644 --- a/app/sdks/nodejs/docs/examples/storage/get-file-download.md +++ b/app/sdks/nodejs/docs/examples/storage/create.md @@ -10,7 +10,7 @@ client .setKey('') ; -let promise = storage.getFileDownload('[FILE_ID]'); +let promise = storage.create(document.getElementById('uploader').files[0], [], []); promise.then(function (response) { console.log(response); diff --git a/app/sdks/nodejs/docs/examples/storage/get-file.md b/app/sdks/nodejs/docs/examples/storage/delete.md similarity index 86% rename from app/sdks/nodejs/docs/examples/storage/get-file.md rename to app/sdks/nodejs/docs/examples/storage/delete.md index a1a3baf009..593b55ed34 100644 --- a/app/sdks/nodejs/docs/examples/storage/get-file.md +++ b/app/sdks/nodejs/docs/examples/storage/delete.md @@ -10,7 +10,7 @@ client .setKey('') ; -let promise = storage.getFile('[FILE_ID]'); +let promise = storage.delete('[FILE_ID]'); promise.then(function (response) { console.log(response); diff --git a/app/sdks/nodejs/docs/examples/storage/get-file-view.md b/app/sdks/nodejs/docs/examples/storage/get-download.md similarity index 85% rename from app/sdks/nodejs/docs/examples/storage/get-file-view.md rename to app/sdks/nodejs/docs/examples/storage/get-download.md index a3074fbed1..38883b83aa 100644 --- a/app/sdks/nodejs/docs/examples/storage/get-file-view.md +++ b/app/sdks/nodejs/docs/examples/storage/get-download.md @@ -10,7 +10,7 @@ client .setKey('') ; -let promise = storage.getFileView('[FILE_ID]'); +let promise = storage.getDownload('[FILE_ID]'); promise.then(function (response) { console.log(response); diff --git a/app/sdks/nodejs/docs/examples/storage/delete-file.md b/app/sdks/nodejs/docs/examples/storage/get-preview.md similarity index 85% rename from app/sdks/nodejs/docs/examples/storage/delete-file.md rename to app/sdks/nodejs/docs/examples/storage/get-preview.md index 9e8d13880f..8cea246614 100644 --- a/app/sdks/nodejs/docs/examples/storage/delete-file.md +++ b/app/sdks/nodejs/docs/examples/storage/get-preview.md @@ -10,7 +10,7 @@ client .setKey('') ; -let promise = storage.deleteFile('[FILE_ID]'); +let promise = storage.getPreview('[FILE_ID]'); promise.then(function (response) { console.log(response); diff --git a/app/sdks/nodejs/docs/examples/storage/get-view.md b/app/sdks/nodejs/docs/examples/storage/get-view.md new file mode 100644 index 0000000000..ce10394fda --- /dev/null +++ b/app/sdks/nodejs/docs/examples/storage/get-view.md @@ -0,0 +1,19 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let storage = new sdk.Storage(client); + +client + .setProject('') + .setKey('') +; + +let promise = storage.getView('[FILE_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/nodejs/docs/examples/storage/get.md b/app/sdks/nodejs/docs/examples/storage/get.md new file mode 100644 index 0000000000..0014cfa389 --- /dev/null +++ b/app/sdks/nodejs/docs/examples/storage/get.md @@ -0,0 +1,19 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let storage = new sdk.Storage(client); + +client + .setProject('') + .setKey('') +; + +let promise = storage.get('[FILE_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/nodejs/docs/examples/storage/list-files.md b/app/sdks/nodejs/docs/examples/storage/list.md similarity index 88% rename from app/sdks/nodejs/docs/examples/storage/list-files.md rename to app/sdks/nodejs/docs/examples/storage/list.md index 59a331a2b5..acaf8194e9 100644 --- a/app/sdks/nodejs/docs/examples/storage/list-files.md +++ b/app/sdks/nodejs/docs/examples/storage/list.md @@ -10,7 +10,7 @@ client .setKey('') ; -let promise = storage.listFiles(); +let promise = storage.list(); promise.then(function (response) { console.log(response); diff --git a/app/sdks/nodejs/docs/examples/storage/update-file.md b/app/sdks/nodejs/docs/examples/storage/update-file.md deleted file mode 100644 index 3741785996..0000000000 --- a/app/sdks/nodejs/docs/examples/storage/update-file.md +++ /dev/null @@ -1,19 +0,0 @@ -const sdk = require('node-appwrite'); - -// Init SDK -let client = new sdk.Client(); - -let storage = new sdk.Storage(client); - -client - .setProject('') - .setKey('') -; - -let promise = storage.updateFile('[FILE_ID]', [], []); - -promise.then(function (response) { - console.log(response); -}, function (error) { - console.log(error); -}); \ No newline at end of file diff --git a/app/sdks/nodejs/docs/examples/storage/get-file-preview.md b/app/sdks/nodejs/docs/examples/storage/update.md similarity index 84% rename from app/sdks/nodejs/docs/examples/storage/get-file-preview.md rename to app/sdks/nodejs/docs/examples/storage/update.md index 0c09e8ca8d..055c1d0b90 100644 --- a/app/sdks/nodejs/docs/examples/storage/get-file-preview.md +++ b/app/sdks/nodejs/docs/examples/storage/update.md @@ -10,7 +10,7 @@ client .setKey('') ; -let promise = storage.getFilePreview('[FILE_ID]'); +let promise = storage.update('[FILE_ID]', [], []); promise.then(function (response) { console.log(response); diff --git a/app/sdks/nodejs/docs/examples/teams/delete-team-membership.md b/app/sdks/nodejs/docs/examples/teams/create-membership.md similarity index 73% rename from app/sdks/nodejs/docs/examples/teams/delete-team-membership.md rename to app/sdks/nodejs/docs/examples/teams/create-membership.md index 435a65026f..c949448fb3 100644 --- a/app/sdks/nodejs/docs/examples/teams/delete-team-membership.md +++ b/app/sdks/nodejs/docs/examples/teams/create-membership.md @@ -10,7 +10,7 @@ client .setKey('') ; -let promise = teams.deleteTeamMembership('[TEAM_ID]', '[INVITE_ID]'); +let promise = teams.createMembership('[TEAM_ID]', 'email@example.com', [], 'https://example.com'); promise.then(function (response) { console.log(response); diff --git a/app/sdks/nodejs/docs/examples/teams/create-team-membership.md b/app/sdks/nodejs/docs/examples/teams/create-team-membership.md deleted file mode 100644 index 7a2c9be298..0000000000 --- a/app/sdks/nodejs/docs/examples/teams/create-team-membership.md +++ /dev/null @@ -1,19 +0,0 @@ -const sdk = require('node-appwrite'); - -// Init SDK -let client = new sdk.Client(); - -let teams = new sdk.Teams(client); - -client - .setProject('') - .setKey('') -; - -let promise = teams.createTeamMembership('[TEAM_ID]', 'email@example.com', [], 'https://example.com'); - -promise.then(function (response) { - console.log(response); -}, function (error) { - console.log(error); -}); \ No newline at end of file diff --git a/app/sdks/nodejs/docs/examples/teams/get-team.md b/app/sdks/nodejs/docs/examples/teams/create.md similarity index 86% rename from app/sdks/nodejs/docs/examples/teams/get-team.md rename to app/sdks/nodejs/docs/examples/teams/create.md index b716b7ea01..2bee16c282 100644 --- a/app/sdks/nodejs/docs/examples/teams/get-team.md +++ b/app/sdks/nodejs/docs/examples/teams/create.md @@ -10,7 +10,7 @@ client .setKey('') ; -let promise = teams.getTeam('[TEAM_ID]'); +let promise = teams.create('[NAME]'); promise.then(function (response) { console.log(response); diff --git a/app/sdks/nodejs/docs/examples/teams/get-team-memberships.md b/app/sdks/nodejs/docs/examples/teams/delete-membership.md similarity index 80% rename from app/sdks/nodejs/docs/examples/teams/get-team-memberships.md rename to app/sdks/nodejs/docs/examples/teams/delete-membership.md index 038fd4e2a0..c5867ac15c 100644 --- a/app/sdks/nodejs/docs/examples/teams/get-team-memberships.md +++ b/app/sdks/nodejs/docs/examples/teams/delete-membership.md @@ -10,7 +10,7 @@ client .setKey('') ; -let promise = teams.getTeamMemberships('[TEAM_ID]'); +let promise = teams.deleteMembership('[TEAM_ID]', '[INVITE_ID]'); promise.then(function (response) { console.log(response); diff --git a/app/sdks/nodejs/docs/examples/teams/create-team.md b/app/sdks/nodejs/docs/examples/teams/delete.md similarity index 86% rename from app/sdks/nodejs/docs/examples/teams/create-team.md rename to app/sdks/nodejs/docs/examples/teams/delete.md index 73dd77ecc5..5d322e9a14 100644 --- a/app/sdks/nodejs/docs/examples/teams/create-team.md +++ b/app/sdks/nodejs/docs/examples/teams/delete.md @@ -10,7 +10,7 @@ client .setKey('') ; -let promise = teams.createTeam('[NAME]'); +let promise = teams.delete('[TEAM_ID]'); promise.then(function (response) { console.log(response); diff --git a/app/sdks/nodejs/docs/examples/teams/get-memberships.md b/app/sdks/nodejs/docs/examples/teams/get-memberships.md new file mode 100644 index 0000000000..332a3d3e68 --- /dev/null +++ b/app/sdks/nodejs/docs/examples/teams/get-memberships.md @@ -0,0 +1,19 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let teams = new sdk.Teams(client); + +client + .setProject('') + .setKey('') +; + +let promise = teams.getMemberships('[TEAM_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/nodejs/docs/examples/teams/delete-team.md b/app/sdks/nodejs/docs/examples/teams/get.md similarity index 86% rename from app/sdks/nodejs/docs/examples/teams/delete-team.md rename to app/sdks/nodejs/docs/examples/teams/get.md index 0204d40c98..026a9993eb 100644 --- a/app/sdks/nodejs/docs/examples/teams/delete-team.md +++ b/app/sdks/nodejs/docs/examples/teams/get.md @@ -10,7 +10,7 @@ client .setKey('') ; -let promise = teams.deleteTeam('[TEAM_ID]'); +let promise = teams.get('[TEAM_ID]'); promise.then(function (response) { console.log(response); diff --git a/app/sdks/nodejs/docs/examples/teams/list-teams.md b/app/sdks/nodejs/docs/examples/teams/list.md similarity index 89% rename from app/sdks/nodejs/docs/examples/teams/list-teams.md rename to app/sdks/nodejs/docs/examples/teams/list.md index 609c708753..71209d0d8f 100644 --- a/app/sdks/nodejs/docs/examples/teams/list-teams.md +++ b/app/sdks/nodejs/docs/examples/teams/list.md @@ -10,7 +10,7 @@ client .setKey('') ; -let promise = teams.listTeams(); +let promise = teams.list(); promise.then(function (response) { console.log(response); diff --git a/app/sdks/nodejs/docs/examples/teams/update-team.md b/app/sdks/nodejs/docs/examples/teams/update-team.md deleted file mode 100644 index 6afb377091..0000000000 --- a/app/sdks/nodejs/docs/examples/teams/update-team.md +++ /dev/null @@ -1,19 +0,0 @@ -const sdk = require('node-appwrite'); - -// Init SDK -let client = new sdk.Client(); - -let teams = new sdk.Teams(client); - -client - .setProject('') - .setKey('') -; - -let promise = teams.updateTeam('[TEAM_ID]', '[NAME]'); - -promise.then(function (response) { - console.log(response); -}, function (error) { - console.log(error); -}); \ No newline at end of file diff --git a/app/sdks/nodejs/docs/examples/teams/update.md b/app/sdks/nodejs/docs/examples/teams/update.md new file mode 100644 index 0000000000..ccc1002501 --- /dev/null +++ b/app/sdks/nodejs/docs/examples/teams/update.md @@ -0,0 +1,19 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let teams = new sdk.Teams(client); + +client + .setProject('') + .setKey('') +; + +let promise = teams.update('[TEAM_ID]', '[NAME]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/nodejs/docs/examples/users/create-user.md b/app/sdks/nodejs/docs/examples/users/create-user.md deleted file mode 100644 index d07ab1eabf..0000000000 --- a/app/sdks/nodejs/docs/examples/users/create-user.md +++ /dev/null @@ -1,19 +0,0 @@ -const sdk = require('node-appwrite'); - -// Init SDK -let client = new sdk.Client(); - -let users = new sdk.Users(client); - -client - .setProject('') - .setKey('') -; - -let promise = users.createUser('email@example.com', 'password'); - -promise.then(function (response) { - console.log(response); -}, function (error) { - console.log(error); -}); \ No newline at end of file diff --git a/app/sdks/nodejs/docs/examples/users/delete-user-sessions.md b/app/sdks/nodejs/docs/examples/users/create.md similarity index 81% rename from app/sdks/nodejs/docs/examples/users/delete-user-sessions.md rename to app/sdks/nodejs/docs/examples/users/create.md index 33f803298d..ba4c7976f3 100644 --- a/app/sdks/nodejs/docs/examples/users/delete-user-sessions.md +++ b/app/sdks/nodejs/docs/examples/users/create.md @@ -10,7 +10,7 @@ client .setKey('') ; -let promise = users.deleteUserSessions('[USER_ID]'); +let promise = users.create('email@example.com', 'password'); promise.then(function (response) { console.log(response); diff --git a/app/sdks/nodejs/docs/examples/users/delete-session.md b/app/sdks/nodejs/docs/examples/users/delete-session.md new file mode 100644 index 0000000000..8fe3fbc082 --- /dev/null +++ b/app/sdks/nodejs/docs/examples/users/delete-session.md @@ -0,0 +1,19 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let users = new sdk.Users(client); + +client + .setProject('') + .setKey('') +; + +let promise = users.deleteSession('[USER_ID]', '[SESSION_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/nodejs/docs/examples/users/delete-sessions.md b/app/sdks/nodejs/docs/examples/users/delete-sessions.md new file mode 100644 index 0000000000..25a4e073e9 --- /dev/null +++ b/app/sdks/nodejs/docs/examples/users/delete-sessions.md @@ -0,0 +1,19 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let users = new sdk.Users(client); + +client + .setProject('') + .setKey('') +; + +let promise = users.deleteSessions('[USER_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/nodejs/docs/examples/users/delete-user-session.md b/app/sdks/nodejs/docs/examples/users/delete-user-session.md deleted file mode 100644 index dab704e2d4..0000000000 --- a/app/sdks/nodejs/docs/examples/users/delete-user-session.md +++ /dev/null @@ -1,19 +0,0 @@ -const sdk = require('node-appwrite'); - -// Init SDK -let client = new sdk.Client(); - -let users = new sdk.Users(client); - -client - .setProject('') - .setKey('') -; - -let promise = users.deleteUserSession('[USER_ID]', '[SESSION_ID]'); - -promise.then(function (response) { - console.log(response); -}, function (error) { - console.log(error); -}); \ No newline at end of file diff --git a/app/sdks/nodejs/docs/examples/users/get-user.md b/app/sdks/nodejs/docs/examples/users/get-logs.md similarity index 86% rename from app/sdks/nodejs/docs/examples/users/get-user.md rename to app/sdks/nodejs/docs/examples/users/get-logs.md index 96676c0196..a6edd2c0c5 100644 --- a/app/sdks/nodejs/docs/examples/users/get-user.md +++ b/app/sdks/nodejs/docs/examples/users/get-logs.md @@ -10,7 +10,7 @@ client .setKey('') ; -let promise = users.getUser('[USER_ID]'); +let promise = users.getLogs('[USER_ID]'); promise.then(function (response) { console.log(response); diff --git a/app/sdks/nodejs/docs/examples/users/get-user-logs.md b/app/sdks/nodejs/docs/examples/users/get-prefs.md similarity index 85% rename from app/sdks/nodejs/docs/examples/users/get-user-logs.md rename to app/sdks/nodejs/docs/examples/users/get-prefs.md index 85d0a125a0..9842e37726 100644 --- a/app/sdks/nodejs/docs/examples/users/get-user-logs.md +++ b/app/sdks/nodejs/docs/examples/users/get-prefs.md @@ -10,7 +10,7 @@ client .setKey('') ; -let promise = users.getUserLogs('[USER_ID]'); +let promise = users.getPrefs('[USER_ID]'); promise.then(function (response) { console.log(response); diff --git a/app/sdks/nodejs/docs/examples/users/get-user-prefs.md b/app/sdks/nodejs/docs/examples/users/get-sessions.md similarity index 85% rename from app/sdks/nodejs/docs/examples/users/get-user-prefs.md rename to app/sdks/nodejs/docs/examples/users/get-sessions.md index 46d959e1cb..cb174f7154 100644 --- a/app/sdks/nodejs/docs/examples/users/get-user-prefs.md +++ b/app/sdks/nodejs/docs/examples/users/get-sessions.md @@ -10,7 +10,7 @@ client .setKey('') ; -let promise = users.getUserPrefs('[USER_ID]'); +let promise = users.getSessions('[USER_ID]'); promise.then(function (response) { console.log(response); diff --git a/app/sdks/nodejs/docs/examples/users/get.md b/app/sdks/nodejs/docs/examples/users/get.md new file mode 100644 index 0000000000..075a4433a6 --- /dev/null +++ b/app/sdks/nodejs/docs/examples/users/get.md @@ -0,0 +1,19 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let users = new sdk.Users(client); + +client + .setProject('') + .setKey('') +; + +let promise = users.get('[USER_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/nodejs/docs/examples/users/list-users.md b/app/sdks/nodejs/docs/examples/users/list.md similarity index 89% rename from app/sdks/nodejs/docs/examples/users/list-users.md rename to app/sdks/nodejs/docs/examples/users/list.md index 455e42db4d..b506fa3ff5 100644 --- a/app/sdks/nodejs/docs/examples/users/list-users.md +++ b/app/sdks/nodejs/docs/examples/users/list.md @@ -10,7 +10,7 @@ client .setKey('') ; -let promise = users.listUsers(); +let promise = users.list(); promise.then(function (response) { console.log(response); diff --git a/app/sdks/nodejs/docs/examples/users/get-user-sessions.md b/app/sdks/nodejs/docs/examples/users/update-prefs.md similarity index 84% rename from app/sdks/nodejs/docs/examples/users/get-user-sessions.md rename to app/sdks/nodejs/docs/examples/users/update-prefs.md index b3dfe28405..f2bfb26bb2 100644 --- a/app/sdks/nodejs/docs/examples/users/get-user-sessions.md +++ b/app/sdks/nodejs/docs/examples/users/update-prefs.md @@ -10,7 +10,7 @@ client .setKey('') ; -let promise = users.getUserSessions('[USER_ID]'); +let promise = users.updatePrefs('[USER_ID]', ''); promise.then(function (response) { console.log(response); diff --git a/app/sdks/nodejs/docs/examples/users/update-status.md b/app/sdks/nodejs/docs/examples/users/update-status.md new file mode 100644 index 0000000000..45a23690d8 --- /dev/null +++ b/app/sdks/nodejs/docs/examples/users/update-status.md @@ -0,0 +1,19 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let users = new sdk.Users(client); + +client + .setProject('') + .setKey('') +; + +let promise = users.updateStatus('[USER_ID]', '1'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/nodejs/docs/examples/users/update-user-prefs.md b/app/sdks/nodejs/docs/examples/users/update-user-prefs.md deleted file mode 100644 index 8788ac7dba..0000000000 --- a/app/sdks/nodejs/docs/examples/users/update-user-prefs.md +++ /dev/null @@ -1,19 +0,0 @@ -const sdk = require('node-appwrite'); - -// Init SDK -let client = new sdk.Client(); - -let users = new sdk.Users(client); - -client - .setProject('') - .setKey('') -; - -let promise = users.updateUserPrefs('[USER_ID]', ''); - -promise.then(function (response) { - console.log(response); -}, function (error) { - console.log(error); -}); \ No newline at end of file diff --git a/app/sdks/nodejs/docs/examples/users/update-user-status.md b/app/sdks/nodejs/docs/examples/users/update-user-status.md deleted file mode 100644 index 858833a50c..0000000000 --- a/app/sdks/nodejs/docs/examples/users/update-user-status.md +++ /dev/null @@ -1,19 +0,0 @@ -const sdk = require('node-appwrite'); - -// Init SDK -let client = new sdk.Client(); - -let users = new sdk.Users(client); - -client - .setProject('') - .setKey('') -; - -let promise = users.updateUserStatus('[USER_ID]', '1'); - -promise.then(function (response) { - console.log(response); -}, function (error) { - console.log(error); -}); \ No newline at end of file diff --git a/app/sdks/nodejs/lib/services/database.js b/app/sdks/nodejs/lib/services/database.js index 4287484038..78c5e78f4b 100644 --- a/app/sdks/nodejs/lib/services/database.js +++ b/app/sdks/nodejs/lib/services/database.js @@ -18,7 +18,7 @@ class Database extends Service { * @return {} */ async listCollections(search = '', limit = 25, offset = 0, orderType = 'ASC') { - let path = '/database'; + let path = '/database/collections'; return await this.client.call('get', path, { 'content-type': 'application/json', @@ -44,7 +44,7 @@ class Database extends Service { * @return {} */ async createCollection(name, read, write, rules) { - let path = '/database'; + let path = '/database/collections'; return await this.client.call('post', path, { 'content-type': 'application/json', @@ -68,7 +68,7 @@ class Database extends Service { * @return {} */ async getCollection(collectionId) { - let path = '/database/{collectionId}'.replace(new RegExp('{collectionId}', 'g'), collectionId); + let path = '/database/collections/{collectionId}'.replace(new RegExp('{collectionId}', 'g'), collectionId); return await this.client.call('get', path, { 'content-type': 'application/json', @@ -91,7 +91,7 @@ class Database extends Service { * @return {} */ async updateCollection(collectionId, name, read, write, rules = []) { - let path = '/database/{collectionId}'.replace(new RegExp('{collectionId}', 'g'), collectionId); + let path = '/database/collections/{collectionId}'.replace(new RegExp('{collectionId}', 'g'), collectionId); return await this.client.call('put', path, { 'content-type': 'application/json', @@ -115,7 +115,7 @@ class Database extends Service { * @return {} */ async deleteCollection(collectionId) { - let path = '/database/{collectionId}'.replace(new RegExp('{collectionId}', 'g'), collectionId); + let path = '/database/collections/{collectionId}'.replace(new RegExp('{collectionId}', 'g'), collectionId); return await this.client.call('delete', path, { 'content-type': 'application/json', @@ -146,7 +146,7 @@ class Database extends Service { * @return {} */ async listDocuments(collectionId, filters = [], offset = 0, limit = 50, orderField = '$uid', orderType = 'ASC', orderCast = 'string', search = '', first = 0, last = 0) { - let path = '/database/{collectionId}/documents'.replace(new RegExp('{collectionId}', 'g'), collectionId); + let path = '/database/collections/{collectionId}/documents'.replace(new RegExp('{collectionId}', 'g'), collectionId); return await this.client.call('get', path, { 'content-type': 'application/json', @@ -180,7 +180,7 @@ class Database extends Service { * @return {} */ async createDocument(collectionId, data, read, write, parentDocument = '', parentProperty = '', parentPropertyType = 'assign') { - let path = '/database/{collectionId}/documents'.replace(new RegExp('{collectionId}', 'g'), collectionId); + let path = '/database/collections/{collectionId}/documents'.replace(new RegExp('{collectionId}', 'g'), collectionId); return await this.client.call('post', path, { 'content-type': 'application/json', @@ -207,7 +207,7 @@ class Database extends Service { * @return {} */ async getDocument(collectionId, documentId) { - let path = '/database/{collectionId}/documents/{documentId}'.replace(new RegExp('{collectionId}', 'g'), collectionId).replace(new RegExp('{documentId}', 'g'), documentId); + let path = '/database/collections/{collectionId}/documents/{documentId}'.replace(new RegExp('{collectionId}', 'g'), collectionId).replace(new RegExp('{documentId}', 'g'), documentId); return await this.client.call('get', path, { 'content-type': 'application/json', @@ -228,7 +228,7 @@ class Database extends Service { * @return {} */ async updateDocument(collectionId, documentId, data, read, write) { - let path = '/database/{collectionId}/documents/{documentId}'.replace(new RegExp('{collectionId}', 'g'), collectionId).replace(new RegExp('{documentId}', 'g'), documentId); + let path = '/database/collections/{collectionId}/documents/{documentId}'.replace(new RegExp('{collectionId}', 'g'), collectionId).replace(new RegExp('{documentId}', 'g'), documentId); return await this.client.call('patch', path, { 'content-type': 'application/json', @@ -253,7 +253,7 @@ class Database extends Service { * @return {} */ async deleteDocument(collectionId, documentId) { - let path = '/database/{collectionId}/documents/{documentId}'.replace(new RegExp('{collectionId}', 'g'), collectionId).replace(new RegExp('{documentId}', 'g'), documentId); + let path = '/database/collections/{collectionId}/documents/{documentId}'.replace(new RegExp('{collectionId}', 'g'), collectionId).replace(new RegExp('{documentId}', 'g'), documentId); return await this.client.call('delete', path, { 'content-type': 'application/json', diff --git a/app/sdks/nodejs/lib/services/locale.js b/app/sdks/nodejs/lib/services/locale.js index 2b5f3f2b2f..1a89ba7dd9 100644 --- a/app/sdks/nodejs/lib/services/locale.js +++ b/app/sdks/nodejs/lib/services/locale.js @@ -15,7 +15,7 @@ class Locale extends Service { * @throws Exception * @return {} */ - async getLocale() { + async get() { let path = '/locale'; return await this.client.call('get', path, { diff --git a/app/sdks/nodejs/lib/services/storage.js b/app/sdks/nodejs/lib/services/storage.js index 7237ccfc6f..7db394d783 100644 --- a/app/sdks/nodejs/lib/services/storage.js +++ b/app/sdks/nodejs/lib/services/storage.js @@ -16,7 +16,7 @@ class Storage extends Service { * @throws Exception * @return {} */ - async listFiles(search = '', limit = 25, offset = 0, orderType = 'ASC') { + async list(search = '', limit = 25, offset = 0, orderType = 'ASC') { let path = '/storage/files'; return await this.client.call('get', path, { @@ -43,7 +43,7 @@ class Storage extends Service { * @throws Exception * @return {} */ - async createFile(file, read, write) { + async create(file, read, write) { let path = '/storage/files'; return await this.client.call('post', path, { @@ -66,7 +66,7 @@ class Storage extends Service { * @throws Exception * @return {} */ - async getFile(fileId) { + async get(fileId) { let path = '/storage/files/{fileId}'.replace(new RegExp('{fileId}', 'g'), fileId); return await this.client.call('get', path, { @@ -88,7 +88,7 @@ class Storage extends Service { * @throws Exception * @return {} */ - async updateFile(fileId, read, write) { + async update(fileId, read, write) { let path = '/storage/files/{fileId}'.replace(new RegExp('{fileId}', 'g'), fileId); return await this.client.call('put', path, { @@ -110,7 +110,7 @@ class Storage extends Service { * @throws Exception * @return {} */ - async deleteFile(fileId) { + async delete(fileId) { let path = '/storage/files/{fileId}'.replace(new RegExp('{fileId}', 'g'), fileId); return await this.client.call('delete', path, { @@ -131,7 +131,7 @@ class Storage extends Service { * @throws Exception * @return {} */ - async getFileDownload(fileId) { + async getDownload(fileId) { let path = '/storage/files/{fileId}/download'.replace(new RegExp('{fileId}', 'g'), fileId); return await this.client.call('get', path, { @@ -158,7 +158,7 @@ class Storage extends Service { * @throws Exception * @return {} */ - async getFilePreview(fileId, width = 0, height = 0, quality = 100, background = '', output = '') { + async getPreview(fileId, width = 0, height = 0, quality = 100, background = '', output = '') { let path = '/storage/files/{fileId}/preview'.replace(new RegExp('{fileId}', 'g'), fileId); return await this.client.call('get', path, { @@ -184,7 +184,7 @@ class Storage extends Service { * @throws Exception * @return {} */ - async getFileView(fileId, as = '') { + async getView(fileId, as = '') { let path = '/storage/files/{fileId}/view'.replace(new RegExp('{fileId}', 'g'), fileId); return await this.client.call('get', path, { diff --git a/app/sdks/nodejs/lib/services/teams.js b/app/sdks/nodejs/lib/services/teams.js index b54ca076db..7d6657fa5e 100644 --- a/app/sdks/nodejs/lib/services/teams.js +++ b/app/sdks/nodejs/lib/services/teams.js @@ -16,7 +16,7 @@ class Teams extends Service { * @throws Exception * @return {} */ - async listTeams(search = '', limit = 25, offset = 0, orderType = 'ASC') { + async list(search = '', limit = 25, offset = 0, orderType = 'ASC') { let path = '/teams'; return await this.client.call('get', path, { @@ -43,7 +43,7 @@ class Teams extends Service { * @throws Exception * @return {} */ - async createTeam(name, roles = ["owner"]) { + async create(name, roles = ["owner"]) { let path = '/teams'; return await this.client.call('post', path, { @@ -65,7 +65,7 @@ class Teams extends Service { * @throws Exception * @return {} */ - async getTeam(teamId) { + async get(teamId) { let path = '/teams/{teamId}'.replace(new RegExp('{teamId}', 'g'), teamId); return await this.client.call('get', path, { @@ -86,7 +86,7 @@ class Teams extends Service { * @throws Exception * @return {} */ - async updateTeam(teamId, name) { + async update(teamId, name) { let path = '/teams/{teamId}'.replace(new RegExp('{teamId}', 'g'), teamId); return await this.client.call('put', path, { @@ -107,7 +107,7 @@ class Teams extends Service { * @throws Exception * @return {} */ - async deleteTeam(teamId) { + async delete(teamId) { let path = '/teams/{teamId}'.replace(new RegExp('{teamId}', 'g'), teamId); return await this.client.call('delete', path, { @@ -127,7 +127,7 @@ class Teams extends Service { * @throws Exception * @return {} */ - async getTeamMemberships(teamId) { + async getMemberships(teamId) { let path = '/teams/{teamId}/memberships'.replace(new RegExp('{teamId}', 'g'), teamId); return await this.client.call('get', path, { @@ -162,7 +162,7 @@ class Teams extends Service { * @throws Exception * @return {} */ - async createTeamMembership(teamId, email, roles, url, name = '') { + async createMembership(teamId, email, roles, url, name = '') { let path = '/teams/{teamId}/memberships'.replace(new RegExp('{teamId}', 'g'), teamId); return await this.client.call('post', path, { @@ -188,7 +188,7 @@ class Teams extends Service { * @throws Exception * @return {} */ - async deleteTeamMembership(teamId, inviteId) { + async deleteMembership(teamId, inviteId) { let path = '/teams/{teamId}/memberships/{inviteId}'.replace(new RegExp('{teamId}', 'g'), teamId).replace(new RegExp('{inviteId}', 'g'), inviteId); return await this.client.call('delete', path, { diff --git a/app/sdks/nodejs/lib/services/users.js b/app/sdks/nodejs/lib/services/users.js index 5fe21c7350..5bb638a43e 100644 --- a/app/sdks/nodejs/lib/services/users.js +++ b/app/sdks/nodejs/lib/services/users.js @@ -15,7 +15,7 @@ class Users extends Service { * @throws Exception * @return {} */ - async listUsers(search = '', limit = 25, offset = 0, orderType = 'ASC') { + async list(search = '', limit = 25, offset = 0, orderType = 'ASC') { let path = '/users'; return await this.client.call('get', path, { @@ -40,7 +40,7 @@ class Users extends Service { * @throws Exception * @return {} */ - async createUser(email, password, name = '') { + async create(email, password, name = '') { let path = '/users'; return await this.client.call('post', path, { @@ -62,7 +62,7 @@ class Users extends Service { * @throws Exception * @return {} */ - async getUser(userId) { + async get(userId) { let path = '/users/{userId}'.replace(new RegExp('{userId}', 'g'), userId); return await this.client.call('get', path, { @@ -81,7 +81,7 @@ class Users extends Service { * @throws Exception * @return {} */ - async getUserLogs(userId) { + async getLogs(userId) { let path = '/users/{userId}/logs'.replace(new RegExp('{userId}', 'g'), userId); return await this.client.call('get', path, { @@ -100,7 +100,7 @@ class Users extends Service { * @throws Exception * @return {} */ - async getUserPrefs(userId) { + async getPrefs(userId) { let path = '/users/{userId}/prefs'.replace(new RegExp('{userId}', 'g'), userId); return await this.client.call('get', path, { @@ -121,7 +121,7 @@ class Users extends Service { * @throws Exception * @return {} */ - async updateUserPrefs(userId, prefs) { + async updatePrefs(userId, prefs) { let path = '/users/{userId}/prefs'.replace(new RegExp('{userId}', 'g'), userId); return await this.client.call('patch', path, { @@ -141,7 +141,7 @@ class Users extends Service { * @throws Exception * @return {} */ - async getUserSessions(userId) { + async getSessions(userId) { let path = '/users/{userId}/sessions'.replace(new RegExp('{userId}', 'g'), userId); return await this.client.call('get', path, { @@ -160,7 +160,7 @@ class Users extends Service { * @throws Exception * @return {} */ - async deleteUserSessions(userId) { + async deleteSessions(userId) { let path = '/users/{userId}/sessions'.replace(new RegExp('{userId}', 'g'), userId); return await this.client.call('delete', path, { @@ -180,7 +180,7 @@ class Users extends Service { * @throws Exception * @return {} */ - async deleteUserSession(userId, sessionId) { + async deleteSession(userId, sessionId) { let path = '/users/{userId}/sessions/:session'.replace(new RegExp('{userId}', 'g'), userId); return await this.client.call('delete', path, { @@ -201,7 +201,7 @@ class Users extends Service { * @throws Exception * @return {} */ - async updateUserStatus(userId, status) { + async updateStatus(userId, status) { let path = '/users/{userId}/status'.replace(new RegExp('{userId}', 'g'), userId); return await this.client.call('patch', path, { diff --git a/app/sdks/php/docs/database.md b/app/sdks/php/docs/database.md index 86a8b20933..9bf9cf14e0 100644 --- a/app/sdks/php/docs/database.md +++ b/app/sdks/php/docs/database.md @@ -3,7 +3,7 @@ ## List Collections ```http request -GET https://appwrite.io/v1/database +GET https://appwrite.io/v1/database/collections ``` ** 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). ** @@ -20,7 +20,7 @@ GET https://appwrite.io/v1/database ## Create Collection ```http request -POST https://appwrite.io/v1/database +POST https://appwrite.io/v1/database/collections ``` ** Create a new Collection. ** @@ -37,7 +37,7 @@ POST https://appwrite.io/v1/database ## Get Collection ```http request -GET https://appwrite.io/v1/database/{collectionId} +GET https://appwrite.io/v1/database/collections/{collectionId} ``` ** Get collection by its unique ID. This endpoint response returns a JSON object with the collection metadata. ** @@ -51,7 +51,7 @@ GET https://appwrite.io/v1/database/{collectionId} ## Update Collection ```http request -PUT https://appwrite.io/v1/database/{collectionId} +PUT https://appwrite.io/v1/database/collections/{collectionId} ``` ** Update collection by its unique ID. ** @@ -69,7 +69,7 @@ PUT https://appwrite.io/v1/database/{collectionId} ## Delete Collection ```http request -DELETE https://appwrite.io/v1/database/{collectionId} +DELETE https://appwrite.io/v1/database/collections/{collectionId} ``` ** Delete a collection by its unique ID. Only users with write permissions have access to delete this resource. ** @@ -83,7 +83,7 @@ DELETE https://appwrite.io/v1/database/{collectionId} ## List Documents ```http request -GET https://appwrite.io/v1/database/{collectionId}/documents +GET https://appwrite.io/v1/database/collections/{collectionId}/documents ``` ** 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). ** @@ -106,7 +106,7 @@ GET https://appwrite.io/v1/database/{collectionId}/documents ## Create Document ```http request -POST https://appwrite.io/v1/database/{collectionId}/documents +POST https://appwrite.io/v1/database/collections/{collectionId}/documents ``` ** Create a new Document. ** @@ -126,7 +126,7 @@ POST https://appwrite.io/v1/database/{collectionId}/documents ## Get Document ```http request -GET https://appwrite.io/v1/database/{collectionId}/documents/{documentId} +GET https://appwrite.io/v1/database/collections/{collectionId}/documents/{documentId} ``` ** Get document by its unique ID. This endpoint response returns a JSON object with the document data. ** @@ -141,7 +141,7 @@ GET https://appwrite.io/v1/database/{collectionId}/documents/{documentId} ## Update Document ```http request -PATCH https://appwrite.io/v1/database/{collectionId}/documents/{documentId} +PATCH https://appwrite.io/v1/database/collections/{collectionId}/documents/{documentId} ``` ### Parameters @@ -157,7 +157,7 @@ PATCH https://appwrite.io/v1/database/{collectionId}/documents/{documentId} ## Delete Document ```http request -DELETE https://appwrite.io/v1/database/{collectionId}/documents/{documentId} +DELETE https://appwrite.io/v1/database/collections/{collectionId}/documents/{documentId} ``` ** 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. ** diff --git a/app/sdks/php/docs/examples/locale/get-locale.md b/app/sdks/php/docs/examples/locale/get.md similarity index 84% rename from app/sdks/php/docs/examples/locale/get-locale.md rename to app/sdks/php/docs/examples/locale/get.md index ac56f068de..6db5289e48 100644 --- a/app/sdks/php/docs/examples/locale/get-locale.md +++ b/app/sdks/php/docs/examples/locale/get.md @@ -12,4 +12,4 @@ $client $locale = new Locale($client); -$result = $locale->getLocale(); \ No newline at end of file +$result = $locale->get(); \ No newline at end of file diff --git a/app/sdks/php/docs/examples/storage/create-file.md b/app/sdks/php/docs/examples/storage/create-file.md deleted file mode 100644 index 225b9e2bec..0000000000 --- a/app/sdks/php/docs/examples/storage/create-file.md +++ /dev/null @@ -1,15 +0,0 @@ -setProject('') - ->setKey('') -; - -$storage = new Storage($client); - -$result = $storage->createFile(new \CURLFile('/path/to/file.png', 'image/png', 'file.png'), [], []); \ No newline at end of file diff --git a/app/sdks/php/docs/examples/storage/get-file-download.md b/app/sdks/php/docs/examples/storage/create.md similarity index 63% rename from app/sdks/php/docs/examples/storage/get-file-download.md rename to app/sdks/php/docs/examples/storage/create.md index 3a6db00081..789e163dd2 100644 --- a/app/sdks/php/docs/examples/storage/get-file-download.md +++ b/app/sdks/php/docs/examples/storage/create.md @@ -12,4 +12,4 @@ $client $storage = new Storage($client); -$result = $storage->getFileDownload('[FILE_ID]'); \ No newline at end of file +$result = $storage->create(new \CURLFile('/path/to/file.png', 'image/png', 'file.png'), [], []); \ No newline at end of file diff --git a/app/sdks/php/docs/examples/storage/get-file.md b/app/sdks/php/docs/examples/storage/delete.md similarity index 80% rename from app/sdks/php/docs/examples/storage/get-file.md rename to app/sdks/php/docs/examples/storage/delete.md index 63fa59b40a..c1cf02b71d 100644 --- a/app/sdks/php/docs/examples/storage/get-file.md +++ b/app/sdks/php/docs/examples/storage/delete.md @@ -12,4 +12,4 @@ $client $storage = new Storage($client); -$result = $storage->getFile('[FILE_ID]'); \ No newline at end of file +$result = $storage->delete('[FILE_ID]'); \ No newline at end of file diff --git a/app/sdks/php/docs/examples/storage/get-file-view.md b/app/sdks/php/docs/examples/storage/get-download.md similarity index 78% rename from app/sdks/php/docs/examples/storage/get-file-view.md rename to app/sdks/php/docs/examples/storage/get-download.md index 59cc25bc74..4d871c2956 100644 --- a/app/sdks/php/docs/examples/storage/get-file-view.md +++ b/app/sdks/php/docs/examples/storage/get-download.md @@ -12,4 +12,4 @@ $client $storage = new Storage($client); -$result = $storage->getFileView('[FILE_ID]'); \ No newline at end of file +$result = $storage->getDownload('[FILE_ID]'); \ No newline at end of file diff --git a/app/sdks/php/docs/examples/storage/delete-file.md b/app/sdks/php/docs/examples/storage/get-preview.md similarity index 79% rename from app/sdks/php/docs/examples/storage/delete-file.md rename to app/sdks/php/docs/examples/storage/get-preview.md index 74448e5a7c..f3bf8cf2c0 100644 --- a/app/sdks/php/docs/examples/storage/delete-file.md +++ b/app/sdks/php/docs/examples/storage/get-preview.md @@ -12,4 +12,4 @@ $client $storage = new Storage($client); -$result = $storage->deleteFile('[FILE_ID]'); \ No newline at end of file +$result = $storage->getPreview('[FILE_ID]'); \ No newline at end of file diff --git a/app/sdks/php/docs/examples/storage/get-view.md b/app/sdks/php/docs/examples/storage/get-view.md new file mode 100644 index 0000000000..62979c4e91 --- /dev/null +++ b/app/sdks/php/docs/examples/storage/get-view.md @@ -0,0 +1,15 @@ +setProject('') + ->setKey('') +; + +$storage = new Storage($client); + +$result = $storage->getView('[FILE_ID]'); \ No newline at end of file diff --git a/app/sdks/php/docs/examples/storage/get.md b/app/sdks/php/docs/examples/storage/get.md new file mode 100644 index 0000000000..47f1534483 --- /dev/null +++ b/app/sdks/php/docs/examples/storage/get.md @@ -0,0 +1,15 @@ +setProject('') + ->setKey('') +; + +$storage = new Storage($client); + +$result = $storage->get('[FILE_ID]'); \ No newline at end of file diff --git a/app/sdks/php/docs/examples/storage/list-files.md b/app/sdks/php/docs/examples/storage/list.md similarity index 84% rename from app/sdks/php/docs/examples/storage/list-files.md rename to app/sdks/php/docs/examples/storage/list.md index 434e1fe70d..d5fc5b6691 100644 --- a/app/sdks/php/docs/examples/storage/list-files.md +++ b/app/sdks/php/docs/examples/storage/list.md @@ -12,4 +12,4 @@ $client $storage = new Storage($client); -$result = $storage->listFiles(); \ No newline at end of file +$result = $storage->list(); \ No newline at end of file diff --git a/app/sdks/php/docs/examples/storage/update-file.md b/app/sdks/php/docs/examples/storage/update-file.md deleted file mode 100644 index 637870a7a6..0000000000 --- a/app/sdks/php/docs/examples/storage/update-file.md +++ /dev/null @@ -1,15 +0,0 @@ -setProject('') - ->setKey('') -; - -$storage = new Storage($client); - -$result = $storage->updateFile('[FILE_ID]', [], []); \ No newline at end of file diff --git a/app/sdks/php/docs/examples/storage/get-file-preview.md b/app/sdks/php/docs/examples/storage/update.md similarity index 77% rename from app/sdks/php/docs/examples/storage/get-file-preview.md rename to app/sdks/php/docs/examples/storage/update.md index 8b02bdd2a9..a2967d94d6 100644 --- a/app/sdks/php/docs/examples/storage/get-file-preview.md +++ b/app/sdks/php/docs/examples/storage/update.md @@ -12,4 +12,4 @@ $client $storage = new Storage($client); -$result = $storage->getFilePreview('[FILE_ID]'); \ No newline at end of file +$result = $storage->update('[FILE_ID]', [], []); \ No newline at end of file diff --git a/app/sdks/php/docs/examples/teams/delete-team-membership.md b/app/sdks/php/docs/examples/teams/create-membership.md similarity index 62% rename from app/sdks/php/docs/examples/teams/delete-team-membership.md rename to app/sdks/php/docs/examples/teams/create-membership.md index d53e1ed7ce..9929963648 100644 --- a/app/sdks/php/docs/examples/teams/delete-team-membership.md +++ b/app/sdks/php/docs/examples/teams/create-membership.md @@ -12,4 +12,4 @@ $client $teams = new Teams($client); -$result = $teams->deleteTeamMembership('[TEAM_ID]', '[INVITE_ID]'); \ No newline at end of file +$result = $teams->createMembership('[TEAM_ID]', 'email@example.com', [], 'https://example.com'); \ No newline at end of file diff --git a/app/sdks/php/docs/examples/teams/create-team-membership.md b/app/sdks/php/docs/examples/teams/create-team-membership.md deleted file mode 100644 index 12a47b6f15..0000000000 --- a/app/sdks/php/docs/examples/teams/create-team-membership.md +++ /dev/null @@ -1,15 +0,0 @@ -setProject('') - ->setKey('') -; - -$teams = new Teams($client); - -$result = $teams->createTeamMembership('[TEAM_ID]', 'email@example.com', [], 'https://example.com'); \ No newline at end of file diff --git a/app/sdks/php/docs/examples/teams/get-team.md b/app/sdks/php/docs/examples/teams/create.md similarity index 80% rename from app/sdks/php/docs/examples/teams/get-team.md rename to app/sdks/php/docs/examples/teams/create.md index e58a9d0dc2..048c0bce2c 100644 --- a/app/sdks/php/docs/examples/teams/get-team.md +++ b/app/sdks/php/docs/examples/teams/create.md @@ -12,4 +12,4 @@ $client $teams = new Teams($client); -$result = $teams->getTeam('[TEAM_ID]'); \ No newline at end of file +$result = $teams->create('[NAME]'); \ No newline at end of file diff --git a/app/sdks/php/docs/examples/teams/get-team-memberships.md b/app/sdks/php/docs/examples/teams/delete-membership.md similarity index 72% rename from app/sdks/php/docs/examples/teams/get-team-memberships.md rename to app/sdks/php/docs/examples/teams/delete-membership.md index e7868f6a8c..d6e66abe39 100644 --- a/app/sdks/php/docs/examples/teams/get-team-memberships.md +++ b/app/sdks/php/docs/examples/teams/delete-membership.md @@ -12,4 +12,4 @@ $client $teams = new Teams($client); -$result = $teams->getTeamMemberships('[TEAM_ID]'); \ No newline at end of file +$result = $teams->deleteMembership('[TEAM_ID]', '[INVITE_ID]'); \ No newline at end of file diff --git a/app/sdks/php/docs/examples/teams/create-team.md b/app/sdks/php/docs/examples/teams/delete.md similarity index 80% rename from app/sdks/php/docs/examples/teams/create-team.md rename to app/sdks/php/docs/examples/teams/delete.md index 11928b37cc..46a610da1b 100644 --- a/app/sdks/php/docs/examples/teams/create-team.md +++ b/app/sdks/php/docs/examples/teams/delete.md @@ -12,4 +12,4 @@ $client $teams = new Teams($client); -$result = $teams->createTeam('[NAME]'); \ No newline at end of file +$result = $teams->delete('[TEAM_ID]'); \ No newline at end of file diff --git a/app/sdks/php/docs/examples/teams/get-memberships.md b/app/sdks/php/docs/examples/teams/get-memberships.md new file mode 100644 index 0000000000..af39577657 --- /dev/null +++ b/app/sdks/php/docs/examples/teams/get-memberships.md @@ -0,0 +1,15 @@ +setProject('') + ->setKey('') +; + +$teams = new Teams($client); + +$result = $teams->getMemberships('[TEAM_ID]'); \ No newline at end of file diff --git a/app/sdks/php/docs/examples/teams/delete-team.md b/app/sdks/php/docs/examples/teams/get.md similarity index 79% rename from app/sdks/php/docs/examples/teams/delete-team.md rename to app/sdks/php/docs/examples/teams/get.md index 7fb04015be..59ea1b5313 100644 --- a/app/sdks/php/docs/examples/teams/delete-team.md +++ b/app/sdks/php/docs/examples/teams/get.md @@ -12,4 +12,4 @@ $client $teams = new Teams($client); -$result = $teams->deleteTeam('[TEAM_ID]'); \ No newline at end of file +$result = $teams->get('[TEAM_ID]'); \ No newline at end of file diff --git a/app/sdks/php/docs/examples/teams/list-teams.md b/app/sdks/php/docs/examples/teams/list.md similarity index 84% rename from app/sdks/php/docs/examples/teams/list-teams.md rename to app/sdks/php/docs/examples/teams/list.md index 9b753c6d16..fcccf13917 100644 --- a/app/sdks/php/docs/examples/teams/list-teams.md +++ b/app/sdks/php/docs/examples/teams/list.md @@ -12,4 +12,4 @@ $client $teams = new Teams($client); -$result = $teams->listTeams(); \ No newline at end of file +$result = $teams->list(); \ No newline at end of file diff --git a/app/sdks/php/docs/examples/teams/update-team.md b/app/sdks/php/docs/examples/teams/update-team.md deleted file mode 100644 index a76fce3a83..0000000000 --- a/app/sdks/php/docs/examples/teams/update-team.md +++ /dev/null @@ -1,15 +0,0 @@ -setProject('') - ->setKey('') -; - -$teams = new Teams($client); - -$result = $teams->updateTeam('[TEAM_ID]', '[NAME]'); \ No newline at end of file diff --git a/app/sdks/php/docs/examples/teams/update.md b/app/sdks/php/docs/examples/teams/update.md new file mode 100644 index 0000000000..ea2b214da6 --- /dev/null +++ b/app/sdks/php/docs/examples/teams/update.md @@ -0,0 +1,15 @@ +setProject('') + ->setKey('') +; + +$teams = new Teams($client); + +$result = $teams->update('[TEAM_ID]', '[NAME]'); \ No newline at end of file diff --git a/app/sdks/php/docs/examples/users/create-user.md b/app/sdks/php/docs/examples/users/create-user.md deleted file mode 100644 index b25a479c89..0000000000 --- a/app/sdks/php/docs/examples/users/create-user.md +++ /dev/null @@ -1,15 +0,0 @@ -setProject('') - ->setKey('') -; - -$users = new Users($client); - -$result = $users->createUser('email@example.com', 'password'); \ No newline at end of file diff --git a/app/sdks/php/docs/examples/users/delete-user-sessions.md b/app/sdks/php/docs/examples/users/create.md similarity index 73% rename from app/sdks/php/docs/examples/users/delete-user-sessions.md rename to app/sdks/php/docs/examples/users/create.md index a83c648f69..2f88c4a19f 100644 --- a/app/sdks/php/docs/examples/users/delete-user-sessions.md +++ b/app/sdks/php/docs/examples/users/create.md @@ -12,4 +12,4 @@ $client $users = new Users($client); -$result = $users->deleteUserSessions('[USER_ID]'); \ No newline at end of file +$result = $users->create('email@example.com', 'password'); \ No newline at end of file diff --git a/app/sdks/php/docs/examples/users/delete-session.md b/app/sdks/php/docs/examples/users/delete-session.md new file mode 100644 index 0000000000..301d309a3e --- /dev/null +++ b/app/sdks/php/docs/examples/users/delete-session.md @@ -0,0 +1,15 @@ +setProject('') + ->setKey('') +; + +$users = new Users($client); + +$result = $users->deleteSession('[USER_ID]', '[SESSION_ID]'); \ No newline at end of file diff --git a/app/sdks/php/docs/examples/users/delete-sessions.md b/app/sdks/php/docs/examples/users/delete-sessions.md new file mode 100644 index 0000000000..3494eb2d59 --- /dev/null +++ b/app/sdks/php/docs/examples/users/delete-sessions.md @@ -0,0 +1,15 @@ +setProject('') + ->setKey('') +; + +$users = new Users($client); + +$result = $users->deleteSessions('[USER_ID]'); \ No newline at end of file diff --git a/app/sdks/php/docs/examples/users/delete-user-session.md b/app/sdks/php/docs/examples/users/delete-user-session.md deleted file mode 100644 index 28ad6dd165..0000000000 --- a/app/sdks/php/docs/examples/users/delete-user-session.md +++ /dev/null @@ -1,15 +0,0 @@ -setProject('') - ->setKey('') -; - -$users = new Users($client); - -$result = $users->deleteUserSession('[USER_ID]', '[SESSION_ID]'); \ No newline at end of file diff --git a/app/sdks/php/docs/examples/users/get-user.md b/app/sdks/php/docs/examples/users/get-logs.md similarity index 80% rename from app/sdks/php/docs/examples/users/get-user.md rename to app/sdks/php/docs/examples/users/get-logs.md index bc776d4313..9d64c015ca 100644 --- a/app/sdks/php/docs/examples/users/get-user.md +++ b/app/sdks/php/docs/examples/users/get-logs.md @@ -12,4 +12,4 @@ $client $users = new Users($client); -$result = $users->getUser('[USER_ID]'); \ No newline at end of file +$result = $users->getLogs('[USER_ID]'); \ No newline at end of file diff --git a/app/sdks/php/docs/examples/users/get-user-logs.md b/app/sdks/php/docs/examples/users/get-prefs.md similarity index 79% rename from app/sdks/php/docs/examples/users/get-user-logs.md rename to app/sdks/php/docs/examples/users/get-prefs.md index bb9a70e975..932db5a632 100644 --- a/app/sdks/php/docs/examples/users/get-user-logs.md +++ b/app/sdks/php/docs/examples/users/get-prefs.md @@ -12,4 +12,4 @@ $client $users = new Users($client); -$result = $users->getUserLogs('[USER_ID]'); \ No newline at end of file +$result = $users->getPrefs('[USER_ID]'); \ No newline at end of file diff --git a/app/sdks/php/docs/examples/users/get-user-prefs.md b/app/sdks/php/docs/examples/users/get-sessions.md similarity index 78% rename from app/sdks/php/docs/examples/users/get-user-prefs.md rename to app/sdks/php/docs/examples/users/get-sessions.md index 949d206065..ff75cd230f 100644 --- a/app/sdks/php/docs/examples/users/get-user-prefs.md +++ b/app/sdks/php/docs/examples/users/get-sessions.md @@ -12,4 +12,4 @@ $client $users = new Users($client); -$result = $users->getUserPrefs('[USER_ID]'); \ No newline at end of file +$result = $users->getSessions('[USER_ID]'); \ No newline at end of file diff --git a/app/sdks/php/docs/examples/users/get.md b/app/sdks/php/docs/examples/users/get.md new file mode 100644 index 0000000000..b0eaa73c54 --- /dev/null +++ b/app/sdks/php/docs/examples/users/get.md @@ -0,0 +1,15 @@ +setProject('') + ->setKey('') +; + +$users = new Users($client); + +$result = $users->get('[USER_ID]'); \ No newline at end of file diff --git a/app/sdks/php/docs/examples/users/list-users.md b/app/sdks/php/docs/examples/users/list.md similarity index 84% rename from app/sdks/php/docs/examples/users/list-users.md rename to app/sdks/php/docs/examples/users/list.md index d3824540fc..745d83e40d 100644 --- a/app/sdks/php/docs/examples/users/list-users.md +++ b/app/sdks/php/docs/examples/users/list.md @@ -12,4 +12,4 @@ $client $users = new Users($client); -$result = $users->listUsers(); \ No newline at end of file +$result = $users->list(); \ No newline at end of file diff --git a/app/sdks/php/docs/examples/users/get-user-sessions.md b/app/sdks/php/docs/examples/users/update-prefs.md similarity index 77% rename from app/sdks/php/docs/examples/users/get-user-sessions.md rename to app/sdks/php/docs/examples/users/update-prefs.md index 9f29697960..d6854bb54d 100644 --- a/app/sdks/php/docs/examples/users/get-user-sessions.md +++ b/app/sdks/php/docs/examples/users/update-prefs.md @@ -12,4 +12,4 @@ $client $users = new Users($client); -$result = $users->getUserSessions('[USER_ID]'); \ No newline at end of file +$result = $users->updatePrefs('[USER_ID]', ''); \ No newline at end of file diff --git a/app/sdks/php/docs/examples/users/update-status.md b/app/sdks/php/docs/examples/users/update-status.md new file mode 100644 index 0000000000..149d5bfd91 --- /dev/null +++ b/app/sdks/php/docs/examples/users/update-status.md @@ -0,0 +1,15 @@ +setProject('') + ->setKey('') +; + +$users = new Users($client); + +$result = $users->updateStatus('[USER_ID]', '1'); \ No newline at end of file diff --git a/app/sdks/php/docs/examples/users/update-user-prefs.md b/app/sdks/php/docs/examples/users/update-user-prefs.md deleted file mode 100644 index 873bbc2912..0000000000 --- a/app/sdks/php/docs/examples/users/update-user-prefs.md +++ /dev/null @@ -1,15 +0,0 @@ -setProject('') - ->setKey('') -; - -$users = new Users($client); - -$result = $users->updateUserPrefs('[USER_ID]', ''); \ No newline at end of file diff --git a/app/sdks/php/docs/examples/users/update-user-status.md b/app/sdks/php/docs/examples/users/update-user-status.md deleted file mode 100644 index 918d827962..0000000000 --- a/app/sdks/php/docs/examples/users/update-user-status.md +++ /dev/null @@ -1,15 +0,0 @@ -setProject('') - ->setKey('') -; - -$users = new Users($client); - -$result = $users->updateUserStatus('[USER_ID]', '1'); \ No newline at end of file diff --git a/app/sdks/php/src/Appwrite/Services/Database.php b/app/sdks/php/src/Appwrite/Services/Database.php index 3621a5c4b2..cf9135d4a2 100644 --- a/app/sdks/php/src/Appwrite/Services/Database.php +++ b/app/sdks/php/src/Appwrite/Services/Database.php @@ -25,7 +25,7 @@ class Database extends Service */ public function listCollections(string $search = '', int $limit = 25, int $offset = 0, string $orderType = 'ASC'):array { - $path = str_replace([], [], '/database'); + $path = str_replace([], [], '/database/collections'); $params = []; $params['search'] = $search; @@ -52,7 +52,7 @@ class Database extends Service */ public function createCollection(string $name, array $read, array $write, array $rules):array { - $path = str_replace([], [], '/database'); + $path = str_replace([], [], '/database/collections'); $params = []; $params['name'] = $name; @@ -77,7 +77,7 @@ class Database extends Service */ public function getCollection(string $collectionId):array { - $path = str_replace(['{collectionId}'], [$collectionId], '/database/{collectionId}'); + $path = str_replace(['{collectionId}'], [$collectionId], '/database/collections/{collectionId}'); $params = []; @@ -101,7 +101,7 @@ class Database extends Service */ public function updateCollection(string $collectionId, string $name, array $read, array $write, array $rules = []):array { - $path = str_replace(['{collectionId}'], [$collectionId], '/database/{collectionId}'); + $path = str_replace(['{collectionId}'], [$collectionId], '/database/collections/{collectionId}'); $params = []; $params['name'] = $name; @@ -126,7 +126,7 @@ class Database extends Service */ public function deleteCollection(string $collectionId):array { - $path = str_replace(['{collectionId}'], [$collectionId], '/database/{collectionId}'); + $path = str_replace(['{collectionId}'], [$collectionId], '/database/collections/{collectionId}'); $params = []; @@ -158,7 +158,7 @@ class Database extends Service */ public function listDocuments(string $collectionId, array $filters = [], int $offset = 0, int $limit = 50, string $orderField = '$uid', string $orderType = 'ASC', string $orderCast = 'string', string $search = '', int $first = 0, int $last = 0):array { - $path = str_replace(['{collectionId}'], [$collectionId], '/database/{collectionId}/documents'); + $path = str_replace(['{collectionId}'], [$collectionId], '/database/collections/{collectionId}/documents'); $params = []; $params['filters'] = $filters; @@ -193,7 +193,7 @@ class Database extends Service */ public function createDocument(string $collectionId, string $data, array $read, array $write, string $parentDocument = '', string $parentProperty = '', string $parentPropertyType = 'assign'):array { - $path = str_replace(['{collectionId}'], [$collectionId], '/database/{collectionId}/documents'); + $path = str_replace(['{collectionId}'], [$collectionId], '/database/collections/{collectionId}/documents'); $params = []; $params['data'] = $data; @@ -221,7 +221,7 @@ class Database extends Service */ public function getDocument(string $collectionId, string $documentId):array { - $path = str_replace(['{collectionId}', '{documentId}'], [$collectionId, $documentId], '/database/{collectionId}/documents/{documentId}'); + $path = str_replace(['{collectionId}', '{documentId}'], [$collectionId, $documentId], '/database/collections/{collectionId}/documents/{documentId}'); $params = []; @@ -243,7 +243,7 @@ class Database extends Service */ public function updateDocument(string $collectionId, string $documentId, string $data, array $read, array $write):array { - $path = str_replace(['{collectionId}', '{documentId}'], [$collectionId, $documentId], '/database/{collectionId}/documents/{documentId}'); + $path = str_replace(['{collectionId}', '{documentId}'], [$collectionId, $documentId], '/database/collections/{collectionId}/documents/{documentId}'); $params = []; $params['data'] = $data; @@ -269,7 +269,7 @@ class Database extends Service */ public function deleteDocument(string $collectionId, string $documentId):array { - $path = str_replace(['{collectionId}', '{documentId}'], [$collectionId, $documentId], '/database/{collectionId}/documents/{documentId}'); + $path = str_replace(['{collectionId}', '{documentId}'], [$collectionId, $documentId], '/database/collections/{collectionId}/documents/{documentId}'); $params = []; diff --git a/app/sdks/php/src/Appwrite/Services/Locale.php b/app/sdks/php/src/Appwrite/Services/Locale.php index 5304f91924..4cb95fa97a 100644 --- a/app/sdks/php/src/Appwrite/Services/Locale.php +++ b/app/sdks/php/src/Appwrite/Services/Locale.php @@ -21,7 +21,7 @@ class Locale extends Service * @throws Exception * @return array */ - public function getLocale():array + public function get():array { $path = str_replace([], [], '/locale'); $params = []; diff --git a/app/sdks/php/src/Appwrite/Services/Storage.php b/app/sdks/php/src/Appwrite/Services/Storage.php index 09b74fbf8f..c4931f9227 100644 --- a/app/sdks/php/src/Appwrite/Services/Storage.php +++ b/app/sdks/php/src/Appwrite/Services/Storage.php @@ -22,7 +22,7 @@ class Storage extends Service * @throws Exception * @return array */ - public function listFiles(string $search = '', int $limit = 25, int $offset = 0, string $orderType = 'ASC'):array + public function list(string $search = '', int $limit = 25, int $offset = 0, string $orderType = 'ASC'):array { $path = str_replace([], [], '/storage/files'); $params = []; @@ -50,7 +50,7 @@ class Storage extends Service * @throws Exception * @return array */ - public function createFile(\CurlFile $file, array $read, array $write):array + public function create(\CurlFile $file, array $read, array $write):array { $path = str_replace([], [], '/storage/files'); $params = []; @@ -74,7 +74,7 @@ class Storage extends Service * @throws Exception * @return array */ - public function getFile(string $fileId):array + public function get(string $fileId):array { $path = str_replace(['{fileId}'], [$fileId], '/storage/files/{fileId}'); $params = []; @@ -97,7 +97,7 @@ class Storage extends Service * @throws Exception * @return array */ - public function updateFile(string $fileId, array $read, array $write):array + public function update(string $fileId, array $read, array $write):array { $path = str_replace(['{fileId}'], [$fileId], '/storage/files/{fileId}'); $params = []; @@ -120,7 +120,7 @@ class Storage extends Service * @throws Exception * @return array */ - public function deleteFile(string $fileId):array + public function delete(string $fileId):array { $path = str_replace(['{fileId}'], [$fileId], '/storage/files/{fileId}'); $params = []; @@ -142,7 +142,7 @@ class Storage extends Service * @throws Exception * @return array */ - public function getFileDownload(string $fileId):array + public function getDownload(string $fileId):array { $path = str_replace(['{fileId}'], [$fileId], '/storage/files/{fileId}/download'); $params = []; @@ -170,7 +170,7 @@ class Storage extends Service * @throws Exception * @return array */ - public function getFilePreview(string $fileId, int $width = 0, int $height = 0, int $quality = 100, string $background = '', string $output = ''):array + public function getPreview(string $fileId, int $width = 0, int $height = 0, int $quality = 100, string $background = '', string $output = ''):array { $path = str_replace(['{fileId}'], [$fileId], '/storage/files/{fileId}/preview'); $params = []; @@ -197,7 +197,7 @@ class Storage extends Service * @throws Exception * @return array */ - public function getFileView(string $fileId, string $as = ''):array + public function getView(string $fileId, string $as = ''):array { $path = str_replace(['{fileId}'], [$fileId], '/storage/files/{fileId}/view'); $params = []; diff --git a/app/sdks/php/src/Appwrite/Services/Teams.php b/app/sdks/php/src/Appwrite/Services/Teams.php index 4b305bf9e9..60b73231e5 100644 --- a/app/sdks/php/src/Appwrite/Services/Teams.php +++ b/app/sdks/php/src/Appwrite/Services/Teams.php @@ -22,7 +22,7 @@ class Teams extends Service * @throws Exception * @return array */ - public function listTeams(string $search = '', int $limit = 25, int $offset = 0, string $orderType = 'ASC'):array + public function list(string $search = '', int $limit = 25, int $offset = 0, string $orderType = 'ASC'):array { $path = str_replace([], [], '/teams'); $params = []; @@ -50,7 +50,7 @@ class Teams extends Service * @throws Exception * @return array */ - public function createTeam(string $name, array $roles = ["owner"]):array + public function create(string $name, array $roles = ["owner"]):array { $path = str_replace([], [], '/teams'); $params = []; @@ -73,7 +73,7 @@ class Teams extends Service * @throws Exception * @return array */ - public function getTeam(string $teamId):array + public function get(string $teamId):array { $path = str_replace(['{teamId}'], [$teamId], '/teams/{teamId}'); $params = []; @@ -95,7 +95,7 @@ class Teams extends Service * @throws Exception * @return array */ - public function updateTeam(string $teamId, string $name):array + public function update(string $teamId, string $name):array { $path = str_replace(['{teamId}'], [$teamId], '/teams/{teamId}'); $params = []; @@ -117,7 +117,7 @@ class Teams extends Service * @throws Exception * @return array */ - public function deleteTeam(string $teamId):array + public function delete(string $teamId):array { $path = str_replace(['{teamId}'], [$teamId], '/teams/{teamId}'); $params = []; @@ -138,7 +138,7 @@ class Teams extends Service * @throws Exception * @return array */ - public function getTeamMemberships(string $teamId):array + public function getMemberships(string $teamId):array { $path = str_replace(['{teamId}'], [$teamId], '/teams/{teamId}/memberships'); $params = []; @@ -174,7 +174,7 @@ class Teams extends Service * @throws Exception * @return array */ - public function createTeamMembership(string $teamId, string $email, array $roles, string $url, string $name = ''):array + public function createMembership(string $teamId, string $email, array $roles, string $url, string $name = ''):array { $path = str_replace(['{teamId}'], [$teamId], '/teams/{teamId}/memberships'); $params = []; @@ -201,7 +201,7 @@ class Teams extends Service * @throws Exception * @return array */ - public function deleteTeamMembership(string $teamId, string $inviteId):array + public function deleteMembership(string $teamId, string $inviteId):array { $path = str_replace(['{teamId}', '{inviteId}'], [$teamId, $inviteId], '/teams/{teamId}/memberships/{inviteId}'); $params = []; diff --git a/app/sdks/php/src/Appwrite/Services/Users.php b/app/sdks/php/src/Appwrite/Services/Users.php index 3d59006f57..aa3b2ecaa4 100644 --- a/app/sdks/php/src/Appwrite/Services/Users.php +++ b/app/sdks/php/src/Appwrite/Services/Users.php @@ -21,7 +21,7 @@ class Users extends Service * @throws Exception * @return array */ - public function listUsers(string $search = '', int $limit = 25, int $offset = 0, string $orderType = 'ASC'):array + public function list(string $search = '', int $limit = 25, int $offset = 0, string $orderType = 'ASC'):array { $path = str_replace([], [], '/users'); $params = []; @@ -47,7 +47,7 @@ class Users extends Service * @throws Exception * @return array */ - public function createUser(string $email, string $password, string $name = ''):array + public function create(string $email, string $password, string $name = ''):array { $path = str_replace([], [], '/users'); $params = []; @@ -70,7 +70,7 @@ class Users extends Service * @throws Exception * @return array */ - public function getUser(string $userId):array + public function get(string $userId):array { $path = str_replace(['{userId}'], [$userId], '/users/{userId}'); $params = []; @@ -90,7 +90,7 @@ class Users extends Service * @throws Exception * @return array */ - public function getUserLogs(string $userId):array + public function getLogs(string $userId):array { $path = str_replace(['{userId}'], [$userId], '/users/{userId}/logs'); $params = []; @@ -110,7 +110,7 @@ class Users extends Service * @throws Exception * @return array */ - public function getUserPrefs(string $userId):array + public function getPrefs(string $userId):array { $path = str_replace(['{userId}'], [$userId], '/users/{userId}/prefs'); $params = []; @@ -132,7 +132,7 @@ class Users extends Service * @throws Exception * @return array */ - public function updateUserPrefs(string $userId, string $prefs):array + public function updatePrefs(string $userId, string $prefs):array { $path = str_replace(['{userId}'], [$userId], '/users/{userId}/prefs'); $params = []; @@ -153,7 +153,7 @@ class Users extends Service * @throws Exception * @return array */ - public function getUserSessions(string $userId):array + public function getSessions(string $userId):array { $path = str_replace(['{userId}'], [$userId], '/users/{userId}/sessions'); $params = []; @@ -173,7 +173,7 @@ class Users extends Service * @throws Exception * @return array */ - public function deleteUserSessions(string $userId):array + public function deleteSessions(string $userId):array { $path = str_replace(['{userId}'], [$userId], '/users/{userId}/sessions'); $params = []; @@ -194,7 +194,7 @@ class Users extends Service * @throws Exception * @return array */ - public function deleteUserSession(string $userId, string $sessionId):array + public function deleteSession(string $userId, string $sessionId):array { $path = str_replace(['{userId}'], [$userId], '/users/{userId}/sessions/:session'); $params = []; @@ -216,7 +216,7 @@ class Users extends Service * @throws Exception * @return array */ - public function updateUserStatus(string $userId, string $status):array + public function updateStatus(string $userId, string $status):array { $path = str_replace(['{userId}'], [$userId], '/users/{userId}/status'); $params = []; diff --git a/app/sdks/python/appwrite/services/database.py b/app/sdks/python/appwrite/services/database.py index 486f5c3299..36d3b68111 100644 --- a/app/sdks/python/appwrite/services/database.py +++ b/app/sdks/python/appwrite/services/database.py @@ -10,7 +10,7 @@ class Database(Service): """List Collections""" params = {} - path = '/database' + path = '/database/collections' params['search'] = search params['limit'] = limit params['offset'] = offset @@ -24,7 +24,7 @@ class Database(Service): """Create Collection""" params = {} - path = '/database' + path = '/database/collections' params['name'] = name params['read'] = read params['write'] = write @@ -38,7 +38,7 @@ class Database(Service): """Get Collection""" params = {} - path = '/database/{collectionId}' + path = '/database/collections/{collectionId}' path = path.replace('{collectionId}', collection_id) return self.client.call('get', path, { @@ -49,7 +49,7 @@ class Database(Service): """Update Collection""" params = {} - path = '/database/{collectionId}' + path = '/database/collections/{collectionId}' path = path.replace('{collectionId}', collection_id) params['name'] = name params['read'] = read @@ -64,7 +64,7 @@ class Database(Service): """Delete Collection""" params = {} - path = '/database/{collectionId}' + path = '/database/collections/{collectionId}' path = path.replace('{collectionId}', collection_id) return self.client.call('delete', path, { @@ -75,7 +75,7 @@ class Database(Service): """List Documents""" params = {} - path = '/database/{collectionId}/documents' + path = '/database/collections/{collectionId}/documents' path = path.replace('{collectionId}', collection_id) params['filters'] = filters params['offset'] = offset @@ -95,7 +95,7 @@ class Database(Service): """Create Document""" params = {} - path = '/database/{collectionId}/documents' + path = '/database/collections/{collectionId}/documents' path = path.replace('{collectionId}', collection_id) params['data'] = data params['read'] = read @@ -112,7 +112,7 @@ class Database(Service): """Get Document""" params = {} - path = '/database/{collectionId}/documents/{documentId}' + path = '/database/collections/{collectionId}/documents/{documentId}' path = path.replace('{collectionId}', collection_id) path = path.replace('{documentId}', document_id) @@ -124,7 +124,7 @@ class Database(Service): """Update Document""" params = {} - path = '/database/{collectionId}/documents/{documentId}' + path = '/database/collections/{collectionId}/documents/{documentId}' path = path.replace('{collectionId}', collection_id) path = path.replace('{documentId}', document_id) params['data'] = data @@ -139,7 +139,7 @@ class Database(Service): """Delete Document""" params = {} - path = '/database/{collectionId}/documents/{documentId}' + path = '/database/collections/{collectionId}/documents/{documentId}' path = path.replace('{collectionId}', collection_id) path = path.replace('{documentId}', document_id) diff --git a/app/sdks/python/appwrite/services/locale.py b/app/sdks/python/appwrite/services/locale.py index 4982618c9b..1c5ad69832 100644 --- a/app/sdks/python/appwrite/services/locale.py +++ b/app/sdks/python/appwrite/services/locale.py @@ -6,7 +6,7 @@ class Locale(Service): def __init__(self, client): super(Locale, self).__init__(client) - def get_locale(self): + def get(self): """Get User Locale""" params = {} diff --git a/app/sdks/python/appwrite/services/storage.py b/app/sdks/python/appwrite/services/storage.py index 7e2a986f6e..8423be06e0 100644 --- a/app/sdks/python/appwrite/services/storage.py +++ b/app/sdks/python/appwrite/services/storage.py @@ -6,7 +6,7 @@ class Storage(Service): def __init__(self, client): super(Storage, self).__init__(client) - def list_files(self, search='', limit=25, offset=0, order_type='ASC'): + def list(self, search='', limit=25, offset=0, order_type='ASC'): """List Files""" params = {} @@ -20,7 +20,7 @@ class Storage(Service): 'content-type': 'application/json', }, params) - def create_file(self, file, read, write): + def create(self, file, read, write): """Create File""" params = {} @@ -33,7 +33,7 @@ class Storage(Service): 'content-type': 'multipart/form-data', }, params) - def get_file(self, file_id): + def get(self, file_id): """Get File""" params = {} @@ -44,7 +44,7 @@ class Storage(Service): 'content-type': 'application/json', }, params) - def update_file(self, file_id, read, write): + def update(self, file_id, read, write): """Update File""" params = {} @@ -57,7 +57,7 @@ class Storage(Service): 'content-type': 'application/json', }, params) - def delete_file(self, file_id): + def delete(self, file_id): """Delete File""" params = {} @@ -68,7 +68,7 @@ class Storage(Service): 'content-type': 'application/json', }, params) - def get_file_download(self, file_id): + def get_download(self, file_id): """Get File for Download""" params = {} @@ -79,7 +79,7 @@ class Storage(Service): 'content-type': 'application/json', }, params) - def get_file_preview(self, file_id, width=0, height=0, quality=100, background='', output=''): + def get_preview(self, file_id, width=0, height=0, quality=100, background='', output=''): """Get File Preview""" params = {} @@ -95,7 +95,7 @@ class Storage(Service): 'content-type': 'application/json', }, params) - def get_file_view(self, file_id, xas=''): + def get_view(self, file_id, xas=''): """Get File for View""" params = {} diff --git a/app/sdks/python/appwrite/services/teams.py b/app/sdks/python/appwrite/services/teams.py index bcf995929f..cdc3780ad9 100644 --- a/app/sdks/python/appwrite/services/teams.py +++ b/app/sdks/python/appwrite/services/teams.py @@ -6,7 +6,7 @@ class Teams(Service): def __init__(self, client): super(Teams, self).__init__(client) - def list_teams(self, search='', limit=25, offset=0, order_type='ASC'): + def list(self, search='', limit=25, offset=0, order_type='ASC'): """List Teams""" params = {} @@ -20,7 +20,7 @@ class Teams(Service): 'content-type': 'application/json', }, params) - def create_team(self, name, roles=[]): + def create(self, name, roles=[]): """Create Team""" params = {} @@ -32,7 +32,7 @@ class Teams(Service): 'content-type': 'application/json', }, params) - def get_team(self, team_id): + def get(self, team_id): """Get Team""" params = {} @@ -43,7 +43,7 @@ class Teams(Service): 'content-type': 'application/json', }, params) - def update_team(self, team_id, name): + def update(self, team_id, name): """Update Team""" params = {} @@ -55,7 +55,7 @@ class Teams(Service): 'content-type': 'application/json', }, params) - def delete_team(self, team_id): + def delete(self, team_id): """Delete Team""" params = {} @@ -66,7 +66,7 @@ class Teams(Service): 'content-type': 'application/json', }, params) - def get_team_memberships(self, team_id): + def get_memberships(self, team_id): """Get Team Memberships""" params = {} @@ -77,7 +77,7 @@ class Teams(Service): 'content-type': 'application/json', }, params) - def create_team_membership(self, team_id, email, roles, url, name=''): + def create_membership(self, team_id, email, roles, url, name=''): """Create Team Membership""" params = {} @@ -92,7 +92,7 @@ class Teams(Service): 'content-type': 'application/json', }, params) - def delete_team_membership(self, team_id, invite_id): + def delete_membership(self, team_id, invite_id): """Delete Team Membership""" params = {} diff --git a/app/sdks/python/appwrite/services/users.py b/app/sdks/python/appwrite/services/users.py index 1fbe5c7518..be9b2da8de 100644 --- a/app/sdks/python/appwrite/services/users.py +++ b/app/sdks/python/appwrite/services/users.py @@ -6,7 +6,7 @@ class Users(Service): def __init__(self, client): super(Users, self).__init__(client) - def list_users(self, search='', limit=25, offset=0, order_type='ASC'): + def list(self, search='', limit=25, offset=0, order_type='ASC'): """List Users""" params = {} @@ -20,7 +20,7 @@ class Users(Service): 'content-type': 'application/json', }, params) - def create_user(self, email, password, name=''): + def create(self, email, password, name=''): """Create User""" params = {} @@ -33,7 +33,7 @@ class Users(Service): 'content-type': 'application/json', }, params) - def get_user(self, user_id): + def get(self, user_id): """Get User""" params = {} @@ -44,7 +44,7 @@ class Users(Service): 'content-type': 'application/json', }, params) - def get_user_logs(self, user_id): + def get_logs(self, user_id): """Get User Logs""" params = {} @@ -55,7 +55,7 @@ class Users(Service): 'content-type': 'application/json', }, params) - def get_user_prefs(self, user_id): + def get_prefs(self, user_id): """Get User Preferences""" params = {} @@ -66,7 +66,7 @@ class Users(Service): 'content-type': 'application/json', }, params) - def update_user_prefs(self, user_id, prefs): + def update_prefs(self, user_id, prefs): """Update User Preferences""" params = {} @@ -78,7 +78,7 @@ class Users(Service): 'content-type': 'application/json', }, params) - def get_user_sessions(self, user_id): + def get_sessions(self, user_id): """Get User Sessions""" params = {} @@ -89,7 +89,7 @@ class Users(Service): 'content-type': 'application/json', }, params) - def delete_user_sessions(self, user_id): + def delete_sessions(self, user_id): """Delete User Sessions""" params = {} @@ -100,7 +100,7 @@ class Users(Service): 'content-type': 'application/json', }, params) - def delete_user_session(self, user_id, session_id): + def delete_session(self, user_id, session_id): """Delete User Session""" params = {} @@ -112,7 +112,7 @@ class Users(Service): 'content-type': 'application/json', }, params) - def update_user_status(self, user_id, status): + def update_status(self, user_id, status): """Update User Status""" params = {} diff --git a/app/sdks/python/docs/examples/locale/get-locale.md b/app/sdks/python/docs/examples/locale/get.md similarity index 85% rename from app/sdks/python/docs/examples/locale/get-locale.md rename to app/sdks/python/docs/examples/locale/get.md index 552e690e4b..52d027c5a7 100644 --- a/app/sdks/python/docs/examples/locale/get-locale.md +++ b/app/sdks/python/docs/examples/locale/get.md @@ -10,4 +10,4 @@ client = Client() locale = Locale(client) -result = locale.get_locale() +result = locale.get() diff --git a/app/sdks/python/docs/examples/storage/create-file.md b/app/sdks/python/docs/examples/storage/create-file.md deleted file mode 100644 index 9ef2aacd18..0000000000 --- a/app/sdks/python/docs/examples/storage/create-file.md +++ /dev/null @@ -1,13 +0,0 @@ -from appwrite.client import Client -from appwrite.services.storage import Storage - -client = Client() - -(client - .set_project('') - .set_key('') -) - -storage = Storage(client) - -result = storage.create_file(document.getElementById('uploader').files[0], {}, {}) diff --git a/app/sdks/python/docs/examples/storage/get-file-download.md b/app/sdks/python/docs/examples/storage/create.md similarity index 68% rename from app/sdks/python/docs/examples/storage/get-file-download.md rename to app/sdks/python/docs/examples/storage/create.md index cbe8f97b41..39bb42e671 100644 --- a/app/sdks/python/docs/examples/storage/get-file-download.md +++ b/app/sdks/python/docs/examples/storage/create.md @@ -10,4 +10,4 @@ client = Client() storage = Storage(client) -result = storage.get_file_download('[FILE_ID]') +result = storage.create(document.getElementById('uploader').files[0], {}, {}) diff --git a/app/sdks/python/docs/examples/storage/get-file.md b/app/sdks/python/docs/examples/storage/delete.md similarity index 81% rename from app/sdks/python/docs/examples/storage/get-file.md rename to app/sdks/python/docs/examples/storage/delete.md index 7146cbdb94..dde1f574f9 100644 --- a/app/sdks/python/docs/examples/storage/get-file.md +++ b/app/sdks/python/docs/examples/storage/delete.md @@ -10,4 +10,4 @@ client = Client() storage = Storage(client) -result = storage.get_file('[FILE_ID]') +result = storage.delete('[FILE_ID]') diff --git a/app/sdks/python/docs/examples/storage/get-file-view.md b/app/sdks/python/docs/examples/storage/get-download.md similarity index 79% rename from app/sdks/python/docs/examples/storage/get-file-view.md rename to app/sdks/python/docs/examples/storage/get-download.md index 72f0ec5731..1f0893590e 100644 --- a/app/sdks/python/docs/examples/storage/get-file-view.md +++ b/app/sdks/python/docs/examples/storage/get-download.md @@ -10,4 +10,4 @@ client = Client() storage = Storage(client) -result = storage.get_file_view('[FILE_ID]') +result = storage.get_download('[FILE_ID]') diff --git a/app/sdks/python/docs/examples/storage/get-file-preview.md b/app/sdks/python/docs/examples/storage/get-file-preview.md deleted file mode 100644 index 7d8ffc854e..0000000000 --- a/app/sdks/python/docs/examples/storage/get-file-preview.md +++ /dev/null @@ -1,13 +0,0 @@ -from appwrite.client import Client -from appwrite.services.storage import Storage - -client = Client() - -(client - .set_project('') - .set_key('') -) - -storage = Storage(client) - -result = storage.get_file_preview('[FILE_ID]') diff --git a/app/sdks/python/docs/examples/storage/delete-file.md b/app/sdks/python/docs/examples/storage/get-preview.md similarity index 80% rename from app/sdks/python/docs/examples/storage/delete-file.md rename to app/sdks/python/docs/examples/storage/get-preview.md index 7dbf229d28..96badbe625 100644 --- a/app/sdks/python/docs/examples/storage/delete-file.md +++ b/app/sdks/python/docs/examples/storage/get-preview.md @@ -10,4 +10,4 @@ client = Client() storage = Storage(client) -result = storage.delete_file('[FILE_ID]') +result = storage.get_preview('[FILE_ID]') diff --git a/app/sdks/python/docs/examples/storage/get-view.md b/app/sdks/python/docs/examples/storage/get-view.md new file mode 100644 index 0000000000..bb5bdebb7f --- /dev/null +++ b/app/sdks/python/docs/examples/storage/get-view.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.storage import Storage + +client = Client() + +(client + .set_project('') + .set_key('') +) + +storage = Storage(client) + +result = storage.get_view('[FILE_ID]') diff --git a/app/sdks/python/docs/examples/storage/get.md b/app/sdks/python/docs/examples/storage/get.md new file mode 100644 index 0000000000..8962ea4160 --- /dev/null +++ b/app/sdks/python/docs/examples/storage/get.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.storage import Storage + +client = Client() + +(client + .set_project('') + .set_key('') +) + +storage = Storage(client) + +result = storage.get('[FILE_ID]') diff --git a/app/sdks/python/docs/examples/storage/list-files.md b/app/sdks/python/docs/examples/storage/list.md similarity index 85% rename from app/sdks/python/docs/examples/storage/list-files.md rename to app/sdks/python/docs/examples/storage/list.md index 175b3c3a5f..e7f7924bdb 100644 --- a/app/sdks/python/docs/examples/storage/list-files.md +++ b/app/sdks/python/docs/examples/storage/list.md @@ -10,4 +10,4 @@ client = Client() storage = Storage(client) -result = storage.list_files() +result = storage.list() diff --git a/app/sdks/python/docs/examples/storage/update-file.md b/app/sdks/python/docs/examples/storage/update-file.md deleted file mode 100644 index b32f8e7ad0..0000000000 --- a/app/sdks/python/docs/examples/storage/update-file.md +++ /dev/null @@ -1,13 +0,0 @@ -from appwrite.client import Client -from appwrite.services.storage import Storage - -client = Client() - -(client - .set_project('') - .set_key('') -) - -storage = Storage(client) - -result = storage.update_file('[FILE_ID]', {}, {}) diff --git a/app/sdks/python/docs/examples/storage/update.md b/app/sdks/python/docs/examples/storage/update.md new file mode 100644 index 0000000000..c07dcb5b8b --- /dev/null +++ b/app/sdks/python/docs/examples/storage/update.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.storage import Storage + +client = Client() + +(client + .set_project('') + .set_key('') +) + +storage = Storage(client) + +result = storage.update('[FILE_ID]', {}, {}) diff --git a/app/sdks/python/docs/examples/teams/delete-team-membership.md b/app/sdks/python/docs/examples/teams/create-membership.md similarity index 63% rename from app/sdks/python/docs/examples/teams/delete-team-membership.md rename to app/sdks/python/docs/examples/teams/create-membership.md index f8360744df..b28e4d71d1 100644 --- a/app/sdks/python/docs/examples/teams/delete-team-membership.md +++ b/app/sdks/python/docs/examples/teams/create-membership.md @@ -10,4 +10,4 @@ client = Client() teams = Teams(client) -result = teams.delete_team_membership('[TEAM_ID]', '[INVITE_ID]') +result = teams.create_membership('[TEAM_ID]', 'email@example.com', {}, 'https://example.com') diff --git a/app/sdks/python/docs/examples/teams/create-team-membership.md b/app/sdks/python/docs/examples/teams/create-team-membership.md deleted file mode 100644 index 6c3f6abf7b..0000000000 --- a/app/sdks/python/docs/examples/teams/create-team-membership.md +++ /dev/null @@ -1,13 +0,0 @@ -from appwrite.client import Client -from appwrite.services.teams import Teams - -client = Client() - -(client - .set_project('') - .set_key('') -) - -teams = Teams(client) - -result = teams.create_team_membership('[TEAM_ID]', 'email@example.com', {}, 'https://example.com') diff --git a/app/sdks/python/docs/examples/teams/create-team.md b/app/sdks/python/docs/examples/teams/create.md similarity index 81% rename from app/sdks/python/docs/examples/teams/create-team.md rename to app/sdks/python/docs/examples/teams/create.md index 2429ba9899..f54083626e 100644 --- a/app/sdks/python/docs/examples/teams/create-team.md +++ b/app/sdks/python/docs/examples/teams/create.md @@ -10,4 +10,4 @@ client = Client() teams = Teams(client) -result = teams.create_team('[NAME]') +result = teams.create('[NAME]') diff --git a/app/sdks/python/docs/examples/teams/get-team-memberships.md b/app/sdks/python/docs/examples/teams/delete-membership.md similarity index 73% rename from app/sdks/python/docs/examples/teams/get-team-memberships.md rename to app/sdks/python/docs/examples/teams/delete-membership.md index 0b150d02c8..26ada291ec 100644 --- a/app/sdks/python/docs/examples/teams/get-team-memberships.md +++ b/app/sdks/python/docs/examples/teams/delete-membership.md @@ -10,4 +10,4 @@ client = Client() teams = Teams(client) -result = teams.get_team_memberships('[TEAM_ID]') +result = teams.delete_membership('[TEAM_ID]', '[INVITE_ID]') diff --git a/app/sdks/python/docs/examples/teams/get-team.md b/app/sdks/python/docs/examples/teams/delete.md similarity index 81% rename from app/sdks/python/docs/examples/teams/get-team.md rename to app/sdks/python/docs/examples/teams/delete.md index 3a36051ac7..02bf96686f 100644 --- a/app/sdks/python/docs/examples/teams/get-team.md +++ b/app/sdks/python/docs/examples/teams/delete.md @@ -10,4 +10,4 @@ client = Client() teams = Teams(client) -result = teams.get_team('[TEAM_ID]') +result = teams.delete('[TEAM_ID]') diff --git a/app/sdks/python/docs/examples/teams/get-memberships.md b/app/sdks/python/docs/examples/teams/get-memberships.md new file mode 100644 index 0000000000..193ed976ca --- /dev/null +++ b/app/sdks/python/docs/examples/teams/get-memberships.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.teams import Teams + +client = Client() + +(client + .set_project('') + .set_key('') +) + +teams = Teams(client) + +result = teams.get_memberships('[TEAM_ID]') diff --git a/app/sdks/python/docs/examples/teams/delete-team.md b/app/sdks/python/docs/examples/teams/get.md similarity index 80% rename from app/sdks/python/docs/examples/teams/delete-team.md rename to app/sdks/python/docs/examples/teams/get.md index f442ca8850..f8e6bc869a 100644 --- a/app/sdks/python/docs/examples/teams/delete-team.md +++ b/app/sdks/python/docs/examples/teams/get.md @@ -10,4 +10,4 @@ client = Client() teams = Teams(client) -result = teams.delete_team('[TEAM_ID]') +result = teams.get('[TEAM_ID]') diff --git a/app/sdks/python/docs/examples/teams/list-teams.md b/app/sdks/python/docs/examples/teams/list.md similarity index 85% rename from app/sdks/python/docs/examples/teams/list-teams.md rename to app/sdks/python/docs/examples/teams/list.md index 0022359833..3f6bca905e 100644 --- a/app/sdks/python/docs/examples/teams/list-teams.md +++ b/app/sdks/python/docs/examples/teams/list.md @@ -10,4 +10,4 @@ client = Client() teams = Teams(client) -result = teams.list_teams() +result = teams.list() diff --git a/app/sdks/python/docs/examples/teams/update-team.md b/app/sdks/python/docs/examples/teams/update-team.md deleted file mode 100644 index 0b74316a98..0000000000 --- a/app/sdks/python/docs/examples/teams/update-team.md +++ /dev/null @@ -1,13 +0,0 @@ -from appwrite.client import Client -from appwrite.services.teams import Teams - -client = Client() - -(client - .set_project('') - .set_key('') -) - -teams = Teams(client) - -result = teams.update_team('[TEAM_ID]', '[NAME]') diff --git a/app/sdks/python/docs/examples/teams/update.md b/app/sdks/python/docs/examples/teams/update.md new file mode 100644 index 0000000000..996447f7f1 --- /dev/null +++ b/app/sdks/python/docs/examples/teams/update.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.teams import Teams + +client = Client() + +(client + .set_project('') + .set_key('') +) + +teams = Teams(client) + +result = teams.update('[TEAM_ID]', '[NAME]') diff --git a/app/sdks/python/docs/examples/users/create-user.md b/app/sdks/python/docs/examples/users/create-user.md deleted file mode 100644 index 0b83f46274..0000000000 --- a/app/sdks/python/docs/examples/users/create-user.md +++ /dev/null @@ -1,13 +0,0 @@ -from appwrite.client import Client -from appwrite.services.users import Users - -client = Client() - -(client - .set_project('') - .set_key('') -) - -users = Users(client) - -result = users.create_user('email@example.com', 'password') diff --git a/app/sdks/python/docs/examples/users/delete-user-sessions.md b/app/sdks/python/docs/examples/users/create.md similarity index 75% rename from app/sdks/python/docs/examples/users/delete-user-sessions.md rename to app/sdks/python/docs/examples/users/create.md index 64a450d8df..14546109ce 100644 --- a/app/sdks/python/docs/examples/users/delete-user-sessions.md +++ b/app/sdks/python/docs/examples/users/create.md @@ -10,4 +10,4 @@ client = Client() users = Users(client) -result = users.delete_user_sessions('[USER_ID]') +result = users.create('email@example.com', 'password') diff --git a/app/sdks/python/docs/examples/users/delete-session.md b/app/sdks/python/docs/examples/users/delete-session.md new file mode 100644 index 0000000000..f1b7ec6c3b --- /dev/null +++ b/app/sdks/python/docs/examples/users/delete-session.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.users import Users + +client = Client() + +(client + .set_project('') + .set_key('') +) + +users = Users(client) + +result = users.delete_session('[USER_ID]', '[SESSION_ID]') diff --git a/app/sdks/python/docs/examples/users/delete-sessions.md b/app/sdks/python/docs/examples/users/delete-sessions.md new file mode 100644 index 0000000000..922a4ebeed --- /dev/null +++ b/app/sdks/python/docs/examples/users/delete-sessions.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.users import Users + +client = Client() + +(client + .set_project('') + .set_key('') +) + +users = Users(client) + +result = users.delete_sessions('[USER_ID]') diff --git a/app/sdks/python/docs/examples/users/delete-user-session.md b/app/sdks/python/docs/examples/users/delete-user-session.md deleted file mode 100644 index c731fca3d5..0000000000 --- a/app/sdks/python/docs/examples/users/delete-user-session.md +++ /dev/null @@ -1,13 +0,0 @@ -from appwrite.client import Client -from appwrite.services.users import Users - -client = Client() - -(client - .set_project('') - .set_key('') -) - -users = Users(client) - -result = users.delete_user_session('[USER_ID]', '[SESSION_ID]') diff --git a/app/sdks/python/docs/examples/users/get-user.md b/app/sdks/python/docs/examples/users/get-logs.md similarity index 81% rename from app/sdks/python/docs/examples/users/get-user.md rename to app/sdks/python/docs/examples/users/get-logs.md index 1a9bc3a023..e97073137e 100644 --- a/app/sdks/python/docs/examples/users/get-user.md +++ b/app/sdks/python/docs/examples/users/get-logs.md @@ -10,4 +10,4 @@ client = Client() users = Users(client) -result = users.get_user('[USER_ID]') +result = users.get_logs('[USER_ID]') diff --git a/app/sdks/python/docs/examples/users/get-user-logs.md b/app/sdks/python/docs/examples/users/get-prefs.md similarity index 79% rename from app/sdks/python/docs/examples/users/get-user-logs.md rename to app/sdks/python/docs/examples/users/get-prefs.md index 83b06d2a2d..90c9cfac96 100644 --- a/app/sdks/python/docs/examples/users/get-user-logs.md +++ b/app/sdks/python/docs/examples/users/get-prefs.md @@ -10,4 +10,4 @@ client = Client() users = Users(client) -result = users.get_user_logs('[USER_ID]') +result = users.get_prefs('[USER_ID]') diff --git a/app/sdks/python/docs/examples/users/get-user-prefs.md b/app/sdks/python/docs/examples/users/get-sessions.md similarity index 79% rename from app/sdks/python/docs/examples/users/get-user-prefs.md rename to app/sdks/python/docs/examples/users/get-sessions.md index 1b14b86c86..19b9bc3722 100644 --- a/app/sdks/python/docs/examples/users/get-user-prefs.md +++ b/app/sdks/python/docs/examples/users/get-sessions.md @@ -10,4 +10,4 @@ client = Client() users = Users(client) -result = users.get_user_prefs('[USER_ID]') +result = users.get_sessions('[USER_ID]') diff --git a/app/sdks/python/docs/examples/users/get.md b/app/sdks/python/docs/examples/users/get.md new file mode 100644 index 0000000000..b0206edfb3 --- /dev/null +++ b/app/sdks/python/docs/examples/users/get.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.users import Users + +client = Client() + +(client + .set_project('') + .set_key('') +) + +users = Users(client) + +result = users.get('[USER_ID]') diff --git a/app/sdks/python/docs/examples/users/list-users.md b/app/sdks/python/docs/examples/users/list.md similarity index 85% rename from app/sdks/python/docs/examples/users/list-users.md rename to app/sdks/python/docs/examples/users/list.md index fe2082d306..0538e4251a 100644 --- a/app/sdks/python/docs/examples/users/list-users.md +++ b/app/sdks/python/docs/examples/users/list.md @@ -10,4 +10,4 @@ client = Client() users = Users(client) -result = users.list_users() +result = users.list() diff --git a/app/sdks/python/docs/examples/users/update-prefs.md b/app/sdks/python/docs/examples/users/update-prefs.md new file mode 100644 index 0000000000..f7ae308d5e --- /dev/null +++ b/app/sdks/python/docs/examples/users/update-prefs.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.users import Users + +client = Client() + +(client + .set_project('') + .set_key('') +) + +users = Users(client) + +result = users.update_prefs('[USER_ID]', '') diff --git a/app/sdks/python/docs/examples/users/get-user-sessions.md b/app/sdks/python/docs/examples/users/update-status.md similarity index 77% rename from app/sdks/python/docs/examples/users/get-user-sessions.md rename to app/sdks/python/docs/examples/users/update-status.md index d91583fbe5..bdc1127427 100644 --- a/app/sdks/python/docs/examples/users/get-user-sessions.md +++ b/app/sdks/python/docs/examples/users/update-status.md @@ -10,4 +10,4 @@ client = Client() users = Users(client) -result = users.get_user_sessions('[USER_ID]') +result = users.update_status('[USER_ID]', '1') diff --git a/app/sdks/python/docs/examples/users/update-user-prefs.md b/app/sdks/python/docs/examples/users/update-user-prefs.md deleted file mode 100644 index ff310f654b..0000000000 --- a/app/sdks/python/docs/examples/users/update-user-prefs.md +++ /dev/null @@ -1,13 +0,0 @@ -from appwrite.client import Client -from appwrite.services.users import Users - -client = Client() - -(client - .set_project('') - .set_key('') -) - -users = Users(client) - -result = users.update_user_prefs('[USER_ID]', '') diff --git a/app/sdks/python/docs/examples/users/update-user-status.md b/app/sdks/python/docs/examples/users/update-user-status.md deleted file mode 100644 index 0639c9e5f7..0000000000 --- a/app/sdks/python/docs/examples/users/update-user-status.md +++ /dev/null @@ -1,13 +0,0 @@ -from appwrite.client import Client -from appwrite.services.users import Users - -client = Client() - -(client - .set_project('') - .set_key('') -) - -users = Users(client) - -result = users.update_user_status('[USER_ID]', '1') diff --git a/app/sdks/ruby/lib/appwrite/services/database.rb b/app/sdks/ruby/lib/appwrite/services/database.rb index cf1171248d..52404c3b56 100644 --- a/app/sdks/ruby/lib/appwrite/services/database.rb +++ b/app/sdks/ruby/lib/appwrite/services/database.rb @@ -2,7 +2,7 @@ module Appwrite class Database < Service def list_collections(search: '', limit: 25, offset: 0, order_type: 'ASC') - path = '/database' + path = '/database/collections' params = { 'search': search, @@ -17,7 +17,7 @@ module Appwrite end def create_collection(name:, read:, write:, rules:) - path = '/database' + path = '/database/collections' params = { 'name': name, @@ -32,7 +32,7 @@ module Appwrite end def get_collection(collection_id:) - path = '/database/{collectionId}' + path = '/database/collections/{collectionId}' .gsub('{collection_id}', collection_id) params = { @@ -44,7 +44,7 @@ module Appwrite end def update_collection(collection_id:, name:, read:, write:, rules: []) - path = '/database/{collectionId}' + path = '/database/collections/{collectionId}' .gsub('{collection_id}', collection_id) params = { @@ -60,7 +60,7 @@ module Appwrite end def delete_collection(collection_id:) - path = '/database/{collectionId}' + path = '/database/collections/{collectionId}' .gsub('{collection_id}', collection_id) params = { @@ -72,7 +72,7 @@ module Appwrite end def list_documents(collection_id:, filters: [], offset: 0, limit: 50, order_field: '$uid', order_type: 'ASC', order_cast: 'string', search: '', first: 0, last: 0) - path = '/database/{collectionId}/documents' + path = '/database/collections/{collectionId}/documents' .gsub('{collection_id}', collection_id) params = { @@ -93,7 +93,7 @@ module Appwrite end def create_document(collection_id:, data:, read:, write:, parent_document: '', parent_property: '', parent_property_type: 'assign') - path = '/database/{collectionId}/documents' + path = '/database/collections/{collectionId}/documents' .gsub('{collection_id}', collection_id) params = { @@ -111,7 +111,7 @@ module Appwrite end def get_document(collection_id:, document_id:) - path = '/database/{collectionId}/documents/{documentId}' + path = '/database/collections/{collectionId}/documents/{documentId}' .gsub('{collection_id}', collection_id) .gsub('{document_id}', document_id) @@ -124,7 +124,7 @@ module Appwrite end def update_document(collection_id:, document_id:, data:, read:, write:) - path = '/database/{collectionId}/documents/{documentId}' + path = '/database/collections/{collectionId}/documents/{documentId}' .gsub('{collection_id}', collection_id) .gsub('{document_id}', document_id) @@ -140,7 +140,7 @@ module Appwrite end def delete_document(collection_id:, document_id:) - path = '/database/{collectionId}/documents/{documentId}' + path = '/database/collections/{collectionId}/documents/{documentId}' .gsub('{collection_id}', collection_id) .gsub('{document_id}', document_id) diff --git a/app/sdks/ruby/lib/appwrite/services/locale.rb b/app/sdks/ruby/lib/appwrite/services/locale.rb index a5c708c764..707c8b2f4a 100644 --- a/app/sdks/ruby/lib/appwrite/services/locale.rb +++ b/app/sdks/ruby/lib/appwrite/services/locale.rb @@ -1,7 +1,7 @@ module Appwrite class Locale < Service - def get_locale() + def get() path = '/locale' params = { diff --git a/app/sdks/ruby/lib/appwrite/services/storage.rb b/app/sdks/ruby/lib/appwrite/services/storage.rb index 2fe1a5762f..ea56e484d8 100644 --- a/app/sdks/ruby/lib/appwrite/services/storage.rb +++ b/app/sdks/ruby/lib/appwrite/services/storage.rb @@ -1,7 +1,7 @@ module Appwrite class Storage < Service - def list_files(search: '', limit: 25, offset: 0, order_type: 'ASC') + def list(search: '', limit: 25, offset: 0, order_type: 'ASC') path = '/storage/files' params = { @@ -16,7 +16,7 @@ module Appwrite }, params); end - def create_file(file:, read:, write:) + def create(file:, read:, write:) path = '/storage/files' params = { @@ -30,7 +30,7 @@ module Appwrite }, params); end - def get_file(file_id:) + def get(file_id:) path = '/storage/files/{fileId}' .gsub('{file_id}', file_id) @@ -42,7 +42,7 @@ module Appwrite }, params); end - def update_file(file_id:, read:, write:) + def update(file_id:, read:, write:) path = '/storage/files/{fileId}' .gsub('{file_id}', file_id) @@ -56,7 +56,7 @@ module Appwrite }, params); end - def delete_file(file_id:) + def delete(file_id:) path = '/storage/files/{fileId}' .gsub('{file_id}', file_id) @@ -68,7 +68,7 @@ module Appwrite }, params); end - def get_file_download(file_id:) + def get_download(file_id:) path = '/storage/files/{fileId}/download' .gsub('{file_id}', file_id) @@ -80,7 +80,7 @@ module Appwrite }, params); end - def get_file_preview(file_id:, width: 0, height: 0, quality: 100, background: '', output: '') + def get_preview(file_id:, width: 0, height: 0, quality: 100, background: '', output: '') path = '/storage/files/{fileId}/preview' .gsub('{file_id}', file_id) @@ -97,7 +97,7 @@ module Appwrite }, params); end - def get_file_view(file_id:, as: '') + def get_view(file_id:, as: '') path = '/storage/files/{fileId}/view' .gsub('{file_id}', file_id) diff --git a/app/sdks/ruby/lib/appwrite/services/teams.rb b/app/sdks/ruby/lib/appwrite/services/teams.rb index 16ae20e676..de6079b6f8 100644 --- a/app/sdks/ruby/lib/appwrite/services/teams.rb +++ b/app/sdks/ruby/lib/appwrite/services/teams.rb @@ -1,7 +1,7 @@ module Appwrite class Teams < Service - def list_teams(search: '', limit: 25, offset: 0, order_type: 'ASC') + def list(search: '', limit: 25, offset: 0, order_type: 'ASC') path = '/teams' params = { @@ -16,7 +16,7 @@ module Appwrite }, params); end - def create_team(name:, roles: ["owner"]) + def create(name:, roles: ["owner"]) path = '/teams' params = { @@ -29,7 +29,7 @@ module Appwrite }, params); end - def get_team(team_id:) + def get(team_id:) path = '/teams/{teamId}' .gsub('{team_id}', team_id) @@ -41,7 +41,7 @@ module Appwrite }, params); end - def update_team(team_id:, name:) + def update(team_id:, name:) path = '/teams/{teamId}' .gsub('{team_id}', team_id) @@ -54,7 +54,7 @@ module Appwrite }, params); end - def delete_team(team_id:) + def delete(team_id:) path = '/teams/{teamId}' .gsub('{team_id}', team_id) @@ -66,7 +66,7 @@ module Appwrite }, params); end - def get_team_memberships(team_id:) + def get_memberships(team_id:) path = '/teams/{teamId}/memberships' .gsub('{team_id}', team_id) @@ -78,7 +78,7 @@ module Appwrite }, params); end - def create_team_membership(team_id:, email:, roles:, url:, name: '') + def create_membership(team_id:, email:, roles:, url:, name: '') path = '/teams/{teamId}/memberships' .gsub('{team_id}', team_id) @@ -94,7 +94,7 @@ module Appwrite }, params); end - def delete_team_membership(team_id:, invite_id:) + def delete_membership(team_id:, invite_id:) path = '/teams/{teamId}/memberships/{inviteId}' .gsub('{team_id}', team_id) .gsub('{invite_id}', invite_id) diff --git a/app/sdks/ruby/lib/appwrite/services/users.rb b/app/sdks/ruby/lib/appwrite/services/users.rb index 99927523f0..75b1701f2d 100644 --- a/app/sdks/ruby/lib/appwrite/services/users.rb +++ b/app/sdks/ruby/lib/appwrite/services/users.rb @@ -1,7 +1,7 @@ module Appwrite class Users < Service - def list_users(search: '', limit: 25, offset: 0, order_type: 'ASC') + def list(search: '', limit: 25, offset: 0, order_type: 'ASC') path = '/users' params = { @@ -16,7 +16,7 @@ module Appwrite }, params); end - def create_user(email:, password:, name: '') + def create(email:, password:, name: '') path = '/users' params = { @@ -30,7 +30,7 @@ module Appwrite }, params); end - def get_user(user_id:) + def get(user_id:) path = '/users/{userId}' .gsub('{user_id}', user_id) @@ -42,7 +42,7 @@ module Appwrite }, params); end - def get_user_logs(user_id:) + def get_logs(user_id:) path = '/users/{userId}/logs' .gsub('{user_id}', user_id) @@ -54,7 +54,7 @@ module Appwrite }, params); end - def get_user_prefs(user_id:) + def get_prefs(user_id:) path = '/users/{userId}/prefs' .gsub('{user_id}', user_id) @@ -66,7 +66,7 @@ module Appwrite }, params); end - def update_user_prefs(user_id:, prefs:) + def update_prefs(user_id:, prefs:) path = '/users/{userId}/prefs' .gsub('{user_id}', user_id) @@ -79,7 +79,7 @@ module Appwrite }, params); end - def get_user_sessions(user_id:) + def get_sessions(user_id:) path = '/users/{userId}/sessions' .gsub('{user_id}', user_id) @@ -91,7 +91,7 @@ module Appwrite }, params); end - def delete_user_sessions(user_id:) + def delete_sessions(user_id:) path = '/users/{userId}/sessions' .gsub('{user_id}', user_id) @@ -103,7 +103,7 @@ module Appwrite }, params); end - def delete_user_session(user_id:, session_id:) + def delete_session(user_id:, session_id:) path = '/users/{userId}/sessions/:session' .gsub('{user_id}', user_id) @@ -116,7 +116,7 @@ module Appwrite }, params); end - def update_user_status(user_id:, status:) + def update_status(user_id:, status:) path = '/users/{userId}/status' .gsub('{user_id}', user_id) diff --git a/gulpfile.js b/gulpfile.js index d839bde5e8..a3b43be5a9 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -73,7 +73,8 @@ const configApp = { const configDep = { mainFile: 'app-dep.js', src: [ - 'node_modules/appwrite/src/sdk.js', + //'node_modules/appwrite/src/sdk.js', + 'public/scripts/dependencies/appwrite.js', 'public/scripts/dependencies/chart.js', 'public/scripts/dependencies/markdown-it.js', 'public/scripts/dependencies/pell.js', diff --git a/package.json b/package.json index 29308a8b41..e84ed569b8 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,6 @@ "license": "BSD-3-Clause", "repository": "public", "devDependencies": { - "appwrite": "^1.0.23", "gulp": "^4.0.0", "gulp-clean-css": "^4.0.0", "gulp-concat": "2.5.2", diff --git a/public/dist/scripts/app-dep.js b/public/dist/scripts/app-dep.js index a01a015516..683bc54dd7 100644 --- a/public/dist/scripts/app-dep.js +++ b/public/dist/scripts/app-dep.js @@ -5,7 +5,7 @@ {http.addGlobalHeader('X-Appwrite-Locale',value);config.locale=value;return this;};let setMode=function(value) {http.addGlobalHeader('X-Appwrite-Mode',value);config.mode=value;return this;};let http=function(document){let globalParams=[],globalHeaders=[];let addParam=function(url,param,value){let a=document.createElement('a'),regex=/(?:\?|&|&)+([^=]+)(?:=([^&]*))*/g;let match,str=[];a.href=url;param=encodeURIComponent(param);while(match=regex.exec(a.search))if(param!==match[1])str.push(match[1]+(match[2]?"="+match[2]:""));str.push(param+(value?"="+encodeURIComponent(value):""));a.search=str.join("&");return a.href;};let buildQuery=function(params){let str=[];for(let p in params){if(Array.isArray(params[p])){for(let index=0;index=request.status){let data=request.response;let contentType=this.getResponseHeader('content-type')||'';contentType=contentType.substring(0,contentType.indexOf(';'));switch(contentType){case'application/json':data=JSON.parse(data);break;} resolve(data);}else{reject(new Error(request.statusText));}};if(progress){request.addEventListener('progress',progress);request.upload.addEventListener('progress',progress,false);} request.onerror=function(){reject(new Error("Network Error"));};request.send(params);})};return{'get':function(path,headers={},params={}){return call('GET',path+((Object.keys(params).length>0)?'?'+buildQuery(params):''),headers,{});},'post':function(path,headers={},params={},progress=null){return call('POST',path,headers,params,progress);},'put':function(path,headers={},params={},progress=null){return call('PUT',path,headers,params,progress);},'patch':function(path,headers={},params={},progress=null){return call('PATCH',path,headers,params,progress);},'delete':function(path,headers={},params={},progress=null){return call('DELETE',path,headers,params,progress);},'addGlobalParam':addGlobalParam,'addGlobalHeader':addGlobalHeader}}(window.document);let iframe=function(method,url,params){let form=document.createElement('form');form.setAttribute('method',method);form.setAttribute('action',config.endpoint+url);for(let key in params){if(params.hasOwnProperty(key)){let hiddenField=document.createElement("input");hiddenField.setAttribute("type","hidden");hiddenField.setAttribute("name",key);hiddenField.setAttribute("value",params[key]);form.appendChild(hiddenField);}} -document.body.appendChild(form);return form.submit();};let account={get:function(){let path='/account';let payload={};return http.get(path,{'content-type':'application/json'},payload);},delete:function(){let path='/account';let payload={};return http.delete(path,{'content-type':'application/json'},payload);},updateEmail:function(email,password){if(email===undefined){throw new Error('Missing required parameter: "email"');} +document.body.appendChild(form);return form.submit();};let account={get:function(){let path='/account';let payload={};return http.get(path,{'content-type':'application/json',},payload);},create:function(email,password,name=''){if(email===undefined){throw new Error('Missing required parameter: "email"');} +if(password===undefined){throw new Error('Missing required parameter: "password"');} +let path='/account';let payload={};if(email){payload['email']=email;} +if(password){payload['password']=password;} +if(name){payload['name']=name;} +return http.post(path,{'content-type':'application/json',},payload);},delete:function(){let path='/account';let payload={};return http.delete(path,{'content-type':'application/json',},payload);},updateEmail:function(email,password){if(email===undefined){throw new Error('Missing required parameter: "email"');} if(password===undefined){throw new Error('Missing required parameter: "password"');} let path='/account/email';let payload={};if(email){payload['email']=email;} if(password){payload['password']=password;} -return http.patch(path,{'content-type':'application/json'},payload);},updateName:function(name){if(name===undefined){throw new Error('Missing required parameter: "name"');} +return http.patch(path,{'content-type':'application/json',},payload);},getLogs:function(){let path='/account/logs';let payload={};return http.get(path,{'content-type':'application/json',},payload);},updateName:function(name){if(name===undefined){throw new Error('Missing required parameter: "name"');} let path='/account/name';let payload={};if(name){payload['name']=name;} -return http.patch(path,{'content-type':'application/json'},payload);},updatePassword:function(password,oldPassword){if(password===undefined){throw new Error('Missing required parameter: "password"');} +return http.patch(path,{'content-type':'application/json',},payload);},updatePassword:function(password,oldPassword){if(password===undefined){throw new Error('Missing required parameter: "password"');} if(oldPassword===undefined){throw new Error('Missing required parameter: "oldPassword"');} let path='/account/password';let payload={};if(password){payload['password']=password;} if(oldPassword){payload['old-password']=oldPassword;} -return http.patch(path,{'content-type':'application/json'},payload);},getPrefs:function(){let path='/account/prefs';let payload={};return http.get(path,{'content-type':'application/json'},payload);},updatePrefs:function(prefs){if(prefs===undefined){throw new Error('Missing required parameter: "prefs"');} +return http.patch(path,{'content-type':'application/json',},payload);},getPrefs:function(){let path='/account/prefs';let payload={};return http.get(path,{'content-type':'application/json',},payload);},updatePrefs:function(prefs){if(prefs===undefined){throw new Error('Missing required parameter: "prefs"');} let path='/account/prefs';let payload={};if(prefs){payload['prefs']=prefs;} -return http.patch(path,{'content-type':'application/json'},payload);},getSecurity:function(){let path='/account/security';let payload={};return http.get(path,{'content-type':'application/json'},payload);},getSessions:function(){let path='/account/sessions';let payload={};return http.get(path,{'content-type':'application/json'},payload);}};let auth={login:function(email,password,success,failure){if(email===undefined){throw new Error('Missing required parameter: "email"');} -if(password===undefined){throw new Error('Missing required parameter: "password"');} -if(success===undefined){throw new Error('Missing required parameter: "success"');} -if(failure===undefined){throw new Error('Missing required parameter: "failure"');} -let path='/auth/login';let payload={};if(email){payload['email']=email;} -if(password){payload['password']=password;} -if(success){payload['success']=success;} -if(failure){payload['failure']=failure;} -payload['project']=config.project;return iframe('post',path,payload);},logout:function(){let path='/auth/logout';let payload={};return http.delete(path,{'content-type':'application/json'},payload);},logoutBySession:function(id){if(id===undefined){throw new Error('Missing required parameter: "id"');} -let path='/auth/logout/{id}'.replace(new RegExp('{id}','g'),id);let payload={};return http.delete(path,{'content-type':'application/json'},payload);},oauth:function(provider,success='',failure=''){if(provider===undefined){throw new Error('Missing required parameter: "provider"');} -let path='/auth/oauth/{provider}'.replace(new RegExp('{provider}','g'),provider);let payload={};if(success){payload['success']=success;} -if(failure){payload['failure']=failure;} -return http.get(path,{'content-type':'application/json'},payload);},recovery:function(email,reset){if(email===undefined){throw new Error('Missing required parameter: "email"');} -if(reset===undefined){throw new Error('Missing required parameter: "reset"');} -let path='/auth/recovery';let payload={};if(email){payload['email']=email;} -if(reset){payload['reset']=reset;} -return http.post(path,{'content-type':'application/json'},payload);},recoveryReset:function(userId,token,passwordA,passwordB){if(userId===undefined){throw new Error('Missing required parameter: "userId"');} -if(token===undefined){throw new Error('Missing required parameter: "token"');} +return http.patch(path,{'content-type':'application/json',},payload);},createRecovery:function(email,url){if(email===undefined){throw new Error('Missing required parameter: "email"');} +if(url===undefined){throw new Error('Missing required parameter: "url"');} +let path='/account/recovery';let payload={};if(email){payload['email']=email;} +if(url){payload['url']=url;} +return http.post(path,{'content-type':'application/json',},payload);},updateRecovery:function(userId,secret,passwordA,passwordB){if(userId===undefined){throw new Error('Missing required parameter: "userId"');} +if(secret===undefined){throw new Error('Missing required parameter: "secret"');} if(passwordA===undefined){throw new Error('Missing required parameter: "passwordA"');} if(passwordB===undefined){throw new Error('Missing required parameter: "passwordB"');} -let path='/auth/recovery/reset';let payload={};if(userId){payload['userId']=userId;} -if(token){payload['token']=token;} +let path='/account/recovery';let payload={};if(userId){payload['userId']=userId;} +if(secret){payload['secret']=secret;} if(passwordA){payload['password-a']=passwordA;} if(passwordB){payload['password-b']=passwordB;} -return http.put(path,{'content-type':'application/json'},payload);},register:function(email,password,confirm,success='',failure='',name=''){if(email===undefined){throw new Error('Missing required parameter: "email"');} +return http.put(path,{'content-type':'application/json',},payload);},getSessions:function(){let path='/account/sessions';let payload={};return http.get(path,{'content-type':'application/json',},payload);},createSession:function(email,password){if(email===undefined){throw new Error('Missing required parameter: "email"');} if(password===undefined){throw new Error('Missing required parameter: "password"');} -if(confirm===undefined){throw new Error('Missing required parameter: "confirm"');} -let path='/auth/register';let payload={};if(email){payload['email']=email;} +let path='/account/sessions';let payload={};if(email){payload['email']=email;} if(password){payload['password']=password;} -if(confirm){payload['confirm']=confirm;} -if(success){payload['success']=success;} +return http.post(path,{'content-type':'application/json',},payload);},deleteSessions:function(){let path='/account/sessions';let payload={};return http.delete(path,{'content-type':'application/json',},payload);},deleteCurrentSession:function(){let path='/account/sessions/current';let payload={};return http.delete(path,{'content-type':'application/json',},payload);},createOAuthSession:function(provider,success,failure){if(provider===undefined){throw new Error('Missing required parameter: "provider"');} +if(success===undefined){throw new Error('Missing required parameter: "success"');} +if(failure===undefined){throw new Error('Missing required parameter: "failure"');} +let path='/account/sessions/oauth/{provider}'.replace(new RegExp('{provider}','g'),provider);let payload={};if(success){payload['success']=success;} if(failure){payload['failure']=failure;} -if(name){payload['name']=name;} -payload['project']=config.project;return iframe('post',path,payload);},confirm:function(userId,token){if(userId===undefined){throw new Error('Missing required parameter: "userId"');} -if(token===undefined){throw new Error('Missing required parameter: "token"');} -let path='/auth/register/confirm';let payload={};if(userId){payload['userId']=userId;} -if(token){payload['token']=token;} -return http.post(path,{'content-type':'application/json'},payload);},confirmResend:function(confirm){if(confirm===undefined){throw new Error('Missing required parameter: "confirm"');} -let path='/auth/register/confirm/resend';let payload={};if(confirm){payload['confirm']=confirm;} -return http.post(path,{'content-type':'application/json'},payload);}};let avatars={getBrowser:function(code,width=100,height=100,quality=100){if(code===undefined){throw new Error('Missing required parameter: "code"');} +return http.get(path,{'content-type':'application/json',},payload);},deleteSession:function(id){if(id===undefined){throw new Error('Missing required parameter: "id"');} +let path='/account/sessions/{id}'.replace(new RegExp('{id}','g'),id);let payload={};return http.delete(path,{'content-type':'application/json',},payload);},createVerification:function(url){if(url===undefined){throw new Error('Missing required parameter: "url"');} +let path='/account/verification';let payload={};if(url){payload['url']=url;} +return http.post(path,{'content-type':'application/json',},payload);},updateVerification:function(userId,secret,passwordB){if(userId===undefined){throw new Error('Missing required parameter: "userId"');} +if(secret===undefined){throw new Error('Missing required parameter: "secret"');} +if(passwordB===undefined){throw new Error('Missing required parameter: "passwordB"');} +let path='/account/verification';let payload={};if(userId){payload['userId']=userId;} +if(secret){payload['secret']=secret;} +if(passwordB){payload['password-b']=passwordB;} +return http.put(path,{'content-type':'application/json',},payload);}};let avatars={getBrowser:function(code,width=100,height=100,quality=100){if(code===undefined){throw new Error('Missing required parameter: "code"');} let path='/avatars/browsers/{code}'.replace(new RegExp('{code}','g'),code);let payload={};if(width){payload['width']=width;} if(height){payload['height']=height;} if(quality){payload['quality']=quality;} -return http.get(path,{'content-type':'application/json'},payload);},getCreditCard:function(code,width=100,height=100,quality=100){if(code===undefined){throw new Error('Missing required parameter: "code"');} +return http.get(path,{'content-type':'application/json',},payload);},getCreditCard:function(code,width=100,height=100,quality=100){if(code===undefined){throw new Error('Missing required parameter: "code"');} let path='/avatars/credit-cards/{code}'.replace(new RegExp('{code}','g'),code);let payload={};if(width){payload['width']=width;} if(height){payload['height']=height;} if(quality){payload['quality']=quality;} -return http.get(path,{'content-type':'application/json'},payload);},getFavicon:function(url){if(url===undefined){throw new Error('Missing required parameter: "url"');} +return http.get(path,{'content-type':'application/json',},payload);},getFavicon:function(url){if(url===undefined){throw new Error('Missing required parameter: "url"');} let path='/avatars/favicon';let payload={};if(url){payload['url']=url;} -return http.get(path,{'content-type':'application/json'},payload);},getFlag:function(code,width=100,height=100,quality=100){if(code===undefined){throw new Error('Missing required parameter: "code"');} +return http.get(path,{'content-type':'application/json',},payload);},getFlag:function(code,width=100,height=100,quality=100){if(code===undefined){throw new Error('Missing required parameter: "code"');} let path='/avatars/flags/{code}'.replace(new RegExp('{code}','g'),code);let payload={};if(width){payload['width']=width;} if(height){payload['height']=height;} if(quality){payload['quality']=quality;} -return http.get(path,{'content-type':'application/json'},payload);},getImage:function(url,width=400,height=400){if(url===undefined){throw new Error('Missing required parameter: "url"');} +return http.get(path,{'content-type':'application/json',},payload);},getImage:function(url,width=400,height=400){if(url===undefined){throw new Error('Missing required parameter: "url"');} let path='/avatars/image';let payload={};if(url){payload['url']=url;} if(width){payload['width']=width;} if(height){payload['height']=height;} -return http.get(path,{'content-type':'application/json'},payload);},getQR:function(text,size=400,margin=1,download=0){if(text===undefined){throw new Error('Missing required parameter: "text"');} +return http.get(path,{'content-type':'application/json',},payload);},getQR:function(text,size=400,margin=1,download=0){if(text===undefined){throw new Error('Missing required parameter: "text"');} let path='/avatars/qr';let payload={};if(text){payload['text']=text;} if(size){payload['size']=size;} if(margin){payload['margin']=margin;} if(download){payload['download']=download;} -return http.get(path,{'content-type':'application/json'},payload);}};let database={listCollections:function(search='',limit=25,offset=0,orderType='ASC'){let path='/database';let payload={};if(search){payload['search']=search;} +return http.get(path,{'content-type':'application/json',},payload);}};let database={listCollections:function(search='',limit=25,offset=0,orderType='ASC'){let path='/database/collections';let payload={};if(search){payload['search']=search;} if(limit){payload['limit']=limit;} if(offset){payload['offset']=offset;} if(orderType){payload['orderType']=orderType;} -return http.get(path,{'content-type':'application/json'},payload);},createCollection:function(name,read=[],write=[],rules=[]){if(name===undefined){throw new Error('Missing required parameter: "name"');} -let path='/database';let payload={};if(name){payload['name']=name;} +return http.get(path,{'content-type':'application/json',},payload);},createCollection:function(name,read,write,rules){if(name===undefined){throw new Error('Missing required parameter: "name"');} +if(read===undefined){throw new Error('Missing required parameter: "read"');} +if(write===undefined){throw new Error('Missing required parameter: "write"');} +if(rules===undefined){throw new Error('Missing required parameter: "rules"');} +let path='/database/collections';let payload={};if(name){payload['name']=name;} if(read){payload['read']=read;} if(write){payload['write']=write;} if(rules){payload['rules']=rules;} -return http.post(path,{'content-type':'application/json'},payload);},getCollection:function(collectionId){if(collectionId===undefined){throw new Error('Missing required parameter: "collectionId"');} -let path='/database/{collectionId}'.replace(new RegExp('{collectionId}','g'),collectionId);let payload={};return http.get(path,{'content-type':'application/json'},payload);},updateCollection:function(collectionId,name,read=[],write=[],rules=[]){if(collectionId===undefined){throw new Error('Missing required parameter: "collectionId"');} +return http.post(path,{'content-type':'application/json',},payload);},getCollection:function(collectionId){if(collectionId===undefined){throw new Error('Missing required parameter: "collectionId"');} +let path='/database/collections/{collectionId}'.replace(new RegExp('{collectionId}','g'),collectionId);let payload={};return http.get(path,{'content-type':'application/json',},payload);},updateCollection:function(collectionId,name,read,write,rules=[]){if(collectionId===undefined){throw new Error('Missing required parameter: "collectionId"');} if(name===undefined){throw new Error('Missing required parameter: "name"');} -let path='/database/{collectionId}'.replace(new RegExp('{collectionId}','g'),collectionId);let payload={};if(name){payload['name']=name;} +if(read===undefined){throw new Error('Missing required parameter: "read"');} +if(write===undefined){throw new Error('Missing required parameter: "write"');} +let path='/database/collections/{collectionId}'.replace(new RegExp('{collectionId}','g'),collectionId);let payload={};if(name){payload['name']=name;} if(read){payload['read']=read;} if(write){payload['write']=write;} if(rules){payload['rules']=rules;} -return http.put(path,{'content-type':'application/json'},payload);},deleteCollection:function(collectionId){if(collectionId===undefined){throw new Error('Missing required parameter: "collectionId"');} -let path='/database/{collectionId}'.replace(new RegExp('{collectionId}','g'),collectionId);let payload={};return http.delete(path,{'content-type':'application/json'},payload);},listDocuments:function(collectionId,filters=[],offset=0,limit=50,orderField='$uid',orderType='ASC',orderCast='string',search='',first=0,last=0){if(collectionId===undefined){throw new Error('Missing required parameter: "collectionId"');} -let path='/database/{collectionId}/documents'.replace(new RegExp('{collectionId}','g'),collectionId);let payload={};if(filters){payload['filters']=filters;} +return http.put(path,{'content-type':'application/json',},payload);},deleteCollection:function(collectionId){if(collectionId===undefined){throw new Error('Missing required parameter: "collectionId"');} +let path='/database/collections/{collectionId}'.replace(new RegExp('{collectionId}','g'),collectionId);let payload={};return http.delete(path,{'content-type':'application/json',},payload);},listDocuments:function(collectionId,filters=[],offset=0,limit=50,orderField='$uid',orderType='ASC',orderCast='string',search='',first=0,last=0){if(collectionId===undefined){throw new Error('Missing required parameter: "collectionId"');} +let path='/database/collections/{collectionId}/documents'.replace(new RegExp('{collectionId}','g'),collectionId);let payload={};if(filters){payload['filters']=filters;} if(offset){payload['offset']=offset;} if(limit){payload['limit']=limit;} if(orderField){payload['order-field']=orderField;} @@ -118,25 +119,29 @@ if(orderCast){payload['order-cast']=orderCast;} if(search){payload['search']=search;} if(first){payload['first']=first;} if(last){payload['last']=last;} -return http.get(path,{'content-type':'application/json'},payload);},createDocument:function(collectionId,data,read=[],write=[],parentDocument='',parentProperty='',parentPropertyType='assign'){if(collectionId===undefined){throw new Error('Missing required parameter: "collectionId"');} +return http.get(path,{'content-type':'application/json',},payload);},createDocument:function(collectionId,data,read,write,parentDocument='',parentProperty='',parentPropertyType='assign'){if(collectionId===undefined){throw new Error('Missing required parameter: "collectionId"');} if(data===undefined){throw new Error('Missing required parameter: "data"');} -let path='/database/{collectionId}/documents'.replace(new RegExp('{collectionId}','g'),collectionId);let payload={};if(data){payload['data']=data;} +if(read===undefined){throw new Error('Missing required parameter: "read"');} +if(write===undefined){throw new Error('Missing required parameter: "write"');} +let path='/database/collections/{collectionId}/documents'.replace(new RegExp('{collectionId}','g'),collectionId);let payload={};if(data){payload['data']=data;} if(read){payload['read']=read;} if(write){payload['write']=write;} if(parentDocument){payload['parentDocument']=parentDocument;} if(parentProperty){payload['parentProperty']=parentProperty;} if(parentPropertyType){payload['parentPropertyType']=parentPropertyType;} -return http.post(path,{'content-type':'application/json'},payload);},getDocument:function(collectionId,documentId){if(collectionId===undefined){throw new Error('Missing required parameter: "collectionId"');} +return http.post(path,{'content-type':'application/json',},payload);},getDocument:function(collectionId,documentId){if(collectionId===undefined){throw new Error('Missing required parameter: "collectionId"');} if(documentId===undefined){throw new Error('Missing required parameter: "documentId"');} -let path='/database/{collectionId}/documents/{documentId}'.replace(new RegExp('{collectionId}','g'),collectionId).replace(new RegExp('{documentId}','g'),documentId);let payload={};return http.get(path,{'content-type':'application/json'},payload);},updateDocument:function(collectionId,documentId,data,read=[],write=[]){if(collectionId===undefined){throw new Error('Missing required parameter: "collectionId"');} +let path='/database/collections/{collectionId}/documents/{documentId}'.replace(new RegExp('{collectionId}','g'),collectionId).replace(new RegExp('{documentId}','g'),documentId);let payload={};return http.get(path,{'content-type':'application/json',},payload);},updateDocument:function(collectionId,documentId,data,read,write){if(collectionId===undefined){throw new Error('Missing required parameter: "collectionId"');} if(documentId===undefined){throw new Error('Missing required parameter: "documentId"');} if(data===undefined){throw new Error('Missing required parameter: "data"');} -let path='/database/{collectionId}/documents/{documentId}'.replace(new RegExp('{collectionId}','g'),collectionId).replace(new RegExp('{documentId}','g'),documentId);let payload={};if(data){payload['data']=data;} +if(read===undefined){throw new Error('Missing required parameter: "read"');} +if(write===undefined){throw new Error('Missing required parameter: "write"');} +let path='/database/collections/{collectionId}/documents/{documentId}'.replace(new RegExp('{collectionId}','g'),collectionId).replace(new RegExp('{documentId}','g'),documentId);let payload={};if(data){payload['data']=data;} if(read){payload['read']=read;} if(write){payload['write']=write;} -return http.patch(path,{'content-type':'application/json'},payload);},deleteDocument:function(collectionId,documentId){if(collectionId===undefined){throw new Error('Missing required parameter: "collectionId"');} +return http.patch(path,{'content-type':'application/json',},payload);},deleteDocument:function(collectionId,documentId){if(collectionId===undefined){throw new Error('Missing required parameter: "collectionId"');} if(documentId===undefined){throw new Error('Missing required parameter: "documentId"');} -let path='/database/{collectionId}/documents/{documentId}'.replace(new RegExp('{collectionId}','g'),collectionId).replace(new RegExp('{documentId}','g'),documentId);let payload={};return http.delete(path,{'content-type':'application/json'},payload);}};let locale={getLocale:function(){let path='/locale';let payload={};return http.get(path,{'content-type':'application/json'},payload);},getCountries:function(){let path='/locale/countries';let payload={};return http.get(path,{'content-type':'application/json'},payload);},getCountriesEU:function(){let path='/locale/countries/eu';let payload={};return http.get(path,{'content-type':'application/json'},payload);},getCountriesPhones:function(){let path='/locale/countries/phones';let payload={};return http.get(path,{'content-type':'application/json'},payload);},getCurrencies:function(){let path='/locale/currencies';let payload={};return http.get(path,{'content-type':'application/json'},payload);}};let projects={listProjects:function(){let path='/projects';let payload={};return http.get(path,{'content-type':'application/json'},payload);},createProject:function(name,teamId,description='',logo='',url='',legalName='',legalCountry='',legalState='',legalCity='',legalAddress='',legalTaxId=''){if(name===undefined){throw new Error('Missing required parameter: "name"');} +let path='/database/collections/{collectionId}/documents/{documentId}'.replace(new RegExp('{collectionId}','g'),collectionId).replace(new RegExp('{documentId}','g'),documentId);let payload={};return http.delete(path,{'content-type':'application/json',},payload);}};let locale={get:function(){let path='/locale';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getContinents:function(){let path='/locale/continents';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getCountries:function(){let path='/locale/countries';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getCountriesEU:function(){let path='/locale/countries/eu';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getCountriesPhones:function(){let path='/locale/countries/phones';let payload={};return http.get(path,{'content-type':'application/json',},payload);},getCurrencies:function(){let path='/locale/currencies';let payload={};return http.get(path,{'content-type':'application/json',},payload);}};let projects={list:function(){let path='/projects';let payload={};return http.get(path,{'content-type':'application/json',},payload);},create:function(name,teamId,description='',logo='',url='',legalName='',legalCountry='',legalState='',legalCity='',legalAddress='',legalTaxId=''){if(name===undefined){throw new Error('Missing required parameter: "name"');} if(teamId===undefined){throw new Error('Missing required parameter: "teamId"');} let path='/projects';let payload={};if(name){payload['name']=name;} if(teamId){payload['teamId']=teamId;} @@ -149,8 +154,8 @@ if(legalState){payload['legalState']=legalState;} if(legalCity){payload['legalCity']=legalCity;} if(legalAddress){payload['legalAddress']=legalAddress;} if(legalTaxId){payload['legalTaxId']=legalTaxId;} -return http.post(path,{'content-type':'application/json'},payload);},getProject:function(projectId){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} -let path='/projects/{projectId}'.replace(new RegExp('{projectId}','g'),projectId);let payload={};return http.get(path,{'content-type':'application/json'},payload);},updateProject:function(projectId,name,description='',logo='',url='',legalName='',legalCountry='',legalState='',legalCity='',legalAddress='',legalTaxId=''){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} +return http.post(path,{'content-type':'application/json',},payload);},get:function(projectId){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} +let path='/projects/{projectId}'.replace(new RegExp('{projectId}','g'),projectId);let payload={};return http.get(path,{'content-type':'application/json',},payload);},update:function(projectId,name,description='',logo='',url='',legalName='',legalCountry='',legalState='',legalCity='',legalAddress='',legalTaxId=''){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} if(name===undefined){throw new Error('Missing required parameter: "name"');} let path='/projects/{projectId}'.replace(new RegExp('{projectId}','g'),projectId);let payload={};if(name){payload['name']=name;} if(description){payload['description']=description;} @@ -162,30 +167,30 @@ if(legalState){payload['legalState']=legalState;} if(legalCity){payload['legalCity']=legalCity;} if(legalAddress){payload['legalAddress']=legalAddress;} if(legalTaxId){payload['legalTaxId']=legalTaxId;} -return http.patch(path,{'content-type':'application/json'},payload);},deleteProject:function(projectId){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} -let path='/projects/{projectId}'.replace(new RegExp('{projectId}','g'),projectId);let payload={};return http.delete(path,{'content-type':'application/json'},payload);},listKeys:function(projectId){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} -let path='/projects/{projectId}/keys'.replace(new RegExp('{projectId}','g'),projectId);let payload={};return http.get(path,{'content-type':'application/json'},payload);},createKey:function(projectId,name,scopes){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} +return http.patch(path,{'content-type':'application/json',},payload);},delete:function(projectId){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} +let path='/projects/{projectId}'.replace(new RegExp('{projectId}','g'),projectId);let payload={};return http.delete(path,{'content-type':'application/json',},payload);},listKeys:function(projectId){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} +let path='/projects/{projectId}/keys'.replace(new RegExp('{projectId}','g'),projectId);let payload={};return http.get(path,{'content-type':'application/json',},payload);},createKey:function(projectId,name,scopes){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} if(name===undefined){throw new Error('Missing required parameter: "name"');} if(scopes===undefined){throw new Error('Missing required parameter: "scopes"');} let path='/projects/{projectId}/keys'.replace(new RegExp('{projectId}','g'),projectId);let payload={};if(name){payload['name']=name;} if(scopes){payload['scopes']=scopes;} -return http.post(path,{'content-type':'application/json'},payload);},getKey:function(projectId,keyId){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} +return http.post(path,{'content-type':'application/json',},payload);},getKey:function(projectId,keyId){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} if(keyId===undefined){throw new Error('Missing required parameter: "keyId"');} -let path='/projects/{projectId}/keys/{keyId}'.replace(new RegExp('{projectId}','g'),projectId).replace(new RegExp('{keyId}','g'),keyId);let payload={};return http.get(path,{'content-type':'application/json'},payload);},updateKey:function(projectId,keyId,name,scopes){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} +let path='/projects/{projectId}/keys/{keyId}'.replace(new RegExp('{projectId}','g'),projectId).replace(new RegExp('{keyId}','g'),keyId);let payload={};return http.get(path,{'content-type':'application/json',},payload);},updateKey:function(projectId,keyId,name,scopes){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} if(keyId===undefined){throw new Error('Missing required parameter: "keyId"');} if(name===undefined){throw new Error('Missing required parameter: "name"');} if(scopes===undefined){throw new Error('Missing required parameter: "scopes"');} let path='/projects/{projectId}/keys/{keyId}'.replace(new RegExp('{projectId}','g'),projectId).replace(new RegExp('{keyId}','g'),keyId);let payload={};if(name){payload['name']=name;} if(scopes){payload['scopes']=scopes;} -return http.put(path,{'content-type':'application/json'},payload);},deleteKey:function(projectId,keyId){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} +return http.put(path,{'content-type':'application/json',},payload);},deleteKey:function(projectId,keyId){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} if(keyId===undefined){throw new Error('Missing required parameter: "keyId"');} -let path='/projects/{projectId}/keys/{keyId}'.replace(new RegExp('{projectId}','g'),projectId).replace(new RegExp('{keyId}','g'),keyId);let payload={};return http.delete(path,{'content-type':'application/json'},payload);},updateProjectOAuth:function(projectId,provider,appId='',secret=''){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} +let path='/projects/{projectId}/keys/{keyId}'.replace(new RegExp('{projectId}','g'),projectId).replace(new RegExp('{keyId}','g'),keyId);let payload={};return http.delete(path,{'content-type':'application/json',},payload);},updateOAuth:function(projectId,provider,appId='',secret=''){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} if(provider===undefined){throw new Error('Missing required parameter: "provider"');} let path='/projects/{projectId}/oauth'.replace(new RegExp('{projectId}','g'),projectId);let payload={};if(provider){payload['provider']=provider;} if(appId){payload['appId']=appId;} if(secret){payload['secret']=secret;} -return http.patch(path,{'content-type':'application/json'},payload);},listPlatforms:function(projectId){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} -let path='/projects/{projectId}/platforms'.replace(new RegExp('{projectId}','g'),projectId);let payload={};return http.get(path,{'content-type':'application/json'},payload);},createPlatform:function(projectId,type,name,key='',store='',url=''){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} +return http.patch(path,{'content-type':'application/json',},payload);},listPlatforms:function(projectId){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} +let path='/projects/{projectId}/platforms'.replace(new RegExp('{projectId}','g'),projectId);let payload={};return http.get(path,{'content-type':'application/json',},payload);},createPlatform:function(projectId,type,name,key='',store='',url=''){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} if(type===undefined){throw new Error('Missing required parameter: "type"');} if(name===undefined){throw new Error('Missing required parameter: "name"');} let path='/projects/{projectId}/platforms'.replace(new RegExp('{projectId}','g'),projectId);let payload={};if(type){payload['type']=type;} @@ -193,19 +198,19 @@ if(name){payload['name']=name;} if(key){payload['key']=key;} if(store){payload['store']=store;} if(url){payload['url']=url;} -return http.post(path,{'content-type':'application/json'},payload);},getPlatform:function(projectId,platformId){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} +return http.post(path,{'content-type':'application/json',},payload);},getPlatform:function(projectId,platformId){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} if(platformId===undefined){throw new Error('Missing required parameter: "platformId"');} -let path='/projects/{projectId}/platforms/{platformId}'.replace(new RegExp('{projectId}','g'),projectId).replace(new RegExp('{platformId}','g'),platformId);let payload={};return http.get(path,{'content-type':'application/json'},payload);},updatePlatform:function(projectId,platformId,name,key='',store='',url=''){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} +let path='/projects/{projectId}/platforms/{platformId}'.replace(new RegExp('{projectId}','g'),projectId).replace(new RegExp('{platformId}','g'),platformId);let payload={};return http.get(path,{'content-type':'application/json',},payload);},updatePlatform:function(projectId,platformId,name,key='',store='',url=''){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} if(platformId===undefined){throw new Error('Missing required parameter: "platformId"');} if(name===undefined){throw new Error('Missing required parameter: "name"');} let path='/projects/{projectId}/platforms/{platformId}'.replace(new RegExp('{projectId}','g'),projectId).replace(new RegExp('{platformId}','g'),platformId);let payload={};if(name){payload['name']=name;} if(key){payload['key']=key;} if(store){payload['store']=store;} if(url){payload['url']=url;} -return http.put(path,{'content-type':'application/json'},payload);},deletePlatform:function(projectId,platformId){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} +return http.put(path,{'content-type':'application/json',},payload);},deletePlatform:function(projectId,platformId){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} if(platformId===undefined){throw new Error('Missing required parameter: "platformId"');} -let path='/projects/{projectId}/platforms/{platformId}'.replace(new RegExp('{projectId}','g'),projectId).replace(new RegExp('{platformId}','g'),platformId);let payload={};return http.delete(path,{'content-type':'application/json'},payload);},listTasks:function(projectId){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} -let path='/projects/{projectId}/tasks'.replace(new RegExp('{projectId}','g'),projectId);let payload={};return http.get(path,{'content-type':'application/json'},payload);},createTask:function(projectId,name,status,schedule,security,httpMethod,httpUrl,httpHeaders=[],httpUser='',httpPass=''){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} +let path='/projects/{projectId}/platforms/{platformId}'.replace(new RegExp('{projectId}','g'),projectId).replace(new RegExp('{platformId}','g'),platformId);let payload={};return http.delete(path,{'content-type':'application/json',},payload);},listTasks:function(projectId){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} +let path='/projects/{projectId}/tasks'.replace(new RegExp('{projectId}','g'),projectId);let payload={};return http.get(path,{'content-type':'application/json',},payload);},createTask:function(projectId,name,status,schedule,security,httpMethod,httpUrl,httpHeaders=[],httpUser='',httpPass=''){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} if(name===undefined){throw new Error('Missing required parameter: "name"');} if(status===undefined){throw new Error('Missing required parameter: "status"');} if(schedule===undefined){throw new Error('Missing required parameter: "schedule"');} @@ -221,9 +226,9 @@ if(httpUrl){payload['httpUrl']=httpUrl;} if(httpHeaders){payload['httpHeaders']=httpHeaders;} if(httpUser){payload['httpUser']=httpUser;} if(httpPass){payload['httpPass']=httpPass;} -return http.post(path,{'content-type':'application/json'},payload);},getTask:function(projectId,taskId){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} +return http.post(path,{'content-type':'application/json',},payload);},getTask:function(projectId,taskId){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} if(taskId===undefined){throw new Error('Missing required parameter: "taskId"');} -let path='/projects/{projectId}/tasks/{taskId}'.replace(new RegExp('{projectId}','g'),projectId).replace(new RegExp('{taskId}','g'),taskId);let payload={};return http.get(path,{'content-type':'application/json'},payload);},updateTask:function(projectId,taskId,name,status,schedule,security,httpMethod,httpUrl,httpHeaders=[],httpUser='',httpPass=''){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} +let path='/projects/{projectId}/tasks/{taskId}'.replace(new RegExp('{projectId}','g'),projectId).replace(new RegExp('{taskId}','g'),taskId);let payload={};return http.get(path,{'content-type':'application/json',},payload);},updateTask:function(projectId,taskId,name,status,schedule,security,httpMethod,httpUrl,httpHeaders=[],httpUser='',httpPass=''){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} if(taskId===undefined){throw new Error('Missing required parameter: "taskId"');} if(name===undefined){throw new Error('Missing required parameter: "name"');} if(status===undefined){throw new Error('Missing required parameter: "status"');} @@ -240,11 +245,11 @@ if(httpUrl){payload['httpUrl']=httpUrl;} if(httpHeaders){payload['httpHeaders']=httpHeaders;} if(httpUser){payload['httpUser']=httpUser;} if(httpPass){payload['httpPass']=httpPass;} -return http.put(path,{'content-type':'application/json'},payload);},deleteTask:function(projectId,taskId){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} +return http.put(path,{'content-type':'application/json',},payload);},deleteTask:function(projectId,taskId){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} if(taskId===undefined){throw new Error('Missing required parameter: "taskId"');} -let path='/projects/{projectId}/tasks/{taskId}'.replace(new RegExp('{projectId}','g'),projectId).replace(new RegExp('{taskId}','g'),taskId);let payload={};return http.delete(path,{'content-type':'application/json'},payload);},getProjectUsage:function(projectId){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} -let path='/projects/{projectId}/usage'.replace(new RegExp('{projectId}','g'),projectId);let payload={};return http.get(path,{'content-type':'application/json'},payload);},listWebhooks:function(projectId){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} -let path='/projects/{projectId}/webhooks'.replace(new RegExp('{projectId}','g'),projectId);let payload={};return http.get(path,{'content-type':'application/json'},payload);},createWebhook:function(projectId,name,events,url,security,httpUser='',httpPass=''){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} +let path='/projects/{projectId}/tasks/{taskId}'.replace(new RegExp('{projectId}','g'),projectId).replace(new RegExp('{taskId}','g'),taskId);let payload={};return http.delete(path,{'content-type':'application/json',},payload);},getUsage:function(projectId){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} +let path='/projects/{projectId}/usage'.replace(new RegExp('{projectId}','g'),projectId);let payload={};return http.get(path,{'content-type':'application/json',},payload);},listWebhooks:function(projectId){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} +let path='/projects/{projectId}/webhooks'.replace(new RegExp('{projectId}','g'),projectId);let payload={};return http.get(path,{'content-type':'application/json',},payload);},createWebhook:function(projectId,name,events,url,security,httpUser='',httpPass=''){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} if(name===undefined){throw new Error('Missing required parameter: "name"');} if(events===undefined){throw new Error('Missing required parameter: "events"');} if(url===undefined){throw new Error('Missing required parameter: "url"');} @@ -255,9 +260,9 @@ if(url){payload['url']=url;} if(security){payload['security']=security;} if(httpUser){payload['httpUser']=httpUser;} if(httpPass){payload['httpPass']=httpPass;} -return http.post(path,{'content-type':'application/json'},payload);},getWebhook:function(projectId,webhookId){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} +return http.post(path,{'content-type':'application/json',},payload);},getWebhook:function(projectId,webhookId){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} if(webhookId===undefined){throw new Error('Missing required parameter: "webhookId"');} -let path='/projects/{projectId}/webhooks/{webhookId}'.replace(new RegExp('{projectId}','g'),projectId).replace(new RegExp('{webhookId}','g'),webhookId);let payload={};return http.get(path,{'content-type':'application/json'},payload);},updateWebhook:function(projectId,webhookId,name,events,url,security,httpUser='',httpPass=''){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} +let path='/projects/{projectId}/webhooks/{webhookId}'.replace(new RegExp('{projectId}','g'),projectId).replace(new RegExp('{webhookId}','g'),webhookId);let payload={};return http.get(path,{'content-type':'application/json',},payload);},updateWebhook:function(projectId,webhookId,name,events,url,security,httpUser='',httpPass=''){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} if(webhookId===undefined){throw new Error('Missing required parameter: "webhookId"');} if(name===undefined){throw new Error('Missing required parameter: "name"');} if(events===undefined){throw new Error('Missing required parameter: "events"');} @@ -269,91 +274,87 @@ if(url){payload['url']=url;} if(security){payload['security']=security;} if(httpUser){payload['httpUser']=httpUser;} if(httpPass){payload['httpPass']=httpPass;} -return http.put(path,{'content-type':'application/json'},payload);},deleteWebhook:function(projectId,webhookId){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} +return http.put(path,{'content-type':'application/json',},payload);},deleteWebhook:function(projectId,webhookId){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"');} if(webhookId===undefined){throw new Error('Missing required parameter: "webhookId"');} -let path='/projects/{projectId}/webhooks/{webhookId}'.replace(new RegExp('{projectId}','g'),projectId).replace(new RegExp('{webhookId}','g'),webhookId);let payload={};return http.delete(path,{'content-type':'application/json'},payload);}};let storage={listFiles:function(search='',limit=25,offset=0,orderType='ASC'){let path='/storage/files';let payload={};if(search){payload['search']=search;} +let path='/projects/{projectId}/webhooks/{webhookId}'.replace(new RegExp('{projectId}','g'),projectId).replace(new RegExp('{webhookId}','g'),webhookId);let payload={};return http.delete(path,{'content-type':'application/json',},payload);}};let storage={list:function(search='',limit=25,offset=0,orderType='ASC'){let path='/storage/files';let payload={};if(search){payload['search']=search;} if(limit){payload['limit']=limit;} if(offset){payload['offset']=offset;} if(orderType){payload['orderType']=orderType;} -return http.get(path,{'content-type':'application/json'},payload);},createFile:function(files,read=[],write=[],folderId=''){if(files===undefined){throw new Error('Missing required parameter: "files"');} -let path='/storage/files';let payload={};if(files){payload['files']=files;} +return http.get(path,{'content-type':'application/json',},payload);},create:function(file,read,write){if(file===undefined){throw new Error('Missing required parameter: "file"');} +if(read===undefined){throw new Error('Missing required parameter: "read"');} +if(write===undefined){throw new Error('Missing required parameter: "write"');} +let path='/storage/files';let payload={};if(file){payload['file']=file;} if(read){payload['read']=read;} if(write){payload['write']=write;} -if(folderId){payload['folderId']=folderId;} -return http.post(path,{'content-type':'multipart/form-data'},payload);},getFile:function(fileId){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"');} -let path='/storage/files/{fileId}'.replace(new RegExp('{fileId}','g'),fileId);let payload={};return http.get(path,{'content-type':'application/json'},payload);},updateFile:function(fileId,read=[],write=[],folderId=''){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"');} +return http.post(path,{'content-type':'multipart/form-data',},payload);},get:function(fileId){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"');} +let path='/storage/files/{fileId}'.replace(new RegExp('{fileId}','g'),fileId);let payload={};return http.get(path,{'content-type':'application/json',},payload);},update:function(fileId,read,write){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"');} +if(read===undefined){throw new Error('Missing required parameter: "read"');} +if(write===undefined){throw new Error('Missing required parameter: "write"');} let path='/storage/files/{fileId}'.replace(new RegExp('{fileId}','g'),fileId);let payload={};if(read){payload['read']=read;} if(write){payload['write']=write;} -if(folderId){payload['folderId']=folderId;} -return http.put(path,{'content-type':'application/json'},payload);},deleteFile:function(fileId){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"');} -let path='/storage/files/{fileId}'.replace(new RegExp('{fileId}','g'),fileId);let payload={};return http.delete(path,{'content-type':'application/json'},payload);},getFileDownload:function(fileId){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"');} -let path='/storage/files/{fileId}/download'.replace(new RegExp('{fileId}','g'),fileId);let payload={};return http.get(path,{'content-type':'application/json'},payload);},getFilePreview:function(fileId,width=0,height=0,quality=100,background='',output=''){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"');} +return http.put(path,{'content-type':'application/json',},payload);},delete:function(fileId){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"');} +let path='/storage/files/{fileId}'.replace(new RegExp('{fileId}','g'),fileId);let payload={};return http.delete(path,{'content-type':'application/json',},payload);},getDownload:function(fileId){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"');} +let path='/storage/files/{fileId}/download'.replace(new RegExp('{fileId}','g'),fileId);let payload={};return http.get(path,{'content-type':'application/json',},payload);},getPreview:function(fileId,width=0,height=0,quality=100,background='',output=''){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"');} let path='/storage/files/{fileId}/preview'.replace(new RegExp('{fileId}','g'),fileId);let payload={};if(width){payload['width']=width;} if(height){payload['height']=height;} if(quality){payload['quality']=quality;} if(background){payload['background']=background;} if(output){payload['output']=output;} -return http.get(path,{'content-type':'application/json'},payload);},getFileView:function(fileId,as=''){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"');} +return http.get(path,{'content-type':'application/json',},payload);},getView:function(fileId,as=''){if(fileId===undefined){throw new Error('Missing required parameter: "fileId"');} let path='/storage/files/{fileId}/view'.replace(new RegExp('{fileId}','g'),fileId);let payload={};if(as){payload['as']=as;} -return http.get(path,{'content-type':'application/json'},payload);}};let teams={listTeams:function(search='',limit=25,offset=0,orderType='ASC'){let path='/teams';let payload={};if(search){payload['search']=search;} +return http.get(path,{'content-type':'application/json',},payload);}};let teams={list:function(search='',limit=25,offset=0,orderType='ASC'){let path='/teams';let payload={};if(search){payload['search']=search;} if(limit){payload['limit']=limit;} if(offset){payload['offset']=offset;} if(orderType){payload['orderType']=orderType;} -return http.get(path,{'content-type':'application/json'},payload);},createTeam:function(name,roles=["owner"]){if(name===undefined){throw new Error('Missing required parameter: "name"');} +return http.get(path,{'content-type':'application/json',},payload);},create:function(name,roles=["owner"]){if(name===undefined){throw new Error('Missing required parameter: "name"');} let path='/teams';let payload={};if(name){payload['name']=name;} if(roles){payload['roles']=roles;} -return http.post(path,{'content-type':'application/json'},payload);},getTeam:function(teamId){if(teamId===undefined){throw new Error('Missing required parameter: "teamId"');} -let path='/teams/{teamId}'.replace(new RegExp('{teamId}','g'),teamId);let payload={};return http.get(path,{'content-type':'application/json'},payload);},updateTeam:function(teamId,name){if(teamId===undefined){throw new Error('Missing required parameter: "teamId"');} +return http.post(path,{'content-type':'application/json',},payload);},get:function(teamId){if(teamId===undefined){throw new Error('Missing required parameter: "teamId"');} +let path='/teams/{teamId}'.replace(new RegExp('{teamId}','g'),teamId);let payload={};return http.get(path,{'content-type':'application/json',},payload);},update:function(teamId,name){if(teamId===undefined){throw new Error('Missing required parameter: "teamId"');} if(name===undefined){throw new Error('Missing required parameter: "name"');} let path='/teams/{teamId}'.replace(new RegExp('{teamId}','g'),teamId);let payload={};if(name){payload['name']=name;} -return http.put(path,{'content-type':'application/json'},payload);},deleteTeam:function(teamId){if(teamId===undefined){throw new Error('Missing required parameter: "teamId"');} -let path='/teams/{teamId}'.replace(new RegExp('{teamId}','g'),teamId);let payload={};return http.delete(path,{'content-type':'application/json'},payload);},getTeamMembers:function(teamId){if(teamId===undefined){throw new Error('Missing required parameter: "teamId"');} -let path='/teams/{teamId}/members'.replace(new RegExp('{teamId}','g'),teamId);let payload={};return http.get(path,{'content-type':'application/json'},payload);},createTeamMembership:function(teamId,email,roles,redirect,name=''){if(teamId===undefined){throw new Error('Missing required parameter: "teamId"');} +return http.put(path,{'content-type':'application/json',},payload);},delete:function(teamId){if(teamId===undefined){throw new Error('Missing required parameter: "teamId"');} +let path='/teams/{teamId}'.replace(new RegExp('{teamId}','g'),teamId);let payload={};return http.delete(path,{'content-type':'application/json',},payload);},getMemberships:function(teamId){if(teamId===undefined){throw new Error('Missing required parameter: "teamId"');} +let path='/teams/{teamId}/memberships'.replace(new RegExp('{teamId}','g'),teamId);let payload={};return http.get(path,{'content-type':'application/json',},payload);},createMembership:function(teamId,email,roles,url,name=''){if(teamId===undefined){throw new Error('Missing required parameter: "teamId"');} if(email===undefined){throw new Error('Missing required parameter: "email"');} if(roles===undefined){throw new Error('Missing required parameter: "roles"');} -if(redirect===undefined){throw new Error('Missing required parameter: "redirect"');} +if(url===undefined){throw new Error('Missing required parameter: "url"');} let path='/teams/{teamId}/memberships'.replace(new RegExp('{teamId}','g'),teamId);let payload={};if(email){payload['email']=email;} if(name){payload['name']=name;} if(roles){payload['roles']=roles;} -if(redirect){payload['redirect']=redirect;} -return http.post(path,{'content-type':'application/json'},payload);},deleteTeamMembership:function(teamId,inviteId){if(teamId===undefined){throw new Error('Missing required parameter: "teamId"');} +if(url){payload['url']=url;} +return http.post(path,{'content-type':'application/json',},payload);},deleteMembership:function(teamId,inviteId){if(teamId===undefined){throw new Error('Missing required parameter: "teamId"');} if(inviteId===undefined){throw new Error('Missing required parameter: "inviteId"');} -let path='/teams/{teamId}/memberships/{inviteId}'.replace(new RegExp('{teamId}','g'),teamId).replace(new RegExp('{inviteId}','g'),inviteId);let payload={};return http.delete(path,{'content-type':'application/json'},payload);},createTeamMembershipResend:function(teamId,inviteId,redirect){if(teamId===undefined){throw new Error('Missing required parameter: "teamId"');} -if(inviteId===undefined){throw new Error('Missing required parameter: "inviteId"');} -if(redirect===undefined){throw new Error('Missing required parameter: "redirect"');} -let path='/teams/{teamId}/memberships/{inviteId}/resend'.replace(new RegExp('{teamId}','g'),teamId).replace(new RegExp('{inviteId}','g'),inviteId);let payload={};if(redirect){payload['redirect']=redirect;} -return http.post(path,{'content-type':'application/json'},payload);},updateTeamMembershipStatus:function(teamId,inviteId,userId,secret,success='',failure=''){if(teamId===undefined){throw new Error('Missing required parameter: "teamId"');} +let path='/teams/{teamId}/memberships/{inviteId}'.replace(new RegExp('{teamId}','g'),teamId).replace(new RegExp('{inviteId}','g'),inviteId);let payload={};return http.delete(path,{'content-type':'application/json',},payload);},updateMembershipStatus:function(teamId,inviteId,userId,secret){if(teamId===undefined){throw new Error('Missing required parameter: "teamId"');} if(inviteId===undefined){throw new Error('Missing required parameter: "inviteId"');} if(userId===undefined){throw new Error('Missing required parameter: "userId"');} if(secret===undefined){throw new Error('Missing required parameter: "secret"');} let path='/teams/{teamId}/memberships/{inviteId}/status'.replace(new RegExp('{teamId}','g'),teamId).replace(new RegExp('{inviteId}','g'),inviteId);let payload={};if(userId){payload['userId']=userId;} if(secret){payload['secret']=secret;} -if(success){payload['success']=success;} -if(failure){payload['failure']=failure;} -payload['project']=config.project;return iframe('patch',path,payload);}};let users={listUsers:function(search='',limit=25,offset=0,orderType='ASC'){let path='/users';let payload={};if(search){payload['search']=search;} +payload['project']=config.project;return iframe('patch',path,payload);}};let users={list:function(search='',limit=25,offset=0,orderType='ASC'){let path='/users';let payload={};if(search){payload['search']=search;} if(limit){payload['limit']=limit;} if(offset){payload['offset']=offset;} if(orderType){payload['orderType']=orderType;} -return http.get(path,{'content-type':'application/json'},payload);},createUser:function(email,password,name=''){if(email===undefined){throw new Error('Missing required parameter: "email"');} +return http.get(path,{'content-type':'application/json',},payload);},create:function(email,password,name=''){if(email===undefined){throw new Error('Missing required parameter: "email"');} if(password===undefined){throw new Error('Missing required parameter: "password"');} let path='/users';let payload={};if(email){payload['email']=email;} if(password){payload['password']=password;} if(name){payload['name']=name;} -return http.post(path,{'content-type':'application/json'},payload);},getUser:function(userId){if(userId===undefined){throw new Error('Missing required parameter: "userId"');} -let path='/users/{userId}'.replace(new RegExp('{userId}','g'),userId);let payload={};return http.get(path,{'content-type':'application/json'},payload);},getUserLogs:function(userId){if(userId===undefined){throw new Error('Missing required parameter: "userId"');} -let path='/users/{userId}/logs'.replace(new RegExp('{userId}','g'),userId);let payload={};return http.get(path,{'content-type':'application/json'},payload);},getUserPrefs:function(userId){if(userId===undefined){throw new Error('Missing required parameter: "userId"');} -let path='/users/{userId}/prefs'.replace(new RegExp('{userId}','g'),userId);let payload={};return http.get(path,{'content-type':'application/json'},payload);},updateUserPrefs:function(userId,prefs){if(userId===undefined){throw new Error('Missing required parameter: "userId"');} +return http.post(path,{'content-type':'application/json',},payload);},get:function(userId){if(userId===undefined){throw new Error('Missing required parameter: "userId"');} +let path='/users/{userId}'.replace(new RegExp('{userId}','g'),userId);let payload={};return http.get(path,{'content-type':'application/json',},payload);},getLogs:function(userId){if(userId===undefined){throw new Error('Missing required parameter: "userId"');} +let path='/users/{userId}/logs'.replace(new RegExp('{userId}','g'),userId);let payload={};return http.get(path,{'content-type':'application/json',},payload);},getPrefs:function(userId){if(userId===undefined){throw new Error('Missing required parameter: "userId"');} +let path='/users/{userId}/prefs'.replace(new RegExp('{userId}','g'),userId);let payload={};return http.get(path,{'content-type':'application/json',},payload);},updatePrefs:function(userId,prefs){if(userId===undefined){throw new Error('Missing required parameter: "userId"');} if(prefs===undefined){throw new Error('Missing required parameter: "prefs"');} let path='/users/{userId}/prefs'.replace(new RegExp('{userId}','g'),userId);let payload={};if(prefs){payload['prefs']=prefs;} -return http.patch(path,{'content-type':'application/json'},payload);},getUserSessions:function(userId){if(userId===undefined){throw new Error('Missing required parameter: "userId"');} -let path='/users/{userId}/sessions'.replace(new RegExp('{userId}','g'),userId);let payload={};return http.get(path,{'content-type':'application/json'},payload);},deleteUserSessions:function(userId){if(userId===undefined){throw new Error('Missing required parameter: "userId"');} -let path='/users/{userId}/sessions'.replace(new RegExp('{userId}','g'),userId);let payload={};return http.delete(path,{'content-type':'application/json'},payload);},deleteUserSession:function(userId,sessionId){if(userId===undefined){throw new Error('Missing required parameter: "userId"');} +return http.patch(path,{'content-type':'application/json',},payload);},getSessions:function(userId){if(userId===undefined){throw new Error('Missing required parameter: "userId"');} +let path='/users/{userId}/sessions'.replace(new RegExp('{userId}','g'),userId);let payload={};return http.get(path,{'content-type':'application/json',},payload);},deleteSessions:function(userId){if(userId===undefined){throw new Error('Missing required parameter: "userId"');} +let path='/users/{userId}/sessions'.replace(new RegExp('{userId}','g'),userId);let payload={};return http.delete(path,{'content-type':'application/json',},payload);},deleteSession:function(userId,sessionId){if(userId===undefined){throw new Error('Missing required parameter: "userId"');} if(sessionId===undefined){throw new Error('Missing required parameter: "sessionId"');} let path='/users/{userId}/sessions/:session'.replace(new RegExp('{userId}','g'),userId);let payload={};if(sessionId){payload['sessionId']=sessionId;} -return http.delete(path,{'content-type':'application/json'},payload);},updateUserStatus:function(userId,status){if(userId===undefined){throw new Error('Missing required parameter: "userId"');} +return http.delete(path,{'content-type':'application/json',},payload);},updateStatus:function(userId,status){if(userId===undefined){throw new Error('Missing required parameter: "userId"');} if(status===undefined){throw new Error('Missing required parameter: "status"');} let path='/users/{userId}/status'.replace(new RegExp('{userId}','g'),userId);let payload={};if(status){payload['status']=status;} -return http.patch(path,{'content-type':'application/json'},payload);}};return{setEndpoint:setEndpoint,setProject:setProject,setKey:setKey,setLocale:setLocale,setMode:setMode,account:account,auth:auth,avatars:avatars,database:database,locale:locale,projects:projects,storage:storage,teams:teams,users:users};};if(typeof module!=="undefined"){module.exports=window.Appwrite;}})((typeof window!=="undefined")?window:{});(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Chart=f()}})(function(){var define,module,exports;return(function(){function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o= request.status) { + let data = request.response; + let contentType = this.getResponseHeader('content-type') || ''; + contentType = contentType.substring(0, contentType.indexOf(';')); + + switch (contentType) { + case 'application/json': + data = JSON.parse(data); + break; + } + + resolve(data); + + } else { + reject(new Error(request.statusText)); + } + }; + + if (progress) { + request.addEventListener('progress', progress); + request.upload.addEventListener('progress', progress, false); + } + + // Handle network errors + request.onerror = function () { + reject(new Error("Network Error")); + }; + + request.send(params); + }) + }; + + return { + 'get': function(path, headers = {}, params = {}) { + return call('GET', path + ((Object.keys(params).length > 0) ? '?' + buildQuery(params) : ''), headers, {}); + }, + 'post': function(path, headers = {}, params = {}, progress = null) { + return call('POST', path, headers, params, progress); + }, + 'put': function(path, headers = {}, params = {}, progress = null) { + return call('PUT', path, headers, params, progress); + }, + 'patch': function(path, headers = {}, params = {}, progress = null) { + return call('PATCH', path, headers, params, progress); + }, + 'delete': function(path, headers = {}, params = {}, progress = null) { + return call('DELETE', path, headers, params, progress); + }, + 'addGlobalParam': addGlobalParam, + 'addGlobalHeader': addGlobalHeader + } + }(window.document); + + let iframe = function(method, url, params) { + let form = document.createElement('form'); + + form.setAttribute('method', method); + form.setAttribute('action', config.endpoint + url); + + for(let key in params) { + if(params.hasOwnProperty(key)) { + let hiddenField = document.createElement("input"); + hiddenField.setAttribute("type", "hidden"); + hiddenField.setAttribute("name", key); + hiddenField.setAttribute("value", params[key]); + + form.appendChild(hiddenField); + } + } + + document.body.appendChild(form); + + return form.submit(); + }; + + let account = { + + /** + * Get Account + * + * Get currently logged in user data as JSON object. + * + * @throws {Error} + * @return {Promise} + */ + get: function() { + let path = '/account'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Create Account + * + * 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. + * + * @param {string} email + * @param {string} password + * @param {string} name + * @throws {Error} + * @return {Promise} + */ + create: function(email, password, name = '') { + if(email === undefined) { + throw new Error('Missing required parameter: "email"'); + } + + if(password === undefined) { + throw new Error('Missing required parameter: "password"'); + } + + let path = '/account'; + + let payload = {}; + + if(email) { + payload['email'] = email; + } + + if(password) { + payload['password'] = password; + } + + if(name) { + payload['name'] = name; + } + + return http + .post(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Delete Account + * + * 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. + * + * @throws {Error} + * @return {Promise} + */ + delete: function() { + let path = '/account'; + + let payload = {}; + + return http + .delete(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Update Account Email + * + * 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. + * + * @param {string} email + * @param {string} password + * @throws {Error} + * @return {Promise} + */ + updateEmail: function(email, password) { + if(email === undefined) { + throw new Error('Missing required parameter: "email"'); + } + + if(password === undefined) { + throw new Error('Missing required parameter: "password"'); + } + + let path = '/account/email'; + + let payload = {}; + + if(email) { + payload['email'] = email; + } + + if(password) { + payload['password'] = password; + } + + return http + .patch(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Account Logs + * + * Get currently logged in user list of latest security activity logs. Each + * log returns user IP address, location and date and time of log. + * + * @throws {Error} + * @return {Promise} + */ + getLogs: function() { + let path = '/account/logs'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Update Account Name + * + * Update currently logged in user account name. + * + * @param {string} name + * @throws {Error} + * @return {Promise} + */ + updateName: function(name) { + if(name === undefined) { + throw new Error('Missing required parameter: "name"'); + } + + let path = '/account/name'; + + let payload = {}; + + if(name) { + payload['name'] = name; + } + + return http + .patch(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Update Account Password + * + * Update currently logged in user password. For validation, user is required + * to pass the password twice. + * + * @param {string} password + * @param {string} oldPassword + * @throws {Error} + * @return {Promise} + */ + updatePassword: function(password, oldPassword) { + if(password === undefined) { + throw new Error('Missing required parameter: "password"'); + } + + if(oldPassword === undefined) { + throw new Error('Missing required parameter: "oldPassword"'); + } + + let path = '/account/password'; + + let payload = {}; + + if(password) { + payload['password'] = password; + } + + if(oldPassword) { + payload['old-password'] = oldPassword; + } + + return http + .patch(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Account Preferences + * + * Get currently logged in user preferences key-value object. + * + * @throws {Error} + * @return {Promise} + */ + getPrefs: function() { + let path = '/account/prefs'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Update Account Preferences + * + * Update currently logged in user account preferences. You can pass only the + * specific settings you wish to update. + * + * @param {string} prefs + * @throws {Error} + * @return {Promise} + */ + updatePrefs: function(prefs) { + if(prefs === undefined) { + throw new Error('Missing required parameter: "prefs"'); + } + + let path = '/account/prefs'; + + let payload = {}; + + if(prefs) { + payload['prefs'] = prefs; + } + + return http + .patch(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Password Recovery + * + * 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. + * + * @param {string} email + * @param {string} url + * @throws {Error} + * @return {Promise} + */ + createRecovery: function(email, url) { + if(email === undefined) { + throw new Error('Missing required parameter: "email"'); + } + + if(url === undefined) { + throw new Error('Missing required parameter: "url"'); + } + + let path = '/account/recovery'; + + let payload = {}; + + if(email) { + payload['email'] = email; + } + + if(url) { + payload['url'] = url; + } + + return http + .post(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Password Reset + * + * 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. + * + * @param {string} userId + * @param {string} secret + * @param {string} passwordA + * @param {string} passwordB + * @throws {Error} + * @return {Promise} + */ + updateRecovery: function(userId, secret, passwordA, passwordB) { + if(userId === undefined) { + throw new Error('Missing required parameter: "userId"'); + } + + if(secret === undefined) { + throw new Error('Missing required parameter: "secret"'); + } + + if(passwordA === undefined) { + throw new Error('Missing required parameter: "passwordA"'); + } + + if(passwordB === undefined) { + throw new Error('Missing required parameter: "passwordB"'); + } + + let path = '/account/recovery'; + + let payload = {}; + + if(userId) { + payload['userId'] = userId; + } + + if(secret) { + payload['secret'] = secret; + } + + if(passwordA) { + payload['password-a'] = passwordA; + } + + if(passwordB) { + payload['password-b'] = passwordB; + } + + return http + .put(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Account Sessions + * + * Get currently logged in user list of active sessions across different + * devices. + * + * @throws {Error} + * @return {Promise} + */ + getSessions: function() { + let path = '/account/sessions'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Create Account Session + * + * 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. + * + * @param {string} email + * @param {string} password + * @throws {Error} + * @return {Promise} + */ + createSession: function(email, password) { + if(email === undefined) { + throw new Error('Missing required parameter: "email"'); + } + + if(password === undefined) { + throw new Error('Missing required parameter: "password"'); + } + + let path = '/account/sessions'; + + let payload = {}; + + if(email) { + payload['email'] = email; + } + + if(password) { + payload['password'] = password; + } + + return http + .post(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Delete All Account Sessions + * + * Delete all sessions from the user account and remove any sessions cookies + * from the end client. + * + * @throws {Error} + * @return {Promise} + */ + deleteSessions: function() { + let path = '/account/sessions'; + + let payload = {}; + + return http + .delete(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Delete Current Account Session + * + * 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. + * + * @throws {Error} + * @return {Promise} + */ + deleteCurrentSession: function() { + let path = '/account/sessions/current'; + + let payload = {}; + + return http + .delete(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Create Account Session with 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. + * + * @param {string} provider + * @param {string} success + * @param {string} failure + * @throws {Error} + * @return {Promise} + */ + createOAuthSession: function(provider, success, failure) { + if(provider === undefined) { + throw new Error('Missing required parameter: "provider"'); + } + + if(success === undefined) { + throw new Error('Missing required parameter: "success"'); + } + + if(failure === undefined) { + throw new Error('Missing required parameter: "failure"'); + } + + let path = '/account/sessions/oauth/{provider}'.replace(new RegExp('{provider}', 'g'), provider); + + let payload = {}; + + if(success) { + payload['success'] = success; + } + + if(failure) { + payload['failure'] = failure; + } + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Delete Account Session + * + * 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. + * + * @param {string} id + * @throws {Error} + * @return {Promise} + */ + deleteSession: function(id) { + if(id === undefined) { + throw new Error('Missing required parameter: "id"'); + } + + let path = '/account/sessions/{id}'.replace(new RegExp('{id}', 'g'), id); + + let payload = {}; + + return http + .delete(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Create Verification + * + * 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. + * + * @param {string} url + * @throws {Error} + * @return {Promise} + */ + createVerification: function(url) { + if(url === undefined) { + throw new Error('Missing required parameter: "url"'); + } + + let path = '/account/verification'; + + let payload = {}; + + if(url) { + payload['url'] = url; + } + + return http + .post(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Updated Verification + * + * 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. + * + * @param {string} userId + * @param {string} secret + * @param {string} passwordB + * @throws {Error} + * @return {Promise} + */ + updateVerification: function(userId, secret, passwordB) { + if(userId === undefined) { + throw new Error('Missing required parameter: "userId"'); + } + + if(secret === undefined) { + throw new Error('Missing required parameter: "secret"'); + } + + if(passwordB === undefined) { + throw new Error('Missing required parameter: "passwordB"'); + } + + let path = '/account/verification'; + + let payload = {}; + + if(userId) { + payload['userId'] = userId; + } + + if(secret) { + payload['secret'] = secret; + } + + if(passwordB) { + payload['password-b'] = passwordB; + } + + return http + .put(path, { + 'content-type': 'application/json', + }, payload); + } + }; + + let avatars = { + + /** + * Get Browser Icon + * + * 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. + * + * @param {string} code + * @param {number} width + * @param {number} height + * @param {number} quality + * @throws {Error} + * @return {Promise} + */ + getBrowser: function(code, width = 100, height = 100, quality = 100) { + if(code === undefined) { + throw new Error('Missing required parameter: "code"'); + } + + let path = '/avatars/browsers/{code}'.replace(new RegExp('{code}', 'g'), code); + + let payload = {}; + + if(width) { + payload['width'] = width; + } + + if(height) { + payload['height'] = height; + } + + if(quality) { + payload['quality'] = quality; + } + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Credit Card Icon + * + * 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. + * + * @param {string} code + * @param {number} width + * @param {number} height + * @param {number} quality + * @throws {Error} + * @return {Promise} + */ + getCreditCard: function(code, width = 100, height = 100, quality = 100) { + if(code === undefined) { + throw new Error('Missing required parameter: "code"'); + } + + let path = '/avatars/credit-cards/{code}'.replace(new RegExp('{code}', 'g'), code); + + let payload = {}; + + if(width) { + payload['width'] = width; + } + + if(height) { + payload['height'] = height; + } + + if(quality) { + payload['quality'] = quality; + } + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Favicon + * + * Use this endpoint to fetch the favorite icon (AKA favicon) of a any remote + * website URL. + * + * @param {string} url + * @throws {Error} + * @return {Promise} + */ + getFavicon: function(url) { + if(url === undefined) { + throw new Error('Missing required parameter: "url"'); + } + + let path = '/avatars/favicon'; + + let payload = {}; + + if(url) { + payload['url'] = url; + } + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Country Flag + * + * 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. + * + * @param {string} code + * @param {number} width + * @param {number} height + * @param {number} quality + * @throws {Error} + * @return {Promise} + */ + getFlag: function(code, width = 100, height = 100, quality = 100) { + if(code === undefined) { + throw new Error('Missing required parameter: "code"'); + } + + let path = '/avatars/flags/{code}'.replace(new RegExp('{code}', 'g'), code); + + let payload = {}; + + if(width) { + payload['width'] = width; + } + + if(height) { + payload['height'] = height; + } + + if(quality) { + payload['quality'] = quality; + } + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Image from URL + * + * 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. + * + * @param {string} url + * @param {number} width + * @param {number} height + * @throws {Error} + * @return {Promise} + */ + getImage: function(url, width = 400, height = 400) { + if(url === undefined) { + throw new Error('Missing required parameter: "url"'); + } + + let path = '/avatars/image'; + + let payload = {}; + + if(url) { + payload['url'] = url; + } + + if(width) { + payload['width'] = width; + } + + if(height) { + payload['height'] = height; + } + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get QR Code + * + * 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. + * + * @param {string} text + * @param {number} size + * @param {number} margin + * @param {number} download + * @throws {Error} + * @return {Promise} + */ + getQR: function(text, size = 400, margin = 1, download = 0) { + if(text === undefined) { + throw new Error('Missing required parameter: "text"'); + } + + let path = '/avatars/qr'; + + let payload = {}; + + if(text) { + payload['text'] = text; + } + + if(size) { + payload['size'] = size; + } + + if(margin) { + payload['margin'] = margin; + } + + if(download) { + payload['download'] = download; + } + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + } + }; + + let database = { + + /** + * List Collections + * + * 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). + * + * @param {string} search + * @param {number} limit + * @param {number} offset + * @param {string} orderType + * @throws {Error} + * @return {Promise} + */ + listCollections: function(search = '', limit = 25, offset = 0, orderType = 'ASC') { + let path = '/database/collections'; + + let payload = {}; + + if(search) { + payload['search'] = search; + } + + if(limit) { + payload['limit'] = limit; + } + + if(offset) { + payload['offset'] = offset; + } + + if(orderType) { + payload['orderType'] = orderType; + } + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Create Collection + * + * Create a new Collection. + * + * @param {string} name + * @param {array} read + * @param {array} write + * @param {array} rules + * @throws {Error} + * @return {Promise} + */ + createCollection: function(name, read, write, rules) { + if(name === undefined) { + throw new Error('Missing required parameter: "name"'); + } + + if(read === undefined) { + throw new Error('Missing required parameter: "read"'); + } + + if(write === undefined) { + throw new Error('Missing required parameter: "write"'); + } + + if(rules === undefined) { + throw new Error('Missing required parameter: "rules"'); + } + + let path = '/database/collections'; + + let payload = {}; + + if(name) { + payload['name'] = name; + } + + if(read) { + payload['read'] = read; + } + + if(write) { + payload['write'] = write; + } + + if(rules) { + payload['rules'] = rules; + } + + return http + .post(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Collection + * + * Get collection by its unique ID. This endpoint response returns a JSON + * object with the collection metadata. + * + * @param {string} collectionId + * @throws {Error} + * @return {Promise} + */ + getCollection: function(collectionId) { + if(collectionId === undefined) { + throw new Error('Missing required parameter: "collectionId"'); + } + + let path = '/database/collections/{collectionId}'.replace(new RegExp('{collectionId}', 'g'), collectionId); + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Update Collection + * + * Update collection by its unique ID. + * + * @param {string} collectionId + * @param {string} name + * @param {array} read + * @param {array} write + * @param {array} rules + * @throws {Error} + * @return {Promise} + */ + updateCollection: function(collectionId, name, read, write, rules = []) { + if(collectionId === undefined) { + throw new Error('Missing required parameter: "collectionId"'); + } + + if(name === undefined) { + throw new Error('Missing required parameter: "name"'); + } + + if(read === undefined) { + throw new Error('Missing required parameter: "read"'); + } + + if(write === undefined) { + throw new Error('Missing required parameter: "write"'); + } + + let path = '/database/collections/{collectionId}'.replace(new RegExp('{collectionId}', 'g'), collectionId); + + let payload = {}; + + if(name) { + payload['name'] = name; + } + + if(read) { + payload['read'] = read; + } + + if(write) { + payload['write'] = write; + } + + if(rules) { + payload['rules'] = rules; + } + + return http + .put(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Delete Collection + * + * Delete a collection by its unique ID. Only users with write permissions + * have access to delete this resource. + * + * @param {string} collectionId + * @throws {Error} + * @return {Promise} + */ + deleteCollection: function(collectionId) { + if(collectionId === undefined) { + throw new Error('Missing required parameter: "collectionId"'); + } + + let path = '/database/collections/{collectionId}'.replace(new RegExp('{collectionId}', 'g'), collectionId); + + let payload = {}; + + return http + .delete(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * List Documents + * + * 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). + * + * @param {string} collectionId + * @param {array} filters + * @param {number} offset + * @param {number} limit + * @param {string} orderField + * @param {string} orderType + * @param {string} orderCast + * @param {string} search + * @param {number} first + * @param {number} last + * @throws {Error} + * @return {Promise} + */ + listDocuments: function(collectionId, filters = [], offset = 0, limit = 50, orderField = '$uid', orderType = 'ASC', orderCast = 'string', search = '', first = 0, last = 0) { + if(collectionId === undefined) { + throw new Error('Missing required parameter: "collectionId"'); + } + + let path = '/database/collections/{collectionId}/documents'.replace(new RegExp('{collectionId}', 'g'), collectionId); + + let payload = {}; + + if(filters) { + payload['filters'] = filters; + } + + if(offset) { + payload['offset'] = offset; + } + + if(limit) { + payload['limit'] = limit; + } + + if(orderField) { + payload['order-field'] = orderField; + } + + if(orderType) { + payload['order-type'] = orderType; + } + + if(orderCast) { + payload['order-cast'] = orderCast; + } + + if(search) { + payload['search'] = search; + } + + if(first) { + payload['first'] = first; + } + + if(last) { + payload['last'] = last; + } + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Create Document + * + * Create a new Document. + * + * @param {string} collectionId + * @param {string} data + * @param {array} read + * @param {array} write + * @param {string} parentDocument + * @param {string} parentProperty + * @param {string} parentPropertyType + * @throws {Error} + * @return {Promise} + */ + createDocument: function(collectionId, data, read, write, parentDocument = '', parentProperty = '', parentPropertyType = 'assign') { + if(collectionId === undefined) { + throw new Error('Missing required parameter: "collectionId"'); + } + + if(data === undefined) { + throw new Error('Missing required parameter: "data"'); + } + + if(read === undefined) { + throw new Error('Missing required parameter: "read"'); + } + + if(write === undefined) { + throw new Error('Missing required parameter: "write"'); + } + + let path = '/database/collections/{collectionId}/documents'.replace(new RegExp('{collectionId}', 'g'), collectionId); + + let payload = {}; + + if(data) { + payload['data'] = data; + } + + if(read) { + payload['read'] = read; + } + + if(write) { + payload['write'] = write; + } + + if(parentDocument) { + payload['parentDocument'] = parentDocument; + } + + if(parentProperty) { + payload['parentProperty'] = parentProperty; + } + + if(parentPropertyType) { + payload['parentPropertyType'] = parentPropertyType; + } + + return http + .post(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Document + * + * Get document by its unique ID. This endpoint response returns a JSON object + * with the document data. + * + * @param {string} collectionId + * @param {string} documentId + * @throws {Error} + * @return {Promise} + */ + getDocument: function(collectionId, documentId) { + if(collectionId === undefined) { + throw new Error('Missing required parameter: "collectionId"'); + } + + if(documentId === undefined) { + throw new Error('Missing required parameter: "documentId"'); + } + + let path = '/database/collections/{collectionId}/documents/{documentId}'.replace(new RegExp('{collectionId}', 'g'), collectionId).replace(new RegExp('{documentId}', 'g'), documentId); + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Update Document + * + * + * @param {string} collectionId + * @param {string} documentId + * @param {string} data + * @param {array} read + * @param {array} write + * @throws {Error} + * @return {Promise} + */ + updateDocument: function(collectionId, documentId, data, read, write) { + if(collectionId === undefined) { + throw new Error('Missing required parameter: "collectionId"'); + } + + if(documentId === undefined) { + throw new Error('Missing required parameter: "documentId"'); + } + + if(data === undefined) { + throw new Error('Missing required parameter: "data"'); + } + + if(read === undefined) { + throw new Error('Missing required parameter: "read"'); + } + + if(write === undefined) { + throw new Error('Missing required parameter: "write"'); + } + + let path = '/database/collections/{collectionId}/documents/{documentId}'.replace(new RegExp('{collectionId}', 'g'), collectionId).replace(new RegExp('{documentId}', 'g'), documentId); + + let payload = {}; + + if(data) { + payload['data'] = data; + } + + if(read) { + payload['read'] = read; + } + + if(write) { + payload['write'] = write; + } + + return http + .patch(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Delete Document + * + * 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. + * + * @param {string} collectionId + * @param {string} documentId + * @throws {Error} + * @return {Promise} + */ + deleteDocument: function(collectionId, documentId) { + if(collectionId === undefined) { + throw new Error('Missing required parameter: "collectionId"'); + } + + if(documentId === undefined) { + throw new Error('Missing required parameter: "documentId"'); + } + + let path = '/database/collections/{collectionId}/documents/{documentId}'.replace(new RegExp('{collectionId}', 'g'), collectionId).replace(new RegExp('{documentId}', 'g'), documentId); + + let payload = {}; + + return http + .delete(path, { + 'content-type': 'application/json', + }, payload); + } + }; + + let locale = { + + /** + * Get User Locale + * + * Get the current user location based on IP. Returns an object with user + * country code, country name, continent name, continent code, ip address and + * suggested currency. You can use the locale header to get the data in a + * supported language. + * + * ([IP Geolocation by DB-IP](https://db-ip.com)) + * + * @throws {Error} + * @return {Promise} + */ + get: function() { + let path = '/locale'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * List Countries + * + * List of all continents. You can use the locale header to get the data in a + * supported language. + * + * @throws {Error} + * @return {Promise} + */ + getContinents: function() { + let path = '/locale/continents'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * List Countries + * + * List of all countries. You can use the locale header to get the data in a + * supported language. + * + * @throws {Error} + * @return {Promise} + */ + getCountries: function() { + let path = '/locale/countries'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * List EU Countries + * + * 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. + * + * @throws {Error} + * @return {Promise} + */ + getCountriesEU: function() { + let path = '/locale/countries/eu'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * List Countries Phone Codes + * + * List of all countries phone codes. You can use the locale header to get the + * data in a supported language. + * + * @throws {Error} + * @return {Promise} + */ + getCountriesPhones: function() { + let path = '/locale/countries/phones'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * List Currencies + * + * 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. + * + * @throws {Error} + * @return {Promise} + */ + getCurrencies: function() { + let path = '/locale/currencies'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + } + }; + + let projects = { + + /** + * List Projects + * + * + * @throws {Error} + * @return {Promise} + */ + list: function() { + let path = '/projects'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Create Project + * + * + * @param {string} name + * @param {string} teamId + * @param {string} description + * @param {string} logo + * @param {string} url + * @param {string} legalName + * @param {string} legalCountry + * @param {string} legalState + * @param {string} legalCity + * @param {string} legalAddress + * @param {string} legalTaxId + * @throws {Error} + * @return {Promise} + */ + create: function(name, teamId, description = '', logo = '', url = '', legalName = '', legalCountry = '', legalState = '', legalCity = '', legalAddress = '', legalTaxId = '') { + if(name === undefined) { + throw new Error('Missing required parameter: "name"'); + } + + if(teamId === undefined) { + throw new Error('Missing required parameter: "teamId"'); + } + + let path = '/projects'; + + let payload = {}; + + if(name) { + payload['name'] = name; + } + + if(teamId) { + payload['teamId'] = teamId; + } + + if(description) { + payload['description'] = description; + } + + if(logo) { + payload['logo'] = logo; + } + + if(url) { + payload['url'] = url; + } + + if(legalName) { + payload['legalName'] = legalName; + } + + if(legalCountry) { + payload['legalCountry'] = legalCountry; + } + + if(legalState) { + payload['legalState'] = legalState; + } + + if(legalCity) { + payload['legalCity'] = legalCity; + } + + if(legalAddress) { + payload['legalAddress'] = legalAddress; + } + + if(legalTaxId) { + payload['legalTaxId'] = legalTaxId; + } + + return http + .post(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Project + * + * + * @param {string} projectId + * @throws {Error} + * @return {Promise} + */ + get: function(projectId) { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + let path = '/projects/{projectId}'.replace(new RegExp('{projectId}', 'g'), projectId); + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Update Project + * + * + * @param {string} projectId + * @param {string} name + * @param {string} description + * @param {string} logo + * @param {string} url + * @param {string} legalName + * @param {string} legalCountry + * @param {string} legalState + * @param {string} legalCity + * @param {string} legalAddress + * @param {string} legalTaxId + * @throws {Error} + * @return {Promise} + */ + update: function(projectId, name, description = '', logo = '', url = '', legalName = '', legalCountry = '', legalState = '', legalCity = '', legalAddress = '', legalTaxId = '') { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + if(name === undefined) { + throw new Error('Missing required parameter: "name"'); + } + + let path = '/projects/{projectId}'.replace(new RegExp('{projectId}', 'g'), projectId); + + let payload = {}; + + if(name) { + payload['name'] = name; + } + + if(description) { + payload['description'] = description; + } + + if(logo) { + payload['logo'] = logo; + } + + if(url) { + payload['url'] = url; + } + + if(legalName) { + payload['legalName'] = legalName; + } + + if(legalCountry) { + payload['legalCountry'] = legalCountry; + } + + if(legalState) { + payload['legalState'] = legalState; + } + + if(legalCity) { + payload['legalCity'] = legalCity; + } + + if(legalAddress) { + payload['legalAddress'] = legalAddress; + } + + if(legalTaxId) { + payload['legalTaxId'] = legalTaxId; + } + + return http + .patch(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Delete Project + * + * + * @param {string} projectId + * @throws {Error} + * @return {Promise} + */ + delete: function(projectId) { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + let path = '/projects/{projectId}'.replace(new RegExp('{projectId}', 'g'), projectId); + + let payload = {}; + + return http + .delete(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * List Keys + * + * + * @param {string} projectId + * @throws {Error} + * @return {Promise} + */ + listKeys: function(projectId) { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + let path = '/projects/{projectId}/keys'.replace(new RegExp('{projectId}', 'g'), projectId); + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Create Key + * + * + * @param {string} projectId + * @param {string} name + * @param {array} scopes + * @throws {Error} + * @return {Promise} + */ + createKey: function(projectId, name, scopes) { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + if(name === undefined) { + throw new Error('Missing required parameter: "name"'); + } + + if(scopes === undefined) { + throw new Error('Missing required parameter: "scopes"'); + } + + let path = '/projects/{projectId}/keys'.replace(new RegExp('{projectId}', 'g'), projectId); + + let payload = {}; + + if(name) { + payload['name'] = name; + } + + if(scopes) { + payload['scopes'] = scopes; + } + + return http + .post(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Key + * + * + * @param {string} projectId + * @param {string} keyId + * @throws {Error} + * @return {Promise} + */ + getKey: function(projectId, keyId) { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + if(keyId === undefined) { + throw new Error('Missing required parameter: "keyId"'); + } + + let path = '/projects/{projectId}/keys/{keyId}'.replace(new RegExp('{projectId}', 'g'), projectId).replace(new RegExp('{keyId}', 'g'), keyId); + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Update Key + * + * + * @param {string} projectId + * @param {string} keyId + * @param {string} name + * @param {array} scopes + * @throws {Error} + * @return {Promise} + */ + updateKey: function(projectId, keyId, name, scopes) { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + if(keyId === undefined) { + throw new Error('Missing required parameter: "keyId"'); + } + + if(name === undefined) { + throw new Error('Missing required parameter: "name"'); + } + + if(scopes === undefined) { + throw new Error('Missing required parameter: "scopes"'); + } + + let path = '/projects/{projectId}/keys/{keyId}'.replace(new RegExp('{projectId}', 'g'), projectId).replace(new RegExp('{keyId}', 'g'), keyId); + + let payload = {}; + + if(name) { + payload['name'] = name; + } + + if(scopes) { + payload['scopes'] = scopes; + } + + return http + .put(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Delete Key + * + * + * @param {string} projectId + * @param {string} keyId + * @throws {Error} + * @return {Promise} + */ + deleteKey: function(projectId, keyId) { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + if(keyId === undefined) { + throw new Error('Missing required parameter: "keyId"'); + } + + let path = '/projects/{projectId}/keys/{keyId}'.replace(new RegExp('{projectId}', 'g'), projectId).replace(new RegExp('{keyId}', 'g'), keyId); + + let payload = {}; + + return http + .delete(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Update Project OAuth + * + * + * @param {string} projectId + * @param {string} provider + * @param {string} appId + * @param {string} secret + * @throws {Error} + * @return {Promise} + */ + updateOAuth: function(projectId, provider, appId = '', secret = '') { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + if(provider === undefined) { + throw new Error('Missing required parameter: "provider"'); + } + + let path = '/projects/{projectId}/oauth'.replace(new RegExp('{projectId}', 'g'), projectId); + + let payload = {}; + + if(provider) { + payload['provider'] = provider; + } + + if(appId) { + payload['appId'] = appId; + } + + if(secret) { + payload['secret'] = secret; + } + + return http + .patch(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * List Platforms + * + * + * @param {string} projectId + * @throws {Error} + * @return {Promise} + */ + listPlatforms: function(projectId) { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + let path = '/projects/{projectId}/platforms'.replace(new RegExp('{projectId}', 'g'), projectId); + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Create Platform + * + * + * @param {string} projectId + * @param {string} type + * @param {string} name + * @param {string} key + * @param {string} store + * @param {string} url + * @throws {Error} + * @return {Promise} + */ + createPlatform: function(projectId, type, name, key = '', store = '', url = '') { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + if(type === undefined) { + throw new Error('Missing required parameter: "type"'); + } + + if(name === undefined) { + throw new Error('Missing required parameter: "name"'); + } + + let path = '/projects/{projectId}/platforms'.replace(new RegExp('{projectId}', 'g'), projectId); + + let payload = {}; + + if(type) { + payload['type'] = type; + } + + if(name) { + payload['name'] = name; + } + + if(key) { + payload['key'] = key; + } + + if(store) { + payload['store'] = store; + } + + if(url) { + payload['url'] = url; + } + + return http + .post(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Platform + * + * + * @param {string} projectId + * @param {string} platformId + * @throws {Error} + * @return {Promise} + */ + getPlatform: function(projectId, platformId) { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + if(platformId === undefined) { + throw new Error('Missing required parameter: "platformId"'); + } + + let path = '/projects/{projectId}/platforms/{platformId}'.replace(new RegExp('{projectId}', 'g'), projectId).replace(new RegExp('{platformId}', 'g'), platformId); + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Update Platform + * + * + * @param {string} projectId + * @param {string} platformId + * @param {string} name + * @param {string} key + * @param {string} store + * @param {string} url + * @throws {Error} + * @return {Promise} + */ + updatePlatform: function(projectId, platformId, name, key = '', store = '', url = '') { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + if(platformId === undefined) { + throw new Error('Missing required parameter: "platformId"'); + } + + if(name === undefined) { + throw new Error('Missing required parameter: "name"'); + } + + let path = '/projects/{projectId}/platforms/{platformId}'.replace(new RegExp('{projectId}', 'g'), projectId).replace(new RegExp('{platformId}', 'g'), platformId); + + let payload = {}; + + if(name) { + payload['name'] = name; + } + + if(key) { + payload['key'] = key; + } + + if(store) { + payload['store'] = store; + } + + if(url) { + payload['url'] = url; + } + + return http + .put(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Delete Platform + * + * + * @param {string} projectId + * @param {string} platformId + * @throws {Error} + * @return {Promise} + */ + deletePlatform: function(projectId, platformId) { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + if(platformId === undefined) { + throw new Error('Missing required parameter: "platformId"'); + } + + let path = '/projects/{projectId}/platforms/{platformId}'.replace(new RegExp('{projectId}', 'g'), projectId).replace(new RegExp('{platformId}', 'g'), platformId); + + let payload = {}; + + return http + .delete(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * List Tasks + * + * + * @param {string} projectId + * @throws {Error} + * @return {Promise} + */ + listTasks: function(projectId) { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + let path = '/projects/{projectId}/tasks'.replace(new RegExp('{projectId}', 'g'), projectId); + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Create Task + * + * + * @param {string} projectId + * @param {string} name + * @param {string} status + * @param {string} schedule + * @param {number} security + * @param {string} httpMethod + * @param {string} httpUrl + * @param {array} httpHeaders + * @param {string} httpUser + * @param {string} httpPass + * @throws {Error} + * @return {Promise} + */ + createTask: function(projectId, name, status, schedule, security, httpMethod, httpUrl, httpHeaders = [], httpUser = '', httpPass = '') { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + if(name === undefined) { + throw new Error('Missing required parameter: "name"'); + } + + if(status === undefined) { + throw new Error('Missing required parameter: "status"'); + } + + if(schedule === undefined) { + throw new Error('Missing required parameter: "schedule"'); + } + + if(security === undefined) { + throw new Error('Missing required parameter: "security"'); + } + + if(httpMethod === undefined) { + throw new Error('Missing required parameter: "httpMethod"'); + } + + if(httpUrl === undefined) { + throw new Error('Missing required parameter: "httpUrl"'); + } + + let path = '/projects/{projectId}/tasks'.replace(new RegExp('{projectId}', 'g'), projectId); + + let payload = {}; + + if(name) { + payload['name'] = name; + } + + if(status) { + payload['status'] = status; + } + + if(schedule) { + payload['schedule'] = schedule; + } + + if(security) { + payload['security'] = security; + } + + if(httpMethod) { + payload['httpMethod'] = httpMethod; + } + + if(httpUrl) { + payload['httpUrl'] = httpUrl; + } + + if(httpHeaders) { + payload['httpHeaders'] = httpHeaders; + } + + if(httpUser) { + payload['httpUser'] = httpUser; + } + + if(httpPass) { + payload['httpPass'] = httpPass; + } + + return http + .post(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Task + * + * + * @param {string} projectId + * @param {string} taskId + * @throws {Error} + * @return {Promise} + */ + getTask: function(projectId, taskId) { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + if(taskId === undefined) { + throw new Error('Missing required parameter: "taskId"'); + } + + let path = '/projects/{projectId}/tasks/{taskId}'.replace(new RegExp('{projectId}', 'g'), projectId).replace(new RegExp('{taskId}', 'g'), taskId); + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Update Task + * + * + * @param {string} projectId + * @param {string} taskId + * @param {string} name + * @param {string} status + * @param {string} schedule + * @param {number} security + * @param {string} httpMethod + * @param {string} httpUrl + * @param {array} httpHeaders + * @param {string} httpUser + * @param {string} httpPass + * @throws {Error} + * @return {Promise} + */ + updateTask: function(projectId, taskId, name, status, schedule, security, httpMethod, httpUrl, httpHeaders = [], httpUser = '', httpPass = '') { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + if(taskId === undefined) { + throw new Error('Missing required parameter: "taskId"'); + } + + if(name === undefined) { + throw new Error('Missing required parameter: "name"'); + } + + if(status === undefined) { + throw new Error('Missing required parameter: "status"'); + } + + if(schedule === undefined) { + throw new Error('Missing required parameter: "schedule"'); + } + + if(security === undefined) { + throw new Error('Missing required parameter: "security"'); + } + + if(httpMethod === undefined) { + throw new Error('Missing required parameter: "httpMethod"'); + } + + if(httpUrl === undefined) { + throw new Error('Missing required parameter: "httpUrl"'); + } + + let path = '/projects/{projectId}/tasks/{taskId}'.replace(new RegExp('{projectId}', 'g'), projectId).replace(new RegExp('{taskId}', 'g'), taskId); + + let payload = {}; + + if(name) { + payload['name'] = name; + } + + if(status) { + payload['status'] = status; + } + + if(schedule) { + payload['schedule'] = schedule; + } + + if(security) { + payload['security'] = security; + } + + if(httpMethod) { + payload['httpMethod'] = httpMethod; + } + + if(httpUrl) { + payload['httpUrl'] = httpUrl; + } + + if(httpHeaders) { + payload['httpHeaders'] = httpHeaders; + } + + if(httpUser) { + payload['httpUser'] = httpUser; + } + + if(httpPass) { + payload['httpPass'] = httpPass; + } + + return http + .put(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Delete Task + * + * + * @param {string} projectId + * @param {string} taskId + * @throws {Error} + * @return {Promise} + */ + deleteTask: function(projectId, taskId) { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + if(taskId === undefined) { + throw new Error('Missing required parameter: "taskId"'); + } + + let path = '/projects/{projectId}/tasks/{taskId}'.replace(new RegExp('{projectId}', 'g'), projectId).replace(new RegExp('{taskId}', 'g'), taskId); + + let payload = {}; + + return http + .delete(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Project + * + * + * @param {string} projectId + * @throws {Error} + * @return {Promise} + */ + getUsage: function(projectId) { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + let path = '/projects/{projectId}/usage'.replace(new RegExp('{projectId}', 'g'), projectId); + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * List Webhooks + * + * + * @param {string} projectId + * @throws {Error} + * @return {Promise} + */ + listWebhooks: function(projectId) { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + let path = '/projects/{projectId}/webhooks'.replace(new RegExp('{projectId}', 'g'), projectId); + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Create Webhook + * + * + * @param {string} projectId + * @param {string} name + * @param {array} events + * @param {string} url + * @param {number} security + * @param {string} httpUser + * @param {string} httpPass + * @throws {Error} + * @return {Promise} + */ + createWebhook: function(projectId, name, events, url, security, httpUser = '', httpPass = '') { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + if(name === undefined) { + throw new Error('Missing required parameter: "name"'); + } + + if(events === undefined) { + throw new Error('Missing required parameter: "events"'); + } + + if(url === undefined) { + throw new Error('Missing required parameter: "url"'); + } + + if(security === undefined) { + throw new Error('Missing required parameter: "security"'); + } + + let path = '/projects/{projectId}/webhooks'.replace(new RegExp('{projectId}', 'g'), projectId); + + let payload = {}; + + if(name) { + payload['name'] = name; + } + + if(events) { + payload['events'] = events; + } + + if(url) { + payload['url'] = url; + } + + if(security) { + payload['security'] = security; + } + + if(httpUser) { + payload['httpUser'] = httpUser; + } + + if(httpPass) { + payload['httpPass'] = httpPass; + } + + return http + .post(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Webhook + * + * + * @param {string} projectId + * @param {string} webhookId + * @throws {Error} + * @return {Promise} + */ + getWebhook: function(projectId, webhookId) { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + if(webhookId === undefined) { + throw new Error('Missing required parameter: "webhookId"'); + } + + let path = '/projects/{projectId}/webhooks/{webhookId}'.replace(new RegExp('{projectId}', 'g'), projectId).replace(new RegExp('{webhookId}', 'g'), webhookId); + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Update Webhook + * + * + * @param {string} projectId + * @param {string} webhookId + * @param {string} name + * @param {array} events + * @param {string} url + * @param {number} security + * @param {string} httpUser + * @param {string} httpPass + * @throws {Error} + * @return {Promise} + */ + updateWebhook: function(projectId, webhookId, name, events, url, security, httpUser = '', httpPass = '') { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + if(webhookId === undefined) { + throw new Error('Missing required parameter: "webhookId"'); + } + + if(name === undefined) { + throw new Error('Missing required parameter: "name"'); + } + + if(events === undefined) { + throw new Error('Missing required parameter: "events"'); + } + + if(url === undefined) { + throw new Error('Missing required parameter: "url"'); + } + + if(security === undefined) { + throw new Error('Missing required parameter: "security"'); + } + + let path = '/projects/{projectId}/webhooks/{webhookId}'.replace(new RegExp('{projectId}', 'g'), projectId).replace(new RegExp('{webhookId}', 'g'), webhookId); + + let payload = {}; + + if(name) { + payload['name'] = name; + } + + if(events) { + payload['events'] = events; + } + + if(url) { + payload['url'] = url; + } + + if(security) { + payload['security'] = security; + } + + if(httpUser) { + payload['httpUser'] = httpUser; + } + + if(httpPass) { + payload['httpPass'] = httpPass; + } + + return http + .put(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Delete Webhook + * + * + * @param {string} projectId + * @param {string} webhookId + * @throws {Error} + * @return {Promise} + */ + deleteWebhook: function(projectId, webhookId) { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + if(webhookId === undefined) { + throw new Error('Missing required parameter: "webhookId"'); + } + + let path = '/projects/{projectId}/webhooks/{webhookId}'.replace(new RegExp('{projectId}', 'g'), projectId).replace(new RegExp('{webhookId}', 'g'), webhookId); + + let payload = {}; + + return http + .delete(path, { + 'content-type': 'application/json', + }, payload); + } + }; + + let storage = { + + /** + * List Files + * + * 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). + * + * @param {string} search + * @param {number} limit + * @param {number} offset + * @param {string} orderType + * @throws {Error} + * @return {Promise} + */ + list: function(search = '', limit = 25, offset = 0, orderType = 'ASC') { + let path = '/storage/files'; + + let payload = {}; + + if(search) { + payload['search'] = search; + } + + if(limit) { + payload['limit'] = limit; + } + + if(offset) { + payload['offset'] = offset; + } + + if(orderType) { + payload['orderType'] = orderType; + } + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Create File + * + * 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. + * + * @param {File} file + * @param {array} read + * @param {array} write + * @throws {Error} + * @return {Promise} + */ + create: function(file, read, write) { + if(file === undefined) { + throw new Error('Missing required parameter: "file"'); + } + + if(read === undefined) { + throw new Error('Missing required parameter: "read"'); + } + + if(write === undefined) { + throw new Error('Missing required parameter: "write"'); + } + + let path = '/storage/files'; + + let payload = {}; + + if(file) { + payload['file'] = file; + } + + if(read) { + payload['read'] = read; + } + + if(write) { + payload['write'] = write; + } + + return http + .post(path, { + 'content-type': 'multipart/form-data', + }, payload); + }, + + /** + * Get File + * + * Get file by its unique ID. This endpoint response returns a JSON object + * with the file metadata. + * + * @param {string} fileId + * @throws {Error} + * @return {Promise} + */ + get: function(fileId) { + if(fileId === undefined) { + throw new Error('Missing required parameter: "fileId"'); + } + + let path = '/storage/files/{fileId}'.replace(new RegExp('{fileId}', 'g'), fileId); + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Update File + * + * Update file by its unique ID. Only users with write permissions have access + * to update this resource. + * + * @param {string} fileId + * @param {array} read + * @param {array} write + * @throws {Error} + * @return {Promise} + */ + update: function(fileId, read, write) { + if(fileId === undefined) { + throw new Error('Missing required parameter: "fileId"'); + } + + if(read === undefined) { + throw new Error('Missing required parameter: "read"'); + } + + if(write === undefined) { + throw new Error('Missing required parameter: "write"'); + } + + let path = '/storage/files/{fileId}'.replace(new RegExp('{fileId}', 'g'), fileId); + + let payload = {}; + + if(read) { + payload['read'] = read; + } + + if(write) { + payload['write'] = write; + } + + return http + .put(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Delete File + * + * Delete a file by its unique ID. Only users with write permissions have + * access to delete this resource. + * + * @param {string} fileId + * @throws {Error} + * @return {Promise} + */ + delete: function(fileId) { + if(fileId === undefined) { + throw new Error('Missing required parameter: "fileId"'); + } + + let path = '/storage/files/{fileId}'.replace(new RegExp('{fileId}', 'g'), fileId); + + let payload = {}; + + return http + .delete(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get File for Download + * + * 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. + * + * @param {string} fileId + * @throws {Error} + * @return {Promise} + */ + getDownload: function(fileId) { + if(fileId === undefined) { + throw new Error('Missing required parameter: "fileId"'); + } + + let path = '/storage/files/{fileId}/download'.replace(new RegExp('{fileId}', 'g'), fileId); + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get File Preview + * + * Get a file preview image. Currently, this method supports preview for image + * files (jpg, png, and gif), other supported formats, like pdf, docs, slides, + * and spreadsheets, will return the file icon image. You can also pass query + * string arguments for cutting and resizing your preview image. + * + * @param {string} fileId + * @param {number} width + * @param {number} height + * @param {number} quality + * @param {string} background + * @param {string} output + * @throws {Error} + * @return {Promise} + */ + getPreview: function(fileId, width = 0, height = 0, quality = 100, background = '', output = '') { + if(fileId === undefined) { + throw new Error('Missing required parameter: "fileId"'); + } + + let path = '/storage/files/{fileId}/preview'.replace(new RegExp('{fileId}', 'g'), fileId); + + let payload = {}; + + if(width) { + payload['width'] = width; + } + + if(height) { + payload['height'] = height; + } + + if(quality) { + payload['quality'] = quality; + } + + if(background) { + payload['background'] = background; + } + + if(output) { + payload['output'] = output; + } + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get File for View + * + * Get file content by its unique ID. This endpoint is similar to the download + * method but returns with no 'Content-Disposition: attachment' header. + * + * @param {string} fileId + * @param {string} as + * @throws {Error} + * @return {Promise} + */ + getView: function(fileId, as = '') { + if(fileId === undefined) { + throw new Error('Missing required parameter: "fileId"'); + } + + let path = '/storage/files/{fileId}/view'.replace(new RegExp('{fileId}', 'g'), fileId); + + let payload = {}; + + if(as) { + payload['as'] = as; + } + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + } + }; + + let teams = { + + /** + * List Teams + * + * Get a list of all the current user teams. You can use the query params to + * filter your results. On admin mode, this endpoint will return a list of all + * of the project teams. [Learn more about different API modes](/docs/admin). + * + * @param {string} search + * @param {number} limit + * @param {number} offset + * @param {string} orderType + * @throws {Error} + * @return {Promise} + */ + list: function(search = '', limit = 25, offset = 0, orderType = 'ASC') { + let path = '/teams'; + + let payload = {}; + + if(search) { + payload['search'] = search; + } + + if(limit) { + payload['limit'] = limit; + } + + if(offset) { + payload['offset'] = offset; + } + + if(orderType) { + payload['orderType'] = orderType; + } + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Create Team + * + * Create a new team. The user who creates the team will automatically be + * assigned as the owner of the team. The team owner can invite new members, + * who will be able add new owners and update or delete the team from your + * project. + * + * @param {string} name + * @param {array} roles + * @throws {Error} + * @return {Promise} + */ + create: function(name, roles = ["owner"]) { + if(name === undefined) { + throw new Error('Missing required parameter: "name"'); + } + + let path = '/teams'; + + let payload = {}; + + if(name) { + payload['name'] = name; + } + + if(roles) { + payload['roles'] = roles; + } + + return http + .post(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Team + * + * Get team by its unique ID. All team members have read access for this + * resource. + * + * @param {string} teamId + * @throws {Error} + * @return {Promise} + */ + get: function(teamId) { + if(teamId === undefined) { + throw new Error('Missing required parameter: "teamId"'); + } + + let path = '/teams/{teamId}'.replace(new RegExp('{teamId}', 'g'), teamId); + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Update Team + * + * Update team by its unique ID. Only team owners have write access for this + * resource. + * + * @param {string} teamId + * @param {string} name + * @throws {Error} + * @return {Promise} + */ + update: function(teamId, name) { + if(teamId === undefined) { + throw new Error('Missing required parameter: "teamId"'); + } + + if(name === undefined) { + throw new Error('Missing required parameter: "name"'); + } + + let path = '/teams/{teamId}'.replace(new RegExp('{teamId}', 'g'), teamId); + + let payload = {}; + + if(name) { + payload['name'] = name; + } + + return http + .put(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Delete Team + * + * Delete team by its unique ID. Only team owners have write access for this + * resource. + * + * @param {string} teamId + * @throws {Error} + * @return {Promise} + */ + delete: function(teamId) { + if(teamId === undefined) { + throw new Error('Missing required parameter: "teamId"'); + } + + let path = '/teams/{teamId}'.replace(new RegExp('{teamId}', 'g'), teamId); + + let payload = {}; + + return http + .delete(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Team Memberships + * + * Get team members by the team unique ID. All team members have read access + * for this list of resources. + * + * @param {string} teamId + * @throws {Error} + * @return {Promise} + */ + getMemberships: function(teamId) { + if(teamId === undefined) { + throw new Error('Missing required parameter: "teamId"'); + } + + let path = '/teams/{teamId}/memberships'.replace(new RegExp('{teamId}', 'g'), teamId); + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Create Team Membership + * + * Use this endpoint to invite a new member to your team. An email with a link + * to join the team will be sent to the new member email address. If member + * doesn't exists in the project it will be automatically created. + * + * Use the 'url' parameter to redirect the user from the invitation email back + * to your app. When the user is redirected, use the [Update Team Membership + * Status](/docs/teams#updateTeamMembershipStatus) endpoint to finally join + * the user to the team. + * + * Please note that in order to avoid a [Redirect + * Attacks](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) + * the only valid redirect URL's are the once from domains you have set when + * added your platforms in the console interface. + * + * @param {string} teamId + * @param {string} email + * @param {array} roles + * @param {string} url + * @param {string} name + * @throws {Error} + * @return {Promise} + */ + createMembership: function(teamId, email, roles, url, name = '') { + if(teamId === undefined) { + throw new Error('Missing required parameter: "teamId"'); + } + + if(email === undefined) { + throw new Error('Missing required parameter: "email"'); + } + + if(roles === undefined) { + throw new Error('Missing required parameter: "roles"'); + } + + if(url === undefined) { + throw new Error('Missing required parameter: "url"'); + } + + let path = '/teams/{teamId}/memberships'.replace(new RegExp('{teamId}', 'g'), teamId); + + let payload = {}; + + if(email) { + payload['email'] = email; + } + + if(name) { + payload['name'] = name; + } + + if(roles) { + payload['roles'] = roles; + } + + if(url) { + payload['url'] = url; + } + + return http + .post(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Delete Team Membership + * + * This endpoint allows a user to leave a team or for a team owner to delete + * the membership of any other team member. You can also use this endpoint to + * delete a user membership even if he didn't accept it. + * + * @param {string} teamId + * @param {string} inviteId + * @throws {Error} + * @return {Promise} + */ + deleteMembership: function(teamId, inviteId) { + if(teamId === undefined) { + throw new Error('Missing required parameter: "teamId"'); + } + + if(inviteId === undefined) { + throw new Error('Missing required parameter: "inviteId"'); + } + + let path = '/teams/{teamId}/memberships/{inviteId}'.replace(new RegExp('{teamId}', 'g'), teamId).replace(new RegExp('{inviteId}', 'g'), inviteId); + + let payload = {}; + + return http + .delete(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Update Team Membership Status + * + * Use this endpoint to let user accept an invitation to join a team after he + * is being redirect back to your app from the invitation email. Use the + * success and failure URL's to redirect users back to your application after + * the request completes. + * + * Please note that in order to avoid a [Redirect + * Attacks](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) + * the only valid redirect URL's are the once from domains you have set when + * added your platforms in the console interface. + * + * When not using the success or failure redirect arguments this endpoint will + * result with a 200 status code on success and with 401 status error on + * failure. This behavior was applied to help the web clients deal with + * browsers who don't allow to set 3rd party HTTP cookies needed for saving + * the account session key. + * + * @param {string} teamId + * @param {string} inviteId + * @param {string} userId + * @param {string} secret + * @throws {Error} + * @return {null} + */ + updateMembershipStatus: function(teamId, inviteId, userId, secret) { + if(teamId === undefined) { + throw new Error('Missing required parameter: "teamId"'); + } + + if(inviteId === undefined) { + throw new Error('Missing required parameter: "inviteId"'); + } + + if(userId === undefined) { + throw new Error('Missing required parameter: "userId"'); + } + + if(secret === undefined) { + throw new Error('Missing required parameter: "secret"'); + } + + let path = '/teams/{teamId}/memberships/{inviteId}/status'.replace(new RegExp('{teamId}', 'g'), teamId).replace(new RegExp('{inviteId}', 'g'), inviteId); + + let payload = {}; + + if(userId) { + payload['userId'] = userId; + } + + if(secret) { + payload['secret'] = secret; + } + + payload['project'] = config.project; + + return iframe('patch', path, payload); + } + }; + + let users = { + + /** + * List Users + * + * Get a list of all the project users. You can use the query params to filter + * your results. + * + * @param {string} search + * @param {number} limit + * @param {number} offset + * @param {string} orderType + * @throws {Error} + * @return {Promise} + */ + list: function(search = '', limit = 25, offset = 0, orderType = 'ASC') { + let path = '/users'; + + let payload = {}; + + if(search) { + payload['search'] = search; + } + + if(limit) { + payload['limit'] = limit; + } + + if(offset) { + payload['offset'] = offset; + } + + if(orderType) { + payload['orderType'] = orderType; + } + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Create User + * + * Create a new user. + * + * @param {string} email + * @param {string} password + * @param {string} name + * @throws {Error} + * @return {Promise} + */ + create: function(email, password, name = '') { + if(email === undefined) { + throw new Error('Missing required parameter: "email"'); + } + + if(password === undefined) { + throw new Error('Missing required parameter: "password"'); + } + + let path = '/users'; + + let payload = {}; + + if(email) { + payload['email'] = email; + } + + if(password) { + payload['password'] = password; + } + + if(name) { + payload['name'] = name; + } + + return http + .post(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get User + * + * Get user by its unique ID. + * + * @param {string} userId + * @throws {Error} + * @return {Promise} + */ + get: function(userId) { + if(userId === undefined) { + throw new Error('Missing required parameter: "userId"'); + } + + let path = '/users/{userId}'.replace(new RegExp('{userId}', 'g'), userId); + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get User Logs + * + * Get user activity logs list by its unique ID. + * + * @param {string} userId + * @throws {Error} + * @return {Promise} + */ + getLogs: function(userId) { + if(userId === undefined) { + throw new Error('Missing required parameter: "userId"'); + } + + let path = '/users/{userId}/logs'.replace(new RegExp('{userId}', 'g'), userId); + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get User Preferences + * + * Get user preferences by its unique ID. + * + * @param {string} userId + * @throws {Error} + * @return {Promise} + */ + getPrefs: function(userId) { + if(userId === undefined) { + throw new Error('Missing required parameter: "userId"'); + } + + let path = '/users/{userId}/prefs'.replace(new RegExp('{userId}', 'g'), userId); + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Update User Preferences + * + * Update user preferences by its unique ID. You can pass only the specific + * settings you wish to update. + * + * @param {string} userId + * @param {string} prefs + * @throws {Error} + * @return {Promise} + */ + updatePrefs: function(userId, prefs) { + if(userId === undefined) { + throw new Error('Missing required parameter: "userId"'); + } + + if(prefs === undefined) { + throw new Error('Missing required parameter: "prefs"'); + } + + let path = '/users/{userId}/prefs'.replace(new RegExp('{userId}', 'g'), userId); + + let payload = {}; + + if(prefs) { + payload['prefs'] = prefs; + } + + return http + .patch(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get User Sessions + * + * Get user sessions list by its unique ID. + * + * @param {string} userId + * @throws {Error} + * @return {Promise} + */ + getSessions: function(userId) { + if(userId === undefined) { + throw new Error('Missing required parameter: "userId"'); + } + + let path = '/users/{userId}/sessions'.replace(new RegExp('{userId}', 'g'), userId); + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Delete User Sessions + * + * Delete all user sessions by its unique ID. + * + * @param {string} userId + * @throws {Error} + * @return {Promise} + */ + deleteSessions: function(userId) { + if(userId === undefined) { + throw new Error('Missing required parameter: "userId"'); + } + + let path = '/users/{userId}/sessions'.replace(new RegExp('{userId}', 'g'), userId); + + let payload = {}; + + return http + .delete(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Delete User Session + * + * Delete user sessions by its unique ID. + * + * @param {string} userId + * @param {string} sessionId + * @throws {Error} + * @return {Promise} + */ + deleteSession: function(userId, sessionId) { + if(userId === undefined) { + throw new Error('Missing required parameter: "userId"'); + } + + if(sessionId === undefined) { + throw new Error('Missing required parameter: "sessionId"'); + } + + let path = '/users/{userId}/sessions/:session'.replace(new RegExp('{userId}', 'g'), userId); + + let payload = {}; + + if(sessionId) { + payload['sessionId'] = sessionId; + } + + return http + .delete(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Update User Status + * + * Update user status by its unique ID. + * + * @param {string} userId + * @param {string} status + * @throws {Error} + * @return {Promise} + */ + updateStatus: function(userId, status) { + if(userId === undefined) { + throw new Error('Missing required parameter: "userId"'); + } + + if(status === undefined) { + throw new Error('Missing required parameter: "status"'); + } + + let path = '/users/{userId}/status'.replace(new RegExp('{userId}', 'g'), userId); + + let payload = {}; + + if(status) { + payload['status'] = status; + } + + return http + .patch(path, { + 'content-type': 'application/json', + }, payload); + } + }; + + return { + setEndpoint: setEndpoint, + setProject: setProject, + setKey: setKey, + setLocale: setLocale, + setMode: setMode, + account: account, + avatars: avatars, + database: database, + locale: locale, + projects: projects, + storage: storage, + teams: teams, + users: users + }; + }; + + if(typeof module !== "undefined") { + module.exports = window.Appwrite; + } + +})((typeof window !== "undefined") ? window : {}); \ No newline at end of file