=begin #Subskribe API #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) OpenAPI spec version: 1.0.0 Generated by: https://github.com/swagger-api/swagger-codegen.git Swagger Codegen version: 2.4.41 =end require 'uri' module SubskribeDevClient class UsersApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # Accept terms and conditions # Before a user gains access to the application, they must accept Subskribe's terms and conditions. This operation requires user bound access tokens. # @param [Hash] opts the optional parameters # @return [nil] def accept_terms_for_current_user(opts = {}) accept_terms_for_current_user_with_http_info(opts) nil end # Accept terms and conditions # Before a user gains access to the application, they must accept Subskribe's terms and conditions. This operation requires user bound access tokens. # @param [Hash] opts the optional parameters # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers def accept_terms_for_current_user_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: UsersApi.accept_terms_for_current_user ...' end # resource path local_var_path = '/users/terms-and-conditions' # 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 = ['ApiKeyAuth'] 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) if @api_client.config.debugging @api_client.config.logger.debug "API called: UsersApi#accept_terms_for_current_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Add a new user # Add a new user to the system. Users in the system must have unique emails. If successful, the path to the new user object is returned and a welcome email containing a temporary password will be sent to the email associated with the user. The login credentials expires in 24 hours. If the user does not login to the system within that time, a new invitation is required. # @param [Hash] opts the optional parameters # @option opts [UserInput] :body # @return [String] def add_user(opts = {}) data, _status_code, _headers = add_user_with_http_info(opts) data end # Add a new user # Add a new user to the system. Users in the system must have unique emails. If successful, the path to the new user object is returned and a welcome email containing a temporary password will be sent to the email associated with the user. The login credentials expires in 24 hours. If the user does not login to the system within that time, a new invitation is required. # @param [Hash] opts the optional parameters # @option opts [UserInput] :body # @return [Array<(String, Fixnum, Hash)>] String data, response status code and response headers def add_user_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: UsersApi.add_user ...' end # resource path local_var_path = '/users' # 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(opts[:'body']) auth_names = ['ApiKeyAuth'] 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 => 'String') if @api_client.config.debugging @api_client.config.logger.debug "API called: UsersApi#add_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Add user group # Create a new user group based on the parameters in the input # @param [Hash] opts the optional parameters # @option opts [UserGroupRequestJson] :body # @return [UserGroupJson] def add_user_group(opts = {}) data, _status_code, _headers = add_user_group_with_http_info(opts) data end # Add user group # Create a new user group based on the parameters in the input # @param [Hash] opts the optional parameters # @option opts [UserGroupRequestJson] :body # @return [Array<(UserGroupJson, Fixnum, Hash)>] UserGroupJson data, response status code and response headers def add_user_group_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: UsersApi.add_user_group ...' end # resource path local_var_path = '/userGroups' # 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(opts[:'body']) auth_names = ['ApiKeyAuth'] 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 => 'UserGroupJson') if @api_client.config.debugging @api_client.config.logger.debug "API called: UsersApi#add_user_group\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Delete user group # Delete the user group by Id # @param user_group_id # @param [Hash] opts the optional parameters # @return [UserGroupJson] def delete_user_group(user_group_id, opts = {}) data, _status_code, _headers = delete_user_group_with_http_info(user_group_id, opts) data end # Delete user group # Delete the user group by Id # @param user_group_id # @param [Hash] opts the optional parameters # @return [Array<(UserGroupJson, Fixnum, Hash)>] UserGroupJson data, response status code and response headers def delete_user_group_with_http_info(user_group_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: UsersApi.delete_user_group ...' end # verify the required parameter 'user_group_id' is set if @api_client.config.client_side_validation && user_group_id.nil? fail ArgumentError, "Missing the required parameter 'user_group_id' when calling UsersApi.delete_user_group" end # resource path local_var_path = '/userGroups/{userGroupId}'.sub('{' + 'userGroupId' + '}', user_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 = ['ApiKeyAuth'] 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 => 'UserGroupJson') if @api_client.config.debugging @api_client.config.logger.debug "API called: UsersApi#delete_user_group\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Disable user # Disables a user by Id. If successful, returns the user just disabled # @param id # @param [Hash] opts the optional parameters # @return [UserJson] def disable_user(id, opts = {}) data, _status_code, _headers = disable_user_with_http_info(id, opts) data end # Disable user # Disables a user by Id. If successful, returns the user just disabled # @param id # @param [Hash] opts the optional parameters # @return [Array<(UserJson, Fixnum, Hash)>] UserJson data, response status code and response headers def disable_user_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: UsersApi.disable_user ...' end # verify the required parameter 'id' is set if @api_client.config.client_side_validation && id.nil? fail ArgumentError, "Missing the required parameter 'id' when calling UsersApi.disable_user" end # resource path local_var_path = '/users/disable/{id}'.sub('{' + 'id' + '}', 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 = ['ApiKeyAuth'] 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 => 'UserJson') if @api_client.config.debugging @api_client.config.logger.debug "API called: UsersApi#disable_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Enable user # Enables a user by Id. If successful, returns the user just enabled # @param id # @param [Hash] opts the optional parameters # @return [UserJson] def enable_user(id, opts = {}) data, _status_code, _headers = enable_user_with_http_info(id, opts) data end # Enable user # Enables a user by Id. If successful, returns the user just enabled # @param id # @param [Hash] opts the optional parameters # @return [Array<(UserJson, Fixnum, Hash)>] UserJson data, response status code and response headers def enable_user_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: UsersApi.enable_user ...' end # verify the required parameter 'id' is set if @api_client.config.client_side_validation && id.nil? fail ArgumentError, "Missing the required parameter 'id' when calling UsersApi.enable_user" end # resource path local_var_path = '/users/enable/{id}'.sub('{' + 'id' + '}', 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 = ['ApiKeyAuth'] 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 => 'UserJson') if @api_client.config.debugging @api_client.config.logger.debug "API called: UsersApi#enable_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get user by Id # Returns a specific user by Id # @param id # @param [Hash] opts the optional parameters # @return [UserJson] def get_user(id, opts = {}) data, _status_code, _headers = get_user_with_http_info(id, opts) data end # Get user by Id # Returns a specific user by Id # @param id # @param [Hash] opts the optional parameters # @return [Array<(UserJson, Fixnum, Hash)>] UserJson data, response status code and response headers def get_user_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: UsersApi.get_user ...' end # verify the required parameter 'id' is set if @api_client.config.client_side_validation && id.nil? fail ArgumentError, "Missing the required parameter 'id' when calling UsersApi.get_user" end # resource path local_var_path = '/users/{id}'.sub('{' + 'id' + '}', 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 = ['ApiKeyAuth'] 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 => 'UserJson') if @api_client.config.debugging @api_client.config.logger.debug "API called: UsersApi#get_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get user group # Retrieve a user group by Id # @param user_group_id # @param [Hash] opts the optional parameters # @return [UserGroupJson] def get_user_group(user_group_id, opts = {}) data, _status_code, _headers = get_user_group_with_http_info(user_group_id, opts) data end # Get user group # Retrieve a user group by Id # @param user_group_id # @param [Hash] opts the optional parameters # @return [Array<(UserGroupJson, Fixnum, Hash)>] UserGroupJson data, response status code and response headers def get_user_group_with_http_info(user_group_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: UsersApi.get_user_group ...' end # verify the required parameter 'user_group_id' is set if @api_client.config.client_side_validation && user_group_id.nil? fail ArgumentError, "Missing the required parameter 'user_group_id' when calling UsersApi.get_user_group" end # resource path local_var_path = '/userGroups/{userGroupId}'.sub('{' + 'userGroupId' + '}', user_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 = ['ApiKeyAuth'] 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 => 'UserGroupJson') if @api_client.config.debugging @api_client.config.logger.debug "API called: UsersApi#get_user_group\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get user groups # Get all available user groups # @param [Hash] opts the optional parameters # @return [Array] def get_user_groups(opts = {}) data, _status_code, _headers = get_user_groups_with_http_info(opts) data end # Get user groups # Get all available user groups # @param [Hash] opts the optional parameters # @return [Array<(Array, Fixnum, Hash)>] Array data, response status code and response headers def get_user_groups_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: UsersApi.get_user_groups ...' end # resource path local_var_path = '/userGroups' # 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 = ['ApiKeyAuth'] 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 => 'Array') if @api_client.config.debugging @api_client.config.logger.debug "API called: UsersApi#get_user_groups\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get users list # Returns a paginated list of users # @param [Hash] opts the optional parameters # @option opts [String] :cursor # @option opts [Integer] :limit # @return [UserPaginationResponseJson] def get_users(opts = {}) data, _status_code, _headers = get_users_with_http_info(opts) data end # Get users list # Returns a paginated list of users # @param [Hash] opts the optional parameters # @option opts [String] :cursor # @option opts [Integer] :limit # @return [Array<(UserPaginationResponseJson, Fixnum, Hash)>] UserPaginationResponseJson data, response status code and response headers def get_users_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: UsersApi.get_users ...' end # resource path local_var_path = '/users' # query parameters query_params = {} query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil? query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].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 = ['ApiKeyAuth'] 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 => 'UserPaginationResponseJson') if @api_client.config.debugging @api_client.config.logger.debug "API called: UsersApi#get_users\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Resend welcome email # Resend welcome email conditioning temporary credentials. This is required if the user does not register within 24 hours of user activation # @param email # @param [Hash] opts the optional parameters # @return [String] def resend_email_for_existing_user(email, opts = {}) data, _status_code, _headers = resend_email_for_existing_user_with_http_info(email, opts) data end # Resend welcome email # Resend welcome email conditioning temporary credentials. This is required if the user does not register within 24 hours of user activation # @param email # @param [Hash] opts the optional parameters # @return [Array<(String, Fixnum, Hash)>] String data, response status code and response headers def resend_email_for_existing_user_with_http_info(email, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: UsersApi.resend_email_for_existing_user ...' end # verify the required parameter 'email' is set if @api_client.config.client_side_validation && email.nil? fail ArgumentError, "Missing the required parameter 'email' when calling UsersApi.resend_email_for_existing_user" end # resource path local_var_path = '/users/resend-email/{email}'.sub('{' + 'email' + '}', email.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 = ['ApiKeyAuth'] 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 => 'String') if @api_client.config.debugging @api_client.config.logger.debug "API called: UsersApi#resend_email_for_existing_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Update user # Updates the user information. Email cannot be updated. # @param id # @param [Hash] opts the optional parameters # @option opts [UserInput] :body # @return [nil] def update_user(id, opts = {}) update_user_with_http_info(id, opts) nil end # Update user # Updates the user information. Email cannot be updated. # @param id # @param [Hash] opts the optional parameters # @option opts [UserInput] :body # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers def update_user_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: UsersApi.update_user ...' end # verify the required parameter 'id' is set if @api_client.config.client_side_validation && id.nil? fail ArgumentError, "Missing the required parameter 'id' when calling UsersApi.update_user" end # resource path local_var_path = '/users/{id}'.sub('{' + 'id' + '}', 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(opts[:'body']) auth_names = ['ApiKeyAuth'] 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) if @api_client.config.debugging @api_client.config.logger.debug "API called: UsersApi#update_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Update user group # Updates the specified user group according to the input # @param [Hash] opts the optional parameters # @option opts [UserGroupRequestJson] :body # @return [UserGroupJson] def update_user_group(opts = {}) data, _status_code, _headers = update_user_group_with_http_info(opts) data end # Update user group # Updates the specified user group according to the input # @param [Hash] opts the optional parameters # @option opts [UserGroupRequestJson] :body # @return [Array<(UserGroupJson, Fixnum, Hash)>] UserGroupJson data, response status code and response headers def update_user_group_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: UsersApi.update_user_group ...' end # resource path local_var_path = '/userGroups' # 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(opts[:'body']) auth_names = ['ApiKeyAuth'] 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 => 'UserGroupJson') if @api_client.config.debugging @api_client.config.logger.debug "API called: UsersApi#update_user_group\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Bulk user upload # Loads a list of users to be added to in CSV format. # @param [Hash] opts the optional parameters # @option opts [InputStream] :body # @return [nil] def upload_csv(opts = {}) upload_csv_with_http_info(opts) nil end # Bulk user upload # Loads a list of users to be added to in CSV format. # @param [Hash] opts the optional parameters # @option opts [InputStream] :body # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers def upload_csv_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: UsersApi.upload_csv ...' end # resource path local_var_path = '/users/upload' # 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(['text/csv']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(opts[:'body']) auth_names = ['ApiKeyAuth'] 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) if @api_client.config.debugging @api_client.config.logger.debug "API called: UsersApi#upload_csv\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end end end