appwrite 2.4.0 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (175) hide show
  1. checksums.yaml +4 -4
  2. data/lib/appwrite/client.rb +197 -56
  3. data/lib/appwrite/exception.rb +7 -7
  4. data/lib/appwrite/file.rb +9 -15
  5. data/lib/appwrite/models/attribute_boolean.rb +52 -0
  6. data/lib/appwrite/models/attribute_email.rb +57 -0
  7. data/lib/appwrite/models/attribute_enum.rb +62 -0
  8. data/lib/appwrite/models/attribute_float.rb +62 -0
  9. data/lib/appwrite/models/attribute_integer.rb +62 -0
  10. data/lib/appwrite/models/attribute_ip.rb +57 -0
  11. data/lib/appwrite/models/attribute_list.rb +32 -0
  12. data/lib/appwrite/models/attribute_string.rb +57 -0
  13. data/lib/appwrite/models/attribute_url.rb +57 -0
  14. data/lib/appwrite/models/bucket.rb +82 -0
  15. data/lib/appwrite/models/bucket_list.rb +32 -0
  16. data/lib/appwrite/models/collection.rb +62 -0
  17. data/lib/appwrite/models/collection_list.rb +32 -0
  18. data/lib/appwrite/models/continent.rb +32 -0
  19. data/lib/appwrite/models/continent_list.rb +32 -0
  20. data/lib/appwrite/models/country.rb +32 -0
  21. data/lib/appwrite/models/country_list.rb +32 -0
  22. data/lib/appwrite/models/currency.rb +57 -0
  23. data/lib/appwrite/models/currency_list.rb +32 -0
  24. data/lib/appwrite/models/deployment.rb +77 -0
  25. data/lib/appwrite/models/deployment_list.rb +32 -0
  26. data/lib/appwrite/models/document.rb +50 -0
  27. data/lib/appwrite/models/document_list.rb +36 -0
  28. data/lib/appwrite/models/execution.rb +72 -0
  29. data/lib/appwrite/models/execution_list.rb +32 -0
  30. data/lib/appwrite/models/file.rb +77 -0
  31. data/lib/appwrite/models/file_list.rb +32 -0
  32. data/lib/appwrite/models/function.rb +92 -0
  33. data/lib/appwrite/models/function_list.rb +32 -0
  34. data/lib/appwrite/models/health_antivirus.rb +32 -0
  35. data/lib/appwrite/models/health_queue.rb +27 -0
  36. data/lib/appwrite/models/health_status.rb +32 -0
  37. data/lib/appwrite/models/health_time.rb +37 -0
  38. data/lib/appwrite/models/index.rb +47 -0
  39. data/lib/appwrite/models/index_list.rb +32 -0
  40. data/lib/appwrite/models/language.rb +37 -0
  41. data/lib/appwrite/models/language_list.rb +32 -0
  42. data/lib/appwrite/models/locale.rb +57 -0
  43. data/lib/appwrite/models/log.rb +127 -0
  44. data/lib/appwrite/models/log_list.rb +32 -0
  45. data/lib/appwrite/models/membership.rb +67 -0
  46. data/lib/appwrite/models/membership_list.rb +32 -0
  47. data/lib/appwrite/models/phone.rb +37 -0
  48. data/lib/appwrite/models/phone_list.rb +32 -0
  49. data/lib/appwrite/models/preferences.rb +30 -0
  50. data/lib/appwrite/models/runtime.rb +57 -0
  51. data/lib/appwrite/models/runtime_list.rb +32 -0
  52. data/lib/appwrite/models/session.rb +142 -0
  53. data/lib/appwrite/models/session_list.rb +32 -0
  54. data/lib/appwrite/models/team.rb +42 -0
  55. data/lib/appwrite/models/team_list.rb +32 -0
  56. data/lib/appwrite/models/token.rb +42 -0
  57. data/lib/appwrite/models/user.rb +62 -0
  58. data/lib/appwrite/models/user_list.rb +32 -0
  59. data/lib/appwrite/query.rb +42 -0
  60. data/lib/appwrite/service.rb +0 -5
  61. data/lib/appwrite/services/account.rb +400 -138
  62. data/lib/appwrite/services/avatars.rb +188 -125
  63. data/lib/appwrite/services/database.rb +875 -130
  64. data/lib/appwrite/services/functions.rb +439 -207
  65. data/lib/appwrite/services/health.rb +201 -58
  66. data/lib/appwrite/services/locale.rb +133 -32
  67. data/lib/appwrite/services/storage.rb +469 -118
  68. data/lib/appwrite/services/teams.rb +302 -118
  69. data/lib/appwrite/services/users.rb +322 -127
  70. data/lib/appwrite.rb +57 -0
  71. metadata +74 -108
  72. data/.travis.yml +0 -16
  73. data/CHANGELOG.md +0 -1
  74. data/Gemfile +0 -4
  75. data/LICENSE +0 -12
  76. data/README.md +0 -96
  77. data/appwrite.gemspec +0 -11
  78. data/docs/examples/account/create-recovery.md +0 -15
  79. data/docs/examples/account/create-verification.md +0 -15
  80. data/docs/examples/account/delete-session.md +0 -15
  81. data/docs/examples/account/delete-sessions.md +0 -15
  82. data/docs/examples/account/delete.md +0 -15
  83. data/docs/examples/account/get-logs.md +0 -15
  84. data/docs/examples/account/get-prefs.md +0 -15
  85. data/docs/examples/account/get-session.md +0 -15
  86. data/docs/examples/account/get-sessions.md +0 -15
  87. data/docs/examples/account/get.md +0 -15
  88. data/docs/examples/account/update-email.md +0 -15
  89. data/docs/examples/account/update-name.md +0 -15
  90. data/docs/examples/account/update-password.md +0 -15
  91. data/docs/examples/account/update-prefs.md +0 -15
  92. data/docs/examples/account/update-recovery.md +0 -15
  93. data/docs/examples/account/update-verification.md +0 -15
  94. data/docs/examples/avatars/get-browser.md +0 -15
  95. data/docs/examples/avatars/get-credit-card.md +0 -15
  96. data/docs/examples/avatars/get-favicon.md +0 -15
  97. data/docs/examples/avatars/get-flag.md +0 -15
  98. data/docs/examples/avatars/get-image.md +0 -15
  99. data/docs/examples/avatars/get-initials.md +0 -15
  100. data/docs/examples/avatars/get-q-r.md +0 -15
  101. data/docs/examples/database/create-collection.md +0 -15
  102. data/docs/examples/database/create-document.md +0 -15
  103. data/docs/examples/database/delete-collection.md +0 -15
  104. data/docs/examples/database/delete-document.md +0 -15
  105. data/docs/examples/database/get-collection.md +0 -15
  106. data/docs/examples/database/get-document.md +0 -15
  107. data/docs/examples/database/list-collections.md +0 -15
  108. data/docs/examples/database/list-documents.md +0 -15
  109. data/docs/examples/database/update-collection.md +0 -15
  110. data/docs/examples/database/update-document.md +0 -15
  111. data/docs/examples/functions/create-execution.md +0 -15
  112. data/docs/examples/functions/create-tag.md +0 -15
  113. data/docs/examples/functions/create.md +0 -15
  114. data/docs/examples/functions/delete-tag.md +0 -15
  115. data/docs/examples/functions/delete.md +0 -15
  116. data/docs/examples/functions/get-execution.md +0 -15
  117. data/docs/examples/functions/get-tag.md +0 -15
  118. data/docs/examples/functions/get.md +0 -15
  119. data/docs/examples/functions/list-executions.md +0 -15
  120. data/docs/examples/functions/list-tags.md +0 -15
  121. data/docs/examples/functions/list.md +0 -15
  122. data/docs/examples/functions/update-tag.md +0 -15
  123. data/docs/examples/functions/update.md +0 -15
  124. data/docs/examples/health/get-anti-virus.md +0 -15
  125. data/docs/examples/health/get-cache.md +0 -15
  126. data/docs/examples/health/get-d-b.md +0 -15
  127. data/docs/examples/health/get-queue-certificates.md +0 -15
  128. data/docs/examples/health/get-queue-functions.md +0 -15
  129. data/docs/examples/health/get-queue-logs.md +0 -15
  130. data/docs/examples/health/get-queue-tasks.md +0 -15
  131. data/docs/examples/health/get-queue-usage.md +0 -15
  132. data/docs/examples/health/get-queue-webhooks.md +0 -15
  133. data/docs/examples/health/get-storage-local.md +0 -15
  134. data/docs/examples/health/get-time.md +0 -15
  135. data/docs/examples/health/get.md +0 -15
  136. data/docs/examples/locale/get-continents.md +0 -15
  137. data/docs/examples/locale/get-countries-e-u.md +0 -15
  138. data/docs/examples/locale/get-countries-phones.md +0 -15
  139. data/docs/examples/locale/get-countries.md +0 -15
  140. data/docs/examples/locale/get-currencies.md +0 -15
  141. data/docs/examples/locale/get-languages.md +0 -15
  142. data/docs/examples/locale/get.md +0 -15
  143. data/docs/examples/storage/create-file.md +0 -15
  144. data/docs/examples/storage/delete-file.md +0 -15
  145. data/docs/examples/storage/get-file-download.md +0 -15
  146. data/docs/examples/storage/get-file-preview.md +0 -15
  147. data/docs/examples/storage/get-file-view.md +0 -15
  148. data/docs/examples/storage/get-file.md +0 -15
  149. data/docs/examples/storage/list-files.md +0 -15
  150. data/docs/examples/storage/update-file.md +0 -15
  151. data/docs/examples/teams/create-membership.md +0 -15
  152. data/docs/examples/teams/create.md +0 -15
  153. data/docs/examples/teams/delete-membership.md +0 -15
  154. data/docs/examples/teams/delete.md +0 -15
  155. data/docs/examples/teams/get-memberships.md +0 -15
  156. data/docs/examples/teams/get.md +0 -15
  157. data/docs/examples/teams/list.md +0 -15
  158. data/docs/examples/teams/update-membership-roles.md +0 -15
  159. data/docs/examples/teams/update-membership-status.md +0 -15
  160. data/docs/examples/teams/update.md +0 -15
  161. data/docs/examples/users/create.md +0 -15
  162. data/docs/examples/users/delete-session.md +0 -15
  163. data/docs/examples/users/delete-sessions.md +0 -15
  164. data/docs/examples/users/delete.md +0 -15
  165. data/docs/examples/users/get-logs.md +0 -15
  166. data/docs/examples/users/get-prefs.md +0 -15
  167. data/docs/examples/users/get-sessions.md +0 -15
  168. data/docs/examples/users/get.md +0 -15
  169. data/docs/examples/users/list.md +0 -15
  170. data/docs/examples/users/update-email.md +0 -15
  171. data/docs/examples/users/update-name.md +0 -15
  172. data/docs/examples/users/update-password.md +0 -15
  173. data/docs/examples/users/update-prefs.md +0 -15
  174. data/docs/examples/users/update-status.md +0 -15
  175. data/docs/examples/users/update-verification.md +0 -15
