From 6a2cd89df10f1c350cdb5aaf86d7c0839f1d7da1 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Fri, 5 Jun 2026 14:06:14 +0530 Subject: [PATCH 1/2] chore: update Go SDK to v5.1.0 --- CHANGELOG.md | 12 +- account/account.go | 54 +++ activities/activities.go | 2 + advisor/advisor.go | 5 + appwrite/appwrite.go | 12 +- avatars/avatars.go | 8 + backups/backups.go | 12 + client/client.go | 6 +- databases/databases.go | 71 +++ docs/examples/account/update-password.md | 2 +- docs/examples/health/get-audits-db.md | 19 + .../examples/messaging/create-ses-provider.md | 30 ++ .../examples/messaging/update-ses-provider.md | 30 ++ .../project/update-o-auth-2-server.md | 28 ++ .../update-password-strength-policy.md | 25 + functions/functions.go | 26 + graphql/graphql.go | 2 + health/health.go | 59 +++ health/health_test.go | 33 ++ locale/locale.go | 8 + messaging/messaging.go | 341 +++++++++++++ messaging/messaging_test.go | 66 +++ models/oAuth2Amazon_test.go | 2 +- models/oAuth2Auth0_test.go | 2 +- models/oAuth2Authentik_test.go | 2 +- models/oAuth2Autodesk_test.go | 2 +- models/oAuth2Bitbucket_test.go | 2 +- models/oAuth2Bitly_test.go | 2 +- models/oAuth2Box_test.go | 2 +- models/oAuth2Dailymotion_test.go | 2 +- models/oAuth2Discord_test.go | 2 +- models/oAuth2Disqus_test.go | 2 +- models/oAuth2Dropbox_test.go | 2 +- models/oAuth2Etsy_test.go | 2 +- models/oAuth2Facebook_test.go | 2 +- models/oAuth2Figma_test.go | 2 +- models/oAuth2FusionAuth_test.go | 2 +- models/oAuth2Github_test.go | 2 +- models/oAuth2Gitlab_test.go | 2 +- models/oAuth2Google_test.go | 2 +- models/oAuth2Keycloak_test.go | 2 +- models/oAuth2Kick_test.go | 2 +- models/oAuth2Linkedin_test.go | 2 +- models/oAuth2Microsoft_test.go | 2 +- models/oAuth2Notion_test.go | 2 +- models/oAuth2Oidc_test.go | 2 +- models/oAuth2Okta_test.go | 2 +- models/oAuth2Paypal_test.go | 2 +- models/oAuth2Podio_test.go | 2 +- models/oAuth2Salesforce_test.go | 2 +- models/oAuth2Slack_test.go | 2 +- models/oAuth2Spotify_test.go | 2 +- models/oAuth2Stripe_test.go | 2 +- models/oAuth2Tradeshift_test.go | 2 +- models/oAuth2Twitch_test.go | 2 +- models/oAuth2WordPress_test.go | 2 +- models/oAuth2X_test.go | 2 +- models/oAuth2Yahoo_test.go | 2 +- models/oAuth2Yandex_test.go | 2 +- models/oAuth2Zoho_test.go | 2 +- models/oAuth2Zoom_test.go | 2 +- models/policyList_test.go | 2 +- models/policyPasswordStrength.go | 43 ++ models/policyPasswordStrength_test.go | 38 ++ models/project.go | 30 +- models/projectList_test.go | 6 +- models/project_test.go | 36 +- organization/organization.go | 10 + organization/organization_test.go | 52 +- presences/presences.go | 5 + project/project.go | 324 +++++++++++++ project/project_test.go | 448 +++++++++++++++--- proxy/proxy.go | 8 + sites/sites.go | 25 + storage/storage.go | 13 + tablesdb/tables_db.go | 71 +++ teams/teams.go | 13 + tokens/tokens.go | 5 + usage/usage.go | 2 + users/users.go | 49 ++ webhooks/webhooks.go | 6 + 81 files changed, 1970 insertions(+), 145 deletions(-) create mode 100644 docs/examples/health/get-audits-db.md create mode 100644 docs/examples/messaging/create-ses-provider.md create mode 100644 docs/examples/messaging/update-ses-provider.md create mode 100644 docs/examples/project/update-o-auth-2-server.md create mode 100644 docs/examples/project/update-password-strength-policy.md create mode 100644 models/policyPasswordStrength.go create mode 100644 models/policyPasswordStrength_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 935a351d..1e48fc15 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ # Change Log +## v5.1.0 + +* Added: `createSesProvider` and `updateSesProvider` to `messaging` +* Added: `updateOAuth2Server` to `project` for OAuth2 server settings +* Added: `updatePasswordStrengthPolicy` and `PolicyPasswordStrength` to `project` +* Added: `getAuditsDB` health check to `health` +* Added: `password-strength` to `ProjectPolicyId` +* Added: `apps.read` and `apps.write` to `ProjectKeyScopes` + + ## v5.0.0 * Breaking: Removed `githubImagine` and `googleImagine` from `ProjectOAuthProviderId` @@ -8,7 +18,7 @@ * Added: `Organization` service for managing projects and API keys * Added: `PolicyDenyAliasedEmail`, `PolicyDenyDisposableEmail`, and `PolicyDenyFreeEmail` policy models * Added: `deny-aliased-email`, `deny-disposable-email`, and `deny-free-email` to `ProjectPolicyId` -* Added: `BrowserTheme`, `HealthQueueName`, `OrganizationKeyScopes`, and `Region` enums +* Replaced: `BrowserTheme`, `HealthQueueName`, `OrganizationKeyScopes`, and `Region` enums * Added: `dart-3.12` and `flutter-3.44` runtimes * Added: `ProjectList` model and new attributes on `Function`, `Site`, and `UsageGauge` * Updated: `functions`, `sites`, `usage`, `health`, and `avatars` services diff --git a/account/account.go b/account/account.go index 145a7d13..25bdbc89 100644 --- a/account/account.go +++ b/account/account.go @@ -25,6 +25,7 @@ func (srv *Account) Get()(*models.User, error) { path := "/account" params := map[string]interface{}{} headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -90,6 +91,7 @@ func (srv *Account) Create(UserId string, Email string, Password string, optiona params["name"] = options.Name } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -131,6 +133,7 @@ func (srv *Account) UpdateEmail(Email string, Password string)(*models.User, err params["email"] = Email params["password"] = Password headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -199,6 +202,7 @@ func (srv *Account) ListIdentities(optionalSetters ...ListIdentitiesOption)(*mod params["total"] = options.Total } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -233,6 +237,7 @@ func (srv *Account) DeleteIdentity(IdentityId string)(*interface{}, error) { params := map[string]interface{}{} params["identityId"] = IdentityId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -293,6 +298,7 @@ func (srv *Account) CreateJWT(optionalSetters ...CreateJWTOption)(*models.Jwt, e params["duration"] = options.Duration } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -363,6 +369,7 @@ func (srv *Account) ListLogs(optionalSetters ...ListLogsOption)(*models.LogList, params["total"] = options.Total } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -396,6 +403,7 @@ func (srv *Account) UpdateMFA(Mfa bool)(*models.User, error) { params := map[string]interface{}{} params["mfa"] = Mfa headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -436,6 +444,7 @@ func (srv *Account) CreateMfaAuthenticator(Type string)(*models.MfaType, error) params := map[string]interface{}{} params["type"] = Type headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -474,6 +483,7 @@ func (srv *Account) CreateMFAAuthenticator(Type string)(*models.MfaType, error) params := map[string]interface{}{} params["type"] = Type headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -515,6 +525,7 @@ func (srv *Account) UpdateMfaAuthenticator(Type string, Otp string)(*models.User params["type"] = Type params["otp"] = Otp headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -554,6 +565,7 @@ func (srv *Account) UpdateMFAAuthenticator(Type string, Otp string)(*models.User params["type"] = Type params["otp"] = Otp headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -591,6 +603,7 @@ func (srv *Account) DeleteMfaAuthenticator(Type string)(*interface{}, error) { params := map[string]interface{}{} params["type"] = Type headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -625,6 +638,7 @@ func (srv *Account) DeleteMFAAuthenticator(Type string)(*interface{}, error) { params := map[string]interface{}{} params["type"] = Type headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -663,6 +677,7 @@ func (srv *Account) CreateMfaChallenge(Factor string)(*models.MfaChallenge, erro params := map[string]interface{}{} params["factor"] = Factor headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -700,6 +715,7 @@ func (srv *Account) CreateMFAChallenge(Factor string)(*models.MfaChallenge, erro params := map[string]interface{}{} params["factor"] = Factor headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -741,6 +757,7 @@ func (srv *Account) UpdateMfaChallenge(ChallengeId string, Otp string)(*models.S params["challengeId"] = ChallengeId params["otp"] = Otp headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -780,6 +797,7 @@ func (srv *Account) UpdateMFAChallenge(ChallengeId string, Otp string)(*models.S params["challengeId"] = ChallengeId params["otp"] = Otp headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -816,6 +834,7 @@ func (srv *Account) ListMfaFactors()(*models.MfaFactors, error) { path := "/account/mfa/factors" params := map[string]interface{}{} headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -849,6 +868,7 @@ func (srv *Account) ListMFAFactors()(*models.MfaFactors, error) { path := "/account/mfa/factors" params := map[string]interface{}{} headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -886,6 +906,7 @@ func (srv *Account) GetMfaRecoveryCodes()(*models.MfaRecoveryCodes, error) { path := "/account/mfa/recovery-codes" params := map[string]interface{}{} headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -921,6 +942,7 @@ func (srv *Account) GetMFARecoveryCodes()(*models.MfaRecoveryCodes, error) { path := "/account/mfa/recovery-codes" params := map[string]interface{}{} headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -960,6 +982,7 @@ func (srv *Account) CreateMfaRecoveryCodes()(*models.MfaRecoveryCodes, error) { path := "/account/mfa/recovery-codes" params := map[string]interface{}{} headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -998,6 +1021,7 @@ func (srv *Account) CreateMFARecoveryCodes()(*models.MfaRecoveryCodes, error) { path := "/account/mfa/recovery-codes" params := map[string]interface{}{} headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1036,6 +1060,7 @@ func (srv *Account) UpdateMfaRecoveryCodes()(*models.MfaRecoveryCodes, error) { path := "/account/mfa/recovery-codes" params := map[string]interface{}{} headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1072,6 +1097,7 @@ func (srv *Account) UpdateMFARecoveryCodes()(*models.MfaRecoveryCodes, error) { path := "/account/mfa/recovery-codes" params := map[string]interface{}{} headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1106,6 +1132,7 @@ func (srv *Account) UpdateName(Name string)(*models.User, error) { params := map[string]interface{}{} params["name"] = Name headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1167,6 +1194,7 @@ func (srv *Account) UpdatePassword(Password string, optionalSetters ...UpdatePas params["oldPassword"] = options.OldPassword } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1206,6 +1234,7 @@ func (srv *Account) UpdatePhone(Phone string, Password string)(*models.User, err params["phone"] = Phone params["password"] = Password headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1240,6 +1269,7 @@ func (srv *Account) GetPrefs()(*models.Preferences, error) { path := "/account/prefs" params := map[string]interface{}{} headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -1275,6 +1305,7 @@ func (srv *Account) UpdatePrefs(Prefs interface{})(*models.User, error) { params := map[string]interface{}{} params["prefs"] = Prefs headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1317,6 +1348,7 @@ func (srv *Account) CreateRecovery(Email string, Url string)(*models.Token, erro params["email"] = Email params["url"] = Url headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1363,6 +1395,7 @@ func (srv *Account) UpdateRecovery(UserId string, Secret string, Password string params["secret"] = Secret params["password"] = Password headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1397,6 +1430,7 @@ func (srv *Account) ListSessions()(*models.SessionList, error) { path := "/account/sessions" params := map[string]interface{}{} headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -1430,6 +1464,7 @@ func (srv *Account) DeleteSessions()(*interface{}, error) { path := "/account/sessions" params := map[string]interface{}{} headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1468,6 +1503,7 @@ func (srv *Account) CreateAnonymousSession()(*models.Session, error) { path := "/account/sessions/anonymous" params := map[string]interface{}{} headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1509,6 +1545,7 @@ func (srv *Account) CreateEmailPasswordSession(Email string, Password string)(*m params["email"] = Email params["password"] = Password headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1549,6 +1586,7 @@ func (srv *Account) UpdateMagicURLSession(UserId string, Secret string)(*models. params["userId"] = UserId params["secret"] = Secret headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1589,6 +1627,7 @@ func (srv *Account) UpdatePhoneSession(UserId string, Secret string)(*models.Ses params["userId"] = UserId params["secret"] = Secret headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1627,6 +1666,7 @@ func (srv *Account) CreateSession(UserId string, Secret string)(*models.Session, params["userId"] = UserId params["secret"] = Secret headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1663,6 +1703,7 @@ func (srv *Account) GetSession(SessionId string)(*models.Session, error) { params := map[string]interface{}{} params["sessionId"] = SessionId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -1700,6 +1741,7 @@ func (srv *Account) UpdateSession(SessionId string)(*models.Session, error) { params := map[string]interface{}{} params["sessionId"] = SessionId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1739,6 +1781,7 @@ func (srv *Account) DeleteSession(SessionId string)(*interface{}, error) { params := map[string]interface{}{} params["sessionId"] = SessionId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1773,6 +1816,7 @@ func (srv *Account) UpdateStatus()(*models.User, error) { path := "/account/status" params := map[string]interface{}{} headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1844,6 +1888,7 @@ func (srv *Account) CreateEmailToken(UserId string, Email string, optionalSetter params["phrase"] = options.Phrase } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1926,6 +1971,7 @@ func (srv *Account) CreateMagicURLToken(UserId string, Email string, optionalSet params["phrase"] = options.Phrase } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -2020,6 +2066,7 @@ func (srv *Account) CreateOAuth2Token(Provider string, optionalSetters ...Create params["scopes"] = options.Scopes } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -2063,6 +2110,7 @@ func (srv *Account) CreatePhoneToken(UserId string, Phone string)(*models.Token, params["userId"] = UserId params["phone"] = Phone headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -2111,6 +2159,7 @@ func (srv *Account) CreateEmailVerification(Url string)(*models.Token, error) { params := map[string]interface{}{} params["url"] = Url headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -2161,6 +2210,7 @@ func (srv *Account) CreateVerification(Url string)(*models.Token, error) { params := map[string]interface{}{} params["url"] = Url headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -2199,6 +2249,7 @@ func (srv *Account) UpdateEmailVerification(UserId string, Secret string)(*model params["userId"] = UserId params["secret"] = Secret headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -2239,6 +2290,7 @@ func (srv *Account) UpdateVerification(UserId string, Secret string)(*models.Tok params["userId"] = UserId params["secret"] = Secret headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -2279,6 +2331,7 @@ func (srv *Account) CreatePhoneVerification()(*models.Token, error) { path := "/account/verifications/phone" params := map[string]interface{}{} headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -2317,6 +2370,7 @@ func (srv *Account) UpdatePhoneVerification(UserId string, Secret string)(*model params["userId"] = UserId params["secret"] = Secret headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } diff --git a/activities/activities.go b/activities/activities.go index dc050db5..0832d574 100644 --- a/activities/activities.go +++ b/activities/activities.go @@ -49,6 +49,7 @@ func (srv *Activities) ListEvents(optionalSetters ...ListEventsOption)(*models.A params["queries"] = options.Queries } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -83,6 +84,7 @@ func (srv *Activities) GetEvent(EventId string)(*models.ActivityEvent, error) { params := map[string]interface{}{} params["eventId"] = EventId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) diff --git a/advisor/advisor.go b/advisor/advisor.go index 9a927fdd..a66beef1 100644 --- a/advisor/advisor.go +++ b/advisor/advisor.go @@ -61,6 +61,7 @@ func (srv *Advisor) ListReports(optionalSetters ...ListReportsOption)(*models.Re params["total"] = options.Total } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -96,6 +97,7 @@ func (srv *Advisor) GetReport(ReportId string)(*models.Report, error) { params := map[string]interface{}{} params["reportId"] = ReportId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -131,6 +133,7 @@ func (srv *Advisor) DeleteReport(ReportId string)(*interface{}, error) { params := map[string]interface{}{} params["reportId"] = ReportId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -201,6 +204,7 @@ func (srv *Advisor) ListInsights(ReportId string, optionalSetters ...ListInsight params["total"] = options.Total } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -236,6 +240,7 @@ func (srv *Advisor) GetInsight(ReportId string, InsightId string)(*models.Insigh params["reportId"] = ReportId params["insightId"] = InsightId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) diff --git a/appwrite/appwrite.go b/appwrite/appwrite.go index cf89a727..8cd28dba 100644 --- a/appwrite/appwrite.go +++ b/appwrite/appwrite.go @@ -148,7 +148,7 @@ func WithChunkSize(size int64) client.ClientOption { // Your project ID func WithProject(value string) client.ClientOption { return func(clt *client.Client) error { - clt.Headers["X-Appwrite-Project"] = value + clt.Config["project"] = value return nil } } @@ -157,6 +157,7 @@ func WithProject(value string) client.ClientOption { // Your secret API key func WithKey(value string) client.ClientOption { return func(clt *client.Client) error { + clt.Config["key"] = value clt.Headers["X-Appwrite-Key"] = value return nil } @@ -166,6 +167,7 @@ func WithKey(value string) client.ClientOption { // Your secret JSON Web Token func WithJWT(value string) client.ClientOption { return func(clt *client.Client) error { + clt.Config["jwt"] = value clt.Headers["X-Appwrite-JWT"] = value return nil } @@ -173,6 +175,7 @@ func WithJWT(value string) client.ClientOption { // Helper method to construct NewClient() func WithLocale(value string) client.ClientOption { return func(clt *client.Client) error { + clt.Config["locale"] = value clt.Headers["X-Appwrite-Locale"] = value return nil } @@ -182,6 +185,7 @@ func WithLocale(value string) client.ClientOption { // The user session to authenticate with func WithSession(value string) client.ClientOption { return func(clt *client.Client) error { + clt.Config["session"] = value clt.Headers["X-Appwrite-Session"] = value return nil } @@ -191,6 +195,7 @@ func WithSession(value string) client.ClientOption { // The user agent string of the client that made the request func WithForwardedUserAgent(value string) client.ClientOption { return func(clt *client.Client) error { + clt.Config["forwardeduseragent"] = value clt.Headers["X-Forwarded-User-Agent"] = value return nil } @@ -200,6 +205,7 @@ func WithForwardedUserAgent(value string) client.ClientOption { // Your secret dev API key func WithDevKey(value string) client.ClientOption { return func(clt *client.Client) error { + clt.Config["devkey"] = value clt.Headers["X-Appwrite-Dev-Key"] = value return nil } @@ -209,6 +215,7 @@ func WithDevKey(value string) client.ClientOption { // The user cookie to authenticate with. Used by SDKs that forward an incoming Cookie header in server-side runtimes. func WithCookie(value string) client.ClientOption { return func(clt *client.Client) error { + clt.Config["cookie"] = value clt.Headers["Cookie"] = value return nil } @@ -218,6 +225,7 @@ func WithCookie(value string) client.ClientOption { // Impersonate a user by ID on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data. func WithImpersonateUserId(value string) client.ClientOption { return func(clt *client.Client) error { + clt.Config["impersonateuserid"] = value clt.Headers["X-Appwrite-Impersonate-User-Id"] = value return nil } @@ -227,6 +235,7 @@ func WithImpersonateUserId(value string) client.ClientOption { // Impersonate a user by email on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data. func WithImpersonateUserEmail(value string) client.ClientOption { return func(clt *client.Client) error { + clt.Config["impersonateuseremail"] = value clt.Headers["X-Appwrite-Impersonate-User-Email"] = value return nil } @@ -236,6 +245,7 @@ func WithImpersonateUserEmail(value string) client.ClientOption { // Impersonate a user by phone on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data. func WithImpersonateUserPhone(value string) client.ClientOption { return func(clt *client.Client) error { + clt.Config["impersonateuserphone"] = value clt.Headers["X-Appwrite-Impersonate-User-Phone"] = value return nil } diff --git a/avatars/avatars.go b/avatars/avatars.go index 65511920..42a52767 100644 --- a/avatars/avatars.go +++ b/avatars/avatars.go @@ -84,6 +84,7 @@ func (srv *Avatars) GetBrowser(Code string, optionalSetters ...GetBrowserOption) params["quality"] = options.Quality } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -207,6 +208,7 @@ func (srv *Avatars) GetCreditCard(Code string, optionalSetters ...GetCreditCardO params["quality"] = options.Quality } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -276,6 +278,7 @@ func (srv *Avatars) GetFavicon(Url string)(*[]byte, error) { params := map[string]interface{}{} params["url"] = Url headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -381,6 +384,7 @@ func (srv *Avatars) GetFlag(Code string, optionalSetters ...GetFlagOption)(*[]by params["quality"] = options.Quality } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -494,6 +498,7 @@ func (srv *Avatars) GetImage(Url string, optionalSetters ...GetImageOption)(*[]b params["height"] = options.Height } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -630,6 +635,7 @@ func (srv *Avatars) GetInitials(optionalSetters ...GetInitialsOption)(*[]byte, e params["background"] = options.Background } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -752,6 +758,7 @@ func (srv *Avatars) GetQR(Text string, optionalSetters ...GetQROption)(*[]byte, params["download"] = options.Download } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -1044,6 +1051,7 @@ func (srv *Avatars) GetScreenshot(Url string, optionalSetters ...GetScreenshotOp params["output"] = options.Output } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) diff --git a/backups/backups.go b/backups/backups.go index b0b5e3f0..2e7d2144 100644 --- a/backups/backups.go +++ b/backups/backups.go @@ -49,6 +49,7 @@ func (srv *Backups) ListArchives(optionalSetters ...ListArchivesOption)(*models. params["queries"] = options.Queries } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -106,6 +107,7 @@ func (srv *Backups) CreateArchive(Services []string, optionalSetters ...CreateAr params["resourceId"] = options.ResourceId } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -141,6 +143,7 @@ func (srv *Backups) GetArchive(ArchiveId string)(*models.BackupArchive, error) { params := map[string]interface{}{} params["archiveId"] = ArchiveId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -175,6 +178,7 @@ func (srv *Backups) DeleteArchive(ArchiveId string)(*interface{}, error) { params := map[string]interface{}{} params["archiveId"] = ArchiveId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -231,6 +235,7 @@ func (srv *Backups) ListPolicies(optionalSetters ...ListPoliciesOption)(*models. params["queries"] = options.Queries } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -313,6 +318,7 @@ func (srv *Backups) CreatePolicy(PolicyId string, Services []string, Retention i params["enabled"] = options.Enabled } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -348,6 +354,7 @@ func (srv *Backups) GetPolicy(PolicyId string)(*models.BackupPolicy, error) { params := map[string]interface{}{} params["policyId"] = PolicyId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -439,6 +446,7 @@ func (srv *Backups) UpdatePolicy(PolicyId string, optionalSetters ...UpdatePolic params["enabled"] = options.Enabled } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -474,6 +482,7 @@ func (srv *Backups) DeletePolicy(PolicyId string)(*interface{}, error) { params := map[string]interface{}{} params["policyId"] = PolicyId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -544,6 +553,7 @@ func (srv *Backups) CreateRestoration(ArchiveId string, Services []string, optio params["newResourceName"] = options.NewResourceName } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -601,6 +611,7 @@ func (srv *Backups) ListRestorations(optionalSetters ...ListRestorationsOption)( params["queries"] = options.Queries } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -635,6 +646,7 @@ func (srv *Backups) GetRestoration(RestorationId string)(*models.BackupRestorati params := map[string]interface{}{} params["restorationId"] = RestorationId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) diff --git a/client/client.go b/client/client.go index 8239a621..f3d8f806 100644 --- a/client/client.go +++ b/client/client.go @@ -64,6 +64,7 @@ func (ce *AppwriteError) GetResponse() string { type Client struct { Client *http.Client Headers map[string]string + Config map[string]string Endpoint string Timeout time.Duration SelfSigned bool @@ -74,11 +75,11 @@ type Client struct { func New(optionalSetters ...ClientOption) Client { headers := map[string]string{ "X-Appwrite-Response-Format" : "1.9.5", - "user-agent" : fmt.Sprintf("AppwriteGoSDK/v5.0.0 (%s; %s)", runtime.GOOS, runtime.GOARCH), + "user-agent" : fmt.Sprintf("AppwriteGoSDK/v5.1.0 (%s; %s)", runtime.GOOS, runtime.GOARCH), "x-sdk-name": "Go", "x-sdk-platform": "server", "x-sdk-language": "go", - "x-sdk-version": "v5.0.0", + "x-sdk-version": "v5.1.0", } httpClient, err := GetDefaultClient(defaultTimeout) if err != nil { @@ -90,6 +91,7 @@ func New(optionalSetters ...ClientOption) Client { Client: httpClient, Timeout: defaultTimeout, Headers: headers, + Config: map[string]string{}, ChunkSize: defaultChunkSize, } diff --git a/databases/databases.go b/databases/databases.go index c8517792..1efc8996 100644 --- a/databases/databases.go +++ b/databases/databases.go @@ -75,6 +75,7 @@ func (srv *Databases) List(optionalSetters ...ListOption)(*models.DatabaseList, params["total"] = options.Total } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -135,6 +136,7 @@ func (srv *Databases) Create(DatabaseId string, Name string, optionalSetters ... params["enabled"] = options.Enabled } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -192,6 +194,7 @@ func (srv *Databases) ListTransactions(optionalSetters ...ListTransactionsOption params["queries"] = options.Queries } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -248,6 +251,7 @@ func (srv *Databases) CreateTransaction(optionalSetters ...CreateTransactionOpti params["ttl"] = options.Ttl } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -283,6 +287,7 @@ func (srv *Databases) GetTransaction(TransactionId string)(*models.Transaction, params := map[string]interface{}{} params["transactionId"] = TransactionId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -353,6 +358,7 @@ func (srv *Databases) UpdateTransaction(TransactionId string, optionalSetters .. params["rollback"] = options.Rollback } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -388,6 +394,7 @@ func (srv *Databases) DeleteTransaction(TransactionId string)(*interface{}, erro params := map[string]interface{}{} params["transactionId"] = TransactionId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -446,6 +453,7 @@ func (srv *Databases) CreateOperations(TransactionId string, optionalSetters ... params["operations"] = options.Operations } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -484,6 +492,7 @@ func (srv *Databases) Get(DatabaseId string)(*models.Database, error) { params := map[string]interface{}{} params["databaseId"] = DatabaseId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -555,6 +564,7 @@ func (srv *Databases) Update(DatabaseId string, optionalSetters ...UpdateOption) params["enabled"] = options.Enabled } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -593,6 +603,7 @@ func (srv *Databases) Delete(DatabaseId string)(*interface{}, error) { params := map[string]interface{}{} params["databaseId"] = DatabaseId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -676,6 +687,7 @@ func (srv *Databases) ListCollections(DatabaseId string, optionalSetters ...List params["total"] = options.Total } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -785,6 +797,7 @@ func (srv *Databases) CreateCollection(DatabaseId string, CollectionId string, N params["indexes"] = options.Indexes } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -824,6 +837,7 @@ func (srv *Databases) GetCollection(DatabaseId string, CollectionId string)(*mod params["databaseId"] = DatabaseId params["collectionId"] = CollectionId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -929,6 +943,7 @@ func (srv *Databases) UpdateCollection(DatabaseId string, CollectionId string, o params["purge"] = options.Purge } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -968,6 +983,7 @@ func (srv *Databases) DeleteCollection(DatabaseId string, CollectionId string)(* params["databaseId"] = DatabaseId params["collectionId"] = CollectionId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1040,6 +1056,7 @@ func (srv *Databases) ListAttributes(DatabaseId string, CollectionId string, opt params["total"] = options.Total } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -1137,6 +1154,7 @@ func (srv *Databases) CreateBigIntAttribute(DatabaseId string, CollectionId stri params["array"] = options.Array } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1225,6 +1243,7 @@ func (srv *Databases) UpdateBigIntAttribute(DatabaseId string, CollectionId stri params["newKey"] = options.NewKey } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1300,6 +1319,7 @@ func (srv *Databases) CreateBooleanAttribute(DatabaseId string, CollectionId str params["array"] = options.Array } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1366,6 +1386,7 @@ func (srv *Databases) UpdateBooleanAttribute(DatabaseId string, CollectionId str params["newKey"] = options.NewKey } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1442,6 +1463,7 @@ func (srv *Databases) CreateDatetimeAttribute(DatabaseId string, CollectionId st params["array"] = options.Array } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1508,6 +1530,7 @@ func (srv *Databases) UpdateDatetimeAttribute(DatabaseId string, CollectionId st params["newKey"] = options.NewKey } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1583,6 +1606,7 @@ func (srv *Databases) CreateEmailAttribute(DatabaseId string, CollectionId strin params["array"] = options.Array } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1649,6 +1673,7 @@ func (srv *Databases) UpdateEmailAttribute(DatabaseId string, CollectionId strin params["newKey"] = options.NewKey } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1726,6 +1751,7 @@ func (srv *Databases) CreateEnumAttribute(DatabaseId string, CollectionId string params["array"] = options.Array } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1793,6 +1819,7 @@ func (srv *Databases) UpdateEnumAttribute(DatabaseId string, CollectionId string params["newKey"] = options.NewKey } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1891,6 +1918,7 @@ func (srv *Databases) CreateFloatAttribute(DatabaseId string, CollectionId strin params["array"] = options.Array } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1979,6 +2007,7 @@ func (srv *Databases) UpdateFloatAttribute(DatabaseId string, CollectionId strin params["newKey"] = options.NewKey } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -2077,6 +2106,7 @@ func (srv *Databases) CreateIntegerAttribute(DatabaseId string, CollectionId str params["array"] = options.Array } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -2165,6 +2195,7 @@ func (srv *Databases) UpdateIntegerAttribute(DatabaseId string, CollectionId str params["newKey"] = options.NewKey } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -2240,6 +2271,7 @@ func (srv *Databases) CreateIpAttribute(DatabaseId string, CollectionId string, params["array"] = options.Array } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -2306,6 +2338,7 @@ func (srv *Databases) UpdateIpAttribute(DatabaseId string, CollectionId string, params["newKey"] = options.NewKey } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -2370,6 +2403,7 @@ func (srv *Databases) CreateLineAttribute(DatabaseId string, CollectionId string params["default"] = options.Default } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -2446,6 +2480,7 @@ func (srv *Databases) UpdateLineAttribute(DatabaseId string, CollectionId string params["newKey"] = options.NewKey } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -2530,6 +2565,7 @@ func (srv *Databases) CreateLongtextAttribute(DatabaseId string, CollectionId st params["encrypt"] = options.Encrypt } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -2594,6 +2630,7 @@ func (srv *Databases) UpdateLongtextAttribute(DatabaseId string, CollectionId st params["newKey"] = options.NewKey } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -2678,6 +2715,7 @@ func (srv *Databases) CreateMediumtextAttribute(DatabaseId string, CollectionId params["encrypt"] = options.Encrypt } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -2742,6 +2780,7 @@ func (srv *Databases) UpdateMediumtextAttribute(DatabaseId string, CollectionId params["newKey"] = options.NewKey } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -2806,6 +2845,7 @@ func (srv *Databases) CreatePointAttribute(DatabaseId string, CollectionId strin params["default"] = options.Default } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -2882,6 +2922,7 @@ func (srv *Databases) UpdatePointAttribute(DatabaseId string, CollectionId strin params["newKey"] = options.NewKey } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -2946,6 +2987,7 @@ func (srv *Databases) CreatePolygonAttribute(DatabaseId string, CollectionId str params["default"] = options.Default } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -3022,6 +3064,7 @@ func (srv *Databases) UpdatePolygonAttribute(DatabaseId string, CollectionId str params["newKey"] = options.NewKey } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -3121,6 +3164,7 @@ func (srv *Databases) CreateRelationshipAttribute(DatabaseId string, CollectionI params["onDelete"] = options.OnDelete } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -3197,6 +3241,7 @@ func (srv *Databases) UpdateRelationshipAttribute(DatabaseId string, CollectionI params["newKey"] = options.NewKey } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -3284,6 +3329,7 @@ func (srv *Databases) CreateStringAttribute(DatabaseId string, CollectionId stri params["encrypt"] = options.Encrypt } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -3361,6 +3407,7 @@ func (srv *Databases) UpdateStringAttribute(DatabaseId string, CollectionId stri params["newKey"] = options.NewKey } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -3445,6 +3492,7 @@ func (srv *Databases) CreateTextAttribute(DatabaseId string, CollectionId string params["encrypt"] = options.Encrypt } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -3509,6 +3557,7 @@ func (srv *Databases) UpdateTextAttribute(DatabaseId string, CollectionId string params["newKey"] = options.NewKey } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -3584,6 +3633,7 @@ func (srv *Databases) CreateUrlAttribute(DatabaseId string, CollectionId string, params["array"] = options.Array } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -3650,6 +3700,7 @@ func (srv *Databases) UpdateUrlAttribute(DatabaseId string, CollectionId string, params["newKey"] = options.NewKey } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -3735,6 +3786,7 @@ func (srv *Databases) CreateVarcharAttribute(DatabaseId string, CollectionId str params["encrypt"] = options.Encrypt } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -3810,6 +3862,7 @@ func (srv *Databases) UpdateVarcharAttribute(DatabaseId string, CollectionId str params["newKey"] = options.NewKey } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -3849,6 +3902,7 @@ func (srv *Databases) GetAttribute(DatabaseId string, CollectionId string, Key s params["collectionId"] = CollectionId params["key"] = Key headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -3964,6 +4018,7 @@ func (srv *Databases) DeleteAttribute(DatabaseId string, CollectionId string, Ke params["collectionId"] = CollectionId params["key"] = Key headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -4059,6 +4114,7 @@ func (srv *Databases) ListDocuments(DatabaseId string, CollectionId string, opti params["ttl"] = options.Ttl } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -4136,6 +4192,7 @@ func (srv *Databases) CreateDocument(DatabaseId string, CollectionId string, Doc params["transactionId"] = options.TransactionId } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -4202,6 +4259,7 @@ func (srv *Databases) CreateDocuments(DatabaseId string, CollectionId string, Do params["transactionId"] = options.TransactionId } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -4268,6 +4326,7 @@ func (srv *Databases) UpsertDocuments(DatabaseId string, CollectionId string, Do params["transactionId"] = options.TransactionId } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -4354,6 +4413,7 @@ func (srv *Databases) UpdateDocuments(DatabaseId string, CollectionId string, op params["transactionId"] = options.TransactionId } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -4428,6 +4488,7 @@ func (srv *Databases) DeleteDocuments(DatabaseId string, CollectionId string, op params["transactionId"] = options.TransactionId } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -4503,6 +4564,7 @@ func (srv *Databases) GetDocument(DatabaseId string, CollectionId string, Docume params["transactionId"] = options.TransactionId } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -4590,6 +4652,7 @@ func (srv *Databases) UpsertDocument(DatabaseId string, CollectionId string, Doc params["transactionId"] = options.TransactionId } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -4676,6 +4739,7 @@ func (srv *Databases) UpdateDocument(DatabaseId string, CollectionId string, Doc params["transactionId"] = options.TransactionId } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -4739,6 +4803,7 @@ func (srv *Databases) DeleteDocument(DatabaseId string, CollectionId string, Doc params["transactionId"] = options.TransactionId } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -4825,6 +4890,7 @@ func (srv *Databases) DecrementDocumentAttribute(DatabaseId string, CollectionId params["transactionId"] = options.TransactionId } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -4912,6 +4978,7 @@ func (srv *Databases) IncrementDocumentAttribute(DatabaseId string, CollectionId params["transactionId"] = options.TransactionId } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -4985,6 +5052,7 @@ func (srv *Databases) ListIndexes(DatabaseId string, CollectionId string, option params["total"] = options.Total } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -5062,6 +5130,7 @@ func (srv *Databases) CreateIndex(DatabaseId string, CollectionId string, Key st params["lengths"] = options.Lengths } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -5101,6 +5170,7 @@ func (srv *Databases) GetIndex(DatabaseId string, CollectionId string, Key strin params["collectionId"] = CollectionId params["key"] = Key headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -5139,6 +5209,7 @@ func (srv *Databases) DeleteIndex(DatabaseId string, CollectionId string, Key st params["collectionId"] = CollectionId params["key"] = Key headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } diff --git a/docs/examples/account/update-password.md b/docs/examples/account/update-password.md index 34c117a3..bdaf59cd 100644 --- a/docs/examples/account/update-password.md +++ b/docs/examples/account/update-password.md @@ -17,6 +17,6 @@ service := account.New(client) response, error := service.UpdatePassword( "", - account.WithUpdatePasswordOldPassword("password"), + account.WithUpdatePasswordOldPassword(""), ) ``` diff --git a/docs/examples/health/get-audits-db.md b/docs/examples/health/get-audits-db.md new file mode 100644 index 00000000..ae35dc24 --- /dev/null +++ b/docs/examples/health/get-audits-db.md @@ -0,0 +1,19 @@ +```go +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/v5/client" + "github.com/appwrite/sdk-for-go/v5/health" +) + +client := client.New( + client.WithEndpoint("https://.cloud.appwrite.io/v1") + client.WithProject("") + client.WithKey("") +) + +service := health.New(client) + +response, error := service.GetAuditsDB()) +``` diff --git a/docs/examples/messaging/create-ses-provider.md b/docs/examples/messaging/create-ses-provider.md new file mode 100644 index 00000000..e625c8e0 --- /dev/null +++ b/docs/examples/messaging/create-ses-provider.md @@ -0,0 +1,30 @@ +```go +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/v5/client" + "github.com/appwrite/sdk-for-go/v5/messaging" +) + +client := client.New( + client.WithEndpoint("https://.cloud.appwrite.io/v1") + client.WithProject("") + client.WithKey("") +) + +service := messaging.New(client) + +response, error := service.CreateSesProvider( + "", + "", + messaging.WithCreateSesProviderAccessKey(""), + messaging.WithCreateSesProviderSecretKey(""), + messaging.WithCreateSesProviderRegion(""), + messaging.WithCreateSesProviderFromName(""), + messaging.WithCreateSesProviderFromEmail("email@example.com"), + messaging.WithCreateSesProviderReplyToName(""), + messaging.WithCreateSesProviderReplyToEmail("email@example.com"), + messaging.WithCreateSesProviderEnabled(false), +) +``` diff --git a/docs/examples/messaging/update-ses-provider.md b/docs/examples/messaging/update-ses-provider.md new file mode 100644 index 00000000..49847ca7 --- /dev/null +++ b/docs/examples/messaging/update-ses-provider.md @@ -0,0 +1,30 @@ +```go +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/v5/client" + "github.com/appwrite/sdk-for-go/v5/messaging" +) + +client := client.New( + client.WithEndpoint("https://.cloud.appwrite.io/v1") + client.WithProject("") + client.WithKey("") +) + +service := messaging.New(client) + +response, error := service.UpdateSesProvider( + "", + messaging.WithUpdateSesProviderName(""), + messaging.WithUpdateSesProviderEnabled(false), + messaging.WithUpdateSesProviderAccessKey(""), + messaging.WithUpdateSesProviderSecretKey(""), + messaging.WithUpdateSesProviderRegion(""), + messaging.WithUpdateSesProviderFromName(""), + messaging.WithUpdateSesProviderFromEmail("email@example.com"), + messaging.WithUpdateSesProviderReplyToName(""), + messaging.WithUpdateSesProviderReplyToEmail(""), +) +``` diff --git a/docs/examples/project/update-o-auth-2-server.md b/docs/examples/project/update-o-auth-2-server.md new file mode 100644 index 00000000..ae2ad907 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-server.md @@ -0,0 +1,28 @@ +```go +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/v5/client" + "github.com/appwrite/sdk-for-go/v5/project" +) + +client := client.New( + client.WithEndpoint("https://.cloud.appwrite.io/v1") + client.WithProject("") + client.WithKey("") +) + +service := project.New(client) + +response, error := service.UpdateOAuth2Server( + false, + "https://example.com", + project.WithUpdateOAuth2ServerScopes([]interface{}{}), + project.WithUpdateOAuth2ServerAccessTokenDuration(60), + project.WithUpdateOAuth2ServerRefreshTokenDuration(60), + project.WithUpdateOAuth2ServerPublicAccessTokenDuration(60), + project.WithUpdateOAuth2ServerPublicRefreshTokenDuration(60), + project.WithUpdateOAuth2ServerConfidentialPkce(false), +) +``` diff --git a/docs/examples/project/update-password-strength-policy.md b/docs/examples/project/update-password-strength-policy.md new file mode 100644 index 00000000..39b6de6c --- /dev/null +++ b/docs/examples/project/update-password-strength-policy.md @@ -0,0 +1,25 @@ +```go +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/v5/client" + "github.com/appwrite/sdk-for-go/v5/project" +) + +client := client.New( + client.WithEndpoint("https://.cloud.appwrite.io/v1") + client.WithProject("") + client.WithKey("") +) + +service := project.New(client) + +response, error := service.UpdatePasswordStrengthPolicy( + project.WithUpdatePasswordStrengthPolicyMin(8), + project.WithUpdatePasswordStrengthPolicyUppercase(false), + project.WithUpdatePasswordStrengthPolicyLowercase(false), + project.WithUpdatePasswordStrengthPolicyNumber(false), + project.WithUpdatePasswordStrengthPolicySymbols(false), +) +``` diff --git a/functions/functions.go b/functions/functions.go index c7299a05..b71b339e 100644 --- a/functions/functions.go +++ b/functions/functions.go @@ -75,6 +75,7 @@ func (srv *Functions) List(optionalSetters ...ListOption)(*models.FunctionList, params["total"] = options.Total } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -335,6 +336,7 @@ func (srv *Functions) Create(FunctionId string, Name string, Runtime string, opt params["deploymentRetention"] = options.DeploymentRetention } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -369,6 +371,7 @@ func (srv *Functions) ListRuntimes()(*models.RuntimeList, error) { path := "/functions/runtimes" params := map[string]interface{}{} headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -401,6 +404,7 @@ func (srv *Functions) ListSpecifications()(*models.SpecificationList, error) { path := "/functions/specifications" params := map[string]interface{}{} headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -435,6 +439,7 @@ func (srv *Functions) Get(FunctionId string)(*models.Function, error) { params := map[string]interface{}{} params["functionId"] = FunctionId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -703,6 +708,7 @@ func (srv *Functions) Update(FunctionId string, Name string, optionalSetters ... params["deploymentRetention"] = options.DeploymentRetention } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -738,6 +744,7 @@ func (srv *Functions) Delete(FunctionId string)(*interface{}, error) { params := map[string]interface{}{} params["functionId"] = FunctionId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -775,6 +782,7 @@ func (srv *Functions) UpdateFunctionDeployment(FunctionId string, DeploymentId s params["functionId"] = FunctionId params["deploymentId"] = DeploymentId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -857,6 +865,7 @@ func (srv *Functions) ListDeployments(FunctionId string, optionalSetters ...List params["total"] = options.Total } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -938,6 +947,7 @@ func (srv *Functions) CreateDeployment(FunctionId string, Code file.InputFile, A params["commands"] = options.Commands } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "multipart/form-data", } @@ -1004,6 +1014,7 @@ func (srv *Functions) CreateDuplicateDeployment(FunctionId string, DeploymentId params["buildId"] = options.BuildId } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1072,6 +1083,7 @@ func (srv *Functions) CreateTemplateDeployment(FunctionId string, Repository str params["activate"] = options.Activate } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1136,6 +1148,7 @@ func (srv *Functions) CreateVcsDeployment(FunctionId string, Type string, Refere params["activate"] = options.Activate } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1172,6 +1185,7 @@ func (srv *Functions) GetDeployment(FunctionId string, DeploymentId string)(*mod params["functionId"] = FunctionId params["deploymentId"] = DeploymentId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -1207,6 +1221,7 @@ func (srv *Functions) DeleteDeployment(FunctionId string, DeploymentId string)(* params["functionId"] = FunctionId params["deploymentId"] = DeploymentId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1269,6 +1284,7 @@ func (srv *Functions) GetDeploymentDownload(FunctionId string, DeploymentId stri params["type"] = options.Type } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -1332,6 +1348,7 @@ func (srv *Functions) UpdateDeploymentStatus(FunctionId string, DeploymentId str params["functionId"] = FunctionId params["deploymentId"] = DeploymentId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1403,6 +1420,7 @@ func (srv *Functions) ListExecutions(FunctionId string, optionalSetters ...ListE params["total"] = options.Total } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -1519,6 +1537,7 @@ func (srv *Functions) CreateExecution(FunctionId string, optionalSetters ...Crea params["scheduledAt"] = options.ScheduledAt } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1555,6 +1574,7 @@ func (srv *Functions) GetExecution(FunctionId string, ExecutionId string)(*model params["functionId"] = FunctionId params["executionId"] = ExecutionId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -1590,6 +1610,7 @@ func (srv *Functions) DeleteExecution(FunctionId string, ExecutionId string)(*in params["functionId"] = FunctionId params["executionId"] = ExecutionId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1659,6 +1680,7 @@ func (srv *Functions) ListVariables(FunctionId string, optionalSetters ...ListVa params["total"] = options.Total } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -1721,6 +1743,7 @@ func (srv *Functions) CreateVariable(FunctionId string, VariableId string, Key s params["secret"] = options.Secret } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1757,6 +1780,7 @@ func (srv *Functions) GetVariable(FunctionId string, VariableId string)(*models. params["functionId"] = FunctionId params["variableId"] = VariableId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -1838,6 +1862,7 @@ func (srv *Functions) UpdateVariable(FunctionId string, VariableId string, optio params["secret"] = options.Secret } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1874,6 +1899,7 @@ func (srv *Functions) DeleteVariable(FunctionId string, VariableId string)(*inte params["functionId"] = FunctionId params["variableId"] = VariableId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } diff --git a/graphql/graphql.go b/graphql/graphql.go index 4bf159b1..c5790227 100644 --- a/graphql/graphql.go +++ b/graphql/graphql.go @@ -25,6 +25,7 @@ func (srv *Graphql) Query(Query interface{})(*interface{}, error) { params := map[string]interface{}{} params["query"] = Query headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "x-sdk-graphql": "true", "content-type": "application/json", } @@ -59,6 +60,7 @@ func (srv *Graphql) Mutation(Query interface{})(*interface{}, error) { params := map[string]interface{}{} params["query"] = Query headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "x-sdk-graphql": "true", "content-type": "application/json", } diff --git a/health/health.go b/health/health.go index 2c037477..9edc11ce 100644 --- a/health/health.go +++ b/health/health.go @@ -25,6 +25,7 @@ func (srv *Health) Get()(*models.HealthStatus, error) { path := "/health" params := map[string]interface{}{} headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -58,6 +59,7 @@ func (srv *Health) GetAntivirus()(*models.HealthAntivirus, error) { path := "/health/anti-virus" params := map[string]interface{}{} headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -85,12 +87,48 @@ func (srv *Health) GetAntivirus()(*models.HealthAntivirus, error) { } +// GetAuditsDB check the database that backs the audit and activity store. +// When the connection is reachable the endpoint returns a passing status with +// its response time. +func (srv *Health) GetAuditsDB()(*models.HealthStatusList, error) { + path := "/health/audits-db" + params := map[string]interface{}{} + headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], + } + + resp, err := srv.client.Call("GET", path, headers, params) + if err != nil { + return nil, err + } + if strings.HasPrefix(resp.Type, "application/json") { + bytes := []byte(resp.Result.(string)) + + parsed := models.HealthStatusList{}.New(bytes) + + err = json.Unmarshal(bytes, parsed) + if err != nil { + return nil, err + } + + return parsed, nil + } + var parsed models.HealthStatusList + parsed, ok := resp.Result.(models.HealthStatusList) + if !ok { + return nil, errors.New("unexpected response type") + } + return &parsed, nil + +} + // GetCache check the Appwrite in-memory cache servers are up and connection // is successful. func (srv *Health) GetCache()(*models.HealthStatusList, error) { path := "/health/cache" params := map[string]interface{}{} headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -147,6 +185,7 @@ func (srv *Health) GetCertificate(optionalSetters ...GetCertificateOption)(*mode params["domain"] = options.Domain } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -216,6 +255,7 @@ func (srv *Health) GetConsolePausing(optionalSetters ...GetConsolePausingOption) params["inactivityDays"] = options.InactivityDays } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -249,6 +289,7 @@ func (srv *Health) GetDB()(*models.HealthStatusList, error) { path := "/health/db" params := map[string]interface{}{} headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -282,6 +323,7 @@ func (srv *Health) GetPubSub()(*models.HealthStatusList, error) { path := "/health/pubsub" params := map[string]interface{}{} headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -339,6 +381,7 @@ func (srv *Health) GetQueueAudits(optionalSetters ...GetQueueAuditsOption)(*mode params["threshold"] = options.Threshold } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -396,6 +439,7 @@ func (srv *Health) GetQueueBuilds(optionalSetters ...GetQueueBuildsOption)(*mode params["threshold"] = options.Threshold } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -454,6 +498,7 @@ func (srv *Health) GetQueueCertificates(optionalSetters ...GetQueueCertificatesO params["threshold"] = options.Threshold } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -522,6 +567,7 @@ func (srv *Health) GetQueueDatabases(optionalSetters ...GetQueueDatabasesOption) params["threshold"] = options.Threshold } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -579,6 +625,7 @@ func (srv *Health) GetQueueDeletes(optionalSetters ...GetQueueDeletesOption)(*mo params["threshold"] = options.Threshold } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -637,6 +684,7 @@ func (srv *Health) GetFailedJobs(Name string, optionalSetters ...GetFailedJobsOp params["threshold"] = options.Threshold } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -694,6 +742,7 @@ func (srv *Health) GetQueueFunctions(optionalSetters ...GetQueueFunctionsOption) params["threshold"] = options.Threshold } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -751,6 +800,7 @@ func (srv *Health) GetQueueLogs(optionalSetters ...GetQueueLogsOption)(*models.H params["threshold"] = options.Threshold } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -808,6 +858,7 @@ func (srv *Health) GetQueueMails(optionalSetters ...GetQueueMailsOption)(*models params["threshold"] = options.Threshold } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -865,6 +916,7 @@ func (srv *Health) GetQueueMessaging(optionalSetters ...GetQueueMessagingOption) params["threshold"] = options.Threshold } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -922,6 +974,7 @@ func (srv *Health) GetQueueMigrations(optionalSetters ...GetQueueMigrationsOptio params["threshold"] = options.Threshold } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -979,6 +1032,7 @@ func (srv *Health) GetQueueStatsResources(optionalSetters ...GetQueueStatsResour params["threshold"] = options.Threshold } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -1036,6 +1090,7 @@ func (srv *Health) GetQueueUsage(optionalSetters ...GetQueueUsageOption)(*models params["threshold"] = options.Threshold } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -1093,6 +1148,7 @@ func (srv *Health) GetQueueWebhooks(optionalSetters ...GetQueueWebhooksOption)(* params["threshold"] = options.Threshold } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -1126,6 +1182,7 @@ func (srv *Health) GetStorage()(*models.HealthStatus, error) { path := "/health/storage" params := map[string]interface{}{} headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -1159,6 +1216,7 @@ func (srv *Health) GetStorageLocal()(*models.HealthStatus, error) { path := "/health/storage/local" params := map[string]interface{}{} headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -1197,6 +1255,7 @@ func (srv *Health) GetTime()(*models.HealthTime, error) { path := "/health/time" params := map[string]interface{}{} headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) diff --git a/health/health_test.go b/health/health_test.go index 5a9111c9..8cdd0fea 100644 --- a/health/health_test.go +++ b/health/health_test.go @@ -71,6 +71,39 @@ func TestHealth(t *testing.T) { } }) + t.Run("Test GetAuditsDB", func(t *testing.T) { + mockResponse := ` +{ + "total": 5, + "statuses": [ + { + "name": "database", + "ping": 128, + "status": "pass" + } + ] +} +` + + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if r.Method != "GET" { + t.Errorf("Expected method GET, got %s", r.Method) + } + + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(http.StatusOK) + _, _ = w.Write([]byte(mockResponse)) + })) + defer ts.Close() + + srv := New(newTestClient(ts)) + + _, err := srv.GetAuditsDB() + if err != nil { + t.Errorf("Method GetAuditsDB failed: %v", err) + } + }) + t.Run("Test GetCache", func(t *testing.T) { mockResponse := ` { diff --git a/locale/locale.go b/locale/locale.go index 2b37b82e..9be57493 100644 --- a/locale/locale.go +++ b/locale/locale.go @@ -30,6 +30,7 @@ func (srv *Locale) Get()(*models.Locale, error) { path := "/locale" params := map[string]interface{}{} headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -63,6 +64,7 @@ func (srv *Locale) ListCodes()(*models.LocaleCodeList, error) { path := "/locale/codes" params := map[string]interface{}{} headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -96,6 +98,7 @@ func (srv *Locale) ListContinents()(*models.ContinentList, error) { path := "/locale/continents" params := map[string]interface{}{} headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -129,6 +132,7 @@ func (srv *Locale) ListCountries()(*models.CountryList, error) { path := "/locale/countries" params := map[string]interface{}{} headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -162,6 +166,7 @@ func (srv *Locale) ListCountriesEU()(*models.CountryList, error) { path := "/locale/countries/eu" params := map[string]interface{}{} headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -195,6 +200,7 @@ func (srv *Locale) ListCountriesPhones()(*models.PhoneList, error) { path := "/locale/countries/phones" params := map[string]interface{}{} headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -229,6 +235,7 @@ func (srv *Locale) ListCurrencies()(*models.CurrencyList, error) { path := "/locale/currencies" params := map[string]interface{}{} headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -262,6 +269,7 @@ func (srv *Locale) ListLanguages()(*models.LanguageList, error) { path := "/locale/languages" params := map[string]interface{}{} headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) diff --git a/messaging/messaging.go b/messaging/messaging.go index 41fc71e0..3b55cbb7 100644 --- a/messaging/messaging.go +++ b/messaging/messaging.go @@ -71,6 +71,7 @@ func (srv *Messaging) ListMessages(optionalSetters ...ListMessagesOption)(*model params["total"] = options.Total } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -218,6 +219,7 @@ func (srv *Messaging) CreateEmail(MessageId string, Subject string, Content stri params["scheduledAt"] = options.ScheduledAt } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -389,6 +391,7 @@ func (srv *Messaging) UpdateEmail(MessageId string, optionalSetters ...UpdateEma params["attachments"] = options.Attachments } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -634,6 +637,7 @@ func (srv *Messaging) CreatePush(MessageId string, optionalSetters ...CreatePush params["priority"] = options.Priority } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -882,6 +886,7 @@ func (srv *Messaging) UpdatePush(MessageId string, optionalSetters ...UpdatePush params["priority"] = options.Priority } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -987,6 +992,7 @@ func (srv *Messaging) CreateSms(MessageId string, Content string, optionalSetter params["scheduledAt"] = options.ScheduledAt } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1090,6 +1096,7 @@ func (srv *Messaging) CreateSMS(MessageId string, Content string, optionalSetter params["scheduledAt"] = options.ScheduledAt } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1208,6 +1215,7 @@ func (srv *Messaging) UpdateSms(MessageId string, optionalSetters ...UpdateSmsOp params["scheduledAt"] = options.ScheduledAt } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1324,6 +1332,7 @@ func (srv *Messaging) UpdateSMS(MessageId string, optionalSetters ...UpdateSMSOp params["scheduledAt"] = options.ScheduledAt } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1359,6 +1368,7 @@ func (srv *Messaging) GetMessage(MessageId string)(*models.Message, error) { params := map[string]interface{}{} params["messageId"] = MessageId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -1394,6 +1404,7 @@ func (srv *Messaging) Delete(MessageId string)(*interface{}, error) { params := map[string]interface{}{} params["messageId"] = MessageId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1463,6 +1474,7 @@ func (srv *Messaging) ListMessageLogs(MessageId string, optionalSetters ...ListM params["total"] = options.Total } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -1532,6 +1544,7 @@ func (srv *Messaging) ListTargets(MessageId string, optionalSetters ...ListTarge params["total"] = options.Total } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -1611,6 +1624,7 @@ func (srv *Messaging) ListProviders(optionalSetters ...ListProvidersOption)(*mod params["total"] = options.Total } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -1726,6 +1740,7 @@ func (srv *Messaging) CreateApnsProvider(ProviderId string, Name string, optiona params["enabled"] = options.Enabled } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1840,6 +1855,7 @@ func (srv *Messaging) CreateAPNSProvider(ProviderId string, Name string, optiona params["enabled"] = options.Enabled } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1968,6 +1984,7 @@ func (srv *Messaging) UpdateApnsProvider(ProviderId string, optionalSetters ...U params["sandbox"] = options.Sandbox } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -2094,6 +2111,7 @@ func (srv *Messaging) UpdateAPNSProvider(ProviderId string, optionalSetters ...U params["sandbox"] = options.Sandbox } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -2166,6 +2184,7 @@ func (srv *Messaging) CreateFcmProvider(ProviderId string, Name string, optional params["enabled"] = options.Enabled } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -2236,6 +2255,7 @@ func (srv *Messaging) CreateFCMProvider(ProviderId string, Name string, optional params["enabled"] = options.Enabled } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -2320,6 +2340,7 @@ func (srv *Messaging) UpdateFcmProvider(ProviderId string, optionalSetters ...Up params["serviceAccountJSON"] = options.ServiceAccountJSON } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -2402,6 +2423,7 @@ func (srv *Messaging) UpdateFCMProvider(ProviderId string, optionalSetters ...Up params["serviceAccountJSON"] = options.ServiceAccountJSON } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -2538,6 +2560,7 @@ func (srv *Messaging) CreateMailgunProvider(ProviderId string, Name string, opti params["enabled"] = options.Enabled } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -2685,6 +2708,7 @@ func (srv *Messaging) UpdateMailgunProvider(ProviderId string, optionalSetters . params["replyToEmail"] = options.ReplyToEmail } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -2777,6 +2801,7 @@ func (srv *Messaging) CreateMsg91Provider(ProviderId string, Name string, option params["enabled"] = options.Enabled } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -2880,6 +2905,7 @@ func (srv *Messaging) UpdateMsg91Provider(ProviderId string, optionalSetters ... params["authKey"] = options.AuthKey } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -2994,6 +3020,7 @@ func (srv *Messaging) CreateResendProvider(ProviderId string, Name string, optio params["enabled"] = options.Enabled } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -3119,6 +3146,7 @@ func (srv *Messaging) UpdateResendProvider(ProviderId string, optionalSetters .. params["replyToEmail"] = options.ReplyToEmail } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -3233,6 +3261,7 @@ func (srv *Messaging) CreateSendgridProvider(ProviderId string, Name string, opt params["enabled"] = options.Enabled } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -3358,6 +3387,292 @@ func (srv *Messaging) UpdateSendgridProvider(ProviderId string, optionalSetters params["replyToEmail"] = options.ReplyToEmail } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], + "content-type": "application/json", + } + + resp, err := srv.client.Call("PATCH", path, headers, params) + if err != nil { + return nil, err + } + if strings.HasPrefix(resp.Type, "application/json") { + bytes := []byte(resp.Result.(string)) + + parsed := models.Provider{}.New(bytes) + + err = json.Unmarshal(bytes, parsed) + if err != nil { + return nil, err + } + + return parsed, nil + } + var parsed models.Provider + parsed, ok := resp.Result.(models.Provider) + if !ok { + return nil, errors.New("unexpected response type") + } + return &parsed, nil + +} +type CreateSesProviderOptions struct { + AccessKey string + SecretKey string + Region string + FromName string + FromEmail string + ReplyToName string + ReplyToEmail string + Enabled bool + enabledSetters map[string]bool +} +func (options CreateSesProviderOptions) New() *CreateSesProviderOptions { + options.enabledSetters = map[string]bool{ + "AccessKey": false, + "SecretKey": false, + "Region": false, + "FromName": false, + "FromEmail": false, + "ReplyToName": false, + "ReplyToEmail": false, + "Enabled": false, + } + return &options +} +type CreateSesProviderOption func(*CreateSesProviderOptions) +func (srv *Messaging) WithCreateSesProviderAccessKey(v string) CreateSesProviderOption { + return func(o *CreateSesProviderOptions) { + o.AccessKey = v + o.enabledSetters["AccessKey"] = true + } +} +func (srv *Messaging) WithCreateSesProviderSecretKey(v string) CreateSesProviderOption { + return func(o *CreateSesProviderOptions) { + o.SecretKey = v + o.enabledSetters["SecretKey"] = true + } +} +func (srv *Messaging) WithCreateSesProviderRegion(v string) CreateSesProviderOption { + return func(o *CreateSesProviderOptions) { + o.Region = v + o.enabledSetters["Region"] = true + } +} +func (srv *Messaging) WithCreateSesProviderFromName(v string) CreateSesProviderOption { + return func(o *CreateSesProviderOptions) { + o.FromName = v + o.enabledSetters["FromName"] = true + } +} +func (srv *Messaging) WithCreateSesProviderFromEmail(v string) CreateSesProviderOption { + return func(o *CreateSesProviderOptions) { + o.FromEmail = v + o.enabledSetters["FromEmail"] = true + } +} +func (srv *Messaging) WithCreateSesProviderReplyToName(v string) CreateSesProviderOption { + return func(o *CreateSesProviderOptions) { + o.ReplyToName = v + o.enabledSetters["ReplyToName"] = true + } +} +func (srv *Messaging) WithCreateSesProviderReplyToEmail(v string) CreateSesProviderOption { + return func(o *CreateSesProviderOptions) { + o.ReplyToEmail = v + o.enabledSetters["ReplyToEmail"] = true + } +} +func (srv *Messaging) WithCreateSesProviderEnabled(v bool) CreateSesProviderOption { + return func(o *CreateSesProviderOptions) { + o.Enabled = v + o.enabledSetters["Enabled"] = true + } +} + +// CreateSesProvider create a new Amazon SES provider. +func (srv *Messaging) CreateSesProvider(ProviderId string, Name string, optionalSetters ...CreateSesProviderOption)(*models.Provider, error) { + path := "/messaging/providers/ses" + options := CreateSesProviderOptions{}.New() + for _, opt := range optionalSetters { + opt(options) + } + params := map[string]interface{}{} + params["providerId"] = ProviderId + params["name"] = Name + if options.enabledSetters["AccessKey"] { + params["accessKey"] = options.AccessKey + } + if options.enabledSetters["SecretKey"] { + params["secretKey"] = options.SecretKey + } + if options.enabledSetters["Region"] { + params["region"] = options.Region + } + if options.enabledSetters["FromName"] { + params["fromName"] = options.FromName + } + if options.enabledSetters["FromEmail"] { + params["fromEmail"] = options.FromEmail + } + if options.enabledSetters["ReplyToName"] { + params["replyToName"] = options.ReplyToName + } + if options.enabledSetters["ReplyToEmail"] { + params["replyToEmail"] = options.ReplyToEmail + } + if options.enabledSetters["Enabled"] { + params["enabled"] = options.Enabled + } + headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], + "content-type": "application/json", + } + + resp, err := srv.client.Call("POST", path, headers, params) + if err != nil { + return nil, err + } + if strings.HasPrefix(resp.Type, "application/json") { + bytes := []byte(resp.Result.(string)) + + parsed := models.Provider{}.New(bytes) + + err = json.Unmarshal(bytes, parsed) + if err != nil { + return nil, err + } + + return parsed, nil + } + var parsed models.Provider + parsed, ok := resp.Result.(models.Provider) + if !ok { + return nil, errors.New("unexpected response type") + } + return &parsed, nil + +} +type UpdateSesProviderOptions struct { + Name string + Enabled bool + AccessKey string + SecretKey string + Region string + FromName string + FromEmail string + ReplyToName string + ReplyToEmail string + enabledSetters map[string]bool +} +func (options UpdateSesProviderOptions) New() *UpdateSesProviderOptions { + options.enabledSetters = map[string]bool{ + "Name": false, + "Enabled": false, + "AccessKey": false, + "SecretKey": false, + "Region": false, + "FromName": false, + "FromEmail": false, + "ReplyToName": false, + "ReplyToEmail": false, + } + return &options +} +type UpdateSesProviderOption func(*UpdateSesProviderOptions) +func (srv *Messaging) WithUpdateSesProviderName(v string) UpdateSesProviderOption { + return func(o *UpdateSesProviderOptions) { + o.Name = v + o.enabledSetters["Name"] = true + } +} +func (srv *Messaging) WithUpdateSesProviderEnabled(v bool) UpdateSesProviderOption { + return func(o *UpdateSesProviderOptions) { + o.Enabled = v + o.enabledSetters["Enabled"] = true + } +} +func (srv *Messaging) WithUpdateSesProviderAccessKey(v string) UpdateSesProviderOption { + return func(o *UpdateSesProviderOptions) { + o.AccessKey = v + o.enabledSetters["AccessKey"] = true + } +} +func (srv *Messaging) WithUpdateSesProviderSecretKey(v string) UpdateSesProviderOption { + return func(o *UpdateSesProviderOptions) { + o.SecretKey = v + o.enabledSetters["SecretKey"] = true + } +} +func (srv *Messaging) WithUpdateSesProviderRegion(v string) UpdateSesProviderOption { + return func(o *UpdateSesProviderOptions) { + o.Region = v + o.enabledSetters["Region"] = true + } +} +func (srv *Messaging) WithUpdateSesProviderFromName(v string) UpdateSesProviderOption { + return func(o *UpdateSesProviderOptions) { + o.FromName = v + o.enabledSetters["FromName"] = true + } +} +func (srv *Messaging) WithUpdateSesProviderFromEmail(v string) UpdateSesProviderOption { + return func(o *UpdateSesProviderOptions) { + o.FromEmail = v + o.enabledSetters["FromEmail"] = true + } +} +func (srv *Messaging) WithUpdateSesProviderReplyToName(v string) UpdateSesProviderOption { + return func(o *UpdateSesProviderOptions) { + o.ReplyToName = v + o.enabledSetters["ReplyToName"] = true + } +} +func (srv *Messaging) WithUpdateSesProviderReplyToEmail(v string) UpdateSesProviderOption { + return func(o *UpdateSesProviderOptions) { + o.ReplyToEmail = v + o.enabledSetters["ReplyToEmail"] = true + } +} + +// UpdateSesProvider update an Amazon SES provider by its unique ID. +func (srv *Messaging) UpdateSesProvider(ProviderId string, optionalSetters ...UpdateSesProviderOption)(*models.Provider, error) { + r := strings.NewReplacer("{providerId}", ProviderId) + path := r.Replace("/messaging/providers/ses/{providerId}") + options := UpdateSesProviderOptions{}.New() + for _, opt := range optionalSetters { + opt(options) + } + params := map[string]interface{}{} + params["providerId"] = ProviderId + if options.enabledSetters["Name"] { + params["name"] = options.Name + } + if options.enabledSetters["Enabled"] { + params["enabled"] = options.Enabled + } + if options.enabledSetters["AccessKey"] { + params["accessKey"] = options.AccessKey + } + if options.enabledSetters["SecretKey"] { + params["secretKey"] = options.SecretKey + } + if options.enabledSetters["Region"] { + params["region"] = options.Region + } + if options.enabledSetters["FromName"] { + params["fromName"] = options.FromName + } + if options.enabledSetters["FromEmail"] { + params["fromEmail"] = options.FromEmail + } + if options.enabledSetters["ReplyToName"] { + params["replyToName"] = options.ReplyToName + } + if options.enabledSetters["ReplyToEmail"] { + params["replyToEmail"] = options.ReplyToEmail + } + headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -3530,6 +3845,7 @@ func (srv *Messaging) CreateSmtpProvider(ProviderId string, Name string, Host st params["enabled"] = options.Enabled } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -3700,6 +4016,7 @@ func (srv *Messaging) CreateSMTPProvider(ProviderId string, Name string, Host st params["enabled"] = options.Enabled } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -3893,6 +4210,7 @@ func (srv *Messaging) UpdateSmtpProvider(ProviderId string, optionalSetters ...U params["enabled"] = options.Enabled } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -4084,6 +4402,7 @@ func (srv *Messaging) UpdateSMTPProvider(ProviderId string, optionalSetters ...U params["enabled"] = options.Enabled } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -4176,6 +4495,7 @@ func (srv *Messaging) CreateTelesignProvider(ProviderId string, Name string, opt params["enabled"] = options.Enabled } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -4279,6 +4599,7 @@ func (srv *Messaging) UpdateTelesignProvider(ProviderId string, optionalSetters params["from"] = options.From } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -4371,6 +4692,7 @@ func (srv *Messaging) CreateTextmagicProvider(ProviderId string, Name string, op params["enabled"] = options.Enabled } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -4474,6 +4796,7 @@ func (srv *Messaging) UpdateTextmagicProvider(ProviderId string, optionalSetters params["from"] = options.From } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -4566,6 +4889,7 @@ func (srv *Messaging) CreateTwilioProvider(ProviderId string, Name string, optio params["enabled"] = options.Enabled } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -4669,6 +4993,7 @@ func (srv *Messaging) UpdateTwilioProvider(ProviderId string, optionalSetters .. params["from"] = options.From } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -4761,6 +5086,7 @@ func (srv *Messaging) CreateVonageProvider(ProviderId string, Name string, optio params["enabled"] = options.Enabled } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -4864,6 +5190,7 @@ func (srv *Messaging) UpdateVonageProvider(ProviderId string, optionalSetters .. params["from"] = options.From } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -4899,6 +5226,7 @@ func (srv *Messaging) GetProvider(ProviderId string)(*models.Provider, error) { params := map[string]interface{}{} params["providerId"] = ProviderId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -4933,6 +5261,7 @@ func (srv *Messaging) DeleteProvider(ProviderId string)(*interface{}, error) { params := map[string]interface{}{} params["providerId"] = ProviderId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -5002,6 +5331,7 @@ func (srv *Messaging) ListProviderLogs(ProviderId string, optionalSetters ...Lis params["total"] = options.Total } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -5072,6 +5402,7 @@ func (srv *Messaging) ListSubscriberLogs(SubscriberId string, optionalSetters .. params["total"] = options.Total } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -5150,6 +5481,7 @@ func (srv *Messaging) ListTopics(optionalSetters ...ListTopicsOption)(*models.To params["total"] = options.Total } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -5208,6 +5540,7 @@ func (srv *Messaging) CreateTopic(TopicId string, Name string, optionalSetters . params["subscribe"] = options.Subscribe } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -5243,6 +5576,7 @@ func (srv *Messaging) GetTopic(TopicId string)(*models.Topic, error) { params := map[string]interface{}{} params["topicId"] = TopicId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -5312,6 +5646,7 @@ func (srv *Messaging) UpdateTopic(TopicId string, optionalSetters ...UpdateTopic params["subscribe"] = options.Subscribe } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -5347,6 +5682,7 @@ func (srv *Messaging) DeleteTopic(TopicId string)(*interface{}, error) { params := map[string]interface{}{} params["topicId"] = TopicId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -5416,6 +5752,7 @@ func (srv *Messaging) ListTopicLogs(TopicId string, optionalSetters ...ListTopic params["total"] = options.Total } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -5497,6 +5834,7 @@ func (srv *Messaging) ListSubscribers(TopicId string, optionalSetters ...ListSub params["total"] = options.Total } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -5533,6 +5871,7 @@ func (srv *Messaging) CreateSubscriber(TopicId string, SubscriberId string, Targ params["subscriberId"] = SubscriberId params["targetId"] = TargetId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -5569,6 +5908,7 @@ func (srv *Messaging) GetSubscriber(TopicId string, SubscriberId string)(*models params["topicId"] = TopicId params["subscriberId"] = SubscriberId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -5604,6 +5944,7 @@ func (srv *Messaging) DeleteSubscriber(TopicId string, SubscriberId string)(*int params["topicId"] = TopicId params["subscriberId"] = SubscriberId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } diff --git a/messaging/messaging_test.go b/messaging/messaging_test.go index 17c32bef..6142f0b7 100644 --- a/messaging/messaging_test.go +++ b/messaging/messaging_test.go @@ -1053,6 +1053,72 @@ func TestMessaging(t *testing.T) { } }) + t.Run("Test CreateSesProvider", func(t *testing.T) { + mockResponse := ` +{ + "$id": "5e5ea5c16897e", + "$createdAt": "2020-10-15T06:38:00.000+00:00", + "$updatedAt": "2020-10-15T06:38:00.000+00:00", + "name": "Mailgun", + "provider": "mailgun", + "enabled": true, + "type": "sms", + "credentials": {} +} +` + + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if r.Method != "POST" { + t.Errorf("Expected method POST, got %s", r.Method) + } + + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(http.StatusOK) + _, _ = w.Write([]byte(mockResponse)) + })) + defer ts.Close() + + srv := New(newTestClient(ts)) + + _, err := srv.CreateSesProvider("", "") + if err != nil { + t.Errorf("Method CreateSesProvider failed: %v", err) + } + }) + + t.Run("Test UpdateSesProvider", func(t *testing.T) { + mockResponse := ` +{ + "$id": "5e5ea5c16897e", + "$createdAt": "2020-10-15T06:38:00.000+00:00", + "$updatedAt": "2020-10-15T06:38:00.000+00:00", + "name": "Mailgun", + "provider": "mailgun", + "enabled": true, + "type": "sms", + "credentials": {} +} +` + + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if r.Method != "PATCH" { + t.Errorf("Expected method PATCH, got %s", r.Method) + } + + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(http.StatusOK) + _, _ = w.Write([]byte(mockResponse)) + })) + defer ts.Close() + + srv := New(newTestClient(ts)) + + _, err := srv.UpdateSesProvider("") + if err != nil { + t.Errorf("Method UpdateSesProvider failed: %v", err) + } + }) + t.Run("Test CreateSmtpProvider", func(t *testing.T) { mockResponse := ` { diff --git a/models/oAuth2Amazon_test.go b/models/oAuth2Amazon_test.go index df059433..a5a1d57d 100644 --- a/models/oAuth2Amazon_test.go +++ b/models/oAuth2Amazon_test.go @@ -6,7 +6,7 @@ import ( ) func TestOAuth2AmazonModel(t *testing.T) { - model := OAuth2Amazon{ Id: "github", Enabled: true, ClientId: "amzn1.application-oa2-client.87400c00000000000000000000063d5b2", ClientSecret: "your-oauth2-client-secret", } + model := OAuth2Amazon{ Id: "github", Enabled: true, ClientId: "amzn1.application-oa2-client.87400c00000000000000000000063d5b2", ClientSecret: "79ffe4000000000000000000000000000000000000000000000000000002de55", } data, err := json.Marshal(model) if err != nil { diff --git a/models/oAuth2Auth0_test.go b/models/oAuth2Auth0_test.go index 0225e9ff..07dada05 100644 --- a/models/oAuth2Auth0_test.go +++ b/models/oAuth2Auth0_test.go @@ -6,7 +6,7 @@ import ( ) func TestOAuth2Auth0Model(t *testing.T) { - model := OAuth2Auth0{ Id: "github", Enabled: true, ClientId: "OaOkIA000000000000000000005KLSYq", ClientSecret: "your-oauth2-client-secret", Endpoint: "example.us.auth0.com", } + model := OAuth2Auth0{ Id: "github", Enabled: true, ClientId: "OaOkIA000000000000000000005KLSYq", ClientSecret: "zXz0000-00000000000000000000000000000-00000000000000000000PJafnF", Endpoint: "example.us.auth0.com", } data, err := json.Marshal(model) if err != nil { diff --git a/models/oAuth2Authentik_test.go b/models/oAuth2Authentik_test.go index dfd3275b..aeefaeec 100644 --- a/models/oAuth2Authentik_test.go +++ b/models/oAuth2Authentik_test.go @@ -6,7 +6,7 @@ import ( ) func TestOAuth2AuthentikModel(t *testing.T) { - model := OAuth2Authentik{ Id: "github", Enabled: true, ClientId: "dTKOPa0000000000000000000000000000e7G8hv", ClientSecret: "your-oauth2-client-secret", Endpoint: "example.authentik.com", } + model := OAuth2Authentik{ Id: "github", Enabled: true, ClientId: "dTKOPa0000000000000000000000000000e7G8hv", ClientSecret: "ntQadq000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000Hp5WK", Endpoint: "example.authentik.com", } data, err := json.Marshal(model) if err != nil { diff --git a/models/oAuth2Autodesk_test.go b/models/oAuth2Autodesk_test.go index 2a21fa57..f8db242a 100644 --- a/models/oAuth2Autodesk_test.go +++ b/models/oAuth2Autodesk_test.go @@ -6,7 +6,7 @@ import ( ) func TestOAuth2AutodeskModel(t *testing.T) { - model := OAuth2Autodesk{ Id: "github", Enabled: true, ClientId: "5zw90v00000000000000000000kVYXN7", ClientSecret: "your-oauth2-client-secret", } + model := OAuth2Autodesk{ Id: "github", Enabled: true, ClientId: "5zw90v00000000000000000000kVYXN7", ClientSecret: "7I000000000000MW", } data, err := json.Marshal(model) if err != nil { diff --git a/models/oAuth2Bitbucket_test.go b/models/oAuth2Bitbucket_test.go index 8e4f0b23..10af6b12 100644 --- a/models/oAuth2Bitbucket_test.go +++ b/models/oAuth2Bitbucket_test.go @@ -6,7 +6,7 @@ import ( ) func TestOAuth2BitbucketModel(t *testing.T) { - model := OAuth2Bitbucket{ Id: "github", Enabled: true, Key: "Knt70000000000ByRc", Secret: "your-oauth2-client-secret", } + model := OAuth2Bitbucket{ Id: "github", Enabled: true, Key: "Knt70000000000ByRc", Secret: "NMfLZJ00000000000000000000TLQdDx", } data, err := json.Marshal(model) if err != nil { diff --git a/models/oAuth2Bitly_test.go b/models/oAuth2Bitly_test.go index e0ac6158..387a23e5 100644 --- a/models/oAuth2Bitly_test.go +++ b/models/oAuth2Bitly_test.go @@ -6,7 +6,7 @@ import ( ) func TestOAuth2BitlyModel(t *testing.T) { - model := OAuth2Bitly{ Id: "github", Enabled: true, ClientId: "d95151000000000000000000000000000067af9b", ClientSecret: "your-oauth2-client-secret", } + model := OAuth2Bitly{ Id: "github", Enabled: true, ClientId: "d95151000000000000000000000000000067af9b", ClientSecret: "a13e250000000000000000000000000000d73095", } data, err := json.Marshal(model) if err != nil { diff --git a/models/oAuth2Box_test.go b/models/oAuth2Box_test.go index 1dedf78f..02ee9caf 100644 --- a/models/oAuth2Box_test.go +++ b/models/oAuth2Box_test.go @@ -6,7 +6,7 @@ import ( ) func TestOAuth2BoxModel(t *testing.T) { - model := OAuth2Box{ Id: "github", Enabled: true, ClientId: "deglcs00000000000000000000x2og6y", ClientSecret: "your-oauth2-client-secret", } + model := OAuth2Box{ Id: "github", Enabled: true, ClientId: "deglcs00000000000000000000x2og6y", ClientSecret: "OKM1f100000000000000000000eshEif", } data, err := json.Marshal(model) if err != nil { diff --git a/models/oAuth2Dailymotion_test.go b/models/oAuth2Dailymotion_test.go index c2249895..f5852c72 100644 --- a/models/oAuth2Dailymotion_test.go +++ b/models/oAuth2Dailymotion_test.go @@ -6,7 +6,7 @@ import ( ) func TestOAuth2DailymotionModel(t *testing.T) { - model := OAuth2Dailymotion{ Id: "github", Enabled: true, ApiKey: "07a9000000000000067f", ApiSecret: "your-oauth2-client-secret", } + model := OAuth2Dailymotion{ Id: "github", Enabled: true, ApiKey: "07a9000000000000067f", ApiSecret: "a399a90000000000000000000000000000d90639", } data, err := json.Marshal(model) if err != nil { diff --git a/models/oAuth2Discord_test.go b/models/oAuth2Discord_test.go index 8b419b6d..d03aa3dd 100644 --- a/models/oAuth2Discord_test.go +++ b/models/oAuth2Discord_test.go @@ -6,7 +6,7 @@ import ( ) func TestOAuth2DiscordModel(t *testing.T) { - model := OAuth2Discord{ Id: "github", Enabled: true, ClientId: "950722000000343754", ClientSecret: "your-oauth2-client-secret", } + model := OAuth2Discord{ Id: "github", Enabled: true, ClientId: "950722000000343754", ClientSecret: "YmPXnM000000000000000000002zFg5D", } data, err := json.Marshal(model) if err != nil { diff --git a/models/oAuth2Disqus_test.go b/models/oAuth2Disqus_test.go index 6b519b7a..74985cbc 100644 --- a/models/oAuth2Disqus_test.go +++ b/models/oAuth2Disqus_test.go @@ -6,7 +6,7 @@ import ( ) func TestOAuth2DisqusModel(t *testing.T) { - model := OAuth2Disqus{ Id: "github", Enabled: true, PublicKey: "cgegH70000000000000000000000000000000000000000000000000000Hr1nYX", SecretKey: "your-oauth2-client-secret", } + model := OAuth2Disqus{ Id: "github", Enabled: true, PublicKey: "cgegH70000000000000000000000000000000000000000000000000000Hr1nYX", SecretKey: "W7Bykj00000000000000000000000000000000000000000000000000003o43w9", } data, err := json.Marshal(model) if err != nil { diff --git a/models/oAuth2Dropbox_test.go b/models/oAuth2Dropbox_test.go index 4084c46b..44d4d794 100644 --- a/models/oAuth2Dropbox_test.go +++ b/models/oAuth2Dropbox_test.go @@ -6,7 +6,7 @@ import ( ) func TestOAuth2DropboxModel(t *testing.T) { - model := OAuth2Dropbox{ Id: "github", Enabled: true, AppKey: "jl000000000009t", AppSecret: "your-oauth2-client-secret", } + model := OAuth2Dropbox{ Id: "github", Enabled: true, AppKey: "jl000000000009t", AppSecret: "g200000000000vw", } data, err := json.Marshal(model) if err != nil { diff --git a/models/oAuth2Etsy_test.go b/models/oAuth2Etsy_test.go index dc364122..e42ee6a1 100644 --- a/models/oAuth2Etsy_test.go +++ b/models/oAuth2Etsy_test.go @@ -6,7 +6,7 @@ import ( ) func TestOAuth2EtsyModel(t *testing.T) { - model := OAuth2Etsy{ Id: "github", Enabled: true, KeyString: "nsgzxh0000000000008j85a2", SharedSecret: "your-oauth2-client-secret", } + model := OAuth2Etsy{ Id: "github", Enabled: true, KeyString: "nsgzxh0000000000008j85a2", SharedSecret: "tp000000ru", } data, err := json.Marshal(model) if err != nil { diff --git a/models/oAuth2Facebook_test.go b/models/oAuth2Facebook_test.go index fa6f631d..b3d5476f 100644 --- a/models/oAuth2Facebook_test.go +++ b/models/oAuth2Facebook_test.go @@ -6,7 +6,7 @@ import ( ) func TestOAuth2FacebookModel(t *testing.T) { - model := OAuth2Facebook{ Id: "github", Enabled: true, AppId: "260600000007694", AppSecret: "your-oauth2-client-secret", } + model := OAuth2Facebook{ Id: "github", Enabled: true, AppId: "260600000007694", AppSecret: "2d0b2800000000000000000000d38af4", } data, err := json.Marshal(model) if err != nil { diff --git a/models/oAuth2Figma_test.go b/models/oAuth2Figma_test.go index db8d5b7c..6765b0a3 100644 --- a/models/oAuth2Figma_test.go +++ b/models/oAuth2Figma_test.go @@ -6,7 +6,7 @@ import ( ) func TestOAuth2FigmaModel(t *testing.T) { - model := OAuth2Figma{ Id: "github", Enabled: true, ClientId: "byay5H0000000000VtiI40", ClientSecret: "your-oauth2-client-secret", } + model := OAuth2Figma{ Id: "github", Enabled: true, ClientId: "byay5H0000000000VtiI40", ClientSecret: "yEpOYn0000000000000000004iIsU5", } data, err := json.Marshal(model) if err != nil { diff --git a/models/oAuth2FusionAuth_test.go b/models/oAuth2FusionAuth_test.go index 8b4f458b..f4acd5a7 100644 --- a/models/oAuth2FusionAuth_test.go +++ b/models/oAuth2FusionAuth_test.go @@ -6,7 +6,7 @@ import ( ) func TestOAuth2FusionAuthModel(t *testing.T) { - model := OAuth2FusionAuth{ Id: "github", Enabled: true, ClientId: "b2222c00-0000-0000-0000-000000862097", ClientSecret: "your-oauth2-client-secret", Endpoint: "example.fusionauth.io", } + model := OAuth2FusionAuth{ Id: "github", Enabled: true, ClientId: "b2222c00-0000-0000-0000-000000862097", ClientSecret: "Jx4s0C0000000000000000000000000000000wGqLsc", Endpoint: "example.fusionauth.io", } data, err := json.Marshal(model) if err != nil { diff --git a/models/oAuth2Github_test.go b/models/oAuth2Github_test.go index b059302b..d56c255d 100644 --- a/models/oAuth2Github_test.go +++ b/models/oAuth2Github_test.go @@ -6,7 +6,7 @@ import ( ) func TestOAuth2GithubModel(t *testing.T) { - model := OAuth2Github{ Id: "github", Enabled: true, ClientId: "e4d87900000000540733", ClientSecret: "your-oauth2-client-secret", } + model := OAuth2Github{ Id: "github", Enabled: true, ClientId: "e4d87900000000540733", ClientSecret: "5e07c00000000000000000000000000000198bcc", } data, err := json.Marshal(model) if err != nil { diff --git a/models/oAuth2Gitlab_test.go b/models/oAuth2Gitlab_test.go index 698cd06d..6e9c90c4 100644 --- a/models/oAuth2Gitlab_test.go +++ b/models/oAuth2Gitlab_test.go @@ -6,7 +6,7 @@ import ( ) func TestOAuth2GitlabModel(t *testing.T) { - model := OAuth2Gitlab{ Id: "github", Enabled: true, ApplicationId: "d41ffe0000000000000000000000000000000000000000000000000000d5e252", Secret: "your-oauth2-client-secret", Endpoint: "https://gitlab.com", } + model := OAuth2Gitlab{ Id: "github", Enabled: true, ApplicationId: "d41ffe0000000000000000000000000000000000000000000000000000d5e252", Secret: "gloas-838cfa0000000000000000000000000000000000000000000000000000ecbb38", Endpoint: "https://gitlab.com", } data, err := json.Marshal(model) if err != nil { diff --git a/models/oAuth2Google_test.go b/models/oAuth2Google_test.go index 6ca89e43..8921d4cd 100644 --- a/models/oAuth2Google_test.go +++ b/models/oAuth2Google_test.go @@ -6,7 +6,7 @@ import ( ) func TestOAuth2GoogleModel(t *testing.T) { - model := OAuth2Google{ Id: "github", Enabled: true, ClientId: "120000000095-92ifjb00000000000000000000g7ijfb.apps.googleusercontent.com", ClientSecret: "your-oauth2-client-secret", Prompt: []string{"test"}, } + model := OAuth2Google{ Id: "github", Enabled: true, ClientId: "120000000095-92ifjb00000000000000000000g7ijfb.apps.googleusercontent.com", ClientSecret: "GOCSPX-2k8gsR0000000000000000VNahJj", Prompt: []string{"test"}, } data, err := json.Marshal(model) if err != nil { diff --git a/models/oAuth2Keycloak_test.go b/models/oAuth2Keycloak_test.go index e13ddf4c..50ca7e79 100644 --- a/models/oAuth2Keycloak_test.go +++ b/models/oAuth2Keycloak_test.go @@ -6,7 +6,7 @@ import ( ) func TestOAuth2KeycloakModel(t *testing.T) { - model := OAuth2Keycloak{ Id: "github", Enabled: true, ClientId: "appwrite-o0000000st-app", ClientSecret: "your-oauth2-client-secret", Endpoint: "keycloak.example.com", RealmName: "appwrite-realm", } + model := OAuth2Keycloak{ Id: "github", Enabled: true, ClientId: "appwrite-o0000000st-app", ClientSecret: "jdjrJd00000000000000000000HUsaZO", Endpoint: "keycloak.example.com", RealmName: "appwrite-realm", } data, err := json.Marshal(model) if err != nil { diff --git a/models/oAuth2Kick_test.go b/models/oAuth2Kick_test.go index 7766d64d..33e96f41 100644 --- a/models/oAuth2Kick_test.go +++ b/models/oAuth2Kick_test.go @@ -6,7 +6,7 @@ import ( ) func TestOAuth2KickModel(t *testing.T) { - model := OAuth2Kick{ Id: "github", Enabled: true, ClientId: "01KQ7C00000000000001MFHS32", ClientSecret: "your-oauth2-client-secret", } + model := OAuth2Kick{ Id: "github", Enabled: true, ClientId: "01KQ7C00000000000001MFHS32", ClientSecret: "34ac5600000000000000000000000000000000000000000000000000e830c8b", } data, err := json.Marshal(model) if err != nil { diff --git a/models/oAuth2Linkedin_test.go b/models/oAuth2Linkedin_test.go index e1387f01..256e4948 100644 --- a/models/oAuth2Linkedin_test.go +++ b/models/oAuth2Linkedin_test.go @@ -6,7 +6,7 @@ import ( ) func TestOAuth2LinkedinModel(t *testing.T) { - model := OAuth2Linkedin{ Id: "github", Enabled: true, ClientId: "770000000000dv", PrimaryClientSecret: "your-oauth2-client-secret", } + model := OAuth2Linkedin{ Id: "github", Enabled: true, ClientId: "770000000000dv", PrimaryClientSecret: "WPL_AP1.2Bf0000000000000./HtlYw==", } data, err := json.Marshal(model) if err != nil { diff --git a/models/oAuth2Microsoft_test.go b/models/oAuth2Microsoft_test.go index 6646a82e..188dee22 100644 --- a/models/oAuth2Microsoft_test.go +++ b/models/oAuth2Microsoft_test.go @@ -6,7 +6,7 @@ import ( ) func TestOAuth2MicrosoftModel(t *testing.T) { - model := OAuth2Microsoft{ Id: "github", Enabled: true, ApplicationId: "00001111-aaaa-2222-bbbb-3333cccc4444", ApplicationSecret: "your-oauth2-client-secret", Tenant: "common", } + model := OAuth2Microsoft{ Id: "github", Enabled: true, ApplicationId: "00001111-aaaa-2222-bbbb-3333cccc4444", ApplicationSecret: "A1bC2dE3fH4iJ5kL6mN7oP8qR9sT0u", Tenant: "common", } data, err := json.Marshal(model) if err != nil { diff --git a/models/oAuth2Notion_test.go b/models/oAuth2Notion_test.go index 9b0b1ac7..37602278 100644 --- a/models/oAuth2Notion_test.go +++ b/models/oAuth2Notion_test.go @@ -6,7 +6,7 @@ import ( ) func TestOAuth2NotionModel(t *testing.T) { - model := OAuth2Notion{ Id: "github", Enabled: true, OauthClientId: "341d8700-0000-0000-0000-000000446ee3", OauthClientSecret: "your-oauth2-client-secret", } + model := OAuth2Notion{ Id: "github", Enabled: true, OauthClientId: "341d8700-0000-0000-0000-000000446ee3", OauthClientSecret: "secret_dLUr4b000000000000000000000000000000lFHAa9", } data, err := json.Marshal(model) if err != nil { diff --git a/models/oAuth2Oidc_test.go b/models/oAuth2Oidc_test.go index ec4962ad..c9229d87 100644 --- a/models/oAuth2Oidc_test.go +++ b/models/oAuth2Oidc_test.go @@ -6,7 +6,7 @@ import ( ) func TestOAuth2OidcModel(t *testing.T) { - model := OAuth2Oidc{ Id: "github", Enabled: true, ClientId: "qibI2x0000000000000000000000000006L2YFoG", ClientSecret: "your-oauth2-client-secret", WellKnownURL: "https://myoauth.com/.well-known/openid-configuration", AuthorizationURL: "https://myoauth.com/oauth2/authorize", TokenURL: "https://myoauth.com/oauth2/token", UserInfoURL: "https://myoauth.com/oauth2/userinfo", } + model := OAuth2Oidc{ Id: "github", Enabled: true, ClientId: "qibI2x0000000000000000000000000006L2YFoG", ClientSecret: "Ah68ed000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003qpcHV", WellKnownURL: "https://myoauth.com/.well-known/openid-configuration", AuthorizationURL: "https://myoauth.com/oauth2/authorize", TokenURL: "https://myoauth.com/oauth2/token", UserInfoURL: "https://myoauth.com/oauth2/userinfo", } data, err := json.Marshal(model) if err != nil { diff --git a/models/oAuth2Okta_test.go b/models/oAuth2Okta_test.go index 22ab478b..46c5212d 100644 --- a/models/oAuth2Okta_test.go +++ b/models/oAuth2Okta_test.go @@ -6,7 +6,7 @@ import ( ) func TestOAuth2OktaModel(t *testing.T) { - model := OAuth2Okta{ Id: "github", Enabled: true, ClientId: "0oa00000000000000698", ClientSecret: "your-oauth2-client-secret", Domain: "trial-6400025.okta.com", AuthorizationServerId: "aus000000000000000h7z", } + model := OAuth2Okta{ Id: "github", Enabled: true, ClientId: "0oa00000000000000698", ClientSecret: "Kiq0000000000000000000000000000000000000-00000000000H2L5-3SJ-vRV", Domain: "trial-6400025.okta.com", AuthorizationServerId: "aus000000000000000h7z", } data, err := json.Marshal(model) if err != nil { diff --git a/models/oAuth2Paypal_test.go b/models/oAuth2Paypal_test.go index 910b1c17..b3826177 100644 --- a/models/oAuth2Paypal_test.go +++ b/models/oAuth2Paypal_test.go @@ -6,7 +6,7 @@ import ( ) func TestOAuth2PaypalModel(t *testing.T) { - model := OAuth2Paypal{ Id: "github", Enabled: true, ClientId: "AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB", SecretKey: "your-oauth2-client-secret", } + model := OAuth2Paypal{ Id: "github", Enabled: true, ClientId: "AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB", SecretKey: "EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp", } data, err := json.Marshal(model) if err != nil { diff --git a/models/oAuth2Podio_test.go b/models/oAuth2Podio_test.go index cabd8e69..2b20d03d 100644 --- a/models/oAuth2Podio_test.go +++ b/models/oAuth2Podio_test.go @@ -6,7 +6,7 @@ import ( ) func TestOAuth2PodioModel(t *testing.T) { - model := OAuth2Podio{ Id: "github", Enabled: true, ClientId: "appwrite-oauth-test-app", ClientSecret: "your-oauth2-client-secret", } + model := OAuth2Podio{ Id: "github", Enabled: true, ClientId: "appwrite-oauth-test-app", ClientSecret: "Rn247T0000000000000000000000000000000000000000000000000000W2zWTN", } data, err := json.Marshal(model) if err != nil { diff --git a/models/oAuth2Salesforce_test.go b/models/oAuth2Salesforce_test.go index 635907f2..6f9c818f 100644 --- a/models/oAuth2Salesforce_test.go +++ b/models/oAuth2Salesforce_test.go @@ -6,7 +6,7 @@ import ( ) func TestOAuth2SalesforceModel(t *testing.T) { - model := OAuth2Salesforce{ Id: "github", Enabled: true, CustomerKey: "3MVG9I0000000000000000000000000000000000000000000000000000000000000000000000000C5Aejq", CustomerSecret: "your-oauth2-client-secret", } + model := OAuth2Salesforce{ Id: "github", Enabled: true, CustomerKey: "3MVG9I0000000000000000000000000000000000000000000000000000000000000000000000000C5Aejq", CustomerSecret: "3w000000000000e2", } data, err := json.Marshal(model) if err != nil { diff --git a/models/oAuth2Slack_test.go b/models/oAuth2Slack_test.go index a172c638..417079dc 100644 --- a/models/oAuth2Slack_test.go +++ b/models/oAuth2Slack_test.go @@ -6,7 +6,7 @@ import ( ) func TestOAuth2SlackModel(t *testing.T) { - model := OAuth2Slack{ Id: "github", Enabled: true, ClientId: "23000000089.15000000000023", ClientSecret: "your-oauth2-client-secret", } + model := OAuth2Slack{ Id: "github", Enabled: true, ClientId: "23000000089.15000000000023", ClientSecret: "81656000000000000000000000f3d2fd", } data, err := json.Marshal(model) if err != nil { diff --git a/models/oAuth2Spotify_test.go b/models/oAuth2Spotify_test.go index 71b898e8..5c3ec029 100644 --- a/models/oAuth2Spotify_test.go +++ b/models/oAuth2Spotify_test.go @@ -6,7 +6,7 @@ import ( ) func TestOAuth2SpotifyModel(t *testing.T) { - model := OAuth2Spotify{ Id: "github", Enabled: true, ClientId: "6ec271000000000000000000009beace", ClientSecret: "your-oauth2-client-secret", } + model := OAuth2Spotify{ Id: "github", Enabled: true, ClientId: "6ec271000000000000000000009beace", ClientSecret: "db068a000000000000000000008b5b9f", } data, err := json.Marshal(model) if err != nil { diff --git a/models/oAuth2Stripe_test.go b/models/oAuth2Stripe_test.go index 5ffe5730..3bda33de 100644 --- a/models/oAuth2Stripe_test.go +++ b/models/oAuth2Stripe_test.go @@ -6,7 +6,7 @@ import ( ) func TestOAuth2StripeModel(t *testing.T) { - model := OAuth2Stripe{ Id: "github", Enabled: true, ClientId: "ca_UKibXX0000000000000000000006byvR", ApiSecretKey: "your-oauth2-client-secret", } + model := OAuth2Stripe{ Id: "github", Enabled: true, ClientId: "ca_UKibXX0000000000000000000006byvR", ApiSecretKey: "sk_51SfOd000000000000000000000000000000000000000000000000000000000000000000000000000000000000000QGWYfp", } data, err := json.Marshal(model) if err != nil { diff --git a/models/oAuth2Tradeshift_test.go b/models/oAuth2Tradeshift_test.go index b879f8ec..f7eec444 100644 --- a/models/oAuth2Tradeshift_test.go +++ b/models/oAuth2Tradeshift_test.go @@ -6,7 +6,7 @@ import ( ) func TestOAuth2TradeshiftModel(t *testing.T) { - model := OAuth2Tradeshift{ Id: "github", Enabled: true, Oauth2ClientId: "appwrite-test-org.appwrite-test-app", Oauth2ClientSecret: "your-oauth2-client-secret", } + model := OAuth2Tradeshift{ Id: "github", Enabled: true, Oauth2ClientId: "appwrite-test-org.appwrite-test-app", Oauth2ClientSecret: "7cb52700-0000-0000-0000-000000ca5b83", } data, err := json.Marshal(model) if err != nil { diff --git a/models/oAuth2Twitch_test.go b/models/oAuth2Twitch_test.go index d1a5d913..ba5c231b 100644 --- a/models/oAuth2Twitch_test.go +++ b/models/oAuth2Twitch_test.go @@ -6,7 +6,7 @@ import ( ) func TestOAuth2TwitchModel(t *testing.T) { - model := OAuth2Twitch{ Id: "github", Enabled: true, ClientId: "vvi0in000000000000000000ikmt9p", ClientSecret: "your-oauth2-client-secret", } + model := OAuth2Twitch{ Id: "github", Enabled: true, ClientId: "vvi0in000000000000000000ikmt9p", ClientSecret: "pmapue000000000000000000zylw3v", } data, err := json.Marshal(model) if err != nil { diff --git a/models/oAuth2WordPress_test.go b/models/oAuth2WordPress_test.go index e075e47d..726a697f 100644 --- a/models/oAuth2WordPress_test.go +++ b/models/oAuth2WordPress_test.go @@ -6,7 +6,7 @@ import ( ) func TestOAuth2WordPressModel(t *testing.T) { - model := OAuth2WordPress{ Id: "github", Enabled: true, ClientId: "130005", ClientSecret: "your-oauth2-client-secret", } + model := OAuth2WordPress{ Id: "github", Enabled: true, ClientId: "130005", ClientSecret: "PlBfJS0000000000000000000000000000000000000000000000000000EdUZJk", } data, err := json.Marshal(model) if err != nil { diff --git a/models/oAuth2X_test.go b/models/oAuth2X_test.go index 0dc342ac..e8b68fc1 100644 --- a/models/oAuth2X_test.go +++ b/models/oAuth2X_test.go @@ -6,7 +6,7 @@ import ( ) func TestOAuth2XModel(t *testing.T) { - model := OAuth2X{ Id: "github", Enabled: true, CustomerKey: "slzZV0000000000000NFLaWT", SecretKey: "your-oauth2-client-secret", } + model := OAuth2X{ Id: "github", Enabled: true, CustomerKey: "slzZV0000000000000NFLaWT", SecretKey: "tkEPkp00000000000000000000000000000000000000FTxbI9", } data, err := json.Marshal(model) if err != nil { diff --git a/models/oAuth2Yahoo_test.go b/models/oAuth2Yahoo_test.go index a438d539..c0adc5e3 100644 --- a/models/oAuth2Yahoo_test.go +++ b/models/oAuth2Yahoo_test.go @@ -6,7 +6,7 @@ import ( ) func TestOAuth2YahooModel(t *testing.T) { - model := OAuth2Yahoo{ Id: "github", Enabled: true, ClientId: "dj0yJm000000000000000000000000000000000000000000000000000000000000000000000000000000000000Z4PWRm", ClientSecret: "your-oauth2-client-secret", } + model := OAuth2Yahoo{ Id: "github", Enabled: true, ClientId: "dj0yJm000000000000000000000000000000000000000000000000000000000000000000000000000000000000Z4PWRm", ClientSecret: "cf978f0000000000000000000000000000c5e2e9", } data, err := json.Marshal(model) if err != nil { diff --git a/models/oAuth2Yandex_test.go b/models/oAuth2Yandex_test.go index db174737..a6e15a7a 100644 --- a/models/oAuth2Yandex_test.go +++ b/models/oAuth2Yandex_test.go @@ -6,7 +6,7 @@ import ( ) func TestOAuth2YandexModel(t *testing.T) { - model := OAuth2Yandex{ Id: "github", Enabled: true, ClientId: "6a8a6a0000000000000000000091483c", ClientSecret: "your-oauth2-client-secret", } + model := OAuth2Yandex{ Id: "github", Enabled: true, ClientId: "6a8a6a0000000000000000000091483c", ClientSecret: "bbf98500000000000000000000c75a63", } data, err := json.Marshal(model) if err != nil { diff --git a/models/oAuth2Zoho_test.go b/models/oAuth2Zoho_test.go index 847c454f..8265b406 100644 --- a/models/oAuth2Zoho_test.go +++ b/models/oAuth2Zoho_test.go @@ -6,7 +6,7 @@ import ( ) func TestOAuth2ZohoModel(t *testing.T) { - model := OAuth2Zoho{ Id: "github", Enabled: true, ClientId: "1000.83C178000000000000000000RPNX0B", ClientSecret: "your-oauth2-client-secret", } + model := OAuth2Zoho{ Id: "github", Enabled: true, ClientId: "1000.83C178000000000000000000RPNX0B", ClientSecret: "fb5cac000000000000000000000000000000a68f6e", } data, err := json.Marshal(model) if err != nil { diff --git a/models/oAuth2Zoom_test.go b/models/oAuth2Zoom_test.go index 02c315bd..fe4b7e35 100644 --- a/models/oAuth2Zoom_test.go +++ b/models/oAuth2Zoom_test.go @@ -6,7 +6,7 @@ import ( ) func TestOAuth2ZoomModel(t *testing.T) { - model := OAuth2Zoom{ Id: "github", Enabled: true, ClientId: "QMAC00000000000000w0AQ", ClientSecret: "your-oauth2-client-secret", } + model := OAuth2Zoom{ Id: "github", Enabled: true, ClientId: "QMAC00000000000000w0AQ", ClientSecret: "GAWsG4000000000000000000007U01ON", } data, err := json.Marshal(model) if err != nil { diff --git a/models/policyList_test.go b/models/policyList_test.go index d030db26..91531030 100644 --- a/models/policyList_test.go +++ b/models/policyList_test.go @@ -6,7 +6,7 @@ import ( ) func TestPolicyListModel(t *testing.T) { - model := PolicyList{ Total: 9, Policies: []interface{}{}, } + model := PolicyList{ Total: 10, Policies: []interface{}{}, } data, err := json.Marshal(model) if err != nil { diff --git a/models/policyPasswordStrength.go b/models/policyPasswordStrength.go new file mode 100644 index 00000000..452afb4f --- /dev/null +++ b/models/policyPasswordStrength.go @@ -0,0 +1,43 @@ +package models + +import ( + "encoding/json" + "errors" +) + +// PolicyPasswordStrength Model +type PolicyPasswordStrength struct { + // Policy ID. + Id string `json:"$id"` + // Minimum password length required for user passwords. + Min int `json:"min"` + // Whether passwords must include at least one uppercase letter. + Uppercase bool `json:"uppercase"` + // Whether passwords must include at least one lowercase letter. + Lowercase bool `json:"lowercase"` + // Whether passwords must include at least one number. + Number bool `json:"number"` + // Whether passwords must include at least one symbol. + Symbols bool `json:"symbols"` + + // Used by Decode() method + data []byte +} + +func (model PolicyPasswordStrength) New(data []byte) *PolicyPasswordStrength { + model.data = data + return &model +} + +func (model *PolicyPasswordStrength) Decode(value interface{}) error { + if len(model.data) <= 0 { + return errors.New("method Decode() cannot be used on nested struct") + } + + err := json.Unmarshal(model.data, value) + if err != nil { + return err + } + + return nil +} \ No newline at end of file diff --git a/models/policyPasswordStrength_test.go b/models/policyPasswordStrength_test.go new file mode 100644 index 00000000..5b6211bc --- /dev/null +++ b/models/policyPasswordStrength_test.go @@ -0,0 +1,38 @@ +package models + +import ( + "encoding/json" + "testing" +) + +func TestPolicyPasswordStrengthModel(t *testing.T) { + model := PolicyPasswordStrength{ Id: "password-dictionary", Min: 12, Uppercase: true, Lowercase: true, Number: true, Symbols: true, } + + data, err := json.Marshal(model) + if err != nil { + t.Fatal(err) + } + + var result PolicyPasswordStrength + err = json.Unmarshal(data, &result) + if err != nil { + t.Fatal(err) + } + if result.Id != model.Id { + t.Errorf("Expected Id %v, got %v", model.Id, result.Id) + } + if result.Min != model.Min { + t.Errorf("Expected Min %v, got %v", model.Min, result.Min) + } + if result.Uppercase != model.Uppercase { + t.Errorf("Expected Uppercase %v, got %v", model.Uppercase, result.Uppercase) + } + if result.Lowercase != model.Lowercase { + t.Errorf("Expected Lowercase %v, got %v", model.Lowercase, result.Lowercase) + } + if result.Number != model.Number { + t.Errorf("Expected Number %v, got %v", model.Number, result.Number) + } + if result.Symbols != model.Symbols { + t.Errorf("Expected Symbols %v, got %v", model.Symbols, result.Symbols) + }} diff --git a/models/project.go b/models/project.go index 58c884b5..d8c68382 100644 --- a/models/project.go +++ b/models/project.go @@ -17,6 +17,8 @@ type Project struct { Name string `json:"name"` // Project team ID. TeamId string `json:"teamId"` + // Project region + Region string `json:"region"` // Deprecated since 1.9.5: List of dev keys. DevKeys []DevKey `json:"devKeys"` // Status for custom SMTP @@ -54,15 +56,35 @@ type Project struct { Services []ProjectService `json:"services"` // List of protocols. Protocols []ProjectProtocol `json:"protocols"` - // Project region - Region string `json:"region"` - // Billing limits reached - BillingLimits BillingLimits `json:"billingLimits"` // Project blocks information Blocks []Block `json:"blocks"` // Last time the project was accessed via console. Used with plan's // projectInactivityDays to determine if project is paused. ConsoleAccessedAt string `json:"consoleAccessedAt"` + // Billing limits reached + BillingLimits BillingLimits `json:"billingLimits"` + // OAuth2 server status + OAuth2ServerEnabled bool `json:"oAuth2ServerEnabled"` + // OAuth2 server authorization URL + OAuth2ServerAuthorizationUrl string `json:"oAuth2ServerAuthorizationUrl"` + // OAuth2 server allowed scopes + OAuth2ServerScopes []string `json:"oAuth2ServerScopes"` + // OAuth2 server access token duration in seconds for confidential clients + OAuth2ServerAccessTokenDuration int `json:"oAuth2ServerAccessTokenDuration"` + // OAuth2 server refresh token duration in seconds for confidential clients + OAuth2ServerRefreshTokenDuration int `json:"oAuth2ServerRefreshTokenDuration"` + // OAuth2 server access token duration in seconds for public clients (SPAs, + // mobile, native) + OAuth2ServerPublicAccessTokenDuration int `json:"oAuth2ServerPublicAccessTokenDuration"` + // OAuth2 server refresh token duration in seconds for public clients (SPAs, + // mobile, native) + OAuth2ServerPublicRefreshTokenDuration int `json:"oAuth2ServerPublicRefreshTokenDuration"` + // When enabled, PKCE is required for confidential clients (server-side flows + // using client_secret). PKCE is always required for public clients regardless + // of this setting. + OAuth2ServerConfidentialPkce bool `json:"oAuth2ServerConfidentialPkce"` + // OAuth2 server discovery URL + OAuth2ServerDiscoveryUrl string `json:"oAuth2ServerDiscoveryUrl"` // Used by Decode() method data []byte diff --git a/models/projectList_test.go b/models/projectList_test.go index 7e55d105..cc1ddd23 100644 --- a/models/projectList_test.go +++ b/models/projectList_test.go @@ -6,12 +6,12 @@ import ( ) func TestProjectListModel(t *testing.T) { - model := ProjectList{ Total: 5, Projects: []Project{Project{ Id: "5e5ea5c16897e", CreatedAt: "2020-10-15T06:38:00.000+00:00", UpdatedAt: "2020-10-15T06:38:00.000+00:00", Name: "New Project", TeamId: "1592981250", DevKeys: []DevKey{DevKey{ Id: "5e5ea5c16897e", CreatedAt: "2020-10-15T06:38:00.000+00:00", UpdatedAt: "2020-10-15T06:38:00.000+00:00", Name: "Dev API Key", Expire: "2020-10-15T06:38:00.000+00:00", Secret: "919c2d18fb5d4...a2ae413da83346ad2", AccessedAt: "2020-10-15T06:38:00.000+00:00", Sdks: []string{"test"}, }, + model := ProjectList{ Total: 5, Projects: []Project{Project{ Id: "5e5ea5c16897e", CreatedAt: "2020-10-15T06:38:00.000+00:00", UpdatedAt: "2020-10-15T06:38:00.000+00:00", Name: "New Project", TeamId: "1592981250", Region: "fra", DevKeys: []DevKey{DevKey{ Id: "5e5ea5c16897e", CreatedAt: "2020-10-15T06:38:00.000+00:00", UpdatedAt: "2020-10-15T06:38:00.000+00:00", Name: "Dev API Key", Expire: "2020-10-15T06:38:00.000+00:00", Secret: "919c2d18fb5d4...a2ae413da83346ad2", AccessedAt: "2020-10-15T06:38:00.000+00:00", Sdks: []string{"test"}, }, }, SmtpEnabled: true, SmtpSenderName: "John Appwrite", SmtpSenderEmail: "john@appwrite.io", SmtpReplyToName: "Support Team", SmtpReplyToEmail: "support@appwrite.io", SmtpHost: "mail.appwrite.io", SmtpPort: 25, SmtpUsername: "emailuser", SmtpPassword: "string", SmtpSecure: "tls", PingCount: 1, PingedAt: "2020-10-15T06:38:00.000+00:00", Labels: []string{"test"}, Status: "active", AuthMethods: []ProjectAuthMethod{ProjectAuthMethod{ Id: "email-password", Enabled: true, }, }, Services: []ProjectService{ProjectService{ Id: "sites", Enabled: true, }, }, Protocols: []ProjectProtocol{ProjectProtocol{ Id: "graphql", Enabled: true, }, - }, Region: "fra", Blocks: []Block{Block{ CreatedAt: "2020-10-15T06:38:00.000+00:00", ResourceType: "project", ResourceId: "5e5ea5c16897e", ProjectName: "My Project", Region: "fra", OrganizationName: "Acme Inc.", OrganizationId: "5e5ea5c16897e", BillingPlan: "pro", }, - }, ConsoleAccessedAt: "2020-10-15T06:38:00.000+00:00", }, + }, Blocks: []Block{Block{ CreatedAt: "2020-10-15T06:38:00.000+00:00", ResourceType: "project", ResourceId: "5e5ea5c16897e", ProjectName: "My Project", Region: "fra", OrganizationName: "Acme Inc.", OrganizationId: "5e5ea5c16897e", BillingPlan: "pro", }, + }, ConsoleAccessedAt: "2020-10-15T06:38:00.000+00:00", OAuth2ServerEnabled: true, OAuth2ServerAuthorizationUrl: "https://cloud.appwrite.io/oauth2/.well-known/openid-configuration", OAuth2ServerScopes: []string{"test"}, OAuth2ServerAccessTokenDuration: 3600, OAuth2ServerRefreshTokenDuration: 86400, OAuth2ServerPublicAccessTokenDuration: 3600, OAuth2ServerPublicRefreshTokenDuration: 2592000, OAuth2ServerConfidentialPkce: true, OAuth2ServerDiscoveryUrl: "https://auth.example.com/.well-known/openid-configuration", }, }, } data, err := json.Marshal(model) diff --git a/models/project_test.go b/models/project_test.go index c0bcf763..dce32dbf 100644 --- a/models/project_test.go +++ b/models/project_test.go @@ -6,12 +6,12 @@ import ( ) func TestProjectModel(t *testing.T) { - model := Project{ Id: "5e5ea5c16897e", CreatedAt: "2020-10-15T06:38:00.000+00:00", UpdatedAt: "2020-10-15T06:38:00.000+00:00", Name: "New Project", TeamId: "1592981250", DevKeys: []DevKey{DevKey{ Id: "5e5ea5c16897e", CreatedAt: "2020-10-15T06:38:00.000+00:00", UpdatedAt: "2020-10-15T06:38:00.000+00:00", Name: "Dev API Key", Expire: "2020-10-15T06:38:00.000+00:00", Secret: "919c2d18fb5d4...a2ae413da83346ad2", AccessedAt: "2020-10-15T06:38:00.000+00:00", Sdks: []string{"test"}, }, + model := Project{ Id: "5e5ea5c16897e", CreatedAt: "2020-10-15T06:38:00.000+00:00", UpdatedAt: "2020-10-15T06:38:00.000+00:00", Name: "New Project", TeamId: "1592981250", Region: "fra", DevKeys: []DevKey{DevKey{ Id: "5e5ea5c16897e", CreatedAt: "2020-10-15T06:38:00.000+00:00", UpdatedAt: "2020-10-15T06:38:00.000+00:00", Name: "Dev API Key", Expire: "2020-10-15T06:38:00.000+00:00", Secret: "919c2d18fb5d4...a2ae413da83346ad2", AccessedAt: "2020-10-15T06:38:00.000+00:00", Sdks: []string{"test"}, }, }, SmtpEnabled: true, SmtpSenderName: "John Appwrite", SmtpSenderEmail: "john@appwrite.io", SmtpReplyToName: "Support Team", SmtpReplyToEmail: "support@appwrite.io", SmtpHost: "mail.appwrite.io", SmtpPort: 25, SmtpUsername: "emailuser", SmtpPassword: "string", SmtpSecure: "tls", PingCount: 1, PingedAt: "2020-10-15T06:38:00.000+00:00", Labels: []string{"test"}, Status: "active", AuthMethods: []ProjectAuthMethod{ProjectAuthMethod{ Id: "email-password", Enabled: true, }, }, Services: []ProjectService{ProjectService{ Id: "sites", Enabled: true, }, }, Protocols: []ProjectProtocol{ProjectProtocol{ Id: "graphql", Enabled: true, }, - }, Region: "fra", Blocks: []Block{Block{ CreatedAt: "2020-10-15T06:38:00.000+00:00", ResourceType: "project", ResourceId: "5e5ea5c16897e", ProjectName: "My Project", Region: "fra", OrganizationName: "Acme Inc.", OrganizationId: "5e5ea5c16897e", BillingPlan: "pro", }, - }, ConsoleAccessedAt: "2020-10-15T06:38:00.000+00:00", } + }, Blocks: []Block{Block{ CreatedAt: "2020-10-15T06:38:00.000+00:00", ResourceType: "project", ResourceId: "5e5ea5c16897e", ProjectName: "My Project", Region: "fra", OrganizationName: "Acme Inc.", OrganizationId: "5e5ea5c16897e", BillingPlan: "pro", }, + }, ConsoleAccessedAt: "2020-10-15T06:38:00.000+00:00", OAuth2ServerEnabled: true, OAuth2ServerAuthorizationUrl: "https://cloud.appwrite.io/oauth2/.well-known/openid-configuration", OAuth2ServerScopes: []string{"test"}, OAuth2ServerAccessTokenDuration: 3600, OAuth2ServerRefreshTokenDuration: 86400, OAuth2ServerPublicAccessTokenDuration: 3600, OAuth2ServerPublicRefreshTokenDuration: 2592000, OAuth2ServerConfidentialPkce: true, OAuth2ServerDiscoveryUrl: "https://auth.example.com/.well-known/openid-configuration", } data, err := json.Marshal(model) if err != nil { @@ -38,6 +38,9 @@ func TestProjectModel(t *testing.T) { if result.TeamId != model.TeamId { t.Errorf("Expected TeamId %v, got %v", model.TeamId, result.TeamId) } + if result.Region != model.Region { + t.Errorf("Expected Region %v, got %v", model.Region, result.Region) + } if result.SmtpEnabled != model.SmtpEnabled { t.Errorf("Expected SmtpEnabled %v, got %v", model.SmtpEnabled, result.SmtpEnabled) } @@ -77,9 +80,30 @@ func TestProjectModel(t *testing.T) { if result.Status != model.Status { t.Errorf("Expected Status %v, got %v", model.Status, result.Status) } - if result.Region != model.Region { - t.Errorf("Expected Region %v, got %v", model.Region, result.Region) - } if result.ConsoleAccessedAt != model.ConsoleAccessedAt { t.Errorf("Expected ConsoleAccessedAt %v, got %v", model.ConsoleAccessedAt, result.ConsoleAccessedAt) + } + if result.OAuth2ServerEnabled != model.OAuth2ServerEnabled { + t.Errorf("Expected OAuth2ServerEnabled %v, got %v", model.OAuth2ServerEnabled, result.OAuth2ServerEnabled) + } + if result.OAuth2ServerAuthorizationUrl != model.OAuth2ServerAuthorizationUrl { + t.Errorf("Expected OAuth2ServerAuthorizationUrl %v, got %v", model.OAuth2ServerAuthorizationUrl, result.OAuth2ServerAuthorizationUrl) + } + if result.OAuth2ServerAccessTokenDuration != model.OAuth2ServerAccessTokenDuration { + t.Errorf("Expected OAuth2ServerAccessTokenDuration %v, got %v", model.OAuth2ServerAccessTokenDuration, result.OAuth2ServerAccessTokenDuration) + } + if result.OAuth2ServerRefreshTokenDuration != model.OAuth2ServerRefreshTokenDuration { + t.Errorf("Expected OAuth2ServerRefreshTokenDuration %v, got %v", model.OAuth2ServerRefreshTokenDuration, result.OAuth2ServerRefreshTokenDuration) + } + if result.OAuth2ServerPublicAccessTokenDuration != model.OAuth2ServerPublicAccessTokenDuration { + t.Errorf("Expected OAuth2ServerPublicAccessTokenDuration %v, got %v", model.OAuth2ServerPublicAccessTokenDuration, result.OAuth2ServerPublicAccessTokenDuration) + } + if result.OAuth2ServerPublicRefreshTokenDuration != model.OAuth2ServerPublicRefreshTokenDuration { + t.Errorf("Expected OAuth2ServerPublicRefreshTokenDuration %v, got %v", model.OAuth2ServerPublicRefreshTokenDuration, result.OAuth2ServerPublicRefreshTokenDuration) + } + if result.OAuth2ServerConfidentialPkce != model.OAuth2ServerConfidentialPkce { + t.Errorf("Expected OAuth2ServerConfidentialPkce %v, got %v", model.OAuth2ServerConfidentialPkce, result.OAuth2ServerConfidentialPkce) + } + if result.OAuth2ServerDiscoveryUrl != model.OAuth2ServerDiscoveryUrl { + t.Errorf("Expected OAuth2ServerDiscoveryUrl %v, got %v", model.OAuth2ServerDiscoveryUrl, result.OAuth2ServerDiscoveryUrl) }} diff --git a/organization/organization.go b/organization/organization.go index 7f4f158d..23dda457 100644 --- a/organization/organization.go +++ b/organization/organization.go @@ -60,6 +60,7 @@ func (srv *Organization) ListKeys(optionalSetters ...ListKeysOption)(*models.Key params["total"] = options.Total } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -119,6 +120,7 @@ func (srv *Organization) CreateKey(KeyId string, Name string, Scopes []string, o params["expire"] = options.Expire } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -155,6 +157,7 @@ func (srv *Organization) GetKey(KeyId string)(*models.Key, error) { params := map[string]interface{}{} params["keyId"] = KeyId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -216,6 +219,7 @@ func (srv *Organization) UpdateKey(KeyId string, Name string, Scopes []string, o params["expire"] = options.Expire } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -252,6 +256,7 @@ func (srv *Organization) DeleteKey(KeyId string)(*interface{}, error) { params := map[string]interface{}{} params["keyId"] = KeyId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -331,6 +336,7 @@ func (srv *Organization) ListProjects(optionalSetters ...ListProjectsOption)(*mo params["total"] = options.Total } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -389,6 +395,7 @@ func (srv *Organization) CreateProject(ProjectId string, Name string, optionalSe params["region"] = options.Region } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -424,6 +431,7 @@ func (srv *Organization) GetProject(ProjectId string)(*models.Project, error) { params := map[string]interface{}{} params["projectId"] = ProjectId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -459,6 +467,7 @@ func (srv *Organization) UpdateProject(ProjectId string, Name string)(*models.Pr params["projectId"] = ProjectId params["name"] = Name headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -494,6 +503,7 @@ func (srv *Organization) DeleteProject(ProjectId string)(*interface{}, error) { params := map[string]interface{}{} params["projectId"] = ProjectId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } diff --git a/organization/organization_test.go b/organization/organization_test.go index 8e2a0471..d5ec2805 100644 --- a/organization/organization_test.go +++ b/organization/organization_test.go @@ -194,6 +194,7 @@ func TestOrganization(t *testing.T) { "$updatedAt": "2020-10-15T06:38:00.000+00:00", "name": "New Project", "teamId": "1592981250", + "region": "fra", "devKeys": [ { "$id": "5e5ea5c16897e", @@ -238,7 +239,6 @@ func TestOrganization(t *testing.T) { "enabled": true } ], - "region": "fra", "blocks": [ { "$createdAt": "2020-10-15T06:38:00.000+00:00", @@ -251,7 +251,16 @@ func TestOrganization(t *testing.T) { "billingPlan": "pro" } ], - "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00" + "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00", + "oAuth2ServerEnabled": true, + "oAuth2ServerAuthorizationUrl": "https://cloud.appwrite.io/oauth2/.well-known/openid-configuration", + "oAuth2ServerScopes": [], + "oAuth2ServerAccessTokenDuration": 3600, + "oAuth2ServerRefreshTokenDuration": 86400, + "oAuth2ServerPublicAccessTokenDuration": 3600, + "oAuth2ServerPublicRefreshTokenDuration": 2592000, + "oAuth2ServerConfidentialPkce": true, + "oAuth2ServerDiscoveryUrl": "https://auth.example.com/.well-known/openid-configuration" } ] } @@ -284,6 +293,7 @@ func TestOrganization(t *testing.T) { "$updatedAt": "2020-10-15T06:38:00.000+00:00", "name": "New Project", "teamId": "1592981250", + "region": "fra", "devKeys": [ { "$id": "5e5ea5c16897e", @@ -328,7 +338,6 @@ func TestOrganization(t *testing.T) { "enabled": true } ], - "region": "fra", "blocks": [ { "$createdAt": "2020-10-15T06:38:00.000+00:00", @@ -341,7 +350,16 @@ func TestOrganization(t *testing.T) { "billingPlan": "pro" } ], - "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00" + "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00", + "oAuth2ServerEnabled": true, + "oAuth2ServerAuthorizationUrl": "https://cloud.appwrite.io/oauth2/.well-known/openid-configuration", + "oAuth2ServerScopes": [], + "oAuth2ServerAccessTokenDuration": 3600, + "oAuth2ServerRefreshTokenDuration": 86400, + "oAuth2ServerPublicAccessTokenDuration": 3600, + "oAuth2ServerPublicRefreshTokenDuration": 2592000, + "oAuth2ServerConfidentialPkce": true, + "oAuth2ServerDiscoveryUrl": "https://auth.example.com/.well-known/openid-configuration" } ` @@ -372,6 +390,7 @@ func TestOrganization(t *testing.T) { "$updatedAt": "2020-10-15T06:38:00.000+00:00", "name": "New Project", "teamId": "1592981250", + "region": "fra", "devKeys": [ { "$id": "5e5ea5c16897e", @@ -416,7 +435,6 @@ func TestOrganization(t *testing.T) { "enabled": true } ], - "region": "fra", "blocks": [ { "$createdAt": "2020-10-15T06:38:00.000+00:00", @@ -429,7 +447,16 @@ func TestOrganization(t *testing.T) { "billingPlan": "pro" } ], - "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00" + "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00", + "oAuth2ServerEnabled": true, + "oAuth2ServerAuthorizationUrl": "https://cloud.appwrite.io/oauth2/.well-known/openid-configuration", + "oAuth2ServerScopes": [], + "oAuth2ServerAccessTokenDuration": 3600, + "oAuth2ServerRefreshTokenDuration": 86400, + "oAuth2ServerPublicAccessTokenDuration": 3600, + "oAuth2ServerPublicRefreshTokenDuration": 2592000, + "oAuth2ServerConfidentialPkce": true, + "oAuth2ServerDiscoveryUrl": "https://auth.example.com/.well-known/openid-configuration" } ` @@ -460,6 +487,7 @@ func TestOrganization(t *testing.T) { "$updatedAt": "2020-10-15T06:38:00.000+00:00", "name": "New Project", "teamId": "1592981250", + "region": "fra", "devKeys": [ { "$id": "5e5ea5c16897e", @@ -504,7 +532,6 @@ func TestOrganization(t *testing.T) { "enabled": true } ], - "region": "fra", "blocks": [ { "$createdAt": "2020-10-15T06:38:00.000+00:00", @@ -517,7 +544,16 @@ func TestOrganization(t *testing.T) { "billingPlan": "pro" } ], - "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00" + "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00", + "oAuth2ServerEnabled": true, + "oAuth2ServerAuthorizationUrl": "https://cloud.appwrite.io/oauth2/.well-known/openid-configuration", + "oAuth2ServerScopes": [], + "oAuth2ServerAccessTokenDuration": 3600, + "oAuth2ServerRefreshTokenDuration": 86400, + "oAuth2ServerPublicAccessTokenDuration": 3600, + "oAuth2ServerPublicRefreshTokenDuration": 2592000, + "oAuth2ServerConfidentialPkce": true, + "oAuth2ServerDiscoveryUrl": "https://auth.example.com/.well-known/openid-configuration" } ` diff --git a/presences/presences.go b/presences/presences.go index e7d2bc59..7fcff63c 100644 --- a/presences/presences.go +++ b/presences/presences.go @@ -71,6 +71,7 @@ func (srv *Presences) List(optionalSetters ...ListOption)(*models.PresenceList, params["ttl"] = options.Ttl } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -106,6 +107,7 @@ func (srv *Presences) Get(PresenceId string)(*models.Presence, error) { params := map[string]interface{}{} params["presenceId"] = PresenceId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -188,6 +190,7 @@ func (srv *Presences) Upsert(PresenceId string, UserId string, Status string, op params["metadata"] = options.Metadata } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -293,6 +296,7 @@ func (srv *Presences) Update(PresenceId string, UserId string, optionalSetters . params["purge"] = options.Purge } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -328,6 +332,7 @@ func (srv *Presences) Delete(PresenceId string)(*interface{}, error) { params := map[string]interface{}{} params["presenceId"] = PresenceId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } diff --git a/project/project.go b/project/project.go index d3e0b502..2f4daf2b 100644 --- a/project/project.go +++ b/project/project.go @@ -26,6 +26,7 @@ func (srv *Project) Get()(*models.Project, error) { path := "/project" params := map[string]interface{}{} headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -58,6 +59,7 @@ func (srv *Project) Delete()(*interface{}, error) { path := "/project" params := map[string]interface{}{} headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -94,6 +96,7 @@ func (srv *Project) UpdateAuthMethod(MethodId string, Enabled bool)(*models.Proj params["methodId"] = MethodId params["enabled"] = Enabled headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -162,6 +165,7 @@ func (srv *Project) ListKeys(optionalSetters ...ListKeysOption)(*models.KeyList, params["total"] = options.Total } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -225,6 +229,7 @@ func (srv *Project) CreateKey(KeyId string, Name string, Scopes []string, option params["expire"] = options.Expire } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -265,6 +270,7 @@ func (srv *Project) CreateEphemeralKey(Scopes []string, Duration int)(*models.Ep params["scopes"] = Scopes params["duration"] = Duration headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -300,6 +306,7 @@ func (srv *Project) GetKey(KeyId string)(*models.Key, error) { params := map[string]interface{}{} params["keyId"] = KeyId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -361,6 +368,7 @@ func (srv *Project) UpdateKey(KeyId string, Name string, Scopes []string, option params["expire"] = options.Expire } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -397,6 +405,7 @@ func (srv *Project) DeleteKey(KeyId string)(*interface{}, error) { params := map[string]interface{}{} params["keyId"] = KeyId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -431,6 +440,7 @@ func (srv *Project) UpdateLabels(Labels []string)(*models.Project, error) { params := map[string]interface{}{} params["labels"] = Labels headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -500,6 +510,7 @@ func (srv *Project) ListMockPhones(optionalSetters ...ListMockPhonesOption)(*mod params["total"] = options.Total } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -535,6 +546,7 @@ func (srv *Project) CreateMockPhone(Number string, Otp string)(*models.MockNumbe params["number"] = Number params["otp"] = Otp headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -571,6 +583,7 @@ func (srv *Project) GetMockPhone(Number string)(*models.MockNumber, error) { params := map[string]interface{}{} params["number"] = Number headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -607,6 +620,7 @@ func (srv *Project) UpdateMockPhone(Number string, Otp string)(*models.MockNumbe params["number"] = Number params["otp"] = Otp headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -643,6 +657,7 @@ func (srv *Project) DeleteMockPhone(Number string)(*interface{}, error) { params := map[string]interface{}{} params["number"] = Number headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -712,6 +727,7 @@ func (srv *Project) ListOAuth2Providers(optionalSetters ...ListOAuth2ProvidersOp params["total"] = options.Total } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -737,6 +753,121 @@ func (srv *Project) ListOAuth2Providers(optionalSetters ...ListOAuth2ProvidersOp } return &parsed, nil +} +type UpdateOAuth2ServerOptions struct { + Scopes []string + AccessTokenDuration int + RefreshTokenDuration int + PublicAccessTokenDuration int + PublicRefreshTokenDuration int + ConfidentialPkce bool + enabledSetters map[string]bool +} +func (options UpdateOAuth2ServerOptions) New() *UpdateOAuth2ServerOptions { + options.enabledSetters = map[string]bool{ + "Scopes": false, + "AccessTokenDuration": false, + "RefreshTokenDuration": false, + "PublicAccessTokenDuration": false, + "PublicRefreshTokenDuration": false, + "ConfidentialPkce": false, + } + return &options +} +type UpdateOAuth2ServerOption func(*UpdateOAuth2ServerOptions) +func (srv *Project) WithUpdateOAuth2ServerScopes(v []string) UpdateOAuth2ServerOption { + return func(o *UpdateOAuth2ServerOptions) { + o.Scopes = v + o.enabledSetters["Scopes"] = true + } +} +func (srv *Project) WithUpdateOAuth2ServerAccessTokenDuration(v int) UpdateOAuth2ServerOption { + return func(o *UpdateOAuth2ServerOptions) { + o.AccessTokenDuration = v + o.enabledSetters["AccessTokenDuration"] = true + } +} +func (srv *Project) WithUpdateOAuth2ServerRefreshTokenDuration(v int) UpdateOAuth2ServerOption { + return func(o *UpdateOAuth2ServerOptions) { + o.RefreshTokenDuration = v + o.enabledSetters["RefreshTokenDuration"] = true + } +} +func (srv *Project) WithUpdateOAuth2ServerPublicAccessTokenDuration(v int) UpdateOAuth2ServerOption { + return func(o *UpdateOAuth2ServerOptions) { + o.PublicAccessTokenDuration = v + o.enabledSetters["PublicAccessTokenDuration"] = true + } +} +func (srv *Project) WithUpdateOAuth2ServerPublicRefreshTokenDuration(v int) UpdateOAuth2ServerOption { + return func(o *UpdateOAuth2ServerOptions) { + o.PublicRefreshTokenDuration = v + o.enabledSetters["PublicRefreshTokenDuration"] = true + } +} +func (srv *Project) WithUpdateOAuth2ServerConfidentialPkce(v bool) UpdateOAuth2ServerOption { + return func(o *UpdateOAuth2ServerOptions) { + o.ConfidentialPkce = v + o.enabledSetters["ConfidentialPkce"] = true + } +} + +// UpdateOAuth2Server update the OAuth2 server (OIDC provider) configuration. +func (srv *Project) UpdateOAuth2Server(Enabled bool, AuthorizationUrl string, optionalSetters ...UpdateOAuth2ServerOption)(*models.Project, error) { + path := "/project/oauth2-server" + options := UpdateOAuth2ServerOptions{}.New() + for _, opt := range optionalSetters { + opt(options) + } + params := map[string]interface{}{} + params["enabled"] = Enabled + params["authorizationUrl"] = AuthorizationUrl + if options.enabledSetters["Scopes"] { + params["scopes"] = options.Scopes + } + if options.enabledSetters["AccessTokenDuration"] { + params["accessTokenDuration"] = options.AccessTokenDuration + } + if options.enabledSetters["RefreshTokenDuration"] { + params["refreshTokenDuration"] = options.RefreshTokenDuration + } + if options.enabledSetters["PublicAccessTokenDuration"] { + params["publicAccessTokenDuration"] = options.PublicAccessTokenDuration + } + if options.enabledSetters["PublicRefreshTokenDuration"] { + params["publicRefreshTokenDuration"] = options.PublicRefreshTokenDuration + } + if options.enabledSetters["ConfidentialPkce"] { + params["confidentialPkce"] = options.ConfidentialPkce + } + headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], + "content-type": "application/json", + } + + resp, err := srv.client.Call("PUT", path, headers, params) + if err != nil { + return nil, err + } + if strings.HasPrefix(resp.Type, "application/json") { + bytes := []byte(resp.Result.(string)) + + parsed := models.Project{}.New(bytes) + + err = json.Unmarshal(bytes, parsed) + if err != nil { + return nil, err + } + + return parsed, nil + } + var parsed models.Project + parsed, ok := resp.Result.(models.Project) + if !ok { + return nil, errors.New("unexpected response type") + } + return &parsed, nil + } type UpdateOAuth2AmazonOptions struct { ClientId string @@ -790,6 +921,7 @@ func (srv *Project) UpdateOAuth2Amazon(optionalSetters ...UpdateOAuth2AmazonOpti params["enabled"] = options.Enabled } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -891,6 +1023,7 @@ func (srv *Project) UpdateOAuth2Apple(optionalSetters ...UpdateOAuth2AppleOption params["enabled"] = options.Enabled } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -981,6 +1114,7 @@ func (srv *Project) UpdateOAuth2Auth0(optionalSetters ...UpdateOAuth2Auth0Option params["enabled"] = options.Enabled } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1071,6 +1205,7 @@ func (srv *Project) UpdateOAuth2Authentik(optionalSetters ...UpdateOAuth2Authent params["enabled"] = options.Enabled } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1150,6 +1285,7 @@ func (srv *Project) UpdateOAuth2Autodesk(optionalSetters ...UpdateOAuth2Autodesk params["enabled"] = options.Enabled } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1229,6 +1365,7 @@ func (srv *Project) UpdateOAuth2Bitbucket(optionalSetters ...UpdateOAuth2Bitbuck params["enabled"] = options.Enabled } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1308,6 +1445,7 @@ func (srv *Project) UpdateOAuth2Bitly(optionalSetters ...UpdateOAuth2BitlyOption params["enabled"] = options.Enabled } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1387,6 +1525,7 @@ func (srv *Project) UpdateOAuth2Box(optionalSetters ...UpdateOAuth2BoxOption)(*m params["enabled"] = options.Enabled } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1467,6 +1606,7 @@ func (srv *Project) UpdateOAuth2Dailymotion(optionalSetters ...UpdateOAuth2Daily params["enabled"] = options.Enabled } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1546,6 +1686,7 @@ func (srv *Project) UpdateOAuth2Discord(optionalSetters ...UpdateOAuth2DiscordOp params["enabled"] = options.Enabled } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1625,6 +1766,7 @@ func (srv *Project) UpdateOAuth2Disqus(optionalSetters ...UpdateOAuth2DisqusOpti params["enabled"] = options.Enabled } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1704,6 +1846,7 @@ func (srv *Project) UpdateOAuth2Dropbox(optionalSetters ...UpdateOAuth2DropboxOp params["enabled"] = options.Enabled } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1783,6 +1926,7 @@ func (srv *Project) UpdateOAuth2Etsy(optionalSetters ...UpdateOAuth2EtsyOption)( params["enabled"] = options.Enabled } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1862,6 +2006,7 @@ func (srv *Project) UpdateOAuth2Facebook(optionalSetters ...UpdateOAuth2Facebook params["enabled"] = options.Enabled } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1941,6 +2086,7 @@ func (srv *Project) UpdateOAuth2Figma(optionalSetters ...UpdateOAuth2FigmaOption params["enabled"] = options.Enabled } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -2031,6 +2177,7 @@ func (srv *Project) UpdateOAuth2FusionAuth(optionalSetters ...UpdateOAuth2Fusion params["enabled"] = options.Enabled } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -2110,6 +2257,7 @@ func (srv *Project) UpdateOAuth2GitHub(optionalSetters ...UpdateOAuth2GitHubOpti params["enabled"] = options.Enabled } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -2200,6 +2348,7 @@ func (srv *Project) UpdateOAuth2Gitlab(optionalSetters ...UpdateOAuth2GitlabOpti params["enabled"] = options.Enabled } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -2290,6 +2439,7 @@ func (srv *Project) UpdateOAuth2Google(optionalSetters ...UpdateOAuth2GoogleOpti params["enabled"] = options.Enabled } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -2391,6 +2541,7 @@ func (srv *Project) UpdateOAuth2Keycloak(optionalSetters ...UpdateOAuth2Keycloak params["enabled"] = options.Enabled } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -2470,6 +2621,7 @@ func (srv *Project) UpdateOAuth2Kick(optionalSetters ...UpdateOAuth2KickOption)( params["enabled"] = options.Enabled } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -2549,6 +2701,7 @@ func (srv *Project) UpdateOAuth2Linkedin(optionalSetters ...UpdateOAuth2Linkedin params["enabled"] = options.Enabled } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -2639,6 +2792,7 @@ func (srv *Project) UpdateOAuth2Microsoft(optionalSetters ...UpdateOAuth2Microso params["enabled"] = options.Enabled } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -2718,6 +2872,7 @@ func (srv *Project) UpdateOAuth2Notion(optionalSetters ...UpdateOAuth2NotionOpti params["enabled"] = options.Enabled } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -2841,6 +2996,7 @@ func (srv *Project) UpdateOAuth2Oidc(optionalSetters ...UpdateOAuth2OidcOption)( params["enabled"] = options.Enabled } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -2942,6 +3098,7 @@ func (srv *Project) UpdateOAuth2Okta(optionalSetters ...UpdateOAuth2OktaOption)( params["enabled"] = options.Enabled } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -3021,6 +3178,7 @@ func (srv *Project) UpdateOAuth2Paypal(optionalSetters ...UpdateOAuth2PaypalOpti params["enabled"] = options.Enabled } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -3101,6 +3259,7 @@ func (srv *Project) UpdateOAuth2PaypalSandbox(optionalSetters ...UpdateOAuth2Pay params["enabled"] = options.Enabled } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -3180,6 +3339,7 @@ func (srv *Project) UpdateOAuth2Podio(optionalSetters ...UpdateOAuth2PodioOption params["enabled"] = options.Enabled } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -3259,6 +3419,7 @@ func (srv *Project) UpdateOAuth2Salesforce(optionalSetters ...UpdateOAuth2Salesf params["enabled"] = options.Enabled } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -3338,6 +3499,7 @@ func (srv *Project) UpdateOAuth2Slack(optionalSetters ...UpdateOAuth2SlackOption params["enabled"] = options.Enabled } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -3417,6 +3579,7 @@ func (srv *Project) UpdateOAuth2Spotify(optionalSetters ...UpdateOAuth2SpotifyOp params["enabled"] = options.Enabled } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -3496,6 +3659,7 @@ func (srv *Project) UpdateOAuth2Stripe(optionalSetters ...UpdateOAuth2StripeOpti params["enabled"] = options.Enabled } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -3575,6 +3739,7 @@ func (srv *Project) UpdateOAuth2Tradeshift(optionalSetters ...UpdateOAuth2Trades params["enabled"] = options.Enabled } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -3655,6 +3820,7 @@ func (srv *Project) UpdateOAuth2TradeshiftSandbox(optionalSetters ...UpdateOAuth params["enabled"] = options.Enabled } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -3734,6 +3900,7 @@ func (srv *Project) UpdateOAuth2Twitch(optionalSetters ...UpdateOAuth2TwitchOpti params["enabled"] = options.Enabled } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -3813,6 +3980,7 @@ func (srv *Project) UpdateOAuth2WordPress(optionalSetters ...UpdateOAuth2WordPre params["enabled"] = options.Enabled } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -3892,6 +4060,7 @@ func (srv *Project) UpdateOAuth2X(optionalSetters ...UpdateOAuth2XOption)(*model params["enabled"] = options.Enabled } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -3971,6 +4140,7 @@ func (srv *Project) UpdateOAuth2Yahoo(optionalSetters ...UpdateOAuth2YahooOption params["enabled"] = options.Enabled } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -4050,6 +4220,7 @@ func (srv *Project) UpdateOAuth2Yandex(optionalSetters ...UpdateOAuth2YandexOpti params["enabled"] = options.Enabled } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -4129,6 +4300,7 @@ func (srv *Project) UpdateOAuth2Zoho(optionalSetters ...UpdateOAuth2ZohoOption)( params["enabled"] = options.Enabled } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -4208,6 +4380,7 @@ func (srv *Project) UpdateOAuth2Zoom(optionalSetters ...UpdateOAuth2ZoomOption)( params["enabled"] = options.Enabled } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -4245,6 +4418,7 @@ func (srv *Project) GetOAuth2Provider(ProviderId string)(models.Model, error) { params := map[string]interface{}{} params["providerId"] = ProviderId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -4630,6 +4804,7 @@ func (srv *Project) ListPlatforms(optionalSetters ...ListPlatformsOption)(*model params["total"] = options.Total } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -4667,6 +4842,7 @@ func (srv *Project) CreateAndroidPlatform(PlatformId string, Name string, Applic params["name"] = Name params["applicationId"] = ApplicationId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -4705,6 +4881,7 @@ func (srv *Project) UpdateAndroidPlatform(PlatformId string, Name string, Applic params["name"] = Name params["applicationId"] = ApplicationId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -4743,6 +4920,7 @@ func (srv *Project) CreateApplePlatform(PlatformId string, Name string, BundleId params["name"] = Name params["bundleIdentifier"] = BundleIdentifier headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -4781,6 +4959,7 @@ func (srv *Project) UpdateApplePlatform(PlatformId string, Name string, BundleId params["name"] = Name params["bundleIdentifier"] = BundleIdentifier headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -4819,6 +4998,7 @@ func (srv *Project) CreateLinuxPlatform(PlatformId string, Name string, PackageN params["name"] = Name params["packageName"] = PackageName headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -4857,6 +5037,7 @@ func (srv *Project) UpdateLinuxPlatform(PlatformId string, Name string, PackageN params["name"] = Name params["packageName"] = PackageName headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -4895,6 +5076,7 @@ func (srv *Project) CreateWebPlatform(PlatformId string, Name string, Hostname s params["name"] = Name params["hostname"] = Hostname headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -4933,6 +5115,7 @@ func (srv *Project) UpdateWebPlatform(PlatformId string, Name string, Hostname s params["name"] = Name params["hostname"] = Hostname headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -4971,6 +5154,7 @@ func (srv *Project) CreateWindowsPlatform(PlatformId string, Name string, Packag params["name"] = Name params["packageIdentifierName"] = PackageIdentifierName headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -5009,6 +5193,7 @@ func (srv *Project) UpdateWindowsPlatform(PlatformId string, Name string, Packag params["name"] = Name params["packageIdentifierName"] = PackageIdentifierName headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -5045,6 +5230,7 @@ func (srv *Project) GetPlatform(PlatformId string)(models.Model, error) { params := map[string]interface{}{} params["platformId"] = PlatformId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -5117,6 +5303,7 @@ func (srv *Project) DeletePlatform(PlatformId string)(*interface{}, error) { params := map[string]interface{}{} params["platformId"] = PlatformId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -5185,6 +5372,7 @@ func (srv *Project) ListPolicies(optionalSetters ...ListPoliciesOption)(*models. params["total"] = options.Total } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -5220,6 +5408,7 @@ func (srv *Project) UpdateDenyAliasedEmailPolicy(Enabled bool)(*models.Project, params := map[string]interface{}{} params["enabled"] = Enabled headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -5255,6 +5444,7 @@ func (srv *Project) UpdateDenyDisposableEmailPolicy(Enabled bool)(*models.Projec params := map[string]interface{}{} params["enabled"] = Enabled headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -5290,6 +5480,7 @@ func (srv *Project) UpdateDenyFreeEmailPolicy(Enabled bool)(*models.Project, err params := map[string]interface{}{} params["enabled"] = Enabled headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -5394,6 +5585,7 @@ func (srv *Project) UpdateMembershipPrivacyPolicy(optionalSetters ...UpdateMembe params["userMFA"] = options.UserMFA } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -5431,6 +5623,7 @@ func (srv *Project) UpdatePasswordDictionaryPolicy(Enabled bool)(*models.Project params := map[string]interface{}{} params["enabled"] = Enabled headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -5474,6 +5667,7 @@ func (srv *Project) UpdatePasswordHistoryPolicy(Total int)(*models.Project, erro params := map[string]interface{}{} params["total"] = Total headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -5511,6 +5705,7 @@ func (srv *Project) UpdatePasswordPersonalDataPolicy(Enabled bool)(*models.Proje params := map[string]interface{}{} params["enabled"] = Enabled headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -5537,6 +5732,109 @@ func (srv *Project) UpdatePasswordPersonalDataPolicy(Enabled bool)(*models.Proje } return &parsed, nil +} +type UpdatePasswordStrengthPolicyOptions struct { + Min int + Uppercase bool + Lowercase bool + Number bool + Symbols bool + enabledSetters map[string]bool +} +func (options UpdatePasswordStrengthPolicyOptions) New() *UpdatePasswordStrengthPolicyOptions { + options.enabledSetters = map[string]bool{ + "Min": false, + "Uppercase": false, + "Lowercase": false, + "Number": false, + "Symbols": false, + } + return &options +} +type UpdatePasswordStrengthPolicyOption func(*UpdatePasswordStrengthPolicyOptions) +func (srv *Project) WithUpdatePasswordStrengthPolicyMin(v int) UpdatePasswordStrengthPolicyOption { + return func(o *UpdatePasswordStrengthPolicyOptions) { + o.Min = v + o.enabledSetters["Min"] = true + } +} +func (srv *Project) WithUpdatePasswordStrengthPolicyUppercase(v bool) UpdatePasswordStrengthPolicyOption { + return func(o *UpdatePasswordStrengthPolicyOptions) { + o.Uppercase = v + o.enabledSetters["Uppercase"] = true + } +} +func (srv *Project) WithUpdatePasswordStrengthPolicyLowercase(v bool) UpdatePasswordStrengthPolicyOption { + return func(o *UpdatePasswordStrengthPolicyOptions) { + o.Lowercase = v + o.enabledSetters["Lowercase"] = true + } +} +func (srv *Project) WithUpdatePasswordStrengthPolicyNumber(v bool) UpdatePasswordStrengthPolicyOption { + return func(o *UpdatePasswordStrengthPolicyOptions) { + o.Number = v + o.enabledSetters["Number"] = true + } +} +func (srv *Project) WithUpdatePasswordStrengthPolicySymbols(v bool) UpdatePasswordStrengthPolicyOption { + return func(o *UpdatePasswordStrengthPolicyOptions) { + o.Symbols = v + o.enabledSetters["Symbols"] = true + } +} + +// UpdatePasswordStrengthPolicy update the password strength requirements for +// users in the project. +func (srv *Project) UpdatePasswordStrengthPolicy(optionalSetters ...UpdatePasswordStrengthPolicyOption)(*models.PolicyPasswordStrength, error) { + path := "/project/policies/password-strength" + options := UpdatePasswordStrengthPolicyOptions{}.New() + for _, opt := range optionalSetters { + opt(options) + } + params := map[string]interface{}{} + if options.enabledSetters["Min"] { + params["min"] = options.Min + } + if options.enabledSetters["Uppercase"] { + params["uppercase"] = options.Uppercase + } + if options.enabledSetters["Lowercase"] { + params["lowercase"] = options.Lowercase + } + if options.enabledSetters["Number"] { + params["number"] = options.Number + } + if options.enabledSetters["Symbols"] { + params["symbols"] = options.Symbols + } + headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], + "content-type": "application/json", + } + + resp, err := srv.client.Call("PATCH", path, headers, params) + if err != nil { + return nil, err + } + if strings.HasPrefix(resp.Type, "application/json") { + bytes := []byte(resp.Result.(string)) + + parsed := models.PolicyPasswordStrength{}.New(bytes) + + err = json.Unmarshal(bytes, parsed) + if err != nil { + return nil, err + } + + return parsed, nil + } + var parsed models.PolicyPasswordStrength + parsed, ok := resp.Result.(models.PolicyPasswordStrength) + if !ok { + return nil, errors.New("unexpected response type") + } + return &parsed, nil + } // UpdateSessionAlertPolicy updating this policy allows you to control if @@ -5549,6 +5847,7 @@ func (srv *Project) UpdateSessionAlertPolicy(Enabled bool)(*models.Project, erro params := map[string]interface{}{} params["enabled"] = Enabled headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -5584,6 +5883,7 @@ func (srv *Project) UpdateSessionDurationPolicy(Duration int)(*models.Project, e params := map[string]interface{}{} params["duration"] = Duration headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -5621,6 +5921,7 @@ func (srv *Project) UpdateSessionInvalidationPolicy(Enabled bool)(*models.Projec params := map[string]interface{}{} params["enabled"] = Enabled headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -5657,6 +5958,7 @@ func (srv *Project) UpdateSessionLimitPolicy(Total int)(*models.Project, error) params := map[string]interface{}{} params["total"] = Total headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -5693,6 +5995,7 @@ func (srv *Project) UpdateUserLimitPolicy(Total int)(*models.Project, error) { params := map[string]interface{}{} params["total"] = Total headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -5729,6 +6032,7 @@ func (srv *Project) GetPolicy(PolicyId string)(models.Model, error) { params := map[string]interface{}{} params["policyId"] = PolicyId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -5758,6 +6062,14 @@ func (srv *Project) GetPolicy(PolicyId string)(models.Model, error) { return parsed, nil } + if fmt.Sprint(response["$id"]) == "password-strength" { + parsed := models.PolicyPasswordStrength{}.New(bytes) + if err := json.Unmarshal(bytes, parsed); err != nil { + return nil, err + } + + return parsed, nil + } if fmt.Sprint(response["$id"]) == "password-personal-data" { parsed := models.PolicyPasswordPersonalData{}.New(bytes) if err := json.Unmarshal(bytes, parsed); err != nil { @@ -5858,6 +6170,7 @@ func (srv *Project) UpdateProtocol(ProtocolId string, Enabled bool)(*models.Proj params["protocolId"] = ProtocolId params["enabled"] = Enabled headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -5895,6 +6208,7 @@ func (srv *Project) UpdateService(ServiceId string, Enabled bool)(*models.Projec params["serviceId"] = ServiceId params["enabled"] = Enabled headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -6053,6 +6367,7 @@ func (srv *Project) UpdateSMTP(optionalSetters ...UpdateSMTPOption)(*models.Proj params["enabled"] = options.Enabled } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -6087,6 +6402,7 @@ func (srv *Project) CreateSMTPTest(Emails []string)(*interface{}, error) { params := map[string]interface{}{} params["emails"] = Emails headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -6156,6 +6472,7 @@ func (srv *Project) ListEmailTemplates(optionalSetters ...ListEmailTemplatesOpti params["total"] = options.Total } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -6280,6 +6597,7 @@ func (srv *Project) UpdateEmailTemplate(TemplateId string, optionalSetters ...Up params["replyToName"] = options.ReplyToName } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -6341,6 +6659,7 @@ func (srv *Project) GetEmailTemplate(TemplateId string, optionalSetters ...GetEm params["locale"] = options.Locale } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -6408,6 +6727,7 @@ func (srv *Project) ListVariables(optionalSetters ...ListVariablesOption)(*model params["total"] = options.Total } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -6468,6 +6788,7 @@ func (srv *Project) CreateVariable(VariableId string, Key string, Value string, params["secret"] = options.Secret } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -6503,6 +6824,7 @@ func (srv *Project) GetVariable(VariableId string)(*models.Variable, error) { params := map[string]interface{}{} params["variableId"] = VariableId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -6583,6 +6905,7 @@ func (srv *Project) UpdateVariable(VariableId string, optionalSetters ...UpdateV params["secret"] = options.Secret } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -6618,6 +6941,7 @@ func (srv *Project) DeleteVariable(VariableId string)(*interface{}, error) { params := map[string]interface{}{} params["variableId"] = VariableId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } diff --git a/project/project_test.go b/project/project_test.go index 3e0b9836..a2aeb706 100644 --- a/project/project_test.go +++ b/project/project_test.go @@ -25,6 +25,7 @@ func TestProject(t *testing.T) { "$updatedAt": "2020-10-15T06:38:00.000+00:00", "name": "New Project", "teamId": "1592981250", + "region": "fra", "devKeys": [ { "$id": "5e5ea5c16897e", @@ -69,7 +70,6 @@ func TestProject(t *testing.T) { "enabled": true } ], - "region": "fra", "blocks": [ { "$createdAt": "2020-10-15T06:38:00.000+00:00", @@ -82,7 +82,16 @@ func TestProject(t *testing.T) { "billingPlan": "pro" } ], - "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00" + "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00", + "oAuth2ServerEnabled": true, + "oAuth2ServerAuthorizationUrl": "https://cloud.appwrite.io/oauth2/.well-known/openid-configuration", + "oAuth2ServerScopes": [], + "oAuth2ServerAccessTokenDuration": 3600, + "oAuth2ServerRefreshTokenDuration": 86400, + "oAuth2ServerPublicAccessTokenDuration": 3600, + "oAuth2ServerPublicRefreshTokenDuration": 2592000, + "oAuth2ServerConfidentialPkce": true, + "oAuth2ServerDiscoveryUrl": "https://auth.example.com/.well-known/openid-configuration" } ` @@ -139,6 +148,7 @@ func TestProject(t *testing.T) { "$updatedAt": "2020-10-15T06:38:00.000+00:00", "name": "New Project", "teamId": "1592981250", + "region": "fra", "devKeys": [ { "$id": "5e5ea5c16897e", @@ -183,7 +193,6 @@ func TestProject(t *testing.T) { "enabled": true } ], - "region": "fra", "blocks": [ { "$createdAt": "2020-10-15T06:38:00.000+00:00", @@ -196,7 +205,16 @@ func TestProject(t *testing.T) { "billingPlan": "pro" } ], - "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00" + "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00", + "oAuth2ServerEnabled": true, + "oAuth2ServerAuthorizationUrl": "https://cloud.appwrite.io/oauth2/.well-known/openid-configuration", + "oAuth2ServerScopes": [], + "oAuth2ServerAccessTokenDuration": 3600, + "oAuth2ServerRefreshTokenDuration": 86400, + "oAuth2ServerPublicAccessTokenDuration": 3600, + "oAuth2ServerPublicRefreshTokenDuration": 2592000, + "oAuth2ServerConfidentialPkce": true, + "oAuth2ServerDiscoveryUrl": "https://auth.example.com/.well-known/openid-configuration" } ` @@ -428,6 +446,7 @@ func TestProject(t *testing.T) { "$updatedAt": "2020-10-15T06:38:00.000+00:00", "name": "New Project", "teamId": "1592981250", + "region": "fra", "devKeys": [ { "$id": "5e5ea5c16897e", @@ -472,7 +491,6 @@ func TestProject(t *testing.T) { "enabled": true } ], - "region": "fra", "blocks": [ { "$createdAt": "2020-10-15T06:38:00.000+00:00", @@ -485,7 +503,16 @@ func TestProject(t *testing.T) { "billingPlan": "pro" } ], - "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00" + "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00", + "oAuth2ServerEnabled": true, + "oAuth2ServerAuthorizationUrl": "https://cloud.appwrite.io/oauth2/.well-known/openid-configuration", + "oAuth2ServerScopes": [], + "oAuth2ServerAccessTokenDuration": 3600, + "oAuth2ServerRefreshTokenDuration": 86400, + "oAuth2ServerPublicAccessTokenDuration": 3600, + "oAuth2ServerPublicRefreshTokenDuration": 2592000, + "oAuth2ServerConfidentialPkce": true, + "oAuth2ServerDiscoveryUrl": "https://auth.example.com/.well-known/openid-configuration" } ` @@ -682,13 +709,110 @@ func TestProject(t *testing.T) { } }) + t.Run("Test UpdateOAuth2Server", func(t *testing.T) { + mockResponse := ` +{ + "$id": "5e5ea5c16897e", + "$createdAt": "2020-10-15T06:38:00.000+00:00", + "$updatedAt": "2020-10-15T06:38:00.000+00:00", + "name": "New Project", + "teamId": "1592981250", + "region": "fra", + "devKeys": [ + { + "$id": "5e5ea5c16897e", + "$createdAt": "2020-10-15T06:38:00.000+00:00", + "$updatedAt": "2020-10-15T06:38:00.000+00:00", + "name": "Dev API Key", + "expire": "2020-10-15T06:38:00.000+00:00", + "secret": "919c2d18fb5d4...a2ae413da83346ad2", + "accessedAt": "2020-10-15T06:38:00.000+00:00", + "sdks": [] + } + ], + "smtpEnabled": true, + "smtpSenderName": "John Appwrite", + "smtpSenderEmail": "john@appwrite.io", + "smtpReplyToName": "Support Team", + "smtpReplyToEmail": "support@appwrite.io", + "smtpHost": "mail.appwrite.io", + "smtpPort": 25, + "smtpUsername": "emailuser", + "smtpPassword": "string", + "smtpSecure": "tls", + "pingCount": 1, + "pingedAt": "2020-10-15T06:38:00.000+00:00", + "labels": [], + "status": "active", + "authMethods": [ + { + "$id": "email-password", + "enabled": true + } + ], + "services": [ + { + "$id": "sites", + "enabled": true + } + ], + "protocols": [ + { + "$id": "graphql", + "enabled": true + } + ], + "blocks": [ + { + "$createdAt": "2020-10-15T06:38:00.000+00:00", + "resourceType": "project", + "resourceId": "5e5ea5c16897e", + "projectName": "My Project", + "region": "fra", + "organizationName": "Acme Inc.", + "organizationId": "5e5ea5c16897e", + "billingPlan": "pro" + } + ], + "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00", + "oAuth2ServerEnabled": true, + "oAuth2ServerAuthorizationUrl": "https://cloud.appwrite.io/oauth2/.well-known/openid-configuration", + "oAuth2ServerScopes": [], + "oAuth2ServerAccessTokenDuration": 3600, + "oAuth2ServerRefreshTokenDuration": 86400, + "oAuth2ServerPublicAccessTokenDuration": 3600, + "oAuth2ServerPublicRefreshTokenDuration": 2592000, + "oAuth2ServerConfidentialPkce": true, + "oAuth2ServerDiscoveryUrl": "https://auth.example.com/.well-known/openid-configuration" +} +` + + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if r.Method != "PUT" { + t.Errorf("Expected method PUT, got %s", r.Method) + } + + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(http.StatusOK) + _, _ = w.Write([]byte(mockResponse)) + })) + defer ts.Close() + + srv := New(newTestClient(ts)) + + _, err := srv.UpdateOAuth2Server(true, "https://example.com") + if err != nil { + t.Errorf("Method UpdateOAuth2Server failed: %v", err) + } + }) + t.Run("Test UpdateOAuth2Amazon", func(t *testing.T) { mockResponse := ` { "$id": "github", "enabled": true, "clientId": "amzn1.application-oa2-client.87400c00000000000000000000063d5b2", - "clientSecret": "your-oauth2-client-secret" + "clientSecret": "79ffe4000000000000000000000000000000000000000000000000000002de55" } ` @@ -748,7 +872,7 @@ func TestProject(t *testing.T) { "$id": "github", "enabled": true, "clientId": "OaOkIA000000000000000000005KLSYq", - "clientSecret": "your-oauth2-client-secret", + "clientSecret": "zXz0000-00000000000000000000000000000-00000000000000000000PJafnF", "endpoint": "example.us.auth0.com" } ` @@ -778,7 +902,7 @@ func TestProject(t *testing.T) { "$id": "github", "enabled": true, "clientId": "dTKOPa0000000000000000000000000000e7G8hv", - "clientSecret": "your-oauth2-client-secret", + "clientSecret": "ntQadq000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000Hp5WK", "endpoint": "example.authentik.com" } ` @@ -808,7 +932,7 @@ func TestProject(t *testing.T) { "$id": "github", "enabled": true, "clientId": "5zw90v00000000000000000000kVYXN7", - "clientSecret": "your-oauth2-client-secret" + "clientSecret": "7I000000000000MW" } ` @@ -837,7 +961,7 @@ func TestProject(t *testing.T) { "$id": "github", "enabled": true, "key": "Knt70000000000ByRc", - "secret": "your-oauth2-client-secret" + "secret": "NMfLZJ00000000000000000000TLQdDx" } ` @@ -866,7 +990,7 @@ func TestProject(t *testing.T) { "$id": "github", "enabled": true, "clientId": "d95151000000000000000000000000000067af9b", - "clientSecret": "your-oauth2-client-secret" + "clientSecret": "a13e250000000000000000000000000000d73095" } ` @@ -895,7 +1019,7 @@ func TestProject(t *testing.T) { "$id": "github", "enabled": true, "clientId": "deglcs00000000000000000000x2og6y", - "clientSecret": "your-oauth2-client-secret" + "clientSecret": "OKM1f100000000000000000000eshEif" } ` @@ -924,7 +1048,7 @@ func TestProject(t *testing.T) { "$id": "github", "enabled": true, "apiKey": "07a9000000000000067f", - "apiSecret": "your-oauth2-client-secret" + "apiSecret": "a399a90000000000000000000000000000d90639" } ` @@ -953,7 +1077,7 @@ func TestProject(t *testing.T) { "$id": "github", "enabled": true, "clientId": "950722000000343754", - "clientSecret": "your-oauth2-client-secret" + "clientSecret": "YmPXnM000000000000000000002zFg5D" } ` @@ -982,7 +1106,7 @@ func TestProject(t *testing.T) { "$id": "github", "enabled": true, "publicKey": "cgegH70000000000000000000000000000000000000000000000000000Hr1nYX", - "secretKey": "your-oauth2-client-secret" + "secretKey": "W7Bykj00000000000000000000000000000000000000000000000000003o43w9" } ` @@ -1011,7 +1135,7 @@ func TestProject(t *testing.T) { "$id": "github", "enabled": true, "appKey": "jl000000000009t", - "appSecret": "your-oauth2-client-secret" + "appSecret": "g200000000000vw" } ` @@ -1040,7 +1164,7 @@ func TestProject(t *testing.T) { "$id": "github", "enabled": true, "keyString": "nsgzxh0000000000008j85a2", - "sharedSecret": "your-oauth2-client-secret" + "sharedSecret": "tp000000ru" } ` @@ -1069,7 +1193,7 @@ func TestProject(t *testing.T) { "$id": "github", "enabled": true, "appId": "260600000007694", - "appSecret": "your-oauth2-client-secret" + "appSecret": "2d0b2800000000000000000000d38af4" } ` @@ -1098,7 +1222,7 @@ func TestProject(t *testing.T) { "$id": "github", "enabled": true, "clientId": "byay5H0000000000VtiI40", - "clientSecret": "your-oauth2-client-secret" + "clientSecret": "yEpOYn0000000000000000004iIsU5" } ` @@ -1127,7 +1251,7 @@ func TestProject(t *testing.T) { "$id": "github", "enabled": true, "clientId": "b2222c00-0000-0000-0000-000000862097", - "clientSecret": "your-oauth2-client-secret", + "clientSecret": "Jx4s0C0000000000000000000000000000000wGqLsc", "endpoint": "example.fusionauth.io" } ` @@ -1157,7 +1281,7 @@ func TestProject(t *testing.T) { "$id": "github", "enabled": true, "clientId": "e4d87900000000540733", - "clientSecret": "your-oauth2-client-secret" + "clientSecret": "5e07c00000000000000000000000000000198bcc" } ` @@ -1186,7 +1310,7 @@ func TestProject(t *testing.T) { "$id": "github", "enabled": true, "applicationId": "d41ffe0000000000000000000000000000000000000000000000000000d5e252", - "secret": "your-oauth2-client-secret", + "secret": "gloas-838cfa0000000000000000000000000000000000000000000000000000ecbb38", "endpoint": "https://gitlab.com" } ` @@ -1216,7 +1340,7 @@ func TestProject(t *testing.T) { "$id": "github", "enabled": true, "clientId": "120000000095-92ifjb00000000000000000000g7ijfb.apps.googleusercontent.com", - "clientSecret": "your-oauth2-client-secret", + "clientSecret": "GOCSPX-2k8gsR0000000000000000VNahJj", "prompt": [] } ` @@ -1246,7 +1370,7 @@ func TestProject(t *testing.T) { "$id": "github", "enabled": true, "clientId": "appwrite-o0000000st-app", - "clientSecret": "your-oauth2-client-secret", + "clientSecret": "jdjrJd00000000000000000000HUsaZO", "endpoint": "keycloak.example.com", "realmName": "appwrite-realm" } @@ -1277,7 +1401,7 @@ func TestProject(t *testing.T) { "$id": "github", "enabled": true, "clientId": "01KQ7C00000000000001MFHS32", - "clientSecret": "your-oauth2-client-secret" + "clientSecret": "34ac5600000000000000000000000000000000000000000000000000e830c8b" } ` @@ -1306,7 +1430,7 @@ func TestProject(t *testing.T) { "$id": "github", "enabled": true, "clientId": "770000000000dv", - "primaryClientSecret": "your-oauth2-client-secret" + "primaryClientSecret": "WPL_AP1.2Bf0000000000000./HtlYw==" } ` @@ -1335,7 +1459,7 @@ func TestProject(t *testing.T) { "$id": "github", "enabled": true, "applicationId": "00001111-aaaa-2222-bbbb-3333cccc4444", - "applicationSecret": "your-oauth2-client-secret", + "applicationSecret": "A1bC2dE3fH4iJ5kL6mN7oP8qR9sT0u", "tenant": "common" } ` @@ -1365,7 +1489,7 @@ func TestProject(t *testing.T) { "$id": "github", "enabled": true, "oauthClientId": "341d8700-0000-0000-0000-000000446ee3", - "oauthClientSecret": "your-oauth2-client-secret" + "oauthClientSecret": "secret_dLUr4b000000000000000000000000000000lFHAa9" } ` @@ -1394,7 +1518,7 @@ func TestProject(t *testing.T) { "$id": "github", "enabled": true, "clientId": "qibI2x0000000000000000000000000006L2YFoG", - "clientSecret": "your-oauth2-client-secret", + "clientSecret": "Ah68ed000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003qpcHV", "wellKnownURL": "https://myoauth.com/.well-known/openid-configuration", "authorizationURL": "https://myoauth.com/oauth2/authorize", "tokenURL": "https://myoauth.com/oauth2/token", @@ -1427,7 +1551,7 @@ func TestProject(t *testing.T) { "$id": "github", "enabled": true, "clientId": "0oa00000000000000698", - "clientSecret": "your-oauth2-client-secret", + "clientSecret": "Kiq0000000000000000000000000000000000000-00000000000H2L5-3SJ-vRV", "domain": "trial-6400025.okta.com", "authorizationServerId": "aus000000000000000h7z" } @@ -1458,7 +1582,7 @@ func TestProject(t *testing.T) { "$id": "github", "enabled": true, "clientId": "AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB", - "secretKey": "your-oauth2-client-secret" + "secretKey": "EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp" } ` @@ -1487,7 +1611,7 @@ func TestProject(t *testing.T) { "$id": "github", "enabled": true, "clientId": "AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB", - "secretKey": "your-oauth2-client-secret" + "secretKey": "EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp" } ` @@ -1516,7 +1640,7 @@ func TestProject(t *testing.T) { "$id": "github", "enabled": true, "clientId": "appwrite-oauth-test-app", - "clientSecret": "your-oauth2-client-secret" + "clientSecret": "Rn247T0000000000000000000000000000000000000000000000000000W2zWTN" } ` @@ -1545,7 +1669,7 @@ func TestProject(t *testing.T) { "$id": "github", "enabled": true, "customerKey": "3MVG9I0000000000000000000000000000000000000000000000000000000000000000000000000C5Aejq", - "customerSecret": "your-oauth2-client-secret" + "customerSecret": "3w000000000000e2" } ` @@ -1574,7 +1698,7 @@ func TestProject(t *testing.T) { "$id": "github", "enabled": true, "clientId": "23000000089.15000000000023", - "clientSecret": "your-oauth2-client-secret" + "clientSecret": "81656000000000000000000000f3d2fd" } ` @@ -1603,7 +1727,7 @@ func TestProject(t *testing.T) { "$id": "github", "enabled": true, "clientId": "6ec271000000000000000000009beace", - "clientSecret": "your-oauth2-client-secret" + "clientSecret": "db068a000000000000000000008b5b9f" } ` @@ -1632,7 +1756,7 @@ func TestProject(t *testing.T) { "$id": "github", "enabled": true, "clientId": "ca_UKibXX0000000000000000000006byvR", - "apiSecretKey": "your-oauth2-client-secret" + "apiSecretKey": "sk_51SfOd000000000000000000000000000000000000000000000000000000000000000000000000000000000000000QGWYfp" } ` @@ -1661,7 +1785,7 @@ func TestProject(t *testing.T) { "$id": "github", "enabled": true, "oauth2ClientId": "appwrite-test-org.appwrite-test-app", - "oauth2ClientSecret": "your-oauth2-client-secret" + "oauth2ClientSecret": "7cb52700-0000-0000-0000-000000ca5b83" } ` @@ -1690,7 +1814,7 @@ func TestProject(t *testing.T) { "$id": "github", "enabled": true, "oauth2ClientId": "appwrite-test-org.appwrite-test-app", - "oauth2ClientSecret": "your-oauth2-client-secret" + "oauth2ClientSecret": "7cb52700-0000-0000-0000-000000ca5b83" } ` @@ -1719,7 +1843,7 @@ func TestProject(t *testing.T) { "$id": "github", "enabled": true, "clientId": "vvi0in000000000000000000ikmt9p", - "clientSecret": "your-oauth2-client-secret" + "clientSecret": "pmapue000000000000000000zylw3v" } ` @@ -1748,7 +1872,7 @@ func TestProject(t *testing.T) { "$id": "github", "enabled": true, "clientId": "130005", - "clientSecret": "your-oauth2-client-secret" + "clientSecret": "PlBfJS0000000000000000000000000000000000000000000000000000EdUZJk" } ` @@ -1777,7 +1901,7 @@ func TestProject(t *testing.T) { "$id": "github", "enabled": true, "customerKey": "slzZV0000000000000NFLaWT", - "secretKey": "your-oauth2-client-secret" + "secretKey": "tkEPkp00000000000000000000000000000000000000FTxbI9" } ` @@ -1806,7 +1930,7 @@ func TestProject(t *testing.T) { "$id": "github", "enabled": true, "clientId": "dj0yJm000000000000000000000000000000000000000000000000000000000000000000000000000000000000Z4PWRm", - "clientSecret": "your-oauth2-client-secret" + "clientSecret": "cf978f0000000000000000000000000000c5e2e9" } ` @@ -1835,7 +1959,7 @@ func TestProject(t *testing.T) { "$id": "github", "enabled": true, "clientId": "6a8a6a0000000000000000000091483c", - "clientSecret": "your-oauth2-client-secret" + "clientSecret": "bbf98500000000000000000000c75a63" } ` @@ -1864,7 +1988,7 @@ func TestProject(t *testing.T) { "$id": "github", "enabled": true, "clientId": "1000.83C178000000000000000000RPNX0B", - "clientSecret": "your-oauth2-client-secret" + "clientSecret": "fb5cac000000000000000000000000000000a68f6e" } ` @@ -1893,7 +2017,7 @@ func TestProject(t *testing.T) { "$id": "github", "enabled": true, "clientId": "QMAC00000000000000w0AQ", - "clientSecret": "your-oauth2-client-secret" + "clientSecret": "GAWsG4000000000000000000007U01ON" } ` @@ -1922,7 +2046,7 @@ func TestProject(t *testing.T) { "$id": "microsoft", "enabled": true, "applicationId": "00001111-aaaa-2222-bbbb-3333cccc4444", - "applicationSecret": "your-oauth2-client-secret", + "applicationSecret": "A1bC2dE3fH4iJ5kL6mN7oP8qR9sT0u", "tenant": "common" } ` @@ -2349,7 +2473,7 @@ func TestProject(t *testing.T) { t.Run("Test ListPolicies", func(t *testing.T) { mockResponse := ` { - "total": 9, + "total": 10, "policies": [] } ` @@ -2381,6 +2505,7 @@ func TestProject(t *testing.T) { "$updatedAt": "2020-10-15T06:38:00.000+00:00", "name": "New Project", "teamId": "1592981250", + "region": "fra", "devKeys": [ { "$id": "5e5ea5c16897e", @@ -2425,7 +2550,6 @@ func TestProject(t *testing.T) { "enabled": true } ], - "region": "fra", "blocks": [ { "$createdAt": "2020-10-15T06:38:00.000+00:00", @@ -2438,7 +2562,16 @@ func TestProject(t *testing.T) { "billingPlan": "pro" } ], - "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00" + "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00", + "oAuth2ServerEnabled": true, + "oAuth2ServerAuthorizationUrl": "https://cloud.appwrite.io/oauth2/.well-known/openid-configuration", + "oAuth2ServerScopes": [], + "oAuth2ServerAccessTokenDuration": 3600, + "oAuth2ServerRefreshTokenDuration": 86400, + "oAuth2ServerPublicAccessTokenDuration": 3600, + "oAuth2ServerPublicRefreshTokenDuration": 2592000, + "oAuth2ServerConfidentialPkce": true, + "oAuth2ServerDiscoveryUrl": "https://auth.example.com/.well-known/openid-configuration" } ` @@ -2469,6 +2602,7 @@ func TestProject(t *testing.T) { "$updatedAt": "2020-10-15T06:38:00.000+00:00", "name": "New Project", "teamId": "1592981250", + "region": "fra", "devKeys": [ { "$id": "5e5ea5c16897e", @@ -2513,7 +2647,6 @@ func TestProject(t *testing.T) { "enabled": true } ], - "region": "fra", "blocks": [ { "$createdAt": "2020-10-15T06:38:00.000+00:00", @@ -2526,7 +2659,16 @@ func TestProject(t *testing.T) { "billingPlan": "pro" } ], - "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00" + "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00", + "oAuth2ServerEnabled": true, + "oAuth2ServerAuthorizationUrl": "https://cloud.appwrite.io/oauth2/.well-known/openid-configuration", + "oAuth2ServerScopes": [], + "oAuth2ServerAccessTokenDuration": 3600, + "oAuth2ServerRefreshTokenDuration": 86400, + "oAuth2ServerPublicAccessTokenDuration": 3600, + "oAuth2ServerPublicRefreshTokenDuration": 2592000, + "oAuth2ServerConfidentialPkce": true, + "oAuth2ServerDiscoveryUrl": "https://auth.example.com/.well-known/openid-configuration" } ` @@ -2557,6 +2699,7 @@ func TestProject(t *testing.T) { "$updatedAt": "2020-10-15T06:38:00.000+00:00", "name": "New Project", "teamId": "1592981250", + "region": "fra", "devKeys": [ { "$id": "5e5ea5c16897e", @@ -2601,7 +2744,6 @@ func TestProject(t *testing.T) { "enabled": true } ], - "region": "fra", "blocks": [ { "$createdAt": "2020-10-15T06:38:00.000+00:00", @@ -2614,7 +2756,16 @@ func TestProject(t *testing.T) { "billingPlan": "pro" } ], - "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00" + "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00", + "oAuth2ServerEnabled": true, + "oAuth2ServerAuthorizationUrl": "https://cloud.appwrite.io/oauth2/.well-known/openid-configuration", + "oAuth2ServerScopes": [], + "oAuth2ServerAccessTokenDuration": 3600, + "oAuth2ServerRefreshTokenDuration": 86400, + "oAuth2ServerPublicAccessTokenDuration": 3600, + "oAuth2ServerPublicRefreshTokenDuration": 2592000, + "oAuth2ServerConfidentialPkce": true, + "oAuth2ServerDiscoveryUrl": "https://auth.example.com/.well-known/openid-configuration" } ` @@ -2645,6 +2796,7 @@ func TestProject(t *testing.T) { "$updatedAt": "2020-10-15T06:38:00.000+00:00", "name": "New Project", "teamId": "1592981250", + "region": "fra", "devKeys": [ { "$id": "5e5ea5c16897e", @@ -2689,7 +2841,6 @@ func TestProject(t *testing.T) { "enabled": true } ], - "region": "fra", "blocks": [ { "$createdAt": "2020-10-15T06:38:00.000+00:00", @@ -2702,7 +2853,16 @@ func TestProject(t *testing.T) { "billingPlan": "pro" } ], - "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00" + "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00", + "oAuth2ServerEnabled": true, + "oAuth2ServerAuthorizationUrl": "https://cloud.appwrite.io/oauth2/.well-known/openid-configuration", + "oAuth2ServerScopes": [], + "oAuth2ServerAccessTokenDuration": 3600, + "oAuth2ServerRefreshTokenDuration": 86400, + "oAuth2ServerPublicAccessTokenDuration": 3600, + "oAuth2ServerPublicRefreshTokenDuration": 2592000, + "oAuth2ServerConfidentialPkce": true, + "oAuth2ServerDiscoveryUrl": "https://auth.example.com/.well-known/openid-configuration" } ` @@ -2733,6 +2893,7 @@ func TestProject(t *testing.T) { "$updatedAt": "2020-10-15T06:38:00.000+00:00", "name": "New Project", "teamId": "1592981250", + "region": "fra", "devKeys": [ { "$id": "5e5ea5c16897e", @@ -2777,7 +2938,6 @@ func TestProject(t *testing.T) { "enabled": true } ], - "region": "fra", "blocks": [ { "$createdAt": "2020-10-15T06:38:00.000+00:00", @@ -2790,7 +2950,16 @@ func TestProject(t *testing.T) { "billingPlan": "pro" } ], - "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00" + "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00", + "oAuth2ServerEnabled": true, + "oAuth2ServerAuthorizationUrl": "https://cloud.appwrite.io/oauth2/.well-known/openid-configuration", + "oAuth2ServerScopes": [], + "oAuth2ServerAccessTokenDuration": 3600, + "oAuth2ServerRefreshTokenDuration": 86400, + "oAuth2ServerPublicAccessTokenDuration": 3600, + "oAuth2ServerPublicRefreshTokenDuration": 2592000, + "oAuth2ServerConfidentialPkce": true, + "oAuth2ServerDiscoveryUrl": "https://auth.example.com/.well-known/openid-configuration" } ` @@ -2821,6 +2990,7 @@ func TestProject(t *testing.T) { "$updatedAt": "2020-10-15T06:38:00.000+00:00", "name": "New Project", "teamId": "1592981250", + "region": "fra", "devKeys": [ { "$id": "5e5ea5c16897e", @@ -2865,7 +3035,6 @@ func TestProject(t *testing.T) { "enabled": true } ], - "region": "fra", "blocks": [ { "$createdAt": "2020-10-15T06:38:00.000+00:00", @@ -2878,7 +3047,16 @@ func TestProject(t *testing.T) { "billingPlan": "pro" } ], - "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00" + "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00", + "oAuth2ServerEnabled": true, + "oAuth2ServerAuthorizationUrl": "https://cloud.appwrite.io/oauth2/.well-known/openid-configuration", + "oAuth2ServerScopes": [], + "oAuth2ServerAccessTokenDuration": 3600, + "oAuth2ServerRefreshTokenDuration": 86400, + "oAuth2ServerPublicAccessTokenDuration": 3600, + "oAuth2ServerPublicRefreshTokenDuration": 2592000, + "oAuth2ServerConfidentialPkce": true, + "oAuth2ServerDiscoveryUrl": "https://auth.example.com/.well-known/openid-configuration" } ` @@ -2909,6 +3087,7 @@ func TestProject(t *testing.T) { "$updatedAt": "2020-10-15T06:38:00.000+00:00", "name": "New Project", "teamId": "1592981250", + "region": "fra", "devKeys": [ { "$id": "5e5ea5c16897e", @@ -2953,7 +3132,6 @@ func TestProject(t *testing.T) { "enabled": true } ], - "region": "fra", "blocks": [ { "$createdAt": "2020-10-15T06:38:00.000+00:00", @@ -2966,7 +3144,16 @@ func TestProject(t *testing.T) { "billingPlan": "pro" } ], - "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00" + "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00", + "oAuth2ServerEnabled": true, + "oAuth2ServerAuthorizationUrl": "https://cloud.appwrite.io/oauth2/.well-known/openid-configuration", + "oAuth2ServerScopes": [], + "oAuth2ServerAccessTokenDuration": 3600, + "oAuth2ServerRefreshTokenDuration": 86400, + "oAuth2ServerPublicAccessTokenDuration": 3600, + "oAuth2ServerPublicRefreshTokenDuration": 2592000, + "oAuth2ServerConfidentialPkce": true, + "oAuth2ServerDiscoveryUrl": "https://auth.example.com/.well-known/openid-configuration" } ` @@ -2989,6 +3176,37 @@ func TestProject(t *testing.T) { } }) + t.Run("Test UpdatePasswordStrengthPolicy", func(t *testing.T) { + mockResponse := ` +{ + "$id": "password-dictionary", + "min": 12, + "uppercase": true, + "lowercase": true, + "number": true, + "symbols": true +} +` + + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if r.Method != "PATCH" { + t.Errorf("Expected method PATCH, got %s", r.Method) + } + + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(http.StatusOK) + _, _ = w.Write([]byte(mockResponse)) + })) + defer ts.Close() + + srv := New(newTestClient(ts)) + + _, err := srv.UpdatePasswordStrengthPolicy() + if err != nil { + t.Errorf("Method UpdatePasswordStrengthPolicy failed: %v", err) + } + }) + t.Run("Test UpdateSessionAlertPolicy", func(t *testing.T) { mockResponse := ` { @@ -2997,6 +3215,7 @@ func TestProject(t *testing.T) { "$updatedAt": "2020-10-15T06:38:00.000+00:00", "name": "New Project", "teamId": "1592981250", + "region": "fra", "devKeys": [ { "$id": "5e5ea5c16897e", @@ -3041,7 +3260,6 @@ func TestProject(t *testing.T) { "enabled": true } ], - "region": "fra", "blocks": [ { "$createdAt": "2020-10-15T06:38:00.000+00:00", @@ -3054,7 +3272,16 @@ func TestProject(t *testing.T) { "billingPlan": "pro" } ], - "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00" + "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00", + "oAuth2ServerEnabled": true, + "oAuth2ServerAuthorizationUrl": "https://cloud.appwrite.io/oauth2/.well-known/openid-configuration", + "oAuth2ServerScopes": [], + "oAuth2ServerAccessTokenDuration": 3600, + "oAuth2ServerRefreshTokenDuration": 86400, + "oAuth2ServerPublicAccessTokenDuration": 3600, + "oAuth2ServerPublicRefreshTokenDuration": 2592000, + "oAuth2ServerConfidentialPkce": true, + "oAuth2ServerDiscoveryUrl": "https://auth.example.com/.well-known/openid-configuration" } ` @@ -3085,6 +3312,7 @@ func TestProject(t *testing.T) { "$updatedAt": "2020-10-15T06:38:00.000+00:00", "name": "New Project", "teamId": "1592981250", + "region": "fra", "devKeys": [ { "$id": "5e5ea5c16897e", @@ -3129,7 +3357,6 @@ func TestProject(t *testing.T) { "enabled": true } ], - "region": "fra", "blocks": [ { "$createdAt": "2020-10-15T06:38:00.000+00:00", @@ -3142,7 +3369,16 @@ func TestProject(t *testing.T) { "billingPlan": "pro" } ], - "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00" + "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00", + "oAuth2ServerEnabled": true, + "oAuth2ServerAuthorizationUrl": "https://cloud.appwrite.io/oauth2/.well-known/openid-configuration", + "oAuth2ServerScopes": [], + "oAuth2ServerAccessTokenDuration": 3600, + "oAuth2ServerRefreshTokenDuration": 86400, + "oAuth2ServerPublicAccessTokenDuration": 3600, + "oAuth2ServerPublicRefreshTokenDuration": 2592000, + "oAuth2ServerConfidentialPkce": true, + "oAuth2ServerDiscoveryUrl": "https://auth.example.com/.well-known/openid-configuration" } ` @@ -3173,6 +3409,7 @@ func TestProject(t *testing.T) { "$updatedAt": "2020-10-15T06:38:00.000+00:00", "name": "New Project", "teamId": "1592981250", + "region": "fra", "devKeys": [ { "$id": "5e5ea5c16897e", @@ -3217,7 +3454,6 @@ func TestProject(t *testing.T) { "enabled": true } ], - "region": "fra", "blocks": [ { "$createdAt": "2020-10-15T06:38:00.000+00:00", @@ -3230,7 +3466,16 @@ func TestProject(t *testing.T) { "billingPlan": "pro" } ], - "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00" + "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00", + "oAuth2ServerEnabled": true, + "oAuth2ServerAuthorizationUrl": "https://cloud.appwrite.io/oauth2/.well-known/openid-configuration", + "oAuth2ServerScopes": [], + "oAuth2ServerAccessTokenDuration": 3600, + "oAuth2ServerRefreshTokenDuration": 86400, + "oAuth2ServerPublicAccessTokenDuration": 3600, + "oAuth2ServerPublicRefreshTokenDuration": 2592000, + "oAuth2ServerConfidentialPkce": true, + "oAuth2ServerDiscoveryUrl": "https://auth.example.com/.well-known/openid-configuration" } ` @@ -3261,6 +3506,7 @@ func TestProject(t *testing.T) { "$updatedAt": "2020-10-15T06:38:00.000+00:00", "name": "New Project", "teamId": "1592981250", + "region": "fra", "devKeys": [ { "$id": "5e5ea5c16897e", @@ -3305,7 +3551,6 @@ func TestProject(t *testing.T) { "enabled": true } ], - "region": "fra", "blocks": [ { "$createdAt": "2020-10-15T06:38:00.000+00:00", @@ -3318,7 +3563,16 @@ func TestProject(t *testing.T) { "billingPlan": "pro" } ], - "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00" + "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00", + "oAuth2ServerEnabled": true, + "oAuth2ServerAuthorizationUrl": "https://cloud.appwrite.io/oauth2/.well-known/openid-configuration", + "oAuth2ServerScopes": [], + "oAuth2ServerAccessTokenDuration": 3600, + "oAuth2ServerRefreshTokenDuration": 86400, + "oAuth2ServerPublicAccessTokenDuration": 3600, + "oAuth2ServerPublicRefreshTokenDuration": 2592000, + "oAuth2ServerConfidentialPkce": true, + "oAuth2ServerDiscoveryUrl": "https://auth.example.com/.well-known/openid-configuration" } ` @@ -3349,6 +3603,7 @@ func TestProject(t *testing.T) { "$updatedAt": "2020-10-15T06:38:00.000+00:00", "name": "New Project", "teamId": "1592981250", + "region": "fra", "devKeys": [ { "$id": "5e5ea5c16897e", @@ -3393,7 +3648,6 @@ func TestProject(t *testing.T) { "enabled": true } ], - "region": "fra", "blocks": [ { "$createdAt": "2020-10-15T06:38:00.000+00:00", @@ -3406,7 +3660,16 @@ func TestProject(t *testing.T) { "billingPlan": "pro" } ], - "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00" + "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00", + "oAuth2ServerEnabled": true, + "oAuth2ServerAuthorizationUrl": "https://cloud.appwrite.io/oauth2/.well-known/openid-configuration", + "oAuth2ServerScopes": [], + "oAuth2ServerAccessTokenDuration": 3600, + "oAuth2ServerRefreshTokenDuration": 86400, + "oAuth2ServerPublicAccessTokenDuration": 3600, + "oAuth2ServerPublicRefreshTokenDuration": 2592000, + "oAuth2ServerConfidentialPkce": true, + "oAuth2ServerDiscoveryUrl": "https://auth.example.com/.well-known/openid-configuration" } ` @@ -3467,6 +3730,7 @@ func TestProject(t *testing.T) { "$updatedAt": "2020-10-15T06:38:00.000+00:00", "name": "New Project", "teamId": "1592981250", + "region": "fra", "devKeys": [ { "$id": "5e5ea5c16897e", @@ -3511,7 +3775,6 @@ func TestProject(t *testing.T) { "enabled": true } ], - "region": "fra", "blocks": [ { "$createdAt": "2020-10-15T06:38:00.000+00:00", @@ -3524,7 +3787,16 @@ func TestProject(t *testing.T) { "billingPlan": "pro" } ], - "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00" + "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00", + "oAuth2ServerEnabled": true, + "oAuth2ServerAuthorizationUrl": "https://cloud.appwrite.io/oauth2/.well-known/openid-configuration", + "oAuth2ServerScopes": [], + "oAuth2ServerAccessTokenDuration": 3600, + "oAuth2ServerRefreshTokenDuration": 86400, + "oAuth2ServerPublicAccessTokenDuration": 3600, + "oAuth2ServerPublicRefreshTokenDuration": 2592000, + "oAuth2ServerConfidentialPkce": true, + "oAuth2ServerDiscoveryUrl": "https://auth.example.com/.well-known/openid-configuration" } ` @@ -3555,6 +3827,7 @@ func TestProject(t *testing.T) { "$updatedAt": "2020-10-15T06:38:00.000+00:00", "name": "New Project", "teamId": "1592981250", + "region": "fra", "devKeys": [ { "$id": "5e5ea5c16897e", @@ -3599,7 +3872,6 @@ func TestProject(t *testing.T) { "enabled": true } ], - "region": "fra", "blocks": [ { "$createdAt": "2020-10-15T06:38:00.000+00:00", @@ -3612,7 +3884,16 @@ func TestProject(t *testing.T) { "billingPlan": "pro" } ], - "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00" + "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00", + "oAuth2ServerEnabled": true, + "oAuth2ServerAuthorizationUrl": "https://cloud.appwrite.io/oauth2/.well-known/openid-configuration", + "oAuth2ServerScopes": [], + "oAuth2ServerAccessTokenDuration": 3600, + "oAuth2ServerRefreshTokenDuration": 86400, + "oAuth2ServerPublicAccessTokenDuration": 3600, + "oAuth2ServerPublicRefreshTokenDuration": 2592000, + "oAuth2ServerConfidentialPkce": true, + "oAuth2ServerDiscoveryUrl": "https://auth.example.com/.well-known/openid-configuration" } ` @@ -3643,6 +3924,7 @@ func TestProject(t *testing.T) { "$updatedAt": "2020-10-15T06:38:00.000+00:00", "name": "New Project", "teamId": "1592981250", + "region": "fra", "devKeys": [ { "$id": "5e5ea5c16897e", @@ -3687,7 +3969,6 @@ func TestProject(t *testing.T) { "enabled": true } ], - "region": "fra", "blocks": [ { "$createdAt": "2020-10-15T06:38:00.000+00:00", @@ -3700,7 +3981,16 @@ func TestProject(t *testing.T) { "billingPlan": "pro" } ], - "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00" + "consoleAccessedAt": "2020-10-15T06:38:00.000+00:00", + "oAuth2ServerEnabled": true, + "oAuth2ServerAuthorizationUrl": "https://cloud.appwrite.io/oauth2/.well-known/openid-configuration", + "oAuth2ServerScopes": [], + "oAuth2ServerAccessTokenDuration": 3600, + "oAuth2ServerRefreshTokenDuration": 86400, + "oAuth2ServerPublicAccessTokenDuration": 3600, + "oAuth2ServerPublicRefreshTokenDuration": 2592000, + "oAuth2ServerConfidentialPkce": true, + "oAuth2ServerDiscoveryUrl": "https://auth.example.com/.well-known/openid-configuration" } ` diff --git a/proxy/proxy.go b/proxy/proxy.go index 5e565a61..f59b7075 100644 --- a/proxy/proxy.go +++ b/proxy/proxy.go @@ -61,6 +61,7 @@ func (srv *Proxy) ListRules(optionalSetters ...ListRulesOption)(*models.ProxyRul params["total"] = options.Total } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -98,6 +99,7 @@ func (srv *Proxy) CreateAPIRule(Domain string)(*models.ProxyRule, error) { params := map[string]interface{}{} params["domain"] = Domain headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -161,6 +163,7 @@ func (srv *Proxy) CreateFunctionRule(Domain string, FunctionId string, optionalS params["branch"] = options.Branch } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -203,6 +206,7 @@ func (srv *Proxy) CreateRedirectRule(Domain string, Url string, StatusCode strin params["resourceId"] = ResourceId params["resourceType"] = ResourceType headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -266,6 +270,7 @@ func (srv *Proxy) CreateSiteRule(Domain string, SiteId string, optionalSetters . params["branch"] = options.Branch } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -301,6 +306,7 @@ func (srv *Proxy) GetRule(RuleId string)(*models.ProxyRule, error) { params := map[string]interface{}{} params["ruleId"] = RuleId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -335,6 +341,7 @@ func (srv *Proxy) DeleteRule(RuleId string)(*interface{}, error) { params := map[string]interface{}{} params["ruleId"] = RuleId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -372,6 +379,7 @@ func (srv *Proxy) UpdateRuleStatus(RuleId string)(*models.ProxyRule, error) { params := map[string]interface{}{} params["ruleId"] = RuleId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } diff --git a/sites/sites.go b/sites/sites.go index c0c1f45a..226a2c6c 100644 --- a/sites/sites.go +++ b/sites/sites.go @@ -75,6 +75,7 @@ func (srv *Sites) List(optionalSetters ...ListOption)(*models.SiteList, error) { params["total"] = options.Total } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -333,6 +334,7 @@ func (srv *Sites) Create(SiteId string, Name string, Framework string, BuildRunt params["deploymentRetention"] = options.DeploymentRetention } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -367,6 +369,7 @@ func (srv *Sites) ListFrameworks()(*models.FrameworkList, error) { path := "/sites/frameworks" params := map[string]interface{}{} headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -399,6 +402,7 @@ func (srv *Sites) ListSpecifications()(*models.SpecificationList, error) { path := "/sites/specifications" params := map[string]interface{}{} headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -433,6 +437,7 @@ func (srv *Sites) Get(SiteId string)(*models.Site, error) { params := map[string]interface{}{} params["siteId"] = SiteId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -702,6 +707,7 @@ func (srv *Sites) Update(SiteId string, Name string, Framework string, optionalS params["deploymentRetention"] = options.DeploymentRetention } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -737,6 +743,7 @@ func (srv *Sites) Delete(SiteId string)(*interface{}, error) { params := map[string]interface{}{} params["siteId"] = SiteId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -774,6 +781,7 @@ func (srv *Sites) UpdateSiteDeployment(SiteId string, DeploymentId string)(*mode params["siteId"] = SiteId params["deploymentId"] = DeploymentId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -856,6 +864,7 @@ func (srv *Sites) ListDeployments(SiteId string, optionalSetters ...ListDeployme params["total"] = options.Total } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -951,6 +960,7 @@ func (srv *Sites) CreateDeployment(SiteId string, Code file.InputFile, optionalS params["activate"] = options.Activate } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "multipart/form-data", } @@ -993,6 +1003,7 @@ func (srv *Sites) CreateDuplicateDeployment(SiteId string, DeploymentId string)( params["siteId"] = SiteId params["deploymentId"] = DeploymentId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1061,6 +1072,7 @@ func (srv *Sites) CreateTemplateDeployment(SiteId string, Repository string, Own params["activate"] = options.Activate } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1124,6 +1136,7 @@ func (srv *Sites) CreateVcsDeployment(SiteId string, Type string, Reference stri params["activate"] = options.Activate } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1160,6 +1173,7 @@ func (srv *Sites) GetDeployment(SiteId string, DeploymentId string)(*models.Depl params["siteId"] = SiteId params["deploymentId"] = DeploymentId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -1195,6 +1209,7 @@ func (srv *Sites) DeleteDeployment(SiteId string, DeploymentId string)(*interfac params["siteId"] = SiteId params["deploymentId"] = DeploymentId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1257,6 +1272,7 @@ func (srv *Sites) GetDeploymentDownload(SiteId string, DeploymentId string, opti params["type"] = options.Type } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -1320,6 +1336,7 @@ func (srv *Sites) UpdateDeploymentStatus(SiteId string, DeploymentId string)(*mo params["siteId"] = SiteId params["deploymentId"] = DeploymentId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1391,6 +1408,7 @@ func (srv *Sites) ListLogs(SiteId string, optionalSetters ...ListLogsOption)(*mo params["total"] = options.Total } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -1426,6 +1444,7 @@ func (srv *Sites) GetLog(SiteId string, LogId string)(*models.Execution, error) params["siteId"] = SiteId params["logId"] = LogId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -1461,6 +1480,7 @@ func (srv *Sites) DeleteLog(SiteId string, LogId string)(*interface{}, error) { params["siteId"] = SiteId params["logId"] = LogId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1530,6 +1550,7 @@ func (srv *Sites) ListVariables(SiteId string, optionalSetters ...ListVariablesO params["total"] = options.Total } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -1592,6 +1613,7 @@ func (srv *Sites) CreateVariable(SiteId string, VariableId string, Key string, V params["secret"] = options.Secret } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1628,6 +1650,7 @@ func (srv *Sites) GetVariable(SiteId string, VariableId string)(*models.Variable params["siteId"] = SiteId params["variableId"] = VariableId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -1709,6 +1732,7 @@ func (srv *Sites) UpdateVariable(SiteId string, VariableId string, optionalSette params["secret"] = options.Secret } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1745,6 +1769,7 @@ func (srv *Sites) DeleteVariable(SiteId string, VariableId string)(*interface{}, params["siteId"] = SiteId params["variableId"] = VariableId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } diff --git a/storage/storage.go b/storage/storage.go index 911b0a49..80282e47 100644 --- a/storage/storage.go +++ b/storage/storage.go @@ -75,6 +75,7 @@ func (srv *Storage) ListBuckets(optionalSetters ...ListBucketsOption)(*models.Bu params["total"] = options.Total } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -221,6 +222,7 @@ func (srv *Storage) CreateBucket(BucketId string, Name string, optionalSetters . params["transformations"] = options.Transformations } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -257,6 +259,7 @@ func (srv *Storage) GetBucket(BucketId string)(*models.Bucket, error) { params := map[string]interface{}{} params["bucketId"] = BucketId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -404,6 +407,7 @@ func (srv *Storage) UpdateBucket(BucketId string, Name string, optionalSetters . params["transformations"] = options.Transformations } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -439,6 +443,7 @@ func (srv *Storage) DeleteBucket(BucketId string)(*interface{}, error) { params := map[string]interface{}{} params["bucketId"] = BucketId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -520,6 +525,7 @@ func (srv *Storage) ListFiles(BucketId string, optionalSetters ...ListFilesOptio params["total"] = options.Total } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -596,6 +602,7 @@ func (srv *Storage) CreateFile(BucketId string, FileId string, File file.InputFi params["permissions"] = options.Permissions } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "multipart/form-data", } @@ -635,6 +642,7 @@ func (srv *Storage) GetFile(BucketId string, FileId string)(*models.File, error) params["bucketId"] = BucketId params["fileId"] = FileId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -706,6 +714,7 @@ func (srv *Storage) UpdateFile(BucketId string, FileId string, optionalSetters . params["permissions"] = options.Permissions } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -743,6 +752,7 @@ func (srv *Storage) DeleteFile(BucketId string, FileId string)(*interface{}, err params["bucketId"] = BucketId params["fileId"] = FileId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -804,6 +814,7 @@ func (srv *Storage) GetFileDownload(BucketId string, FileId string, optionalSett params["token"] = options.Token } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -1010,6 +1021,7 @@ func (srv *Storage) GetFilePreview(BucketId string, FileId string, optionalSette params["token"] = options.Token } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -1128,6 +1140,7 @@ func (srv *Storage) GetFileView(BucketId string, FileId string, optionalSetters params["token"] = options.Token } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) diff --git a/tablesdb/tables_db.go b/tablesdb/tables_db.go index bb4d10e9..a371e17c 100644 --- a/tablesdb/tables_db.go +++ b/tablesdb/tables_db.go @@ -73,6 +73,7 @@ func (srv *TablesDB) List(optionalSetters ...ListOption)(*models.DatabaseList, e params["total"] = options.Total } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -131,6 +132,7 @@ func (srv *TablesDB) Create(DatabaseId string, Name string, optionalSetters ...C params["enabled"] = options.Enabled } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -188,6 +190,7 @@ func (srv *TablesDB) ListTransactions(optionalSetters ...ListTransactionsOption) params["queries"] = options.Queries } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -244,6 +247,7 @@ func (srv *TablesDB) CreateTransaction(optionalSetters ...CreateTransactionOptio params["ttl"] = options.Ttl } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -279,6 +283,7 @@ func (srv *TablesDB) GetTransaction(TransactionId string)(*models.Transaction, e params := map[string]interface{}{} params["transactionId"] = TransactionId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -349,6 +354,7 @@ func (srv *TablesDB) UpdateTransaction(TransactionId string, optionalSetters ... params["rollback"] = options.Rollback } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -384,6 +390,7 @@ func (srv *TablesDB) DeleteTransaction(TransactionId string)(*interface{}, error params := map[string]interface{}{} params["transactionId"] = TransactionId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -442,6 +449,7 @@ func (srv *TablesDB) CreateOperations(TransactionId string, optionalSetters ...C params["operations"] = options.Operations } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -478,6 +486,7 @@ func (srv *TablesDB) Get(DatabaseId string)(*models.Database, error) { params := map[string]interface{}{} params["databaseId"] = DatabaseId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -547,6 +556,7 @@ func (srv *TablesDB) Update(DatabaseId string, optionalSetters ...UpdateOption)( params["enabled"] = options.Enabled } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -583,6 +593,7 @@ func (srv *TablesDB) Delete(DatabaseId string)(*interface{}, error) { params := map[string]interface{}{} params["databaseId"] = DatabaseId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -664,6 +675,7 @@ func (srv *TablesDB) ListTables(DatabaseId string, optionalSetters ...ListTables params["total"] = options.Total } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -771,6 +783,7 @@ func (srv *TablesDB) CreateTable(DatabaseId string, TableId string, Name string, params["indexes"] = options.Indexes } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -808,6 +821,7 @@ func (srv *TablesDB) GetTable(DatabaseId string, TableId string)(*models.Table, params["databaseId"] = DatabaseId params["tableId"] = TableId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -911,6 +925,7 @@ func (srv *TablesDB) UpdateTable(DatabaseId string, TableId string, optionalSett params["purge"] = options.Purge } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -948,6 +963,7 @@ func (srv *TablesDB) DeleteTable(DatabaseId string, TableId string)(*interface{} params["databaseId"] = DatabaseId params["tableId"] = TableId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1018,6 +1034,7 @@ func (srv *TablesDB) ListColumns(DatabaseId string, TableId string, optionalSett params["total"] = options.Total } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -1113,6 +1130,7 @@ func (srv *TablesDB) CreateBigIntColumn(DatabaseId string, TableId string, Key s params["array"] = options.Array } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1199,6 +1217,7 @@ func (srv *TablesDB) UpdateBigIntColumn(DatabaseId string, TableId string, Key s params["newKey"] = options.NewKey } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1272,6 +1291,7 @@ func (srv *TablesDB) CreateBooleanColumn(DatabaseId string, TableId string, Key params["array"] = options.Array } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1336,6 +1356,7 @@ func (srv *TablesDB) UpdateBooleanColumn(DatabaseId string, TableId string, Key params["newKey"] = options.NewKey } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1410,6 +1431,7 @@ func (srv *TablesDB) CreateDatetimeColumn(DatabaseId string, TableId string, Key params["array"] = options.Array } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1474,6 +1496,7 @@ func (srv *TablesDB) UpdateDatetimeColumn(DatabaseId string, TableId string, Key params["newKey"] = options.NewKey } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1547,6 +1570,7 @@ func (srv *TablesDB) CreateEmailColumn(DatabaseId string, TableId string, Key st params["array"] = options.Array } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1611,6 +1635,7 @@ func (srv *TablesDB) UpdateEmailColumn(DatabaseId string, TableId string, Key st params["newKey"] = options.NewKey } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1686,6 +1711,7 @@ func (srv *TablesDB) CreateEnumColumn(DatabaseId string, TableId string, Key str params["array"] = options.Array } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1751,6 +1777,7 @@ func (srv *TablesDB) UpdateEnumColumn(DatabaseId string, TableId string, Key str params["newKey"] = options.NewKey } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1847,6 +1874,7 @@ func (srv *TablesDB) CreateFloatColumn(DatabaseId string, TableId string, Key st params["array"] = options.Array } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1933,6 +1961,7 @@ func (srv *TablesDB) UpdateFloatColumn(DatabaseId string, TableId string, Key st params["newKey"] = options.NewKey } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -2029,6 +2058,7 @@ func (srv *TablesDB) CreateIntegerColumn(DatabaseId string, TableId string, Key params["array"] = options.Array } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -2115,6 +2145,7 @@ func (srv *TablesDB) UpdateIntegerColumn(DatabaseId string, TableId string, Key params["newKey"] = options.NewKey } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -2188,6 +2219,7 @@ func (srv *TablesDB) CreateIpColumn(DatabaseId string, TableId string, Key strin params["array"] = options.Array } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -2252,6 +2284,7 @@ func (srv *TablesDB) UpdateIpColumn(DatabaseId string, TableId string, Key strin params["newKey"] = options.NewKey } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -2314,6 +2347,7 @@ func (srv *TablesDB) CreateLineColumn(DatabaseId string, TableId string, Key str params["default"] = options.Default } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -2388,6 +2422,7 @@ func (srv *TablesDB) UpdateLineColumn(DatabaseId string, TableId string, Key str params["newKey"] = options.NewKey } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -2472,6 +2507,7 @@ func (srv *TablesDB) CreateLongtextColumn(DatabaseId string, TableId string, Key params["encrypt"] = options.Encrypt } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -2536,6 +2572,7 @@ func (srv *TablesDB) UpdateLongtextColumn(DatabaseId string, TableId string, Key params["newKey"] = options.NewKey } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -2620,6 +2657,7 @@ func (srv *TablesDB) CreateMediumtextColumn(DatabaseId string, TableId string, K params["encrypt"] = options.Encrypt } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -2684,6 +2722,7 @@ func (srv *TablesDB) UpdateMediumtextColumn(DatabaseId string, TableId string, K params["newKey"] = options.NewKey } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -2746,6 +2785,7 @@ func (srv *TablesDB) CreatePointColumn(DatabaseId string, TableId string, Key st params["default"] = options.Default } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -2820,6 +2860,7 @@ func (srv *TablesDB) UpdatePointColumn(DatabaseId string, TableId string, Key st params["newKey"] = options.NewKey } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -2882,6 +2923,7 @@ func (srv *TablesDB) CreatePolygonColumn(DatabaseId string, TableId string, Key params["default"] = options.Default } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -2956,6 +2998,7 @@ func (srv *TablesDB) UpdatePolygonColumn(DatabaseId string, TableId string, Key params["newKey"] = options.NewKey } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -3053,6 +3096,7 @@ func (srv *TablesDB) CreateRelationshipColumn(DatabaseId string, TableId string, params["onDelete"] = options.OnDelete } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -3140,6 +3184,7 @@ func (srv *TablesDB) CreateStringColumn(DatabaseId string, TableId string, Key s params["encrypt"] = options.Encrypt } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -3217,6 +3262,7 @@ func (srv *TablesDB) UpdateStringColumn(DatabaseId string, TableId string, Key s params["newKey"] = options.NewKey } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -3301,6 +3347,7 @@ func (srv *TablesDB) CreateTextColumn(DatabaseId string, TableId string, Key str params["encrypt"] = options.Encrypt } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -3365,6 +3412,7 @@ func (srv *TablesDB) UpdateTextColumn(DatabaseId string, TableId string, Key str params["newKey"] = options.NewKey } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -3438,6 +3486,7 @@ func (srv *TablesDB) CreateUrlColumn(DatabaseId string, TableId string, Key stri params["array"] = options.Array } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -3502,6 +3551,7 @@ func (srv *TablesDB) UpdateUrlColumn(DatabaseId string, TableId string, Key stri params["newKey"] = options.NewKey } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -3587,6 +3637,7 @@ func (srv *TablesDB) CreateVarcharColumn(DatabaseId string, TableId string, Key params["encrypt"] = options.Encrypt } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -3662,6 +3713,7 @@ func (srv *TablesDB) UpdateVarcharColumn(DatabaseId string, TableId string, Key params["newKey"] = options.NewKey } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -3699,6 +3751,7 @@ func (srv *TablesDB) GetColumn(DatabaseId string, TableId string, Key string)(mo params["tableId"] = TableId params["key"] = Key headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -3812,6 +3865,7 @@ func (srv *TablesDB) DeleteColumn(DatabaseId string, TableId string, Key string) params["tableId"] = TableId params["key"] = Key headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -3885,6 +3939,7 @@ func (srv *TablesDB) UpdateRelationshipColumn(DatabaseId string, TableId string, params["newKey"] = options.NewKey } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -3956,6 +4011,7 @@ func (srv *TablesDB) ListIndexes(DatabaseId string, TableId string, optionalSett params["total"] = options.Total } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -4031,6 +4087,7 @@ func (srv *TablesDB) CreateIndex(DatabaseId string, TableId string, Key string, params["lengths"] = options.Lengths } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -4068,6 +4125,7 @@ func (srv *TablesDB) GetIndex(DatabaseId string, TableId string, Key string)(*mo params["tableId"] = TableId params["key"] = Key headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -4104,6 +4162,7 @@ func (srv *TablesDB) DeleteIndex(DatabaseId string, TableId string, Key string)( params["tableId"] = TableId params["key"] = Key headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -4197,6 +4256,7 @@ func (srv *TablesDB) ListRows(DatabaseId string, TableId string, optionalSetters params["ttl"] = options.Ttl } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -4272,6 +4332,7 @@ func (srv *TablesDB) CreateRow(DatabaseId string, TableId string, RowId string, params["transactionId"] = options.TransactionId } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -4336,6 +4397,7 @@ func (srv *TablesDB) CreateRows(DatabaseId string, TableId string, Rows []interf params["transactionId"] = options.TransactionId } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -4400,6 +4462,7 @@ func (srv *TablesDB) UpsertRows(DatabaseId string, TableId string, Rows []interf params["transactionId"] = options.TransactionId } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -4484,6 +4547,7 @@ func (srv *TablesDB) UpdateRows(DatabaseId string, TableId string, optionalSette params["transactionId"] = options.TransactionId } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -4556,6 +4620,7 @@ func (srv *TablesDB) DeleteRows(DatabaseId string, TableId string, optionalSette params["transactionId"] = options.TransactionId } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -4629,6 +4694,7 @@ func (srv *TablesDB) GetRow(DatabaseId string, TableId string, RowId string, opt params["transactionId"] = options.TransactionId } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -4714,6 +4780,7 @@ func (srv *TablesDB) UpsertRow(DatabaseId string, TableId string, RowId string, params["transactionId"] = options.TransactionId } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -4798,6 +4865,7 @@ func (srv *TablesDB) UpdateRow(DatabaseId string, TableId string, RowId string, params["transactionId"] = options.TransactionId } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -4859,6 +4927,7 @@ func (srv *TablesDB) DeleteRow(DatabaseId string, TableId string, RowId string, params["transactionId"] = options.TransactionId } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -4942,6 +5011,7 @@ func (srv *TablesDB) DecrementRowColumn(DatabaseId string, TableId string, RowId params["transactionId"] = options.TransactionId } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -5026,6 +5096,7 @@ func (srv *TablesDB) IncrementRowColumn(DatabaseId string, TableId string, RowId params["transactionId"] = options.TransactionId } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } diff --git a/teams/teams.go b/teams/teams.go index 62ca03f7..26328067 100644 --- a/teams/teams.go +++ b/teams/teams.go @@ -72,6 +72,7 @@ func (srv *Teams) List(optionalSetters ...ListOption)(*models.TeamList, error) { params["total"] = options.Total } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -132,6 +133,7 @@ func (srv *Teams) Create(TeamId string, Name string, optionalSetters ...CreateOp params["roles"] = options.Roles } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -168,6 +170,7 @@ func (srv *Teams) Get(TeamId string)(*models.Team, error) { params := map[string]interface{}{} params["teamId"] = TeamId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -203,6 +206,7 @@ func (srv *Teams) UpdateName(TeamId string, Name string)(*models.Team, error) { params["teamId"] = TeamId params["name"] = Name headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -239,6 +243,7 @@ func (srv *Teams) Delete(TeamId string)(*interface{}, error) { params := map[string]interface{}{} params["teamId"] = TeamId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -321,6 +326,7 @@ func (srv *Teams) ListMemberships(TeamId string, optionalSetters ...ListMembersh params["total"] = options.Total } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -443,6 +449,7 @@ func (srv *Teams) CreateMembership(TeamId string, Roles []string, optionalSetter params["name"] = options.Name } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -481,6 +488,7 @@ func (srv *Teams) GetMembership(TeamId string, MembershipId string)(*models.Memb params["teamId"] = TeamId params["membershipId"] = MembershipId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -519,6 +527,7 @@ func (srv *Teams) UpdateMembership(TeamId string, MembershipId string, Roles []s params["membershipId"] = MembershipId params["roles"] = Roles headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -557,6 +566,7 @@ func (srv *Teams) DeleteMembership(TeamId string, MembershipId string)(*interfac params["teamId"] = TeamId params["membershipId"] = MembershipId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -599,6 +609,7 @@ func (srv *Teams) UpdateMembershipStatus(TeamId string, MembershipId string, Use params["userId"] = UserId params["secret"] = Secret headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -637,6 +648,7 @@ func (srv *Teams) GetPrefs(TeamId string)(*models.Preferences, error) { params := map[string]interface{}{} params["teamId"] = TeamId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -674,6 +686,7 @@ func (srv *Teams) UpdatePrefs(TeamId string, Prefs interface{})(*models.Preferen params["teamId"] = TeamId params["prefs"] = Prefs headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } diff --git a/tokens/tokens.go b/tokens/tokens.go index 2d03ac10..db6f5661 100644 --- a/tokens/tokens.go +++ b/tokens/tokens.go @@ -64,6 +64,7 @@ func (srv *Tokens) List(BucketId string, FileId string, optionalSetters ...ListO params["total"] = options.Total } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -124,6 +125,7 @@ func (srv *Tokens) CreateFileToken(BucketId string, FileId string, optionalSette params["expire"] = options.Expire } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -159,6 +161,7 @@ func (srv *Tokens) Get(TokenId string)(*models.ResourceToken, error) { params := map[string]interface{}{} params["tokenId"] = TokenId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -218,6 +221,7 @@ func (srv *Tokens) Update(TokenId string, optionalSetters ...UpdateOption)(*mode params["expire"] = options.Expire } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -253,6 +257,7 @@ func (srv *Tokens) Delete(TokenId string)(*interface{}, error) { params := map[string]interface{}{} params["tokenId"] = TokenId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } diff --git a/usage/usage.go b/usage/usage.go index 17395b8a..8264698e 100644 --- a/usage/usage.go +++ b/usage/usage.go @@ -71,6 +71,7 @@ func (srv *Usage) ListEvents(optionalSetters ...ListEventsOption)(*models.UsageE params["total"] = options.Total } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -148,6 +149,7 @@ func (srv *Usage) ListGauges(optionalSetters ...ListGaugesOption)(*models.UsageG params["total"] = options.Total } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) diff --git a/users/users.go b/users/users.go index 574549a7..3bc83b88 100644 --- a/users/users.go +++ b/users/users.go @@ -72,6 +72,7 @@ func (srv *Users) List(optionalSetters ...ListOption)(*models.UserList, error) { params["total"] = options.Total } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -162,6 +163,7 @@ func (srv *Users) Create(UserId string, optionalSetters ...CreateOption)(*models params["name"] = options.Name } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -225,6 +227,7 @@ func (srv *Users) CreateArgon2User(UserId string, Email string, Password string, params["name"] = options.Name } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -288,6 +291,7 @@ func (srv *Users) CreateBcryptUser(UserId string, Email string, Password string, params["name"] = options.Name } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -367,6 +371,7 @@ func (srv *Users) ListIdentities(optionalSetters ...ListIdentitiesOption)(*model params["total"] = options.Total } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -401,6 +406,7 @@ func (srv *Users) DeleteIdentity(IdentityId string)(*interface{}, error) { params := map[string]interface{}{} params["identityId"] = IdentityId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -463,6 +469,7 @@ func (srv *Users) CreateMD5User(UserId string, Email string, Password string, op params["name"] = options.Name } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -526,6 +533,7 @@ func (srv *Users) CreatePHPassUser(UserId string, Email string, Password string, params["name"] = options.Name } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -594,6 +602,7 @@ func (srv *Users) CreateScryptUser(UserId string, Email string, Password string, params["name"] = options.Name } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -662,6 +671,7 @@ func (srv *Users) CreateScryptModifiedUser(UserId string, Email string, Password params["name"] = options.Name } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -736,6 +746,7 @@ func (srv *Users) CreateSHAUser(UserId string, Email string, Password string, op params["name"] = options.Name } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -771,6 +782,7 @@ func (srv *Users) Get(UserId string)(*models.User, error) { params := map[string]interface{}{} params["userId"] = UserId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -810,6 +822,7 @@ func (srv *Users) Delete(UserId string)(*interface{}, error) { params := map[string]interface{}{} params["userId"] = UserId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -845,6 +858,7 @@ func (srv *Users) UpdateEmail(UserId string, Email string)(*models.User, error) params["userId"] = UserId params["email"] = Email headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -885,6 +899,7 @@ func (srv *Users) UpdateImpersonator(UserId string, Impersonator bool)(*models.U params["userId"] = UserId params["impersonator"] = Impersonator headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -958,6 +973,7 @@ func (srv *Users) CreateJWT(UserId string, optionalSetters ...CreateJWTOption)(* params["duration"] = options.Duration } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -999,6 +1015,7 @@ func (srv *Users) UpdateLabels(UserId string, Labels []string)(*models.User, err params["userId"] = UserId params["labels"] = Labels headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1069,6 +1086,7 @@ func (srv *Users) ListLogs(UserId string, optionalSetters ...ListLogsOption)(*mo params["total"] = options.Total } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -1149,6 +1167,7 @@ func (srv *Users) ListMemberships(UserId string, optionalSetters ...ListMembersh params["total"] = options.Total } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -1186,6 +1205,7 @@ func (srv *Users) UpdateMfa(UserId string, Mfa bool)(*models.User, error) { params["userId"] = UserId params["mfa"] = Mfa headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1222,6 +1242,7 @@ func (srv *Users) UpdateMFA(UserId string, Mfa bool)(*models.User, error) { params["userId"] = UserId params["mfa"] = Mfa headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1260,6 +1281,7 @@ func (srv *Users) DeleteMfaAuthenticator(UserId string, Type string)(*interface{ params["userId"] = UserId params["type"] = Type headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1295,6 +1317,7 @@ func (srv *Users) DeleteMFAAuthenticator(UserId string, Type string)(*interface{ params["userId"] = UserId params["type"] = Type headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1332,6 +1355,7 @@ func (srv *Users) ListMfaFactors(UserId string)(*models.MfaFactors, error) { params := map[string]interface{}{} params["userId"] = UserId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -1367,6 +1391,7 @@ func (srv *Users) ListMFAFactors(UserId string)(*models.MfaFactors, error) { params := map[string]interface{}{} params["userId"] = UserId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -1406,6 +1431,7 @@ func (srv *Users) GetMfaRecoveryCodes(UserId string)(*models.MfaRecoveryCodes, e params := map[string]interface{}{} params["userId"] = UserId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -1443,6 +1469,7 @@ func (srv *Users) GetMFARecoveryCodes(UserId string)(*models.MfaRecoveryCodes, e params := map[string]interface{}{} params["userId"] = UserId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -1483,6 +1510,7 @@ func (srv *Users) UpdateMfaRecoveryCodes(UserId string)(*models.MfaRecoveryCodes params := map[string]interface{}{} params["userId"] = UserId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1522,6 +1550,7 @@ func (srv *Users) UpdateMFARecoveryCodes(UserId string)(*models.MfaRecoveryCodes params := map[string]interface{}{} params["userId"] = UserId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1562,6 +1591,7 @@ func (srv *Users) CreateMfaRecoveryCodes(UserId string)(*models.MfaRecoveryCodes params := map[string]interface{}{} params["userId"] = UserId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1600,6 +1630,7 @@ func (srv *Users) CreateMFARecoveryCodes(UserId string)(*models.MfaRecoveryCodes params := map[string]interface{}{} params["userId"] = UserId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1636,6 +1667,7 @@ func (srv *Users) UpdateName(UserId string, Name string)(*models.User, error) { params["userId"] = UserId params["name"] = Name headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1672,6 +1704,7 @@ func (srv *Users) UpdatePassword(UserId string, Password string)(*models.User, e params["userId"] = UserId params["password"] = Password headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1708,6 +1741,7 @@ func (srv *Users) UpdatePhone(UserId string, Number string)(*models.User, error) params["userId"] = UserId params["number"] = Number headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1743,6 +1777,7 @@ func (srv *Users) GetPrefs(UserId string)(*models.Preferences, error) { params := map[string]interface{}{} params["userId"] = UserId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -1780,6 +1815,7 @@ func (srv *Users) UpdatePrefs(UserId string, Prefs interface{})(*models.Preferen params["userId"] = UserId params["prefs"] = Prefs headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1839,6 +1875,7 @@ func (srv *Users) ListSessions(UserId string, optionalSetters ...ListSessionsOpt params["total"] = options.Total } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -1879,6 +1916,7 @@ func (srv *Users) CreateSession(UserId string)(*models.Session, error) { params := map[string]interface{}{} params["userId"] = UserId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1914,6 +1952,7 @@ func (srv *Users) DeleteSessions(UserId string)(*interface{}, error) { params := map[string]interface{}{} params["userId"] = UserId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1949,6 +1988,7 @@ func (srv *Users) DeleteSession(UserId string, SessionId string)(*interface{}, e params["userId"] = UserId params["sessionId"] = SessionId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -1985,6 +2025,7 @@ func (srv *Users) UpdateStatus(UserId string, Status bool)(*models.User, error) params["userId"] = UserId params["status"] = Status headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -2055,6 +2096,7 @@ func (srv *Users) ListTargets(UserId string, optionalSetters ...ListTargetsOptio params["total"] = options.Total } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -2127,6 +2169,7 @@ func (srv *Users) CreateTarget(UserId string, TargetId string, ProviderType stri params["name"] = options.Name } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -2163,6 +2206,7 @@ func (srv *Users) GetTarget(UserId string, TargetId string)(*models.Target, erro params["userId"] = UserId params["targetId"] = TargetId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -2244,6 +2288,7 @@ func (srv *Users) UpdateTarget(UserId string, TargetId string, optionalSetters . params["name"] = options.Name } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -2280,6 +2325,7 @@ func (srv *Users) DeleteTarget(UserId string, TargetId string)(*interface{}, err params["userId"] = UserId params["targetId"] = TargetId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -2352,6 +2398,7 @@ func (srv *Users) CreateToken(UserId string, optionalSetters ...CreateTokenOptio params["expire"] = options.Expire } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -2389,6 +2436,7 @@ func (srv *Users) UpdateEmailVerification(UserId string, EmailVerification bool) params["userId"] = UserId params["emailVerification"] = EmailVerification headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -2426,6 +2474,7 @@ func (srv *Users) UpdatePhoneVerification(UserId string, PhoneVerification bool) params["userId"] = UserId params["phoneVerification"] = PhoneVerification headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } diff --git a/webhooks/webhooks.go b/webhooks/webhooks.go index 463e5c6f..2fe58f94 100644 --- a/webhooks/webhooks.go +++ b/webhooks/webhooks.go @@ -61,6 +61,7 @@ func (srv *Webhooks) List(optionalSetters ...ListOption)(*models.WebhookList, er params["total"] = options.Total } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -166,6 +167,7 @@ func (srv *Webhooks) Create(WebhookId string, Url string, Name string, Events [] params["secret"] = options.Secret } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -202,6 +204,7 @@ func (srv *Webhooks) Get(WebhookId string)(*models.Webhook, error) { params := map[string]interface{}{} params["webhookId"] = WebhookId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], } resp, err := srv.client.Call("GET", path, headers, params) @@ -297,6 +300,7 @@ func (srv *Webhooks) Update(WebhookId string, Name string, Url string, Events [] params["authPassword"] = options.AuthPassword } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -333,6 +337,7 @@ func (srv *Webhooks) Delete(WebhookId string)(*interface{}, error) { params := map[string]interface{}{} params["webhookId"] = WebhookId headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } @@ -393,6 +398,7 @@ func (srv *Webhooks) UpdateSecret(WebhookId string, optionalSetters ...UpdateSec params["secret"] = options.Secret } headers := map[string]interface{}{ + "X-Appwrite-Project": srv.client.Config["project"], "content-type": "application/json", } From eec30b13c8dd61466f35df65b37d2d5a21655bb8 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Fri, 5 Jun 2026 14:53:59 +0530 Subject: [PATCH 2/2] chore: regenerate Go SDK with sdk-generator 1.32.3 (fix array doc examples) --- docs/examples/account/create-o-auth-2-token.md | 2 +- docs/examples/account/list-identities.md | 2 +- docs/examples/account/list-logs.md | 2 +- docs/examples/advisor/list-insights.md | 2 +- docs/examples/advisor/list-reports.md | 2 +- docs/examples/avatars/get-screenshot.md | 2 +- docs/examples/backups/create-archive.md | 2 +- docs/examples/backups/create-policy.md | 2 +- docs/examples/backups/create-restoration.md | 2 +- docs/examples/backups/list-archives.md | 2 +- docs/examples/backups/list-policies.md | 2 +- docs/examples/backups/list-restorations.md | 2 +- docs/examples/databases/create-collection.md | 2 +- docs/examples/databases/create-document.md | 2 +- docs/examples/databases/create-enum-attribute.md | 2 +- docs/examples/databases/create-index.md | 6 +++--- docs/examples/databases/create-line-attribute.md | 2 +- docs/examples/databases/create-operations.md | 2 +- docs/examples/databases/create-point-attribute.md | 2 +- docs/examples/databases/create-polygon-attribute.md | 2 +- docs/examples/databases/delete-documents.md | 2 +- docs/examples/databases/get-document.md | 2 +- docs/examples/databases/list-attributes.md | 2 +- docs/examples/databases/list-collections.md | 2 +- docs/examples/databases/list-documents.md | 2 +- docs/examples/databases/list-indexes.md | 2 +- docs/examples/databases/list-transactions.md | 2 +- docs/examples/databases/list.md | 2 +- docs/examples/databases/update-collection.md | 2 +- docs/examples/databases/update-document.md | 2 +- docs/examples/databases/update-documents.md | 2 +- docs/examples/databases/update-enum-attribute.md | 2 +- docs/examples/databases/update-line-attribute.md | 2 +- docs/examples/databases/update-point-attribute.md | 2 +- docs/examples/databases/update-polygon-attribute.md | 2 +- docs/examples/databases/upsert-document.md | 2 +- docs/examples/functions/create.md | 10 +++++----- docs/examples/functions/list-deployments.md | 2 +- docs/examples/functions/list-executions.md | 2 +- docs/examples/functions/list-variables.md | 2 +- docs/examples/functions/list.md | 2 +- docs/examples/functions/update.md | 10 +++++----- docs/examples/messaging/create-email.md | 12 ++++++------ docs/examples/messaging/create-push.md | 6 +++--- docs/examples/messaging/create-sms.md | 6 +++--- docs/examples/messaging/create-topic.md | 2 +- docs/examples/messaging/list-message-logs.md | 2 +- docs/examples/messaging/list-messages.md | 2 +- docs/examples/messaging/list-provider-logs.md | 2 +- docs/examples/messaging/list-providers.md | 2 +- docs/examples/messaging/list-subscriber-logs.md | 2 +- docs/examples/messaging/list-subscribers.md | 2 +- docs/examples/messaging/list-targets.md | 2 +- docs/examples/messaging/list-topic-logs.md | 2 +- docs/examples/messaging/list-topics.md | 2 +- docs/examples/messaging/update-email.md | 12 ++++++------ docs/examples/messaging/update-push.md | 6 +++--- docs/examples/messaging/update-sms.md | 6 +++--- docs/examples/messaging/update-topic.md | 2 +- docs/examples/organization/create-key.md | 2 +- docs/examples/organization/list-keys.md | 2 +- docs/examples/organization/list-projects.md | 2 +- docs/examples/organization/update-key.md | 2 +- docs/examples/presences/list.md | 2 +- docs/examples/presences/update.md | 2 +- docs/examples/presences/upsert.md | 2 +- docs/examples/project/create-ephemeral-key.md | 2 +- docs/examples/project/create-key.md | 2 +- docs/examples/project/create-smtp-test.md | 2 +- docs/examples/project/list-email-templates.md | 2 +- docs/examples/project/list-keys.md | 2 +- docs/examples/project/list-mock-phones.md | 2 +- docs/examples/project/list-o-auth-2-providers.md | 2 +- docs/examples/project/list-platforms.md | 2 +- docs/examples/project/list-policies.md | 2 +- docs/examples/project/list-variables.md | 2 +- docs/examples/project/update-key.md | 2 +- docs/examples/project/update-labels.md | 2 +- docs/examples/project/update-o-auth-2-google.md | 2 +- docs/examples/project/update-o-auth-2-server.md | 2 +- docs/examples/proxy/list-rules.md | 2 +- docs/examples/sites/create.md | 4 ++-- docs/examples/sites/list-deployments.md | 2 +- docs/examples/sites/list-logs.md | 2 +- docs/examples/sites/list-variables.md | 2 +- docs/examples/sites/list.md | 2 +- docs/examples/sites/update.md | 4 ++-- docs/examples/storage/create-bucket.md | 4 ++-- docs/examples/storage/create-file.md | 2 +- docs/examples/storage/list-buckets.md | 2 +- docs/examples/storage/list-files.md | 2 +- docs/examples/storage/update-bucket.md | 4 ++-- docs/examples/storage/update-file.md | 2 +- docs/examples/tablesdb/create-enum-column.md | 2 +- docs/examples/tablesdb/create-index.md | 6 +++--- docs/examples/tablesdb/create-line-column.md | 2 +- docs/examples/tablesdb/create-operations.md | 2 +- docs/examples/tablesdb/create-point-column.md | 2 +- docs/examples/tablesdb/create-polygon-column.md | 2 +- docs/examples/tablesdb/create-row.md | 2 +- docs/examples/tablesdb/create-table.md | 2 +- docs/examples/tablesdb/delete-rows.md | 2 +- docs/examples/tablesdb/get-row.md | 2 +- docs/examples/tablesdb/list-columns.md | 2 +- docs/examples/tablesdb/list-indexes.md | 2 +- docs/examples/tablesdb/list-rows.md | 2 +- docs/examples/tablesdb/list-tables.md | 2 +- docs/examples/tablesdb/list-transactions.md | 2 +- docs/examples/tablesdb/list.md | 2 +- docs/examples/tablesdb/update-enum-column.md | 2 +- docs/examples/tablesdb/update-line-column.md | 2 +- docs/examples/tablesdb/update-point-column.md | 2 +- docs/examples/tablesdb/update-polygon-column.md | 2 +- docs/examples/tablesdb/update-row.md | 2 +- docs/examples/tablesdb/update-rows.md | 2 +- docs/examples/tablesdb/update-table.md | 2 +- docs/examples/tablesdb/upsert-row.md | 2 +- docs/examples/teams/create-membership.md | 2 +- docs/examples/teams/create.md | 2 +- docs/examples/teams/list-memberships.md | 2 +- docs/examples/teams/list.md | 2 +- docs/examples/teams/update-membership.md | 2 +- docs/examples/tokens/list.md | 2 +- docs/examples/usage/list-events.md | 2 +- docs/examples/usage/list-gauges.md | 2 +- docs/examples/users/list-identities.md | 2 +- docs/examples/users/list-logs.md | 2 +- docs/examples/users/list-memberships.md | 2 +- docs/examples/users/list-targets.md | 2 +- docs/examples/users/list.md | 2 +- docs/examples/users/update-labels.md | 2 +- docs/examples/webhooks/create.md | 2 +- docs/examples/webhooks/list.md | 2 +- docs/examples/webhooks/update.md | 2 +- 134 files changed, 168 insertions(+), 168 deletions(-) diff --git a/docs/examples/account/create-o-auth-2-token.md b/docs/examples/account/create-o-auth-2-token.md index 713c5528..67be14e7 100644 --- a/docs/examples/account/create-o-auth-2-token.md +++ b/docs/examples/account/create-o-auth-2-token.md @@ -19,6 +19,6 @@ response, error := service.CreateOAuth2Token( "amazon", account.WithCreateOAuth2TokenSuccess("https://example.com"), account.WithCreateOAuth2TokenFailure("https://example.com"), - account.WithCreateOAuth2TokenScopes([]interface{}{}), + account.WithCreateOAuth2TokenScopes([]string{}), ) ``` diff --git a/docs/examples/account/list-identities.md b/docs/examples/account/list-identities.md index 71379c22..317690ba 100644 --- a/docs/examples/account/list-identities.md +++ b/docs/examples/account/list-identities.md @@ -16,7 +16,7 @@ client := client.New( service := account.New(client) response, error := service.ListIdentities( - account.WithListIdentitiesQueries([]interface{}{}), + account.WithListIdentitiesQueries([]string{}), account.WithListIdentitiesTotal(false), ) ``` diff --git a/docs/examples/account/list-logs.md b/docs/examples/account/list-logs.md index 2e332e7b..47a31e78 100644 --- a/docs/examples/account/list-logs.md +++ b/docs/examples/account/list-logs.md @@ -16,7 +16,7 @@ client := client.New( service := account.New(client) response, error := service.ListLogs( - account.WithListLogsQueries([]interface{}{}), + account.WithListLogsQueries([]string{}), account.WithListLogsTotal(false), ) ``` diff --git a/docs/examples/advisor/list-insights.md b/docs/examples/advisor/list-insights.md index c869971d..3754df2e 100644 --- a/docs/examples/advisor/list-insights.md +++ b/docs/examples/advisor/list-insights.md @@ -17,7 +17,7 @@ service := advisor.New(client) response, error := service.ListInsights( "", - advisor.WithListInsightsQueries([]interface{}{}), + advisor.WithListInsightsQueries([]string{}), advisor.WithListInsightsTotal(false), ) ``` diff --git a/docs/examples/advisor/list-reports.md b/docs/examples/advisor/list-reports.md index b0802467..0931e188 100644 --- a/docs/examples/advisor/list-reports.md +++ b/docs/examples/advisor/list-reports.md @@ -16,7 +16,7 @@ client := client.New( service := advisor.New(client) response, error := service.ListReports( - advisor.WithListReportsQueries([]interface{}{}), + advisor.WithListReportsQueries([]string{}), advisor.WithListReportsTotal(false), ) ``` diff --git a/docs/examples/avatars/get-screenshot.md b/docs/examples/avatars/get-screenshot.md index 143e06af..3f1c7571 100644 --- a/docs/examples/avatars/get-screenshot.md +++ b/docs/examples/avatars/get-screenshot.md @@ -33,7 +33,7 @@ response, error := service.GetScreenshot( avatars.WithGetScreenshotLongitude(-122.4194), avatars.WithGetScreenshotAccuracy(100), avatars.WithGetScreenshotTouch(true), - avatars.WithGetScreenshotPermissions(interface{}{"geolocation","notifications"}), + avatars.WithGetScreenshotPermissions([]string{"geolocation","notifications"}), avatars.WithGetScreenshotSleep(3), avatars.WithGetScreenshotWidth(800), avatars.WithGetScreenshotHeight(600), diff --git a/docs/examples/backups/create-archive.md b/docs/examples/backups/create-archive.md index 7fac1556..00dc8ddb 100644 --- a/docs/examples/backups/create-archive.md +++ b/docs/examples/backups/create-archive.md @@ -16,7 +16,7 @@ client := client.New( service := backups.New(client) response, error := service.CreateArchive( - []interface{}{}, + []string{}, backups.WithCreateArchiveResourceId(""), ) ``` diff --git a/docs/examples/backups/create-policy.md b/docs/examples/backups/create-policy.md index b1303a14..8e35a232 100644 --- a/docs/examples/backups/create-policy.md +++ b/docs/examples/backups/create-policy.md @@ -17,7 +17,7 @@ service := backups.New(client) response, error := service.CreatePolicy( "", - []interface{}{}, + []string{}, 1, "", backups.WithCreatePolicyName(""), diff --git a/docs/examples/backups/create-restoration.md b/docs/examples/backups/create-restoration.md index 0df787a9..bfb1e8fa 100644 --- a/docs/examples/backups/create-restoration.md +++ b/docs/examples/backups/create-restoration.md @@ -17,7 +17,7 @@ service := backups.New(client) response, error := service.CreateRestoration( "", - []interface{}{}, + []string{}, backups.WithCreateRestorationNewResourceId(""), backups.WithCreateRestorationNewResourceName(""), ) diff --git a/docs/examples/backups/list-archives.md b/docs/examples/backups/list-archives.md index 64d75706..4a88c05b 100644 --- a/docs/examples/backups/list-archives.md +++ b/docs/examples/backups/list-archives.md @@ -16,6 +16,6 @@ client := client.New( service := backups.New(client) response, error := service.ListArchives( - backups.WithListArchivesQueries([]interface{}{}), + backups.WithListArchivesQueries([]string{}), ) ``` diff --git a/docs/examples/backups/list-policies.md b/docs/examples/backups/list-policies.md index df757d20..db3cc111 100644 --- a/docs/examples/backups/list-policies.md +++ b/docs/examples/backups/list-policies.md @@ -16,6 +16,6 @@ client := client.New( service := backups.New(client) response, error := service.ListPolicies( - backups.WithListPoliciesQueries([]interface{}{}), + backups.WithListPoliciesQueries([]string{}), ) ``` diff --git a/docs/examples/backups/list-restorations.md b/docs/examples/backups/list-restorations.md index f9071db9..c3bff217 100644 --- a/docs/examples/backups/list-restorations.md +++ b/docs/examples/backups/list-restorations.md @@ -16,6 +16,6 @@ client := client.New( service := backups.New(client) response, error := service.ListRestorations( - backups.WithListRestorationsQueries([]interface{}{}), + backups.WithListRestorationsQueries([]string{}), ) ``` diff --git a/docs/examples/databases/create-collection.md b/docs/examples/databases/create-collection.md index d25162b8..aaac7c10 100644 --- a/docs/examples/databases/create-collection.md +++ b/docs/examples/databases/create-collection.md @@ -19,7 +19,7 @@ response, error := service.CreateCollection( "", "", "", - databases.WithCreateCollectionPermissions(interface{}{"read("any")"}), + databases.WithCreateCollectionPermissions([]string{"read("any")"}), databases.WithCreateCollectionDocumentSecurity(false), databases.WithCreateCollectionEnabled(false), databases.WithCreateCollectionAttributes([]interface{}{}), diff --git a/docs/examples/databases/create-document.md b/docs/examples/databases/create-document.md index 1c5fb2bb..a0a0f3e1 100644 --- a/docs/examples/databases/create-document.md +++ b/docs/examples/databases/create-document.md @@ -26,7 +26,7 @@ response, error := service.CreateDocument( "age": 30, "isAdmin": false }, - databases.WithCreateDocumentPermissions(interface{}{"read("any")"}), + databases.WithCreateDocumentPermissions([]string{"read("any")"}), databases.WithCreateDocumentTransactionId(""), ) ``` diff --git a/docs/examples/databases/create-enum-attribute.md b/docs/examples/databases/create-enum-attribute.md index 72ea1b9c..805af97b 100644 --- a/docs/examples/databases/create-enum-attribute.md +++ b/docs/examples/databases/create-enum-attribute.md @@ -19,7 +19,7 @@ response, error := service.CreateEnumAttribute( "", "", "", - []interface{}{}, + []string{}, false, databases.WithCreateEnumAttributeDefault(""), databases.WithCreateEnumAttributeArray(false), diff --git a/docs/examples/databases/create-index.md b/docs/examples/databases/create-index.md index e4227e5c..496000ee 100644 --- a/docs/examples/databases/create-index.md +++ b/docs/examples/databases/create-index.md @@ -20,8 +20,8 @@ response, error := service.CreateIndex( "", "", "key", - []interface{}{}, - databases.WithCreateIndexOrders([]interface{}{}), - databases.WithCreateIndexLengths([]interface{}{}), + []string{}, + databases.WithCreateIndexOrders([]string{}), + databases.WithCreateIndexLengths([]int{}), ) ``` diff --git a/docs/examples/databases/create-line-attribute.md b/docs/examples/databases/create-line-attribute.md index 6da90eec..8bc7a32b 100644 --- a/docs/examples/databases/create-line-attribute.md +++ b/docs/examples/databases/create-line-attribute.md @@ -20,6 +20,6 @@ response, error := service.CreateLineAttribute( "", "", false, - databases.WithCreateLineAttributeDefault(interface{}{[1, 2], [3, 4], [5, 6]}), + databases.WithCreateLineAttributeDefault([]interface{}{[1, 2], [3, 4], [5, 6]}), ) ``` diff --git a/docs/examples/databases/create-operations.md b/docs/examples/databases/create-operations.md index e5a46425..16a0147c 100644 --- a/docs/examples/databases/create-operations.md +++ b/docs/examples/databases/create-operations.md @@ -17,7 +17,7 @@ service := databases.New(client) response, error := service.CreateOperations( "", - databases.WithCreateOperationsOperations(interface{}{ + databases.WithCreateOperationsOperations([]interface{}{ { "action": "create", "databaseId": "", diff --git a/docs/examples/databases/create-point-attribute.md b/docs/examples/databases/create-point-attribute.md index 9c1cb797..0eba7812 100644 --- a/docs/examples/databases/create-point-attribute.md +++ b/docs/examples/databases/create-point-attribute.md @@ -20,6 +20,6 @@ response, error := service.CreatePointAttribute( "", "", false, - databases.WithCreatePointAttributeDefault(interface{}{1, 2}), + databases.WithCreatePointAttributeDefault([]interface{}{1, 2}), ) ``` diff --git a/docs/examples/databases/create-polygon-attribute.md b/docs/examples/databases/create-polygon-attribute.md index b2ab2ca7..4835b798 100644 --- a/docs/examples/databases/create-polygon-attribute.md +++ b/docs/examples/databases/create-polygon-attribute.md @@ -20,6 +20,6 @@ response, error := service.CreatePolygonAttribute( "", "", false, - databases.WithCreatePolygonAttributeDefault(interface{}{[[1, 2], [3, 4], [5, 6], [1, 2]]}), + databases.WithCreatePolygonAttributeDefault([]interface{}{[[1, 2], [3, 4], [5, 6], [1, 2]]}), ) ``` diff --git a/docs/examples/databases/delete-documents.md b/docs/examples/databases/delete-documents.md index e36bc47a..c1e11a63 100644 --- a/docs/examples/databases/delete-documents.md +++ b/docs/examples/databases/delete-documents.md @@ -18,7 +18,7 @@ service := databases.New(client) response, error := service.DeleteDocuments( "", "", - databases.WithDeleteDocumentsQueries([]interface{}{}), + databases.WithDeleteDocumentsQueries([]string{}), databases.WithDeleteDocumentsTransactionId(""), ) ``` diff --git a/docs/examples/databases/get-document.md b/docs/examples/databases/get-document.md index 4f4664bf..e43ec606 100644 --- a/docs/examples/databases/get-document.md +++ b/docs/examples/databases/get-document.md @@ -19,7 +19,7 @@ response, error := service.GetDocument( "", "", "", - databases.WithGetDocumentQueries([]interface{}{}), + databases.WithGetDocumentQueries([]string{}), databases.WithGetDocumentTransactionId(""), ) ``` diff --git a/docs/examples/databases/list-attributes.md b/docs/examples/databases/list-attributes.md index 9f02c93c..9269e684 100644 --- a/docs/examples/databases/list-attributes.md +++ b/docs/examples/databases/list-attributes.md @@ -18,7 +18,7 @@ service := databases.New(client) response, error := service.ListAttributes( "", "", - databases.WithListAttributesQueries([]interface{}{}), + databases.WithListAttributesQueries([]string{}), databases.WithListAttributesTotal(false), ) ``` diff --git a/docs/examples/databases/list-collections.md b/docs/examples/databases/list-collections.md index b88368d0..a7919949 100644 --- a/docs/examples/databases/list-collections.md +++ b/docs/examples/databases/list-collections.md @@ -17,7 +17,7 @@ service := databases.New(client) response, error := service.ListCollections( "", - databases.WithListCollectionsQueries([]interface{}{}), + databases.WithListCollectionsQueries([]string{}), databases.WithListCollectionsSearch(""), databases.WithListCollectionsTotal(false), ) diff --git a/docs/examples/databases/list-documents.md b/docs/examples/databases/list-documents.md index aff9ed3c..813425d4 100644 --- a/docs/examples/databases/list-documents.md +++ b/docs/examples/databases/list-documents.md @@ -18,7 +18,7 @@ service := databases.New(client) response, error := service.ListDocuments( "", "", - databases.WithListDocumentsQueries([]interface{}{}), + databases.WithListDocumentsQueries([]string{}), databases.WithListDocumentsTransactionId(""), databases.WithListDocumentsTotal(false), databases.WithListDocumentsTtl(0), diff --git a/docs/examples/databases/list-indexes.md b/docs/examples/databases/list-indexes.md index 353e5879..c4015369 100644 --- a/docs/examples/databases/list-indexes.md +++ b/docs/examples/databases/list-indexes.md @@ -18,7 +18,7 @@ service := databases.New(client) response, error := service.ListIndexes( "", "", - databases.WithListIndexesQueries([]interface{}{}), + databases.WithListIndexesQueries([]string{}), databases.WithListIndexesTotal(false), ) ``` diff --git a/docs/examples/databases/list-transactions.md b/docs/examples/databases/list-transactions.md index 5a7c43aa..4e90044c 100644 --- a/docs/examples/databases/list-transactions.md +++ b/docs/examples/databases/list-transactions.md @@ -16,6 +16,6 @@ client := client.New( service := databases.New(client) response, error := service.ListTransactions( - databases.WithListTransactionsQueries([]interface{}{}), + databases.WithListTransactionsQueries([]string{}), ) ``` diff --git a/docs/examples/databases/list.md b/docs/examples/databases/list.md index 1c246d1c..db1c3348 100644 --- a/docs/examples/databases/list.md +++ b/docs/examples/databases/list.md @@ -16,7 +16,7 @@ client := client.New( service := databases.New(client) response, error := service.List( - databases.WithListQueries([]interface{}{}), + databases.WithListQueries([]string{}), databases.WithListSearch(""), databases.WithListTotal(false), ) diff --git a/docs/examples/databases/update-collection.md b/docs/examples/databases/update-collection.md index ee46530f..2fe288aa 100644 --- a/docs/examples/databases/update-collection.md +++ b/docs/examples/databases/update-collection.md @@ -19,7 +19,7 @@ response, error := service.UpdateCollection( "", "", databases.WithUpdateCollectionName(""), - databases.WithUpdateCollectionPermissions(interface{}{"read("any")"}), + databases.WithUpdateCollectionPermissions([]string{"read("any")"}), databases.WithUpdateCollectionDocumentSecurity(false), databases.WithUpdateCollectionEnabled(false), databases.WithUpdateCollectionPurge(false), diff --git a/docs/examples/databases/update-document.md b/docs/examples/databases/update-document.md index a16c2a11..9357db02 100644 --- a/docs/examples/databases/update-document.md +++ b/docs/examples/databases/update-document.md @@ -26,7 +26,7 @@ response, error := service.UpdateDocument( "age": 33, "isAdmin": false }), - databases.WithUpdateDocumentPermissions(interface{}{"read("any")"}), + databases.WithUpdateDocumentPermissions([]string{"read("any")"}), databases.WithUpdateDocumentTransactionId(""), ) ``` diff --git a/docs/examples/databases/update-documents.md b/docs/examples/databases/update-documents.md index f72abb4f..da99217d 100644 --- a/docs/examples/databases/update-documents.md +++ b/docs/examples/databases/update-documents.md @@ -25,7 +25,7 @@ response, error := service.UpdateDocuments( "age": 33, "isAdmin": false }), - databases.WithUpdateDocumentsQueries([]interface{}{}), + databases.WithUpdateDocumentsQueries([]string{}), databases.WithUpdateDocumentsTransactionId(""), ) ``` diff --git a/docs/examples/databases/update-enum-attribute.md b/docs/examples/databases/update-enum-attribute.md index c08d7500..c56645b8 100644 --- a/docs/examples/databases/update-enum-attribute.md +++ b/docs/examples/databases/update-enum-attribute.md @@ -19,7 +19,7 @@ response, error := service.UpdateEnumAttribute( "", "", "", - []interface{}{}, + []string{}, false, "", databases.WithUpdateEnumAttributeNewKey(""), diff --git a/docs/examples/databases/update-line-attribute.md b/docs/examples/databases/update-line-attribute.md index d57414c1..7cae2576 100644 --- a/docs/examples/databases/update-line-attribute.md +++ b/docs/examples/databases/update-line-attribute.md @@ -20,7 +20,7 @@ response, error := service.UpdateLineAttribute( "", "", false, - databases.WithUpdateLineAttributeDefault(interface{}{[1, 2], [3, 4], [5, 6]}), + databases.WithUpdateLineAttributeDefault([]interface{}{[1, 2], [3, 4], [5, 6]}), databases.WithUpdateLineAttributeNewKey(""), ) ``` diff --git a/docs/examples/databases/update-point-attribute.md b/docs/examples/databases/update-point-attribute.md index f9a602f9..9da605d0 100644 --- a/docs/examples/databases/update-point-attribute.md +++ b/docs/examples/databases/update-point-attribute.md @@ -20,7 +20,7 @@ response, error := service.UpdatePointAttribute( "", "", false, - databases.WithUpdatePointAttributeDefault(interface{}{1, 2}), + databases.WithUpdatePointAttributeDefault([]interface{}{1, 2}), databases.WithUpdatePointAttributeNewKey(""), ) ``` diff --git a/docs/examples/databases/update-polygon-attribute.md b/docs/examples/databases/update-polygon-attribute.md index 9b92af0b..5db33da8 100644 --- a/docs/examples/databases/update-polygon-attribute.md +++ b/docs/examples/databases/update-polygon-attribute.md @@ -20,7 +20,7 @@ response, error := service.UpdatePolygonAttribute( "", "", false, - databases.WithUpdatePolygonAttributeDefault(interface{}{[[1, 2], [3, 4], [5, 6], [1, 2]]}), + databases.WithUpdatePolygonAttributeDefault([]interface{}{[[1, 2], [3, 4], [5, 6], [1, 2]]}), databases.WithUpdatePolygonAttributeNewKey(""), ) ``` diff --git a/docs/examples/databases/upsert-document.md b/docs/examples/databases/upsert-document.md index 9e07e0d7..6c0c89b1 100644 --- a/docs/examples/databases/upsert-document.md +++ b/docs/examples/databases/upsert-document.md @@ -26,7 +26,7 @@ response, error := service.UpsertDocument( "age": 30, "isAdmin": false }), - databases.WithUpsertDocumentPermissions(interface{}{"read("any")"}), + databases.WithUpsertDocumentPermissions([]string{"read("any")"}), databases.WithUpsertDocumentTransactionId(""), ) ``` diff --git a/docs/examples/functions/create.md b/docs/examples/functions/create.md index 8ad35b52..e762387a 100644 --- a/docs/examples/functions/create.md +++ b/docs/examples/functions/create.md @@ -19,22 +19,22 @@ response, error := service.Create( "", "", "node-14.5", - functions.WithCreateExecute(interface{}{"any"}), - functions.WithCreateEvents([]interface{}{}), + functions.WithCreateExecute([]string{"any"}), + functions.WithCreateEvents([]string{}), functions.WithCreateSchedule(""), functions.WithCreateTimeout(1), functions.WithCreateEnabled(false), functions.WithCreateLogging(false), functions.WithCreateEntrypoint(""), functions.WithCreateCommands(""), - functions.WithCreateScopes([]interface{}{}), + functions.WithCreateScopes([]string{}), functions.WithCreateInstallationId(""), functions.WithCreateProviderRepositoryId(""), functions.WithCreateProviderBranch(""), functions.WithCreateProviderSilentMode(false), functions.WithCreateProviderRootDirectory(""), - functions.WithCreateProviderBranches([]interface{}{}), - functions.WithCreateProviderPaths([]interface{}{}), + functions.WithCreateProviderBranches([]string{}), + functions.WithCreateProviderPaths([]string{}), functions.WithCreateBuildSpecification(""), functions.WithCreateRuntimeSpecification(""), functions.WithCreateDeploymentRetention(0), diff --git a/docs/examples/functions/list-deployments.md b/docs/examples/functions/list-deployments.md index 815ed2fa..da4aa742 100644 --- a/docs/examples/functions/list-deployments.md +++ b/docs/examples/functions/list-deployments.md @@ -17,7 +17,7 @@ service := functions.New(client) response, error := service.ListDeployments( "", - functions.WithListDeploymentsQueries([]interface{}{}), + functions.WithListDeploymentsQueries([]string{}), functions.WithListDeploymentsSearch(""), functions.WithListDeploymentsTotal(false), ) diff --git a/docs/examples/functions/list-executions.md b/docs/examples/functions/list-executions.md index 7290d628..8096bb19 100644 --- a/docs/examples/functions/list-executions.md +++ b/docs/examples/functions/list-executions.md @@ -17,7 +17,7 @@ service := functions.New(client) response, error := service.ListExecutions( "", - functions.WithListExecutionsQueries([]interface{}{}), + functions.WithListExecutionsQueries([]string{}), functions.WithListExecutionsTotal(false), ) ``` diff --git a/docs/examples/functions/list-variables.md b/docs/examples/functions/list-variables.md index e1248a43..777e5c67 100644 --- a/docs/examples/functions/list-variables.md +++ b/docs/examples/functions/list-variables.md @@ -17,7 +17,7 @@ service := functions.New(client) response, error := service.ListVariables( "", - functions.WithListVariablesQueries([]interface{}{}), + functions.WithListVariablesQueries([]string{}), functions.WithListVariablesTotal(false), ) ``` diff --git a/docs/examples/functions/list.md b/docs/examples/functions/list.md index 6f3ccff4..d20718fd 100644 --- a/docs/examples/functions/list.md +++ b/docs/examples/functions/list.md @@ -16,7 +16,7 @@ client := client.New( service := functions.New(client) response, error := service.List( - functions.WithListQueries([]interface{}{}), + functions.WithListQueries([]string{}), functions.WithListSearch(""), functions.WithListTotal(false), ) diff --git a/docs/examples/functions/update.md b/docs/examples/functions/update.md index 6fed969c..74ea2488 100644 --- a/docs/examples/functions/update.md +++ b/docs/examples/functions/update.md @@ -19,22 +19,22 @@ response, error := service.Update( "", "", functions.WithUpdateRuntime("node-14.5"), - functions.WithUpdateExecute(interface{}{"any"}), - functions.WithUpdateEvents([]interface{}{}), + functions.WithUpdateExecute([]string{"any"}), + functions.WithUpdateEvents([]string{}), functions.WithUpdateSchedule(""), functions.WithUpdateTimeout(1), functions.WithUpdateEnabled(false), functions.WithUpdateLogging(false), functions.WithUpdateEntrypoint(""), functions.WithUpdateCommands(""), - functions.WithUpdateScopes([]interface{}{}), + functions.WithUpdateScopes([]string{}), functions.WithUpdateInstallationId(""), functions.WithUpdateProviderRepositoryId(""), functions.WithUpdateProviderBranch(""), functions.WithUpdateProviderSilentMode(false), functions.WithUpdateProviderRootDirectory(""), - functions.WithUpdateProviderBranches([]interface{}{}), - functions.WithUpdateProviderPaths([]interface{}{}), + functions.WithUpdateProviderBranches([]string{}), + functions.WithUpdateProviderPaths([]string{}), functions.WithUpdateBuildSpecification(""), functions.WithUpdateRuntimeSpecification(""), functions.WithUpdateDeploymentRetention(0), diff --git a/docs/examples/messaging/create-email.md b/docs/examples/messaging/create-email.md index 6e59e83f..8ef213a1 100644 --- a/docs/examples/messaging/create-email.md +++ b/docs/examples/messaging/create-email.md @@ -19,12 +19,12 @@ response, error := service.CreateEmail( "", "", "", - messaging.WithCreateEmailTopics([]interface{}{}), - messaging.WithCreateEmailUsers([]interface{}{}), - messaging.WithCreateEmailTargets([]interface{}{}), - messaging.WithCreateEmailCc([]interface{}{}), - messaging.WithCreateEmailBcc([]interface{}{}), - messaging.WithCreateEmailAttachments([]interface{}{}), + messaging.WithCreateEmailTopics([]string{}), + messaging.WithCreateEmailUsers([]string{}), + messaging.WithCreateEmailTargets([]string{}), + messaging.WithCreateEmailCc([]string{}), + messaging.WithCreateEmailBcc([]string{}), + messaging.WithCreateEmailAttachments([]string{}), messaging.WithCreateEmailDraft(false), messaging.WithCreateEmailHtml(false), messaging.WithCreateEmailScheduledAt("2020-10-15T06:38:00.000+00:00"), diff --git a/docs/examples/messaging/create-push.md b/docs/examples/messaging/create-push.md index a8437c92..7a9f9581 100644 --- a/docs/examples/messaging/create-push.md +++ b/docs/examples/messaging/create-push.md @@ -19,9 +19,9 @@ response, error := service.CreatePush( "", messaging.WithCreatePushTitle(""), messaging.WithCreatePushBody("<BODY>"), - messaging.WithCreatePushTopics([]interface{}{}), - messaging.WithCreatePushUsers([]interface{}{}), - messaging.WithCreatePushTargets([]interface{}{}), + messaging.WithCreatePushTopics([]string{}), + messaging.WithCreatePushUsers([]string{}), + messaging.WithCreatePushTargets([]string{}), messaging.WithCreatePushData(map[string]interface{}{}), messaging.WithCreatePushAction("<ACTION>"), messaging.WithCreatePushImage("<ID1:ID2>"), diff --git a/docs/examples/messaging/create-sms.md b/docs/examples/messaging/create-sms.md index 0d52b9bd..063ea7a5 100644 --- a/docs/examples/messaging/create-sms.md +++ b/docs/examples/messaging/create-sms.md @@ -18,9 +18,9 @@ service := messaging.New(client) response, error := service.CreateSMS( "<MESSAGE_ID>", "<CONTENT>", - messaging.WithCreateSMSTopics([]interface{}{}), - messaging.WithCreateSMSUsers([]interface{}{}), - messaging.WithCreateSMSTargets([]interface{}{}), + messaging.WithCreateSMSTopics([]string{}), + messaging.WithCreateSMSUsers([]string{}), + messaging.WithCreateSMSTargets([]string{}), messaging.WithCreateSMSDraft(false), messaging.WithCreateSMSScheduledAt("2020-10-15T06:38:00.000+00:00"), ) diff --git a/docs/examples/messaging/create-topic.md b/docs/examples/messaging/create-topic.md index aec8900a..da81e806 100644 --- a/docs/examples/messaging/create-topic.md +++ b/docs/examples/messaging/create-topic.md @@ -18,6 +18,6 @@ service := messaging.New(client) response, error := service.CreateTopic( "<TOPIC_ID>", "<NAME>", - messaging.WithCreateTopicSubscribe(interface{}{"any"}), + messaging.WithCreateTopicSubscribe([]string{"any"}), ) ``` diff --git a/docs/examples/messaging/list-message-logs.md b/docs/examples/messaging/list-message-logs.md index 231235be..0f3d3955 100644 --- a/docs/examples/messaging/list-message-logs.md +++ b/docs/examples/messaging/list-message-logs.md @@ -17,7 +17,7 @@ service := messaging.New(client) response, error := service.ListMessageLogs( "<MESSAGE_ID>", - messaging.WithListMessageLogsQueries([]interface{}{}), + messaging.WithListMessageLogsQueries([]string{}), messaging.WithListMessageLogsTotal(false), ) ``` diff --git a/docs/examples/messaging/list-messages.md b/docs/examples/messaging/list-messages.md index 261d83a5..6648d751 100644 --- a/docs/examples/messaging/list-messages.md +++ b/docs/examples/messaging/list-messages.md @@ -16,7 +16,7 @@ client := client.New( service := messaging.New(client) response, error := service.ListMessages( - messaging.WithListMessagesQueries([]interface{}{}), + messaging.WithListMessagesQueries([]string{}), messaging.WithListMessagesSearch("<SEARCH>"), messaging.WithListMessagesTotal(false), ) diff --git a/docs/examples/messaging/list-provider-logs.md b/docs/examples/messaging/list-provider-logs.md index 0544d3f4..72fd8f2d 100644 --- a/docs/examples/messaging/list-provider-logs.md +++ b/docs/examples/messaging/list-provider-logs.md @@ -17,7 +17,7 @@ service := messaging.New(client) response, error := service.ListProviderLogs( "<PROVIDER_ID>", - messaging.WithListProviderLogsQueries([]interface{}{}), + messaging.WithListProviderLogsQueries([]string{}), messaging.WithListProviderLogsTotal(false), ) ``` diff --git a/docs/examples/messaging/list-providers.md b/docs/examples/messaging/list-providers.md index 1d06de93..155c4a38 100644 --- a/docs/examples/messaging/list-providers.md +++ b/docs/examples/messaging/list-providers.md @@ -16,7 +16,7 @@ client := client.New( service := messaging.New(client) response, error := service.ListProviders( - messaging.WithListProvidersQueries([]interface{}{}), + messaging.WithListProvidersQueries([]string{}), messaging.WithListProvidersSearch("<SEARCH>"), messaging.WithListProvidersTotal(false), ) diff --git a/docs/examples/messaging/list-subscriber-logs.md b/docs/examples/messaging/list-subscriber-logs.md index 3a751b5b..11d60a9e 100644 --- a/docs/examples/messaging/list-subscriber-logs.md +++ b/docs/examples/messaging/list-subscriber-logs.md @@ -17,7 +17,7 @@ service := messaging.New(client) response, error := service.ListSubscriberLogs( "<SUBSCRIBER_ID>", - messaging.WithListSubscriberLogsQueries([]interface{}{}), + messaging.WithListSubscriberLogsQueries([]string{}), messaging.WithListSubscriberLogsTotal(false), ) ``` diff --git a/docs/examples/messaging/list-subscribers.md b/docs/examples/messaging/list-subscribers.md index 4b5d12a1..bba7f4fa 100644 --- a/docs/examples/messaging/list-subscribers.md +++ b/docs/examples/messaging/list-subscribers.md @@ -17,7 +17,7 @@ service := messaging.New(client) response, error := service.ListSubscribers( "<TOPIC_ID>", - messaging.WithListSubscribersQueries([]interface{}{}), + messaging.WithListSubscribersQueries([]string{}), messaging.WithListSubscribersSearch("<SEARCH>"), messaging.WithListSubscribersTotal(false), ) diff --git a/docs/examples/messaging/list-targets.md b/docs/examples/messaging/list-targets.md index 159167ea..e59036ee 100644 --- a/docs/examples/messaging/list-targets.md +++ b/docs/examples/messaging/list-targets.md @@ -17,7 +17,7 @@ service := messaging.New(client) response, error := service.ListTargets( "<MESSAGE_ID>", - messaging.WithListTargetsQueries([]interface{}{}), + messaging.WithListTargetsQueries([]string{}), messaging.WithListTargetsTotal(false), ) ``` diff --git a/docs/examples/messaging/list-topic-logs.md b/docs/examples/messaging/list-topic-logs.md index a5c4b94e..1978c3d8 100644 --- a/docs/examples/messaging/list-topic-logs.md +++ b/docs/examples/messaging/list-topic-logs.md @@ -17,7 +17,7 @@ service := messaging.New(client) response, error := service.ListTopicLogs( "<TOPIC_ID>", - messaging.WithListTopicLogsQueries([]interface{}{}), + messaging.WithListTopicLogsQueries([]string{}), messaging.WithListTopicLogsTotal(false), ) ``` diff --git a/docs/examples/messaging/list-topics.md b/docs/examples/messaging/list-topics.md index 0104b513..9d3ec3cf 100644 --- a/docs/examples/messaging/list-topics.md +++ b/docs/examples/messaging/list-topics.md @@ -16,7 +16,7 @@ client := client.New( service := messaging.New(client) response, error := service.ListTopics( - messaging.WithListTopicsQueries([]interface{}{}), + messaging.WithListTopicsQueries([]string{}), messaging.WithListTopicsSearch("<SEARCH>"), messaging.WithListTopicsTotal(false), ) diff --git a/docs/examples/messaging/update-email.md b/docs/examples/messaging/update-email.md index 66f0c426..44557b17 100644 --- a/docs/examples/messaging/update-email.md +++ b/docs/examples/messaging/update-email.md @@ -17,16 +17,16 @@ service := messaging.New(client) response, error := service.UpdateEmail( "<MESSAGE_ID>", - messaging.WithUpdateEmailTopics([]interface{}{}), - messaging.WithUpdateEmailUsers([]interface{}{}), - messaging.WithUpdateEmailTargets([]interface{}{}), + messaging.WithUpdateEmailTopics([]string{}), + messaging.WithUpdateEmailUsers([]string{}), + messaging.WithUpdateEmailTargets([]string{}), messaging.WithUpdateEmailSubject("<SUBJECT>"), messaging.WithUpdateEmailContent("<CONTENT>"), messaging.WithUpdateEmailDraft(false), messaging.WithUpdateEmailHtml(false), - messaging.WithUpdateEmailCc([]interface{}{}), - messaging.WithUpdateEmailBcc([]interface{}{}), + messaging.WithUpdateEmailCc([]string{}), + messaging.WithUpdateEmailBcc([]string{}), messaging.WithUpdateEmailScheduledAt("2020-10-15T06:38:00.000+00:00"), - messaging.WithUpdateEmailAttachments([]interface{}{}), + messaging.WithUpdateEmailAttachments([]string{}), ) ``` diff --git a/docs/examples/messaging/update-push.md b/docs/examples/messaging/update-push.md index 3935091f..52276632 100644 --- a/docs/examples/messaging/update-push.md +++ b/docs/examples/messaging/update-push.md @@ -17,9 +17,9 @@ service := messaging.New(client) response, error := service.UpdatePush( "<MESSAGE_ID>", - messaging.WithUpdatePushTopics([]interface{}{}), - messaging.WithUpdatePushUsers([]interface{}{}), - messaging.WithUpdatePushTargets([]interface{}{}), + messaging.WithUpdatePushTopics([]string{}), + messaging.WithUpdatePushUsers([]string{}), + messaging.WithUpdatePushTargets([]string{}), messaging.WithUpdatePushTitle("<TITLE>"), messaging.WithUpdatePushBody("<BODY>"), messaging.WithUpdatePushData(map[string]interface{}{}), diff --git a/docs/examples/messaging/update-sms.md b/docs/examples/messaging/update-sms.md index 844cedab..066d9ae0 100644 --- a/docs/examples/messaging/update-sms.md +++ b/docs/examples/messaging/update-sms.md @@ -17,9 +17,9 @@ service := messaging.New(client) response, error := service.UpdateSMS( "<MESSAGE_ID>", - messaging.WithUpdateSMSTopics([]interface{}{}), - messaging.WithUpdateSMSUsers([]interface{}{}), - messaging.WithUpdateSMSTargets([]interface{}{}), + messaging.WithUpdateSMSTopics([]string{}), + messaging.WithUpdateSMSUsers([]string{}), + messaging.WithUpdateSMSTargets([]string{}), messaging.WithUpdateSMSContent("<CONTENT>"), messaging.WithUpdateSMSDraft(false), messaging.WithUpdateSMSScheduledAt("2020-10-15T06:38:00.000+00:00"), diff --git a/docs/examples/messaging/update-topic.md b/docs/examples/messaging/update-topic.md index ce77c46d..109e2658 100644 --- a/docs/examples/messaging/update-topic.md +++ b/docs/examples/messaging/update-topic.md @@ -18,6 +18,6 @@ service := messaging.New(client) response, error := service.UpdateTopic( "<TOPIC_ID>", messaging.WithUpdateTopicName("<NAME>"), - messaging.WithUpdateTopicSubscribe(interface{}{"any"}), + messaging.WithUpdateTopicSubscribe([]string{"any"}), ) ``` diff --git a/docs/examples/organization/create-key.md b/docs/examples/organization/create-key.md index 563d8e8c..667627b6 100644 --- a/docs/examples/organization/create-key.md +++ b/docs/examples/organization/create-key.md @@ -18,7 +18,7 @@ service := organization.New(client) response, error := service.CreateKey( "<KEY_ID>", "<NAME>", - []interface{}{}, + []string{}, organization.WithCreateKeyExpire("2020-10-15T06:38:00.000+00:00"), ) ``` diff --git a/docs/examples/organization/list-keys.md b/docs/examples/organization/list-keys.md index a71a5e8c..50aa6adc 100644 --- a/docs/examples/organization/list-keys.md +++ b/docs/examples/organization/list-keys.md @@ -16,7 +16,7 @@ client := client.New( service := organization.New(client) response, error := service.ListKeys( - organization.WithListKeysQueries([]interface{}{}), + organization.WithListKeysQueries([]string{}), organization.WithListKeysTotal(false), ) ``` diff --git a/docs/examples/organization/list-projects.md b/docs/examples/organization/list-projects.md index 2afc5661..d22173aa 100644 --- a/docs/examples/organization/list-projects.md +++ b/docs/examples/organization/list-projects.md @@ -16,7 +16,7 @@ client := client.New( service := organization.New(client) response, error := service.ListProjects( - organization.WithListProjectsQueries([]interface{}{}), + organization.WithListProjectsQueries([]string{}), organization.WithListProjectsSearch("<SEARCH>"), organization.WithListProjectsTotal(false), ) diff --git a/docs/examples/organization/update-key.md b/docs/examples/organization/update-key.md index 14900926..52794c5e 100644 --- a/docs/examples/organization/update-key.md +++ b/docs/examples/organization/update-key.md @@ -18,7 +18,7 @@ service := organization.New(client) response, error := service.UpdateKey( "<KEY_ID>", "<NAME>", - []interface{}{}, + []string{}, organization.WithUpdateKeyExpire("2020-10-15T06:38:00.000+00:00"), ) ``` diff --git a/docs/examples/presences/list.md b/docs/examples/presences/list.md index cb446714..49bde40f 100644 --- a/docs/examples/presences/list.md +++ b/docs/examples/presences/list.md @@ -16,7 +16,7 @@ client := client.New( service := presences.New(client) response, error := service.List( - presences.WithListQueries([]interface{}{}), + presences.WithListQueries([]string{}), presences.WithListTotal(false), presences.WithListTtl(0), ) diff --git a/docs/examples/presences/update.md b/docs/examples/presences/update.md index da1afc5b..87065188 100644 --- a/docs/examples/presences/update.md +++ b/docs/examples/presences/update.md @@ -21,7 +21,7 @@ response, error := service.Update( presences.WithUpdateStatus("<STATUS>"), presences.WithUpdateExpiresAt("2020-10-15T06:38:00.000+00:00"), presences.WithUpdateMetadata(map[string]interface{}{}), - presences.WithUpdatePermissions(interface{}{"read("any")"}), + presences.WithUpdatePermissions([]string{"read("any")"}), presences.WithUpdatePurge(false), ) ``` diff --git a/docs/examples/presences/upsert.md b/docs/examples/presences/upsert.md index 4d275557..7da7a9a7 100644 --- a/docs/examples/presences/upsert.md +++ b/docs/examples/presences/upsert.md @@ -19,7 +19,7 @@ response, error := service.Upsert( "<PRESENCE_ID>", "<USER_ID>", "<STATUS>", - presences.WithUpsertPermissions(interface{}{"read("any")"}), + presences.WithUpsertPermissions([]string{"read("any")"}), presences.WithUpsertExpiresAt("2020-10-15T06:38:00.000+00:00"), presences.WithUpsertMetadata(map[string]interface{}{}), ) diff --git a/docs/examples/project/create-ephemeral-key.md b/docs/examples/project/create-ephemeral-key.md index 8ad72acc..55d19218 100644 --- a/docs/examples/project/create-ephemeral-key.md +++ b/docs/examples/project/create-ephemeral-key.md @@ -16,7 +16,7 @@ client := client.New( service := project.New(client) response, error := service.CreateEphemeralKey( - []interface{}{}, + []string{}, 600, ) ``` diff --git a/docs/examples/project/create-key.md b/docs/examples/project/create-key.md index 618b90c3..595bd1db 100644 --- a/docs/examples/project/create-key.md +++ b/docs/examples/project/create-key.md @@ -18,7 +18,7 @@ service := project.New(client) response, error := service.CreateKey( "<KEY_ID>", "<NAME>", - []interface{}{}, + []string{}, project.WithCreateKeyExpire("2020-10-15T06:38:00.000+00:00"), ) ``` diff --git a/docs/examples/project/create-smtp-test.md b/docs/examples/project/create-smtp-test.md index 8faa0900..d0a68420 100644 --- a/docs/examples/project/create-smtp-test.md +++ b/docs/examples/project/create-smtp-test.md @@ -16,6 +16,6 @@ client := client.New( service := project.New(client) response, error := service.CreateSMTPTest( - []interface{}{}, + []string{}, ) ``` diff --git a/docs/examples/project/list-email-templates.md b/docs/examples/project/list-email-templates.md index 9f429ce5..2cdce744 100644 --- a/docs/examples/project/list-email-templates.md +++ b/docs/examples/project/list-email-templates.md @@ -16,7 +16,7 @@ client := client.New( service := project.New(client) response, error := service.ListEmailTemplates( - project.WithListEmailTemplatesQueries([]interface{}{}), + project.WithListEmailTemplatesQueries([]string{}), project.WithListEmailTemplatesTotal(false), ) ``` diff --git a/docs/examples/project/list-keys.md b/docs/examples/project/list-keys.md index 8741ec23..19072e66 100644 --- a/docs/examples/project/list-keys.md +++ b/docs/examples/project/list-keys.md @@ -16,7 +16,7 @@ client := client.New( service := project.New(client) response, error := service.ListKeys( - project.WithListKeysQueries([]interface{}{}), + project.WithListKeysQueries([]string{}), project.WithListKeysTotal(false), ) ``` diff --git a/docs/examples/project/list-mock-phones.md b/docs/examples/project/list-mock-phones.md index 68f5a04d..80bbc669 100644 --- a/docs/examples/project/list-mock-phones.md +++ b/docs/examples/project/list-mock-phones.md @@ -16,7 +16,7 @@ client := client.New( service := project.New(client) response, error := service.ListMockPhones( - project.WithListMockPhonesQueries([]interface{}{}), + project.WithListMockPhonesQueries([]string{}), project.WithListMockPhonesTotal(false), ) ``` diff --git a/docs/examples/project/list-o-auth-2-providers.md b/docs/examples/project/list-o-auth-2-providers.md index c0e7647a..7c4f287f 100644 --- a/docs/examples/project/list-o-auth-2-providers.md +++ b/docs/examples/project/list-o-auth-2-providers.md @@ -16,7 +16,7 @@ client := client.New( service := project.New(client) response, error := service.ListOAuth2Providers( - project.WithListOAuth2ProvidersQueries([]interface{}{}), + project.WithListOAuth2ProvidersQueries([]string{}), project.WithListOAuth2ProvidersTotal(false), ) ``` diff --git a/docs/examples/project/list-platforms.md b/docs/examples/project/list-platforms.md index ee00038b..fd2295e0 100644 --- a/docs/examples/project/list-platforms.md +++ b/docs/examples/project/list-platforms.md @@ -16,7 +16,7 @@ client := client.New( service := project.New(client) response, error := service.ListPlatforms( - project.WithListPlatformsQueries([]interface{}{}), + project.WithListPlatformsQueries([]string{}), project.WithListPlatformsTotal(false), ) ``` diff --git a/docs/examples/project/list-policies.md b/docs/examples/project/list-policies.md index 57cfa1a7..eb96e217 100644 --- a/docs/examples/project/list-policies.md +++ b/docs/examples/project/list-policies.md @@ -16,7 +16,7 @@ client := client.New( service := project.New(client) response, error := service.ListPolicies( - project.WithListPoliciesQueries([]interface{}{}), + project.WithListPoliciesQueries([]string{}), project.WithListPoliciesTotal(false), ) ``` diff --git a/docs/examples/project/list-variables.md b/docs/examples/project/list-variables.md index 19cec045..2cd1929d 100644 --- a/docs/examples/project/list-variables.md +++ b/docs/examples/project/list-variables.md @@ -16,7 +16,7 @@ client := client.New( service := project.New(client) response, error := service.ListVariables( - project.WithListVariablesQueries([]interface{}{}), + project.WithListVariablesQueries([]string{}), project.WithListVariablesTotal(false), ) ``` diff --git a/docs/examples/project/update-key.md b/docs/examples/project/update-key.md index 171bece1..d476714d 100644 --- a/docs/examples/project/update-key.md +++ b/docs/examples/project/update-key.md @@ -18,7 +18,7 @@ service := project.New(client) response, error := service.UpdateKey( "<KEY_ID>", "<NAME>", - []interface{}{}, + []string{}, project.WithUpdateKeyExpire("2020-10-15T06:38:00.000+00:00"), ) ``` diff --git a/docs/examples/project/update-labels.md b/docs/examples/project/update-labels.md index 15a25186..4275c477 100644 --- a/docs/examples/project/update-labels.md +++ b/docs/examples/project/update-labels.md @@ -16,6 +16,6 @@ client := client.New( service := project.New(client) response, error := service.UpdateLabels( - []interface{}{}, + []string{}, ) ``` diff --git a/docs/examples/project/update-o-auth-2-google.md b/docs/examples/project/update-o-auth-2-google.md index 9bdbefa8..f56254c8 100644 --- a/docs/examples/project/update-o-auth-2-google.md +++ b/docs/examples/project/update-o-auth-2-google.md @@ -18,7 +18,7 @@ service := project.New(client) response, error := service.UpdateOAuth2Google( project.WithUpdateOAuth2GoogleClientId("<CLIENT_ID>"), project.WithUpdateOAuth2GoogleClientSecret("<CLIENT_SECRET>"), - project.WithUpdateOAuth2GooglePrompt([]interface{}{}), + project.WithUpdateOAuth2GooglePrompt([]string{}), project.WithUpdateOAuth2GoogleEnabled(false), ) ``` diff --git a/docs/examples/project/update-o-auth-2-server.md b/docs/examples/project/update-o-auth-2-server.md index ae2ad907..07af5f95 100644 --- a/docs/examples/project/update-o-auth-2-server.md +++ b/docs/examples/project/update-o-auth-2-server.md @@ -18,7 +18,7 @@ service := project.New(client) response, error := service.UpdateOAuth2Server( false, "https://example.com", - project.WithUpdateOAuth2ServerScopes([]interface{}{}), + project.WithUpdateOAuth2ServerScopes([]string{}), project.WithUpdateOAuth2ServerAccessTokenDuration(60), project.WithUpdateOAuth2ServerRefreshTokenDuration(60), project.WithUpdateOAuth2ServerPublicAccessTokenDuration(60), diff --git a/docs/examples/proxy/list-rules.md b/docs/examples/proxy/list-rules.md index c3f75eb0..b1790d33 100644 --- a/docs/examples/proxy/list-rules.md +++ b/docs/examples/proxy/list-rules.md @@ -16,7 +16,7 @@ client := client.New( service := proxy.New(client) response, error := service.ListRules( - proxy.WithListRulesQueries([]interface{}{}), + proxy.WithListRulesQueries([]string{}), proxy.WithListRulesTotal(false), ) ``` diff --git a/docs/examples/sites/create.md b/docs/examples/sites/create.md index fdc2ae08..a3d1891e 100644 --- a/docs/examples/sites/create.md +++ b/docs/examples/sites/create.md @@ -34,8 +34,8 @@ response, error := service.Create( sites.WithCreateProviderBranch("<PROVIDER_BRANCH>"), sites.WithCreateProviderSilentMode(false), sites.WithCreateProviderRootDirectory("<PROVIDER_ROOT_DIRECTORY>"), - sites.WithCreateProviderBranches([]interface{}{}), - sites.WithCreateProviderPaths([]interface{}{}), + sites.WithCreateProviderBranches([]string{}), + sites.WithCreateProviderPaths([]string{}), sites.WithCreateBuildSpecification(""), sites.WithCreateRuntimeSpecification(""), sites.WithCreateDeploymentRetention(0), diff --git a/docs/examples/sites/list-deployments.md b/docs/examples/sites/list-deployments.md index e95dad13..123f8201 100644 --- a/docs/examples/sites/list-deployments.md +++ b/docs/examples/sites/list-deployments.md @@ -17,7 +17,7 @@ service := sites.New(client) response, error := service.ListDeployments( "<SITE_ID>", - sites.WithListDeploymentsQueries([]interface{}{}), + sites.WithListDeploymentsQueries([]string{}), sites.WithListDeploymentsSearch("<SEARCH>"), sites.WithListDeploymentsTotal(false), ) diff --git a/docs/examples/sites/list-logs.md b/docs/examples/sites/list-logs.md index 8e6d1930..1c67a0c1 100644 --- a/docs/examples/sites/list-logs.md +++ b/docs/examples/sites/list-logs.md @@ -17,7 +17,7 @@ service := sites.New(client) response, error := service.ListLogs( "<SITE_ID>", - sites.WithListLogsQueries([]interface{}{}), + sites.WithListLogsQueries([]string{}), sites.WithListLogsTotal(false), ) ``` diff --git a/docs/examples/sites/list-variables.md b/docs/examples/sites/list-variables.md index 4fb76993..a5a0fa06 100644 --- a/docs/examples/sites/list-variables.md +++ b/docs/examples/sites/list-variables.md @@ -17,7 +17,7 @@ service := sites.New(client) response, error := service.ListVariables( "<SITE_ID>", - sites.WithListVariablesQueries([]interface{}{}), + sites.WithListVariablesQueries([]string{}), sites.WithListVariablesTotal(false), ) ``` diff --git a/docs/examples/sites/list.md b/docs/examples/sites/list.md index ff1ae657..26bb4494 100644 --- a/docs/examples/sites/list.md +++ b/docs/examples/sites/list.md @@ -16,7 +16,7 @@ client := client.New( service := sites.New(client) response, error := service.List( - sites.WithListQueries([]interface{}{}), + sites.WithListQueries([]string{}), sites.WithListSearch("<SEARCH>"), sites.WithListTotal(false), ) diff --git a/docs/examples/sites/update.md b/docs/examples/sites/update.md index ea24771f..54f1d344 100644 --- a/docs/examples/sites/update.md +++ b/docs/examples/sites/update.md @@ -34,8 +34,8 @@ response, error := service.Update( sites.WithUpdateProviderBranch("<PROVIDER_BRANCH>"), sites.WithUpdateProviderSilentMode(false), sites.WithUpdateProviderRootDirectory("<PROVIDER_ROOT_DIRECTORY>"), - sites.WithUpdateProviderBranches([]interface{}{}), - sites.WithUpdateProviderPaths([]interface{}{}), + sites.WithUpdateProviderBranches([]string{}), + sites.WithUpdateProviderPaths([]string{}), sites.WithUpdateBuildSpecification(""), sites.WithUpdateRuntimeSpecification(""), sites.WithUpdateDeploymentRetention(0), diff --git a/docs/examples/storage/create-bucket.md b/docs/examples/storage/create-bucket.md index d9e1bd1e..14118bcb 100644 --- a/docs/examples/storage/create-bucket.md +++ b/docs/examples/storage/create-bucket.md @@ -18,11 +18,11 @@ service := storage.New(client) response, error := service.CreateBucket( "<BUCKET_ID>", "<NAME>", - storage.WithCreateBucketPermissions(interface{}{"read("any")"}), + storage.WithCreateBucketPermissions([]string{"read("any")"}), storage.WithCreateBucketFileSecurity(false), storage.WithCreateBucketEnabled(false), storage.WithCreateBucketMaximumFileSize(1), - storage.WithCreateBucketAllowedFileExtensions([]interface{}{}), + storage.WithCreateBucketAllowedFileExtensions([]string{}), storage.WithCreateBucketCompression("none"), storage.WithCreateBucketEncryption(false), storage.WithCreateBucketAntivirus(false), diff --git a/docs/examples/storage/create-file.md b/docs/examples/storage/create-file.md index 3cd3c79a..8dc06528 100644 --- a/docs/examples/storage/create-file.md +++ b/docs/examples/storage/create-file.md @@ -19,6 +19,6 @@ response, error := service.CreateFile( "<BUCKET_ID>", "<FILE_ID>", file.NewInputFile("/path/to/file.png", "file.png"), - storage.WithCreateFilePermissions(interface{}{"read("any")"}), + storage.WithCreateFilePermissions([]string{"read("any")"}), ) ``` diff --git a/docs/examples/storage/list-buckets.md b/docs/examples/storage/list-buckets.md index c113e9e5..ef80c096 100644 --- a/docs/examples/storage/list-buckets.md +++ b/docs/examples/storage/list-buckets.md @@ -16,7 +16,7 @@ client := client.New( service := storage.New(client) response, error := service.ListBuckets( - storage.WithListBucketsQueries([]interface{}{}), + storage.WithListBucketsQueries([]string{}), storage.WithListBucketsSearch("<SEARCH>"), storage.WithListBucketsTotal(false), ) diff --git a/docs/examples/storage/list-files.md b/docs/examples/storage/list-files.md index 12adb72d..563d5ff3 100644 --- a/docs/examples/storage/list-files.md +++ b/docs/examples/storage/list-files.md @@ -17,7 +17,7 @@ service := storage.New(client) response, error := service.ListFiles( "<BUCKET_ID>", - storage.WithListFilesQueries([]interface{}{}), + storage.WithListFilesQueries([]string{}), storage.WithListFilesSearch("<SEARCH>"), storage.WithListFilesTotal(false), ) diff --git a/docs/examples/storage/update-bucket.md b/docs/examples/storage/update-bucket.md index b29f2a83..1134db6f 100644 --- a/docs/examples/storage/update-bucket.md +++ b/docs/examples/storage/update-bucket.md @@ -18,11 +18,11 @@ service := storage.New(client) response, error := service.UpdateBucket( "<BUCKET_ID>", "<NAME>", - storage.WithUpdateBucketPermissions(interface{}{"read("any")"}), + storage.WithUpdateBucketPermissions([]string{"read("any")"}), storage.WithUpdateBucketFileSecurity(false), storage.WithUpdateBucketEnabled(false), storage.WithUpdateBucketMaximumFileSize(1), - storage.WithUpdateBucketAllowedFileExtensions([]interface{}{}), + storage.WithUpdateBucketAllowedFileExtensions([]string{}), storage.WithUpdateBucketCompression("none"), storage.WithUpdateBucketEncryption(false), storage.WithUpdateBucketAntivirus(false), diff --git a/docs/examples/storage/update-file.md b/docs/examples/storage/update-file.md index e342d0e6..43901c52 100644 --- a/docs/examples/storage/update-file.md +++ b/docs/examples/storage/update-file.md @@ -19,6 +19,6 @@ response, error := service.UpdateFile( "<BUCKET_ID>", "<FILE_ID>", storage.WithUpdateFileName("<NAME>"), - storage.WithUpdateFilePermissions(interface{}{"read("any")"}), + storage.WithUpdateFilePermissions([]string{"read("any")"}), ) ``` diff --git a/docs/examples/tablesdb/create-enum-column.md b/docs/examples/tablesdb/create-enum-column.md index db2179be..d665f461 100644 --- a/docs/examples/tablesdb/create-enum-column.md +++ b/docs/examples/tablesdb/create-enum-column.md @@ -19,7 +19,7 @@ response, error := service.CreateEnumColumn( "<DATABASE_ID>", "<TABLE_ID>", "", - []interface{}{}, + []string{}, false, tablesdb.WithCreateEnumColumnDefault("<DEFAULT>"), tablesdb.WithCreateEnumColumnArray(false), diff --git a/docs/examples/tablesdb/create-index.md b/docs/examples/tablesdb/create-index.md index 8841da70..387f6621 100644 --- a/docs/examples/tablesdb/create-index.md +++ b/docs/examples/tablesdb/create-index.md @@ -20,8 +20,8 @@ response, error := service.CreateIndex( "<TABLE_ID>", "", "key", - []interface{}{}, - tablesdb.WithCreateIndexOrders([]interface{}{}), - tablesdb.WithCreateIndexLengths([]interface{}{}), + []string{}, + tablesdb.WithCreateIndexOrders([]string{}), + tablesdb.WithCreateIndexLengths([]int{}), ) ``` diff --git a/docs/examples/tablesdb/create-line-column.md b/docs/examples/tablesdb/create-line-column.md index bde6dee0..ec15a1ed 100644 --- a/docs/examples/tablesdb/create-line-column.md +++ b/docs/examples/tablesdb/create-line-column.md @@ -20,6 +20,6 @@ response, error := service.CreateLineColumn( "<TABLE_ID>", "", false, - tablesdb.WithCreateLineColumnDefault(interface{}{[1, 2], [3, 4], [5, 6]}), + tablesdb.WithCreateLineColumnDefault([]interface{}{[1, 2], [3, 4], [5, 6]}), ) ``` diff --git a/docs/examples/tablesdb/create-operations.md b/docs/examples/tablesdb/create-operations.md index 61893af9..d3811259 100644 --- a/docs/examples/tablesdb/create-operations.md +++ b/docs/examples/tablesdb/create-operations.md @@ -17,7 +17,7 @@ service := tablesdb.New(client) response, error := service.CreateOperations( "<TRANSACTION_ID>", - tablesdb.WithCreateOperationsOperations(interface{}{ + tablesdb.WithCreateOperationsOperations([]interface{}{ { "action": "create", "databaseId": "<DATABASE_ID>", diff --git a/docs/examples/tablesdb/create-point-column.md b/docs/examples/tablesdb/create-point-column.md index ad1a18dc..18c1c62f 100644 --- a/docs/examples/tablesdb/create-point-column.md +++ b/docs/examples/tablesdb/create-point-column.md @@ -20,6 +20,6 @@ response, error := service.CreatePointColumn( "<TABLE_ID>", "", false, - tablesdb.WithCreatePointColumnDefault(interface{}{1, 2}), + tablesdb.WithCreatePointColumnDefault([]interface{}{1, 2}), ) ``` diff --git a/docs/examples/tablesdb/create-polygon-column.md b/docs/examples/tablesdb/create-polygon-column.md index 259c5690..305a8403 100644 --- a/docs/examples/tablesdb/create-polygon-column.md +++ b/docs/examples/tablesdb/create-polygon-column.md @@ -20,6 +20,6 @@ response, error := service.CreatePolygonColumn( "<TABLE_ID>", "", false, - tablesdb.WithCreatePolygonColumnDefault(interface{}{[[1, 2], [3, 4], [5, 6], [1, 2]]}), + tablesdb.WithCreatePolygonColumnDefault([]interface{}{[[1, 2], [3, 4], [5, 6], [1, 2]]}), ) ``` diff --git a/docs/examples/tablesdb/create-row.md b/docs/examples/tablesdb/create-row.md index 753e99d7..13280ce5 100644 --- a/docs/examples/tablesdb/create-row.md +++ b/docs/examples/tablesdb/create-row.md @@ -26,7 +26,7 @@ response, error := service.CreateRow( "age": 30, "isAdmin": false }, - tablesdb.WithCreateRowPermissions(interface{}{"read("any")"}), + tablesdb.WithCreateRowPermissions([]string{"read("any")"}), tablesdb.WithCreateRowTransactionId("<TRANSACTION_ID>"), ) ``` diff --git a/docs/examples/tablesdb/create-table.md b/docs/examples/tablesdb/create-table.md index ed22c608..576d280e 100644 --- a/docs/examples/tablesdb/create-table.md +++ b/docs/examples/tablesdb/create-table.md @@ -19,7 +19,7 @@ response, error := service.CreateTable( "<DATABASE_ID>", "<TABLE_ID>", "<NAME>", - tablesdb.WithCreateTablePermissions(interface{}{"read("any")"}), + tablesdb.WithCreateTablePermissions([]string{"read("any")"}), tablesdb.WithCreateTableRowSecurity(false), tablesdb.WithCreateTableEnabled(false), tablesdb.WithCreateTableColumns([]interface{}{}), diff --git a/docs/examples/tablesdb/delete-rows.md b/docs/examples/tablesdb/delete-rows.md index aa8c65a1..9f094e51 100644 --- a/docs/examples/tablesdb/delete-rows.md +++ b/docs/examples/tablesdb/delete-rows.md @@ -18,7 +18,7 @@ service := tablesdb.New(client) response, error := service.DeleteRows( "<DATABASE_ID>", "<TABLE_ID>", - tablesdb.WithDeleteRowsQueries([]interface{}{}), + tablesdb.WithDeleteRowsQueries([]string{}), tablesdb.WithDeleteRowsTransactionId("<TRANSACTION_ID>"), ) ``` diff --git a/docs/examples/tablesdb/get-row.md b/docs/examples/tablesdb/get-row.md index acd16691..cc3c3b8a 100644 --- a/docs/examples/tablesdb/get-row.md +++ b/docs/examples/tablesdb/get-row.md @@ -19,7 +19,7 @@ response, error := service.GetRow( "<DATABASE_ID>", "<TABLE_ID>", "<ROW_ID>", - tablesdb.WithGetRowQueries([]interface{}{}), + tablesdb.WithGetRowQueries([]string{}), tablesdb.WithGetRowTransactionId("<TRANSACTION_ID>"), ) ``` diff --git a/docs/examples/tablesdb/list-columns.md b/docs/examples/tablesdb/list-columns.md index ae35052d..4377fe62 100644 --- a/docs/examples/tablesdb/list-columns.md +++ b/docs/examples/tablesdb/list-columns.md @@ -18,7 +18,7 @@ service := tablesdb.New(client) response, error := service.ListColumns( "<DATABASE_ID>", "<TABLE_ID>", - tablesdb.WithListColumnsQueries([]interface{}{}), + tablesdb.WithListColumnsQueries([]string{}), tablesdb.WithListColumnsTotal(false), ) ``` diff --git a/docs/examples/tablesdb/list-indexes.md b/docs/examples/tablesdb/list-indexes.md index 2cbe8be8..c97a33a5 100644 --- a/docs/examples/tablesdb/list-indexes.md +++ b/docs/examples/tablesdb/list-indexes.md @@ -18,7 +18,7 @@ service := tablesdb.New(client) response, error := service.ListIndexes( "<DATABASE_ID>", "<TABLE_ID>", - tablesdb.WithListIndexesQueries([]interface{}{}), + tablesdb.WithListIndexesQueries([]string{}), tablesdb.WithListIndexesTotal(false), ) ``` diff --git a/docs/examples/tablesdb/list-rows.md b/docs/examples/tablesdb/list-rows.md index fa953d7d..f15b10be 100644 --- a/docs/examples/tablesdb/list-rows.md +++ b/docs/examples/tablesdb/list-rows.md @@ -18,7 +18,7 @@ service := tablesdb.New(client) response, error := service.ListRows( "<DATABASE_ID>", "<TABLE_ID>", - tablesdb.WithListRowsQueries([]interface{}{}), + tablesdb.WithListRowsQueries([]string{}), tablesdb.WithListRowsTransactionId("<TRANSACTION_ID>"), tablesdb.WithListRowsTotal(false), tablesdb.WithListRowsTtl(0), diff --git a/docs/examples/tablesdb/list-tables.md b/docs/examples/tablesdb/list-tables.md index 8f1e0dd0..d36e3c2e 100644 --- a/docs/examples/tablesdb/list-tables.md +++ b/docs/examples/tablesdb/list-tables.md @@ -17,7 +17,7 @@ service := tablesdb.New(client) response, error := service.ListTables( "<DATABASE_ID>", - tablesdb.WithListTablesQueries([]interface{}{}), + tablesdb.WithListTablesQueries([]string{}), tablesdb.WithListTablesSearch("<SEARCH>"), tablesdb.WithListTablesTotal(false), ) diff --git a/docs/examples/tablesdb/list-transactions.md b/docs/examples/tablesdb/list-transactions.md index dced89ff..d1be6ee5 100644 --- a/docs/examples/tablesdb/list-transactions.md +++ b/docs/examples/tablesdb/list-transactions.md @@ -16,6 +16,6 @@ client := client.New( service := tablesdb.New(client) response, error := service.ListTransactions( - tablesdb.WithListTransactionsQueries([]interface{}{}), + tablesdb.WithListTransactionsQueries([]string{}), ) ``` diff --git a/docs/examples/tablesdb/list.md b/docs/examples/tablesdb/list.md index 75e6880f..886b6069 100644 --- a/docs/examples/tablesdb/list.md +++ b/docs/examples/tablesdb/list.md @@ -16,7 +16,7 @@ client := client.New( service := tablesdb.New(client) response, error := service.List( - tablesdb.WithListQueries([]interface{}{}), + tablesdb.WithListQueries([]string{}), tablesdb.WithListSearch("<SEARCH>"), tablesdb.WithListTotal(false), ) diff --git a/docs/examples/tablesdb/update-enum-column.md b/docs/examples/tablesdb/update-enum-column.md index 8a54362b..cf3c2f3e 100644 --- a/docs/examples/tablesdb/update-enum-column.md +++ b/docs/examples/tablesdb/update-enum-column.md @@ -19,7 +19,7 @@ response, error := service.UpdateEnumColumn( "<DATABASE_ID>", "<TABLE_ID>", "", - []interface{}{}, + []string{}, false, "<DEFAULT>", tablesdb.WithUpdateEnumColumnNewKey(""), diff --git a/docs/examples/tablesdb/update-line-column.md b/docs/examples/tablesdb/update-line-column.md index bccb8602..78653fbd 100644 --- a/docs/examples/tablesdb/update-line-column.md +++ b/docs/examples/tablesdb/update-line-column.md @@ -20,7 +20,7 @@ response, error := service.UpdateLineColumn( "<TABLE_ID>", "", false, - tablesdb.WithUpdateLineColumnDefault(interface{}{[1, 2], [3, 4], [5, 6]}), + tablesdb.WithUpdateLineColumnDefault([]interface{}{[1, 2], [3, 4], [5, 6]}), tablesdb.WithUpdateLineColumnNewKey(""), ) ``` diff --git a/docs/examples/tablesdb/update-point-column.md b/docs/examples/tablesdb/update-point-column.md index ad844af4..3b128bd7 100644 --- a/docs/examples/tablesdb/update-point-column.md +++ b/docs/examples/tablesdb/update-point-column.md @@ -20,7 +20,7 @@ response, error := service.UpdatePointColumn( "<TABLE_ID>", "", false, - tablesdb.WithUpdatePointColumnDefault(interface{}{1, 2}), + tablesdb.WithUpdatePointColumnDefault([]interface{}{1, 2}), tablesdb.WithUpdatePointColumnNewKey(""), ) ``` diff --git a/docs/examples/tablesdb/update-polygon-column.md b/docs/examples/tablesdb/update-polygon-column.md index a8e5bcfb..d0c81adb 100644 --- a/docs/examples/tablesdb/update-polygon-column.md +++ b/docs/examples/tablesdb/update-polygon-column.md @@ -20,7 +20,7 @@ response, error := service.UpdatePolygonColumn( "<TABLE_ID>", "", false, - tablesdb.WithUpdatePolygonColumnDefault(interface{}{[[1, 2], [3, 4], [5, 6], [1, 2]]}), + tablesdb.WithUpdatePolygonColumnDefault([]interface{}{[[1, 2], [3, 4], [5, 6], [1, 2]]}), tablesdb.WithUpdatePolygonColumnNewKey(""), ) ``` diff --git a/docs/examples/tablesdb/update-row.md b/docs/examples/tablesdb/update-row.md index db27fcbf..9bad72b6 100644 --- a/docs/examples/tablesdb/update-row.md +++ b/docs/examples/tablesdb/update-row.md @@ -26,7 +26,7 @@ response, error := service.UpdateRow( "age": 33, "isAdmin": false }), - tablesdb.WithUpdateRowPermissions(interface{}{"read("any")"}), + tablesdb.WithUpdateRowPermissions([]string{"read("any")"}), tablesdb.WithUpdateRowTransactionId("<TRANSACTION_ID>"), ) ``` diff --git a/docs/examples/tablesdb/update-rows.md b/docs/examples/tablesdb/update-rows.md index 7cdba14a..2ac9bddb 100644 --- a/docs/examples/tablesdb/update-rows.md +++ b/docs/examples/tablesdb/update-rows.md @@ -25,7 +25,7 @@ response, error := service.UpdateRows( "age": 33, "isAdmin": false }), - tablesdb.WithUpdateRowsQueries([]interface{}{}), + tablesdb.WithUpdateRowsQueries([]string{}), tablesdb.WithUpdateRowsTransactionId("<TRANSACTION_ID>"), ) ``` diff --git a/docs/examples/tablesdb/update-table.md b/docs/examples/tablesdb/update-table.md index 4ed06f51..08129181 100644 --- a/docs/examples/tablesdb/update-table.md +++ b/docs/examples/tablesdb/update-table.md @@ -19,7 +19,7 @@ response, error := service.UpdateTable( "<DATABASE_ID>", "<TABLE_ID>", tablesdb.WithUpdateTableName("<NAME>"), - tablesdb.WithUpdateTablePermissions(interface{}{"read("any")"}), + tablesdb.WithUpdateTablePermissions([]string{"read("any")"}), tablesdb.WithUpdateTableRowSecurity(false), tablesdb.WithUpdateTableEnabled(false), tablesdb.WithUpdateTablePurge(false), diff --git a/docs/examples/tablesdb/upsert-row.md b/docs/examples/tablesdb/upsert-row.md index 27e278d0..af6f4e2d 100644 --- a/docs/examples/tablesdb/upsert-row.md +++ b/docs/examples/tablesdb/upsert-row.md @@ -26,7 +26,7 @@ response, error := service.UpsertRow( "age": 33, "isAdmin": false }), - tablesdb.WithUpsertRowPermissions(interface{}{"read("any")"}), + tablesdb.WithUpsertRowPermissions([]string{"read("any")"}), tablesdb.WithUpsertRowTransactionId("<TRANSACTION_ID>"), ) ``` diff --git a/docs/examples/teams/create-membership.md b/docs/examples/teams/create-membership.md index bdce92bc..c6ac8928 100644 --- a/docs/examples/teams/create-membership.md +++ b/docs/examples/teams/create-membership.md @@ -17,7 +17,7 @@ service := teams.New(client) response, error := service.CreateMembership( "<TEAM_ID>", - []interface{}{}, + []string{}, teams.WithCreateMembershipEmail("email@example.com"), teams.WithCreateMembershipUserId("<USER_ID>"), teams.WithCreateMembershipPhone("+12065550100"), diff --git a/docs/examples/teams/create.md b/docs/examples/teams/create.md index adbbd6c3..d24a5ed3 100644 --- a/docs/examples/teams/create.md +++ b/docs/examples/teams/create.md @@ -18,6 +18,6 @@ service := teams.New(client) response, error := service.Create( "<TEAM_ID>", "<NAME>", - teams.WithCreateRoles([]interface{}{}), + teams.WithCreateRoles([]string{}), ) ``` diff --git a/docs/examples/teams/list-memberships.md b/docs/examples/teams/list-memberships.md index 98f55dfe..a5fce437 100644 --- a/docs/examples/teams/list-memberships.md +++ b/docs/examples/teams/list-memberships.md @@ -17,7 +17,7 @@ service := teams.New(client) response, error := service.ListMemberships( "<TEAM_ID>", - teams.WithListMembershipsQueries([]interface{}{}), + teams.WithListMembershipsQueries([]string{}), teams.WithListMembershipsSearch("<SEARCH>"), teams.WithListMembershipsTotal(false), ) diff --git a/docs/examples/teams/list.md b/docs/examples/teams/list.md index 04738396..394f7f76 100644 --- a/docs/examples/teams/list.md +++ b/docs/examples/teams/list.md @@ -16,7 +16,7 @@ client := client.New( service := teams.New(client) response, error := service.List( - teams.WithListQueries([]interface{}{}), + teams.WithListQueries([]string{}), teams.WithListSearch("<SEARCH>"), teams.WithListTotal(false), ) diff --git a/docs/examples/teams/update-membership.md b/docs/examples/teams/update-membership.md index 7f235317..71bd6b80 100644 --- a/docs/examples/teams/update-membership.md +++ b/docs/examples/teams/update-membership.md @@ -18,6 +18,6 @@ service := teams.New(client) response, error := service.UpdateMembership( "<TEAM_ID>", "<MEMBERSHIP_ID>", - []interface{}{}, + []string{}, ) ``` diff --git a/docs/examples/tokens/list.md b/docs/examples/tokens/list.md index 7f002f1c..88f5b9b1 100644 --- a/docs/examples/tokens/list.md +++ b/docs/examples/tokens/list.md @@ -18,7 +18,7 @@ service := tokens.New(client) response, error := service.List( "<BUCKET_ID>", "<FILE_ID>", - tokens.WithListQueries([]interface{}{}), + tokens.WithListQueries([]string{}), tokens.WithListTotal(false), ) ``` diff --git a/docs/examples/usage/list-events.md b/docs/examples/usage/list-events.md index c366ad34..f685606e 100644 --- a/docs/examples/usage/list-events.md +++ b/docs/examples/usage/list-events.md @@ -16,7 +16,7 @@ client := client.New( service := usage.New(client) response, error := service.ListEvents( - usage.WithListEventsQueries([]interface{}{}), + usage.WithListEventsQueries([]string{}), usage.WithListEventsTotal(false), ) ``` diff --git a/docs/examples/usage/list-gauges.md b/docs/examples/usage/list-gauges.md index 1b396855..a4d47e18 100644 --- a/docs/examples/usage/list-gauges.md +++ b/docs/examples/usage/list-gauges.md @@ -16,7 +16,7 @@ client := client.New( service := usage.New(client) response, error := service.ListGauges( - usage.WithListGaugesQueries([]interface{}{}), + usage.WithListGaugesQueries([]string{}), usage.WithListGaugesTotal(false), ) ``` diff --git a/docs/examples/users/list-identities.md b/docs/examples/users/list-identities.md index 7fa6bca9..39c2f9a4 100644 --- a/docs/examples/users/list-identities.md +++ b/docs/examples/users/list-identities.md @@ -16,7 +16,7 @@ client := client.New( service := users.New(client) response, error := service.ListIdentities( - users.WithListIdentitiesQueries([]interface{}{}), + users.WithListIdentitiesQueries([]string{}), users.WithListIdentitiesSearch("<SEARCH>"), users.WithListIdentitiesTotal(false), ) diff --git a/docs/examples/users/list-logs.md b/docs/examples/users/list-logs.md index 4755c474..f3f39a8f 100644 --- a/docs/examples/users/list-logs.md +++ b/docs/examples/users/list-logs.md @@ -17,7 +17,7 @@ service := users.New(client) response, error := service.ListLogs( "<USER_ID>", - users.WithListLogsQueries([]interface{}{}), + users.WithListLogsQueries([]string{}), users.WithListLogsTotal(false), ) ``` diff --git a/docs/examples/users/list-memberships.md b/docs/examples/users/list-memberships.md index daa4c734..f3d31349 100644 --- a/docs/examples/users/list-memberships.md +++ b/docs/examples/users/list-memberships.md @@ -17,7 +17,7 @@ service := users.New(client) response, error := service.ListMemberships( "<USER_ID>", - users.WithListMembershipsQueries([]interface{}{}), + users.WithListMembershipsQueries([]string{}), users.WithListMembershipsSearch("<SEARCH>"), users.WithListMembershipsTotal(false), ) diff --git a/docs/examples/users/list-targets.md b/docs/examples/users/list-targets.md index b7ef2871..db42a08d 100644 --- a/docs/examples/users/list-targets.md +++ b/docs/examples/users/list-targets.md @@ -17,7 +17,7 @@ service := users.New(client) response, error := service.ListTargets( "<USER_ID>", - users.WithListTargetsQueries([]interface{}{}), + users.WithListTargetsQueries([]string{}), users.WithListTargetsTotal(false), ) ``` diff --git a/docs/examples/users/list.md b/docs/examples/users/list.md index 3d14f6ff..33911d75 100644 --- a/docs/examples/users/list.md +++ b/docs/examples/users/list.md @@ -16,7 +16,7 @@ client := client.New( service := users.New(client) response, error := service.List( - users.WithListQueries([]interface{}{}), + users.WithListQueries([]string{}), users.WithListSearch("<SEARCH>"), users.WithListTotal(false), ) diff --git a/docs/examples/users/update-labels.md b/docs/examples/users/update-labels.md index 0f6f55c9..0f8c95d1 100644 --- a/docs/examples/users/update-labels.md +++ b/docs/examples/users/update-labels.md @@ -17,6 +17,6 @@ service := users.New(client) response, error := service.UpdateLabels( "<USER_ID>", - []interface{}{}, + []string{}, ) ``` diff --git a/docs/examples/webhooks/create.md b/docs/examples/webhooks/create.md index 8186e1b4..52e7047e 100644 --- a/docs/examples/webhooks/create.md +++ b/docs/examples/webhooks/create.md @@ -19,7 +19,7 @@ response, error := service.Create( "<WEBHOOK_ID>", "", "<NAME>", - []interface{}{}, + []string{}, webhooks.WithCreateEnabled(false), webhooks.WithCreateTls(false), webhooks.WithCreateAuthUsername("<AUTH_USERNAME>"), diff --git a/docs/examples/webhooks/list.md b/docs/examples/webhooks/list.md index 0ba537cc..a0f97568 100644 --- a/docs/examples/webhooks/list.md +++ b/docs/examples/webhooks/list.md @@ -16,7 +16,7 @@ client := client.New( service := webhooks.New(client) response, error := service.List( - webhooks.WithListQueries([]interface{}{}), + webhooks.WithListQueries([]string{}), webhooks.WithListTotal(false), ) ``` diff --git a/docs/examples/webhooks/update.md b/docs/examples/webhooks/update.md index 2850b853..2e7598d8 100644 --- a/docs/examples/webhooks/update.md +++ b/docs/examples/webhooks/update.md @@ -19,7 +19,7 @@ response, error := service.Update( "<WEBHOOK_ID>", "<NAME>", "", - []interface{}{}, + []string{}, webhooks.WithUpdateEnabled(false), webhooks.WithUpdateTls(false), webhooks.WithUpdateAuthUsername("<AUTH_USERNAME>"),