appwrite 2.1.1 → 2.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -1
  3. data/README.md +7 -8
  4. data/appwrite.gemspec +1 -1
  5. data/docs/examples/account/create-recovery.md +1 -1
  6. data/docs/examples/account/create-verification.md +1 -1
  7. data/docs/examples/account/delete-session.md +1 -1
  8. data/docs/examples/account/delete-sessions.md +1 -1
  9. data/docs/examples/account/delete.md +1 -1
  10. data/docs/examples/account/get-logs.md +1 -1
  11. data/docs/examples/account/get-prefs.md +1 -1
  12. data/docs/examples/account/get-session.md +15 -0
  13. data/docs/examples/account/get-sessions.md +1 -1
  14. data/docs/examples/account/get.md +1 -1
  15. data/docs/examples/account/update-email.md +1 -1
  16. data/docs/examples/account/update-name.md +1 -1
  17. data/docs/examples/account/update-password.md +1 -1
  18. data/docs/examples/account/update-prefs.md +1 -1
  19. data/docs/examples/account/update-recovery.md +1 -1
  20. data/docs/examples/account/update-verification.md +1 -1
  21. data/docs/examples/avatars/get-q-r.md +1 -1
  22. data/docs/examples/functions/create.md +1 -1
  23. data/docs/examples/health/get-d-b.md +1 -1
  24. data/docs/examples/locale/get-countries-e-u.md +1 -1
  25. data/docs/examples/teams/update-membership-status.md +1 -1
  26. data/docs/examples/users/update-email.md +15 -0
  27. data/docs/examples/users/update-name.md +15 -0
  28. data/docs/examples/users/update-password.md +15 -0
  29. data/docs/examples/users/update-verification.md +15 -0
  30. data/lib/appwrite/client.rb +3 -3
  31. data/lib/appwrite/services/account.rb +151 -46
  32. data/lib/appwrite/services/avatars.rb +125 -42
  33. data/lib/appwrite/services/database.rb +199 -53
  34. data/lib/appwrite/services/functions.rb +223 -61
  35. data/lib/appwrite/services/health.rb +13 -25
  36. data/lib/appwrite/services/locale.rb +8 -15
  37. data/lib/appwrite/services/storage.rb +127 -38
  38. data/lib/appwrite/services/teams.rb +162 -42
  39. data/lib/appwrite/services/users.rb +197 -33
  40. metadata +7 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1fe06a326eed6537ffa429178e237f1c925b0f40224824f775b61771603f52d5
4
- data.tar.gz: 8d7847c0288e59b751e0c5aa37a602609c5509c13eb5729952b2eb5699d929ca
3
+ metadata.gz: 213800ebfb3b9439c2c435494dc283e25110d1747179bd06c60a17041c3fdb6f
4
+ data.tar.gz: e93c76057871b72b7272798f1dc79001f7850acff9959c735a1cf6b760a23e87
5
5
  SHA512:
6
- metadata.gz: c93b91e386e903cc480934818bdb93a55538469cb8f512112daa407946e30179c81a6a41f8838ecc2f06267373363041582614d9dee56dfa8d2efeacc97d2602
7
- data.tar.gz: 17dc4accecde0078a260f062f30ea8bfa039687f4c978fcfe09c9be14897d67260bfa9ed3355bd7d65c498ad913e21ff2a87e275f27aaebeb9a42043d957a1d6
6
+ metadata.gz: 2efe4ce3fd7b0f65933968fc84b3e17ad16c37fc4c3f7a923ff25dccc6e8fcd2f51cb566d30d4e5b2f4b99f387125de50fb694b78914eab15dcfea622eb05581
7
+ data.tar.gz: fa1f5bfb07204da80ab47d0f293ef97fd2d45c70bbd91aee712957688a8c8bd51a022015c9114f2f2cebf089f34d4f02fa4bc5dbbbd8bae7932ab94b76e59f70
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem 'mime-types', '~> 3.1'
3
+ gem 'mime-types', '~> 3.3.1'
4
4
  gemspec