@@ -1,54 +1,91 @@
1
+ #frozen_string_literal: true
2
+
1
3
  module Appwrite
2
4
  class Teams < Service
3
5
 
4
- def list(search: nil, limit: nil, offset: nil, order_type: nil)
6
+ # Get a list of all the teams in which the current user is a member. You can
7
+ # use the parameters to filter your results.
8
+ #
9
+ # In admin mode, this endpoint returns a list of all the teams in the current
10
+ # project. [Learn more about different API modes](/docs/admin).
11
+ #
12
+ # @param [string] search Search term to filter your list results. Max length: 256 chars.
13
+ # @param [number] limit Maximum number of teams to return in response. By default will return maximum 25 results. Maximum of 100 results allowed per request.
14
+ # @param [number] offset Offset value. The default value is 0. Use this param to manage pagination. [learn more about pagination](https://appwrite.io/docs/pagination)
15
+ # @param [string] cursor ID of the team used as the starting point for the query, excluding the team itself. Should be used for efficient pagination when working with large sets of data. [learn more about pagination](https://appwrite.io/docs/pagination)
16
+ # @param [string] cursor_direction Direction of the cursor.
17
+ # @param [string] order_type Order result by ASC or DESC order.
18
+ #
19
+ # @return [TeamList]
20
+ def list(search: nil, limit: nil, offset: nil, cursor: nil, cursor_direction: nil, order_type: nil)
5
21
  path = '/teams'
