From b2cb9ed475a29b00ba5cf688507c3b7f59f072e4 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 19 Feb 2026 10:29:18 +0000 Subject: [PATCH 1/4] regenerate --- CHANGELOG.md | 19 --- README.md | 2 +- activities/activities.go | 111 ++++++++++++++++++ appwrite/appwrite.go | 4 + client/client.go | 4 +- databases/databases.go | 44 +++++++ .../get-event.md} | 8 +- .../list-events.md} | 8 +- .../databases/create-longtext-attribute.md | 1 + .../databases/create-mediumtext-attribute.md | 1 + .../databases/create-text-attribute.md | 1 + .../databases/create-varchar-attribute.md | 1 + .../get-queue-billing-project-aggregation.md | 21 ---- .../get-queue-billing-team-aggregation.md | 21 ---- .../health/get-queue-priority-builds.md | 21 ---- .../tablesdb/create-longtext-column.md | 1 + .../tablesdb/create-mediumtext-column.md | 1 + docs/examples/tablesdb/create-text-column.md | 1 + .../tablesdb/create-varchar-column.md | 1 + models/activity_event.go | 97 +++++++++++++++ models/activity_event_list.go | 35 ++++++ models/attribute_longtext.go | 2 + models/attribute_mediumtext.go | 2 + models/attribute_text.go | 2 + models/attribute_varchar.go | 2 + models/column_longtext.go | 2 + models/column_mediumtext.go | 2 + models/column_text.go | 2 + models/column_varchar.go | 2 + query/query.go | 26 ++++ tablesdb/tables_db.go | 44 +++++++ 31 files changed, 396 insertions(+), 93 deletions(-) create mode 100644 activities/activities.go rename docs/examples/{health/get-queue-threats.md => activities/get-event.md} (61%) rename docs/examples/{health/get-queue-region-manager.md => activities/list-events.md} (60%) delete mode 100644 docs/examples/health/get-queue-billing-project-aggregation.md delete mode 100644 docs/examples/health/get-queue-billing-team-aggregation.md delete mode 100644 docs/examples/health/get-queue-priority-builds.md create mode 100644 models/activity_event.go create mode 100644 models/activity_event_list.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 1210df2d..0cc39564 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,24 +1,5 @@ # Change Log -## v0.17.0 - -* Fix doc examples with proper formatting -* Add support for the new `Backups` service - -## v0.16.0 - -* Added ability to create columns and indexes synchronously while creating a table -* Breaking change: `Output` enum has been removed; use `ImageFormat` instead. -* Add `getQueueAudits` support to `Health` service. -* Add longtext/mediumtext/text/varchar attribute and column helpers to `Databases` and `TablesDB` services. - -## v0.15.0 - -* Rename `VCSDeploymentType` enum to `VCSReferenceType` -* Change `CreateTemplateDeployment` method signature: replace `Version` parameter with `Type` (TemplateReferenceType) and `Reference` parameters -* Add `GetScreenshot` method to `Avatars` service -* Add `Theme`, `Timezone` and `Output` enums - ## v0.14.0 * Add `total` parameter to list queries allowing skipping counting rows in a table for improved performance diff --git a/README.md b/README.md index b4599f4c..8ad82ca3 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ [![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 latest. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-go/releases).** +**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).** 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) diff --git a/activities/activities.go b/activities/activities.go new file mode 100644 index 00000000..e22629e6 --- /dev/null +++ b/activities/activities.go @@ -0,0 +1,111 @@ +package activities + +import ( + "encoding/json" + "errors" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/models" + "strings" +) + +// Activities service +type Activities struct { + client client.Client +} + +func New(clt client.Client) *Activities { + return &Activities{ + client: clt, + } +} + +type ListEventsOptions struct { + Queries string + enabledSetters map[string]bool +} +func (options ListEventsOptions) New() *ListEventsOptions { + options.enabledSetters = map[string]bool{ + "Queries": false, + } + return &options +} +type ListEventsOption func(*ListEventsOptions) +func (srv *Activities) WithListEventsQueries(v string) ListEventsOption { + return func(o *ListEventsOptions) { + o.Queries = v + o.enabledSetters["Queries"] = true + } +} + +// ListEvents list all events for selected filters. +func (srv *Activities) ListEvents(optionalSetters ...ListEventsOption)(*models.ActivityEventList, error) { + path := "/activities/events" + options := ListEventsOptions{}.New() + for _, opt := range optionalSetters { + opt(options) + } + params := map[string]interface{}{} + if options.enabledSetters["Queries"] { + params["queries"] = options.Queries + } + headers := map[string]interface{}{ + } + + 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.ActivityEventList{}.New(bytes) + + err = json.Unmarshal(bytes, parsed) + if err != nil { + return nil, err + } + + return parsed, nil + } + var parsed models.ActivityEventList + parsed, ok := resp.Result.(models.ActivityEventList) + if !ok { + return nil, errors.New("unexpected response type") + } + return &parsed, nil + +} + +// GetEvent get event by ID. +func (srv *Activities) GetEvent(EventId string)(*models.ActivityEvent, error) { + r := strings.NewReplacer("{eventId}", EventId) + path := r.Replace("/activities/events/{eventId}") + params := map[string]interface{}{} + params["eventId"] = EventId + headers := map[string]interface{}{ + } + + 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.ActivityEvent{}.New(bytes) + + err = json.Unmarshal(bytes, parsed) + if err != nil { + return nil, err + } + + return parsed, nil + } + var parsed models.ActivityEvent + parsed, ok := resp.Result.(models.ActivityEvent) + if !ok { + return nil, errors.New("unexpected response type") + } + return &parsed, nil + +} diff --git a/appwrite/appwrite.go b/appwrite/appwrite.go index bf4cfa6c..0f2d7b9e 100644 --- a/appwrite/appwrite.go +++ b/appwrite/appwrite.go @@ -5,6 +5,7 @@ import ( "github.com/appwrite/sdk-for-go/client" "github.com/appwrite/sdk-for-go/account" + "github.com/appwrite/sdk-for-go/activities" "github.com/appwrite/sdk-for-go/avatars" "github.com/appwrite/sdk-for-go/backups" "github.com/appwrite/sdk-for-go/databases" @@ -24,6 +25,9 @@ import ( func NewAccount(clt client.Client) *account.Account { return account.New(clt) } +func NewActivities(clt client.Client) *activities.Activities { + return activities.New(clt) +} func NewAvatars(clt client.Client) *avatars.Avatars { return avatars.New(clt) } diff --git a/client/client.go b/client/client.go index dff15cca..7257c445 100644 --- a/client/client.go +++ b/client/client.go @@ -74,11 +74,11 @@ type Client struct { func New(optionalSetters ...ClientOption) Client { headers := map[string]string{ "X-Appwrite-Response-Format" : "1.8.0", - "user-agent" : fmt.Sprintf("AppwriteGoSDK/v0.17.0 (%s; %s)", runtime.GOOS, runtime.GOARCH), + "user-agent" : fmt.Sprintf("AppwriteGoSDK/0.17.0 (%s; %s)", runtime.GOOS, runtime.GOARCH), "x-sdk-name": "Go", "x-sdk-platform": "server", "x-sdk-language": "go", - "x-sdk-version": "v0.17.0", + "x-sdk-version": "0.17.0", } httpClient, err := GetDefaultClient(defaultTimeout) if err != nil { diff --git a/databases/databases.go b/databases/databases.go index 98e8ec80..bb2f4282 100644 --- a/databases/databases.go +++ b/databases/databases.go @@ -2278,12 +2278,14 @@ func (srv *Databases) UpdateLineAttribute(DatabaseId string, CollectionId string type CreateLongtextAttributeOptions struct { Default string Array bool + Encrypt bool enabledSetters map[string]bool } func (options CreateLongtextAttributeOptions) New() *CreateLongtextAttributeOptions { options.enabledSetters = map[string]bool{ "Default": false, "Array": false, + "Encrypt": false, } return &options } @@ -2300,6 +2302,12 @@ func (srv *Databases) WithCreateLongtextAttributeArray(v bool) CreateLongtextAtt o.enabledSetters["Array"] = true } } +func (srv *Databases) WithCreateLongtextAttributeEncrypt(v bool) CreateLongtextAttributeOption { + return func(o *CreateLongtextAttributeOptions) { + o.Encrypt = v + o.enabledSetters["Encrypt"] = true + } +} // CreateLongtextAttribute create a longtext attribute. func (srv *Databases) CreateLongtextAttribute(DatabaseId string, CollectionId string, Key string, Required bool, optionalSetters ...CreateLongtextAttributeOption)(*models.AttributeLongtext, error) { @@ -2320,6 +2328,9 @@ func (srv *Databases) CreateLongtextAttribute(DatabaseId string, CollectionId st if options.enabledSetters["Array"] { params["array"] = options.Array } + if options.enabledSetters["Encrypt"] { + params["encrypt"] = options.Encrypt + } headers := map[string]interface{}{ "content-type": "application/json", } @@ -2415,12 +2426,14 @@ func (srv *Databases) UpdateLongtextAttribute(DatabaseId string, CollectionId st type CreateMediumtextAttributeOptions struct { Default string Array bool + Encrypt bool enabledSetters map[string]bool } func (options CreateMediumtextAttributeOptions) New() *CreateMediumtextAttributeOptions { options.enabledSetters = map[string]bool{ "Default": false, "Array": false, + "Encrypt": false, } return &options } @@ -2437,6 +2450,12 @@ func (srv *Databases) WithCreateMediumtextAttributeArray(v bool) CreateMediumtex o.enabledSetters["Array"] = true } } +func (srv *Databases) WithCreateMediumtextAttributeEncrypt(v bool) CreateMediumtextAttributeOption { + return func(o *CreateMediumtextAttributeOptions) { + o.Encrypt = v + o.enabledSetters["Encrypt"] = true + } +} // CreateMediumtextAttribute create a mediumtext attribute. func (srv *Databases) CreateMediumtextAttribute(DatabaseId string, CollectionId string, Key string, Required bool, optionalSetters ...CreateMediumtextAttributeOption)(*models.AttributeMediumtext, error) { @@ -2457,6 +2476,9 @@ func (srv *Databases) CreateMediumtextAttribute(DatabaseId string, CollectionId if options.enabledSetters["Array"] { params["array"] = options.Array } + if options.enabledSetters["Encrypt"] { + params["encrypt"] = options.Encrypt + } headers := map[string]interface{}{ "content-type": "application/json", } @@ -3095,12 +3117,14 @@ func (srv *Databases) UpdateStringAttribute(DatabaseId string, CollectionId stri type CreateTextAttributeOptions struct { Default string Array bool + Encrypt bool enabledSetters map[string]bool } func (options CreateTextAttributeOptions) New() *CreateTextAttributeOptions { options.enabledSetters = map[string]bool{ "Default": false, "Array": false, + "Encrypt": false, } return &options } @@ -3117,6 +3141,12 @@ func (srv *Databases) WithCreateTextAttributeArray(v bool) CreateTextAttributeOp o.enabledSetters["Array"] = true } } +func (srv *Databases) WithCreateTextAttributeEncrypt(v bool) CreateTextAttributeOption { + return func(o *CreateTextAttributeOptions) { + o.Encrypt = v + o.enabledSetters["Encrypt"] = true + } +} // CreateTextAttribute create a text attribute. func (srv *Databases) CreateTextAttribute(DatabaseId string, CollectionId string, Key string, Required bool, optionalSetters ...CreateTextAttributeOption)(*models.AttributeText, error) { @@ -3137,6 +3167,9 @@ func (srv *Databases) CreateTextAttribute(DatabaseId string, CollectionId string if options.enabledSetters["Array"] { params["array"] = options.Array } + if options.enabledSetters["Encrypt"] { + params["encrypt"] = options.Encrypt + } headers := map[string]interface{}{ "content-type": "application/json", } @@ -3373,12 +3406,14 @@ func (srv *Databases) UpdateUrlAttribute(DatabaseId string, CollectionId string, type CreateVarcharAttributeOptions struct { Default string Array bool + Encrypt bool enabledSetters map[string]bool } func (options CreateVarcharAttributeOptions) New() *CreateVarcharAttributeOptions { options.enabledSetters = map[string]bool{ "Default": false, "Array": false, + "Encrypt": false, } return &options } @@ -3395,6 +3430,12 @@ func (srv *Databases) WithCreateVarcharAttributeArray(v bool) CreateVarcharAttri o.enabledSetters["Array"] = true } } +func (srv *Databases) WithCreateVarcharAttributeEncrypt(v bool) CreateVarcharAttributeOption { + return func(o *CreateVarcharAttributeOptions) { + o.Encrypt = v + o.enabledSetters["Encrypt"] = true + } +} // CreateVarcharAttribute create a varchar attribute. func (srv *Databases) CreateVarcharAttribute(DatabaseId string, CollectionId string, Key string, Size int, Required bool, optionalSetters ...CreateVarcharAttributeOption)(*models.AttributeVarchar, error) { @@ -3416,6 +3457,9 @@ func (srv *Databases) CreateVarcharAttribute(DatabaseId string, CollectionId str if options.enabledSetters["Array"] { params["array"] = options.Array } + if options.enabledSetters["Encrypt"] { + params["encrypt"] = options.Encrypt + } headers := map[string]interface{}{ "content-type": "application/json", } diff --git a/docs/examples/health/get-queue-threats.md b/docs/examples/activities/get-event.md similarity index 61% rename from docs/examples/health/get-queue-threats.md rename to docs/examples/activities/get-event.md index f996b067..f392366c 100644 --- a/docs/examples/health/get-queue-threats.md +++ b/docs/examples/activities/get-event.md @@ -4,7 +4,7 @@ package main import ( "fmt" "github.com/appwrite/sdk-for-go/client" - "github.com/appwrite/sdk-for-go/health" + "github.com/appwrite/sdk-for-go/activities" ) client := client.New( @@ -13,9 +13,9 @@ client := client.New( client.WithKey("") ) -service := health.New(client) +service := activities.New(client) -response, error := service.GetQueueThreats( - health.WithGetQueueThreatsThreshold(0), +response, error := service.GetEvent( + "", ) ``` diff --git a/docs/examples/health/get-queue-region-manager.md b/docs/examples/activities/list-events.md similarity index 60% rename from docs/examples/health/get-queue-region-manager.md rename to docs/examples/activities/list-events.md index deff19a6..f5a165a4 100644 --- a/docs/examples/health/get-queue-region-manager.md +++ b/docs/examples/activities/list-events.md @@ -4,7 +4,7 @@ package main import ( "fmt" "github.com/appwrite/sdk-for-go/client" - "github.com/appwrite/sdk-for-go/health" + "github.com/appwrite/sdk-for-go/activities" ) client := client.New( @@ -13,9 +13,9 @@ client := client.New( client.WithKey("") ) -service := health.New(client) +service := activities.New(client) -response, error := service.GetQueueRegionManager( - health.WithGetQueueRegionManagerThreshold(0), +response, error := service.ListEvents( + activities.WithListEventsQueries(""), ) ``` diff --git a/docs/examples/databases/create-longtext-attribute.md b/docs/examples/databases/create-longtext-attribute.md index bbbfa73d..693c4345 100644 --- a/docs/examples/databases/create-longtext-attribute.md +++ b/docs/examples/databases/create-longtext-attribute.md @@ -22,5 +22,6 @@ response, error := service.CreateLongtextAttribute( false, databases.WithCreateLongtextAttributeDefault(""), databases.WithCreateLongtextAttributeArray(false), + databases.WithCreateLongtextAttributeEncrypt(false), ) ``` diff --git a/docs/examples/databases/create-mediumtext-attribute.md b/docs/examples/databases/create-mediumtext-attribute.md index 4c1f31eb..55a97704 100644 --- a/docs/examples/databases/create-mediumtext-attribute.md +++ b/docs/examples/databases/create-mediumtext-attribute.md @@ -22,5 +22,6 @@ response, error := service.CreateMediumtextAttribute( false, databases.WithCreateMediumtextAttributeDefault(""), databases.WithCreateMediumtextAttributeArray(false), + databases.WithCreateMediumtextAttributeEncrypt(false), ) ``` diff --git a/docs/examples/databases/create-text-attribute.md b/docs/examples/databases/create-text-attribute.md index 4b3dd653..55aaa2d5 100644 --- a/docs/examples/databases/create-text-attribute.md +++ b/docs/examples/databases/create-text-attribute.md @@ -22,5 +22,6 @@ response, error := service.CreateTextAttribute( false, databases.WithCreateTextAttributeDefault(""), databases.WithCreateTextAttributeArray(false), + databases.WithCreateTextAttributeEncrypt(false), ) ``` diff --git a/docs/examples/databases/create-varchar-attribute.md b/docs/examples/databases/create-varchar-attribute.md index 2536b27a..56372666 100644 --- a/docs/examples/databases/create-varchar-attribute.md +++ b/docs/examples/databases/create-varchar-attribute.md @@ -23,5 +23,6 @@ response, error := service.CreateVarcharAttribute( false, databases.WithCreateVarcharAttributeDefault(""), databases.WithCreateVarcharAttributeArray(false), + databases.WithCreateVarcharAttributeEncrypt(false), ) ``` diff --git a/docs/examples/health/get-queue-billing-project-aggregation.md b/docs/examples/health/get-queue-billing-project-aggregation.md deleted file mode 100644 index d67dd084..00000000 --- a/docs/examples/health/get-queue-billing-project-aggregation.md +++ /dev/null @@ -1,21 +0,0 @@ -```go -package main - -import ( - "fmt" - "github.com/appwrite/sdk-for-go/client" - "github.com/appwrite/sdk-for-go/health" -) - -client := client.New( - client.WithEndpoint("https://.cloud.appwrite.io/v1") - client.WithProject("") - client.WithKey("") -) - -service := health.New(client) - -response, error := service.GetQueueBillingProjectAggregation( - health.WithGetQueueBillingProjectAggregationThreshold(0), -) -``` diff --git a/docs/examples/health/get-queue-billing-team-aggregation.md b/docs/examples/health/get-queue-billing-team-aggregation.md deleted file mode 100644 index 412a291e..00000000 --- a/docs/examples/health/get-queue-billing-team-aggregation.md +++ /dev/null @@ -1,21 +0,0 @@ -```go -package main - -import ( - "fmt" - "github.com/appwrite/sdk-for-go/client" - "github.com/appwrite/sdk-for-go/health" -) - -client := client.New( - client.WithEndpoint("https://.cloud.appwrite.io/v1") - client.WithProject("") - client.WithKey("") -) - -service := health.New(client) - -response, error := service.GetQueueBillingTeamAggregation( - health.WithGetQueueBillingTeamAggregationThreshold(0), -) -``` diff --git a/docs/examples/health/get-queue-priority-builds.md b/docs/examples/health/get-queue-priority-builds.md deleted file mode 100644 index 2c5b5789..00000000 --- a/docs/examples/health/get-queue-priority-builds.md +++ /dev/null @@ -1,21 +0,0 @@ -```go -package main - -import ( - "fmt" - "github.com/appwrite/sdk-for-go/client" - "github.com/appwrite/sdk-for-go/health" -) - -client := client.New( - client.WithEndpoint("https://.cloud.appwrite.io/v1") - client.WithProject("") - client.WithKey("") -) - -service := health.New(client) - -response, error := service.GetQueuePriorityBuilds( - health.WithGetQueuePriorityBuildsThreshold(0), -) -``` diff --git a/docs/examples/tablesdb/create-longtext-column.md b/docs/examples/tablesdb/create-longtext-column.md index 4fca2539..708c13c7 100644 --- a/docs/examples/tablesdb/create-longtext-column.md +++ b/docs/examples/tablesdb/create-longtext-column.md @@ -22,5 +22,6 @@ response, error := service.CreateLongtextColumn( false, tablesdb.WithCreateLongtextColumnDefault(""), tablesdb.WithCreateLongtextColumnArray(false), + tablesdb.WithCreateLongtextColumnEncrypt(false), ) ``` diff --git a/docs/examples/tablesdb/create-mediumtext-column.md b/docs/examples/tablesdb/create-mediumtext-column.md index 57687276..0f8e692b 100644 --- a/docs/examples/tablesdb/create-mediumtext-column.md +++ b/docs/examples/tablesdb/create-mediumtext-column.md @@ -22,5 +22,6 @@ response, error := service.CreateMediumtextColumn( false, tablesdb.WithCreateMediumtextColumnDefault(""), tablesdb.WithCreateMediumtextColumnArray(false), + tablesdb.WithCreateMediumtextColumnEncrypt(false), ) ``` diff --git a/docs/examples/tablesdb/create-text-column.md b/docs/examples/tablesdb/create-text-column.md index f8fb4b19..bd85e440 100644 --- a/docs/examples/tablesdb/create-text-column.md +++ b/docs/examples/tablesdb/create-text-column.md @@ -22,5 +22,6 @@ response, error := service.CreateTextColumn( false, tablesdb.WithCreateTextColumnDefault(""), tablesdb.WithCreateTextColumnArray(false), + tablesdb.WithCreateTextColumnEncrypt(false), ) ``` diff --git a/docs/examples/tablesdb/create-varchar-column.md b/docs/examples/tablesdb/create-varchar-column.md index e669253f..0f265ebd 100644 --- a/docs/examples/tablesdb/create-varchar-column.md +++ b/docs/examples/tablesdb/create-varchar-column.md @@ -23,5 +23,6 @@ response, error := service.CreateVarcharColumn( false, tablesdb.WithCreateVarcharColumnDefault(""), tablesdb.WithCreateVarcharColumnArray(false), + tablesdb.WithCreateVarcharColumnEncrypt(false), ) ``` diff --git a/models/activity_event.go b/models/activity_event.go new file mode 100644 index 00000000..c515bf2d --- /dev/null +++ b/models/activity_event.go @@ -0,0 +1,97 @@ +package models + +import ( + "encoding/json" + "errors" +) + +// ActivityEvent Model +type ActivityEvent struct { + // Event ID. + Id string `json:"$id"` + // User type. + UserType string `json:"userType"` + // User ID. + UserId string `json:"userId"` + // User Email. + UserEmail string `json:"userEmail"` + // User Name. + UserName string `json:"userName"` + // Resource parent. + ResourceParent string `json:"resourceParent"` + // Resource type. + ResourceType string `json:"resourceType"` + // Resource ID. + ResourceId string `json:"resourceId"` + // Resource. + Resource string `json:"resource"` + // Event name. + Event string `json:"event"` + // User agent. + UserAgent string `json:"userAgent"` + // IP address. + Ip string `json:"ip"` + // API mode when event triggered. + Mode string `json:"mode"` + // Location. + Country string `json:"country"` + // Log creation date in ISO 8601 format. + Time string `json:"time"` + // Project ID. + ProjectId string `json:"projectId"` + // Team ID. + TeamId string `json:"teamId"` + // Hostname. + Hostname string `json:"hostname"` + // Operating system code name. View list of [available + // options](https://github.com/appwrite/appwrite/blob/master/docs/lists/os.json). + OsCode string `json:"osCode"` + // Operating system name. + OsName string `json:"osName"` + // Operating system version. + OsVersion string `json:"osVersion"` + // Client type. + ClientType string `json:"clientType"` + // Client code name. View list of [available + // options](https://github.com/appwrite/appwrite/blob/master/docs/lists/clients.json). + ClientCode string `json:"clientCode"` + // Client name. + ClientName string `json:"clientName"` + // Client version. + ClientVersion string `json:"clientVersion"` + // Client engine name. + ClientEngine string `json:"clientEngine"` + // Client engine name. + ClientEngineVersion string `json:"clientEngineVersion"` + // Device name. + DeviceName string `json:"deviceName"` + // Device brand name. + DeviceBrand string `json:"deviceBrand"` + // Device model name. + DeviceModel string `json:"deviceModel"` + // Country two-character ISO 3166-1 alpha code. + CountryCode string `json:"countryCode"` + // Country name. + CountryName string `json:"countryName"` + + // Used by Decode() method + data []byte +} + +func (model ActivityEvent) New(data []byte) *ActivityEvent { + model.data = data + return &model +} + +func (model *ActivityEvent) 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/activity_event_list.go b/models/activity_event_list.go new file mode 100644 index 00000000..0468f09b --- /dev/null +++ b/models/activity_event_list.go @@ -0,0 +1,35 @@ +package models + +import ( + "encoding/json" + "errors" +) + +// ActivityEventList Model +type ActivityEventList struct { + // Total number of events that matched your query. + Total int `json:"total"` + // List of events. + Events []ActivityEvent `json:"events"` + + // Used by Decode() method + data []byte +} + +func (model ActivityEventList) New(data []byte) *ActivityEventList { + model.data = data + return &model +} + +func (model *ActivityEventList) 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/attribute_longtext.go b/models/attribute_longtext.go index a1f0ed4e..ef758e15 100644 --- a/models/attribute_longtext.go +++ b/models/attribute_longtext.go @@ -28,6 +28,8 @@ type AttributeLongtext struct { // Default value for attribute when not provided. Cannot be set when attribute // is required. Default string `json:"default"` + // Defines whether this attribute is encrypted or not. + Encrypt bool `json:"encrypt"` // Used by Decode() method data []byte diff --git a/models/attribute_mediumtext.go b/models/attribute_mediumtext.go index c8861d90..22039b81 100644 --- a/models/attribute_mediumtext.go +++ b/models/attribute_mediumtext.go @@ -28,6 +28,8 @@ type AttributeMediumtext struct { // Default value for attribute when not provided. Cannot be set when attribute // is required. Default string `json:"default"` + // Defines whether this attribute is encrypted or not. + Encrypt bool `json:"encrypt"` // Used by Decode() method data []byte diff --git a/models/attribute_text.go b/models/attribute_text.go index 596f8b66..e31bc390 100644 --- a/models/attribute_text.go +++ b/models/attribute_text.go @@ -28,6 +28,8 @@ type AttributeText struct { // Default value for attribute when not provided. Cannot be set when attribute // is required. Default string `json:"default"` + // Defines whether this attribute is encrypted or not. + Encrypt bool `json:"encrypt"` // Used by Decode() method data []byte diff --git a/models/attribute_varchar.go b/models/attribute_varchar.go index a565f370..264aaa2b 100644 --- a/models/attribute_varchar.go +++ b/models/attribute_varchar.go @@ -30,6 +30,8 @@ type AttributeVarchar struct { // Default value for attribute when not provided. Cannot be set when attribute // is required. Default string `json:"default"` + // Defines whether this attribute is encrypted or not. + Encrypt bool `json:"encrypt"` // Used by Decode() method data []byte diff --git a/models/column_longtext.go b/models/column_longtext.go index 9744f2b3..756e9d65 100644 --- a/models/column_longtext.go +++ b/models/column_longtext.go @@ -28,6 +28,8 @@ type ColumnLongtext struct { // Default value for column when not provided. Cannot be set when column is // required. Default string `json:"default"` + // Defines whether this column is encrypted or not. + Encrypt bool `json:"encrypt"` // Used by Decode() method data []byte diff --git a/models/column_mediumtext.go b/models/column_mediumtext.go index dc8e8bba..039ff4a6 100644 --- a/models/column_mediumtext.go +++ b/models/column_mediumtext.go @@ -28,6 +28,8 @@ type ColumnMediumtext struct { // Default value for column when not provided. Cannot be set when column is // required. Default string `json:"default"` + // Defines whether this column is encrypted or not. + Encrypt bool `json:"encrypt"` // Used by Decode() method data []byte diff --git a/models/column_text.go b/models/column_text.go index 3b2a5c3c..f1d74e48 100644 --- a/models/column_text.go +++ b/models/column_text.go @@ -28,6 +28,8 @@ type ColumnText struct { // Default value for column when not provided. Cannot be set when column is // required. Default string `json:"default"` + // Defines whether this column is encrypted or not. + Encrypt bool `json:"encrypt"` // Used by Decode() method data []byte diff --git a/models/column_varchar.go b/models/column_varchar.go index 230fd954..e3128e4d 100644 --- a/models/column_varchar.go +++ b/models/column_varchar.go @@ -30,6 +30,8 @@ type ColumnVarchar struct { // Default value for column when not provided. Cannot be set when column is // required. Default string `json:"default"` + // Defines whether this column is encrypted or not. + Encrypt bool `json:"encrypt"` // Used by Decode() method data []byte diff --git a/query/query.go b/query/query.go index 560b7e23..b057223c 100644 --- a/query/query.go +++ b/query/query.go @@ -147,6 +147,10 @@ func EndsWith(attribute string, value interface{}) string { }) } +// Contains filters resources where attribute contains the specified value. +// For string attributes, checks if the string contains the substring. +// +// Note: For array attributes, use ContainsAny or ContainsAll instead. func Contains(attribute string, value interface{}) string { values := toArray(value) return parseQuery(queryOptions{ @@ -156,6 +160,28 @@ func Contains(attribute string, value interface{}) string { }) } +// ContainsAny filters resources where attribute contains ANY of the specified values. +// For array and relationship attributes, matches documents where the attribute +// contains at least one of the given values. +func ContainsAny(attribute string, value []interface{}) string { + return parseQuery(queryOptions{ + Method: "containsAny", + Attribute: &attribute, + Values: &value, + }) +} + +// ContainsAll filters resources where attribute contains ALL of the specified values. +// For array and relationship attributes, matches documents where the attribute +// contains every one of the given values. +func ContainsAll(attribute string, value []interface{}) string { + return parseQuery(queryOptions{ + Method: "containsAll", + Attribute: &attribute, + Values: &value, + }) +} + func NotContains(attribute string, value interface{}) string { values := toArray(value) return parseQuery(queryOptions{ diff --git a/tablesdb/tables_db.go b/tablesdb/tables_db.go index c1fec224..e7d021dd 100644 --- a/tablesdb/tables_db.go +++ b/tablesdb/tables_db.go @@ -2224,12 +2224,14 @@ func (srv *TablesDB) UpdateLineColumn(DatabaseId string, TableId string, Key str type CreateLongtextColumnOptions struct { Default string Array bool + Encrypt bool enabledSetters map[string]bool } func (options CreateLongtextColumnOptions) New() *CreateLongtextColumnOptions { options.enabledSetters = map[string]bool{ "Default": false, "Array": false, + "Encrypt": false, } return &options } @@ -2246,6 +2248,12 @@ func (srv *TablesDB) WithCreateLongtextColumnArray(v bool) CreateLongtextColumnO o.enabledSetters["Array"] = true } } +func (srv *TablesDB) WithCreateLongtextColumnEncrypt(v bool) CreateLongtextColumnOption { + return func(o *CreateLongtextColumnOptions) { + o.Encrypt = v + o.enabledSetters["Encrypt"] = true + } +} // CreateLongtextColumn create a longtext column. func (srv *TablesDB) CreateLongtextColumn(DatabaseId string, TableId string, Key string, Required bool, optionalSetters ...CreateLongtextColumnOption)(*models.ColumnLongtext, error) { @@ -2266,6 +2274,9 @@ func (srv *TablesDB) CreateLongtextColumn(DatabaseId string, TableId string, Key if options.enabledSetters["Array"] { params["array"] = options.Array } + if options.enabledSetters["Encrypt"] { + params["encrypt"] = options.Encrypt + } headers := map[string]interface{}{ "content-type": "application/json", } @@ -2361,12 +2372,14 @@ func (srv *TablesDB) UpdateLongtextColumn(DatabaseId string, TableId string, Key type CreateMediumtextColumnOptions struct { Default string Array bool + Encrypt bool enabledSetters map[string]bool } func (options CreateMediumtextColumnOptions) New() *CreateMediumtextColumnOptions { options.enabledSetters = map[string]bool{ "Default": false, "Array": false, + "Encrypt": false, } return &options } @@ -2383,6 +2396,12 @@ func (srv *TablesDB) WithCreateMediumtextColumnArray(v bool) CreateMediumtextCol o.enabledSetters["Array"] = true } } +func (srv *TablesDB) WithCreateMediumtextColumnEncrypt(v bool) CreateMediumtextColumnOption { + return func(o *CreateMediumtextColumnOptions) { + o.Encrypt = v + o.enabledSetters["Encrypt"] = true + } +} // CreateMediumtextColumn create a mediumtext column. func (srv *TablesDB) CreateMediumtextColumn(DatabaseId string, TableId string, Key string, Required bool, optionalSetters ...CreateMediumtextColumnOption)(*models.ColumnMediumtext, error) { @@ -2403,6 +2422,9 @@ func (srv *TablesDB) CreateMediumtextColumn(DatabaseId string, TableId string, K if options.enabledSetters["Array"] { params["array"] = options.Array } + if options.enabledSetters["Encrypt"] { + params["encrypt"] = options.Encrypt + } headers := map[string]interface{}{ "content-type": "application/json", } @@ -3031,12 +3053,14 @@ func (srv *TablesDB) UpdateStringColumn(DatabaseId string, TableId string, Key s type CreateTextColumnOptions struct { Default string Array bool + Encrypt bool enabledSetters map[string]bool } func (options CreateTextColumnOptions) New() *CreateTextColumnOptions { options.enabledSetters = map[string]bool{ "Default": false, "Array": false, + "Encrypt": false, } return &options } @@ -3053,6 +3077,12 @@ func (srv *TablesDB) WithCreateTextColumnArray(v bool) CreateTextColumnOption { o.enabledSetters["Array"] = true } } +func (srv *TablesDB) WithCreateTextColumnEncrypt(v bool) CreateTextColumnOption { + return func(o *CreateTextColumnOptions) { + o.Encrypt = v + o.enabledSetters["Encrypt"] = true + } +} // CreateTextColumn create a text column. func (srv *TablesDB) CreateTextColumn(DatabaseId string, TableId string, Key string, Required bool, optionalSetters ...CreateTextColumnOption)(*models.ColumnText, error) { @@ -3073,6 +3103,9 @@ func (srv *TablesDB) CreateTextColumn(DatabaseId string, TableId string, Key str if options.enabledSetters["Array"] { params["array"] = options.Array } + if options.enabledSetters["Encrypt"] { + params["encrypt"] = options.Encrypt + } headers := map[string]interface{}{ "content-type": "application/json", } @@ -3305,12 +3338,14 @@ func (srv *TablesDB) UpdateUrlColumn(DatabaseId string, TableId string, Key stri type CreateVarcharColumnOptions struct { Default string Array bool + Encrypt bool enabledSetters map[string]bool } func (options CreateVarcharColumnOptions) New() *CreateVarcharColumnOptions { options.enabledSetters = map[string]bool{ "Default": false, "Array": false, + "Encrypt": false, } return &options } @@ -3327,6 +3362,12 @@ func (srv *TablesDB) WithCreateVarcharColumnArray(v bool) CreateVarcharColumnOpt o.enabledSetters["Array"] = true } } +func (srv *TablesDB) WithCreateVarcharColumnEncrypt(v bool) CreateVarcharColumnOption { + return func(o *CreateVarcharColumnOptions) { + o.Encrypt = v + o.enabledSetters["Encrypt"] = true + } +} // CreateVarcharColumn create a varchar column. func (srv *TablesDB) CreateVarcharColumn(DatabaseId string, TableId string, Key string, Size int, Required bool, optionalSetters ...CreateVarcharColumnOption)(*models.ColumnVarchar, error) { @@ -3348,6 +3389,9 @@ func (srv *TablesDB) CreateVarcharColumn(DatabaseId string, TableId string, Key if options.enabledSetters["Array"] { params["array"] = options.Array } + if options.enabledSetters["Encrypt"] { + params["encrypt"] = options.Encrypt + } headers := map[string]interface{}{ "content-type": "application/json", } From e628799f6c24eef308a46ef9d92ea719f347c502 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 19 Feb 2026 11:06:38 +0000 Subject: [PATCH 2/4] release --- CHANGELOG.md | 7 +++++++ client/client.go | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0cc39564..a140c72c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Change Log +## 0.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. +* Updated documentation and examples to demonstrate the new encrypt option for attribute creation (e.g., docs/examples/databases/create-longtext-attribute.md, create-mediumtext-attribute.md, create-text-attribute.md, create-varchar-attribute.md). +* Updated README to reflect compatibility with Appwrite server version 1.8.x. + ## v0.14.0 * Add `total` parameter to list queries allowing skipping counting rows in a table for improved performance diff --git a/client/client.go b/client/client.go index 7257c445..dff15cca 100644 --- a/client/client.go +++ b/client/client.go @@ -74,11 +74,11 @@ type Client struct { func New(optionalSetters ...ClientOption) Client { headers := map[string]string{ "X-Appwrite-Response-Format" : "1.8.0", - "user-agent" : fmt.Sprintf("AppwriteGoSDK/0.17.0 (%s; %s)", runtime.GOOS, runtime.GOARCH), + "user-agent" : fmt.Sprintf("AppwriteGoSDK/v0.17.0 (%s; %s)", runtime.GOOS, runtime.GOARCH), "x-sdk-name": "Go", "x-sdk-platform": "server", "x-sdk-language": "go", - "x-sdk-version": "0.17.0", + "x-sdk-version": "v0.17.0", } httpClient, err := GetDefaultClient(defaultTimeout) if err != nil { From 8ed49ab206ffb14eb9296218c30c3e5b5b88510c Mon Sep 17 00:00:00 2001 From: root Date: Thu, 19 Feb 2026 11:21:22 +0000 Subject: [PATCH 3/4] regen --- CHANGELOG.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a140c72c..c39393b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,24 @@ * Updated documentation and examples to demonstrate the new encrypt option for attribute creation (e.g., docs/examples/databases/create-longtext-attribute.md, create-mediumtext-attribute.md, create-text-attribute.md, create-varchar-attribute.md). * Updated README to reflect compatibility with Appwrite server version 1.8.x. +## v0.16.1 + +* Fix doc examples with proper formatting + +## v0.16.0 + +* Added ability to create columns and indexes synchronously while creating a table +* Breaking change: `Output` enum has been removed; use `ImageFormat` instead. +* Add `getQueueAudits` support to `Health` service. +* Add longtext/mediumtext/text/varchar attribute and column helpers to `Databases` and `TablesDB` services. + +## v0.15.0 + +* Rename `VCSDeploymentType` enum to `VCSReferenceType` +* Change `CreateTemplateDeployment` method signature: replace `Version` parameter with `Type` (TemplateReferenceType) and `Reference` parameters +* Add `GetScreenshot` method to `Avatars` service +* Add `Theme`, `Timezone` and `Output` enums + ## v0.14.0 * Add `total` parameter to list queries allowing skipping counting rows in a table for improved performance From 0c54b5a927a213fbb738ef06391871037b814689 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 19 Feb 2026 11:42:10 +0000 Subject: [PATCH 4/4] add missing entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c39393b9..af42f6ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ * 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. * Updated documentation and examples to demonstrate the new encrypt option for attribute creation (e.g., docs/examples/databases/create-longtext-attribute.md, create-mediumtext-attribute.md, create-text-attribute.md, create-varchar-attribute.md). * Updated README to reflect compatibility with Appwrite server version 1.8.x. +* Add support for the new `Backups` service ## v0.16.1