data/README.md CHANGED
@@ -1,15 +1,14 @@
1
1
  # Appwrite Ruby SDK
2
2
 
3
3
  ![License](https://img.shields.io/github/license/appwrite/sdk-for-ruby.svg?style=flat-square)
4
- ![Version](https://img.shields.io/badge/api%20version-0.8.0-blue.svg?style=flat-square)
4
+ ![Version](https://img.shields.io/badge/api%20version-0.10.0-blue.svg?style=flat-square)
5
+ [![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator)
5
6
  [![Twitter Account](https://img.shields.io/twitter/follow/appwrite_io?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite_io)
6
7
  [![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord)
7
8
 
8
- **This SDK is compatible with Appwrite server version 0.8.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-ruby/releases).**
9
+ **This SDK is compatible with Appwrite server version 0.10.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-ruby/releases).**
9
10
 
10
- Appwrite is an open-source backend as a service server that abstract and simplify 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.
11
- Use the Ruby SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools.
12
- For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)
11
+ Appwrite is an open-source backend as a service server that abstract and simplify 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)
13
12
 
14
13
  ![Appwrite](https://appwrite.io/images/github.png)
15
14
 
@@ -25,7 +24,7 @@ gem install appwrite --save
25
24
  ## Getting Started
26
25
 
27
26
  ### Init your SDK
28
- Initialize your SDK code with your project ID which can be found in your project settings page and your new API secret Key from project's API keys section.
27
+ Initialize your SDK with your Appwrite server API endpoint and project ID which can be found in your project settings page and your new API secret Key from project's API keys section.
29
28
 
30
29
  ```ruby
31
30
  require 'appwrite'
@@ -41,7 +40,7 @@ client
41
40
  ```
42
41
 
43
42
  ### Make Your First Request
44
- Once your SDK object is set, create any of the Appwrite service objects and choose any request to send. Full documentation for any service method you would like to use can be found in your SDK documentation or in the API References section.
43
+ Once your SDK object is set, create any of the Appwrite service objects and choose any request to send. Full documentation for any service method you would like to use can be found in your SDK documentation or in the [API References](https://appwrite.io/docs) section.
45
44
 
46
45
  ```ruby
47
46
  users = Appwrite::Users.new(client);
@@ -81,7 +80,7 @@ end
81
80
  ```
82
81
 
83
82
  ### Learn more
84
- You can use followng resources to learn more and get help
83
+ You can use the following resources to learn more and get help
85
84
  - 🚀 [Getting Started Tutorial](https://appwrite.io/docs/getting-started-for-server)
86
85
  - 📜 [Appwrite Docs](https://appwrite.io/docs)
87
86
  - 💬 [Discord Community](https://appwrite.io/discord)
data/appwrite.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
 
3
3
  s.name = 'appwrite'
4
- s.version = '2.1.1'
4
+ s.version = '2.4.0'
5
5
  s.summary = "Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API"
6
6
  s.author = 'Appwrite Team'
7
7
  s.homepage = 'https://appwrite.io/support'
@@ -5,7 +5,7 @@ client = Appwrite::Client.new()
5
5
  client
6
6
  .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
7
7
  .set_project('5df5acd0d48c2') # Your project ID
8
- .set_j_w_t('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') # Your secret JSON Web Token
8
+ .set_jwt('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') # Your secret JSON Web Token
9
9
  ;
10
10
 
11
11
  account = Appwrite::Account.new(client);
@@ -5,7 +5,7 @@ client = Appwrite::Client.new()
5
5
  client
6
6
  .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
7
7
  .set_project('5df5acd0d48c2') # Your project ID
8
- .set_j_w_t('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') # Your secret JSON Web Token
8
+ .set_jwt('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') # Your secret JSON Web Token
9
9
  ;
10
10
 
11
11
  account = Appwrite::Account.new(client);
@@ -5,7 +5,7 @@ client = Appwrite::Client.new()
5
5
  client
6
6
  .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
7
7
  .set_project('5df5acd0d48c2') # Your project ID
8
- .set_j_w_t('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') # Your secret JSON Web Token
8
+ .set_jwt('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') # Your secret JSON Web Token
9
9
  ;
10
10
 
11
11
  account = Appwrite::Account.new(client);
@@ -5,7 +5,7 @@ client = Appwrite::Client.new()
5
5
  client
6
6
  .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
7
7
  .set_project('5df5acd0d48c2') # Your project ID
8
- .set_j_w_t('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') # Your secret JSON Web Token
8
+ .set_jwt('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') # Your secret JSON Web Token
9
9
  ;
10
10
 
11
11
  account = Appwrite::Account.new(client);
@@ -5,7 +5,7 @@ client = Appwrite::Client.new()
5
5
  client
6
6
  .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
7
7
  .set_project('5df5acd0d48c2') # Your project ID
8
- .set_j_w_t('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') # Your secret JSON Web Token
8
+ .set_jwt('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') # Your secret JSON Web Token
9
9
  ;
10
10
 
11
11
  account = Appwrite::Account.new(client);
@@ -5,7 +5,7 @@ client = Appwrite::Client.new()
5
5
  client
6
6
  .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
7
7
  .set_project('5df5acd0d48c2') # Your project ID
8
- .set_j_w_t('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') # Your secret JSON Web Token
8
+ .set_jwt('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') # Your secret JSON Web Token
9
9
  ;
10
10
 
11
11
  account = Appwrite::Account.new(client);
@@ -5,7 +5,7 @@ client = Appwrite::Client.new()
5
5
  client
6
6
  .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
7
7
  .set_project('5df5acd0d48c2') # Your project ID
8
- .set_j_w_t('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') # Your secret JSON Web Token
8
+ .set_jwt('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') # Your secret JSON Web Token
9
9
  ;
10
10
 
11
11
  account = Appwrite::Account.new(client);
@@ -0,0 +1,15 @@
1
+ require 'appwrite'
2
+
3
+ client = Appwrite::Client.new()
4
+
5
+ client
6
+ .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
7
+ .set_project('5df5acd0d48c2') # Your project ID
8
+ .set_jwt('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') # Your secret JSON Web Token
9
+ ;
10
+
11
+ account = Appwrite::Account.new(client);
12
+
13
+ response = account.get_session(session_id: '[SESSION_ID]');
14
+
15
+ puts response
@@ -5,7 +5,7 @@ client = Appwrite::Client.new()
5
5
  client
6
6
  .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
7
7
  .set_project('5df5acd0d48c2') # Your project ID
8
- .set_j_w_t('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') # Your secret JSON Web Token
8
+ .set_jwt('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') # Your secret JSON Web Token
9
9
  ;
10
10
 
11
11
  account = Appwrite::Account.new(client);
@@ -5,7 +5,7 @@ client = Appwrite::Client.new()
5
5
  client
6
6
  .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
7
7
  .set_project('5df5acd0d48c2') # Your project ID
8
- .set_j_w_t('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') # Your secret JSON Web Token
8
+ .set_jwt('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') # Your secret JSON Web Token
9
9
  ;
10
10
 
11
11
  account = Appwrite::Account.new(client);
@@ -5,7 +5,7 @@ client = Appwrite::Client.new()
5
5
  client
6
6
  .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
7
7
  .set_project('5df5acd0d48c2') # Your project ID
8
- .set_j_w_t('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') # Your secret JSON Web Token
8
+ .set_jwt('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') # Your secret JSON Web Token
9
9
  ;
10
10
 
11
11
  account = Appwrite::Account.new(client);
@@ -5,7 +5,7 @@ client = Appwrite::Client.new()
5
5
  client
6
6
  .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
7
7
  .set_project('5df5acd0d48c2') # Your project ID
8
- .set_j_w_t('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') # Your secret JSON Web Token
8
+ .set_jwt('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') # Your secret JSON Web Token
9
9
  ;
10
10
 
11
11
  account = Appwrite::Account.new(client);
@@ -5,7 +5,7 @@ client = Appwrite::Client.new()
5
5
  client
6
6
  .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
7
7
  .set_project('5df5acd0d48c2') # Your project ID
8
- .set_j_w_t('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') # Your secret JSON Web Token
8
+ .set_jwt('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') # Your secret JSON Web Token
9
9
  ;
10
10
 
11
11
  account = Appwrite::Account.new(client);
@@ -5,7 +5,7 @@ client = Appwrite::Client.new()
5
5
  client
6
6
  .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
7
7
  .set_project('5df5acd0d48c2') # Your project ID
8
- .set_j_w_t('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') # Your secret JSON Web Token
8
+ .set_jwt('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') # Your secret JSON Web Token
9
9
  ;
10
10
 
11
11
  account = Appwrite::Account.new(client);
@@ -5,7 +5,7 @@ client = Appwrite::Client.new()
5
5
  client
6
6
  .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
7
7
  .set_project('5df5acd0d48c2') # Your project ID
8
- .set_j_w_t('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') # Your secret JSON Web Token
8
+ .set_jwt('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') # Your secret JSON Web Token
9
9
  ;
10
10
 
11
11
  account = Appwrite::Account.new(client);
@@ -5,7 +5,7 @@ client = Appwrite::Client.new()
5
5
  client
6
6
  .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
7
7
  .set_project('5df5acd0d48c2') # Your project ID
8
- .set_j_w_t('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') # Your secret JSON Web Token
8
+ .set_jwt('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') # Your secret JSON Web Token
9
9
  ;
10
10
 
11
11
  account = Appwrite::Account.new(client);
@@ -10,6 +10,6 @@ client
10
10
 
11
11
  avatars = Appwrite::Avatars.new(client);
12
12
 
13
- response = avatars.get_q_r(text: '[TEXT]');
13
+ response = avatars.get_qr(text: '[TEXT]');
14
14
 
15
15
  puts response
@@ -10,6 +10,6 @@ client
10
10
 
11
11
  functions = Appwrite::Functions.new(client);
12
12
 
13
- response = functions.create(name: '[NAME]', execute: [], env: 'dotnet-3.1');
13
+ response = functions.create(name: '[NAME]', execute: [], runtime: 'dotnet-5.0');
14
14
 
15
15
  puts response
@@ -10,6 +10,6 @@ client
10
10
 
11
11
  health = Appwrite::Health.new(client);
12
12
 
13
- response = health.get_d_b();
13
+ response = health.get_db();
14
14
 
15
15
  puts response
@@ -10,6 +10,6 @@ client
10
10
 
11
11
  locale = Appwrite::Locale.new(client);
12
12
 
13
- response = locale.get_countries_e_u();
13
+ response = locale.get_countries_eu();
14
14
 
15
15
  puts response
@@ -5,7 +5,7 @@ client = Appwrite::Client.new()
5
5
  client
6
6
  .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
7
7
  .set_project('5df5acd0d48c2') # Your project ID
8
- .set_j_w_t('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') # Your secret JSON Web Token
8
+ .set_jwt('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') # Your secret JSON Web Token
9
9
  ;
10
10
 
11
11
  teams = Appwrite::Teams.new(client);
@@ -0,0 +1,15 @@
1
+ require 'appwrite'
2
+
3
+ client = Appwrite::Client.new()
4
+
5
+ client
6
+ .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
7
+ .set_project('5df5acd0d48c2') # Your project ID
8
+ .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
9
+ ;
10
+
11
+ users = Appwrite::Users.new(client);
12
+
13
+ response = users.update_email(user_id: '[USER_ID]', email: 'email@example.com');
14
+
15
+ puts response
@@ -0,0 +1,15 @@
1
+ require 'appwrite'
2
+
3
+ client = Appwrite::Client.new()
4
+
5
+ client
6
+ .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
7
+ .set_project('5df5acd0d48c2') # Your project ID
8
+ .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
9
+ ;
10
+
11
+ users = Appwrite::Users.new(client);
12
+
13
+ response = users.update_name(user_id: '[USER_ID]', name: '[NAME]');
14
+
15
+ puts response
@@ -0,0 +1,15 @@
1
+ require 'appwrite'
2
+
3
+ client = Appwrite::Client.new()
4
+
5
+ client
6
+ .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
7
+ .set_project('5df5acd0d48c2') # Your project ID
8
+ .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
9
+ ;
10
+
11
+ users = Appwrite::Users.new(client);
12
+
13
+ response = users.update_password(user_id: '[USER_ID]', password: 'password');
14
+
15
+ puts response
@@ -0,0 +1,15 @@
1
+ require 'appwrite'
2
+
3
+ client = Appwrite::Client.new()
4
+
5
+ client
6
+ .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
7
+ .set_project('5df5acd0d48c2') # Your project ID
8
+ .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
9
+ ;
10
+
11
+ users = Appwrite::Users.new(client);
12
+
13
+ response = users.update_verification(user_id: '[USER_ID]', email_verification: false);
14
+
15
+ puts response
@@ -20,8 +20,8 @@ module Appwrite
20
20
  @headers = {
21
21
  'content-type' => '',
22
22
  'user-agent' => RUBY_PLATFORM + ':ruby-' + RUBY_VERSION,
23
- 'x-sdk-version' => 'appwrite:ruby:2.1.1',
24
- 'X-Appwrite-Response-Format' => '0.8.0'
23
+ 'x-sdk-version' => 'appwrite:ruby:2.4.0',
24
+ 'X-Appwrite-Response-Format' => '0.10.0'
25
25
  }
26
26
  @endpoint = 'https://appwrite.io/v1';
27
27
  end
@@ -38,7 +38,7 @@ module Appwrite
38
38
  return self
39
39
  end
40
40
 
41
- def set_j_w_t(value)
41
+ def set_jwt(value)
42
42
  add_header('x-appwrite-jwt', value)
43
43
 
44
44
  return self
@@ -4,8 +4,7 @@ module Appwrite
4
4
  def get()
5
5
  path = '/account'
6
6
 
7
- params = {
8
- }
7
+ params = {}
9
8
 
10
9
  return @client.call('get', path, {
11
10
  'content-type' => 'application/json',
@@ -15,8 +14,7 @@ module Appwrite
15
14
  def delete()
16
15
  path = '/account'
17
16
 
18
- params = {
19
- }
17
+ params = {}
20
18
 
21
19
  return @client.call('delete', path, {
22
20
  'content-type' => 'application/json',
@@ -24,12 +22,25 @@ module Appwrite
24
22
  end
25
23
 
26
24
  def update_email(email:, password:)
25
+ if email.nil?
26
+ raise Appwrite::Exception.new('Missing required parameter: "email"')
27
+ end
28
+
29
+ if password.nil?
30
+ raise Appwrite::Exception.new('Missing required parameter: "password"')
31
+ end
32
+
27
33
  path = '/account/email'
28
34
 
29
- params = {
30
- 'email': email,
31
- 'password': password
32
- }
35
+ params = {}
36
+
37
+ if !email.nil?
38
+ params[:email] = email
39
+ end
40
+
41
+ if !password.nil?
42
+ params[:password] = password
43
+ end
33
44
 
34
45
  return @client.call('patch', path, {
35
46
  'content-type' => 'application/json',
@@ -39,8 +50,7 @@ module Appwrite
39
50
  def get_logs()
40
51
  path = '/account/logs'
41
52
 
42
- params = {
43
- }
53
+ params = {}
44
54
 
45
55
  return @client.call('get', path, {
46
56
  'content-type' => 'application/json',
@@ -48,24 +58,39 @@ module Appwrite
48
58
  end
49
59
 
50
60
  def update_name(name:)
61
+ if name.nil?
62
+ raise Appwrite::Exception.new('Missing required parameter: "name"')
63
+ end
64
+
51
65
  path = '/account/name'
52
66
 
53
- params = {
54
- 'name': name
55
- }
67
+ params = {}
68
+
69
+ if !name.nil?
70
+ params[:name] = name
71
+ end
56
72
 
57
73
  return @client.call('patch', path, {
58
74
  'content-type' => 'application/json',
59
75
  }, params);
60
76
  end
61
77
 
62
- def update_password(password:, old_password: '')
78
+ def update_password(password:, old_password: nil)
79
+ if password.nil?
80
+ raise Appwrite::Exception.new('Missing required parameter: "password"')
81
+ end
82
+
63
83
  path = '/account/password'
64
84
 
65
- params = {
66
- 'password': password,
67
- 'oldPassword': old_password
68
- }
85
+ params = {}
86
+
87
+ if !password.nil?
88
+ params[:password] = password
89
+ end
90
+
91
+ if !old_password.nil?
92
+ params[:oldPassword] = old_password
93
+ end
69
94
 
70
95
  return @client.call('patch', path, {
71
96
  'content-type' => 'application/json',
@@ -75,8 +100,7 @@ module Appwrite
75
100
  def get_prefs()
76
101
  path = '/account/prefs'
77
102
 
78
- params = {
79
- }
103
+ params = {}
80
104
 
81
105
  return @client.call('get', path, {
82
106
  'content-type' => 'application/json',
@@ -84,11 +108,17 @@ module Appwrite
84
108
  end
85
109
 
86
110
  def update_prefs(prefs:)
111
+ if prefs.nil?
112
+ raise Appwrite::Exception.new('Missing required parameter: "prefs"')
113
+ end
114
+
87
115
  path = '/account/prefs'
88
116
 
89
- params = {
90
- 'prefs': prefs
91
- }
117
+ params = {}
118
+
119
+ if !prefs.nil?
120
+ params[:prefs] = prefs
121
+ end
92
122
 
93
123
  return @client.call('patch', path, {
94
124
  'content-type' => 'application/json',
@@ -96,12 +126,25 @@ module Appwrite
96
126
  end
97
127
 
98
128
  def create_recovery(email:, url:)
129
+ if email.nil?
130
+ raise Appwrite::Exception.new('Missing required parameter: "email"')
131
+ end
132
+
133
+ if url.nil?
134
+ raise Appwrite::Exception.new('Missing required parameter: "url"')
135
+ end
136
+
99
137
  path = '/account/recovery'
100
138
 
101
- params = {
102
- 'email': email,
103
- 'url': url
104
- }
139
+ params = {}
140
+
141
+ if !email.nil?
142
+ params[:email] = email
143
+ end
144
+
145
+ if !url.nil?
146
+ params[:url] = url
147
+ end
105
148
 
106
149
  return @client.call('post', path, {
107
150
  'content-type' => 'application/json',
@@ -109,14 +152,41 @@ module Appwrite
109
152
  end
110
153
 
111
154
  def update_recovery(user_id:, secret:, password:, password_again:)
155
+ if user_id.nil?
156
+ raise Appwrite::Exception.new('Missing required parameter: "userId"')
157
+ end
158
+
159
+ if secret.nil?
160
+ raise Appwrite::Exception.new('Missing required parameter: "secret"')
161
+ end
162
+
163
+ if password.nil?
164
+ raise Appwrite::Exception.new('Missing required parameter: "password"')
165
+ end
166
+
167
+ if password_again.nil?
168
+ raise Appwrite::Exception.new('Missing required parameter: "passwordAgain"')
169
+ end
170
+
112
171
  path = '/account/recovery'
113
172
 
114
- params = {
115
- 'userId': user_id,
116
- 'secret': secret,
117
- 'password': password,
118
- 'passwordAgain': password_again
119
- }
173
+ params = {}
174
+
175
+ if !user_id.nil?
176
+ params[:userId] = user_id
177
+ end
178
+
179
+ if !secret.nil?
180
+ params[:secret] = secret
181
+ end
182
+
183
+ if !password.nil?
184
+ params[:password] = password
185
+ end
186
+
187
+ if !password_again.nil?
188
+ params[:passwordAgain] = password_again
189
+ end
120
190
 
121
191
  return @client.call('put', path, {
122
192
  'content-type' => 'application/json',
@@ -126,8 +196,7 @@ module Appwrite
126
196
  def get_sessions()
127
197
  path = '/account/sessions'
128
198
 
129
- params = {
130
- }
199
+ params = {}
131
200
 
132
201
  return @client.call('get', path, {
133
202
  'content-type' => 'application/json',
@@ -137,20 +206,37 @@ module Appwrite
137
206
  def delete_sessions()
138
207
  path = '/account/sessions'
139
208
 
140
- params = {
141
- }
209
+ params = {}
142
210
 
143
211
  return @client.call('delete', path, {
144
212
  'content-type' => 'application/json',
145
213
  }, params);
146
214
  end
147
215
 
216
+ def get_session(session_id:)
217
+ if session_id.nil?
218
+ raise Appwrite::Exception.new('Missing required parameter: "sessionId"')
219
+ end
220
+
221
+ path = '/account/sessions/{sessionId}'
222
+ .gsub('{sessionId}', session_id)
223
+
224
+ params = {}
225
+
226
+ return @client.call('get', path, {
227
+ 'content-type' => 'application/json',
228
+ }, params);
229
+ end
230
+
148
231
  def delete_session(session_id:)
232
+ if session_id.nil?
233
+ raise Appwrite::Exception.new('Missing required parameter: "sessionId"')
234
+ end
235
+
149
236
  path = '/account/sessions/{sessionId}'
150
237
  .gsub('{sessionId}', session_id)
151
238
 
152
- params = {
153
- }
239
+ params = {}
154
240
 
155
241
  return @client.call('delete', path, {
156
242
  'content-type' => 'application/json',
@@ -158,11 +244,17 @@ module Appwrite
158
244
  end
159
245
 
160
246
  def create_verification(url:)
247
+ if url.nil?
248
+ raise Appwrite::Exception.new('Missing required parameter: "url"')
249
+ end
250
+
161
251
  path = '/account/verification'
162
252
 
163
- params = {
164
- 'url': url
165
- }
253
+ params = {}
254
+
255
+ if !url.nil?
256
+ params[:url] = url
257
+ end
166
258
 
167
259
  return @client.call('post', path, {
168
260
  'content-type' => 'application/json',
@@ -170,12 +262,25 @@ module Appwrite
170
262
  end
171
263
 
172
264
  def update_verification(user_id:, secret:)
265
+ if user_id.nil?
266
+ raise Appwrite::Exception.new('Missing required parameter: "userId"')
267
+ end
268
+
269
+ if secret.nil?
270
+ raise Appwrite::Exception.new('Missing required parameter: "secret"')
271
+ end
272
+
173
273
  path = '/account/verification'
174
274
 
175
- params = {
176
- 'userId': user_id,
177
- 'secret': secret
178
- }
275
+ params = {}
276
+
277
+ if !user_id.nil?
278
+ params[:userId] = user_id
279
+ end
280
+
281
+ if !secret.nil?
282
+ params[:secret] = secret
283
+ end
179
284
 
180
285
  return @client.call('put', path, {
181
286
  'content-type' => 'application/json',