6
22
 
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
23
+ params = {
24
+ search: search,
25
+ limit: limit,
26
+ offset: offset,
27
+ cursor: cursor,
28
+ cursorDirection: cursor_direction,
29
+ orderType: order_type,
30
+ }
31
+
32
+ headers = {
33
+ "content-type": 'application/json',
34
+ }
35
+
36
+ @client.call(
37
+ method: 'GET',
38
+ path: path,
39
+ headers: headers,
40
+ params: params,
41
+ response_type: Models::TeamList
42
+ )
43
+ end
20
44
 
21
- if !order_type.nil?
22
- params[:orderType] = order_type
45
+ # Create a new team. The user who creates the team will automatically be
46
+ # assigned as the owner of the team. Only the users with the owner role can
47
+ # invite new members, add new owners and delete or update the team.
48
+ #
49
+ # @param [string] team_id Team ID. Choose your own unique ID or pass the string &quot;unique()&quot; to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can&#039;t start with a special char. Max length is 36 chars.
50
+ # @param [string] name Team name. Max length: 128 chars.
51
+ # @param [array] roles Array of strings. Use this param to set the roles in the team for the user who created it. The default role is **owner**. A role can be any string. Learn more about [roles and permissions](/docs/permissions). Max length for each role is 32 chars.
52
+ #
53
+ # @return [Team]
54
+ def create(team_id:, name:, roles: nil)
55
+ if team_id.nil?
56
+ raise Appwrite::Exception.new('Missing required parameter: "teamId"')
23
57
  end
