class FireflyIIIClient::AttachmentsApi
Attributes
Public Class Methods
# File lib/firefly_iii_client/api/attachments_api.rb, line 19 def initialize(api_client = ApiClient.default) @api_client = api_client end
Public Instance Methods
Delete an attachment. With this endpoint you delete an attachment, including any stored file data. @param id [Integer] The ID of the single. @param [Hash] opts the optional parameters @return [nil]
# File lib/firefly_iii_client/api/attachments_api.rb, line 27 def delete_attachment(id, opts = {}) delete_attachment_with_http_info(id, opts) nil end
Delete an attachment. With this endpoint you delete an attachment, including any stored file data. @param id [Integer] The ID of the single. @param [Hash] opts the optional parameters @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
# File lib/firefly_iii_client/api/attachments_api.rb, line 37 def delete_attachment_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AttachmentsApi.delete_attachment ...' end # verify the required parameter 'id' is set if @api_client.config.client_side_validation && id.nil? fail ArgumentError, "Missing the required parameter 'id' when calling AttachmentsApi.delete_attachment" end # resource path local_var_path = '/api/v1/attachments/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] # auth_names auth_names = opts[:debug_auth_names] || ['firefly_iii_auth'] new_options = opts.merge( :operation => :"AttachmentsApi.delete_attachment", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: AttachmentsApi#delete_attachment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Download a single attachment. This endpoint allows you to download the binary content of a transaction. It will be sent to you as a download, using the content type "application/octet-stream" and content disposition "attachment; filename=example.pdf". @param id [Integer] The ID of the attachment. @param [Hash] opts the optional parameters @return [File]
# File lib/firefly_iii_client/api/attachments_api.rb, line 88 def download_attachment(id, opts = {}) data, _status_code, _headers = download_attachment_with_http_info(id, opts) data end
Download a single attachment. This endpoint allows you to download the binary content of a transaction. It will be sent to you as a download, using the content type "application/octet-stream" and content disposition "attachment; filename=example.pdf". @param id [Integer] The ID of the attachment. @param [Hash] opts the optional parameters @return [Array<(File, Integer, Hash)>] File data, response status code and response headers
# File lib/firefly_iii_client/api/attachments_api.rb, line 98 def download_attachment_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AttachmentsApi.download_attachment ...' end # verify the required parameter 'id' is set if @api_client.config.client_side_validation && id.nil? fail ArgumentError, "Missing the required parameter 'id' when calling AttachmentsApi.download_attachment" end # resource path local_var_path = '/api/v1/attachments/{id}/download'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'File' # auth_names auth_names = opts[:debug_auth_names] || ['firefly_iii_auth'] new_options = opts.merge( :operation => :"AttachmentsApi.download_attachment", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: AttachmentsApi#download_attachment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Get a single attachment. Get a single attachment. This endpoint only returns the available metadata for the attachment. Actual file data is handled in two other endpoints (see below). @param id [Integer] The ID of the attachment. @param [Hash] opts the optional parameters @return [AttachmentSingle]
# File lib/firefly_iii_client/api/attachments_api.rb, line 151 def get_attachment(id, opts = {}) data, _status_code, _headers = get_attachment_with_http_info(id, opts) data end
Get a single attachment. Get a single attachment. This endpoint only returns the available metadata for the attachment. Actual file data is handled in two other endpoints (see below). @param id [Integer] The ID of the attachment. @param [Hash] opts the optional parameters @return [Array<(AttachmentSingle
, Integer, Hash)>] AttachmentSingle
data, response status code and response headers
# File lib/firefly_iii_client/api/attachments_api.rb, line 161 def get_attachment_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AttachmentsApi.get_attachment ...' end # verify the required parameter 'id' is set if @api_client.config.client_side_validation && id.nil? fail ArgumentError, "Missing the required parameter 'id' when calling AttachmentsApi.get_attachment" end # resource path local_var_path = '/api/v1/attachments/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'AttachmentSingle' # auth_names auth_names = opts[:debug_auth_names] || ['firefly_iii_auth'] new_options = opts.merge( :operation => :"AttachmentsApi.get_attachment", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: AttachmentsApi#get_attachment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
List all attachments. This endpoint lists all attachments. @param [Hash] opts the optional parameters @option opts [Integer] :page Page number. The default pagination is 50. @return [AttachmentArray]
# File lib/firefly_iii_client/api/attachments_api.rb, line 214 def list_attachment(opts = {}) data, _status_code, _headers = list_attachment_with_http_info(opts) data end
List all attachments. This endpoint lists all attachments. @param [Hash] opts the optional parameters @option opts [Integer] :page Page number. The default pagination is 50. @return [Array<(AttachmentArray
, Integer, Hash)>] AttachmentArray
data, response status code and response headers
# File lib/firefly_iii_client/api/attachments_api.rb, line 224 def list_attachment_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AttachmentsApi.list_attachment ...' end # resource path local_var_path = '/api/v1/attachments' # query parameters query_params = opts[:query_params] || {} query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'AttachmentArray' # auth_names auth_names = opts[:debug_auth_names] || ['firefly_iii_auth'] new_options = opts.merge( :operation => :"AttachmentsApi.list_attachment", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: AttachmentsApi#list_attachment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Store a new attachment. Creates a new attachment. The data required can be submitted as a JSON body or as a list of parameters. You cannot use this endpoint to upload the actual file data (see below). This endpoint only creates the attachment object. @param attachment [Attachment] JSON array or key=value pairs with the necessary attachment information. See the model for the exact specifications. @param [Hash] opts the optional parameters @return [AttachmentSingle]
# File lib/firefly_iii_client/api/attachments_api.rb, line 274 def store_attachment(attachment, opts = {}) data, _status_code, _headers = store_attachment_with_http_info(attachment, opts) data end
Store a new attachment. Creates a new attachment. The data required can be submitted as a JSON body or as a list of parameters. You cannot use this endpoint to upload the actual file data (see below). This endpoint only creates the attachment object. @param attachment [Attachment] JSON array or key=value pairs with the necessary attachment information. See the model for the exact specifications. @param [Hash] opts the optional parameters @return [Array<(AttachmentSingle
, Integer, Hash)>] AttachmentSingle
data, response status code and response headers
# File lib/firefly_iii_client/api/attachments_api.rb, line 284 def store_attachment_with_http_info(attachment, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AttachmentsApi.store_attachment ...' end # verify the required parameter 'attachment' is set if @api_client.config.client_side_validation && attachment.nil? fail ArgumentError, "Missing the required parameter 'attachment' when calling AttachmentsApi.store_attachment" end # resource path local_var_path = '/api/v1/attachments' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[: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/json', 'application/x-www-form-urlencoded']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(attachment) # return_type return_type = opts[:debug_return_type] || 'AttachmentSingle' # auth_names auth_names = opts[:debug_auth_names] || ['firefly_iii_auth'] new_options = opts.merge( :operation => :"AttachmentsApi.store_attachment", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: AttachmentsApi#store_attachment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Update existing attachment. Update the meta data for an existing attachment. This endpoint does not allow you to upload or download data. For that, see below. @param id [Integer] The ID of the attachment. @param attachment [Attachment] JSON array with updated attachment information. See the model for the exact specifications. @param [Hash] opts the optional parameters @return [AttachmentSingle]
# File lib/firefly_iii_client/api/attachments_api.rb, line 340 def update_attachment(id, attachment, opts = {}) data, _status_code, _headers = update_attachment_with_http_info(id, attachment, opts) data end
Update existing attachment. Update the meta data for an existing attachment. This endpoint does not allow you to upload or download data. For that, see below. @param id [Integer] The ID of the attachment. @param attachment [Attachment] JSON array with updated attachment information. See the model for the exact specifications. @param [Hash] opts the optional parameters @return [Array<(AttachmentSingle
, Integer, Hash)>] AttachmentSingle
data, response status code and response headers
# File lib/firefly_iii_client/api/attachments_api.rb, line 351 def update_attachment_with_http_info(id, attachment, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AttachmentsApi.update_attachment ...' end # verify the required parameter 'id' is set if @api_client.config.client_side_validation && id.nil? fail ArgumentError, "Missing the required parameter 'id' when calling AttachmentsApi.update_attachment" end # verify the required parameter 'attachment' is set if @api_client.config.client_side_validation && attachment.nil? fail ArgumentError, "Missing the required parameter 'attachment' when calling AttachmentsApi.update_attachment" end # resource path local_var_path = '/api/v1/attachments/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[: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/json', 'application/x-www-form-urlencoded']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(attachment) # return_type return_type = opts[:debug_return_type] || 'AttachmentSingle' # auth_names auth_names = opts[:debug_auth_names] || ['firefly_iii_auth'] new_options = opts.merge( :operation => :"AttachmentsApi.update_attachment", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: AttachmentsApi#update_attachment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Upload an attachment. Use this endpoint to upload (and possible overwrite) the file contents of an attachment. Simply put the entire file in the body as binary data. @param id [Integer] The ID of the attachment. @param [Hash] opts the optional parameters @option opts [File] :body @return [nil]
# File lib/firefly_iii_client/api/attachments_api.rb, line 411 def upload_attachment(id, opts = {}) upload_attachment_with_http_info(id, opts) nil end
Upload an attachment. Use this endpoint to upload (and possible overwrite) the file contents of an attachment. Simply put the entire file in the body as binary data. @param id [Integer] The ID of the attachment. @param [Hash] opts the optional parameters @option opts [File] :body @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
# File lib/firefly_iii_client/api/attachments_api.rb, line 422 def upload_attachment_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AttachmentsApi.upload_attachment ...' end # verify the required parameter 'id' is set if @api_client.config.client_side_validation && id.nil? fail ArgumentError, "Missing the required parameter 'id' when calling AttachmentsApi.upload_attachment" end # resource path local_var_path = '/api/v1/attachments/{id}/upload'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/octet-stream']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'body']) # return_type return_type = opts[:debug_return_type] # auth_names auth_names = opts[:debug_auth_names] || ['firefly_iii_auth'] new_options = opts.merge( :operation => :"AttachmentsApi.upload_attachment", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: AttachmentsApi#upload_attachment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end