From 926079acd49947bcf6c916203e68d22023403def Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Tue, 28 Jan 2020 23:01:07 +0200 Subject: [PATCH] Updated go templates --- app/sdks/go/avatars.go | 17 ++++++++----- app/sdks/go/database.go | 25 +++++++++++-------- .../go/docs/examples/avatars/get-browser.md | 2 +- .../docs/examples/avatars/get-credit-card.md | 2 +- app/sdks/go/docs/examples/avatars/get-flag.md | 2 +- .../go/docs/examples/avatars/get-image.md | 2 +- app/sdks/go/docs/examples/avatars/get-q-r.md | 2 +- .../docs/examples/database/create-document.md | 2 +- .../examples/database/list-collections.md | 2 +- .../docs/examples/database/list-documents.md | 2 +- .../examples/database/update-collection.md | 2 +- .../docs/examples/storage/get-file-preview.md | 2 +- .../go/docs/examples/storage/get-file-view.md | 2 +- .../go/docs/examples/storage/list-files.md | 2 +- .../examples/teams/create-team-membership.md | 2 +- .../go/docs/examples/teams/create-team.md | 2 +- app/sdks/go/docs/examples/teams/list-teams.md | 2 +- .../go/docs/examples/users/create-user.md | 2 +- app/sdks/go/docs/examples/users/list-users.md | 2 +- app/sdks/go/locale.go | 17 ++++++++----- app/sdks/go/storage.go | 21 ++++++++++------ app/sdks/go/teams.go | 21 ++++++++++------ app/sdks/go/users.go | 25 +++++++++++-------- composer.lock | 4 +-- 24 files changed, 97 insertions(+), 67 deletions(-) diff --git a/app/sdks/go/avatars.go b/app/sdks/go/avatars.go index 6e7e2961bf..bf2d394105 100644 --- a/app/sdks/go/avatars.go +++ b/app/sdks/go/avatars.go @@ -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) } diff --git a/app/sdks/go/database.go b/app/sdks/go/database.go index 48263a2e5e..f10a520d5a 100644 --- a/app/sdks/go/database.go +++ b/app/sdks/go/database.go @@ -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) } diff --git a/app/sdks/go/docs/examples/avatars/get-browser.md b/app/sdks/go/docs/examples/avatars/get-browser.md index 4400222e7e..085dd03757 100644 --- a/app/sdks/go/docs/examples/avatars/get-browser.md +++ b/app/sdks/go/docs/examples/avatars/get-browser.md @@ -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) diff --git a/app/sdks/go/docs/examples/avatars/get-credit-card.md b/app/sdks/go/docs/examples/avatars/get-credit-card.md index 563db7c957..8191559d79 100644 --- a/app/sdks/go/docs/examples/avatars/get-credit-card.md +++ b/app/sdks/go/docs/examples/avatars/get-credit-card.md @@ -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) diff --git a/app/sdks/go/docs/examples/avatars/get-flag.md b/app/sdks/go/docs/examples/avatars/get-flag.md index 546a90e85f..d2d852ac28 100644 --- a/app/sdks/go/docs/examples/avatars/get-flag.md +++ b/app/sdks/go/docs/examples/avatars/get-flag.md @@ -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) diff --git a/app/sdks/go/docs/examples/avatars/get-image.md b/app/sdks/go/docs/examples/avatars/get-image.md index 0444c9a588..9d519436bc 100644 --- a/app/sdks/go/docs/examples/avatars/get-image.md +++ b/app/sdks/go/docs/examples/avatars/get-image.md @@ -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) diff --git a/app/sdks/go/docs/examples/avatars/get-q-r.md b/app/sdks/go/docs/examples/avatars/get-q-r.md index c04a3ba850..d23d83782f 100644 --- a/app/sdks/go/docs/examples/avatars/get-q-r.md +++ b/app/sdks/go/docs/examples/avatars/get-q-r.md @@ -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) diff --git a/app/sdks/go/docs/examples/database/create-document.md b/app/sdks/go/docs/examples/database/create-document.md index 66753a4b69..64abf25349 100644 --- a/app/sdks/go/docs/examples/database/create-document.md +++ b/app/sdks/go/docs/examples/database/create-document.md @@ -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) diff --git a/app/sdks/go/docs/examples/database/list-collections.md b/app/sdks/go/docs/examples/database/list-collections.md index f781fc78ca..dbb5d68ac2 100644 --- a/app/sdks/go/docs/examples/database/list-collections.md +++ b/app/sdks/go/docs/examples/database/list-collections.md @@ -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) diff --git a/app/sdks/go/docs/examples/database/list-documents.md b/app/sdks/go/docs/examples/database/list-documents.md index 171b7d25c2..f842f46e3a 100644 --- a/app/sdks/go/docs/examples/database/list-documents.md +++ b/app/sdks/go/docs/examples/database/list-documents.md @@ -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) diff --git a/app/sdks/go/docs/examples/database/update-collection.md b/app/sdks/go/docs/examples/database/update-collection.md index c0bfea1163..9ec0b1c20d 100644 --- a/app/sdks/go/docs/examples/database/update-collection.md +++ b/app/sdks/go/docs/examples/database/update-collection.md @@ -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) diff --git a/app/sdks/go/docs/examples/storage/get-file-preview.md b/app/sdks/go/docs/examples/storage/get-file-preview.md index aa80c7cf0f..6ee4a129cb 100644 --- a/app/sdks/go/docs/examples/storage/get-file-preview.md +++ b/app/sdks/go/docs/examples/storage/get-file-preview.md @@ -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) diff --git a/app/sdks/go/docs/examples/storage/get-file-view.md b/app/sdks/go/docs/examples/storage/get-file-view.md index ba8fa9b020..2a444aa6a5 100644 --- a/app/sdks/go/docs/examples/storage/get-file-view.md +++ b/app/sdks/go/docs/examples/storage/get-file-view.md @@ -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) diff --git a/app/sdks/go/docs/examples/storage/list-files.md b/app/sdks/go/docs/examples/storage/list-files.md index ba59152eb9..78cf9379a3 100644 --- a/app/sdks/go/docs/examples/storage/list-files.md +++ b/app/sdks/go/docs/examples/storage/list-files.md @@ -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) diff --git a/app/sdks/go/docs/examples/teams/create-team-membership.md b/app/sdks/go/docs/examples/teams/create-team-membership.md index 242bc06ee1..0cc0e4c379 100644 --- a/app/sdks/go/docs/examples/teams/create-team-membership.md +++ b/app/sdks/go/docs/examples/teams/create-team-membership.md @@ -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) diff --git a/app/sdks/go/docs/examples/teams/create-team.md b/app/sdks/go/docs/examples/teams/create-team.md index c859919c65..27aea5d2f5 100644 --- a/app/sdks/go/docs/examples/teams/create-team.md +++ b/app/sdks/go/docs/examples/teams/create-team.md @@ -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) diff --git a/app/sdks/go/docs/examples/teams/list-teams.md b/app/sdks/go/docs/examples/teams/list-teams.md index abd0e9cd00..cf7e13f6a1 100644 --- a/app/sdks/go/docs/examples/teams/list-teams.md +++ b/app/sdks/go/docs/examples/teams/list-teams.md @@ -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) diff --git a/app/sdks/go/docs/examples/users/create-user.md b/app/sdks/go/docs/examples/users/create-user.md index 1ce7639b73..098d65800a 100644 --- a/app/sdks/go/docs/examples/users/create-user.md +++ b/app/sdks/go/docs/examples/users/create-user.md @@ -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) diff --git a/app/sdks/go/docs/examples/users/list-users.md b/app/sdks/go/docs/examples/users/list-users.md index 64d241faf2..a77f46f225 100644 --- a/app/sdks/go/docs/examples/users/list-users.md +++ b/app/sdks/go/docs/examples/users/list-users.md @@ -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) diff --git a/app/sdks/go/locale.go b/app/sdks/go/locale.go index a79bddcbad..2b4813bbdc 100644 --- a/app/sdks/go/locale.go +++ b/app/sdks/go/locale.go @@ -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) } diff --git a/app/sdks/go/storage.go b/app/sdks/go/storage.go index 0f3bf55d03..b1fe2192f3 100644 --- a/app/sdks/go/storage.go +++ b/app/sdks/go/storage.go @@ -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) } diff --git a/app/sdks/go/teams.go b/app/sdks/go/teams.go index b79452237c..97b73d1985 100644 --- a/app/sdks/go/teams.go +++ b/app/sdks/go/teams.go @@ -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) } diff --git a/app/sdks/go/users.go b/app/sdks/go/users.go index cb4f728566..671f1ed7fa 100644 --- a/app/sdks/go/users.go +++ b/app/sdks/go/users.go @@ -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) } diff --git a/composer.lock b/composer.lock index bdc81ca724..2ece8e9ede 100644 --- a/composer.lock +++ b/composer.lock @@ -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",