1
0
Fork 0
mirror of synced 2024-06-26 18:20:43 +12:00

Updated go templates

This commit is contained in:
Eldad Fux 2020-01-28 23:01:07 +02:00
parent 67468b518f
commit 926079acd4
24 changed files with 97 additions and 67 deletions

View file

@ -9,6 +9,11 @@ type Avatars struct {
client Client
}
func New(client *Client) *Avatars {
service := Avatars{client}
return service
}
// 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
@ -23,7 +28,7 @@ func (srv *Avatars) GetBrowser(Code string, Width int, Height int, Quality int)
"quality": Quality,
}
return srv.client.Call("GET", path, nil, params)
return srv.Client.Call("GET", path, nil, params)
}
// GetCreditCard need to display your users with your billing method or their
@ -40,7 +45,7 @@ func (srv *Avatars) GetCreditCard(Code string, Width int, Height int, Quality in
"quality": Quality,
}
return srv.client.Call("GET", path, nil, params)
return srv.Client.Call("GET", path, nil, params)
}
// GetFavicon use this endpoint to fetch the favorite icon (AKA favicon) of a
@ -52,7 +57,7 @@ func (srv *Avatars) GetFavicon(Url string) (map[string]interface{}, error) {
"url": Url,
}
return srv.client.Call("GET", path, nil, params)
return srv.Client.Call("GET", path, nil, params)
}
// GetFlag you can use this endpoint to show different country flags icons to
@ -68,7 +73,7 @@ func (srv *Avatars) GetFlag(Code string, Width int, Height int, Quality int) (ma
"quality": Quality,
}
return srv.client.Call("GET", path, nil, params)
return srv.Client.Call("GET", path, nil, params)
}
// GetImage use this endpoint to fetch a remote image URL and crop it to any
@ -84,7 +89,7 @@ func (srv *Avatars) GetImage(Url string, Width int, Height int) (map[string]inte
"height": Height,
}
return srv.client.Call("GET", path, nil, params)
return srv.Client.Call("GET", path, nil, params)
}
// GetQR converts a given plain text to a QR code image. You can use the query
@ -99,5 +104,5 @@ func (srv *Avatars) GetQR(Text string, Size int, Margin int, Download int) (map[
"download": Download,
}
return srv.client.Call("GET", path, nil, params)
return srv.Client.Call("GET", path, nil, params)
}

View file

@ -9,6 +9,11 @@ type Database struct {
client Client
}
func New(client *Client) *Database {
service := Database{client}
return service
}
// 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
@ -23,7 +28,7 @@ func (srv *Database) ListCollections(Search string, Limit int, Offset int, Order
"orderType": OrderType,
}
return srv.client.Call("GET", path, nil, params)
return srv.Client.Call("GET", path, nil, params)
}
// CreateCollection create a new Collection.
@ -37,7 +42,7 @@ func (srv *Database) CreateCollection(Name string, Read []interface{}, Write []i
"rules": Rules,
}
return srv.client.Call("POST", path, nil, params)
return srv.Client.Call("POST", path, nil, params)
}
// GetCollection get collection by its unique ID. This endpoint response
@ -49,7 +54,7 @@ func (srv *Database) GetCollection(CollectionId string) (map[string]interface{},
params := map[string]interface{}{
}
return srv.client.Call("GET", path, nil, params)
return srv.Client.Call("GET", path, nil, params)
}
// UpdateCollection update collection by its unique ID.
@ -64,7 +69,7 @@ func (srv *Database) UpdateCollection(CollectionId string, Name string, Read []i
"rules": Rules,
}
return srv.client.Call("PUT", path, nil, params)
return srv.Client.Call("PUT", path, nil, params)
}
// DeleteCollection delete a collection by its unique ID. Only users with
@ -76,7 +81,7 @@ func (srv *Database) DeleteCollection(CollectionId string) (map[string]interface
params := map[string]interface{}{
}
return srv.client.Call("DELETE", path, nil, params)
return srv.Client.Call("DELETE", path, nil, params)
}
// ListDocuments get a list of all the user documents. You can use the query
@ -99,7 +104,7 @@ func (srv *Database) ListDocuments(CollectionId string, Filters []interface{}, O
"last": Last,
}
return srv.client.Call("GET", path, nil, params)
return srv.Client.Call("GET", path, nil, params)
}
// CreateDocument create a new Document.
@ -116,7 +121,7 @@ func (srv *Database) CreateDocument(CollectionId string, Data string, Read []int
"parentPropertyType": ParentPropertyType,
}
return srv.client.Call("POST", path, nil, params)
return srv.Client.Call("POST", path, nil, params)
}
// GetDocument get document by its unique ID. This endpoint response returns a
@ -128,7 +133,7 @@ func (srv *Database) GetDocument(CollectionId string, DocumentId string) (map[st
params := map[string]interface{}{
}
return srv.client.Call("GET", path, nil, params)
return srv.Client.Call("GET", path, nil, params)
}
// UpdateDocument
@ -142,7 +147,7 @@ func (srv *Database) UpdateDocument(CollectionId string, DocumentId string, Data
"write": Write,
}
return srv.client.Call("PATCH", path, nil, params)
return srv.Client.Call("PATCH", path, nil, params)
}
// DeleteDocument delete document by its unique ID. This endpoint deletes only
@ -155,5 +160,5 @@ func (srv *Database) DeleteDocument(CollectionId string, DocumentId string) (map
params := map[string]interface{}{
}
return srv.client.Call("DELETE", path, nil, params)
return srv.Client.Call("DELETE", path, nil, params)
}

