appwrite 7.1.0 → 9.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/lib/appwrite/client.rb +2 -2
  3. data/lib/appwrite/models/algo_argon2.rb +5 -0
  4. data/lib/appwrite/models/algo_bcrypt.rb +5 -0
  5. data/lib/appwrite/models/algo_md5.rb +5 -0
  6. data/lib/appwrite/models/algo_phpass.rb +5 -0
  7. data/lib/appwrite/models/algo_scrypt.rb +5 -0
  8. data/lib/appwrite/models/algo_scrypt_modified.rb +5 -0
  9. data/lib/appwrite/models/algo_sha.rb +5 -0
  10. data/lib/appwrite/models/attribute_boolean.rb +5 -0
  11. data/lib/appwrite/models/attribute_datetime.rb +5 -0
  12. data/lib/appwrite/models/attribute_email.rb +5 -0
  13. data/lib/appwrite/models/attribute_enum.rb +5 -0
  14. data/lib/appwrite/models/attribute_float.rb +5 -0
  15. data/lib/appwrite/models/attribute_integer.rb +5 -0
  16. data/lib/appwrite/models/attribute_ip.rb +5 -0
  17. data/lib/appwrite/models/attribute_relationship.rb +82 -0
  18. data/lib/appwrite/models/attribute_string.rb +5 -0
  19. data/lib/appwrite/models/attribute_url.rb +5 -0
  20. data/lib/appwrite/models/database.rb +8 -3
  21. data/lib/appwrite/models/deployment.rb +65 -10
  22. data/lib/appwrite/models/execution.rb +40 -20
  23. data/lib/appwrite/models/function.rb +53 -13
  24. data/lib/appwrite/models/headers.rb +32 -0
  25. data/lib/appwrite/models/health_status.rb +5 -0
  26. data/lib/appwrite/models/identity.rb +72 -0
  27. data/lib/appwrite/models/identity_list.rb +32 -0
  28. data/lib/appwrite/models/index.rb +5 -0
  29. data/lib/appwrite/models/locale_code.rb +32 -0
  30. data/lib/appwrite/models/locale_code_list.rb +32 -0
  31. data/lib/appwrite/models/team.rb +8 -3
  32. data/lib/appwrite/models/user.rb +16 -6
  33. data/lib/appwrite/models/variable.rb +10 -5
  34. data/lib/appwrite/query.rb +41 -17
  35. data/lib/appwrite/services/account.rb +120 -65
  36. data/lib/appwrite/services/avatars.rb +14 -14
  37. data/lib/appwrite/services/databases.rb +834 -188
  38. data/lib/appwrite/services/functions.rb +150 -74
  39. data/lib/appwrite/services/graphql.rb +71 -0
  40. data/lib/appwrite/services/health.rb +71 -22
  41. data/lib/appwrite/services/locale.rb +39 -14
  42. data/lib/appwrite/services/storage.rb +43 -42
  43. data/lib/appwrite/services/teams.rb +123 -50
  44. data/lib/appwrite/services/users.rb +158 -60
  45. data/lib/appwrite.rb +7 -1
  46. metadata +10 -4
  47. data/lib/appwrite/models/account.rb +0 -82
@@ -12,7 +12,7 @@ module Appwrite
12
12
  #
13
13
  # @return [HealthStatus]
14
14
  def get()
15
- path = '/health'
15
+ api_path = '/health'
16
16
 
17
17
  params = {
18
18
  }
@@ -23,7 +23,7 @@ module Appwrite
23
23
 
