appwrite 2.1.1 → 2.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,29 +1,56 @@
1
1
  module Appwrite
2
2
  class Users < Service
3
3
 
4
- def list(search: '', limit: 25, offset: 0, order_type: 'ASC')
4
+ def list(search: nil, limit: nil, offset: nil, order_type: nil)
5
5
  path = '/users'
6
6
 
7
- params = {
8
- 'search': search,
9
- 'limit': limit,
10
- 'offset': offset,
11
- 'orderType': order_type
12
- }
7
+ params = {}
8
+
9
+ if !search.nil?
10
+ params[:search] = search
11
+ end
12
+
13
+ if !limit.nil?
14
+ params[:limit] = limit
15
+ end
16
+
17
+ if !offset.nil?
18
+ params[:offset] = offset
19
+ end
20
+
21
+ if !order_type.nil?
22
+ params[:orderType] = order_type
23
+ end
13
24
 
14
25
  return @client.call('get', path, {
15
26
  'content-type' => 'application/json',
16
27
  }, params);
17
28
  end
18
29
 
19
- def create(email:, password:, name: '')
30
+ def create(email:, password:, name: nil)
31
+ if email.nil?
32
+ raise Appwrite::Exception.new('Missing required parameter: "email"')
33
+ end
34
+
35
+ if password.nil?
36
+ raise Appwrite::Exception.new('Missing required parameter: "password"')
37
+ end
38
+
20
39
  path = '/users'
21
40
 
22
- params = {
23
- 'email': email,
24
- 'password': password,
25
- 'name': name
26
- }
41
+ params = {}
42
+
43
+ if !email.nil?
44
+ params[:email] = email
45
+ end
46
+
47
+ if !password.nil?
48
+ params[:password] = password
49
+ end
50
+
51
+ if !name.nil?
52
+ params[:name] = name
53
+ end
27
54
 
