update: generate docs examples as per latest 1.8.x source.

This commit is contained in:
Darshan
2025-06-19 18:13:27 +05:30
parent c7a3ffdb71
commit 974037ee38
6235 changed files with 96496 additions and 0 deletions
@@ -0,0 +1,11 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
account = Account.new(client)
result = account.create_anonymous_session()
@@ -0,0 +1,14 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
account = Account.new(client)
result = account.create_email_password_session(
email: 'email@example.com',
password: 'password'
)
@@ -0,0 +1,15 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
account = Account.new(client)
result = account.create_email_token(
user_id: '<USER_ID>',
email: 'email@example.com',
phrase: false # optional
)
@@ -0,0 +1,11 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
account = Account.new(client)
result = account.create_jwt()
@@ -0,0 +1,16 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
account = Account.new(client)
result = account.create_magic_url_token(
user_id: '<USER_ID>',
email: 'email@example.com',
url: 'https://example.com', # optional
phrase: false # optional
)
@@ -0,0 +1,15 @@
require 'appwrite'
include Appwrite
include Appwrite::Enums
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_session('') # The user session to authenticate with
account = Account.new(client)
result = account.create_mfa_authenticator(
type: AuthenticatorType::TOTP
)
@@ -0,0 +1,14 @@
require 'appwrite'
include Appwrite
include Appwrite::Enums
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
account = Account.new(client)
result = account.create_mfa_challenge(
factor: AuthenticationFactor::EMAIL
)
@@ -0,0 +1,12 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_session('') # The user session to authenticate with
account = Account.new(client)
result = account.create_mfa_recovery_codes()
@@ -0,0 +1,17 @@
require 'appwrite'
include Appwrite
include Appwrite::Enums
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
account = Account.new(client)
result = account.create_o_auth2_token(
provider: OAuthProvider::AMAZON,
success: 'https://example.com', # optional
failure: 'https://example.com', # optional
scopes: [] # optional
)
@@ -0,0 +1,14 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
account = Account.new(client)
result = account.create_phone_token(
user_id: '<USER_ID>',
phone: '+12065550100'
)
@@ -0,0 +1,12 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_session('') # The user session to authenticate with
account = Account.new(client)
result = account.create_phone_verification()
@@ -0,0 +1,15 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_session('') # The user session to authenticate with
account = Account.new(client)
result = account.create_recovery(
email: 'email@example.com',
url: 'https://example.com'
)
@@ -0,0 +1,14 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
account = Account.new(client)
result = account.create_session(
user_id: '<USER_ID>',
secret: '<SECRET>'
)
@@ -0,0 +1,14 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_session('') # The user session to authenticate with
account = Account.new(client)
result = account.create_verification(
url: 'https://example.com'
)
@@ -0,0 +1,16 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
account = Account.new(client)
result = account.create(
user_id: '<USER_ID>',
email: 'email@example.com',
password: '',
name: '<NAME>' # optional
)
@@ -0,0 +1,14 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_session('') # The user session to authenticate with
account = Account.new(client)
result = account.delete_identity(
identity_id: '<IDENTITY_ID>'
)
@@ -0,0 +1,15 @@
require 'appwrite'
include Appwrite
include Appwrite::Enums
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_session('') # The user session to authenticate with
account = Account.new(client)
result = account.delete_mfa_authenticator(
type: AuthenticatorType::TOTP
)
@@ -0,0 +1,14 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_session('') # The user session to authenticate with
account = Account.new(client)
result = account.delete_session(
session_id: '<SESSION_ID>'
)
@@ -0,0 +1,12 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_session('') # The user session to authenticate with
account = Account.new(client)
result = account.delete_sessions()
@@ -0,0 +1,12 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_session('') # The user session to authenticate with
account = Account.new(client)
result = account.get_mfa_recovery_codes()
@@ -0,0 +1,12 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_session('') # The user session to authenticate with
account = Account.new(client)
result = account.get_prefs()
@@ -0,0 +1,14 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_session('') # The user session to authenticate with
account = Account.new(client)
result = account.get_session(
session_id: '<SESSION_ID>'
)
@@ -0,0 +1,12 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_session('') # The user session to authenticate with
account = Account.new(client)
result = account.get()
@@ -0,0 +1,14 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_session('') # The user session to authenticate with
account = Account.new(client)
result = account.list_identities(
queries: [] # optional
)
@@ -0,0 +1,14 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_session('') # The user session to authenticate with
account = Account.new(client)
result = account.list_logs(
queries: [] # optional
)
@@ -0,0 +1,12 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_session('') # The user session to authenticate with
account = Account.new(client)
result = account.list_mfa_factors()
@@ -0,0 +1,12 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_session('') # The user session to authenticate with
account = Account.new(client)
result = account.list_sessions()
@@ -0,0 +1,15 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_session('') # The user session to authenticate with
account = Account.new(client)
result = account.update_email(
email: 'email@example.com',
password: 'password'
)
@@ -0,0 +1,14 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_session('') # The user session to authenticate with
account = Account.new(client)
result = account.update_mfa(
mfa: false
)
@@ -0,0 +1,14 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
account = Account.new(client)
result = account.update_magic_url_session(
user_id: '<USER_ID>',
secret: '<SECRET>'
)
@@ -0,0 +1,16 @@
require 'appwrite'
include Appwrite
include Appwrite::Enums
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_session('') # The user session to authenticate with
account = Account.new(client)
result = account.update_mfa_authenticator(
type: AuthenticatorType::TOTP,
otp: '<OTP>'
)
@@ -0,0 +1,15 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_session('') # The user session to authenticate with
account = Account.new(client)
result = account.update_mfa_challenge(
challenge_id: '<CHALLENGE_ID>',
otp: '<OTP>'
)
@@ -0,0 +1,12 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_session('') # The user session to authenticate with
account = Account.new(client)
result = account.update_mfa_recovery_codes()
@@ -0,0 +1,14 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_session('') # The user session to authenticate with
account = Account.new(client)
result = account.update_name(
name: '<NAME>'
)
@@ -0,0 +1,15 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_session('') # The user session to authenticate with
account = Account.new(client)
result = account.update_password(
password: '',
old_password: 'password' # optional
)
@@ -0,0 +1,14 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
account = Account.new(client)
result = account.update_phone_session(
user_id: '<USER_ID>',
secret: '<SECRET>'
)
@@ -0,0 +1,15 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_session('') # The user session to authenticate with
account = Account.new(client)
result = account.update_phone_verification(
user_id: '<USER_ID>',
secret: '<SECRET>'
)
@@ -0,0 +1,15 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_session('') # The user session to authenticate with
account = Account.new(client)
result = account.update_phone(
phone: '+12065550100',
password: 'password'
)
@@ -0,0 +1,14 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_session('') # The user session to authenticate with
account = Account.new(client)
result = account.update_prefs(
prefs: {}
)
@@ -0,0 +1,16 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_session('') # The user session to authenticate with
account = Account.new(client)
result = account.update_recovery(
user_id: '<USER_ID>',
secret: '<SECRET>',
password: ''
)
@@ -0,0 +1,14 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_session('') # The user session to authenticate with
account = Account.new(client)
result = account.update_session(
session_id: '<SESSION_ID>'
)
@@ -0,0 +1,12 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_session('') # The user session to authenticate with
account = Account.new(client)
result = account.update_status()
@@ -0,0 +1,15 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_session('') # The user session to authenticate with
account = Account.new(client)
result = account.update_verification(
user_id: '<USER_ID>',
secret: '<SECRET>'
)
@@ -0,0 +1,18 @@
require 'appwrite'
include Appwrite
include Appwrite::Enums
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_session('') # The user session to authenticate with
avatars = Avatars.new(client)
result = avatars.get_browser(
code: Browser::AVANT_BROWSER,
width: 0, # optional
height: 0, # optional
quality: -1 # optional
)
@@ -0,0 +1,18 @@
require 'appwrite'
include Appwrite
include Appwrite::Enums
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_session('') # The user session to authenticate with
avatars = Avatars.new(client)
result = avatars.get_credit_card(
code: CreditCard::AMERICAN_EXPRESS,
width: 0, # optional
height: 0, # optional
quality: -1 # optional
)
@@ -0,0 +1,14 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_session('') # The user session to authenticate with
avatars = Avatars.new(client)
result = avatars.get_favicon(
url: 'https://example.com'
)
@@ -0,0 +1,18 @@
require 'appwrite'
include Appwrite
include Appwrite::Enums
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_session('') # The user session to authenticate with
avatars = Avatars.new(client)
result = avatars.get_flag(
code: Flag::AFGHANISTAN,
width: 0, # optional
height: 0, # optional
quality: -1 # optional
)
@@ -0,0 +1,16 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_session('') # The user session to authenticate with
avatars = Avatars.new(client)
result = avatars.get_image(
url: 'https://example.com',
width: 0, # optional
height: 0 # optional
)
@@ -0,0 +1,17 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_session('') # The user session to authenticate with
avatars = Avatars.new(client)
result = avatars.get_initials(
name: '<NAME>', # optional
width: 0, # optional
height: 0, # optional
background: '' # optional
)
@@ -0,0 +1,17 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_session('') # The user session to authenticate with
avatars = Avatars.new(client)
result = avatars.get_qr(
text: '<TEXT>',
size: 1, # optional
margin: 0, # optional
download: false # optional
)
@@ -0,0 +1,19 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_key('<YOUR_API_KEY>') # Your secret API key
databases = Databases.new(client)
result = databases.create_boolean_attribute(
database_id: '<DATABASE_ID>',
collection_id: '<COLLECTION_ID>',
key: '',
required: false,
default: false, # optional
array: false # optional
)
@@ -0,0 +1,19 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_key('<YOUR_API_KEY>') # Your secret API key
databases = Databases.new(client)
result = databases.create_collection(
database_id: '<DATABASE_ID>',
collection_id: '<COLLECTION_ID>',
name: '<NAME>',
permissions: ["read("any")"], # optional
document_security: false, # optional
enabled: false # optional
)
@@ -0,0 +1,19 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_key('<YOUR_API_KEY>') # Your secret API key
databases = Databases.new(client)
result = databases.create_datetime_attribute(
database_id: '<DATABASE_ID>',
collection_id: '<COLLECTION_ID>',
key: '',
required: false,
default: '', # optional
array: false # optional
)
@@ -0,0 +1,19 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_session('') # The user session to authenticate with
.set_key('<YOUR_API_KEY>') # Your secret API key
.set_jwt('<YOUR_JWT>') # Your secret JSON Web Token
databases = Databases.new(client)
result = databases.create_document(
database_id: '<DATABASE_ID>',
collection_id: '<COLLECTION_ID>',
document_id: '<DOCUMENT_ID>',
data: {},
permissions: ["read("any")"] # optional
)
@@ -0,0 +1,16 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_admin('') #
.set_key('<YOUR_API_KEY>') # Your secret API key
databases = Databases.new(client)
result = databases.create_documents(
database_id: '<DATABASE_ID>',
collection_id: '<COLLECTION_ID>',
documents: []
)
@@ -0,0 +1,19 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_key('<YOUR_API_KEY>') # Your secret API key
databases = Databases.new(client)
result = databases.create_email_attribute(
database_id: '<DATABASE_ID>',
collection_id: '<COLLECTION_ID>',
key: '',
required: false,
default: 'email@example.com', # optional
array: false # optional
)
@@ -0,0 +1,20 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_key('<YOUR_API_KEY>') # Your secret API key
databases = Databases.new(client)
result = databases.create_enum_attribute(
database_id: '<DATABASE_ID>',
collection_id: '<COLLECTION_ID>',
key: '',
elements: [],
required: false,
default: '<DEFAULT>', # optional
array: false # optional
)
@@ -0,0 +1,21 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_key('<YOUR_API_KEY>') # Your secret API key
databases = Databases.new(client)
result = databases.create_float_attribute(
database_id: '<DATABASE_ID>',
collection_id: '<COLLECTION_ID>',
key: '',
required: false,
min: null, # optional
max: null, # optional
default: null, # optional
array: false # optional
)
@@ -0,0 +1,21 @@
require 'appwrite'
include Appwrite
include Appwrite::Enums
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_key('<YOUR_API_KEY>') # Your secret API key
databases = Databases.new(client)
result = databases.create_index(
database_id: '<DATABASE_ID>',
collection_id: '<COLLECTION_ID>',
key: '',
type: IndexType::KEY,
attributes: [],
orders: [], # optional
lengths: [] # optional
)
@@ -0,0 +1,21 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_key('<YOUR_API_KEY>') # Your secret API key
databases = Databases.new(client)
result = databases.create_integer_attribute(
database_id: '<DATABASE_ID>',
collection_id: '<COLLECTION_ID>',
key: '',
required: false,
min: null, # optional
max: null, # optional
default: null, # optional
array: false # optional
)
@@ -0,0 +1,19 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_key('<YOUR_API_KEY>') # Your secret API key
databases = Databases.new(client)
result = databases.create_ip_attribute(
database_id: '<DATABASE_ID>',
collection_id: '<COLLECTION_ID>',
key: '',
required: false,
default: '', # optional
array: false # optional
)
@@ -0,0 +1,22 @@
require 'appwrite'
include Appwrite
include Appwrite::Enums
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_key('<YOUR_API_KEY>') # Your secret API key
databases = Databases.new(client)
result = databases.create_relationship_attribute(
database_id: '<DATABASE_ID>',
collection_id: '<COLLECTION_ID>',
related_collection_id: '<RELATED_COLLECTION_ID>',
type: RelationshipType::ONETOONE,
two_way: false, # optional
key: '', # optional
two_way_key: '', # optional
on_delete: RelationMutate::CASCADE # optional
)
@@ -0,0 +1,21 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_key('<YOUR_API_KEY>') # Your secret API key
databases = Databases.new(client)
result = databases.create_string_attribute(
database_id: '<DATABASE_ID>',
collection_id: '<COLLECTION_ID>',
key: '',
size: 1,
required: false,
default: '<DEFAULT>', # optional
array: false, # optional
encrypt: false # optional
)
@@ -0,0 +1,19 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_key('<YOUR_API_KEY>') # Your secret API key
databases = Databases.new(client)
result = databases.create_url_attribute(
database_id: '<DATABASE_ID>',
collection_id: '<COLLECTION_ID>',
key: '',
required: false,
default: 'https://example.com', # optional
array: false # optional
)
@@ -0,0 +1,16 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_key('<YOUR_API_KEY>') # Your secret API key
databases = Databases.new(client)
result = databases.create(
database_id: '<DATABASE_ID>',
name: '<NAME>',
enabled: false # optional
)
@@ -0,0 +1,19 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_key('<YOUR_API_KEY>') # Your secret API key
databases = Databases.new(client)
result = databases.decrement_document_attribute(
database_id: '<DATABASE_ID>',
collection_id: '<COLLECTION_ID>',
document_id: '<DOCUMENT_ID>',
attribute: '',
value: null, # optional
min: null # optional
)
@@ -0,0 +1,16 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_key('<YOUR_API_KEY>') # Your secret API key
databases = Databases.new(client)
result = databases.delete_attribute(
database_id: '<DATABASE_ID>',
collection_id: '<COLLECTION_ID>',
key: ''
)
@@ -0,0 +1,15 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_key('<YOUR_API_KEY>') # Your secret API key
databases = Databases.new(client)
result = databases.delete_collection(
database_id: '<DATABASE_ID>',
collection_id: '<COLLECTION_ID>'
)
@@ -0,0 +1,16 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_session('') # The user session to authenticate with
databases = Databases.new(client)
result = databases.delete_document(
database_id: '<DATABASE_ID>',
collection_id: '<COLLECTION_ID>',
document_id: '<DOCUMENT_ID>'
)
@@ -0,0 +1,16 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_key('<YOUR_API_KEY>') # Your secret API key
databases = Databases.new(client)
result = databases.delete_documents(
database_id: '<DATABASE_ID>',
collection_id: '<COLLECTION_ID>',
queries: [] # optional
)
@@ -0,0 +1,16 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_key('<YOUR_API_KEY>') # Your secret API key
databases = Databases.new(client)
result = databases.delete_index(
database_id: '<DATABASE_ID>',
collection_id: '<COLLECTION_ID>',
key: ''
)
@@ -0,0 +1,14 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_key('<YOUR_API_KEY>') # Your secret API key
databases = Databases.new(client)
result = databases.delete(
database_id: '<DATABASE_ID>'
)
@@ -0,0 +1,16 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_key('<YOUR_API_KEY>') # Your secret API key
databases = Databases.new(client)
result = databases.get_attribute(
database_id: '<DATABASE_ID>',
collection_id: '<COLLECTION_ID>',
key: ''
)
@@ -0,0 +1,15 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_key('<YOUR_API_KEY>') # Your secret API key
databases = Databases.new(client)
result = databases.get_collection(
database_id: '<DATABASE_ID>',
collection_id: '<COLLECTION_ID>'
)
@@ -0,0 +1,17 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_session('') # The user session to authenticate with
databases = Databases.new(client)
result = databases.get_document(
database_id: '<DATABASE_ID>',
collection_id: '<COLLECTION_ID>',
document_id: '<DOCUMENT_ID>',
queries: [] # optional
)
@@ -0,0 +1,16 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_key('<YOUR_API_KEY>') # Your secret API key
databases = Databases.new(client)
result = databases.get_index(
database_id: '<DATABASE_ID>',
collection_id: '<COLLECTION_ID>',
key: ''
)
@@ -0,0 +1,14 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_key('<YOUR_API_KEY>') # Your secret API key
databases = Databases.new(client)
result = databases.get(
database_id: '<DATABASE_ID>'
)
@@ -0,0 +1,19 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_key('<YOUR_API_KEY>') # Your secret API key
databases = Databases.new(client)
result = databases.increment_document_attribute(
database_id: '<DATABASE_ID>',
collection_id: '<COLLECTION_ID>',
document_id: '<DOCUMENT_ID>',
attribute: '',
value: null, # optional
max: null # optional
)
@@ -0,0 +1,16 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_key('<YOUR_API_KEY>') # Your secret API key
databases = Databases.new(client)
result = databases.list_attributes(
database_id: '<DATABASE_ID>',
collection_id: '<COLLECTION_ID>',
queries: [] # optional
)
@@ -0,0 +1,16 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_key('<YOUR_API_KEY>') # Your secret API key
databases = Databases.new(client)
result = databases.list_collections(
database_id: '<DATABASE_ID>',
queries: [], # optional
search: '<SEARCH>' # optional
)
@@ -0,0 +1,16 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_session('') # The user session to authenticate with
databases = Databases.new(client)
result = databases.list_documents(
database_id: '<DATABASE_ID>',
collection_id: '<COLLECTION_ID>',
queries: [] # optional
)
@@ -0,0 +1,16 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_key('<YOUR_API_KEY>') # Your secret API key
databases = Databases.new(client)
result = databases.list_indexes(
database_id: '<DATABASE_ID>',
collection_id: '<COLLECTION_ID>',
queries: [] # optional
)
@@ -0,0 +1,15 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_key('<YOUR_API_KEY>') # Your secret API key
databases = Databases.new(client)
result = databases.list(
queries: [], # optional
search: '<SEARCH>' # optional
)
@@ -0,0 +1,19 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_key('<YOUR_API_KEY>') # Your secret API key
databases = Databases.new(client)
result = databases.update_boolean_attribute(
database_id: '<DATABASE_ID>',
collection_id: '<COLLECTION_ID>',
key: '',
required: false,
default: false,
new_key: '' # optional
)
@@ -0,0 +1,19 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_key('<YOUR_API_KEY>') # Your secret API key
databases = Databases.new(client)
result = databases.update_collection(
database_id: '<DATABASE_ID>',
collection_id: '<COLLECTION_ID>',
name: '<NAME>',
permissions: ["read("any")"], # optional
document_security: false, # optional
enabled: false # optional
)
@@ -0,0 +1,19 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_key('<YOUR_API_KEY>') # Your secret API key
databases = Databases.new(client)
result = databases.update_datetime_attribute(
database_id: '<DATABASE_ID>',
collection_id: '<COLLECTION_ID>',
key: '',
required: false,
default: '',
new_key: '' # optional
)
@@ -0,0 +1,18 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_session('') # The user session to authenticate with
databases = Databases.new(client)
result = databases.update_document(
database_id: '<DATABASE_ID>',
collection_id: '<COLLECTION_ID>',
document_id: '<DOCUMENT_ID>',
data: {}, # optional
permissions: ["read("any")"] # optional
)
@@ -0,0 +1,17 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_key('<YOUR_API_KEY>') # Your secret API key
databases = Databases.new(client)
result = databases.update_documents(
database_id: '<DATABASE_ID>',
collection_id: '<COLLECTION_ID>',
data: {}, # optional
queries: [] # optional
)
@@ -0,0 +1,19 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_key('<YOUR_API_KEY>') # Your secret API key
databases = Databases.new(client)
result = databases.update_email_attribute(
database_id: '<DATABASE_ID>',
collection_id: '<COLLECTION_ID>',
key: '',
required: false,
default: 'email@example.com',
new_key: '' # optional
)
@@ -0,0 +1,20 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_key('<YOUR_API_KEY>') # Your secret API key
databases = Databases.new(client)
result = databases.update_enum_attribute(
database_id: '<DATABASE_ID>',
collection_id: '<COLLECTION_ID>',
key: '',
elements: [],
required: false,
default: '<DEFAULT>',
new_key: '' # optional
)
@@ -0,0 +1,21 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_key('<YOUR_API_KEY>') # Your secret API key
databases = Databases.new(client)
result = databases.update_float_attribute(
database_id: '<DATABASE_ID>',
collection_id: '<COLLECTION_ID>',
key: '',
required: false,
default: null,
min: null, # optional
max: null, # optional
new_key: '' # optional
)
@@ -0,0 +1,21 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_key('<YOUR_API_KEY>') # Your secret API key
databases = Databases.new(client)
result = databases.update_integer_attribute(
database_id: '<DATABASE_ID>',
collection_id: '<COLLECTION_ID>',
key: '',
required: false,
default: null,
min: null, # optional
max: null, # optional
new_key: '' # optional
)
@@ -0,0 +1,19 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_key('<YOUR_API_KEY>') # Your secret API key
databases = Databases.new(client)
result = databases.update_ip_attribute(
database_id: '<DATABASE_ID>',
collection_id: '<COLLECTION_ID>',
key: '',
required: false,
default: '',
new_key: '' # optional
)
@@ -0,0 +1,18 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_key('<YOUR_API_KEY>') # Your secret API key
databases = Databases.new(client)
result = databases.update_relationship_attribute(
database_id: '<DATABASE_ID>',
collection_id: '<COLLECTION_ID>',
key: '',
on_delete: RelationMutate::CASCADE, # optional
new_key: '' # optional
)
@@ -0,0 +1,20 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_key('<YOUR_API_KEY>') # Your secret API key
databases = Databases.new(client)
result = databases.update_string_attribute(
database_id: '<DATABASE_ID>',
collection_id: '<COLLECTION_ID>',
key: '',
required: false,
default: '<DEFAULT>',
size: 1, # optional
new_key: '' # optional
)
@@ -0,0 +1,19 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_key('<YOUR_API_KEY>') # Your secret API key
databases = Databases.new(client)
result = databases.update_url_attribute(
database_id: '<DATABASE_ID>',
collection_id: '<COLLECTION_ID>',
key: '',
required: false,
default: 'https://example.com',
new_key: '' # optional
)
@@ -0,0 +1,16 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_key('<YOUR_API_KEY>') # Your secret API key
databases = Databases.new(client)
result = databases.update(
database_id: '<DATABASE_ID>',
name: '<NAME>',
enabled: false # optional
)
@@ -0,0 +1,17 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_session('') # The user session to authenticate with
.set_key('<YOUR_API_KEY>') # Your secret API key
.set_jwt('<YOUR_JWT>') # Your secret JSON Web Token
databases = Databases.new(client)
result = databases.upsert_document(
database_id: '<DATABASE_ID>',
collection_id: '<COLLECTION_ID>',
document_id: '<DOCUMENT_ID>'
)
@@ -0,0 +1,15 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_admin('') #
.set_key('<YOUR_API_KEY>') # Your secret API key
databases = Databases.new(client)
result = databases.upsert_documents(
database_id: '<DATABASE_ID>',
collection_id: '<COLLECTION_ID>'
)
@@ -0,0 +1,18 @@
require 'appwrite'
include Appwrite
client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_key('<YOUR_API_KEY>') # Your secret API key
functions = Functions.new(client)
result = functions.create_deployment(
function_id: '<FUNCTION_ID>',
code: InputFile.from_path('dir/file.png'),
activate: false,
entrypoint: '<ENTRYPOINT>', # optional
commands: '<COMMANDS>' # optional
)

Some files were not shown because too many files have changed in this diff Show More