Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Change Log

## v2.0.0

* [BREAKING] Changed `$sequence` type from `int` to `string` for rows and documents
* Added `NewProject` and `NewWebhooks` client constructors
* Added impersonation helpers `WithImpersonateUserId`, `WithImpersonateUserEmail`, `WithImpersonateUserPhone`
* Added avatar URL helpers: `GetBrowserURL`, `GetCreditCardURL`, `GetFaviconURL`, `GetFlagURL`, `GetImageURL`, `GetInitialsURL`, `GetQRURL`, `GetScreenshotURL`
* Updated README badge to API version 1.9.0

## v1.0.0

* Breaking: Activate parameter was removed from CreateDeployment; use WithCreateDeploymentActivate.
Expand All @@ -8,7 +16,7 @@
* Added: TTL option to list operations for documents and rows.
* Updated: Document and Row sequence comments to reflect sequence IDs.

## 0.17.0
## v0.17.0

* Added new Activities service to the Go SDK with a NewActivities constructor to access Activities endpoints.
* Extended Databases attribute APIs to support encryption: introduced Encrypt option for Longtext, Mediumtext, Text, and Varchar attributes, along with corresponding New/Create option builders (WithCreateLongtextAttributeEncrypt, WithCreateMediumtextAttributeEncrypt, WithCreateTextAttributeEncrypt, WithCreateVarcharAttributeEncrypt) and wiring to send the encrypt parameter when enabled.
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Appwrite Go SDK

![License](https://img.shields.io/github/license/appwrite/sdk-for-go.svg?style=flat-square)
![Version](https://img.shields.io/badge/api%20version-1.8.1-blue.svg?style=flat-square)
![Version](https://img.shields.io/badge/api%20version-1.9.0-blue.svg?style=flat-square)
[![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator)
[![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite)
[![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord)

**This SDK is compatible with Appwrite server version 1.8.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-go/releases).**
**This SDK is compatible with Appwrite server version 1.9.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-go/releases).**

Appwrite is an open-source backend as a service server that abstracts and simplifies complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the Go SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)

Expand Down
35 changes: 35 additions & 0 deletions appwrite/appwrite.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@ import (
"github.com/appwrite/sdk-for-go/health"
"github.com/appwrite/sdk-for-go/locale"
"github.com/appwrite/sdk-for-go/messaging"
"github.com/appwrite/sdk-for-go/project"
"github.com/appwrite/sdk-for-go/sites"
"github.com/appwrite/sdk-for-go/storage"
"github.com/appwrite/sdk-for-go/tablesdb"
"github.com/appwrite/sdk-for-go/teams"
"github.com/appwrite/sdk-for-go/tokens"
"github.com/appwrite/sdk-for-go/users"
"github.com/appwrite/sdk-for-go/webhooks"
)

func NewAccount(clt client.Client) *account.Account {
Expand Down Expand Up @@ -52,6 +54,9 @@ func NewLocale(clt client.Client) *locale.Locale {
func NewMessaging(clt client.Client) *messaging.Messaging {
return messaging.New(clt)
}
func NewProject(clt client.Client) *project.Project {
return project.New(clt)
}
func NewSites(clt client.Client) *sites.Sites {
return sites.New(clt)
}
Expand All @@ -70,6 +75,9 @@ func NewTokens(clt client.Client) *tokens.Tokens {
func NewUsers(clt client.Client) *users.Users {
return users.New(clt)
}
func NewWebhooks(clt client.Client) *webhooks.Webhooks {
return webhooks.New(clt)
}

// NewClient initializes a new Appwrite client with a given timeout
func NewClient(optionalSetters ...client.ClientOption) client.Client {
Expand Down Expand Up @@ -167,3 +175,30 @@ func WithForwardedUserAgent(value string) client.ClientOption {
return nil
}
}
// Helper method to construct NewClient()
//
// 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.Headers["X-Appwrite-Impersonate-User-Id"] = value
return nil
}
}
// Helper method to construct NewClient()
//
// 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.Headers["X-Appwrite-Impersonate-User-Email"] = value
return nil
}
}
// Helper method to construct NewClient()
//
// 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.Headers["X-Appwrite-Impersonate-User-Phone"] = value
return nil
}
}
Loading