24
58
 
25
- return @client.call('get', path, {
26
- 'content-type' => 'application/json',
27
- }, params);
28
- end
29
-
30
- def create(name:, roles: nil)
31
59
  if name.nil?
32
60
  raise Appwrite::Exception.new('Missing required parameter: "name"')
33
61
  end
34
62
 
35
63
  path = '/teams'
36
64
 
37
- params = {}
38
-
39
- if !name.nil?
40
- params[:name] = name
41
- end
42
-
43
- if !roles.nil?
44
- params[:roles] = roles
45
- end
46
-
47
- return @client.call('post', path, {
48
- 'content-type' => 'application/json',
49
- }, params);
65
+ params = {
66
+ teamId: team_id,
67
+ name: name,
68
+ roles: roles,
69
+ }
70
+
71
+ headers = {
72
+ "content-type": 'application/json',
73
+ }
74
+
75
+ @client.call(
76
+ method: 'POST',
77
+ path: path,
78
+ headers: headers,
79
+ params: params,
80
+ response_type: Models::Team
81
+ )
50
82
  end
51
83
 
84
+ # Get a team by its ID. All team members have read access for this resource.
85
+ #
86
+ # @param [string] team_id Team ID.
87
+ #
88
+ # @return [Team]
52
89
  def get(team_id:)
53
90
  if team_id.nil?
54
91
  raise Appwrite::Exception.new('Missing required parameter: "teamId"')
@@ -57,13 +94,29 @@ module Appwrite
57
94
  path = '/teams/{teamId}'
58
95
  .gsub('{teamId}', team_id)
59
96
 
60
- params = {}
97
+ params = {
98
+ }
99
+
100
+ headers = {
101
+ "content-type": 'application/json',
102
+ }
61
103
 
62
- return @client.call('get', path, {
63
- 'content-type' => 'application/json',
64
- }, params);
104
+ @client.call(
105
+ method: 'GET',
106
+ path: path,
107
+ headers: headers,
108
+ params: params,
109
+ response_type: Models::Team
110
+ )
65
111
  end
66
112
 
113
+ # Update a team using its ID. Only members with the owner role can update the
114
+ # team.
115
+ #
116
+ # @param [string] team_id Team ID.
117
+ # @param [string] name New team name. Max length: 128 chars.
118
+ #
119
+ # @return [Team]
67
120
  def update(team_id:, name:)
