appwrite 2.2.0 → 3.0.0

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