=begin #Fatture in Cloud API v2 - API Reference #Connect your software with Fatture in Cloud, the invoicing platform chosen by more than 500.000 businesses in Italy. The Fatture in Cloud API is based on REST, and makes possible to interact with the user related data prior authorization via OAuth2 protocol. The version of the OpenAPI document: 2.0.27 Contact: info@fattureincloud.it Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.5.0 =end require 'cgi' module FattureInCloud_Ruby_Sdk class IssuedDocumentsApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # Create Issued Document # Creates a new document. # @param company_id [Integer] The ID of the company. # @param [Hash] opts the optional parameters # @option opts [CreateIssuedDocumentRequest] :create_issued_document_request The Issued Document # @return [CreateIssuedDocumentResponse] def create_issued_document(company_id, opts = {}) data, _status_code, _headers = create_issued_document_with_http_info(company_id, opts) data end # Create Issued Document # Creates a new document. # @param company_id [Integer] The ID of the company. # @param [Hash] opts the optional parameters # @option opts [CreateIssuedDocumentRequest] :create_issued_document_request The Issued Document # @return [Array<(CreateIssuedDocumentResponse, Integer, Hash)>] CreateIssuedDocumentResponse data, response status code and response headers def create_issued_document_with_http_info(company_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: IssuedDocumentsApi.create_issued_document ...' end # verify the required parameter 'company_id' is set if @api_client.config.client_side_validation && company_id.nil? fail ArgumentError, "Missing the required parameter 'company_id' when calling IssuedDocumentsApi.create_issued_document" end # resource path local_var_path = '/c/{company_id}/issued_documents'.sub('{' + 'company_id' + '}', CGI.escape(company_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' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'create_issued_document_request']) # return_type return_type = opts[:debug_return_type] || 'CreateIssuedDocumentResponse' # auth_names auth_names = opts[:debug_auth_names] || ['OAuth2AuthenticationCodeFlow'] new_options = opts.merge( :operation => :"IssuedDocumentsApi.create_issued_document", :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: IssuedDocumentsApi#create_issued_document\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Delete Issued Document # Deletes the specified document. # @param company_id [Integer] The ID of the company. # @param document_id [Integer] The ID of the document. # @param [Hash] opts the optional parameters # @return [nil] def delete_issued_document(company_id, document_id, opts = {}) delete_issued_document_with_http_info(company_id, document_id, opts) nil end # Delete Issued Document # Deletes the specified document. # @param company_id [Integer] The ID of the company. # @param document_id [Integer] The ID of the document. # @param [Hash] opts the optional parameters # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers def delete_issued_document_with_http_info(company_id, document_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: IssuedDocumentsApi.delete_issued_document ...' end # verify the required parameter 'company_id' is set if @api_client.config.client_side_validation && company_id.nil? fail ArgumentError, "Missing the required parameter 'company_id' when calling IssuedDocumentsApi.delete_issued_document" end # verify the required parameter 'document_id' is set if @api_client.config.client_side_validation && document_id.nil? fail ArgumentError, "Missing the required parameter 'document_id' when calling IssuedDocumentsApi.delete_issued_document" end # resource path local_var_path = '/c/{company_id}/issued_documents/{document_id}'.sub('{' + 'company_id' + '}', CGI.escape(company_id.to_s)).sub('{' + 'document_id' + '}', CGI.escape(document_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] || ['OAuth2AuthenticationCodeFlow'] new_options = opts.merge( :operation => :"IssuedDocumentsApi.delete_issued_document", :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: IssuedDocumentsApi#delete_issued_document\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Delete Issued Document Attachment # Removes the attachment of the specified document. # @param company_id [Integer] The ID of the company. # @param document_id [Integer] The ID of the document. # @param [Hash] opts the optional parameters # @return [nil] def delete_issued_document_attachment(company_id, document_id, opts = {}) delete_issued_document_attachment_with_http_info(company_id, document_id, opts) nil end # Delete Issued Document Attachment # Removes the attachment of the specified document. # @param company_id [Integer] The ID of the company. # @param document_id [Integer] The ID of the document. # @param [Hash] opts the optional parameters # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers def delete_issued_document_attachment_with_http_info(company_id, document_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: IssuedDocumentsApi.delete_issued_document_attachment ...' end # verify the required parameter 'company_id' is set if @api_client.config.client_side_validation && company_id.nil? fail ArgumentError, "Missing the required parameter 'company_id' when calling IssuedDocumentsApi.delete_issued_document_attachment" end # verify the required parameter 'document_id' is set if @api_client.config.client_side_validation && document_id.nil? fail ArgumentError, "Missing the required parameter 'document_id' when calling IssuedDocumentsApi.delete_issued_document_attachment" end # resource path local_var_path = '/c/{company_id}/issued_documents/{document_id}/attachment'.sub('{' + 'company_id' + '}', CGI.escape(company_id.to_s)).sub('{' + 'document_id' + '}', CGI.escape(document_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] || ['OAuth2AuthenticationCodeFlow'] new_options = opts.merge( :operation => :"IssuedDocumentsApi.delete_issued_document_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: IssuedDocumentsApi#delete_issued_document_attachment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get Email Data # Gets the pre-compiled email details. # @param company_id [Integer] The ID of the company. # @param document_id [Integer] The ID of the document. # @param [Hash] opts the optional parameters # @return [GetEmailDataResponse] def get_email_data(company_id, document_id, opts = {}) data, _status_code, _headers = get_email_data_with_http_info(company_id, document_id, opts) data end # Get Email Data # Gets the pre-compiled email details. # @param company_id [Integer] The ID of the company. # @param document_id [Integer] The ID of the document. # @param [Hash] opts the optional parameters # @return [Array<(GetEmailDataResponse, Integer, Hash)>] GetEmailDataResponse data, response status code and response headers def get_email_data_with_http_info(company_id, document_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: IssuedDocumentsApi.get_email_data ...' end # verify the required parameter 'company_id' is set if @api_client.config.client_side_validation && company_id.nil? fail ArgumentError, "Missing the required parameter 'company_id' when calling IssuedDocumentsApi.get_email_data" end # verify the required parameter 'document_id' is set if @api_client.config.client_side_validation && document_id.nil? fail ArgumentError, "Missing the required parameter 'document_id' when calling IssuedDocumentsApi.get_email_data" end # resource path local_var_path = '/c/{company_id}/issued_documents/{document_id}/email'.sub('{' + 'company_id' + '}', CGI.escape(company_id.to_s)).sub('{' + 'document_id' + '}', CGI.escape(document_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] || 'GetEmailDataResponse' # auth_names auth_names = opts[:debug_auth_names] || ['OAuth2AuthenticationCodeFlow'] new_options = opts.merge( :operation => :"IssuedDocumentsApi.get_email_data", :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: IssuedDocumentsApi#get_email_data\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get Existing Issued Document Totals # Returns the totals for a specified document. # @param company_id [Integer] The ID of the company. # @param document_id [Integer] The ID of the document. # @param [Hash] opts the optional parameters # @option opts [GetExistingIssuedDocumentTotalsRequest] :get_existing_issued_document_totals_request # @return [GetExistingIssuedDocumentTotalsResponse] def get_existing_issued_document_totals(company_id, document_id, opts = {}) data, _status_code, _headers = get_existing_issued_document_totals_with_http_info(company_id, document_id, opts) data end # Get Existing Issued Document Totals # Returns the totals for a specified document. # @param company_id [Integer] The ID of the company. # @param document_id [Integer] The ID of the document. # @param [Hash] opts the optional parameters # @option opts [GetExistingIssuedDocumentTotalsRequest] :get_existing_issued_document_totals_request # @return [Array<(GetExistingIssuedDocumentTotalsResponse, Integer, Hash)>] GetExistingIssuedDocumentTotalsResponse data, response status code and response headers def get_existing_issued_document_totals_with_http_info(company_id, document_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: IssuedDocumentsApi.get_existing_issued_document_totals ...' end # verify the required parameter 'company_id' is set if @api_client.config.client_side_validation && company_id.nil? fail ArgumentError, "Missing the required parameter 'company_id' when calling IssuedDocumentsApi.get_existing_issued_document_totals" end # verify the required parameter 'document_id' is set if @api_client.config.client_side_validation && document_id.nil? fail ArgumentError, "Missing the required parameter 'document_id' when calling IssuedDocumentsApi.get_existing_issued_document_totals" end # resource path local_var_path = '/c/{company_id}/issued_documents/{document_id}/totals'.sub('{' + 'company_id' + '}', CGI.escape(company_id.to_s)).sub('{' + 'document_id' + '}', CGI.escape(document_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' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'get_existing_issued_document_totals_request']) # return_type return_type = opts[:debug_return_type] || 'GetExistingIssuedDocumentTotalsResponse' # auth_names auth_names = opts[:debug_auth_names] || ['OAuth2AuthenticationCodeFlow'] new_options = opts.merge( :operation => :"IssuedDocumentsApi.get_existing_issued_document_totals", :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: IssuedDocumentsApi#get_existing_issued_document_totals\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get Issued Document # Gets the specified document. # @param company_id [Integer] The ID of the company. # @param document_id [Integer] The ID of the document. # @param [Hash] opts the optional parameters # @option opts [String] :fields List of comma-separated fields. # @option opts [String] :fieldset Name of the fieldset. # @return [GetIssuedDocumentResponse] def get_issued_document(company_id, document_id, opts = {}) data, _status_code, _headers = get_issued_document_with_http_info(company_id, document_id, opts) data end # Get Issued Document # Gets the specified document. # @param company_id [Integer] The ID of the company. # @param document_id [Integer] The ID of the document. # @param [Hash] opts the optional parameters # @option opts [String] :fields List of comma-separated fields. # @option opts [String] :fieldset Name of the fieldset. # @return [Array<(GetIssuedDocumentResponse, Integer, Hash)>] GetIssuedDocumentResponse data, response status code and response headers def get_issued_document_with_http_info(company_id, document_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: IssuedDocumentsApi.get_issued_document ...' end # verify the required parameter 'company_id' is set if @api_client.config.client_side_validation && company_id.nil? fail ArgumentError, "Missing the required parameter 'company_id' when calling IssuedDocumentsApi.get_issued_document" end # verify the required parameter 'document_id' is set if @api_client.config.client_side_validation && document_id.nil? fail ArgumentError, "Missing the required parameter 'document_id' when calling IssuedDocumentsApi.get_issued_document" end allowable_values = ["basic", "detailed"] if @api_client.config.client_side_validation && opts[:'fieldset'] && !allowable_values.include?(opts[:'fieldset']) fail ArgumentError, "invalid value for \"fieldset\", must be one of #{allowable_values}" end # resource path local_var_path = '/c/{company_id}/issued_documents/{document_id}'.sub('{' + 'company_id' + '}', CGI.escape(company_id.to_s)).sub('{' + 'document_id' + '}', CGI.escape(document_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'fields'] = opts[:'fields'] if !opts[:'fields'].nil? query_params[:'fieldset'] = opts[:'fieldset'] if !opts[:'fieldset'].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] || 'GetIssuedDocumentResponse' # auth_names auth_names = opts[:debug_auth_names] || ['OAuth2AuthenticationCodeFlow'] new_options = opts.merge( :operation => :"IssuedDocumentsApi.get_issued_document", :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: IssuedDocumentsApi#get_issued_document\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get Issued Document Pre-create info # Retrieves the information useful while creating a new document. # @param company_id [Integer] The ID of the company. # @param type [String] The type of the issued document. # @param [Hash] opts the optional parameters # @return [GetIssuedDocumentPreCreateInfoResponse] def get_issued_document_pre_create_info(company_id, type, opts = {}) data, _status_code, _headers = get_issued_document_pre_create_info_with_http_info(company_id, type, opts) data end # Get Issued Document Pre-create info # Retrieves the information useful while creating a new document. # @param company_id [Integer] The ID of the company. # @param type [String] The type of the issued document. # @param [Hash] opts the optional parameters # @return [Array<(GetIssuedDocumentPreCreateInfoResponse, Integer, Hash)>] GetIssuedDocumentPreCreateInfoResponse data, response status code and response headers def get_issued_document_pre_create_info_with_http_info(company_id, type, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: IssuedDocumentsApi.get_issued_document_pre_create_info ...' end # verify the required parameter 'company_id' is set if @api_client.config.client_side_validation && company_id.nil? fail ArgumentError, "Missing the required parameter 'company_id' when calling IssuedDocumentsApi.get_issued_document_pre_create_info" end # verify the required parameter 'type' is set if @api_client.config.client_side_validation && type.nil? fail ArgumentError, "Missing the required parameter 'type' when calling IssuedDocumentsApi.get_issued_document_pre_create_info" end # verify enum value allowable_values = ["invoice", "quote", "proforma", "receipt", "delivery_note", "credit_note", "order", "work_report", "supplier_order", "self_own_invoice", "self_supplier_invoice"] if @api_client.config.client_side_validation && !allowable_values.include?(type) fail ArgumentError, "invalid value for \"type\", must be one of #{allowable_values}" end # resource path local_var_path = '/c/{company_id}/issued_documents/info'.sub('{' + 'company_id' + '}', CGI.escape(company_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'type'] = type # 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] || 'GetIssuedDocumentPreCreateInfoResponse' # auth_names auth_names = opts[:debug_auth_names] || ['OAuth2AuthenticationCodeFlow'] new_options = opts.merge( :operation => :"IssuedDocumentsApi.get_issued_document_pre_create_info", :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: IssuedDocumentsApi#get_issued_document_pre_create_info\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get New Issued Document Totals # Returns the totals for a new document. # @param company_id [Integer] The ID of the company. # @param [Hash] opts the optional parameters # @option opts [GetNewIssuedDocumentTotalsRequest] :get_new_issued_document_totals_request # @return [GetNewIssuedDocumentTotalsResponse] def get_new_issued_document_totals(company_id, opts = {}) data, _status_code, _headers = get_new_issued_document_totals_with_http_info(company_id, opts) data end # Get New Issued Document Totals # Returns the totals for a new document. # @param company_id [Integer] The ID of the company. # @param [Hash] opts the optional parameters # @option opts [GetNewIssuedDocumentTotalsRequest] :get_new_issued_document_totals_request # @return [Array<(GetNewIssuedDocumentTotalsResponse, Integer, Hash)>] GetNewIssuedDocumentTotalsResponse data, response status code and response headers def get_new_issued_document_totals_with_http_info(company_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: IssuedDocumentsApi.get_new_issued_document_totals ...' end # verify the required parameter 'company_id' is set if @api_client.config.client_side_validation && company_id.nil? fail ArgumentError, "Missing the required parameter 'company_id' when calling IssuedDocumentsApi.get_new_issued_document_totals" end # resource path local_var_path = '/c/{company_id}/issued_documents/totals'.sub('{' + 'company_id' + '}', CGI.escape(company_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' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'get_new_issued_document_totals_request']) # return_type return_type = opts[:debug_return_type] || 'GetNewIssuedDocumentTotalsResponse' # auth_names auth_names = opts[:debug_auth_names] || ['OAuth2AuthenticationCodeFlow'] new_options = opts.merge( :operation => :"IssuedDocumentsApi.get_new_issued_document_totals", :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: IssuedDocumentsApi#get_new_issued_document_totals\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Join issued documents # Joins issued documents. # @param company_id [Integer] The ID of the company. # @param ids [String] Ids of the documents. # @param [Hash] opts the optional parameters # @option opts [Integer] :group Group items. # @option opts [Integer] :e_invoice New document e_invoice. # @return [JoinIssuedDocumentsResponse] def join_issued_documents(company_id, ids, opts = {}) data, _status_code, _headers = join_issued_documents_with_http_info(company_id, ids, opts) data end # Join issued documents # Joins issued documents. # @param company_id [Integer] The ID of the company. # @param ids [String] Ids of the documents. # @param [Hash] opts the optional parameters # @option opts [Integer] :group Group items. # @option opts [Integer] :e_invoice New document e_invoice. # @return [Array<(JoinIssuedDocumentsResponse, Integer, Hash)>] JoinIssuedDocumentsResponse data, response status code and response headers def join_issued_documents_with_http_info(company_id, ids, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: IssuedDocumentsApi.join_issued_documents ...' end # verify the required parameter 'company_id' is set if @api_client.config.client_side_validation && company_id.nil? fail ArgumentError, "Missing the required parameter 'company_id' when calling IssuedDocumentsApi.join_issued_documents" end # verify the required parameter 'ids' is set if @api_client.config.client_side_validation && ids.nil? fail ArgumentError, "Missing the required parameter 'ids' when calling IssuedDocumentsApi.join_issued_documents" end allowable_values = [0, 1] if @api_client.config.client_side_validation && opts[:'group'] && !allowable_values.include?(opts[:'group']) fail ArgumentError, "invalid value for \"group\", must be one of #{allowable_values}" end allowable_values = [0, 1] if @api_client.config.client_side_validation && opts[:'e_invoice'] && !allowable_values.include?(opts[:'e_invoice']) fail ArgumentError, "invalid value for \"e_invoice\", must be one of #{allowable_values}" end # resource path local_var_path = '/c/{company_id}/issued_documents/join'.sub('{' + 'company_id' + '}', CGI.escape(company_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'ids'] = ids query_params[:'group'] = opts[:'group'] if !opts[:'group'].nil? query_params[:'e_invoice'] = opts[:'e_invoice'] if !opts[:'e_invoice'].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] || 'JoinIssuedDocumentsResponse' # auth_names auth_names = opts[:debug_auth_names] || ['OAuth2AuthenticationCodeFlow'] new_options = opts.merge( :operation => :"IssuedDocumentsApi.join_issued_documents", :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: IssuedDocumentsApi#join_issued_documents\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # List Issued Documents # Lists the issued documents. # @param company_id [Integer] The ID of the company. # @param type [String] The type of the issued document. # @param [Hash] opts the optional parameters # @option opts [String] :fields List of comma-separated fields. # @option opts [String] :fieldset Name of the fieldset. # @option opts [String] :sort List of comma-separated fields for result sorting (minus for desc sorting). # @option opts [Integer] :page The page to retrieve. (default to 1) # @option opts [Integer] :per_page The size of the page. (default to 5) # @option opts [String] :q Query for filtering the results. # @option opts [Integer] :inclusive (Only for type = delivery_notes) Include invoices delivery notes. # @return [ListIssuedDocumentsResponse] def list_issued_documents(company_id, type, opts = {}) data, _status_code, _headers = list_issued_documents_with_http_info(company_id, type, opts) data end # List Issued Documents # Lists the issued documents. # @param company_id [Integer] The ID of the company. # @param type [String] The type of the issued document. # @param [Hash] opts the optional parameters # @option opts [String] :fields List of comma-separated fields. # @option opts [String] :fieldset Name of the fieldset. # @option opts [String] :sort List of comma-separated fields for result sorting (minus for desc sorting). # @option opts [Integer] :page The page to retrieve. (default to 1) # @option opts [Integer] :per_page The size of the page. (default to 5) # @option opts [String] :q Query for filtering the results. # @option opts [Integer] :inclusive (Only for type = delivery_notes) Include invoices delivery notes. # @return [Array<(ListIssuedDocumentsResponse, Integer, Hash)>] ListIssuedDocumentsResponse data, response status code and response headers def list_issued_documents_with_http_info(company_id, type, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: IssuedDocumentsApi.list_issued_documents ...' end # verify the required parameter 'company_id' is set if @api_client.config.client_side_validation && company_id.nil? fail ArgumentError, "Missing the required parameter 'company_id' when calling IssuedDocumentsApi.list_issued_documents" end # verify the required parameter 'type' is set if @api_client.config.client_side_validation && type.nil? fail ArgumentError, "Missing the required parameter 'type' when calling IssuedDocumentsApi.list_issued_documents" end # verify enum value allowable_values = ["invoice", "quote", "proforma", "receipt", "delivery_note", "credit_note", "order", "work_report", "supplier_order", "self_own_invoice", "self_supplier_invoice"] if @api_client.config.client_side_validation && !allowable_values.include?(type) fail ArgumentError, "invalid value for \"type\", must be one of #{allowable_values}" end allowable_values = ["basic", "detailed"] if @api_client.config.client_side_validation && opts[:'fieldset'] && !allowable_values.include?(opts[:'fieldset']) fail ArgumentError, "invalid value for \"fieldset\", must be one of #{allowable_values}" end if @api_client.config.client_side_validation && !opts[:'per_page'].nil? && opts[:'per_page'] > 100 fail ArgumentError, 'invalid value for "opts[:"per_page"]" when calling IssuedDocumentsApi.list_issued_documents, must be smaller than or equal to 100.' end if @api_client.config.client_side_validation && !opts[:'per_page'].nil? && opts[:'per_page'] < 1 fail ArgumentError, 'invalid value for "opts[:"per_page"]" when calling IssuedDocumentsApi.list_issued_documents, must be greater than or equal to 1.' end allowable_values = [0, 1] if @api_client.config.client_side_validation && opts[:'inclusive'] && !allowable_values.include?(opts[:'inclusive']) fail ArgumentError, "invalid value for \"inclusive\", must be one of #{allowable_values}" end # resource path local_var_path = '/c/{company_id}/issued_documents'.sub('{' + 'company_id' + '}', CGI.escape(company_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'type'] = type query_params[:'fields'] = opts[:'fields'] if !opts[:'fields'].nil? query_params[:'fieldset'] = opts[:'fieldset'] if !opts[:'fieldset'].nil? query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil? query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil? query_params[:'q'] = opts[:'q'] if !opts[:'q'].nil? query_params[:'inclusive'] = opts[:'inclusive'] if !opts[:'inclusive'].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] || 'ListIssuedDocumentsResponse' # auth_names auth_names = opts[:debug_auth_names] || ['OAuth2AuthenticationCodeFlow'] new_options = opts.merge( :operation => :"IssuedDocumentsApi.list_issued_documents", :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: IssuedDocumentsApi#list_issued_documents\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Modify Issued Document # Modifies the specified document. # @param company_id [Integer] The ID of the company. # @param document_id [Integer] The ID of the document. # @param [Hash] opts the optional parameters # @option opts [ModifyIssuedDocumentRequest] :modify_issued_document_request The modified document # @return [ModifyIssuedDocumentResponse] def modify_issued_document(company_id, document_id, opts = {}) data, _status_code, _headers = modify_issued_document_with_http_info(company_id, document_id, opts) data end # Modify Issued Document # Modifies the specified document. # @param company_id [Integer] The ID of the company. # @param document_id [Integer] The ID of the document. # @param [Hash] opts the optional parameters # @option opts [ModifyIssuedDocumentRequest] :modify_issued_document_request The modified document # @return [Array<(ModifyIssuedDocumentResponse, Integer, Hash)>] ModifyIssuedDocumentResponse data, response status code and response headers def modify_issued_document_with_http_info(company_id, document_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: IssuedDocumentsApi.modify_issued_document ...' end # verify the required parameter 'company_id' is set if @api_client.config.client_side_validation && company_id.nil? fail ArgumentError, "Missing the required parameter 'company_id' when calling IssuedDocumentsApi.modify_issued_document" end # verify the required parameter 'document_id' is set if @api_client.config.client_side_validation && document_id.nil? fail ArgumentError, "Missing the required parameter 'document_id' when calling IssuedDocumentsApi.modify_issued_document" end # resource path local_var_path = '/c/{company_id}/issued_documents/{document_id}'.sub('{' + 'company_id' + '}', CGI.escape(company_id.to_s)).sub('{' + 'document_id' + '}', CGI.escape(document_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' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'modify_issued_document_request']) # return_type return_type = opts[:debug_return_type] || 'ModifyIssuedDocumentResponse' # auth_names auth_names = opts[:debug_auth_names] || ['OAuth2AuthenticationCodeFlow'] new_options = opts.merge( :operation => :"IssuedDocumentsApi.modify_issued_document", :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: IssuedDocumentsApi#modify_issued_document\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Schedule Email # Schedules the sending of a document by email. # @param company_id [Integer] The ID of the company. # @param document_id [Integer] The ID of the document. # @param [Hash] opts the optional parameters # @option opts [ScheduleEmailRequest] :schedule_email_request Email Schedule # @return [nil] def schedule_email(company_id, document_id, opts = {}) schedule_email_with_http_info(company_id, document_id, opts) nil end # Schedule Email # Schedules the sending of a document by email. # @param company_id [Integer] The ID of the company. # @param document_id [Integer] The ID of the document. # @param [Hash] opts the optional parameters # @option opts [ScheduleEmailRequest] :schedule_email_request Email Schedule # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers def schedule_email_with_http_info(company_id, document_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: IssuedDocumentsApi.schedule_email ...' end # verify the required parameter 'company_id' is set if @api_client.config.client_side_validation && company_id.nil? fail ArgumentError, "Missing the required parameter 'company_id' when calling IssuedDocumentsApi.schedule_email" end # verify the required parameter 'document_id' is set if @api_client.config.client_side_validation && document_id.nil? fail ArgumentError, "Missing the required parameter 'document_id' when calling IssuedDocumentsApi.schedule_email" end # resource path local_var_path = '/c/{company_id}/issued_documents/{document_id}/email'.sub('{' + 'company_id' + '}', CGI.escape(company_id.to_s)).sub('{' + 'document_id' + '}', CGI.escape(document_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'schedule_email_request']) # return_type return_type = opts[:debug_return_type] # auth_names auth_names = opts[:debug_auth_names] || ['OAuth2AuthenticationCodeFlow'] new_options = opts.merge( :operation => :"IssuedDocumentsApi.schedule_email", :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: IssuedDocumentsApi#schedule_email\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Transform issued document # Transforms the document. # @param company_id [Integer] The ID of the company. # @param original_document_id [Integer] Original document id. # @param new_type [String] New document type. # @param [Hash] opts the optional parameters # @option opts [Integer] :e_invoice New document e_invoice. # @option opts [Integer] :transform_keep_copy Keep the old document. # @return [TransformIssuedDocumentResponse] def transform_issued_document(company_id, original_document_id, new_type, opts = {}) data, _status_code, _headers = transform_issued_document_with_http_info(company_id, original_document_id, new_type, opts) data end # Transform issued document # Transforms the document. # @param company_id [Integer] The ID of the company. # @param original_document_id [Integer] Original document id. # @param new_type [String] New document type. # @param [Hash] opts the optional parameters # @option opts [Integer] :e_invoice New document e_invoice. # @option opts [Integer] :transform_keep_copy Keep the old document. # @return [Array<(TransformIssuedDocumentResponse, Integer, Hash)>] TransformIssuedDocumentResponse data, response status code and response headers def transform_issued_document_with_http_info(company_id, original_document_id, new_type, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: IssuedDocumentsApi.transform_issued_document ...' end # verify the required parameter 'company_id' is set if @api_client.config.client_side_validation && company_id.nil? fail ArgumentError, "Missing the required parameter 'company_id' when calling IssuedDocumentsApi.transform_issued_document" end # verify the required parameter 'original_document_id' is set if @api_client.config.client_side_validation && original_document_id.nil? fail ArgumentError, "Missing the required parameter 'original_document_id' when calling IssuedDocumentsApi.transform_issued_document" end # verify the required parameter 'new_type' is set if @api_client.config.client_side_validation && new_type.nil? fail ArgumentError, "Missing the required parameter 'new_type' when calling IssuedDocumentsApi.transform_issued_document" end allowable_values = [0, 1] if @api_client.config.client_side_validation && opts[:'e_invoice'] && !allowable_values.include?(opts[:'e_invoice']) fail ArgumentError, "invalid value for \"e_invoice\", must be one of #{allowable_values}" end allowable_values = [0, 1] if @api_client.config.client_side_validation && opts[:'transform_keep_copy'] && !allowable_values.include?(opts[:'transform_keep_copy']) fail ArgumentError, "invalid value for \"transform_keep_copy\", must be one of #{allowable_values}" end # resource path local_var_path = '/c/{company_id}/issued_documents/transform'.sub('{' + 'company_id' + '}', CGI.escape(company_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'original_document_id'] = original_document_id query_params[:'new_type'] = new_type query_params[:'e_invoice'] = opts[:'e_invoice'] if !opts[:'e_invoice'].nil? query_params[:'transform_keep_copy'] = opts[:'transform_keep_copy'] if !opts[:'transform_keep_copy'].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] || 'TransformIssuedDocumentResponse' # auth_names auth_names = opts[:debug_auth_names] || ['OAuth2AuthenticationCodeFlow'] new_options = opts.merge( :operation => :"IssuedDocumentsApi.transform_issued_document", :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: IssuedDocumentsApi#transform_issued_document\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Upload Issued Document Attachment # Uploads an attachment destined to an issued document. The actual association between the document and the attachment must be implemented separately, using the returned token. # @param company_id [Integer] The ID of the company. # @param [Hash] opts the optional parameters # @option opts [String] :filename Name of the file. # @option opts [File] :attachment Valid format: .png, .jpg, .gif, .pdf, .zip, .xls, .xlsx, .doc, .docx # @return [UploadIssuedDocumentAttachmentResponse] def upload_issued_document_attachment(company_id, opts = {}) data, _status_code, _headers = upload_issued_document_attachment_with_http_info(company_id, opts) data end # Upload Issued Document Attachment # Uploads an attachment destined to an issued document. The actual association between the document and the attachment must be implemented separately, using the returned token. # @param company_id [Integer] The ID of the company. # @param [Hash] opts the optional parameters # @option opts [String] :filename Name of the file. # @option opts [File] :attachment Valid format: .png, .jpg, .gif, .pdf, .zip, .xls, .xlsx, .doc, .docx # @return [Array<(UploadIssuedDocumentAttachmentResponse, Integer, Hash)>] UploadIssuedDocumentAttachmentResponse data, response status code and response headers def upload_issued_document_attachment_with_http_info(company_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: IssuedDocumentsApi.upload_issued_document_attachment ...' end # verify the required parameter 'company_id' is set if @api_client.config.client_side_validation && company_id.nil? fail ArgumentError, "Missing the required parameter 'company_id' when calling IssuedDocumentsApi.upload_issued_document_attachment" end # resource path local_var_path = '/c/{company_id}/issued_documents/attachment'.sub('{' + 'company_id' + '}', CGI.escape(company_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' content_type = @api_client.select_header_content_type(['multipart/form-data']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} form_params['filename'] = opts[:'filename'] if !opts[:'filename'].nil? form_params['attachment'] = opts[:'attachment'] if !opts[:'attachment'].nil? # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'UploadIssuedDocumentAttachmentResponse' # auth_names auth_names = opts[:debug_auth_names] || ['OAuth2AuthenticationCodeFlow'] new_options = opts.merge( :operation => :"IssuedDocumentsApi.upload_issued_document_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: IssuedDocumentsApi#upload_issued_document_attachment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end end end