68
121
  if team_id.nil?
69
122
  raise Appwrite::Exception.new('Missing required parameter: "teamId"')
@@ -76,17 +129,29 @@ module Appwrite
76
129
  path = '/teams/{teamId}'
77
130
  .gsub('{teamId}', team_id)
78
131
 
79
- params = {}
80
-
81
- if !name.nil?
82
- params[:name] = name
83
- end
84
-
85
- return @client.call('put', path, {
86
- 'content-type' => 'application/json',
87
- }, params);
132
+ params = {
133
+ name: name,
134
+ }
135
+
136
+ headers = {
137
+ "content-type": 'application/json',
138
+ }
139
+
140
+ @client.call(
141
+ method: 'PUT',
142
+ path: path,
143
+ headers: headers,
144
+ params: params,
145
+ response_type: Models::Team
146
+ )
88
147
  end
89
148
 
149
+ # Delete a team using its ID. Only team members with the owner role can
150
+ # delete the team.
151
+ #
152
+ # @param [string] team_id Team ID.
153
+ #
154
+ # @return []
90
155
  def delete(team_id:)
91
156
  if team_id.nil?
92
157
  raise Appwrite::Exception.new('Missing required parameter: "teamId"')
@@ -95,14 +160,34 @@ module Appwrite
95
160
  path = '/teams/{teamId}'
96
161
  .gsub('{teamId}', team_id)
97
162
 
98
- params = {}
163
+ params = {
164
+ }
99
165
 
100
- return @client.call('delete', path, {
101
- 'content-type' => 'application/json',
102
- }, params);
166
+ headers = {
167
+ "content-type": 'application/json',
168
+ }
169
+
170
+ @client.call(
171
+ method: 'DELETE',
172
+ path: path,
173
+ headers: headers,
174
+ params: params,
175
+ )
103
176
  end
104
177
 
105
- def get_memberships(team_id:, search: nil, limit: nil, offset: nil, order_type: nil)
178
+ # Use this endpoint to list a team's members using the team's ID. All team
179
+ # members have read access to this endpoint.
180
+ #
181
+ # @param [string] team_id Team ID.
182
+ # @param [string] search Search term to filter your list results. Max length: 256 chars.
183
+ # @param [number] limit Maximum number of memberships to return in response. By default will return maximum 25 results. Maximum of 100 results allowed per request.
184
+ # @param [number] offset Offset value. The default value is 0. Use this value to manage pagination. [learn more about pagination](https://appwrite.io/docs/pagination)
185
+ # @param [string] cursor ID of the membership used as the starting point for the query, excluding the membership itself. Should be used for efficient pagination when working with large sets of data. [learn more about pagination](https://appwrite.io/docs/pagination)
186
+ # @param [string] cursor_direction Direction of the cursor.
187
+ # @param [string] order_type Order result by ASC or DESC order.
188
+ #
189
+ # @return [MembershipList]
190
+ def get_memberships(team_id:, search: nil, limit: nil, offset: nil, cursor: nil, cursor_direction: nil, order_type: nil)
106
191
  if team_id.nil?
107
192
  raise Appwrite::Exception.new('Missing required parameter: "teamId"')
108
193
  end
@@ -110,29 +195,51 @@ module Appwrite
110
195
  path = '/teams/{teamId}/memberships'
111
196
  .gsub('{teamId}', team_id)
112
197
 
113
- params = {}
114
-
115
- if !search.nil?
116
- params[:search] = search
117
- end
118
-
119
- if !limit.nil?
120
- params[:limit] = limit
121
- end
122
-
123
- if !offset.nil?
124
- params[:offset] = offset
125
- end
126
-
127
- if !order_type.nil?
128
- params[:orderType] = order_type
129
- end
130
-
131
- return @client.call('get', path, {
132
- 'content-type' => 'application/json',
133
- }, params);
198
+ params = {
199
+ search: search,
200
+ limit: limit,
201
+ offset: offset,
202
+ cursor: cursor,
203
+ cursorDirection: cursor_direction,
204
+ orderType: order_type,
205
+ }
206
+
207
+ headers = {
208
+ "content-type": 'application/json',
209
+ }
210
+
211
+ @client.call(
212
+ method: 'GET',
213
+ path: path,
214
+ headers: headers,
215
+ params: params,
216
+ response_type: Models::MembershipList
217
+ )
134
218
  end
