=begin #DocuSign Admin API #An API for an organization administrator to manage organizations, accounts and users OpenAPI spec version: v2.1 Contact: devcenter@docusign.com Generated by: https://github.com/swagger-api/swagger-codegen.git =end require "uri" module DocuSign_Admin class GetGroupsOptions # Index of first item to include in the response Default value: 0 attr_accessor :start # Page size of the response Default value: 20 attr_accessor :take # Index of the last item to include in the response. Ignored if 'take' parameter is specfied attr_accessor :_end def self.default @@default ||= GetGroupsOptions.new end end class GetOrganizationsOptions # Specifies how to select the organizations. Values: org_admin - will return organizations for which the user is an admin; account_membership: will return organizations that contain an account of which the user is a member Default value: org_admin attr_accessor :mode def self.default @@default ||= GetOrganizationsOptions.new end end class AccountsApi attr_accessor :api_client def initialize(api_client = AccountsApi.default) @api_client = api_client end # Returns the list of groups in an account. # Required scopes: group_read # @param organization_id The organization ID Guid # @param account_id The account ID Guid # @param DocuSign_Admin::GetGroupsOptions Options for modifying the behavior of the function. # @return [MemberGroupsResponse] def get_groups(organization_id, account_id, options = DocuSign_Admin::GetGroupsOptions.default) data, _status_code, _headers = get_groups_with_http_info(organization_id, account_id, options) return data end # Returns the list of groups in an account. # Required scopes: group_read # @param organization_id The organization ID Guid # @param account_id The account ID Guid # @param DocuSign_Admin::GetGroupsOptions Options for modifying the behavior of the function. # @return [Array<(MemberGroupsResponse, Fixnum, Hash)>] MemberGroupsResponse data, response status code and response headers def get_groups_with_http_info(organization_id, account_id, options = DocuSign_Admin::GetGroupsOptions.default) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: AccountsApi.get_groups ..." end # verify the required parameter 'organization_id' is set fail ArgumentError, "Missing the required parameter 'organization_id' when calling AccountsApi.get_groups" if organization_id.nil? # verify the required parameter 'account_id' is set fail ArgumentError, "Missing the required parameter 'account_id' when calling AccountsApi.get_groups" if account_id.nil? # resource path local_var_path = "/v2/organizations/{organizationId}/accounts/{accountId}/groups".sub('{format}','json').sub('{' + 'organizationId' + '}', organization_id.to_s).sub('{' + 'accountId' + '}', account_id.to_s) # query parameters query_params = {} query_params[:'start'] = options.start if !options.start.nil? query_params[:'take'] = options.take if !options.take.nil? query_params[:'end'] = options._end if !options._end.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 => 'MemberGroupsResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: AccountsApi#get_groups\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Returns the list of organizations of which the authenticated user is a member. # Required scopes: organization_read # @param DocuSign_Admin::GetOrganizationsOptions Options for modifying the behavior of the function. # @return [OrganizationsResponse] def get_organizations(options = DocuSign_Admin::GetOrganizationsOptions.default) data, _status_code, _headers = get_organizations_with_http_info(options) return data end # Returns the list of organizations of which the authenticated user is a member. # Required scopes: organization_read # @param DocuSign_Admin::GetOrganizationsOptions Options for modifying the behavior of the function. # @return [Array<(OrganizationsResponse, Fixnum, Hash)>] OrganizationsResponse data, response status code and response headers def get_organizations_with_http_info(options = DocuSign_Admin::GetOrganizationsOptions.default) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: AccountsApi.get_organizations ..." end # resource path local_var_path = "/v2/organizations".sub('{format}','json') # query parameters query_params = {} query_params[:'mode'] = options.mode if !options.mode.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 => 'OrganizationsResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: AccountsApi#get_organizations\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Returns the list of permission profiles in an account. # Required scopes: permission_read # @param organization_id The organization ID Guid # @param account_id The account ID Guid # @return [PermissionsResponse] def get_permissions(organization_id, account_id) data, _status_code, _headers = get_permissions_with_http_info(organization_id, account_id) return data end # Returns the list of permission profiles in an account. # Required scopes: permission_read # @param organization_id The organization ID Guid # @param account_id The account ID Guid # @return [Array<(PermissionsResponse, Fixnum, Hash)>] PermissionsResponse data, response status code and response headers def get_permissions_with_http_info(organization_id, account_id) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: AccountsApi.get_permissions ..." end # verify the required parameter 'organization_id' is set fail ArgumentError, "Missing the required parameter 'organization_id' when calling AccountsApi.get_permissions" if organization_id.nil? # verify the required parameter 'account_id' is set fail ArgumentError, "Missing the required parameter 'account_id' when calling AccountsApi.get_permissions" if account_id.nil? # resource path local_var_path = "/v2/organizations/{organizationId}/accounts/{accountId}/permissions".sub('{format}','json').sub('{' + 'organizationId' + '}', organization_id.to_s).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']) # 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 => 'PermissionsResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: AccountsApi#get_permissions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end end end