appwrite 2.2.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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,129 +1,273 @@
1
+ #frozen_string_literal: true
2
+
1
3
  module Appwrite
2
4
  class Health < Service
3
5
 
6
+ include Models
7
+ # Check the Appwrite HTTP server is up and responsive.
8
+ #
9
+ #
10
+ # @return [HealthStatus]
4
11
  def get()
5
12
  path = '/health'
6
13
 
7
- params = {}
14
+ params = {
15
+ }
16
+
17
+ headers = {
18
+ "content-type": 'application/json',
19
+ }
8
20
 
9
- return @client.call('get', path, {
10
- 'content-type' => 'application/json',
11
- }, params);
21
+ @client.call(
22
+ method: 'GET',
23
+ path: path,
24
+ params: params,
25
+ headers: headers,
26
+ response_type: HealthStatus
27
+ )
12
28
  end
13
29
 
14
- def get_anti_virus()
30
+ # Check the Appwrite Antivirus server is up and connection is successful.
31
+ #
32
+ #
33
+ # @return [HealthAntivirus]
34
+ def get_antivirus()
15
35
  path = '/health/anti-virus'
16
36
 
17
- params = {}
37
+ params = {
38
+ }
18
39
 
19
- return @client.call('get', path, {
20
- 'content-type' => 'application/json',
21
- }, params);
40
+ headers = {
41
+ "content-type": 'application/json',
42
+ }
43
+
44
+ @client.call(
45
+ method: 'GET',
46
+ path: path,
47
+ params: params,
48
+ headers: headers,
49
+ response_type: HealthAntivirus
50
+ )
22
51
  end
23
52
 
53
+ # Check the Appwrite in-memory cache server is up and connection is
54
+ # successful.
55
+ #
56
+ #
57
+ # @return [HealthStatus]
24
58
  def get_cache()
25
59
  path = '/health/cache'
26
60
 
27
- params = {}
61
+ params = {
62
+ }
63
+
64
+ headers = {
65
+ "content-type": 'application/json',
66
+ }
28
67
 
29
- return @client.call('get', path, {
30
- 'content-type' => 'application/json',
31
- }, params);
68
+ @client.call(
69
+ method: 'GET',
70
+ path: path,
71
+ params: params,
72
+ headers: headers,
73
+ response_type: HealthStatus
74
+ )
32
75
  end
33
76
 
77
+ # Check the Appwrite database server is up and connection is successful.
78
+ #
79
+ #
80
+ # @return [HealthStatus]
34
81
  def get_db()
35
82
  path = '/health/db'
36
83
 
37
- params = {}
84
+ params = {
85
+ }
38
86
 
39
- return @client.call('get', path, {
40
- 'content-type' => 'application/json',
41
- }, params);
87
+ headers = {
88
+ "content-type": 'application/json',
89
+ }
90
+
91
+ @client.call(
92
+ method: 'GET',
93
+ path: path,
94
+ params: params,
95
+ headers: headers,
96
+ response_type: HealthStatus
97
+ )
42
98
  end
43
99
 
100
+ # Get the number of certificates that are waiting to be issued against
101
+ # [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue
102
+ # server.
103
+ #
104
+ #
105
+ # @return [HealthQueue]
44
106
  def get_queue_certificates()
45
107
  path = '/health/queue/certificates'
46
108
 
47
- params = {}
109
+ params = {
110
+ }
111
+
112
+ headers = {
113
+ "content-type": 'application/json',
114
+ }
48
115
 
49
- return @client.call('get', path, {
50
- 'content-type' => 'application/json',
51
- }, params);
116
+ @client.call(
117
+ method: 'GET',
118
+ path: path,
119
+ params: params,
120
+ headers: headers,
121
+ response_type: HealthQueue
122
+ )
52
123
  end
53
124
 
125
+ #
126
+ #
127
+ #
128
+ # @return [HealthQueue]
54
129
  def get_queue_functions()
55
130
  path = '/health/queue/functions'
56
131
 
57
- params = {}
132
+ params = {
133
+ }
58
134
 
59
- return @client.call('get', path, {
60
- 'content-type' => 'application/json',
61
- }, params);
135
+ headers = {
136
+ "content-type": 'application/json',
137
+ }
138
+
139
+ @client.call(
140
+ method: 'GET',
141
+ path: path,
142
+ params: params,
143
+ headers: headers,
144
+ response_type: HealthQueue
145
+ )
62
146
  end
63
147
 
148
+ # Get the number of logs that are waiting to be processed in the Appwrite
149
+ # internal queue server.
150
+ #
151
+ #
152
+ # @return [HealthQueue]
64
153
  def get_queue_logs()
65
154
  path = '/health/queue/logs'
66
155
 
