Class: DirectusSDK::FilesApi
- Inherits:
-
Object
- Object
- DirectusSDK::FilesApi
- Defined in:
- lib/directus_sdk/api/files_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#create_file(opts = {}) ⇒ nil
Creates file.
-
#create_file_with_http_info(opts = {}) ⇒ Array<(nil, Fixnum, Hash)>
Creates file.
-
#get_file(file_id, opts = {}) ⇒ GetFile
Returns specific file by id.
-
#get_file_with_http_info(file_id, opts = {}) ⇒ Array<(GetFile, Fixnum, Hash)>
Returns specific file by id.
-
#get_files(opts = {}) ⇒ GetFiles
Returns files.
-
#get_files_with_http_info(opts = {}) ⇒ Array<(GetFiles, Fixnum, Hash)>
Returns files.
-
#initialize(api_client = ApiClient.default) ⇒ FilesApi
constructor
A new instance of FilesApi.
-
#update_file(file_id, opts = {}) ⇒ nil
Creates file.
-
#update_file_with_http_info(file_id, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>
Creates file.
Constructor Details
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
17 18 19 |
# File 'lib/directus_sdk/api/files_api.rb', line 17 def api_client @api_client end |
Instance Method Details
#create_file(opts = {}) ⇒ nil
Creates file
35 36 37 38 |
# File 'lib/directus_sdk/api/files_api.rb', line 35 def create_file(opts = {}) create_file_with_http_info(opts) return nil end |
#create_file_with_http_info(opts = {}) ⇒ Array<(nil, Fixnum, Hash)>
Creates file
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/directus_sdk/api/files_api.rb', line 52 def create_file_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: FilesApi.create_file ..." end # resource path local_var_path = "/files" # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded']) # form parameters form_params = {} form_params["data"] = opts[:'data'] if !opts[:'data'].nil? form_params["active"] = opts[:'active'] if !opts[:'active'].nil? form_params["name"] = opts[:'name'] if !opts[:'name'].nil? form_params["title"] = opts[:'title'] if !opts[:'title'].nil? form_params["location"] = opts[:'location'] if !opts[:'location'].nil? form_params["type"] = opts[:'type'] if !opts[:'type'].nil? form_params["tags"] = opts[:'tags'] if !opts[:'tags'].nil? form_params["caption"] = opts[:'caption'] if !opts[:'caption'].nil? # http body (model) post_body = nil auth_names = ['api_key'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names) if @api_client.config.debugging @api_client.config.logger.debug "API called: FilesApi#create_file\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_file(file_id, opts = {}) ⇒ GetFile
Returns specific file by id
100 101 102 103 |
# File 'lib/directus_sdk/api/files_api.rb', line 100 def get_file(file_id, opts = {}) data, _status_code, _headers = get_file_with_http_info(file_id, opts) return data end |
#get_file_with_http_info(file_id, opts = {}) ⇒ Array<(GetFile, Fixnum, Hash)>
Returns specific file by id
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 |
# File 'lib/directus_sdk/api/files_api.rb', line 110 def get_file_with_http_info(file_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: FilesApi.get_file ..." end # verify the required parameter 'file_id' is set if @api_client.config.client_side_validation && file_id.nil? fail ArgumentError, "Missing the required parameter 'file_id' when calling FilesApi.get_file" end # resource path local_var_path = "/files/{fileId}".sub('{' + 'fileId' + '}', file_id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['api_key'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'GetFile') if @api_client.config.debugging @api_client.config.logger.debug "API called: FilesApi#get_file\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_files(opts = {}) ⇒ GetFiles
Returns files
152 153 154 155 |
# File 'lib/directus_sdk/api/files_api.rb', line 152 def get_files(opts = {}) data, _status_code, _headers = get_files_with_http_info(opts) return data end |
#get_files_with_http_info(opts = {}) ⇒ Array<(GetFiles, Fixnum, Hash)>
Returns files
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 |
# File 'lib/directus_sdk/api/files_api.rb', line 161 def get_files_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: FilesApi.get_files ..." end # resource path local_var_path = "/files" # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['api_key'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'GetFiles') if @api_client.config.debugging @api_client.config.logger.debug "API called: FilesApi#get_files\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#update_file(file_id, opts = {}) ⇒ nil
Creates file
216 217 218 219 |
# File 'lib/directus_sdk/api/files_api.rb', line 216 def update_file(file_id, opts = {}) update_file_with_http_info(file_id, opts) return nil end |
#update_file_with_http_info(file_id, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>
Creates file
242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 |
# File 'lib/directus_sdk/api/files_api.rb', line 242 def update_file_with_http_info(file_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: FilesApi.update_file ..." end # verify the required parameter 'file_id' is set if @api_client.config.client_side_validation && file_id.nil? fail ArgumentError, "Missing the required parameter 'file_id' when calling FilesApi.update_file" end # resource path local_var_path = "/files/{fileId}".sub('{' + 'fileId' + '}', file_id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded']) # form parameters form_params = {} form_params["data"] = opts[:'data'] if !opts[:'data'].nil? form_params["active"] = opts[:'active'] if !opts[:'active'].nil? form_params["name"] = opts[:'name'] if !opts[:'name'].nil? form_params["title"] = opts[:'title'] if !opts[:'title'].nil? form_params["location"] = opts[:'location'] if !opts[:'location'].nil? form_params["type"] = opts[:'type'] if !opts[:'type'].nil? form_params["tags"] = opts[:'tags'] if !opts[:'tags'].nil? form_params["caption"] = opts[:'caption'] if !opts[:'caption'].nil? form_params["url"] = opts[:'url'] if !opts[:'url'].nil? form_params["width"] = opts[:'width'] if !opts[:'width'].nil? form_params["height"] = opts[:'height'] if !opts[:'height'].nil? form_params["size"] = opts[:'size'] if !opts[:'size'].nil? form_params["embed_id"] = opts[:'embed_id'] if !opts[:'embed_id'].nil? form_params["user"] = opts[:'user'] if !opts[:'user'].nil? form_params["date_uploaded"] = opts[:'date_uploaded'] if !opts[:'date_uploaded'].nil? form_params["storage_adapter"] = opts[:'storage_adapter'] if !opts[:'storage_adapter'].nil? # http body (model) post_body = nil auth_names = ['api_key'] data, status_code, headers = @api_client.call_api(:PUT, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names) if @api_client.config.debugging @api_client.config.logger.debug "API called: FilesApi#update_file\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |