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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
# Change Log

## 29.0.0

* Breaking: requests send `X-Appwrite-Response-Format: 2.5.0`; responses follow the 2.5 shapes
* Breaking: removed `account.list_logs`, `users.list_logs` and the `Log`/`LogList` models
* Breaking: removed `organization.create_key`, `get_key`, `list_keys`, `update_key` and `delete_key`, and `OrganizationKeyScopes`; use `organization.list_project_keys`, `get_project_key`, `update_project_key` and `delete_project_key` instead
* Breaking: removed `Client#set_dev_key`, the `DevKey` model and `Project#dev_keys`
* Breaking: removed `BillingPlanGroup::STARTER`; use `BillingPlanGroup::FREE`
* Breaking: `list_specifications` returns each specification's prices and overage rates on the row itself. Removed the list-level `pricing` field and the `DedicatedDatabaseSpecificationPricing` model
* Breaking: removed `Block` fields `reason`, `project_name`, `region`, `organization_name`, `organization_id` and `billing_plan`
* Breaking: OAuth2 `resource:` params now take an array
* Breaking: `BackupRestoration#options` is now a hash
* Breaking: some response fields became optional, such as `BillingPlan#usage` and `DedicatedDatabase#engine`
* Added: `Topic` helper to build MQTT topics for push messages
* Added: `mongo`, `mysql` and `postgresql` `promote_restoration`, `restore_mode:`, `target_name:` and `auto_promote:` on `create_restoration`, and `DedicatedDatabaseRestoration#restore_mode`
* Added: `proxy.create_smtp_rule`, the `ProxyRuleProtocol` enum and `ProxyRule#protocol`
* Added: `email_enabled:` on `functions.update` and `Function`, and `ExecutionTrigger::EMAIL`
* Added: `Query` aggregates (`count`, `count_distinct`, `sum`, `avg`, `min`, `max` and more), `group_by`, `having`, `distinct`, joins, `relationship`, `covers`, `spatial_equals` and `page`
* Added: `Query.builder` to chain queries; `build()` returns the query list
* Updated: missing response fields fall back to their documented defaults in more models

## 28.4.0

* Added: `domains` service to manage domains, DNS records, email presets, prices, transfer status and zones
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Appwrite Ruby SDK

