=begin
#Docusign eSignature REST API

#The Docusign eSignature REST API provides you with a powerful, convenient, and simple Web services API for interacting with Docusign.

OpenAPI spec version: v2.1
Contact: devcenter@docusign.com
Generated by: https://github.com/swagger-api/swagger-codegen.git

=end

require "uri"

module DocuSign_eSign

  class ListOptions
    # 
    attr_accessor :group_type

    # When set to **true**, the response includes the signing group members. 
    attr_accessor :include_users

    def self.default
      @@default ||= ListOptions.new
    end
  end


  class SigningGroupsApi
    attr_accessor :api_client

    def initialize(api_client = SigningGroupsApi.default)
      @api_client = api_client
    end

    # Creates a signing group. 
    # Creates one or more signing groups.   Multiple signing groups can be created in one call. Only users with account administrator privileges can create signing groups.   An account can have a maximum of 50 signing groups. Each signing group can have a maximum of 50 group members.   Signing groups can be used by any account user.
    # @param account_id The external account number (int) or account ID Guid.
    # @param signing_group_information  (optional parameter)
    # @return [SigningGroupInformation]
    def create_list(account_id, signing_group_information)
      data, _status_code, _headers = create_list_with_http_info(account_id,  signing_group_information)
      return data
    end

    # Creates a signing group. 
    # Creates one or more signing groups.   Multiple signing groups can be created in one call. Only users with account administrator privileges can create signing groups.   An account can have a maximum of 50 signing groups. Each signing group can have a maximum of 50 group members.   Signing groups can be used by any account user.
    # @param account_id The external account number (int) or account ID Guid.
    # @param signing_group_information  (optional parameter)
    # @return [Array<(SigningGroupInformation, Fixnum, Hash)>] SigningGroupInformation data, response status code and response headers
    def create_list_with_http_info(account_id, signing_group_information)
      if @api_client.config.debugging
        @api_client.config.logger.debug "Calling API: SigningGroupsApi.create_list ..."
      end
      # verify the required parameter 'account_id' is set
      fail ArgumentError, "Missing the required parameter 'account_id' when calling SigningGroupsApi.create_list" if account_id.nil?
      # resource path
      local_var_path = "/v2.1/accounts/{accountId}/signing_groups".sub('{format}','json').sub('{' + 'accountId' + '}', account_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 = @api_client.object_to_http_body(signing_group_information)
      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 => 'SigningGroupInformation')
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: SigningGroupsApi#create_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end

    # Deletes one or more signing groups.
    # Deletes one or more signing groups in the specified account.
    # @param account_id The external account number (int) or account ID Guid.
    # @param signing_group_information  (optional parameter)
    # @return [SigningGroupInformation]
    def delete_list(account_id, signing_group_information)
      data, _status_code, _headers = delete_list_with_http_info(account_id,  signing_group_information)
      return data
    end

    # Deletes one or more signing groups.
    # Deletes one or more signing groups in the specified account.
    # @param account_id The external account number (int) or account ID Guid.
    # @param signing_group_information  (optional parameter)
    # @return [Array<(SigningGroupInformation, Fixnum, Hash)>] SigningGroupInformation data, response status code and response headers
    def delete_list_with_http_info(account_id, signing_group_information)
      if @api_client.config.debugging
        @api_client.config.logger.debug "Calling API: SigningGroupsApi.delete_list ..."
      end
      # verify the required parameter 'account_id' is set
      fail ArgumentError, "Missing the required parameter 'account_id' when calling SigningGroupsApi.delete_list" if account_id.nil?
      # resource path
      local_var_path = "/v2.1/accounts/{accountId}/signing_groups".sub('{format}','json').sub('{' + 'accountId' + '}', account_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 = @api_client.object_to_http_body(signing_group_information)
      auth_names = []
      data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
        :header_params => header_params,
        :query_params => query_params,
        :form_params => form_params,
        :body => post_body,
        :auth_names => auth_names,
        :return_type => 'SigningGroupInformation')
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: SigningGroupsApi#delete_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end

    # Deletes  one or more members from a signing group.
    # Deletes  one or more members from the specified signing group. 
    # @param account_id The external account number (int) or account ID Guid.
    # @param signing_group_id 
    # @param signing_group_users  (optional parameter)
    # @return [SigningGroupUsers]
    def delete_users(account_id, signing_group_id, signing_group_users)
      data, _status_code, _headers = delete_users_with_http_info(account_id, signing_group_id,  signing_group_users)
      return data
    end

    # Deletes  one or more members from a signing group.
    # Deletes  one or more members from the specified signing group. 
    # @param account_id The external account number (int) or account ID Guid.
    # @param signing_group_id 
    # @param signing_group_users  (optional parameter)
    # @return [Array<(SigningGroupUsers, Fixnum, Hash)>] SigningGroupUsers data, response status code and response headers
    def delete_users_with_http_info(account_id, signing_group_id, signing_group_users)
      if @api_client.config.debugging
        @api_client.config.logger.debug "Calling API: SigningGroupsApi.delete_users ..."
      end
      # verify the required parameter 'account_id' is set
      fail ArgumentError, "Missing the required parameter 'account_id' when calling SigningGroupsApi.delete_users" if account_id.nil?
      # verify the required parameter 'signing_group_id' is set
      fail ArgumentError, "Missing the required parameter 'signing_group_id' when calling SigningGroupsApi.delete_users" if signing_group_id.nil?
      # resource path
      local_var_path = "/v2.1/accounts/{accountId}/signing_groups/{signingGroupId}/users".sub('{format}','json').sub('{' + 'accountId' + '}', account_id.to_s).sub('{' + 'signingGroupId' + '}', signing_group_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 = @api_client.object_to_http_body(signing_group_users)
      auth_names = []
      data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
        :header_params => header_params,
        :query_params => query_params,
        :form_params => form_params,
        :body => post_body,
        :auth_names => auth_names,
        :return_type => 'SigningGroupUsers')
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: SigningGroupsApi#delete_users\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end

    # Gets information about a signing group. 
    # Retrieves information, including group member information, for the specified signing group. 
    # @param account_id The external account number (int) or account ID Guid.
    # @param signing_group_id 
    # @return [SigningGroup]
    def get(account_id, signing_group_id)
      data, _status_code, _headers = get_with_http_info(account_id, signing_group_id)
      return data
    end

    # Gets information about a signing group. 
    # Retrieves information, including group member information, for the specified signing group. 
    # @param account_id The external account number (int) or account ID Guid.
    # @param signing_group_id 
    # @return [Array<(SigningGroup, Fixnum, Hash)>] SigningGroup data, response status code and response headers
    def get_with_http_info(account_id, signing_group_id)
      if @api_client.config.debugging
        @api_client.config.logger.debug "Calling API: SigningGroupsApi.get ..."
      end
      # verify the required parameter 'account_id' is set
      fail ArgumentError, "Missing the required parameter 'account_id' when calling SigningGroupsApi.get" if account_id.nil?
      # verify the required parameter 'signing_group_id' is set
      fail ArgumentError, "Missing the required parameter 'signing_group_id' when calling SigningGroupsApi.get" if signing_group_id.nil?
      # resource path
      local_var_path = "/v2.1/accounts/{accountId}/signing_groups/{signingGroupId}".sub('{format}','json').sub('{' + 'accountId' + '}', account_id.to_s).sub('{' + 'signingGroupId' + '}', signing_group_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 = []
      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 => 'SigningGroup')
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: SigningGroupsApi#get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end

    # Gets a list of the Signing Groups in an account.
    # Retrieves a list of all signing groups in the specified account.
    # @param account_id The external account number (int) or account ID Guid.
    # @param DocuSign_eSign::ListOptions Options for modifying the behavior of the function.
    # @return [SigningGroupInformation]
    def list(account_id, options = DocuSign_eSign::ListOptions.default)
      data, _status_code, _headers = list_with_http_info(account_id, options)
      return data
    end

    # Gets a list of the Signing Groups in an account.
    # Retrieves a list of all signing groups in the specified account.
    # @param account_id The external account number (int) or account ID Guid.
    # @param DocuSign_eSign::ListOptions Options for modifying the behavior of the function.
    # @return [Array<(SigningGroupInformation, Fixnum, Hash)>] SigningGroupInformation data, response status code and response headers
    def list_with_http_info(account_id, options = DocuSign_eSign::ListOptions.default)
      if @api_client.config.debugging
        @api_client.config.logger.debug "Calling API: SigningGroupsApi.list ..."
      end
      # verify the required parameter 'account_id' is set
      fail ArgumentError, "Missing the required parameter 'account_id' when calling SigningGroupsApi.list" if account_id.nil?
      # resource path
      local_var_path = "/v2.1/accounts/{accountId}/signing_groups".sub('{format}','json').sub('{' + 'accountId' + '}', account_id.to_s)

      # query parameters
      query_params = {}
      query_params[:'group_type'] = options.group_type if !options.group_type.nil?
      query_params[:'include_users'] = options.include_users if !options.include_users.nil?

      # 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 = []
      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 => 'SigningGroupInformation')
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: SigningGroupsApi#list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end

    # Gets a list of members in a Signing Group.
    # Retrieves the list of members in the specified Signing Group.
    # @param account_id The external account number (int) or account ID Guid.
    # @param signing_group_id 
    # @return [SigningGroupUsers]
    def list_users(account_id, signing_group_id)
      data, _status_code, _headers = list_users_with_http_info(account_id, signing_group_id)
      return data
    end

    # Gets a list of members in a Signing Group.
    # Retrieves the list of members in the specified Signing Group.
    # @param account_id The external account number (int) or account ID Guid.
    # @param signing_group_id 
    # @return [Array<(SigningGroupUsers, Fixnum, Hash)>] SigningGroupUsers data, response status code and response headers
    def list_users_with_http_info(account_id, signing_group_id)
      if @api_client.config.debugging
        @api_client.config.logger.debug "Calling API: SigningGroupsApi.list_users ..."
      end
      # verify the required parameter 'account_id' is set
      fail ArgumentError, "Missing the required parameter 'account_id' when calling SigningGroupsApi.list_users" if account_id.nil?
      # verify the required parameter 'signing_group_id' is set
      fail ArgumentError, "Missing the required parameter 'signing_group_id' when calling SigningGroupsApi.list_users" if signing_group_id.nil?
      # resource path
      local_var_path = "/v2.1/accounts/{accountId}/signing_groups/{signingGroupId}/users".sub('{format}','json').sub('{' + 'accountId' + '}', account_id.to_s).sub('{' + 'signingGroupId' + '}', signing_group_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 = []
      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 => 'SigningGroupUsers')
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: SigningGroupsApi#list_users\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end

    # Updates a signing group. 
    # Updates signing group name and member information. You can also add new members to the signing group. A signing group can have a maximum of 50 members. 
    # @param account_id The external account number (int) or account ID Guid.
    # @param signing_group_id 
    # @param signing_group  (optional parameter)
    # @return [SigningGroup]
    def update(account_id, signing_group_id, signing_group)
      data, _status_code, _headers = update_with_http_info(account_id, signing_group_id,  signing_group)
      return data
    end

    # Updates a signing group. 
    # Updates signing group name and member information. You can also add new members to the signing group. A signing group can have a maximum of 50 members. 
    # @param account_id The external account number (int) or account ID Guid.
    # @param signing_group_id 
    # @param signing_group  (optional parameter)
    # @return [Array<(SigningGroup, Fixnum, Hash)>] SigningGroup data, response status code and response headers
    def update_with_http_info(account_id, signing_group_id, signing_group)
      if @api_client.config.debugging
        @api_client.config.logger.debug "Calling API: SigningGroupsApi.update ..."
      end
      # verify the required parameter 'account_id' is set
      fail ArgumentError, "Missing the required parameter 'account_id' when calling SigningGroupsApi.update" if account_id.nil?
      # verify the required parameter 'signing_group_id' is set
      fail ArgumentError, "Missing the required parameter 'signing_group_id' when calling SigningGroupsApi.update" if signing_group_id.nil?
      # resource path
      local_var_path = "/v2.1/accounts/{accountId}/signing_groups/{signingGroupId}".sub('{format}','json').sub('{' + 'accountId' + '}', account_id.to_s).sub('{' + 'signingGroupId' + '}', signing_group_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 = @api_client.object_to_http_body(signing_group)
      auth_names = []
      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,
        :return_type => 'SigningGroup')
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: SigningGroupsApi#update\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end

    # Updates signing group names.
    # Updates the name of one or more existing signing groups. 
    # @param account_id The external account number (int) or account ID Guid.
    # @param signing_group_information  (optional parameter)
    # @return [SigningGroupInformation]
    def update_list(account_id, signing_group_information)
      data, _status_code, _headers = update_list_with_http_info(account_id,  signing_group_information)
      return data
    end

    # Updates signing group names.
    # Updates the name of one or more existing signing groups. 
    # @param account_id The external account number (int) or account ID Guid.
    # @param signing_group_information  (optional parameter)
    # @return [Array<(SigningGroupInformation, Fixnum, Hash)>] SigningGroupInformation data, response status code and response headers
    def update_list_with_http_info(account_id, signing_group_information)
      if @api_client.config.debugging
        @api_client.config.logger.debug "Calling API: SigningGroupsApi.update_list ..."
      end
      # verify the required parameter 'account_id' is set
      fail ArgumentError, "Missing the required parameter 'account_id' when calling SigningGroupsApi.update_list" if account_id.nil?
      # resource path
      local_var_path = "/v2.1/accounts/{accountId}/signing_groups".sub('{format}','json').sub('{' + 'accountId' + '}', account_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 = @api_client.object_to_http_body(signing_group_information)
      auth_names = []
      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,
        :return_type => 'SigningGroupInformation')
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: SigningGroupsApi#update_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end

    # Adds members to a signing group. 
    # Adds one or more new members to a signing group. A signing group can have a maximum of 50 members. 
    # @param account_id The external account number (int) or account ID Guid.
    # @param signing_group_id 
    # @param signing_group_users  (optional parameter)
    # @return [SigningGroupUsers]
    def update_users(account_id, signing_group_id, signing_group_users)
      data, _status_code, _headers = update_users_with_http_info(account_id, signing_group_id,  signing_group_users)
      return data
    end

    # Adds members to a signing group. 
    # Adds one or more new members to a signing group. A signing group can have a maximum of 50 members. 
    # @param account_id The external account number (int) or account ID Guid.
    # @param signing_group_id 
    # @param signing_group_users  (optional parameter)
    # @return [Array<(SigningGroupUsers, Fixnum, Hash)>] SigningGroupUsers data, response status code and response headers
    def update_users_with_http_info(account_id, signing_group_id, signing_group_users)
      if @api_client.config.debugging
        @api_client.config.logger.debug "Calling API: SigningGroupsApi.update_users ..."
      end
      # verify the required parameter 'account_id' is set
      fail ArgumentError, "Missing the required parameter 'account_id' when calling SigningGroupsApi.update_users" if account_id.nil?
      # verify the required parameter 'signing_group_id' is set
      fail ArgumentError, "Missing the required parameter 'signing_group_id' when calling SigningGroupsApi.update_users" if signing_group_id.nil?
      # resource path
      local_var_path = "/v2.1/accounts/{accountId}/signing_groups/{signingGroupId}/users".sub('{format}','json').sub('{' + 'accountId' + '}', account_id.to_s).sub('{' + 'signingGroupId' + '}', signing_group_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 = @api_client.object_to_http_body(signing_group_users)
      auth_names = []
      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,
        :return_type => 'SigningGroupUsers')
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: SigningGroupsApi#update_users\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
  end
end