=begin #Web Forms API version 1.1 #The Web Forms API facilitates generating semantic HTML forms around everyday contracts. OpenAPI spec version: 1.1.0 Contact: devcenter@docusign.com Generated by: https://github.com/swagger-api/swagger-codegen.git =end require "uri" module DocuSign_WebForms class ListInstancesOptions # A unique identifier for a user that should originate from client's system. This value can be anything your backend system would use to track individual form instances. Examples include employee IDs, email addresses, surrogate key values, etc. attr_accessor :client_user_id def self.default @@default ||= ListInstancesOptions.new end end class FormInstanceManagementApi attr_accessor :api_client def initialize(api_client = FormInstanceManagementApi.default) @api_client = api_client end # Creates an instance of the web form # Creates an instance of the web form. # @param account_id Account identifier in which the web form resides # @param form_id Unique identifier for a web form entity that is consistent for it's lifetime # @param create_instance_body Request body containing properties that will be used to create instance. # @return [WebFormInstance] def create_instance(account_id, form_id, create_instance_body) data, _status_code, _headers = create_instance_with_http_info(account_id, form_id, create_instance_body) return data end # Creates an instance of the web form # Creates an instance of the web form. # @param account_id Account identifier in which the web form resides # @param form_id Unique identifier for a web form entity that is consistent for it's lifetime # @param create_instance_body Request body containing properties that will be used to create instance. # @return [Array<(WebFormInstance, Fixnum, Hash)>] WebFormInstance data, response status code and response headers def create_instance_with_http_info(account_id, form_id, create_instance_body) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: FormInstanceManagementApi.create_instance ..." end # verify the required parameter 'account_id' is set fail ArgumentError, "Missing the required parameter 'account_id' when calling FormInstanceManagementApi.create_instance" if account_id.nil? # verify the required parameter 'form_id' is set fail ArgumentError, "Missing the required parameter 'form_id' when calling FormInstanceManagementApi.create_instance" if form_id.nil? # verify the required parameter 'create_instance_body' is set fail ArgumentError, "Missing the required parameter 'create_instance_body' when calling FormInstanceManagementApi.create_instance" if create_instance_body.nil? # resource path local_var_path = "/v1.1/accounts/{accountId}/forms/{formId}/instances".sub('{format}','json').sub('{' + 'accountId' + '}', account_id.to_s).sub('{' + 'formId' + '}', form_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/json']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(create_instance_body) auth_names = [] 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, :return_type => 'WebFormInstance') if @api_client.config.debugging @api_client.config.logger.debug "API called: FormInstanceManagementApi#create_instance\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get form instance # Retrieves instance information filter by instance id # @param account_id Account identifier in which the web form resides # @param form_id Unique identifier for a web form entity that is consistent for it's lifetime # @param instance_id Unique identifier for a Web Form Instance that is consistent until its expiration # @return [WebFormInstance] def get_instance(account_id, form_id, instance_id) data, _status_code, _headers = get_instance_with_http_info(account_id, form_id, instance_id) return data end # Get form instance # Retrieves instance information filter by instance id # @param account_id Account identifier in which the web form resides # @param form_id Unique identifier for a web form entity that is consistent for it's lifetime # @param instance_id Unique identifier for a Web Form Instance that is consistent until its expiration # @return [Array<(WebFormInstance, Fixnum, Hash)>] WebFormInstance data, response status code and response headers def get_instance_with_http_info(account_id, form_id, instance_id) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: FormInstanceManagementApi.get_instance ..." end # verify the required parameter 'account_id' is set fail ArgumentError, "Missing the required parameter 'account_id' when calling FormInstanceManagementApi.get_instance" if account_id.nil? # verify the required parameter 'form_id' is set fail ArgumentError, "Missing the required parameter 'form_id' when calling FormInstanceManagementApi.get_instance" if form_id.nil? # verify the required parameter 'instance_id' is set fail ArgumentError, "Missing the required parameter 'instance_id' when calling FormInstanceManagementApi.get_instance" if instance_id.nil? # resource path local_var_path = "/v1.1/accounts/{accountId}/forms/{formId}/instances/{instanceId}".sub('{format}','json').sub('{' + 'accountId' + '}', account_id.to_s).sub('{' + 'formId' + '}', form_id.to_s).sub('{' + 'instanceId' + '}', instance_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/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = [] 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 => 'WebFormInstance') if @api_client.config.debugging @api_client.config.logger.debug "API called: FormInstanceManagementApi#get_instance\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # List instances # List all the instances of a web form in an account. When filtered by clientUserId, it will return instances having same clientUserId # @param account_id Account identifier in which the web form resides # @param form_id Unique identifier for a web form that is consistent for it's lifetime # @param DocuSign_WebForms::ListInstancesOptions Options for modifying the behavior of the function. # @return [WebFormInstanceList] def list_instances(account_id, form_id, options = DocuSign_WebForms::ListInstancesOptions.default) data, _status_code, _headers = list_instances_with_http_info(account_id, form_id, options) return data end # List instances # List all the instances of a web form in an account. When filtered by clientUserId, it will return instances having same clientUserId # @param account_id Account identifier in which the web form resides # @param form_id Unique identifier for a web form that is consistent for it's lifetime # @param DocuSign_WebForms::ListInstancesOptions Options for modifying the behavior of the function. # @return [Array<(WebFormInstanceList, Fixnum, Hash)>] WebFormInstanceList data, response status code and response headers def list_instances_with_http_info(account_id, form_id, options = DocuSign_WebForms::ListInstancesOptions.default) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: FormInstanceManagementApi.list_instances ..." end # verify the required parameter 'account_id' is set fail ArgumentError, "Missing the required parameter 'account_id' when calling FormInstanceManagementApi.list_instances" if account_id.nil? # verify the required parameter 'form_id' is set fail ArgumentError, "Missing the required parameter 'form_id' when calling FormInstanceManagementApi.list_instances" if form_id.nil? if !options.client_user_id.nil? && options.client_user_id.to_s.length > 100 fail ArgumentError, 'invalid value for "options[:"client_user_id"]" when calling FormInstanceManagementApi.list_instances, the character length must be smaller than or equal to 100.' end # resource path local_var_path = "/v1.1/accounts/{accountId}/forms/{formId}/instances".sub('{format}','json').sub('{' + 'accountId' + '}', account_id.to_s).sub('{' + 'formId' + '}', form_id.to_s) # query parameters query_params = {} query_params[:'client_user_id'] = options.client_user_id if !options.client_user_id.nil? # 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/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = [] 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 => 'WebFormInstanceList') if @api_client.config.debugging @api_client.config.logger.debug "API called: FormInstanceManagementApi#list_instances\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Refreshes the instance token # Generates new instance token for the existing Web Form Instance. # @param account_id Account identifier in which the web form resides # @param form_id Unique identifier for a web form entity that is consistent for it's lifetime # @param instance_id Unique identifier for a Web Form Instance that is consistent until its expiration # @return [WebFormInstance] def refresh_token(account_id, form_id, instance_id) data, _status_code, _headers = refresh_token_with_http_info(account_id, form_id, instance_id) return data end # Refreshes the instance token # Generates new instance token for the existing Web Form Instance. # @param account_id Account identifier in which the web form resides # @param form_id Unique identifier for a web form entity that is consistent for it's lifetime # @param instance_id Unique identifier for a Web Form Instance that is consistent until its expiration # @return [Array<(WebFormInstance, Fixnum, Hash)>] WebFormInstance data, response status code and response headers def refresh_token_with_http_info(account_id, form_id, instance_id) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: FormInstanceManagementApi.refresh_token ..." end # verify the required parameter 'account_id' is set fail ArgumentError, "Missing the required parameter 'account_id' when calling FormInstanceManagementApi.refresh_token" if account_id.nil? # verify the required parameter 'form_id' is set fail ArgumentError, "Missing the required parameter 'form_id' when calling FormInstanceManagementApi.refresh_token" if form_id.nil? # verify the required parameter 'instance_id' is set fail ArgumentError, "Missing the required parameter 'instance_id' when calling FormInstanceManagementApi.refresh_token" if instance_id.nil? # resource path local_var_path = "/v1.1/accounts/{accountId}/forms/{formId}/instances/{instanceId}/refresh".sub('{format}','json').sub('{' + 'accountId' + '}', account_id.to_s).sub('{' + 'formId' + '}', form_id.to_s).sub('{' + 'instanceId' + '}', instance_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/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = [] 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, :return_type => 'WebFormInstance') if @api_client.config.debugging @api_client.config.logger.debug "API called: FormInstanceManagementApi#refresh_token\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end end end