![License](https://img.shields.io/github/license/appwrite/sdk-for-ruby.svg?style=flat-square)
![Version](https://img.shields.io/badge/api%20version-2.0.0-blue.svg?style=flat-square)
![Version](https://img.shields.io/badge/api%20version-2.5.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 targets Appwrite server version 1.9.x as shipped on Appwrite Cloud.** Self-hosted releases can lag behind Cloud — if you run an older self-hosted build, use a matching older SDK from [previous releases](https://github.com/appwrite/sdk-for-ruby/releases) when APIs differ.
**This SDK targets Appwrite server version 2.5.x as shipped on Appwrite Cloud.** Self-hosted releases can lag behind Cloud — if you run an older self-hosted build, use a matching older SDK from [previous releases](https://github.com/appwrite/sdk-for-ruby/releases) when APIs differ.

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 Ruby 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 Expand Up @@ -35,7 +35,7 @@ client
.set_endpoint(ENV["APPWRITE_ENDPOINT"]) # Your API Endpoint
.set_project(ENV["APPWRITE_PROJECT"]) # Your project ID
.set_key(ENV["APPWRITE_SECRET"]) # Your secret API key
.setSelfSigned() # Use only on dev mode with a self-signed SSL cert
.set_self_signed # Use only on dev mode with a self-signed SSL cert
;
```

Expand All @@ -45,7 +45,7 @@ Once your SDK object is set, create any of the Appwrite service objects and choo
```ruby
users = Appwrite::Users.new(client);

user = users.create(userId: Appwrite::ID::unique(), email: "email@example.com", phone: "+123456789", password: "password", name: "Walter O'Brien");
user = users.create(user_id: Appwrite::ID::unique(), email: "email@example.com", phone: "+123456789", password: "password", name: "Walter O'Brien");
```

### Full Example
Expand All @@ -58,12 +58,12 @@ client
.set_endpoint(ENV["APPWRITE_ENDPOINT"]) # Your API Endpoint
.set_project(ENV["APPWRITE_PROJECT"]) # Your project ID
.set_key(ENV["APPWRITE_SECRET"]) # Your secret API key
.setSelfSigned() # Use only on dev mode with a self-signed SSL cert
.set_self_signed # Use only on dev mode with a self-signed SSL cert
;

users = Appwrite::Users.new(client);

user = users.create(userId: Appwrite::ID::unique(), email: "email@example.com", phone: "+123456789", password: "password", name: "Walter O'Brien");
user = users.create(user_id: Appwrite::ID::unique(), email: "email@example.com", phone: "+123456789", password: "password", name: "Walter O'Brien");
```

### Error Handling
Expand All @@ -73,7 +73,7 @@ The Appwrite Ruby SDK raises `Appwrite::Exception` object with `message`, `code`
users = Appwrite::Users.new(client);

begin
user = users.create(userId: Appwrite::ID::unique(), email: "email@example.com", phone: "+123456789", password: "password", name: "Walter O'Brien");
user = users.create(user_id: Appwrite::ID::unique(), email: "email@example.com", phone: "+123456789", password: "password", name: "Walter O'Brien");
rescue Appwrite::Exception => error
puts error.message
end
Expand Down
2 changes: 1 addition & 1 deletion appwrite.gemspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Gem::Specification.new do |spec|
spec.name = 'appwrite'
spec.version = '28.4.0'
spec.version = '29.0.0'
spec.license = 'BSD-3-Clause'
spec.summary = 'Appwrite is an open-source self-hosted backend server that abstracts and simplifies complex and repetitive development tasks behind a very simple REST API'
spec.author = 'Appwrite Team'
Expand Down
17 changes: 0 additions & 17 deletions docs/examples/account/list-logs.md

This file was deleted.

4 changes: 2 additions & 2 deletions docs/examples/account/update-prefs.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ account = Account.new(client)

result = account.update_prefs(
prefs: {
"language" => "en",
"timezone" => "UTC",
"language" => 'en',
"timezone" => 'UTC',
"darkTheme" => true
}
)
Expand Down
3 changes: 1 addition & 2 deletions docs/examples/avatars/get-screenshot.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ avatars = Avatars.new(client)
result = avatars.get_screenshot(
url: 'https://example.com',
headers: {
"Authorization" => "Bearer token123",
"X-Custom-Header" => "value"
"Accept-Language" => 'en-US,en;q=0.9'
}, # optional
viewport_width: 1920, # optional
viewport_height: 1080, # optional
Expand Down
6 changes: 3 additions & 3 deletions docs/examples/databases/create-document.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ result = databases.create_document(
collection_id: '<COLLECTION_ID>',
document_id: '<DOCUMENT_ID>',
data: {
"username" => "walter.obrien",
"email" => "walter.obrien@example.com",
"fullName" => "Walter O'Brien",
"username" => 'walter.obrien',
"email" => 'walter.obrien@example.com',
"fullName" => 'Walter O\'Brien',
"age" => 30,
"isAdmin" => false
},
Expand Down
11 changes: 10 additions & 1 deletion docs/examples/databases/create-documents.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,16 @@ databases = Databases.new(client)
result = databases.create_documents(
database_id: '<DATABASE_ID>',
collection_id: '<COLLECTION_ID>',
documents: [],
documents: [
{
"$id": "example1",
"username": "walter.obrien",
"email": "walter.obrien@example.com",
"fullName": "Walter O'Brien",
"age": 30,
"isAdmin": false
}
],
transaction_id: '<TRANSACTION_ID>' # optional
)
```
2 changes: 1 addition & 1 deletion docs/examples/databases/create-index.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ result = databases.create_index(
collection_id: '<COLLECTION_ID>',
key: '<KEY>',
type: DatabasesIndexType::KEY,
attributes: [],
attributes: ["username"],
orders: [OrderBy::ASC], # optional
lengths: [] # optional
)
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/databases/delete-documents.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ databases = Databases.new(client)
result = databases.delete_documents(
database_id: '<DATABASE_ID>',
collection_id: '<COLLECTION_ID>',
queries: [], # optional
queries: ["{\"method\":\"equal\", \"attribute\":\"$id\", \"values\":[\"<DOCUMENT_ID>\"]}"], # optional
transaction_id: '<TRANSACTION_ID>' # optional
)
```
6 changes: 3 additions & 3 deletions docs/examples/databases/update-document.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ result = databases.update_document(
collection_id: '<COLLECTION_ID>',
document_id: '<DOCUMENT_ID>',
data: {
"username" => "walter.obrien",
"email" => "walter.obrien@example.com",
"fullName" => "Walter O'Brien",
"username" => 'walter.obrien',
"email" => 'walter.obrien@example.com',
"fullName" => 'Walter O\'Brien',
"age" => 33,
"isAdmin" => false
}, # optional
Expand Down
6 changes: 3 additions & 3 deletions docs/examples/databases/update-documents.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ result = databases.update_documents(
database_id: '<DATABASE_ID>',
collection_id: '<COLLECTION_ID>',
data: {
"username" => "walter.obrien",
"email" => "walter.obrien@example.com",
"fullName" => "Walter O'Brien",
"username" => 'walter.obrien',
"email" => 'walter.obrien@example.com',
"fullName" => 'Walter O\'Brien',
"age" => 33,
"isAdmin" => false
}, # optional
Expand Down
6 changes: 3 additions & 3 deletions docs/examples/databases/upsert-document.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ result = databases.upsert_document(
collection_id: '<COLLECTION_ID>',
document_id: '<DOCUMENT_ID>',
data: {
"username" => "walter.obrien",
"email" => "walter.obrien@example.com",
"fullName" => "Walter O'Brien",
"username" => 'walter.obrien',
"email" => 'walter.obrien@example.com',
"fullName" => 'Walter O\'Brien',
"age" => 30,
"isAdmin" => false
}, # optional
Expand Down
11 changes: 10 additions & 1 deletion docs/examples/databases/upsert-documents.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,16 @@ databases = Databases.new(client)
result = databases.upsert_documents(
database_id: '<DATABASE_ID>',
collection_id: '<COLLECTION_ID>',
documents: [],
documents: [
{
"$id": "example1",
"username": "walter.obrien",
"email": "walter.obrien@example.com",
"fullName": "Walter O'Brien",
"age": 30,
"isAdmin": false
}
],
transaction_id: '<TRANSACTION_ID>' # optional
)
```
6 changes: 3 additions & 3 deletions docs/examples/documentsdb/create-document.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ result = documents_db.create_document(
collection_id: '<COLLECTION_ID>',
document_id: '<DOCUMENT_ID>',
data: {
"username" => "walter.obrien",
"email" => "walter.obrien@example.com",
"fullName" => "Walter O'Brien",
"username" => 'walter.obrien',
"email" => 'walter.obrien@example.com',
"fullName" => 'Walter O\'Brien',
"age" => 30,
"isAdmin" => false
},
Expand Down
11 changes: 10 additions & 1 deletion docs/examples/documentsdb/create-documents.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,16 @@ documents_db = DocumentsDB.new(client)
result = documents_db.create_documents(
database_id: '<DATABASE_ID>',
collection_id: '<COLLECTION_ID>',
documents: [],
documents: [
{
"$id": "example1",
"username": "walter.obrien",
"email": "walter.obrien@example.com",
"fullName": "Walter O'Brien",
"age": 30,
"isAdmin": false
}
],
transaction_id: '<TRANSACTION_ID>' # optional
)
```
2 changes: 1 addition & 1 deletion docs/examples/documentsdb/create-index.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ result = documents_db.create_index(
collection_id: '<COLLECTION_ID>',
key: '<KEY>',
type: DocumentsDBIndexType::KEY,
attributes: [],
attributes: ["username"],
orders: [OrderBy::ASC], # optional
lengths: [] # optional
)
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/documentsdb/delete-documents.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ documents_db = DocumentsDB.new(client)
result = documents_db.delete_documents(
database_id: '<DATABASE_ID>',
collection_id: '<COLLECTION_ID>',
queries: [], # optional
queries: ["{\"method\":\"equal\", \"attribute\":\"$id\", \"values\":[\"<DOCUMENT_ID>\"]}"], # optional
transaction_id: '<TRANSACTION_ID>' # optional
)
```
11 changes: 10 additions & 1 deletion docs/examples/documentsdb/upsert-documents.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,16 @@ documents_db = DocumentsDB.new(client)
result = documents_db.upsert_documents(
database_id: '<DATABASE_ID>',
collection_id: '<COLLECTION_ID>',
documents: [],
documents: [
{
"$id": "example1",
"username": "walter.obrien",
"email": "walter.obrien@example.com",
"fullName": "Walter O'Brien",
"age": 30,
"isAdmin": false
}
],
transaction_id: '<TRANSACTION_ID>' # optional
)
```
2 changes: 1 addition & 1 deletion docs/examples/embeddings/create-text-embeddings.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ client = Client.new
embeddings = Embeddings.new(client)

result = embeddings.create_text_embeddings(
texts: [],
texts: ["Appwrite helps developers build applications.", "Find documents with semantic search."],
model: EmbeddingModel::NOMIC_EMBED_TEXT # optional
)
```
3 changes: 2 additions & 1 deletion docs/examples/functions/update.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ result = functions.update(
build_specification: 's-1vcpu-512mb', # optional
runtime_specification: 's-1vcpu-512mb', # optional
deployment_retention: 0, # optional
interval: 0 # optional
interval: 0, # optional
email_enabled: false # optional
)
```
4 changes: 3 additions & 1 deletion docs/examples/graphql/mutation.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ client = Client.new
graphql = Graphql.new(client)

result = graphql.mutation(
query: {}
query: {
"query" => 'mutation { accountUpdateName(name: "Walter") { name } }'
}
)
```
4 changes: 3 additions & 1 deletion docs/examples/graphql/query.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ client = Client.new
graphql = Graphql.new(client)

result = graphql.query(
query: {}
query: {
"query" => 'query { localeGet { ip } }'
}
)
```
2 changes: 1 addition & 1 deletion docs/examples/messaging/create-twilio-provider.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ messaging = Messaging.new(client)
result = messaging.create_twilio_provider(
provider_id: '<PROVIDER_ID>',
name: '<NAME>',
from: '+12065550100', # optional
from: '<FROM>', # optional
account_sid: '<ACCOUNT_SID>', # optional
auth_token: '<AUTH_TOKEN>', # optional
enabled: false # optional
Expand Down
5 changes: 4 additions & 1 deletion docs/examples/mongo/create-restoration.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ result = mongo.create_restoration(
type: 'backup', # optional
backup_id: '<BACKUP_ID>', # optional
target_database_id: '<TARGET_DATABASE_ID>', # optional
target_time: '2020-10-15T06:38:00.000+00:00' # optional
target_time: '2020-10-15T06:38:00.000+00:00', # optional
restore_mode: 'in_place', # optional
target_name: '<TARGET_NAME>', # optional
auto_promote: false # optional
)
```
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@ client = Client.new
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_key('<YOUR_API_KEY>') # Your secret API key

users = Users.new(client)
mongo = Mongo.new(client)

result = users.list_logs(
user_id: '<USER_ID>',
queries: [], # optional
total: false # optional
result = mongo.promote_restoration(
database_id: '<DATABASE_ID>',
restoration_id: '<RESTORATION_ID>'
)
```
5 changes: 4 additions & 1 deletion docs/examples/mysql/create-restoration.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ result = mysql.create_restoration(
type: 'backup', # optional
backup_id: '<BACKUP_ID>', # optional
target_database_id: '<TARGET_DATABASE_ID>', # optional
target_time: '2020-10-15T06:38:00.000+00:00' # optional
target_time: '2020-10-15T06:38:00.000+00:00', # optional
restore_mode: 'in_place', # optional
target_name: '<TARGET_NAME>', # optional
auto_promote: false # optional
)
```
Loading