View file

@ -15,7 +15,7 @@ func main() {
client: &client
}
var response, error := service.GetBrowser("aa")
var response, error := service.GetBrowser("aa", 0, 0, 0)
if error != nil {
panic(error)

View file

@ -15,7 +15,7 @@ func main() {
client: &client
}
var response, error := service.GetCreditCard("amex")
var response, error := service.GetCreditCard("amex", 0, 0, 0)
if error != nil {
panic(error)

View file

@ -15,7 +15,7 @@ func main() {
client: &client
}
var response, error := service.GetFlag("af")
var response, error := service.GetFlag("af", 0, 0, 0)
if error != nil {
panic(error)

View file

@ -15,7 +15,7 @@ func main() {
client: &client
}
var response, error := service.GetImage("https://example.com")
var response, error := service.GetImage("https://example.com", 0, 0)
if error != nil {
panic(error)

View file

@ -15,7 +15,7 @@ func main() {
client: &client
}
var response, error := service.GetQR("[TEXT]")
var response, error := service.GetQR("[TEXT]", 0, 0, 0)
if error != nil {
panic(error)

View file

@ -15,7 +15,7 @@ func main() {
client: &client
}
var response, error := service.CreateDocument("[COLLECTION_ID]", "{}", [], [])
var response, error := service.CreateDocument("[COLLECTION_ID]", "{}", [], [], "[PARENT_DOCUMENT]", "", "assign")
if error != nil {
panic(error)

View file

@ -15,7 +15,7 @@ func main() {
client: &client
}
var response, error := service.ListCollections()
var response, error := service.ListCollections("[SEARCH]", 0, 0, "ASC")
if error != nil {
panic(error)

View file

@ -15,7 +15,7 @@ func main() {
client: &client
}
var response, error := service.ListDocuments("[COLLECTION_ID]")
var response, error := service.ListDocuments("[COLLECTION_ID]", [], 0, 0, "[ORDER_FIELD]", "DESC", "int", "[SEARCH]", 0, 0)
if error != nil {
panic(error)

View file

@ -15,7 +15,7 @@ func main() {
client: &client
}
var response, error := service.UpdateCollection("[COLLECTION_ID]", "[NAME]", [], [])
var response, error := service.UpdateCollection("[COLLECTION_ID]", "[NAME]", [], [], [])
if error != nil {
panic(error)

View file

@ -15,7 +15,7 @@ func main() {
client: &client
}
var response, error := service.GetFilePreview("[FILE_ID]")
var response, error := service.GetFilePreview("[FILE_ID]", 0, 0, 0, "", "jpg")
if error != nil {
panic(error)

View file

@ -15,7 +15,7 @@ func main() {
client: &client
}
var response, error := service.GetFileView("[FILE_ID]")
var response, error := service.GetFileView("[FILE_ID]", "pdf")
if error != nil {
panic(error)

View file

@ -15,7 +15,7 @@ func main() {
client: &client
}
var response, error := service.ListFiles()
var response, error := service.ListFiles("[SEARCH]", 0, 0, "ASC")
if error != nil {
panic(error)

View file

@ -15,7 +15,7 @@ func main() {
client: &client
}
var response, error := service.CreateTeamMembership("[TEAM_ID]", "email@example.com", [], "https://example.com")
var response, error := service.CreateTeamMembership("[TEAM_ID]", "email@example.com", [], "https://example.com", "[NAME]")
if error != nil {
panic(error)

View file

@ -15,7 +15,7 @@ func main() {
client: &client
}
var response, error := service.CreateTeam("[NAME]")
var response, error := service.CreateTeam("[NAME]", [])
if error != nil {
panic(error)

View file

@ -15,7 +15,7 @@ func main() {
client: &client
}
var response, error := service.ListTeams()
var response, error := service.ListTeams("[SEARCH]", 0, 0, "ASC")
if error != nil {
panic(error)

View file

@ -15,7 +15,7 @@ func main() {
client: &client
}
var response, error := service.CreateUser("email@example.com", "password")
var response, error := service.CreateUser("email@example.com", "password", "[NAME]")
if error != nil {
panic(error)

View file

@ -15,7 +15,7 @@ func main() {
client: &client
}
var response, error := service.ListUsers()
var response, error := service.ListUsers("[SEARCH]", 0, 0, "ASC")
if error != nil {
panic(error)

View file

@ -8,6 +8,11 @@ type Locale struct {
client Client
}
func New(client *Client) *Locale {
service := Locale{client}
return service
}
// GetLocale get the current user location based on IP. Returns an object with
// user country code, country name, continent name, continent code, ip address
// and suggested currency. You can use the locale header to get the data in a
@ -20,7 +25,7 @@ func (srv *Locale) GetLocale() (map[string]interface{}, error) {
params := map[string]interface{}{
}
return srv.client.Call("GET", path, nil, params)
return srv.Client.Call("GET", path, nil, params)
}
// GetContinents list of all continents. You can use the locale header to get
@ -31,7 +36,7 @@ func (srv *Locale) GetContinents() (map[string]interface{}, error) {
params := map[string]interface{}{
}
return srv.client.Call("GET", path, nil, params)
return srv.Client.Call("GET", path, nil, params)
}
// GetCountries list of all countries. You can use the locale header to get
@ -42,7 +47,7 @@ func (srv *Locale) GetCountries() (map[string]interface{}, error) {
params := map[string]interface{}{
}
return srv.client.Call("GET", path, nil, params)
return srv.Client.Call("GET", path, nil, params)
}
// GetCountriesEU list of all countries that are currently members of the EU.
@ -53,7 +58,7 @@ func (srv *Locale) GetCountriesEU() (map[string]interface{}, error) {
params := map[string]interface{}{
}
return srv.client.Call("GET", path, nil, params)
return srv.Client.Call("GET", path, nil, params)
}
// GetCountriesPhones list of all countries phone codes. You can use the
@ -64,7 +69,7 @@ func (srv *Locale) GetCountriesPhones() (map[string]interface{}, error) {
params := map[string]interface{}{
}
return srv.client.Call("GET", path, nil, params)
return srv.Client.Call("GET", path, nil, params)
}
// GetCurrencies list of all currencies, including currency symol, name,
@ -76,5 +81,5 @@ func (srv *Locale) GetCurrencies() (map[string]interface{}, error) {
params := map[string]interface{}{
}
return srv.client.Call("GET", path, nil, params)
return srv.Client.Call("GET", path, nil, params)
}

View file

@ -9,6 +9,11 @@ type Storage struct {
client Client
}
func New(client *Client) *Storage {
service := Storage{client}
return service
}
// ListFiles get a list of all the user files. You can use the query params to
// filter your results. On admin mode, this endpoint will return a list of all
// of the project files. [Learn more about different API modes](/docs/admin).
@ -22,7 +27,7 @@ func (srv *Storage) ListFiles(Search string, Limit int, Offset int, OrderType st
"orderType": OrderType,
}
return srv.client.Call("GET", path, nil, params)
return srv.Client.Call("GET", path, nil, params)
}
// CreateFile create a new file. The user who creates the file will
@ -37,7 +42,7 @@ func (srv *Storage) CreateFile(File string, Read []interface{}, Write []interfac
"write": Write,
}
return srv.client.Call("POST", path, nil, params)
return srv.Client.Call("POST", path, nil, params)
}
// GetFile get file by its unique ID. This endpoint response returns a JSON
@ -49,7 +54,7 @@ func (srv *Storage) GetFile(FileId string) (map[string]interface{}, error) {
params := map[string]interface{}{
}
return srv.client.Call("GET", path, nil, params)
return srv.Client.Call("GET", path, nil, params)
}
// UpdateFile update file by its unique ID. Only users with write permissions
@ -63,7 +68,7 @@ func (srv *Storage) UpdateFile(FileId string, Read []interface{}, Write []interf
"write": Write,
}
return srv.client.Call("PUT", path, nil, params)
return srv.Client.Call("PUT", path, nil, params)
}
// DeleteFile delete a file by its unique ID. Only users with write
@ -75,7 +80,7 @@ func (srv *Storage) DeleteFile(FileId string) (map[string]interface{}, error) {
params := map[string]interface{}{
}
return srv.client.Call("DELETE", path, nil, params)
return srv.Client.Call("DELETE", path, nil, params)
}
// GetFileDownload get file content by its unique ID. The endpoint response
@ -88,7 +93,7 @@ func (srv *Storage) GetFileDownload(FileId string) (map[string]interface{}, erro
params := map[string]interface{}{
}
return srv.client.Call("GET", path, nil, params)
return srv.Client.Call("GET", path, nil, params)
}
// GetFilePreview get a file preview image. Currently, this method supports
@ -108,7 +113,7 @@ func (srv *Storage) GetFilePreview(FileId string, Width int, Height int, Quality
"output": Output,
}
return srv.client.Call("GET", path, nil, params)
return srv.Client.Call("GET", path, nil, params)
}
// GetFileView get file content by its unique ID. This endpoint is similar to
@ -122,5 +127,5 @@ func (srv *Storage) GetFileView(FileId string, As string) (map[string]interface{
"as": As,
}
return srv.client.Call("GET", path, nil, params)
return srv.Client.Call("GET", path, nil, params)
}

View file

@ -9,6 +9,11 @@ type Teams struct {
client Client
}
func New(client *Client) *Teams {
service := Teams{client}
return service
}
// ListTeams get a list of all the current user teams. You can use the query
// params to filter your results. On admin mode, this endpoint will return a
// list of all of the project teams. [Learn more about different API
@ -23,7 +28,7 @@ func (srv *Teams) ListTeams(Search string, Limit int, Offset int, OrderType stri
"orderType": OrderType,
}
return srv.client.Call("GET", path, nil, params)
return srv.Client.Call("GET", path, nil, params)
}
// CreateTeam create a new team. The user who creates the team will
@ -38,7 +43,7 @@ func (srv *Teams) CreateTeam(Name string, Roles []interface{}) (map[string]inter
"roles": Roles,
}
return srv.client.Call("POST", path, nil, params)
return srv.Client.Call("POST", path, nil, params)
}
// GetTeam get team by its unique ID. All team members have read access for
@ -50,7 +55,7 @@ func (srv *Teams) GetTeam(TeamId string) (map[string]interface{}, error) {
params := map[string]interface{}{
}
return srv.client.Call("GET", path, nil, params)
return srv.Client.Call("GET", path, nil, params)
}
// UpdateTeam update team by its unique ID. Only team owners have write access
@ -63,7 +68,7 @@ func (srv *Teams) UpdateTeam(TeamId string, Name string) (map[string]interface{}
"name": Name,
}
return srv.client.Call("PUT", path, nil, params)
return srv.Client.Call("PUT", path, nil, params)
}
// DeleteTeam delete team by its unique ID. Only team owners have write access
@ -75,7 +80,7 @@ func (srv *Teams) DeleteTeam(TeamId string) (map[string]interface{}, error) {
params := map[string]interface{}{
}
return srv.client.Call("DELETE", path, nil, params)
return srv.Client.Call("DELETE", path, nil, params)
}
// GetTeamMemberships get team members by the team unique ID. All team members
@ -87,7 +92,7 @@ func (srv *Teams) GetTeamMemberships(TeamId string) (map[string]interface{}, err
params := map[string]interface{}{
}
return srv.client.Call("GET", path, nil, params)
return srv.Client.Call("GET", path, nil, params)
}
// CreateTeamMembership use this endpoint to invite a new member to your team.
@ -115,7 +120,7 @@ func (srv *Teams) CreateTeamMembership(TeamId string, Email string, Roles []inte
"url": Url,
}
return srv.client.Call("POST", path, nil, params)
return srv.Client.Call("POST", path, nil, params)
}
// DeleteTeamMembership this endpoint allows a user to leave a team or for a
@ -128,5 +133,5 @@ func (srv *Teams) DeleteTeamMembership(TeamId string, InviteId string) (map[stri
params := map[string]interface{}{
}
return srv.client.Call("DELETE", path, nil, params)
return srv.Client.Call("DELETE", path, nil, params)
}

View file

@ -9,6 +9,11 @@ type Users struct {
client Client
}
func New(client *Client) *Users {
service := Users{client}
return service
}
// ListUsers get a list of all the project users. You can use the query params
// to filter your results.
func (srv *Users) ListUsers(Search string, Limit int, Offset int, OrderType string) (map[string]interface{}, error) {
@ -21,7 +26,7 @@ func (srv *Users) ListUsers(Search string, Limit int, Offset int, OrderType stri
"orderType": OrderType,
}
return srv.client.Call("GET", path, nil, params)
return srv.Client.Call("GET", path, nil, params)
}
// CreateUser create a new user.
@ -34,7 +39,7 @@ func (srv *Users) CreateUser(Email string, Password string, Name string) (map[st
"name": Name,
}
return srv.client.Call("POST", path, nil, params)
return srv.Client.Call("POST", path, nil, params)
}
// GetUser get user by its unique ID.
@ -45,7 +50,7 @@ func (srv *Users) GetUser(UserId string) (map[string]interface{}, error) {
params := map[string]interface{}{
}
return srv.client.Call("GET", path, nil, params)
return srv.Client.Call("GET", path, nil, params)
}
// GetUserLogs get user activity logs list by its unique ID.
@ -56,7 +61,7 @@ func (srv *Users) GetUserLogs(UserId string) (map[string]interface{}, error) {
params := map[string]interface{}{
}
return srv.client.Call("GET", path, nil, params)
return srv.Client.Call("GET", path, nil, params)
}
// GetUserPrefs get user preferences by its unique ID.
@ -67,7 +72,7 @@ func (srv *Users) GetUserPrefs(UserId string) (map[string]interface{}, error) {
params := map[string]interface{}{
}
return srv.client.Call("GET", path, nil, params)
return srv.Client.Call("GET", path, nil, params)
}
// UpdateUserPrefs update user preferences by its unique ID. You can pass only
@ -80,7 +85,7 @@ func (srv *Users) UpdateUserPrefs(UserId string, Prefs string) (map[string]inter
"prefs": Prefs,
}
return srv.client.Call("PATCH", path, nil, params)
return srv.Client.Call("PATCH", path, nil, params)
}
// GetUserSessions get user sessions list by its unique ID.
@ -91,7 +96,7 @@ func (srv *Users) GetUserSessions(UserId string) (map[string]interface{}, error)
params := map[string]interface{}{
}
return srv.client.Call("GET", path, nil, params)
return srv.Client.Call("GET", path, nil, params)
}
// DeleteUserSessions delete all user sessions by its unique ID.
@ -102,7 +107,7 @@ func (srv *Users) DeleteUserSessions(UserId string) (map[string]interface{}, err
params := map[string]interface{}{
}
return srv.client.Call("DELETE", path, nil, params)
return srv.Client.Call("DELETE", path, nil, params)
}
// DeleteUserSession delete user sessions by its unique ID.
@ -114,7 +119,7 @@ func (srv *Users) DeleteUserSession(UserId string, SessionId string) (map[string
"sessionId": SessionId,
}
return srv.client.Call("DELETE", path, nil, params)
return srv.Client.Call("DELETE", path, nil, params)
}
// UpdateUserStatus update user status by its unique ID.
@ -126,5 +131,5 @@ func (srv *Users) UpdateUserStatus(UserId string, Status string) (map[string]int
"status": Status,
}
return srv.client.Call("PATCH", path, nil, params)
return srv.Client.Call("PATCH", path, nil, params)
}

4
composer.lock generated
View file

@ -1526,7 +1526,7 @@
"source": {
"type": "git",
"url": "https://github.com/appwrite/sdk-generator",
"reference": "6dc240f55ef5cfe99563899dadd0d63afe882f00"
"reference": "590cd29f649869dcbe431c5784bd1483f195e2ec"
},
"require": {
"ext-curl": "*",
@ -1556,7 +1556,7 @@
}
],
"description": "Appwrite PHP library for generating API SDKs for multiple programming languages and platforms",
"time": "2020-01-28T20:20:14+00:00"
"time": "2020-01-28T20:57:54+00:00"
},
{
"name": "doctrine/instantiator",