135
219
 
220
+ # Invite a new member to join your team. If initiated from the client SDK, an
221
+ # email with a link to join the team will be sent to the member's email
222
+ # address and an account will be created for them should they not be signed
223
+ # up already. If initiated from server-side SDKs, the new member will
224
+ # automatically be added to the team.
225
+ #
226
+ # Use the 'url' parameter to redirect the user from the invitation email back
227
+ # to your app. When the user is redirected, use the [Update Team Membership
228
+ # Status](/docs/client/teams#teamsUpdateMembershipStatus) endpoint to allow
229
+ # the user to accept the invitation to the team.
230
+ #
231
+ # Please note that to avoid a [Redirect
232
+ # Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md)
233
+ # the only valid redirect URL's are the once from domains you have set when
234
+ # adding your platforms in the console interface.
235
+ #
236
+ # @param [string] team_id Team ID.
237
+ # @param [string] email Email of the new team member.
238
+ # @param [array] roles Array of strings. Use this param to set the user roles in the team. A role can be any string. Learn more about [roles and permissions](/docs/permissions). Max length for each role is 32 chars.
239
+ # @param [string] url URL to redirect the user back to your app from the invitation email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
240
+ # @param [string] name Name of the new team member. Max length: 128 chars.
241
+ #
242
+ # @return [Membership]
136
243
  def create_membership(team_id:, email:, roles:, url:, name: nil)
137
244
  if team_id.nil?
138
245
  raise Appwrite::Exception.new('Missing required parameter: "teamId"')
@@ -153,29 +260,71 @@ module Appwrite
153
260
  path = '/teams/{teamId}/memberships'
154
261
  .gsub('{teamId}', team_id)
155
262
 
156
- params = {}
263
+ params = {
264
+ email: email,
265
+ roles: roles,
266
+ url: url,
267
+ name: name,
268
+ }
269
+
270
+ headers = {
271
+ "content-type": 'application/json',
272
+ }
273
+
274
+ @client.call(
275
+ method: 'POST',
276
+ path: path,
277
+ headers: headers,
278
+ params: params,
279
+ response_type: Models::Membership
280
+ )
281
+ end
157
282
 
158
- if !email.nil?
159
- params[:email] = email
283
+ # Get a team member by the membership unique id. All team members have read
284
+ # access for this resource.
285
+ #
286
+ # @param [string] team_id Team ID.
287
+ # @param [string] membership_id Membership ID.
288
+ #
289
+ # @return [MembershipList]
290
+ def get_membership(team_id:, membership_id:)
291
+ if team_id.nil?
292
+ raise Appwrite::Exception.new('Missing required parameter: "teamId"')
160
293
  end
161
294
 
162
- if !name.nil?
163
- params[:name] = name
295
+ if membership_id.nil?
296
+ raise Appwrite::Exception.new('Missing required parameter: "membershipId"')
164
297
  end
165
298
 
166
- if !roles.nil?
167
- params[:roles] = roles
168
- end
299
+ path = '/teams/{teamId}/memberships/{membershipId}'
300
+ .gsub('{teamId}', team_id)
301
+ .gsub('{membershipId}', membership_id)
169
302
 
170
- if !url.nil?
171
- params[:url] = url
172
- end
303
+ params = {
304
+ }
305
+
306
+ headers = {
307
+ "content-type": 'application/json',
308
+ }
173
309
 
174
- return @client.call('post', path, {
175
- 'content-type' => 'application/json',
176
- }, params);
310
+ @client.call(
311
+ method: 'GET',
312
+ path: path,
313
+ headers: headers,
314
+ params: params,
315
+ response_type: Models::MembershipList
316
+ )
177
317
  end
178
318
 
