Updated SDKs
This commit is contained in:
parent
4d1d2d2f14
commit
4ce95242fc
|
@ -11,16 +11,16 @@ class Auth extends Service {
|
|||
/// redirect URL\'s back to your app when login is completed.
|
||||
///
|
||||
/// Please notice that in order to avoid a [Redirect
|
||||
/// Attacks](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md)
|
||||
/// the only valid redirect URL's are the once from domains you have set when
|
||||
/// added your platforms in the console interface.
|
||||
/// Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md)
|
||||
/// the only valid redirect URLs are the ones from domains you have set when
|
||||
/// adding your platforms in the console interface.
|
||||
///
|
||||
/// When accessing this route using Javascript from the browser, success and
|
||||
/// failure parameter URLs are required. Appwrite server will respond with a
|
||||
/// 301 redirect status code and will set the user session cookie. This
|
||||
/// behavior is enforced because modern browsers are limiting 3rd party cookies
|
||||
/// in XHR of fetch requests to protect user privacy.
|
||||
Future<Response> login({email, password, success, failure}) async {
|
||||
Future<Response> login({email, password, success = null, failure = null}) async {
|
||||
String path = '/auth/login';
|
||||
|
||||
Map<String, dynamic> params = {
|
||||
|
@ -33,7 +33,7 @@ class Auth extends Service {
|
|||
return await this.client.call('post', path: path, params: params);
|
||||
}
|
||||
/// Use this endpoint to log out the currently logged in user from his account.
|
||||
/// When succeed this endpoint will delete the user session and remove the
|
||||
/// When successful this endpoint will delete the user session and remove the
|
||||
/// session secret cookie from the user client.
|
||||
Future<Response> logout() async {
|
||||
String path = '/auth/logout';
|
||||
|
@ -86,9 +86,9 @@ class Auth extends Service {
|
|||
/// /auth/recovery endpoint.
|
||||
///
|
||||
/// Please notice that in order to avoid a [Redirect
|
||||
/// Attacks](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md)
|
||||
/// the only valid redirect URL's are the once from domains you have set when
|
||||
/// added your platforms in the console interface.
|
||||
/// Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md)
|
||||
/// the only valid redirect URLs are the ones from domains you have set when
|
||||
/// adding your platforms in the console interface.
|
||||
Future<Response> recoveryReset({userId, token, passwordA, passwordB}) async {
|
||||
String path = '/auth/recovery/reset';
|
||||
|
||||
|
@ -102,7 +102,7 @@ class Auth extends Service {
|
|||
return await this.client.call('put', path: path, params: params);
|
||||
}
|
||||
/// Use this endpoint to allow a new user to register an account in your
|
||||
/// project. Use the success and failure URL's to redirect users back to 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
|
||||
|
@ -112,9 +112,9 @@ class Auth extends Service {
|
|||
/// /auth/confirm endpoint to complete the account confirmation.
|
||||
///
|
||||
/// Please notice that in order to avoid a [Redirect
|
||||
/// Attacks](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md)
|
||||
/// the only valid redirect URL's are the once from domains you have set when
|
||||
/// added your platforms in the console interface.
|
||||
/// 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
|
||||
|
@ -150,13 +150,13 @@ class Auth extends Service {
|
|||
return await this.client.call('post', path: path, params: params);
|
||||
}
|
||||
/// This endpoint allows the user to request your app to resend him his email
|
||||
/// confirmation message. The redirect arguments acts the same way as in
|
||||
/// confirmation message. The redirect arguments act the same way as in
|
||||
/// /auth/register endpoint.
|
||||
///
|
||||
/// Please notice that in order to avoid a [Redirect
|
||||
/// Attacks](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md)
|
||||
/// the only valid redirect URL's are the once from domains you have set when
|
||||
/// added your platforms in the console interface.
|
||||
/// Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md)
|
||||
/// the only valid redirect URLs are the ones from domains you have set when
|
||||
/// adding your platforms in the console interface.
|
||||
Future<Response> confirmResend({confirm}) async {
|
||||
String path = '/auth/register/confirm/resend';
|
||||
|
||||
|
|
|
@ -6,8 +6,8 @@ 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 appear in your user
|
||||
/// You can use this endpoint to show different browser icons to your users.
|
||||
/// The code argument receives the browser code as it appears in your user
|
||||
/// /account/sessions endpoint. Use width, height and quality arguments to
|
||||
/// change the output settings.
|
||||
Future<Response> getBrowser({code, width = 100, height = 100, quality = 100}) async {
|
||||
|
@ -21,7 +21,7 @@ class Avatars extends Service {
|
|||
|
||||
return await this.client.call('get', path: path, params: params);
|
||||
}
|
||||
/// Need to display your users with your billing method or there payment
|
||||
/// 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.
|
||||
|
@ -48,7 +48,7 @@ class Avatars extends Service {
|
|||
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 a 2 letter country code. Use width,
|
||||
/// users. The code argument receives the 2 letter country code. Use width,
|
||||
/// height and quality arguments to change the output settings.
|
||||
Future<Response> getFlag({code, width = 100, height = 100, quality = 100}) async {
|
||||
String path = '/avatars/flags/{code}'.replaceAll(RegExp('{code}'), code);
|
||||
|
@ -63,7 +63,7 @@ class Avatars extends Service {
|
|||
}
|
||||
/// 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 cases, you want to make sure a 3rd party
|
||||
/// remote images in your app or in case you want to make sure a 3rd party
|
||||
/// image is properly served using a TLS protocol.
|
||||
Future<Response> getImage({url, width = 400, height = 400}) async {
|
||||
String path = '/avatars/image';
|
||||
|
|
12
app/sdks/go/LICENSE
Normal file
12
app/sdks/go/LICENSE
Normal file
|
@ -0,0 +1,12 @@
|
|||
Copyright (c) 2019 Appwrite (https://appwrite.io) and individual contributors.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name Appwrite nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
24
app/sdks/go/README.md
Normal file
24
app/sdks/go/README.md
Normal file
|
@ -0,0 +1,24 @@
|
|||
# Appwrite SDK for Go
|
||||
|
||||
![License](https://img.shields.io/github/license/appwrite/sdk-for-go.svg?v=1)
|
||||
![Version](https://img.shields.io/badge/api%20version-0.2.0-blue.svg?v=1)
|
||||
|
||||
**WORK IN PROGRESS - NOT READY FOR USAGE - Want to help us improve this client SDK? Send a pull request to Appwrite [SDK generator repository](https://github.com/appwrite/sdk-generator).**
|
||||
|
||||
Appwrite backend as a service cuts up to 70% of the time and costs required for building a modern application. We abstract and simplify common development tasks behind a REST APIs, to help you develop your app in a fast and secure way. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)
|
||||
|
||||
|
||||
|
||||
![Appwrite](https://appwrite.io/images/github.png)
|
||||
|
||||
## Installation
|
||||
|
||||
To install using `go get`:
|
||||
|
||||
```bash
|
||||
go get github.com/appwrite/sdk-for-go
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
Please see the [BSD-3-Clause license](https://raw.githubusercontent.com/appwrite/appwrite/master/LICENSE) file for more information.
|
112
app/sdks/go/account.go
Normal file
112
app/sdks/go/account.go
Normal file
|
@ -0,0 +1,112 @@
|
|||
package appwrite
|
||||
|
||||
import (
|
||||
)
|
||||
|
||||
// Account service
|
||||
type Account struct {
|
||||
client *Client
|
||||
}
|
||||
|
||||
// Get get currently logged in user data as JSON object.
|
||||
func (srv *Account) Get() (map[string]interface{}, error) {
|
||||
path := "/account"
|
||||
|
||||
params := map[string]interface{}{
|
||||
}
|
||||
|
||||
return srv.client.Call("GET", path, nil, params)
|
||||
}
|
||||
|
||||
// Delete delete currently logged in user account.
|
||||
func (srv *Account) Delete() (map[string]interface{}, error) {
|
||||
path := "/account"
|
||||
|
||||
params := map[string]interface{}{
|
||||
}
|
||||
|
||||
return srv.client.Call("DELETE", path, nil, params)
|
||||
}
|
||||
|
||||
// UpdateEmail update currently logged in user account email address. After
|
||||
// changing user address, user confirmation status is being reset and a new
|
||||
// confirmation mail is sent. For security measures, user password is required
|
||||
// to complete this request.
|
||||
func (srv *Account) UpdateEmail(Email string, Password string) (map[string]interface{}, error) {
|
||||
path := "/account/email"
|
||||
|
||||
params := map[string]interface{}{
|
||||
"email": Email,
|
||||
"password": Password,
|
||||
}
|
||||
|
||||
return srv.client.Call("PATCH", path, nil, params)
|
||||
}
|
||||
|
||||
// UpdateName update currently logged in user account name.
|
||||
func (srv *Account) UpdateName(Name string) (map[string]interface{}, error) {
|
||||
path := "/account/name"
|
||||
|
||||
params := map[string]interface{}{
|
||||
"name": Name,
|
||||
}
|
||||
|
||||
return srv.client.Call("PATCH", path, nil, params)
|
||||
}
|
||||
|
||||
// UpdatePassword update currently logged in user password. For validation,
|
||||
// user is required to pass the password twice.
|
||||
func (srv *Account) UpdatePassword(Password string, OldPassword string) (map[string]interface{}, error) {
|
||||
path := "/account/password"
|
||||
|
||||
params := map[string]interface{}{
|
||||
"password": Password,
|
||||
"old-password": OldPassword,
|
||||
}
|
||||
|
||||
return srv.client.Call("PATCH", path, nil, params)
|
||||
}
|
||||
|
||||
// GetPrefs get currently logged in user preferences key-value object.
|
||||
func (srv *Account) GetPrefs() (map[string]interface{}, error) {
|
||||
path := "/account/prefs"
|
||||
|
||||
params := map[string]interface{}{
|
||||
}
|
||||
|
||||
return srv.client.Call("GET", path, nil, params)
|
||||
}
|
||||
|
||||
// UpdatePrefs update currently logged in user account preferences. You can
|
||||
// pass only the specific settings you wish to update.
|
||||
func (srv *Account) UpdatePrefs(Prefs string) (map[string]interface{}, error) {
|
||||
path := "/account/prefs"
|
||||
|
||||
params := map[string]interface{}{
|
||||
"prefs": Prefs,
|
||||
}
|
||||
|
||||
return srv.client.Call("PATCH", path, nil, params)
|
||||
}
|
||||
|
||||
// GetSecurity get currently logged in user list of latest security activity
|
||||
// logs. Each log returns user IP address, location and date and time of log.
|
||||
func (srv *Account) GetSecurity() (map[string]interface{}, error) {
|
||||
path := "/account/security"
|
||||
|
||||
params := map[string]interface{}{
|
||||
}
|
||||
|
||||
return srv.client.Call("GET", path, nil, params)
|
||||
}
|
||||
|
||||
// GetSessions get currently logged in user list of active sessions across
|
||||
// different devices.
|
||||
func (srv *Account) GetSessions() (map[string]interface{}, error) {
|
||||
path := "/account/sessions"
|
||||
|
||||
params := map[string]interface{}{
|
||||
}
|
||||
|
||||
return srv.client.Call("GET", path, nil, params)
|
||||
}
|
183
app/sdks/go/auth.go
Normal file
183
app/sdks/go/auth.go
Normal file
|
@ -0,0 +1,183 @@
|
|||
package appwrite
|
||||
|
||||
import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
// Auth service
|
||||
type Auth struct {
|
||||
client *Client
|
||||
}
|
||||
|
||||
// Login allow the user to login into his account by providing a valid email
|
||||
// and password combination. Use the success and failure arguments to provide
|
||||
// a redirect URL\'s back to your app when login is completed.
|
||||
//
|
||||
// Please notice that in order to avoid a [Redirect
|
||||
// Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md)
|
||||
// the only valid redirect URLs are the ones from domains you have set when
|
||||
// adding your platforms in the console interface.
|
||||
//
|
||||
// When accessing this route using Javascript from the browser, success and
|
||||
// failure parameter URLs are required. Appwrite server will respond with a
|
||||
// 301 redirect status code and will set the user session cookie. This
|
||||
// behavior is enforced because modern browsers are limiting 3rd party cookies
|
||||
// in XHR of fetch requests to protect user privacy.
|
||||
func (srv *Auth) Login(Email string, Password string, Success string, Failure string) (map[string]interface{}, error) {
|
||||
path := "/auth/login"
|
||||
|
||||
params := map[string]interface{}{
|
||||
"email": Email,
|
||||
"password": Password,
|
||||
"success": Success,
|
||||
"failure": Failure,
|
||||
}
|
||||
|
||||
return srv.client.Call("POST", path, nil, params)
|
||||
}
|
||||
|
||||
// Logout use this endpoint to log out the currently logged in user from his
|
||||
// account. When successful this endpoint will delete the user session and
|
||||
// remove the session secret cookie from the user client.
|
||||
func (srv *Auth) Logout() (map[string]interface{}, error) {
|
||||
path := "/auth/logout"
|
||||
|
||||
params := map[string]interface{}{
|
||||
}
|
||||
|
||||
return srv.client.Call("DELETE", path, nil, params)
|
||||
}
|
||||
|
||||
// LogoutBySession use this endpoint to log out the currently logged in user
|
||||
// from all his account sessions across all his different devices. When using
|
||||
// the option id argument, only the session unique ID provider will be
|
||||
// deleted.
|
||||
func (srv *Auth) LogoutBySession(Id string) (map[string]interface{}, error) {
|
||||
r := strings.NewReplacer("{id}", Id)
|
||||
path := r.Replace("/auth/logout/{id}")
|
||||
|
||||
params := map[string]interface{}{
|
||||
}
|
||||
|
||||
return srv.client.Call("DELETE", path, nil, params)
|
||||
}
|
||||
|
||||
// Oauth
|
||||
func (srv *Auth) Oauth(Provider string, Success string, Failure string) (map[string]interface{}, error) {
|
||||
r := strings.NewReplacer("{provider}", Provider)
|
||||
path := r.Replace("/auth/oauth/{provider}")
|
||||
|
||||
params := map[string]interface{}{
|
||||
"success": Success,
|
||||
"failure": Failure,
|
||||
}
|
||||
|
||||
return srv.client.Call("GET", path, nil, params)
|
||||
}
|
||||
|
||||
// Recovery sends the user an email with a temporary secret token for password
|
||||
// reset. When the user clicks the confirmation link he is redirected back to
|
||||
// your app password reset redirect URL with a secret token and email address
|
||||
// values attached to the URL query string. Use the query string params to
|
||||
// submit a request to the /auth/password/reset endpoint to complete the
|
||||
// process.
|
||||
func (srv *Auth) Recovery(Email string, Reset string) (map[string]interface{}, error) {
|
||||
path := "/auth/recovery"
|
||||
|
||||
params := map[string]interface{}{
|
||||
"email": Email,
|
||||
"reset": Reset,
|
||||
}
|
||||
|
||||
return srv.client.Call("POST", path, nil, params)
|
||||
}
|
||||
|
||||
// RecoveryReset use this endpoint to complete the user account password
|
||||
// reset. Both the **userId** and **token** arguments will be passed as query
|
||||
// parameters to the redirect URL you have provided when sending your request
|
||||
// to the /auth/recovery endpoint.
|
||||
//
|
||||
// Please notice that in order to avoid a [Redirect
|
||||
// Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md)
|
||||
// the only valid redirect URLs are the ones from domains you have set when
|
||||
// adding your platforms in the console interface.
|
||||
func (srv *Auth) RecoveryReset(UserId string, Token string, PasswordA string, PasswordB string) (map[string]interface{}, error) {
|
||||
path := "/auth/recovery/reset"
|
||||
|
||||
params := map[string]interface{}{
|
||||
"userId": UserId,
|
||||
"token": Token,
|
||||
"password-a": PasswordA,
|
||||
"password-b": PasswordB,
|
||||
}
|
||||
|
||||
return srv.client.Call("PUT", path, nil, params)
|
||||
}
|
||||
|
||||
// Register use this endpoint to allow a new user to register an account in
|
||||
// your project. Use the success and failure URLs to redirect users back to
|
||||
// your application after signup completes.
|
||||
//
|
||||
// If registration completes successfully user will be sent with a
|
||||
// confirmation email in order to confirm he is the owner of the account email
|
||||
// address. Use the confirmation parameter to redirect the user from the
|
||||
// confirmation email back to your app. When the user is redirected, use the
|
||||
// /auth/confirm endpoint to complete the account confirmation.
|
||||
//
|
||||
// Please notice that in order to avoid a [Redirect
|
||||
// Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md)
|
||||
// the only valid redirect URLs are the ones from domains you have set when
|
||||
// adding your platforms in the console interface.
|
||||
//
|
||||
// When accessing this route using Javascript from the browser, success and
|
||||
// failure parameter URLs are required. Appwrite server will respond with a
|
||||
// 301 redirect status code and will set the user session cookie. This
|
||||
// behavior is enforced because modern browsers are limiting 3rd party cookies
|
||||
// in XHR of fetch requests to protect user privacy.
|
||||
func (srv *Auth) Register(Email string, Password string, Confirm string, Success string, Failure string, Name string) (map[string]interface{}, error) {
|
||||
path := "/auth/register"
|
||||
|
||||
params := map[string]interface{}{
|
||||
"email": Email,
|
||||
"password": Password,
|
||||
"confirm": Confirm,
|
||||
"success": Success,
|
||||
"failure": Failure,
|
||||
"name": Name,
|
||||
}
|
||||
|
||||
return srv.client.Call("POST", path, nil, params)
|
||||
}
|
||||
|
||||
// Confirm use this endpoint to complete the confirmation of the user account
|
||||
// email address. Both the **userId** and **token** arguments will be passed
|
||||
// as query parameters to the redirect URL you have provided when sending your
|
||||
// request to the /auth/register endpoint.
|
||||
func (srv *Auth) Confirm(UserId string, Token string) (map[string]interface{}, error) {
|
||||
path := "/auth/register/confirm"
|
||||
|
||||
params := map[string]interface{}{
|
||||
"userId": UserId,
|
||||
"token": Token,
|
||||
}
|
||||
|
||||
return srv.client.Call("POST", path, nil, params)
|
||||
}
|
||||
|
||||
// ConfirmResend this endpoint allows the user to request your app to resend
|
||||
// him his email confirmation message. The redirect arguments act the same way
|
||||
// as in /auth/register endpoint.
|
||||
//
|
||||
// Please notice that in order to avoid a [Redirect
|
||||
// Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md)
|
||||
// the only valid redirect URLs are the ones from domains you have set when
|
||||
// adding your platforms in the console interface.
|
||||
func (srv *Auth) ConfirmResend(Confirm string) (map[string]interface{}, error) {
|
||||
path := "/auth/register/confirm/resend"
|
||||
|
||||
params := map[string]interface{}{
|
||||
"confirm": Confirm,
|
||||
}
|
||||
|
||||
return srv.client.Call("POST", path, nil, params)
|
||||
}
|
103
app/sdks/go/avatars.go
Normal file
103
app/sdks/go/avatars.go
Normal file
|
@ -0,0 +1,103 @@
|
|||
package appwrite
|
||||
|
||||
import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
// Avatars service
|
||||
type Avatars struct {
|
||||
client *Client
|
||||
}
|
||||
|
||||
// GetBrowser 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.
|
||||
func (srv *Avatars) GetBrowser(Code string, Width int, Height int, Quality int) (map[string]interface{}, error) {
|
||||
r := strings.NewReplacer("{code}", Code)
|
||||
path := r.Replace("/avatars/browsers/{code}")
|
||||
|
||||
params := map[string]interface{}{
|
||||
"width": Width,
|
||||
"height": Height,
|
||||
"quality": Quality,
|
||||
}
|
||||
|
||||
return srv.client.Call("GET", path, nil, params)
|
||||
}
|
||||
|
||||
// GetCreditCard 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.
|
||||
func (srv *Avatars) GetCreditCard(Code string, Width int, Height int, Quality int) (map[string]interface{}, error) {
|
||||
r := strings.NewReplacer("{code}", Code)
|
||||
path := r.Replace("/avatars/credit-cards/{code}")
|
||||
|
||||
params := map[string]interface{}{
|
||||
"width": Width,
|
||||
"height": Height,
|
||||
"quality": Quality,
|
||||
}
|
||||
|
||||
return srv.client.Call("GET", path, nil, params)
|
||||
}
|
||||
|
||||
// GetFavicon use this endpoint to fetch the favorite icon (AKA favicon) of a
|
||||
// any remote website URL.
|
||||
func (srv *Avatars) GetFavicon(Url string) (map[string]interface{}, error) {
|
||||
path := "/avatars/favicon"
|
||||
|
||||
params := map[string]interface{}{
|
||||
"url": Url,
|
||||
}
|
||||
|
||||
return srv.client.Call("GET", path, nil, params)
|
||||
}
|
||||
|
||||
// GetFlag 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.
|
||||
func (srv *Avatars) GetFlag(Code string, Width int, Height int, Quality int) (map[string]interface{}, error) {
|
||||
r := strings.NewReplacer("{code}", Code)
|
||||
path := r.Replace("/avatars/flags/{code}")
|
||||
|
||||
params := map[string]interface{}{
|
||||
"width": Width,
|
||||
"height": Height,
|
||||
"quality": Quality,
|
||||
}
|
||||
|
||||
return srv.client.Call("GET", path, nil, params)
|
||||
}
|
||||
|
||||
// GetImage 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.
|
||||
func (srv *Avatars) GetImage(Url string, Width int, Height int) (map[string]interface{}, error) {
|
||||
path := "/avatars/image"
|
||||
|
||||
params := map[string]interface{}{
|
||||
"url": Url,
|
||||
"width": Width,
|
||||
"height": Height,
|
||||
}
|
||||
|
||||
return srv.client.Call("GET", path, nil, params)
|
||||
}
|
||||
|
||||
// GetQR 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.
|
||||
func (srv *Avatars) GetQR(Text string, Size int, Margin int, Download int) (map[string]interface{}, error) {
|
||||
path := "/avatars/qr"
|
||||
|
||||
params := map[string]interface{}{
|
||||
"text": Text,
|
||||
"size": Size,
|
||||
"margin": Margin,
|
||||
"download": Download,
|
||||
}
|
||||
|
||||
return srv.client.Call("GET", path, nil, params)
|
||||
}
|
119
app/sdks/go/client.go
Normal file
119
app/sdks/go/client.go
Normal file
|
@ -0,0 +1,119 @@
|
|||
package appwrite
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// Client is the client struct to access Appwrite services
|
||||
type Client struct {
|
||||
client *http.Client
|
||||
endpoint string
|
||||
headers map[string]string
|
||||
selfSigned bool
|
||||
}
|
||||
|
||||
// SetEndpoint sets the default endpoint to which the Client connects to
|
||||
func (clt *Client) SetEndpoint(endpoint string) {
|
||||
clt.endpoint = endpoint
|
||||
}
|
||||
|
||||
// SetSelfSigned sets the condition that specify if the Client should allow connections to a server using a self-signed certificate
|
||||
func (clt *Client) SetSelfSigned(status bool) {
|
||||
clt.selfSigned = status
|
||||
}
|
||||
|
||||
// AddHeader add a new custom header that the Client should send on each request
|
||||
func (clt *Client) AddHeader(key string, value string) {
|
||||
clt.headers[key] = value
|
||||
}
|
||||
|
||||
// SetProjectHeader add the 'X-Appwrite-Project' header for the Client. Your Appwrite project ID
|
||||
func (clt *Client) SetProjectHeader(value string) {
|
||||
clt.headers["X-Appwrite-Project"] = value
|
||||
}
|
||||
|
||||
// SetKeyHeader add the 'X-Appwrite-Key' header for the Client. Your Appwrite project secret key
|
||||
func (clt *Client) SetKeyHeader(value string) {
|
||||
clt.headers["X-Appwrite-Key"] = value
|
||||
}
|
||||
|
||||
// SetLocaleHeader add the 'X-Appwrite-Locale' header for the Client.
|
||||
func (clt *Client) SetLocaleHeader(value string) {
|
||||
clt.headers["X-Appwrite-Locale"] = value
|
||||
}
|
||||
|
||||
// SetModeHeader add the 'X-Appwrite-Mode' header for the Client.
|
||||
func (clt *Client) SetModeHeader(value string) {
|
||||
clt.headers["X-Appwrite-Mode"] = value
|
||||
}
|
||||
|
||||
// Call an API using Client
|
||||
func (clt *Client) Call(method string, path string, headers map[string]interface{}, params map[string]interface{}) (map[string]interface{}, error) {
|
||||
if clt.client == nil {
|
||||
// Create HTTP client
|
||||
clt.client = &http.Client{}
|
||||
}
|
||||
|
||||
if clt.selfSigned {
|
||||
// Allow self signed requests
|
||||
}
|
||||
|
||||
urlPath := clt.endpoint + path
|
||||
isGet := strings.ToUpper(method) == "GET"
|
||||
|
||||
var reqBody *strings.Reader
|
||||
if !isGet {
|
||||
frm := url.Values{}
|
||||
for key, val := range params {
|
||||
frm.Add(key, ToString(val))
|
||||
}
|
||||
reqBody = strings.NewReader(frm.Encode())
|
||||
}
|
||||
|
||||
// Create and modify HTTP request before sending
|
||||
req, err := http.NewRequest(method, urlPath, reqBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Set Client headers
|
||||
for key, val := range clt.headers {
|
||||
req.Header.Set(key, ToString(val))
|
||||
}
|
||||
|
||||
// Set Custom headers
|
||||
for key, val := range headers {
|
||||
req.Header.Set(key, ToString(val))
|
||||
}
|
||||
|
||||
if isGet {
|
||||
q := req.URL.Query()
|
||||
for key, val := range params {
|
||||
q.Add(key, ToString(val))
|
||||
}
|
||||
req.URL.RawQuery = q.Encode()
|
||||
}
|
||||
|
||||
// Make request
|
||||
response, err := clt.client.Do(req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Handle response
|
||||
defer response.Body.Close()
|
||||
|
||||
responseData, err := ioutil.ReadAll(response.Body)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var jsonResponse map[string]interface{}
|
||||
json.Unmarshal(responseData, &jsonResponse)
|
||||
|
||||
return jsonResponse, nil
|
||||
}
|
159
app/sdks/go/database.go
Normal file
159
app/sdks/go/database.go
Normal file
|
@ -0,0 +1,159 @@
|
|||
package appwrite
|
||||
|
||||
import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
// Database service
|
||||
type Database struct {
|
||||
client *Client
|
||||
}
|
||||
|
||||
// ListCollections 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/modes).
|
||||
func (srv *Database) ListCollections(Search string, Limit int, Offset int, OrderType string) (map[string]interface{}, error) {
|
||||
path := "/database"
|
||||
|
||||
params := map[string]interface{}{
|
||||
"search": Search,
|
||||
"limit": Limit,
|
||||
"offset": Offset,
|
||||
"orderType": OrderType,
|
||||
}
|
||||
|
||||
return srv.client.Call("GET", path, nil, params)
|
||||
}
|
||||
|
||||
// CreateCollection create a new Collection.
|
||||
func (srv *Database) CreateCollection(Name string, Read []interface{}, Write []interface{}, Rules []interface{}) (map[string]interface{}, error) {
|
||||
path := "/database"
|
||||
|
||||
params := map[string]interface{}{
|
||||
"name": Name,
|
||||
"read": Read,
|
||||
"write": Write,
|
||||
"rules": Rules,
|
||||
}
|
||||
|
||||
return srv.client.Call("POST", path, nil, params)
|
||||
}
|
||||
|
||||
// GetCollection get collection by its unique ID. This endpoint response
|
||||
// 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}")
|
||||
|
||||
params := map[string]interface{}{
|
||||
}
|
||||
|
||||
return srv.client.Call("GET", path, nil, params)
|
||||
}
|
||||
|
||||
// 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}")
|
||||
|
||||
params := map[string]interface{}{
|
||||
"name": Name,
|
||||
"read": Read,
|
||||
"write": Write,
|
||||
"rules": Rules,
|
||||
}
|
||||
|
||||
return srv.client.Call("PUT", path, nil, params)
|
||||
}
|
||||
|
||||
// DeleteCollection delete a collection by its unique ID. Only users with
|
||||
// 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}")
|
||||
|
||||
params := map[string]interface{}{
|
||||
}
|
||||
|
||||
return srv.client.Call("DELETE", path, nil, params)
|
||||
}
|
||||
|
||||
// ListDocuments 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/modes).
|
||||
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")
|
||||
|
||||
params := map[string]interface{}{
|
||||
"filters": Filters,
|
||||
"offset": Offset,
|
||||
"limit": Limit,
|
||||
"order-field": OrderField,
|
||||
"order-type": OrderType,
|
||||
"order-cast": OrderCast,
|
||||
"search": Search,
|
||||
"first": First,
|
||||
"last": Last,
|
||||
}
|
||||
|
||||
return srv.client.Call("GET", path, nil, params)
|
||||
}
|
||||
|
||||
// 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")
|
||||
|
||||
params := map[string]interface{}{
|
||||
"data": Data,
|
||||
"read": Read,
|
||||
"write": Write,
|
||||
"parentDocument": ParentDocument,
|
||||
"parentProperty": ParentProperty,
|
||||
"parentPropertyType": ParentPropertyType,
|
||||
}
|
||||
|
||||
return srv.client.Call("POST", path, nil, params)
|
||||
}
|
||||
|
||||
// GetDocument get document by its unique ID. This endpoint response returns a
|
||||
// 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}")
|
||||
|
||||
params := map[string]interface{}{
|
||||
}
|
||||
|
||||
return srv.client.Call("GET", path, nil, params)
|
||||
}
|
||||
|
||||
// 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}")
|
||||
|
||||
params := map[string]interface{}{
|
||||
"data": Data,
|
||||
"read": Read,
|
||||
"write": Write,
|
||||
}
|
||||
|
||||
return srv.client.Call("PATCH", path, nil, params)
|
||||
}
|
||||
|
||||
// DeleteDocument 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.
|
||||
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}")
|
||||
|
||||
params := map[string]interface{}{
|
||||
}
|
||||
|
||||
return srv.client.Call("DELETE", path, nil, params)
|
||||
}
|
35
app/sdks/go/docs/examples/Account/Delete.md
Normal file
35
app/sdks/go/docs/examples/Account/Delete.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Account Examples
|
||||
|
||||
## Delete
|
||||
|
||||
```go
|
||||
package appwrite-delete
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Account service passing Client
|
||||
var srv := appwrite.Account{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call Delete method and handle results
|
||||
var res, err := srv.Delete()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Account/Get.md
Normal file
35
app/sdks/go/docs/examples/Account/Get.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Account Examples
|
||||
|
||||
## Get
|
||||
|
||||
```go
|
||||
package appwrite-get
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Account service passing Client
|
||||
var srv := appwrite.Account{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call Get method and handle results
|
||||
var res, err := srv.Get()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Account/GetPrefs.md
Normal file
35
app/sdks/go/docs/examples/Account/GetPrefs.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Account Examples
|
||||
|
||||
## GetPrefs
|
||||
|
||||
```go
|
||||
package appwrite-getprefs
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Account service passing Client
|
||||
var srv := appwrite.Account{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call GetPrefs method and handle results
|
||||
var res, err := srv.GetPrefs()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Account/GetSecurity.md
Normal file
35
app/sdks/go/docs/examples/Account/GetSecurity.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Account Examples
|
||||
|
||||
## GetSecurity
|
||||
|
||||
```go
|
||||
package appwrite-getsecurity
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Account service passing Client
|
||||
var srv := appwrite.Account{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call GetSecurity method and handle results
|
||||
var res, err := srv.GetSecurity()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Account/GetSessions.md
Normal file
35
app/sdks/go/docs/examples/Account/GetSessions.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Account Examples
|
||||
|
||||
## GetSessions
|
||||
|
||||
```go
|
||||
package appwrite-getsessions
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Account service passing Client
|
||||
var srv := appwrite.Account{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call GetSessions method and handle results
|
||||
var res, err := srv.GetSessions()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Account/UpdateEmail.md
Normal file
35
app/sdks/go/docs/examples/Account/UpdateEmail.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Account Examples
|
||||
|
||||
## UpdateEmail
|
||||
|
||||
```go
|
||||
package appwrite-updateemail
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Account service passing Client
|
||||
var srv := appwrite.Account{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call UpdateEmail method and handle results
|
||||
var res, err := srv.UpdateEmail("email@example.com", "password")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Account/UpdateName.md
Normal file
35
app/sdks/go/docs/examples/Account/UpdateName.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Account Examples
|
||||
|
||||
## UpdateName
|
||||
|
||||
```go
|
||||
package appwrite-updatename
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Account service passing Client
|
||||
var srv := appwrite.Account{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call UpdateName method and handle results
|
||||
var res, err := srv.UpdateName("[NAME]")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Account/UpdatePassword.md
Normal file
35
app/sdks/go/docs/examples/Account/UpdatePassword.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Account Examples
|
||||
|
||||
## UpdatePassword
|
||||
|
||||
```go
|
||||
package appwrite-updatepassword
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Account service passing Client
|
||||
var srv := appwrite.Account{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call UpdatePassword method and handle results
|
||||
var res, err := srv.UpdatePassword("password", "password")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Account/UpdatePrefs.md
Normal file
35
app/sdks/go/docs/examples/Account/UpdatePrefs.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Account Examples
|
||||
|
||||
## UpdatePrefs
|
||||
|
||||
```go
|
||||
package appwrite-updateprefs
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Account service passing Client
|
||||
var srv := appwrite.Account{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call UpdatePrefs method and handle results
|
||||
var res, err := srv.UpdatePrefs("{}")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
33
app/sdks/go/docs/examples/Auth/Confirm.md
Normal file
33
app/sdks/go/docs/examples/Auth/Confirm.md
Normal file
|
@ -0,0 +1,33 @@
|
|||
# Auth Examples
|
||||
|
||||
## Confirm
|
||||
|
||||
```go
|
||||
package appwrite-confirm
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
|
||||
// Create a new Auth service passing Client
|
||||
var srv := appwrite.Auth{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call Confirm method and handle results
|
||||
var res, err := srv.Confirm("[USER_ID]", "[TOKEN]")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Auth/ConfirmResend.md
Normal file
35
app/sdks/go/docs/examples/Auth/ConfirmResend.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Auth Examples
|
||||
|
||||
## ConfirmResend
|
||||
|
||||
```go
|
||||
package appwrite-confirmresend
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Auth service passing Client
|
||||
var srv := appwrite.Auth{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call ConfirmResend method and handle results
|
||||
var res, err := srv.ConfirmResend("https://example.com")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Auth/Login.md
Normal file
35
app/sdks/go/docs/examples/Auth/Login.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Auth Examples
|
||||
|
||||
## Login
|
||||
|
||||
```go
|
||||
package appwrite-login
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Auth service passing Client
|
||||
var srv := appwrite.Auth{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call Login method and handle results
|
||||
var res, err := srv.Login("email@example.com", "password")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Auth/Logout.md
Normal file
35
app/sdks/go/docs/examples/Auth/Logout.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Auth Examples
|
||||
|
||||
## Logout
|
||||
|
||||
```go
|
||||
package appwrite-logout
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Auth service passing Client
|
||||
var srv := appwrite.Auth{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call Logout method and handle results
|
||||
var res, err := srv.Logout()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Auth/LogoutBySession.md
Normal file
35
app/sdks/go/docs/examples/Auth/LogoutBySession.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Auth Examples
|
||||
|
||||
## LogoutBySession
|
||||
|
||||
```go
|
||||
package appwrite-logoutbysession
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Auth service passing Client
|
||||
var srv := appwrite.Auth{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call LogoutBySession method and handle results
|
||||
var res, err := srv.LogoutBySession("[ID]")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Auth/Oauth.md
Normal file
35
app/sdks/go/docs/examples/Auth/Oauth.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Auth Examples
|
||||
|
||||
## Oauth
|
||||
|
||||
```go
|
||||
package appwrite-oauth
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Auth service passing Client
|
||||
var srv := appwrite.Auth{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call Oauth method and handle results
|
||||
var res, err := srv.Oauth("bitbucket")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Auth/Recovery.md
Normal file
35
app/sdks/go/docs/examples/Auth/Recovery.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Auth Examples
|
||||
|
||||
## Recovery
|
||||
|
||||
```go
|
||||
package appwrite-recovery
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Auth service passing Client
|
||||
var srv := appwrite.Auth{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call Recovery method and handle results
|
||||
var res, err := srv.Recovery("email@example.com", "https://example.com")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Auth/RecoveryReset.md
Normal file
35
app/sdks/go/docs/examples/Auth/RecoveryReset.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Auth Examples
|
||||
|
||||
## RecoveryReset
|
||||
|
||||
```go
|
||||
package appwrite-recoveryreset
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Auth service passing Client
|
||||
var srv := appwrite.Auth{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call RecoveryReset method and handle results
|
||||
var res, err := srv.RecoveryReset("[USER_ID]", "[TOKEN]", "password", "password")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Auth/Register.md
Normal file
35
app/sdks/go/docs/examples/Auth/Register.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Auth Examples
|
||||
|
||||
## Register
|
||||
|
||||
```go
|
||||
package appwrite-register
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Auth service passing Client
|
||||
var srv := appwrite.Auth{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call Register method and handle results
|
||||
var res, err := srv.Register("email@example.com", "password", "https://example.com")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Avatars/GetBrowser.md
Normal file
35
app/sdks/go/docs/examples/Avatars/GetBrowser.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Avatars Examples
|
||||
|
||||
## GetBrowser
|
||||
|
||||
```go
|
||||
package appwrite-getbrowser
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Avatars service passing Client
|
||||
var srv := appwrite.Avatars{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call GetBrowser method and handle results
|
||||
var res, err := srv.GetBrowser("aa")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Avatars/GetCreditCard.md
Normal file
35
app/sdks/go/docs/examples/Avatars/GetCreditCard.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Avatars Examples
|
||||
|
||||
## GetCreditCard
|
||||
|
||||
```go
|
||||
package appwrite-getcreditcard
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Avatars service passing Client
|
||||
var srv := appwrite.Avatars{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call GetCreditCard method and handle results
|
||||
var res, err := srv.GetCreditCard("amex")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Avatars/GetFavicon.md
Normal file
35
app/sdks/go/docs/examples/Avatars/GetFavicon.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Avatars Examples
|
||||
|
||||
## GetFavicon
|
||||
|
||||
```go
|
||||
package appwrite-getfavicon
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Avatars service passing Client
|
||||
var srv := appwrite.Avatars{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call GetFavicon method and handle results
|
||||
var res, err := srv.GetFavicon("https://example.com")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Avatars/GetFlag.md
Normal file
35
app/sdks/go/docs/examples/Avatars/GetFlag.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Avatars Examples
|
||||
|
||||
## GetFlag
|
||||
|
||||
```go
|
||||
package appwrite-getflag
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Avatars service passing Client
|
||||
var srv := appwrite.Avatars{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call GetFlag method and handle results
|
||||
var res, err := srv.GetFlag("af")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Avatars/GetImage.md
Normal file
35
app/sdks/go/docs/examples/Avatars/GetImage.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Avatars Examples
|
||||
|
||||
## GetImage
|
||||
|
||||
```go
|
||||
package appwrite-getimage
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Avatars service passing Client
|
||||
var srv := appwrite.Avatars{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call GetImage method and handle results
|
||||
var res, err := srv.GetImage("https://example.com")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Avatars/GetQR.md
Normal file
35
app/sdks/go/docs/examples/Avatars/GetQR.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Avatars Examples
|
||||
|
||||
## GetQR
|
||||
|
||||
```go
|
||||
package appwrite-getqr
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Avatars service passing Client
|
||||
var srv := appwrite.Avatars{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call GetQR method and handle results
|
||||
var res, err := srv.GetQR("[TEXT]")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Database/CreateCollection.md
Normal file
35
app/sdks/go/docs/examples/Database/CreateCollection.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Database Examples
|
||||
|
||||
## CreateCollection
|
||||
|
||||
```go
|
||||
package appwrite-createcollection
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Database service passing Client
|
||||
var srv := appwrite.Database{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call CreateCollection method and handle results
|
||||
var res, err := srv.CreateCollection("[NAME]")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Database/CreateDocument.md
Normal file
35
app/sdks/go/docs/examples/Database/CreateDocument.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Database Examples
|
||||
|
||||
## CreateDocument
|
||||
|
||||
```go
|
||||
package appwrite-createdocument
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Database service passing Client
|
||||
var srv := appwrite.Database{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call CreateDocument method and handle results
|
||||
var res, err := srv.CreateDocument("[COLLECTION_ID]", "{}")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Database/DeleteCollection.md
Normal file
35
app/sdks/go/docs/examples/Database/DeleteCollection.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Database Examples
|
||||
|
||||
## DeleteCollection
|
||||
|
||||
```go
|
||||
package appwrite-deletecollection
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Database service passing Client
|
||||
var srv := appwrite.Database{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call DeleteCollection method and handle results
|
||||
var res, err := srv.DeleteCollection("[COLLECTION_ID]")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Database/DeleteDocument.md
Normal file
35
app/sdks/go/docs/examples/Database/DeleteDocument.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Database Examples
|
||||
|
||||
## DeleteDocument
|
||||
|
||||
```go
|
||||
package appwrite-deletedocument
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Database service passing Client
|
||||
var srv := appwrite.Database{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call DeleteDocument method and handle results
|
||||
var res, err := srv.DeleteDocument("[COLLECTION_ID]", "[DOCUMENT_ID]")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Database/GetCollection.md
Normal file
35
app/sdks/go/docs/examples/Database/GetCollection.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Database Examples
|
||||
|
||||
## GetCollection
|
||||
|
||||
```go
|
||||
package appwrite-getcollection
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Database service passing Client
|
||||
var srv := appwrite.Database{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call GetCollection method and handle results
|
||||
var res, err := srv.GetCollection("[COLLECTION_ID]")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Database/GetDocument.md
Normal file
35
app/sdks/go/docs/examples/Database/GetDocument.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Database Examples
|
||||
|
||||
## GetDocument
|
||||
|
||||
```go
|
||||
package appwrite-getdocument
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Database service passing Client
|
||||
var srv := appwrite.Database{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call GetDocument method and handle results
|
||||
var res, err := srv.GetDocument("[COLLECTION_ID]", "[DOCUMENT_ID]")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Database/ListCollections.md
Normal file
35
app/sdks/go/docs/examples/Database/ListCollections.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Database Examples
|
||||
|
||||
## ListCollections
|
||||
|
||||
```go
|
||||
package appwrite-listcollections
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Database service passing Client
|
||||
var srv := appwrite.Database{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call ListCollections method and handle results
|
||||
var res, err := srv.ListCollections()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Database/ListDocuments.md
Normal file
35
app/sdks/go/docs/examples/Database/ListDocuments.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Database Examples
|
||||
|
||||
## ListDocuments
|
||||
|
||||
```go
|
||||
package appwrite-listdocuments
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Database service passing Client
|
||||
var srv := appwrite.Database{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call ListDocuments method and handle results
|
||||
var res, err := srv.ListDocuments("[COLLECTION_ID]")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Database/UpdateCollection.md
Normal file
35
app/sdks/go/docs/examples/Database/UpdateCollection.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Database Examples
|
||||
|
||||
## UpdateCollection
|
||||
|
||||
```go
|
||||
package appwrite-updatecollection
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Database service passing Client
|
||||
var srv := appwrite.Database{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call UpdateCollection method and handle results
|
||||
var res, err := srv.UpdateCollection("[COLLECTION_ID]", "[NAME]")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Database/UpdateDocument.md
Normal file
35
app/sdks/go/docs/examples/Database/UpdateDocument.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Database Examples
|
||||
|
||||
## UpdateDocument
|
||||
|
||||
```go
|
||||
package appwrite-updatedocument
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Database service passing Client
|
||||
var srv := appwrite.Database{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call UpdateDocument method and handle results
|
||||
var res, err := srv.UpdateDocument("[COLLECTION_ID]", "[DOCUMENT_ID]", "{}")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Locale/GetCountries.md
Normal file
35
app/sdks/go/docs/examples/Locale/GetCountries.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Locale Examples
|
||||
|
||||
## GetCountries
|
||||
|
||||
```go
|
||||
package appwrite-getcountries
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Locale service passing Client
|
||||
var srv := appwrite.Locale{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call GetCountries method and handle results
|
||||
var res, err := srv.GetCountries()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Locale/GetCountriesEU.md
Normal file
35
app/sdks/go/docs/examples/Locale/GetCountriesEU.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Locale Examples
|
||||
|
||||
## GetCountriesEU
|
||||
|
||||
```go
|
||||
package appwrite-getcountrieseu
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Locale service passing Client
|
||||
var srv := appwrite.Locale{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call GetCountriesEU method and handle results
|
||||
var res, err := srv.GetCountriesEU()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Locale/GetCountriesPhones.md
Normal file
35
app/sdks/go/docs/examples/Locale/GetCountriesPhones.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Locale Examples
|
||||
|
||||
## GetCountriesPhones
|
||||
|
||||
```go
|
||||
package appwrite-getcountriesphones
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Locale service passing Client
|
||||
var srv := appwrite.Locale{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call GetCountriesPhones method and handle results
|
||||
var res, err := srv.GetCountriesPhones()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Locale/GetCurrencies.md
Normal file
35
app/sdks/go/docs/examples/Locale/GetCurrencies.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Locale Examples
|
||||
|
||||
## GetCurrencies
|
||||
|
||||
```go
|
||||
package appwrite-getcurrencies
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Locale service passing Client
|
||||
var srv := appwrite.Locale{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call GetCurrencies method and handle results
|
||||
var res, err := srv.GetCurrencies()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Locale/GetLocale.md
Normal file
35
app/sdks/go/docs/examples/Locale/GetLocale.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Locale Examples
|
||||
|
||||
## GetLocale
|
||||
|
||||
```go
|
||||
package appwrite-getlocale
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Locale service passing Client
|
||||
var srv := appwrite.Locale{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call GetLocale method and handle results
|
||||
var res, err := srv.GetLocale()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Projects/CreateKey.md
Normal file
35
app/sdks/go/docs/examples/Projects/CreateKey.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Projects Examples
|
||||
|
||||
## CreateKey
|
||||
|
||||
```go
|
||||
package appwrite-createkey
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Projects service passing Client
|
||||
var srv := appwrite.Projects{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call CreateKey method and handle results
|
||||
var res, err := srv.CreateKey("[PROJECT_ID]", "[NAME]", [])
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Projects/CreatePlatform.md
Normal file
35
app/sdks/go/docs/examples/Projects/CreatePlatform.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Projects Examples
|
||||
|
||||
## CreatePlatform
|
||||
|
||||
```go
|
||||
package appwrite-createplatform
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Projects service passing Client
|
||||
var srv := appwrite.Projects{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call CreatePlatform method and handle results
|
||||
var res, err := srv.CreatePlatform("[PROJECT_ID]", "web", "[NAME]")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Projects/CreateProject.md
Normal file
35
app/sdks/go/docs/examples/Projects/CreateProject.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Projects Examples
|
||||
|
||||
## CreateProject
|
||||
|
||||
```go
|
||||
package appwrite-createproject
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Projects service passing Client
|
||||
var srv := appwrite.Projects{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call CreateProject method and handle results
|
||||
var res, err := srv.CreateProject("[NAME]", "[TEAM_ID]")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Projects/CreateTask.md
Normal file
35
app/sdks/go/docs/examples/Projects/CreateTask.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Projects Examples
|
||||
|
||||
## CreateTask
|
||||
|
||||
```go
|
||||
package appwrite-createtask
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Projects service passing Client
|
||||
var srv := appwrite.Projects{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call CreateTask method and handle results
|
||||
var res, err := srv.CreateTask("[PROJECT_ID]", "[NAME]", "play", "", 0, "GET", "https://example.com")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Projects/CreateWebhook.md
Normal file
35
app/sdks/go/docs/examples/Projects/CreateWebhook.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Projects Examples
|
||||
|
||||
## CreateWebhook
|
||||
|
||||
```go
|
||||
package appwrite-createwebhook
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Projects service passing Client
|
||||
var srv := appwrite.Projects{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call CreateWebhook method and handle results
|
||||
var res, err := srv.CreateWebhook("[PROJECT_ID]", "[NAME]", [], "[URL]", 0)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Projects/DeleteKey.md
Normal file
35
app/sdks/go/docs/examples/Projects/DeleteKey.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Projects Examples
|
||||
|
||||
## DeleteKey
|
||||
|
||||
```go
|
||||
package appwrite-deletekey
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Projects service passing Client
|
||||
var srv := appwrite.Projects{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call DeleteKey method and handle results
|
||||
var res, err := srv.DeleteKey("[PROJECT_ID]", "[KEY_ID]")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Projects/DeletePlatform.md
Normal file
35
app/sdks/go/docs/examples/Projects/DeletePlatform.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Projects Examples
|
||||
|
||||
## DeletePlatform
|
||||
|
||||
```go
|
||||
package appwrite-deleteplatform
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Projects service passing Client
|
||||
var srv := appwrite.Projects{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call DeletePlatform method and handle results
|
||||
var res, err := srv.DeletePlatform("[PROJECT_ID]", "[PLATFORM_ID]")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Projects/DeleteProject.md
Normal file
35
app/sdks/go/docs/examples/Projects/DeleteProject.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Projects Examples
|
||||
|
||||
## DeleteProject
|
||||
|
||||
```go
|
||||
package appwrite-deleteproject
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Projects service passing Client
|
||||
var srv := appwrite.Projects{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call DeleteProject method and handle results
|
||||
var res, err := srv.DeleteProject("[PROJECT_ID]")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Projects/DeleteTask.md
Normal file
35
app/sdks/go/docs/examples/Projects/DeleteTask.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Projects Examples
|
||||
|
||||
## DeleteTask
|
||||
|
||||
```go
|
||||
package appwrite-deletetask
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Projects service passing Client
|
||||
var srv := appwrite.Projects{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call DeleteTask method and handle results
|
||||
var res, err := srv.DeleteTask("[PROJECT_ID]", "[TASK_ID]")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Projects/DeleteWebhook.md
Normal file
35
app/sdks/go/docs/examples/Projects/DeleteWebhook.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Projects Examples
|
||||
|
||||
## DeleteWebhook
|
||||
|
||||
```go
|
||||
package appwrite-deletewebhook
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Projects service passing Client
|
||||
var srv := appwrite.Projects{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call DeleteWebhook method and handle results
|
||||
var res, err := srv.DeleteWebhook("[PROJECT_ID]", "[WEBHOOK_ID]")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Projects/GetKey.md
Normal file
35
app/sdks/go/docs/examples/Projects/GetKey.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Projects Examples
|
||||
|
||||
## GetKey
|
||||
|
||||
```go
|
||||
package appwrite-getkey
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Projects service passing Client
|
||||
var srv := appwrite.Projects{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call GetKey method and handle results
|
||||
var res, err := srv.GetKey("[PROJECT_ID]", "[KEY_ID]")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Projects/GetPlatform.md
Normal file
35
app/sdks/go/docs/examples/Projects/GetPlatform.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Projects Examples
|
||||
|
||||
## GetPlatform
|
||||
|
||||
```go
|
||||
package appwrite-getplatform
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Projects service passing Client
|
||||
var srv := appwrite.Projects{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call GetPlatform method and handle results
|
||||
var res, err := srv.GetPlatform("[PROJECT_ID]", "[PLATFORM_ID]")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Projects/GetProject.md
Normal file
35
app/sdks/go/docs/examples/Projects/GetProject.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Projects Examples
|
||||
|
||||
## GetProject
|
||||
|
||||
```go
|
||||
package appwrite-getproject
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Projects service passing Client
|
||||
var srv := appwrite.Projects{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call GetProject method and handle results
|
||||
var res, err := srv.GetProject("[PROJECT_ID]")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Projects/GetProjectUsage.md
Normal file
35
app/sdks/go/docs/examples/Projects/GetProjectUsage.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Projects Examples
|
||||
|
||||
## GetProjectUsage
|
||||
|
||||
```go
|
||||
package appwrite-getprojectusage
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Projects service passing Client
|
||||
var srv := appwrite.Projects{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call GetProjectUsage method and handle results
|
||||
var res, err := srv.GetProjectUsage("[PROJECT_ID]")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Projects/GetTask.md
Normal file
35
app/sdks/go/docs/examples/Projects/GetTask.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Projects Examples
|
||||
|
||||
## GetTask
|
||||
|
||||
```go
|
||||
package appwrite-gettask
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Projects service passing Client
|
||||
var srv := appwrite.Projects{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call GetTask method and handle results
|
||||
var res, err := srv.GetTask("[PROJECT_ID]", "[TASK_ID]")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Projects/GetWebhook.md
Normal file
35
app/sdks/go/docs/examples/Projects/GetWebhook.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Projects Examples
|
||||
|
||||
## GetWebhook
|
||||
|
||||
```go
|
||||
package appwrite-getwebhook
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Projects service passing Client
|
||||
var srv := appwrite.Projects{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call GetWebhook method and handle results
|
||||
var res, err := srv.GetWebhook("[PROJECT_ID]", "[WEBHOOK_ID]")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Projects/ListKeys.md
Normal file
35
app/sdks/go/docs/examples/Projects/ListKeys.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Projects Examples
|
||||
|
||||
## ListKeys
|
||||
|
||||
```go
|
||||
package appwrite-listkeys
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Projects service passing Client
|
||||
var srv := appwrite.Projects{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call ListKeys method and handle results
|
||||
var res, err := srv.ListKeys("[PROJECT_ID]")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Projects/ListPlatforms.md
Normal file
35
app/sdks/go/docs/examples/Projects/ListPlatforms.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Projects Examples
|
||||
|
||||
## ListPlatforms
|
||||
|
||||
```go
|
||||
package appwrite-listplatforms
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Projects service passing Client
|
||||
var srv := appwrite.Projects{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call ListPlatforms method and handle results
|
||||
var res, err := srv.ListPlatforms("[PROJECT_ID]")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Projects/ListProjects.md
Normal file
35
app/sdks/go/docs/examples/Projects/ListProjects.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Projects Examples
|
||||
|
||||
## ListProjects
|
||||
|
||||
```go
|
||||
package appwrite-listprojects
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Projects service passing Client
|
||||
var srv := appwrite.Projects{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call ListProjects method and handle results
|
||||
var res, err := srv.ListProjects()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Projects/ListTasks.md
Normal file
35
app/sdks/go/docs/examples/Projects/ListTasks.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Projects Examples
|
||||
|
||||
## ListTasks
|
||||
|
||||
```go
|
||||
package appwrite-listtasks
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Projects service passing Client
|
||||
var srv := appwrite.Projects{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call ListTasks method and handle results
|
||||
var res, err := srv.ListTasks("[PROJECT_ID]")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Projects/ListWebhooks.md
Normal file
35
app/sdks/go/docs/examples/Projects/ListWebhooks.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Projects Examples
|
||||
|
||||
## ListWebhooks
|
||||
|
||||
```go
|
||||
package appwrite-listwebhooks
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Projects service passing Client
|
||||
var srv := appwrite.Projects{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call ListWebhooks method and handle results
|
||||
var res, err := srv.ListWebhooks("[PROJECT_ID]")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Projects/UpdateKey.md
Normal file
35
app/sdks/go/docs/examples/Projects/UpdateKey.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Projects Examples
|
||||
|
||||
## UpdateKey
|
||||
|
||||
```go
|
||||
package appwrite-updatekey
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Projects service passing Client
|
||||
var srv := appwrite.Projects{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call UpdateKey method and handle results
|
||||
var res, err := srv.UpdateKey("[PROJECT_ID]", "[KEY_ID]", "[NAME]", [])
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Projects/UpdatePlatform.md
Normal file
35
app/sdks/go/docs/examples/Projects/UpdatePlatform.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Projects Examples
|
||||
|
||||
## UpdatePlatform
|
||||
|
||||
```go
|
||||
package appwrite-updateplatform
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Projects service passing Client
|
||||
var srv := appwrite.Projects{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call UpdatePlatform method and handle results
|
||||
var res, err := srv.UpdatePlatform("[PROJECT_ID]", "[PLATFORM_ID]", "[NAME]")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Projects/UpdateProject.md
Normal file
35
app/sdks/go/docs/examples/Projects/UpdateProject.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Projects Examples
|
||||
|
||||
## UpdateProject
|
||||
|
||||
```go
|
||||
package appwrite-updateproject
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Projects service passing Client
|
||||
var srv := appwrite.Projects{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call UpdateProject method and handle results
|
||||
var res, err := srv.UpdateProject("[PROJECT_ID]", "[NAME]")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Projects/UpdateProjectOAuth.md
Normal file
35
app/sdks/go/docs/examples/Projects/UpdateProjectOAuth.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Projects Examples
|
||||
|
||||
## UpdateProjectOAuth
|
||||
|
||||
```go
|
||||
package appwrite-updateprojectoauth
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Projects service passing Client
|
||||
var srv := appwrite.Projects{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call UpdateProjectOAuth method and handle results
|
||||
var res, err := srv.UpdateProjectOAuth("[PROJECT_ID]", "bitbucket")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Projects/UpdateTask.md
Normal file
35
app/sdks/go/docs/examples/Projects/UpdateTask.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Projects Examples
|
||||
|
||||
## UpdateTask
|
||||
|
||||
```go
|
||||
package appwrite-updatetask
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Projects service passing Client
|
||||
var srv := appwrite.Projects{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call UpdateTask method and handle results
|
||||
var res, err := srv.UpdateTask("[PROJECT_ID]", "[TASK_ID]", "[NAME]", "play", "", 0, "GET", "https://example.com")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Projects/UpdateWebhook.md
Normal file
35
app/sdks/go/docs/examples/Projects/UpdateWebhook.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Projects Examples
|
||||
|
||||
## UpdateWebhook
|
||||
|
||||
```go
|
||||
package appwrite-updatewebhook
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Projects service passing Client
|
||||
var srv := appwrite.Projects{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call UpdateWebhook method and handle results
|
||||
var res, err := srv.UpdateWebhook("[PROJECT_ID]", "[WEBHOOK_ID]", "[NAME]", [], "[URL]", 0)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Storage/CreateFile.md
Normal file
35
app/sdks/go/docs/examples/Storage/CreateFile.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Storage Examples
|
||||
|
||||
## CreateFile
|
||||
|
||||
```go
|
||||
package appwrite-createfile
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Storage service passing Client
|
||||
var srv := appwrite.Storage{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call CreateFile method and handle results
|
||||
var res, err := srv.CreateFile(file)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Storage/DeleteFile.md
Normal file
35
app/sdks/go/docs/examples/Storage/DeleteFile.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Storage Examples
|
||||
|
||||
## DeleteFile
|
||||
|
||||
```go
|
||||
package appwrite-deletefile
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Storage service passing Client
|
||||
var srv := appwrite.Storage{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call DeleteFile method and handle results
|
||||
var res, err := srv.DeleteFile("[FILE_ID]")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Storage/GetFile.md
Normal file
35
app/sdks/go/docs/examples/Storage/GetFile.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Storage Examples
|
||||
|
||||
## GetFile
|
||||
|
||||
```go
|
||||
package appwrite-getfile
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Storage service passing Client
|
||||
var srv := appwrite.Storage{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call GetFile method and handle results
|
||||
var res, err := srv.GetFile("[FILE_ID]")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Storage/GetFileDownload.md
Normal file
35
app/sdks/go/docs/examples/Storage/GetFileDownload.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Storage Examples
|
||||
|
||||
## GetFileDownload
|
||||
|
||||
```go
|
||||
package appwrite-getfiledownload
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Storage service passing Client
|
||||
var srv := appwrite.Storage{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call GetFileDownload method and handle results
|
||||
var res, err := srv.GetFileDownload("[FILE_ID]")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Storage/GetFilePreview.md
Normal file
35
app/sdks/go/docs/examples/Storage/GetFilePreview.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Storage Examples
|
||||
|
||||
## GetFilePreview
|
||||
|
||||
```go
|
||||
package appwrite-getfilepreview
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Storage service passing Client
|
||||
var srv := appwrite.Storage{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call GetFilePreview method and handle results
|
||||
var res, err := srv.GetFilePreview("[FILE_ID]")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Storage/GetFileView.md
Normal file
35
app/sdks/go/docs/examples/Storage/GetFileView.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Storage Examples
|
||||
|
||||
## GetFileView
|
||||
|
||||
```go
|
||||
package appwrite-getfileview
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Storage service passing Client
|
||||
var srv := appwrite.Storage{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call GetFileView method and handle results
|
||||
var res, err := srv.GetFileView("[FILE_ID]")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Storage/ListFiles.md
Normal file
35
app/sdks/go/docs/examples/Storage/ListFiles.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Storage Examples
|
||||
|
||||
## ListFiles
|
||||
|
||||
```go
|
||||
package appwrite-listfiles
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Storage service passing Client
|
||||
var srv := appwrite.Storage{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call ListFiles method and handle results
|
||||
var res, err := srv.ListFiles()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Storage/UpdateFile.md
Normal file
35
app/sdks/go/docs/examples/Storage/UpdateFile.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Storage Examples
|
||||
|
||||
## UpdateFile
|
||||
|
||||
```go
|
||||
package appwrite-updatefile
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Storage service passing Client
|
||||
var srv := appwrite.Storage{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call UpdateFile method and handle results
|
||||
var res, err := srv.UpdateFile("[FILE_ID]")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Teams/CreateTeam.md
Normal file
35
app/sdks/go/docs/examples/Teams/CreateTeam.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Teams Examples
|
||||
|
||||
## CreateTeam
|
||||
|
||||
```go
|
||||
package appwrite-createteam
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Teams service passing Client
|
||||
var srv := appwrite.Teams{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call CreateTeam method and handle results
|
||||
var res, err := srv.CreateTeam("[NAME]")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Teams/CreateTeamMembership.md
Normal file
35
app/sdks/go/docs/examples/Teams/CreateTeamMembership.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Teams Examples
|
||||
|
||||
## CreateTeamMembership
|
||||
|
||||
```go
|
||||
package appwrite-createteammembership
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Teams service passing Client
|
||||
var srv := appwrite.Teams{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call CreateTeamMembership method and handle results
|
||||
var res, err := srv.CreateTeamMembership("[TEAM_ID]", "email@example.com", [], "https://example.com")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
|
@ -0,0 +1,35 @@
|
|||
# Teams Examples
|
||||
|
||||
## CreateTeamMembershipResend
|
||||
|
||||
```go
|
||||
package appwrite-createteammembershipresend
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Teams service passing Client
|
||||
var srv := appwrite.Teams{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call CreateTeamMembershipResend method and handle results
|
||||
var res, err := srv.CreateTeamMembershipResend("[TEAM_ID]", "[INVITE_ID]", "https://example.com")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Teams/DeleteTeam.md
Normal file
35
app/sdks/go/docs/examples/Teams/DeleteTeam.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Teams Examples
|
||||
|
||||
## DeleteTeam
|
||||
|
||||
```go
|
||||
package appwrite-deleteteam
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Teams service passing Client
|
||||
var srv := appwrite.Teams{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call DeleteTeam method and handle results
|
||||
var res, err := srv.DeleteTeam("[TEAM_ID]")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Teams/DeleteTeamMembership.md
Normal file
35
app/sdks/go/docs/examples/Teams/DeleteTeamMembership.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Teams Examples
|
||||
|
||||
## DeleteTeamMembership
|
||||
|
||||
```go
|
||||
package appwrite-deleteteammembership
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Teams service passing Client
|
||||
var srv := appwrite.Teams{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call DeleteTeamMembership method and handle results
|
||||
var res, err := srv.DeleteTeamMembership("[TEAM_ID]", "[INVITE_ID]")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Teams/GetTeam.md
Normal file
35
app/sdks/go/docs/examples/Teams/GetTeam.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Teams Examples
|
||||
|
||||
## GetTeam
|
||||
|
||||
```go
|
||||
package appwrite-getteam
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Teams service passing Client
|
||||
var srv := appwrite.Teams{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call GetTeam method and handle results
|
||||
var res, err := srv.GetTeam("[TEAM_ID]")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Teams/GetTeamMembers.md
Normal file
35
app/sdks/go/docs/examples/Teams/GetTeamMembers.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Teams Examples
|
||||
|
||||
## GetTeamMembers
|
||||
|
||||
```go
|
||||
package appwrite-getteammembers
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Teams service passing Client
|
||||
var srv := appwrite.Teams{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call GetTeamMembers method and handle results
|
||||
var res, err := srv.GetTeamMembers("[TEAM_ID]")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Teams/ListTeams.md
Normal file
35
app/sdks/go/docs/examples/Teams/ListTeams.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Teams Examples
|
||||
|
||||
## ListTeams
|
||||
|
||||
```go
|
||||
package appwrite-listteams
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Teams service passing Client
|
||||
var srv := appwrite.Teams{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call ListTeams method and handle results
|
||||
var res, err := srv.ListTeams()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Teams/UpdateTeam.md
Normal file
35
app/sdks/go/docs/examples/Teams/UpdateTeam.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Teams Examples
|
||||
|
||||
## UpdateTeam
|
||||
|
||||
```go
|
||||
package appwrite-updateteam
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Teams service passing Client
|
||||
var srv := appwrite.Teams{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call UpdateTeam method and handle results
|
||||
var res, err := srv.UpdateTeam("[TEAM_ID]", "[NAME]")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
|
@ -0,0 +1,35 @@
|
|||
# Teams Examples
|
||||
|
||||
## UpdateTeamMembershipStatus
|
||||
|
||||
```go
|
||||
package appwrite-updateteammembershipstatus
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Teams service passing Client
|
||||
var srv := appwrite.Teams{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call UpdateTeamMembershipStatus method and handle results
|
||||
var res, err := srv.UpdateTeamMembershipStatus("[TEAM_ID]", "[INVITE_ID]", "[USER_ID]", "[SECRET]")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Users/CreateUser.md
Normal file
35
app/sdks/go/docs/examples/Users/CreateUser.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Users Examples
|
||||
|
||||
## CreateUser
|
||||
|
||||
```go
|
||||
package appwrite-createuser
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Users service passing Client
|
||||
var srv := appwrite.Users{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call CreateUser method and handle results
|
||||
var res, err := srv.CreateUser("email@example.com", "password")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Users/DeleteUserSession.md
Normal file
35
app/sdks/go/docs/examples/Users/DeleteUserSession.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Users Examples
|
||||
|
||||
## DeleteUserSession
|
||||
|
||||
```go
|
||||
package appwrite-deleteusersession
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Users service passing Client
|
||||
var srv := appwrite.Users{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call DeleteUserSession method and handle results
|
||||
var res, err := srv.DeleteUserSession("[USER_ID]", "[SESSION_ID]")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Users/DeleteUserSessions.md
Normal file
35
app/sdks/go/docs/examples/Users/DeleteUserSessions.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Users Examples
|
||||
|
||||
## DeleteUserSessions
|
||||
|
||||
```go
|
||||
package appwrite-deleteusersessions
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Users service passing Client
|
||||
var srv := appwrite.Users{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call DeleteUserSessions method and handle results
|
||||
var res, err := srv.DeleteUserSessions("[USER_ID]")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Users/GetUser.md
Normal file
35
app/sdks/go/docs/examples/Users/GetUser.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Users Examples
|
||||
|
||||
## GetUser
|
||||
|
||||
```go
|
||||
package appwrite-getuser
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Users service passing Client
|
||||
var srv := appwrite.Users{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call GetUser method and handle results
|
||||
var res, err := srv.GetUser("[USER_ID]")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Users/GetUserLogs.md
Normal file
35
app/sdks/go/docs/examples/Users/GetUserLogs.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Users Examples
|
||||
|
||||
## GetUserLogs
|
||||
|
||||
```go
|
||||
package appwrite-getuserlogs
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Users service passing Client
|
||||
var srv := appwrite.Users{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call GetUserLogs method and handle results
|
||||
var res, err := srv.GetUserLogs("[USER_ID]")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Users/GetUserPrefs.md
Normal file
35
app/sdks/go/docs/examples/Users/GetUserPrefs.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Users Examples
|
||||
|
||||
## GetUserPrefs
|
||||
|
||||
```go
|
||||
package appwrite-getuserprefs
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Users service passing Client
|
||||
var srv := appwrite.Users{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call GetUserPrefs method and handle results
|
||||
var res, err := srv.GetUserPrefs("[USER_ID]")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
35
app/sdks/go/docs/examples/Users/GetUserSessions.md
Normal file
35
app/sdks/go/docs/examples/Users/GetUserSessions.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Users Examples
|
||||
|
||||
## GetUserSessions
|
||||
|
||||
```go
|
||||
package appwrite-getusersessions
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"github.com/appwrite/sdk-for-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a Client
|
||||
var clt := appwrite.Client{}
|
||||
|
||||
// Set Client required headers
|
||||
clt.SetProject("")
|
||||
clt.SetKey("")
|
||||
|
||||
// Create a new Users service passing Client
|
||||
var srv := appwrite.Users{
|
||||
client: &clt
|
||||
}
|
||||
|
||||
// Call GetUserSessions method and handle results
|
||||
var res, err := srv.GetUserSessions("[USER_ID]")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue