Class: Appwrite::Storage
- Defined in:
- lib/appwrite/services/storage.rb
Instance Method Summary collapse
- #create_file(files:, read: [], write: [], folder_id: '') ⇒ Object
- #delete_file(file_id:) ⇒ Object
- #get_file(file_id:) ⇒ Object
- #get_file_download(file_id:) ⇒ Object
- #get_file_preview(file_id:, width: 0, height: 0, quality: 100, background: '', output: '') ⇒ Object
- #get_file_view(file_id:, as: '') ⇒ Object
- #list_files(search: '', limit: 25, offset: 0, order_type: 'ASC') ⇒ Object
- #update_file(file_id:, read: [], write: [], folder_id: '') ⇒ Object
Methods inherited from Service
Constructor Details
This class inherits a constructor from Appwrite::Service
Instance Method Details
#create_file(files:, read: [], write: [], folder_id: '') ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/appwrite/services/storage.rb', line 19 def create_file(files:, read: [], write: [], folder_id: '') path = '/storage/files' params = { 'files': files, 'read': read, 'write': write, 'folderId': folder_id } return @client.call('post', path, { 'content-type' => 'multipart/form-data', }, params); end |
#delete_file(file_id:) ⇒ Object
61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/appwrite/services/storage.rb', line 61 def delete_file(file_id:) path = '/storage/files/{fileId}' .gsub('{file_id}', file_id) params = { } return @client.call('delete', path, { 'content-type' => 'application/json', }, params); end |
#get_file(file_id:) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/appwrite/services/storage.rb', line 34 def get_file(file_id:) path = '/storage/files/{fileId}' .gsub('{file_id}', file_id) params = { } return @client.call('get', path, { 'content-type' => 'application/json', }, params); end |
#get_file_download(file_id:) ⇒ Object
73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/appwrite/services/storage.rb', line 73 def get_file_download(file_id:) path = '/storage/files/{fileId}/download' .gsub('{file_id}', file_id) params = { } return @client.call('get', path, { 'content-type' => 'application/json', }, params); end |
#get_file_preview(file_id:, width: 0, height: 0, quality: 100, background: '', output: '') ⇒ Object
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/appwrite/services/storage.rb', line 85 def get_file_preview(file_id:, width: 0, height: 0, quality: 100, background: '', output: '') path = '/storage/files/{fileId}/preview' .gsub('{file_id}', file_id) params = { 'width': width, 'height': height, 'quality': quality, 'background': background, 'output': output } return @client.call('get', path, { 'content-type' => 'application/json', }, params); end |
#get_file_view(file_id:, as: '') ⇒ Object
102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/appwrite/services/storage.rb', line 102 def get_file_view(file_id:, as: '') path = '/storage/files/{fileId}/view' .gsub('{file_id}', file_id) params = { 'as': as } return @client.call('get', path, { 'content-type' => 'application/json', }, params); end |
#list_files(search: '', limit: 25, offset: 0, order_type: 'ASC') ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/appwrite/services/storage.rb', line 4 def list_files(search: '', limit: 25, offset: 0, order_type: 'ASC') path = '/storage/files' params = { 'search': search, 'limit': limit, 'offset': offset, 'orderType': order_type } return @client.call('get', path, { 'content-type' => 'application/json', }, params); end |
#update_file(file_id:, read: [], write: [], folder_id: '') ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/appwrite/services/storage.rb', line 46 def update_file(file_id:, read: [], write: [], folder_id: '') path = '/storage/files/{fileId}' .gsub('{file_id}', file_id) params = { 'read': read, 'write': write, 'folderId': folder_id } return @client.call('put', path, { 'content-type' => 'application/json', }, params); end |