24
24
  @client.call(
25
25
  method: 'GET',
26
- path: path,
26
+ path: api_path,
27
27
  headers: headers,
28
28
  params: params,
29
29
  response_type: Models::HealthStatus
@@ -36,7 +36,7 @@ module Appwrite
36
36
  #
37
37
  # @return [HealthAntivirus]
38
38
  def get_antivirus()
39
- path = '/health/anti-virus'
39
+ api_path = '/health/anti-virus'
40
40
 
41
41
  params = {
42
42
  }
@@ -47,7 +47,7 @@ module Appwrite
47
47
 
48
48
  @client.call(
49
49
  method: 'GET',
50
- path: path,
50
+ path: api_path,
51
51
  headers: headers,
52
52
  params: params,
53
53
  response_type: Models::HealthAntivirus
@@ -55,13 +55,13 @@ module Appwrite
55
55
  end
56
56
 
57
57
 
58
- # Check the Appwrite in-memory cache server is up and connection is
58
+ # Check the Appwrite in-memory cache servers are up and connection is
59
59
  # successful.
60
60
  #
61
61
  #
62
62
  # @return [HealthStatus]
63
63
  def get_cache()
64
- path = '/health/cache'
64
+ api_path = '/health/cache'
65
65
 
66
66
  params = {
67
67
  }
@@ -72,7 +72,7 @@ module Appwrite
72
72
 
73
73
  @client.call(
74
74
  method: 'GET',
75
- path: path,
75
+ path: api_path,
76
76
  headers: headers,
77
77
  params: params,
78
78
  response_type: Models::HealthStatus
@@ -80,12 +80,12 @@ module Appwrite
80
80
  end
81
81
 
82
82
 
83
- # Check the Appwrite database server is up and connection is successful.
83
+ # Check the Appwrite database servers are up and connection is successful.
84
84
  #
85
85
  #
86
86
  # @return [HealthStatus]
87
87
  def get_db()
88
- path = '/health/db'
88
+ api_path = '/health/db'
89
89
 
90
90
  params = {
91
91
  }
@@ -96,7 +96,56 @@ module Appwrite
96
96
 
97
97
  @client.call(
98
98
  method: 'GET',
99
- path: path,
99
+ path: api_path,
100
+ headers: headers,
101
+ params: params,
102
+ response_type: Models::HealthStatus
103
+ )
104
+ end
105
+
106
+
107
+ # Check the Appwrite pub-sub servers are up and connection is successful.
108
+ #
109
+ #
110
+ # @return [HealthStatus]
111
+ def get_pub_sub()
112
+ api_path = '/health/pubsub'
113
+
114
+ params = {
115
+ }
116
+
117
+ headers = {
118
+ "content-type": 'application/json',
119
+ }
120
+
121
+ @client.call(
122
+ method: 'GET',
123
+ path: api_path,
124
+ headers: headers,
125
+ params: params,
126
+ response_type: Models::HealthStatus
127
+ )
128
+ end
129
+
130
+
131
+ # Check the Appwrite queue messaging servers are up and connection is
132
+ # successful.
133
+ #
134
+ #
135
+ # @return [HealthStatus]
136
+ def get_queue()
137
+ api_path = '/health/queue'
138
+
139
+ params = {
140
+ }
141
+
142
+ headers = {
143
+ "content-type": 'application/json',
144
+ }
145
+
146
+ @client.call(
147
+ method: 'GET',
148
+ path: api_path,
100
149
  headers: headers,
101
150
  params: params,
102
151
  response_type: Models::HealthStatus
@@ -111,7 +160,7 @@ module Appwrite
111
160
  #
112
161
  # @return [HealthQueue]
113
162
  def get_queue_certificates()
114
- path = '/health/queue/certificates'
163
+ api_path = '/health/queue/certificates'
115
164
 
116
165
  params = {
117
166
  }
@@ -122,7 +171,7 @@ module Appwrite
122
171
 
123
172
  @client.call(
124
173
  method: 'GET',
125
- path: path,
174
+ path: api_path,
126
175
  headers: headers,
127
176
  params: params,
128
177
  response_type: Models::HealthQueue
@@ -135,7 +184,7 @@ module Appwrite
135
184
  #
136
185
  # @return [HealthQueue]
137
186
  def get_queue_functions()
138
- path = '/health/queue/functions'
187
+ api_path = '/health/queue/functions'
139
188
 
140
189
  params = {
141
190
  }
@@ -146,7 +195,7 @@ module Appwrite
146
195
 
147
196
  @client.call(
148
197
  method: 'GET',
149
- path: path,
198
+ path: api_path,
150
199
  headers: headers,
151
200
  params: params,
152
201
  response_type: Models::HealthQueue
@@ -160,7 +209,7 @@ module Appwrite
160
209
  #
161
210
  # @return [HealthQueue]
162
211
  def get_queue_logs()
163
- path = '/health/queue/logs'
212
+ api_path = '/health/queue/logs'
164
213
 
165
214
  params = {
166
215
  }
@@ -171,7 +220,7 @@ module Appwrite
171
220
 
172
221
  @client.call(
173
222
  method: 'GET',
174
- path: path,
223
+ path: api_path,
175
224
  headers: headers,
176
225
  params: params,
177
226
  response_type: Models::HealthQueue
@@ -185,7 +234,7 @@ module Appwrite
185
234
  #
186
235
  # @return [HealthQueue]
187
236
  def get_queue_webhooks()
188
- path = '/health/queue/webhooks'
237
+ api_path = '/health/queue/webhooks'
189
238
 
190
239
  params = {
191
240
  }
@@ -196,7 +245,7 @@ module Appwrite
196
245
 
197
246
  @client.call(
198
247
  method: 'GET',
199
- path: path,
248
+ path: api_path,
200
249
  headers: headers,
201
250
  params: params,
202
251
  response_type: Models::HealthQueue
@@ -209,7 +258,7 @@ module Appwrite
209
258
  #
210
259
  # @return [HealthStatus]
211
260
  def get_storage_local()
212
- path = '/health/storage/local'
261
+ api_path = '/health/storage/local'
213
262
 
214
263
  params = {
215
264
  }
@@ -220,7 +269,7 @@ module Appwrite
220
269
 
221
270
  @client.call(
222
271
  method: 'GET',
223
- path: path,
272
+ path: api_path,
224
273
  headers: headers,
225
274
  params: params,
226
275
  response_type: Models::HealthStatus
@@ -239,7 +288,7 @@ module Appwrite
239
288
  #
240
289
  # @return [HealthTime]
241
290
  def get_time()
242
- path = '/health/time'
291
+ api_path = '/health/time'
243
292
 
244
293
  params = {
245
294
  }
@@ -250,7 +299,7 @@ module Appwrite
250
299
 
251
300
  @client.call(
252
301
  method: 'GET',
253
- path: path,
302
+ path: api_path,
254
303
  headers: headers,
255
304
  params: params,
256
305
  response_type: Models::HealthTime
@@ -17,7 +17,7 @@ module Appwrite
17
17
  #
18
18
  # @return [Locale]
19
19
  def get()
20
- path = '/locale'
20
+ api_path = '/locale'
21
21
 
22
22
  params = {
23
23
  }
@@ -28,7 +28,7 @@ module Appwrite
28
28
 
29
29
  @client.call(
30
30
  method: 'GET',
31
- path: path,
31
+ path: api_path,
32
32
  headers: headers,
33
33
  params: params,
34
34
  response_type: Models::Locale
@@ -36,13 +36,38 @@ module Appwrite
36
36
  end
37
37
 
38
38
 
39
+ # List of all locale codes in [ISO
40
+ # 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes).
41
+ #
42
+ #
43
+ # @return [LocaleCodeList]
44
+ def list_codes()
45
+ api_path = '/locale/codes'
46
+
47
+ params = {
48
+ }
49
+
50
+ headers = {
51
+ "content-type": 'application/json',
52
+ }
53
+
54
+ @client.call(
55
+ method: 'GET',
56
+ path: api_path,
57
+ headers: headers,
58
+ params: params,
59
+ response_type: Models::LocaleCodeList
60
+ )
61
+ end
62
+
63
+
39
64
  # List of all continents. You can use the locale header to get the data in a
40
65
  # supported language.
41
66
  #
42
67
  #
43
68
  # @return [ContinentList]
44
69
  def list_continents()
45
- path = '/locale/continents'
70
+ api_path = '/locale/continents'
46
71
 
47
72
  params = {
48
73
  }
@@ -53,7 +78,7 @@ module Appwrite
53
78
 
54
79
  @client.call(
55
80
  method: 'GET',
56
- path: path,
81
+ path: api_path,
57
82
  headers: headers,
58
83
  params: params,
59
84
  response_type: Models::ContinentList
@@ -67,7 +92,7 @@ module Appwrite
67
92
  #
68
93
  # @return [CountryList]
69
94
  def list_countries()
70
- path = '/locale/countries'
95
+ api_path = '/locale/countries'
71
96
 
72
97
  params = {
73
98
  }
@@ -78,7 +103,7 @@ module Appwrite
78
103
 
79
104
  @client.call(
80
105
  method: 'GET',
81
- path: path,
106
+ path: api_path,
82
107
  headers: headers,
83
108
  params: params,
84
109
  response_type: Models::CountryList
@@ -92,7 +117,7 @@ module Appwrite
92
117
  #
93
118
  # @return [CountryList]
94
119
  def list_countries_eu()
95
- path = '/locale/countries/eu'
120
+ api_path = '/locale/countries/eu'
96
121
 
97
122
  params = {
98
123
  }
@@ -103,7 +128,7 @@ module Appwrite
103
128
 
104
129
  @client.call(
105
130
  method: 'GET',
106
- path: path,
131
+ path: api_path,
107
132
  headers: headers,
108
133
  params: params,
109
134
  response_type: Models::CountryList
@@ -117,7 +142,7 @@ module Appwrite
117
142
  #
118
143
  # @return [PhoneList]
119
144
  def list_countries_phones()
120
- path = '/locale/countries/phones'
145
+ api_path = '/locale/countries/phones'
121
146
 
122
147
  params = {
123
148
  }
@@ -128,7 +153,7 @@ module Appwrite
128
153
 
129
154
  @client.call(
130
155
  method: 'GET',
131
- path: path,
156
+ path: api_path,
132
157
  headers: headers,
133
158
  params: params,
134
159
  response_type: Models::PhoneList
@@ -143,7 +168,7 @@ module Appwrite
143
168
  #
144
169
  # @return [CurrencyList]
145
170
  def list_currencies()
146
- path = '/locale/currencies'
171
+ api_path = '/locale/currencies'
147
172
 
148
173
  params = {
149
174
  }
@@ -154,7 +179,7 @@ module Appwrite
154
179
 
155
180
  @client.call(
156
181
  method: 'GET',
157
- path: path,
182
+ path: api_path,
158
183
  headers: headers,
159
184
  params: params,
160
185
  response_type: Models::CurrencyList
@@ -168,7 +193,7 @@ module Appwrite
168
193
  #
169
194
  # @return [LanguageList]
170
195
  def list_languages()
171
- path = '/locale/languages'
196
+ api_path = '/locale/languages'
172
197
 
173
198
  params = {
174
199
  }
@@ -179,7 +204,7 @@ module Appwrite
179
204
 
180
205
  @client.call(
181
206
  method: 'GET',
182
- path: path,
207
+ path: api_path,
183
208
  headers: headers,
184
209
  params: params,
185
210
  response_type: Models::LanguageList
@@ -10,12 +10,12 @@ module Appwrite
10
10
  # Get a list of all the storage buckets. You can use the query params to
11
11
  # filter your results.
12
12
  #
13
- # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: enabled, name, fileSecurity, maximumFileSize, encryption, antivirus
13
+ # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: enabled, name, fileSecurity, maximumFileSize, encryption, antivirus
14
14
  # @param [String] search Search term to filter your list results. Max length: 256 chars.
15
15
  #
16
16
  # @return [BucketList]
17
17
  def list_buckets(queries: nil, search: nil)
18
- path = '/storage/buckets'
18
+ api_path = '/storage/buckets'
19
19
 
20
20
  params = {
21
21
  queries: queries,
@@ -28,7 +28,7 @@ module Appwrite
28
28
 
29
29
  @client.call(
30
30
  method: 'GET',
31
- path: path,
31
+ path: api_path,
32
32
  headers: headers,
33
33
  params: params,
34
34
  response_type: Models::BucketList
@@ -38,12 +38,12 @@ module Appwrite
38
38
 
39
39
  # Create a new storage bucket.
40
40
  #
41
- # @param [String] bucket_id Unique 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't start with a special char. Max length is 36 chars.
41
+ # @param [String] bucket_id Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
42
42
  # @param [String] name Bucket name
43
- # @param [Array] permissions An array of permission strings. By default no user is granted with any permissions. [Learn more about permissions](/docs/permissions).
43
+ # @param [Array] permissions An array of permission strings. By default, no user is granted with any permissions. [Learn more about permissions](/docs/permissions).
44
44
  # @param [] file_security Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](/docs/permissions).
45
- # @param [] enabled Is bucket enabled?
46
- # @param [Integer] maximum_file_size Maximum file size allowed in bytes. Maximum allowed value is 30MB. For self-hosted setups you can change the max limit by changing the `_APP_STORAGE_LIMIT` environment variable. [Learn more about storage environment variables](docs/environment-variables#storage)
45
+ # @param [] enabled Is bucket enabled? When set to 'disabled', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled.
46
+ # @param [Integer] maximum_file_size Maximum file size allowed in bytes. Maximum allowed value is 30MB.
47
47
  # @param [Array] allowed_file_extensions Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long.
48
48
  # @param [String] compression Compression algorithm choosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled
49
49
  # @param [] encryption Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled
@@ -51,7 +51,7 @@ module Appwrite
51
51
  #
52
52
  # @return [Bucket]
53
53
  def create_bucket(bucket_id:, name:, permissions: nil, file_security: nil, enabled: nil, maximum_file_size: nil, allowed_file_extensions: nil, compression: nil, encryption: nil, antivirus: nil)
54
- path = '/storage/buckets'
54
+ api_path = '/storage/buckets'
55
55
 
56
56
  if bucket_id.nil?
57
57
  raise Appwrite::Exception.new('Missing required parameter: "bucketId"')
@@ -80,7 +80,7 @@ module Appwrite
80
80
 
81
81
  @client.call(
82
82
  method: 'POST',
83
- path: path,
83
+ path: api_path,
84
84
  headers: headers,
85
85
  params: params,
86
86
  response_type: Models::Bucket
@@ -95,7 +95,7 @@ module Appwrite
95
95
  #
96
96
  # @return [Bucket]
97
97
  def get_bucket(bucket_id:)
98
- path = '/storage/buckets/{bucketId}'
98
+ api_path = '/storage/buckets/{bucketId}'
99
99
  .gsub('{bucketId}', bucket_id)
100
100
 
101
101
  if bucket_id.nil?
@@ -111,7 +111,7 @@ module Appwrite
111
111
 
112
112
  @client.call(
113
113
  method: 'GET',
114
- path: path,
114
+ path: api_path,
115
115
  headers: headers,
116
116
  params: params,
117
117
  response_type: Models::Bucket
@@ -123,10 +123,10 @@ module Appwrite
123
123
  #
124
124
  # @param [String] bucket_id Bucket unique ID.
125
125
  # @param [String] name Bucket name
126
- # @param [Array] permissions An array of permission strings. By default the current permissions are inherited. [Learn more about permissions](/docs/permissions).
126
+ # @param [Array] permissions An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](/docs/permissions).
127
127
  # @param [] file_security Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](/docs/permissions).
128
- # @param [] enabled Is bucket enabled?
129
- # @param [Integer] maximum_file_size Maximum file size allowed in bytes. Maximum allowed value is 30MB. For self hosted version you can change the limit by changing _APP_STORAGE_LIMIT environment variable. [Learn more about storage environment variables](docs/environment-variables#storage)
128
+ # @param [] enabled Is bucket enabled? When set to 'disabled', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled.
129
+ # @param [Integer] maximum_file_size Maximum file size allowed in bytes. Maximum allowed value is 30MB.
130
130
  # @param [Array] allowed_file_extensions Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long.
131
131
  # @param [String] compression Compression algorithm choosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled
132
132
  # @param [] encryption Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled
@@ -134,7 +134,7 @@ module Appwrite
134
134
  #
135
135
  # @return [Bucket]
136
136
  def update_bucket(bucket_id:, name:, permissions: nil, file_security: nil, enabled: nil, maximum_file_size: nil, allowed_file_extensions: nil, compression: nil, encryption: nil, antivirus: nil)
137
- path = '/storage/buckets/{bucketId}'
137
+ api_path = '/storage/buckets/{bucketId}'
138
138
  .gsub('{bucketId}', bucket_id)
139
139
 
140
140
  if bucket_id.nil?
@@ -163,7 +163,7 @@ module Appwrite
163
163
 
164
164
  @client.call(
165
165
  method: 'PUT',
166
- path: path,
166
+ path: api_path,
167
167
  headers: headers,
168
168
  params: params,
169
169
  response_type: Models::Bucket
@@ -177,7 +177,7 @@ module Appwrite
177
177
  #
178
178
  # @return []
179
179
  def delete_bucket(bucket_id:)
180
- path = '/storage/buckets/{bucketId}'
180
+ api_path = '/storage/buckets/{bucketId}'
181
181
  .gsub('{bucketId}', bucket_id)
182
182
 
183
183
  if bucket_id.nil?
@@ -193,7 +193,7 @@ module Appwrite
193
193
 
194
194
  @client.call(
195
195
  method: 'DELETE',
196
- path: path,
196
+ path: api_path,
197
197
  headers: headers,
198
198
  params: params,
199
199
  )
@@ -201,16 +201,15 @@ module Appwrite
201
201
 
202
202
 
203
203
  # Get a list of all the user files. You can use the query params to filter
204
- # your results. On admin mode, this endpoint will return a list of all of the
205
- # project's files. [Learn more about different API modes](/docs/admin).
204
+ # your results.
206
205
  #
207
206
  # @param [String] bucket_id Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](/docs/server/storage#createBucket).
208
- # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, signature, mimeType, sizeOriginal, chunksTotal, chunksUploaded
207
+ # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, signature, mimeType, sizeOriginal, chunksTotal, chunksUploaded
209
208
  # @param [String] search Search term to filter your list results. Max length: 256 chars.
210
209
  #
211
210
  # @return [FileList]
212
211
  def list_files(bucket_id:, queries: nil, search: nil)
213
- path = '/storage/buckets/{bucketId}/files'
212
+ api_path = '/storage/buckets/{bucketId}/files'
214
213
  .gsub('{bucketId}', bucket_id)
215
214
 
216
215
  if bucket_id.nil?
@@ -228,7 +227,7 @@ module Appwrite
228
227
 
229
228
  @client.call(
230
229
  method: 'GET',
231
- path: path,
230
+ path: api_path,
232
231
  headers: headers,
233
232
  params: params,
234
233
  response_type: Models::FileList
@@ -256,13 +255,13 @@ module Appwrite
256
255
  #
257
256
  #
258
257
  # @param [String] bucket_id Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](/docs/server/storage#createBucket).
259
- # @param [String] file_id File 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't start with a special char. Max length is 36 chars.
260
- # @param [file] file Binary file.
261
- # @param [Array] permissions An array of permission strings. By default the current user is granted with all permissions. [Learn more about permissions](/docs/permissions).
258
+ # @param [String] file_id File ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
259
+ # @param [file] file Binary file. Appwrite SDKs provide helpers to handle file input. [Learn about file input](/docs/storage#file-input).
260
+ # @param [Array] permissions An array of permission strings. By default, only the current user is granted all permissions. [Learn more about permissions](/docs/permissions).
262
261
  #
263
262
  # @return [File]
264
263
  def create_file(bucket_id:, file_id:, file:, permissions: nil, on_progress: nil)
265
- path = '/storage/buckets/{bucketId}/files'
264
+ api_path = '/storage/buckets/{bucketId}/files'
266
265
  .gsub('{bucketId}', bucket_id)
267
266
 
268
267
  if bucket_id.nil?
@@ -291,7 +290,7 @@ module Appwrite
291
290
  param_name = 'file'
292
291
 
293
292
  @client.chunked_upload(
294
- path: path,
293
+ path: api_path,
295
294
  headers: headers,
296
295
  params: params,
297
296
  param_name: param_name,
@@ -310,7 +309,7 @@ module Appwrite
310
309
  #
311
310
  # @return [File]
312
311
  def get_file(bucket_id:, file_id:)
313
- path = '/storage/buckets/{bucketId}/files/{fileId}'
312
+ api_path = '/storage/buckets/{bucketId}/files/{fileId}'
314
313
  .gsub('{bucketId}', bucket_id)
315
314
  .gsub('{fileId}', file_id)
316
315
 
@@ -331,7 +330,7 @@ module Appwrite
331
330
 
332
331
  @client.call(
333
332
  method: 'GET',
334
- path: path,
333
+ path: api_path,
335
334
  headers: headers,
336
335
  params: params,
337
336
  response_type: Models::File
@@ -344,11 +343,12 @@ module Appwrite
344
343
  #
345
344
  # @param [String] bucket_id Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](/docs/server/storage#createBucket).
346
345
  # @param [String] file_id File unique ID.
347
- # @param [Array] permissions An array of permission string. By default the current permissions are inherited. [Learn more about permissions](/docs/permissions).
346
+ # @param [String] name Name of the file
347
+ # @param [Array] permissions An array of permission string. By default, the current permissions are inherited. [Learn more about permissions](/docs/permissions).
348
348
  #
349
349
  # @return [File]
350
- def update_file(bucket_id:, file_id:, permissions: nil)
351
- path = '/storage/buckets/{bucketId}/files/{fileId}'
350
+ def update_file(bucket_id:, file_id:, name: nil, permissions: nil)
351
+ api_path = '/storage/buckets/{bucketId}/files/{fileId}'
352
352
  .gsub('{bucketId}', bucket_id)
353
353
  .gsub('{fileId}', file_id)
354
354
 
@@ -361,6 +361,7 @@ module Appwrite
361
361
  end
362
362
 
363
363
  params = {
364
+ name: name,
364
365
  permissions: permissions,
365
366
  }
366
367
 
@@ -370,7 +371,7 @@ module Appwrite
370
371
 
371
372
  @client.call(
372
373
  method: 'PUT',
373
- path: path,
374
+ path: api_path,
374
375
  headers: headers,
375
376
  params: params,
376
377
  response_type: Models::File
@@ -386,7 +387,7 @@ module Appwrite
386
387
  #
387
388
  # @return []
388
389
  def delete_file(bucket_id:, file_id:)
389
- path = '/storage/buckets/{bucketId}/files/{fileId}'
390
+ api_path = '/storage/buckets/{bucketId}/files/{fileId}'
390
391
  .gsub('{bucketId}', bucket_id)
391
392
  .gsub('{fileId}', file_id)
392
393
 
@@ -407,7 +408,7 @@ module Appwrite
407
408
 
408
409
  @client.call(
409
410
  method: 'DELETE',
410
- path: path,
411
+ path: api_path,
411
412
  headers: headers,
412
413
  params: params,
413
414
  )
@@ -423,7 +424,7 @@ module Appwrite
423
424
  #
424
425
  # @return []
425
426
  def get_file_download(bucket_id:, file_id:)
426
- path = '/storage/buckets/{bucketId}/files/{fileId}/download'
427
+ api_path = '/storage/buckets/{bucketId}/files/{fileId}/download'
427
428
  .gsub('{bucketId}', bucket_id)
428
429
  .gsub('{fileId}', file_id)
429
430
 
@@ -444,7 +445,7 @@ module Appwrite
444
445
 
445
446
  @client.call(
446
447
  method: 'GET',
447
- path: path,
448
+ path: api_path,
448
449
  headers: headers,
449
450
  params: params,
450
451
  )
@@ -473,7 +474,7 @@ module Appwrite
473
474
  #
474
475
  # @return []
475
476
  def get_file_preview(bucket_id:, file_id:, width: nil, height: nil, gravity: nil, quality: nil, border_width: nil, border_color: nil, border_radius: nil, opacity: nil, rotation: nil, background: nil, output: nil)
476
- path = '/storage/buckets/{bucketId}/files/{fileId}/preview'
477
+ api_path = '/storage/buckets/{bucketId}/files/{fileId}/preview'
477
478
  .gsub('{bucketId}', bucket_id)
478
479
  .gsub('{fileId}', file_id)
479
480
 
@@ -505,7 +506,7 @@ module Appwrite
505
506
 
506
507
  @client.call(
507
508
  method: 'GET',
508
- path: path,
509
+ path: api_path,
509
510
  headers: headers,
510
511
  params: params,
511
512
  )
@@ -521,7 +522,7 @@ module Appwrite
521
522
  #
522
523
  # @return []
523
524
  def get_file_view(bucket_id:, file_id:)
524
- path = '/storage/buckets/{bucketId}/files/{fileId}/view'
525
+ api_path = '/storage/buckets/{bucketId}/files/{fileId}/view'
525
526
  .gsub('{bucketId}', bucket_id)
526
527
  .gsub('{fileId}', file_id)
527
528
 
@@ -542,7 +543,7 @@ module Appwrite
542
543
 
543
544
  @client.call(
544
545
  method: 'GET',
545
- path: path,
546
+ path: api_path,
546
547
  headers: headers,
547
548
  params: params,
548
549
  )