=begin #Pulp 3 API #Fetch, Upload, Organize, and Distribute Software Packages The version of the OpenAPI document: v3 Contact: pulp-list@redhat.com Generated by: https://openapi-generator.tech OpenAPI Generator version: 4.3.1 =end require 'cgi' module PulpcoreClient class UsersApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # Create an user # ViewSet for User. # @param user [User] # @param [Hash] opts the optional parameters # @return [UserResponse] def users_create(user, opts = {}) data, _status_code, _headers = users_create_with_http_info(user, opts) data end # Create an user # ViewSet for User. # @param user [User] # @param [Hash] opts the optional parameters # @return [Array<(UserResponse, Integer, Hash)>] UserResponse data, response status code and response headers def users_create_with_http_info(user, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: UsersApi.users_create ...' end # verify the required parameter 'user' is set if @api_client.config.client_side_validation && user.nil? fail ArgumentError, "Missing the required parameter 'user' when calling UsersApi.users_create" end # resource path local_var_path = '/pulp/api/v3/users/' # 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' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'multipart/form-data']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] || @api_client.object_to_http_body(user) # return_type return_type = opts[:return_type] || 'UserResponse' # auth_names auth_names = opts[:auth_names] || ['basicAuth'] new_options = opts.merge( :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: UsersApi#users_create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Delete an user # ViewSet for User. # @param auth_user_href [String] # @param [Hash] opts the optional parameters # @return [nil] def users_delete(auth_user_href, opts = {}) users_delete_with_http_info(auth_user_href, opts) nil end # Delete an user # ViewSet for User. # @param auth_user_href [String] # @param [Hash] opts the optional parameters # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers def users_delete_with_http_info(auth_user_href, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: UsersApi.users_delete ...' end # verify the required parameter 'auth_user_href' is set if @api_client.config.client_side_validation && auth_user_href.nil? fail ArgumentError, "Missing the required parameter 'auth_user_href' when calling UsersApi.users_delete" end # resource path local_var_path = '{auth_user_href}'.sub('{' + 'auth_user_href' + '}', CGI.escape(auth_user_href.to_s).gsub('%2F', '/')) # 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[:body] # return_type return_type = opts[:return_type] # auth_names auth_names = opts[:auth_names] || ['basicAuth'] new_options = opts.merge( :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: UsersApi#users_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # List users # ViewSet for User. # @param [Hash] opts the optional parameters # @option opts [String] :email Filter results where email matches value # @option opts [String] :email__contains Filter results where email contains value # @option opts [String] :email__icontains Filter results where email contains value # @option opts [String] :email__iexact Filter results where email matches value # @option opts [Array] :email__in Filter results where email is in a comma-separated list of values # @option opts [String] :first_name Filter results where first_name matches value # @option opts [String] :first_name__contains Filter results where first_name contains value # @option opts [String] :first_name__icontains Filter results where first_name contains value # @option opts [String] :first_name__iexact Filter results where first_name matches value # @option opts [Array] :first_name__in Filter results where first_name is in a comma-separated list of values # @option opts [Boolean] :is_active Filter results where is_active matches value # @option opts [Boolean] :is_staff Filter results where is_staff matches value # @option opts [String] :last_name Filter results where last_name matches value # @option opts [String] :last_name__contains Filter results where last_name contains value # @option opts [String] :last_name__icontains Filter results where last_name contains value # @option opts [String] :last_name__iexact Filter results where last_name matches value # @option opts [Array] :last_name__in Filter results where last_name is in a comma-separated list of values # @option opts [Integer] :limit Number of results to return per page. # @option opts [Integer] :offset The initial index from which to return the results. # @option opts [Array] :ordering Ordering * `id` - Id * `-id` - Id (descending) * `password` - Password * `-password` - Password (descending) * `last_login` - Last login * `-last_login` - Last login (descending) * `is_superuser` - Is superuser * `-is_superuser` - Is superuser (descending) * `username` - Username * `-username` - Username (descending) * `first_name` - First name * `-first_name` - First name (descending) * `last_name` - Last name * `-last_name` - Last name (descending) * `email` - Email * `-email` - Email (descending) * `is_staff` - Is staff * `-is_staff` - Is staff (descending) * `is_active` - Is active * `-is_active` - Is active (descending) * `date_joined` - Date joined * `-date_joined` - Date joined (descending) * `pk` - Pk * `-pk` - Pk (descending) # @option opts [Array] :pulp_href__in Multiple values may be separated by commas. # @option opts [Array] :pulp_id__in Multiple values may be separated by commas. # @option opts [String] :username Filter results where username matches value # @option opts [String] :username__contains Filter results where username contains value # @option opts [String] :username__icontains Filter results where username contains value # @option opts [String] :username__iexact Filter results where username matches value # @option opts [Array] :username__in Filter results where username is in a comma-separated list of values # @option opts [Array] :fields A list of fields to include in the response. # @option opts [Array] :exclude_fields A list of fields to exclude from the response. # @return [PaginatedUserResponseList] def users_list(opts = {}) data, _status_code, _headers = users_list_with_http_info(opts) data end # List users # ViewSet for User. # @param [Hash] opts the optional parameters # @option opts [String] :email Filter results where email matches value # @option opts [String] :email__contains Filter results where email contains value # @option opts [String] :email__icontains Filter results where email contains value # @option opts [String] :email__iexact Filter results where email matches value # @option opts [Array] :email__in Filter results where email is in a comma-separated list of values # @option opts [String] :first_name Filter results where first_name matches value # @option opts [String] :first_name__contains Filter results where first_name contains value # @option opts [String] :first_name__icontains Filter results where first_name contains value # @option opts [String] :first_name__iexact Filter results where first_name matches value # @option opts [Array] :first_name__in Filter results where first_name is in a comma-separated list of values # @option opts [Boolean] :is_active Filter results where is_active matches value # @option opts [Boolean] :is_staff Filter results where is_staff matches value # @option opts [String] :last_name Filter results where last_name matches value # @option opts [String] :last_name__contains Filter results where last_name contains value # @option opts [String] :last_name__icontains Filter results where last_name contains value # @option opts [String] :last_name__iexact Filter results where last_name matches value # @option opts [Array] :last_name__in Filter results where last_name is in a comma-separated list of values # @option opts [Integer] :limit Number of results to return per page. # @option opts [Integer] :offset The initial index from which to return the results. # @option opts [Array] :ordering Ordering * `id` - Id * `-id` - Id (descending) * `password` - Password * `-password` - Password (descending) * `last_login` - Last login * `-last_login` - Last login (descending) * `is_superuser` - Is superuser * `-is_superuser` - Is superuser (descending) * `username` - Username * `-username` - Username (descending) * `first_name` - First name * `-first_name` - First name (descending) * `last_name` - Last name * `-last_name` - Last name (descending) * `email` - Email * `-email` - Email (descending) * `is_staff` - Is staff * `-is_staff` - Is staff (descending) * `is_active` - Is active * `-is_active` - Is active (descending) * `date_joined` - Date joined * `-date_joined` - Date joined (descending) * `pk` - Pk * `-pk` - Pk (descending) # @option opts [Array] :pulp_href__in Multiple values may be separated by commas. # @option opts [Array] :pulp_id__in Multiple values may be separated by commas. # @option opts [String] :username Filter results where username matches value # @option opts [String] :username__contains Filter results where username contains value # @option opts [String] :username__icontains Filter results where username contains value # @option opts [String] :username__iexact Filter results where username matches value # @option opts [Array] :username__in Filter results where username is in a comma-separated list of values # @option opts [Array] :fields A list of fields to include in the response. # @option opts [Array] :exclude_fields A list of fields to exclude from the response. # @return [Array<(PaginatedUserResponseList, Integer, Hash)>] PaginatedUserResponseList data, response status code and response headers def users_list_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: UsersApi.users_list ...' end allowable_values = ["-date_joined", "-email", "-first_name", "-id", "-is_active", "-is_staff", "-is_superuser", "-last_login", "-last_name", "-password", "-pk", "-username", "date_joined", "email", "first_name", "id", "is_active", "is_staff", "is_superuser", "last_login", "last_name", "password", "pk", "username"] if @api_client.config.client_side_validation && opts[:'ordering'] && !opts[:'ordering'].all? { |item| allowable_values.include?(item) } fail ArgumentError, "invalid value for \"ordering\", must include one of #{allowable_values}" end # resource path local_var_path = '/pulp/api/v3/users/' # query parameters query_params = opts[:query_params] || {} query_params[:'email'] = opts[:'email'] if !opts[:'email'].nil? query_params[:'email__contains'] = opts[:'email__contains'] if !opts[:'email__contains'].nil? query_params[:'email__icontains'] = opts[:'email__icontains'] if !opts[:'email__icontains'].nil? query_params[:'email__iexact'] = opts[:'email__iexact'] if !opts[:'email__iexact'].nil? query_params[:'email__in'] = @api_client.build_collection_param(opts[:'email__in'], :csv) if !opts[:'email__in'].nil? query_params[:'first_name'] = opts[:'first_name'] if !opts[:'first_name'].nil? query_params[:'first_name__contains'] = opts[:'first_name__contains'] if !opts[:'first_name__contains'].nil? query_params[:'first_name__icontains'] = opts[:'first_name__icontains'] if !opts[:'first_name__icontains'].nil? query_params[:'first_name__iexact'] = opts[:'first_name__iexact'] if !opts[:'first_name__iexact'].nil? query_params[:'first_name__in'] = @api_client.build_collection_param(opts[:'first_name__in'], :csv) if !opts[:'first_name__in'].nil? query_params[:'is_active'] = opts[:'is_active'] if !opts[:'is_active'].nil? query_params[:'is_staff'] = opts[:'is_staff'] if !opts[:'is_staff'].nil? query_params[:'last_name'] = opts[:'last_name'] if !opts[:'last_name'].nil? query_params[:'last_name__contains'] = opts[:'last_name__contains'] if !opts[:'last_name__contains'].nil? query_params[:'last_name__icontains'] = opts[:'last_name__icontains'] if !opts[:'last_name__icontains'].nil? query_params[:'last_name__iexact'] = opts[:'last_name__iexact'] if !opts[:'last_name__iexact'].nil? query_params[:'last_name__in'] = @api_client.build_collection_param(opts[:'last_name__in'], :csv) if !opts[:'last_name__in'].nil? query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil? query_params[:'ordering'] = @api_client.build_collection_param(opts[:'ordering'], :csv) if !opts[:'ordering'].nil? query_params[:'pulp_href__in'] = @api_client.build_collection_param(opts[:'pulp_href__in'], :csv) if !opts[:'pulp_href__in'].nil? query_params[:'pulp_id__in'] = @api_client.build_collection_param(opts[:'pulp_id__in'], :csv) if !opts[:'pulp_id__in'].nil? query_params[:'username'] = opts[:'username'] if !opts[:'username'].nil? query_params[:'username__contains'] = opts[:'username__contains'] if !opts[:'username__contains'].nil? query_params[:'username__icontains'] = opts[:'username__icontains'] if !opts[:'username__icontains'].nil? query_params[:'username__iexact'] = opts[:'username__iexact'] if !opts[:'username__iexact'].nil? query_params[:'username__in'] = @api_client.build_collection_param(opts[:'username__in'], :csv) if !opts[:'username__in'].nil? query_params[:'fields'] = @api_client.build_collection_param(opts[:'fields'], :multi) if !opts[:'fields'].nil? query_params[:'exclude_fields'] = @api_client.build_collection_param(opts[:'exclude_fields'], :multi) if !opts[:'exclude_fields'].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[:body] # return_type return_type = opts[:return_type] || 'PaginatedUserResponseList' # auth_names auth_names = opts[:auth_names] || ['basicAuth'] new_options = opts.merge( :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: UsersApi#users_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Update an user # ViewSet for User. # @param auth_user_href [String] # @param patched_user [PatchedUser] # @param [Hash] opts the optional parameters # @return [UserResponse] def users_partial_update(auth_user_href, patched_user, opts = {}) data, _status_code, _headers = users_partial_update_with_http_info(auth_user_href, patched_user, opts) data end # Update an user # ViewSet for User. # @param auth_user_href [String] # @param patched_user [PatchedUser] # @param [Hash] opts the optional parameters # @return [Array<(UserResponse, Integer, Hash)>] UserResponse data, response status code and response headers def users_partial_update_with_http_info(auth_user_href, patched_user, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: UsersApi.users_partial_update ...' end # verify the required parameter 'auth_user_href' is set if @api_client.config.client_side_validation && auth_user_href.nil? fail ArgumentError, "Missing the required parameter 'auth_user_href' when calling UsersApi.users_partial_update" end # verify the required parameter 'patched_user' is set if @api_client.config.client_side_validation && patched_user.nil? fail ArgumentError, "Missing the required parameter 'patched_user' when calling UsersApi.users_partial_update" end # resource path local_var_path = '{auth_user_href}'.sub('{' + 'auth_user_href' + '}', CGI.escape(auth_user_href.to_s).gsub('%2F', '/')) # 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' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'multipart/form-data']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] || @api_client.object_to_http_body(patched_user) # return_type return_type = opts[:return_type] || 'UserResponse' # auth_names auth_names = opts[:auth_names] || ['basicAuth'] new_options = opts.merge( :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(:PATCH, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: UsersApi#users_partial_update\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Inspect an user # ViewSet for User. # @param auth_user_href [String] # @param [Hash] opts the optional parameters # @option opts [Array] :fields A list of fields to include in the response. # @option opts [Array] :exclude_fields A list of fields to exclude from the response. # @return [UserResponse] def users_read(auth_user_href, opts = {}) data, _status_code, _headers = users_read_with_http_info(auth_user_href, opts) data end # Inspect an user # ViewSet for User. # @param auth_user_href [String] # @param [Hash] opts the optional parameters # @option opts [Array] :fields A list of fields to include in the response. # @option opts [Array] :exclude_fields A list of fields to exclude from the response. # @return [Array<(UserResponse, Integer, Hash)>] UserResponse data, response status code and response headers def users_read_with_http_info(auth_user_href, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: UsersApi.users_read ...' end # verify the required parameter 'auth_user_href' is set if @api_client.config.client_side_validation && auth_user_href.nil? fail ArgumentError, "Missing the required parameter 'auth_user_href' when calling UsersApi.users_read" end # resource path local_var_path = '{auth_user_href}'.sub('{' + 'auth_user_href' + '}', CGI.escape(auth_user_href.to_s).gsub('%2F', '/')) # query parameters query_params = opts[:query_params] || {} query_params[:'fields'] = @api_client.build_collection_param(opts[:'fields'], :multi) if !opts[:'fields'].nil? query_params[:'exclude_fields'] = @api_client.build_collection_param(opts[:'exclude_fields'], :multi) if !opts[:'exclude_fields'].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[:body] # return_type return_type = opts[:return_type] || 'UserResponse' # auth_names auth_names = opts[:auth_names] || ['basicAuth'] new_options = opts.merge( :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: UsersApi#users_read\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Update an user # ViewSet for User. # @param auth_user_href [String] # @param user [User] # @param [Hash] opts the optional parameters # @return [UserResponse] def users_update(auth_user_href, user, opts = {}) data, _status_code, _headers = users_update_with_http_info(auth_user_href, user, opts) data end # Update an user # ViewSet for User. # @param auth_user_href [String] # @param user [User] # @param [Hash] opts the optional parameters # @return [Array<(UserResponse, Integer, Hash)>] UserResponse data, response status code and response headers def users_update_with_http_info(auth_user_href, user, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: UsersApi.users_update ...' end # verify the required parameter 'auth_user_href' is set if @api_client.config.client_side_validation && auth_user_href.nil? fail ArgumentError, "Missing the required parameter 'auth_user_href' when calling UsersApi.users_update" end # verify the required parameter 'user' is set if @api_client.config.client_side_validation && user.nil? fail ArgumentError, "Missing the required parameter 'user' when calling UsersApi.users_update" end # resource path local_var_path = '{auth_user_href}'.sub('{' + 'auth_user_href' + '}', CGI.escape(auth_user_href.to_s).gsub('%2F', '/')) # 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' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'multipart/form-data']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] || @api_client.object_to_http_body(user) # return_type return_type = opts[:return_type] || 'UserResponse' # auth_names auth_names = opts[:auth_names] || ['basicAuth'] new_options = opts.merge( :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: UsersApi#users_update\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end end end