28
55
  return @client.call('post', path, {
29
56
  'content-type' => 'application/json',
@@ -31,11 +58,14 @@ module Appwrite
31
58
  end
32
59
 
33
60
  def get(user_id:)
61
+ if user_id.nil?
62
+ raise Appwrite::Exception.new('Missing required parameter: "userId"')
63
+ end
64
+
34
65
  path = '/users/{userId}'
35
66
  .gsub('{userId}', user_id)
36
67
 
37
- params = {
38
- }
68
+ params = {}
39
69
 
40
70
  return @client.call('get', path, {
41
71
  'content-type' => 'application/json',
@@ -43,11 +73,14 @@ module Appwrite
43
73
  end
44
74
 
45
75
  def delete(user_id:)
76
+ if user_id.nil?
77
+ raise Appwrite::Exception.new('Missing required parameter: "userId"')
78
+ end
79
+
46
80
  path = '/users/{userId}'
47
81
  .gsub('{userId}', user_id)
48
82
 
49
- params = {
50
- }
83
+ params = {}
51
84
 
52
85
  return @client.call('delete', path, {
53
86
  'content-type' => 'application/json',
@@ -55,11 +88,14 @@ module Appwrite
55
88
  end
56
89
 
57
90
  def get_logs(user_id:)
91
+ if user_id.nil?
92
+ raise Appwrite::Exception.new('Missing required parameter: "userId"')
93
+ end
94
+
58
95
  path = '/users/{userId}/logs'
59
96
  .gsub('{userId}', user_id)
60
97
 
61
- params = {
62
- }
98
+ params = {}
63
99
 
64
100
  return @client.call('get', path, {
65
101
  'content-type' => 'application/json',
@@ -67,11 +103,14 @@ module Appwrite
67
103
  end
68
104
 
69
105
  def get_prefs(user_id:)
106
+ if user_id.nil?
107
+ raise Appwrite::Exception.new('Missing required parameter: "userId"')
108
+ end
109
+
70
110
  path = '/users/{userId}/prefs'
71
111
  .gsub('{userId}', user_id)
72
112
 
73
- params = {
74
- }
113
+ params = {}
75
114
 
76
115
  return @client.call('get', path, {
77
116
  'content-type' => 'application/json',
@@ -79,12 +118,22 @@ module Appwrite
79
118
  end
80
119
 
81
120
  def update_prefs(user_id:, prefs:)
121
+ if user_id.nil?
122
+ raise Appwrite::Exception.new('Missing required parameter: "userId"')
123
+ end
124
+
125
+ if prefs.nil?
126
+ raise Appwrite::Exception.new('Missing required parameter: "prefs"')
127
+ end
128
+
82
129
  path = '/users/{userId}/prefs'
83
130
  .gsub('{userId}', user_id)
84
131
 
85
- params = {
86
- 'prefs': prefs
87
- }
132
+ params = {}
133
+
134
+ if !prefs.nil?
135
+ params[:prefs] = prefs
136
+ end
88
137
 
89
138
  return @client.call('patch', path, {
90
139
  'content-type' => 'application/json',
@@ -92,11 +141,14 @@ module Appwrite
92
141
  end
93
142
 
94
143
  def get_sessions(user_id:)
144
+ if user_id.nil?
145
+ raise Appwrite::Exception.new('Missing required parameter: "userId"')
146
+ end
147
+
95
148
  path = '/users/{userId}/sessions'
96
149
  .gsub('{userId}', user_id)
97
150
 
98
- params = {
99
- }
151
+ params = {}
100
152
 
101
153
  return @client.call('get', path, {
102
154
  'content-type' => 'application/json',
@@ -104,11 +156,14 @@ module Appwrite
104
156
  end
105
157
 
106
158
  def delete_sessions(user_id:)
159
+ if user_id.nil?
160
+ raise Appwrite::Exception.new('Missing required parameter: "userId"')
161
+ end
162
+
107
163
  path = '/users/{userId}/sessions'
108
164
  .gsub('{userId}', user_id)
109
165
 
110
- params = {
111
- }
166
+ params = {}
112
167
 
113
168
  return @client.call('delete', path, {
114
169
  'content-type' => 'application/json',
@@ -116,12 +171,19 @@ module Appwrite
116
171
  end
117
172
 
118
173
  def delete_session(user_id:, session_id:)
174
+ if user_id.nil?
175
+ raise Appwrite::Exception.new('Missing required parameter: "userId"')
176
+ end
177
+
178
+ if session_id.nil?
179
+ raise Appwrite::Exception.new('Missing required parameter: "sessionId"')
180
+ end
181
+
119
182
  path = '/users/{userId}/sessions/{sessionId}'
120
183
  .gsub('{userId}', user_id)
121
184
  .gsub('{sessionId}', session_id)
122
185
 
123
- params = {
124
- }
186
+ params = {}
125
187
 
126
188
  return @client.call('delete', path, {
127
189
  'content-type' => 'application/json',
@@ -129,12 +191,22 @@ module Appwrite
129
191
  end
130
192
 
131
193
  def update_status(user_id:, status:)
194
+ if user_id.nil?
195
+ raise Appwrite::Exception.new('Missing required parameter: "userId"')
196
+ end
197
+
198
+ if status.nil?
199
+ raise Appwrite::Exception.new('Missing required parameter: "status"')
200
+ end
201
+
132
202
  path = '/users/{userId}/status'
133
203
  .gsub('{userId}', user_id)
134
204
 
135
- params = {
136
- 'status': status
137
- }
205
+ params = {}
206
+
207
+ if !status.nil?
208
+ params[:status] = status
209
+ end
138
210
 
139
211
  return @client.call('patch', path, {
140
212
  'content-type' => 'application/json',
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appwrite
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.1
4
+ version: 2.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Appwrite Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-21 00:00:00.000000000 Z
11
+ date: 2021-06-03 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: team@appwrite.io