67
- params = {}
68
-
69
- return @client.call('get', path, {
70
- 'content-type' => 'application/json',
71
- }, params);
72
- end
73
-
74
- def get_queue_tasks()
75
- path = '/health/queue/tasks'
156
+ params = {
157
+ }
76
158
 
77
- params = {}
159
+ headers = {
160
+ "content-type": 'application/json',
161
+ }
78
162
 
79
- return @client.call('get', path, {
80
- 'content-type' => 'application/json',
81
- }, params);
163
+ @client.call(
164
+ method: 'GET',
165
+ path: path,
166
+ params: params,
167
+ headers: headers,
168
+ response_type: HealthQueue
169
+ )
82
170
  end
83
171
 
172
+ # Get the number of usage stats that are waiting to be processed in the
173
+ # Appwrite internal queue server.
174
+ #
175
+ #
176
+ # @return [HealthQueue]
84
177
  def get_queue_usage()
85
178
  path = '/health/queue/usage'
86
179
 
87
- params = {}
180
+ params = {
181
+ }
88
182
 
89
- return @client.call('get', path, {
90
- 'content-type' => 'application/json',
91
- }, params);
183
+ headers = {
184
+ "content-type": 'application/json',
185
+ }
186
+
187
+ @client.call(
188
+ method: 'GET',
189
+ path: path,
190
+ params: params,
191
+ headers: headers,
192
+ response_type: HealthQueue
193
+ )
92
194
  end
93
195
 
196
+ # Get the number of webhooks that are waiting to be processed in the Appwrite
197
+ # internal queue server.
198
+ #
199
+ #
200
+ # @return [HealthQueue]
94
201
  def get_queue_webhooks()
95
202
  path = '/health/queue/webhooks'
96
203
 
97
- params = {}
204
+ params = {
205
+ }
206
+
207
+ headers = {
208
+ "content-type": 'application/json',
209
+ }
98
210
 
99
- return @client.call('get', path, {
100
- 'content-type' => 'application/json',
101
- }, params);
211
+ @client.call(
212
+ method: 'GET',
213
+ path: path,
214
+ params: params,
215
+ headers: headers,
216
+ response_type: HealthQueue
217
+ )
102
218
  end
103
219
 
220
+ # Check the Appwrite local storage device is up and connection is successful.
221
+ #
222
+ #
223
+ # @return [HealthStatus]
104
224
  def get_storage_local()
105
225
  path = '/health/storage/local'
106
226
 
107
- params = {}
227
+ params = {
228
+ }
108
229
 
109
- return @client.call('get', path, {
110
- 'content-type' => 'application/json',
111
- }, params);
230
+ headers = {
231
+ "content-type": 'application/json',
232
+ }
233
+
234
+ @client.call(
235
+ method: 'GET',
236
+ path: path,
237
+ params: params,
238
+ headers: headers,
239
+ response_type: HealthStatus
240
+ )
112
241
  end
113
242
 
243
+ # Check the Appwrite server time is synced with Google remote NTP server. We
244
+ # use this technology to smoothly handle leap seconds with no disruptive
245
+ # events. The [Network Time
246
+ # Protocol](https://en.wikipedia.org/wiki/Network_Time_Protocol) (NTP) is
247
+ # used by hundreds of millions of computers and devices to synchronize their
248
+ # clocks over the Internet. If your computer sets its own clock, it likely
249
+ # uses NTP.
250
+ #
251
+ #
252
+ # @return [HealthTime]
114
253
  def get_time()
115
254
  path = '/health/time'
116
255
 
117
- params = {}
118
-
119
- return @client.call('get', path, {
120
- 'content-type' => 'application/json',
121
- }, params);
122
- end
256
+ params = {
257
+ }
123
258
 
259
+ headers = {
260
+ "content-type": 'application/json',
261
+ }
124
262
 
125
- protected
263
+ @client.call(
264
+ method: 'GET',
265
+ path: path,
266
+ params: params,
267
+ headers: headers,
268
+ response_type: HealthTime
269
+ )
270
+ end
126
271
 
127
- private
128
272
  end
129
273
  end
@@ -1,79 +1,181 @@
1
+ #frozen_string_literal: true
2
+
1
3
  module Appwrite
2
4
  class Locale < Service
3
5
 
6
+ include Models
7
+ # Get the current user location based on IP. Returns an object with user
8
+ # country code, country name, continent name, continent code, ip address and
9
+ # suggested currency. You can use the locale header to get the data in a
10
+ # supported language.
11
+ #
12
+ # ([IP Geolocation by DB-IP](https://db-ip.com))
13
+ #
14
+ #
15
+ # @return [Locale]
4
16
  def get()
5
17
  path = '/locale'
6
18
 
7
- params = {}
19
+ params = {
20
+ }
21
+
22
+ headers = {
23
+ "content-type": 'application/json',
24
+ }
8
25
 