319
+ # Modify the roles of a team member. Only team members with the owner role
320
+ # have access to this endpoint. Learn more about [roles and
321
+ # permissions](/docs/permissions).
322
+ #
323
+ # @param [string] team_id Team ID.
324
+ # @param [string] membership_id Membership ID.
325
+ # @param [array] roles An array of strings. Use this param to set the user&#039;s roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Max length for each role is 32 chars.
326
+ #
327
+ # @return [Membership]
179
328
  def update_membership_roles(team_id:, membership_id:, roles:)
180
329
  if team_id.nil?
181
330
  raise Appwrite::Exception.new('Missing required parameter: "teamId"')
@@ -193,17 +342,31 @@ module Appwrite
193
342
  .gsub('{teamId}', team_id)
194
343
  .gsub('{membershipId}', membership_id)
195
344
 
196
- params = {}
197
-
198
- if !roles.nil?
199
- params[:roles] = roles
200
- end
201
-
202
- return @client.call('patch', path, {
203
- 'content-type' => 'application/json',
204
- }, params);
345
+ params = {
346
+ roles: roles,
347
+ }
348
+
349
+ headers = {
350
+ "content-type": 'application/json',
351
+ }
352
+
353
+ @client.call(
354
+ method: 'PATCH',
355
+ path: path,
356
+ headers: headers,
357
+ params: params,
358
+ response_type: Models::Membership
359
+ )
205
360
  end
206
361
 
362
+ # This endpoint allows a user to leave a team or for a team owner to delete
363
+ # the membership of any other team member. You can also use this endpoint to
364
+ # delete a user membership even if it is not accepted.
365
+ #
366
+ # @param [string] team_id Team ID.
367
+ # @param [string] membership_id Membership ID.
368
+ #
369
+ # @return []
207
370
  def delete_membership(team_id:, membership_id:)
208
371
  if team_id.nil?
209
372
  raise Appwrite::Exception.new('Missing required parameter: "teamId"')
@@ -217,13 +380,35 @@ module Appwrite
217
380
  .gsub('{teamId}', team_id)
218
381
  .gsub('{membershipId}', membership_id)
219
382
 
220
- params = {}
383
+ params = {
384
+ }
385
+
386
+ headers = {
387
+ "content-type": 'application/json',
388
+ }
221
389
 
222
- return @client.call('delete', path, {
223
- 'content-type' => 'application/json',
224
- }, params);
390
+ @client.call(
391
+ method: 'DELETE',
392
+ path: path,
393
+ headers: headers,
394
+ params: params,
395
+ )
225
396
  end
226
397
 
398
+ # Use this endpoint to allow a user to accept an invitation to join a team
399
+ # after being redirected back to your app from the invitation email received
400
+ # by the user.
401
+ #
402
+ # If the request is successful, a session for the user is automatically
403
+ # created.
404
+ #
405
+ #
406
+ # @param [string] team_id Team ID.
407
+ # @param [string] membership_id Membership ID.
408
+ # @param [string] user_id User ID.
409
+ # @param [string] secret Secret key.
410
+ #
411
+ # @return [Membership]
227
412
  def update_membership_status(team_id:, membership_id:, user_id:, secret:)
228
413
  if team_id.nil?
229
414
  raise Appwrite::Exception.new('Missing required parameter: "teamId"')
@@ -245,24 +430,23 @@ module Appwrite
245
430
  .gsub('{teamId}', team_id)
246
431
  .gsub('{membershipId}', membership_id)
247
432
 
248
- params = {}
249
-
250
- if !user_id.nil?
251
- params[:userId] = user_id
252
- end
253
-
254
- if !secret.nil?
255
- params[:secret] = secret
256
- end
257
-
258
- return @client.call('patch', path, {
259
- 'content-type' => 'application/json',
260
- }, params);
433
+ params = {
434
+ userId: user_id,
435
+ secret: secret,
436
+ }
437
+
438
+ headers = {
439
+ "content-type": 'application/json',
440
+ }
441
+
442
+ @client.call(
443
+ method: 'PATCH',
444
+ path: path,
445
+ headers: headers,
446
+ params: params,
447
+ response_type: Models::Membership
448
+ )
261
449
  end
262
450
 
263
-
264
- protected
265
-
266
- private
267
451
  end
268
452
  end