9
- return @client.call('get', path, {
10
- 'content-type' => 'application/json',
11
- }, params);
26
+ @client.call(
27
+ method: 'GET',
28
+ path: path,
29
+ params: params,
30
+ headers: headers,
31
+ response_type: Locale
32
+ )
12
33
  end
13
34
 
35
+ # List of all continents. You can use the locale header to get the data in a
36
+ # supported language.
37
+ #
38
+ #
39
+ # @return [ContinentList]
14
40
  def get_continents()
15
41
  path = '/locale/continents'
16
42
 
17
- params = {}
43
+ params = {
44
+ }
45
+
46
+ headers = {
47
+ "content-type": 'application/json',
48
+ }
18
49
 
19
- return @client.call('get', path, {
20
- 'content-type' => 'application/json',
21
- }, params);
50
+ @client.call(
51
+ method: 'GET',
52
+ path: path,
53
+ params: params,
54
+ headers: headers,
55
+ response_type: ContinentList
56
+ )
22
57
  end
23
58
 
59
+ # List of all countries. You can use the locale header to get the data in a
60
+ # supported language.
61
+ #
62
+ #
63
+ # @return [CountryList]
24
64
  def get_countries()
25
65
  path = '/locale/countries'
26
66
 
27
- params = {}
67
+ params = {
68
+ }
28
69
 
29
- return @client.call('get', path, {
30
- 'content-type' => 'application/json',
31
- }, params);
70
+ headers = {
71
+ "content-type": 'application/json',
72
+ }
73
+
74
+ @client.call(
75
+ method: 'GET',
76
+ path: path,
77
+ params: params,
78
+ headers: headers,
79
+ response_type: CountryList
80
+ )
32
81
  end
33
82
 
83
+ # List of all countries that are currently members of the EU. You can use the
84
+ # locale header to get the data in a supported language.
85
+ #
86
+ #
87
+ # @return [CountryList]
34
88
  def get_countries_eu()
35
89
  path = '/locale/countries/eu'
36
90
 
37
- params = {}
91
+ params = {
92
+ }
93
+
94
+ headers = {
95
+ "content-type": 'application/json',
96
+ }
38
97
 
39
- return @client.call('get', path, {
40
- 'content-type' => 'application/json',
41
- }, params);
98
+ @client.call(
99
+ method: 'GET',
100
+ path: path,
101
+ params: params,
102
+ headers: headers,
103
+ response_type: CountryList
104
+ )
42
105
  end
43
106
 
107
+ # List of all countries phone codes. You can use the locale header to get the
108
+ # data in a supported language.
109
+ #
110
+ #
111
+ # @return [PhoneList]
44
112
  def get_countries_phones()
45
113
  path = '/locale/countries/phones'
46
114
 
47
- params = {}
115
+ params = {
116
+ }
48
117
 
49
- return @client.call('get', path, {
50
- 'content-type' => 'application/json',
51
- }, params);
118
+ headers = {
119
+ "content-type": 'application/json',
120
+ }
121
+
122
+ @client.call(
123
+ method: 'GET',
124
+ path: path,
125
+ params: params,
126
+ headers: headers,
127
+ response_type: PhoneList
128
+ )
52
129
  end
53
130
 
131
+ # List of all currencies, including currency symbol, name, plural, and
132
+ # decimal digits for all major and minor currencies. You can use the locale
133
+ # header to get the data in a supported language.
134
+ #
135
+ #
136
+ # @return [CurrencyList]
54
137
  def get_currencies()
55
138
  path = '/locale/currencies'
56
139
 
57
- params = {}
140
+ params = {
141
+ }
142
+
143
+ headers = {
144
+ "content-type": 'application/json',
145
+ }
58
146
 
59
- return @client.call('get', path, {
60
- 'content-type' => 'application/json',
61
- }, params);
147
+ @client.call(
148
+ method: 'GET',
149
+ path: path,
150
+ params: params,
151
+ headers: headers,
152
+ response_type: CurrencyList
153
+ )
62
154
  end
63
155
 
156
+ # List of all languages classified by ISO 639-1 including 2-letter code, name
157
+ # in English, and name in the respective language.
158
+ #
159
+ #
160
+ # @return [LanguageList]
64
161
  def get_languages()
65
162
  path = '/locale/languages'
66
163
 
67
- params = {}
164
+ params = {
165
+ }
68
166
 
69
- return @client.call('get', path, {
70
- 'content-type' => 'application/json',
71
- }, params);
72
- end
167
+ headers = {
168
+ "content-type": 'application/json',
169
+ }
73
170
 
171
+ @client.call(
172
+ method: 'GET',
173
+ path: path,
174
+ params: params,
175
+ headers: headers,
176
+ response_type: LanguageList
177
+ )
178
+ end
74
179
 
75
- protected
76
-
77
- private
78
180
  end
79
181
  end