=begin #Harness feature flag service client apis #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The version of the OpenAPI document: 1.0.0 Contact: cf@harness.io Generated by: https://openapi-generator.tech OpenAPI Generator version: 5.2.1 =end require 'cgi' module OpenapiClient class ClientApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # Authenticate with the admin server. # Used to retrieve all target segments for certain account id. # @param [Hash] opts the optional parameters # @option opts [AuthenticationRequest] :authentication_request # @return [AuthenticationResponse] def authenticate(opts = {}) data, _status_code, _headers = authenticate_with_http_info(opts) data end # Authenticate with the admin server. # Used to retrieve all target segments for certain account id. # @param [Hash] opts the optional parameters # @option opts [AuthenticationRequest] :authentication_request # @return [Array<(AuthenticationResponse, Integer, Hash)>] AuthenticationResponse data, response status code and response headers def authenticate_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ClientApi.authenticate ...' end # resource path local_var_path = '/client/auth' # 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']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'authentication_request']) # return_type return_type = opts[:debug_return_type] || 'AuthenticationResponse' # auth_names auth_names = opts[:debug_auth_names] || [] new_options = opts.merge( :operation => :"ClientApi.authenticate", :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: ClientApi#authenticate\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Retrieve all segments. # Used to retrieve all segments for certain account id. # @param environment_uuid [String] Unique identifier for the environment object in the API. # @param [Hash] opts the optional parameters # @option opts [String] :cluster Unique identifier for the cluster for the account # @option opts [String] :rules When set to rules=v2 will return AND rule compatible serving_rules field. When not set or set to any other value will return old rules field only compatible with OR rules. # @return [Array] def get_all_segments(environment_uuid, opts = {}) data, _status_code, _headers = get_all_segments_with_http_info(environment_uuid, opts) data end # Retrieve all segments. # Used to retrieve all segments for certain account id. # @param environment_uuid [String] Unique identifier for the environment object in the API. # @param [Hash] opts the optional parameters # @option opts [String] :cluster Unique identifier for the cluster for the account # @option opts [String] :rules When set to rules=v2 will return AND rule compatible serving_rules field. When not set or set to any other value will return old rules field only compatible with OR rules. # @return [Array<(Array, Integer, Hash)>] Array data, response status code and response headers def get_all_segments_with_http_info(environment_uuid, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ClientApi.get_all_segments ...' end # verify the required parameter 'environment_uuid' is set if @api_client.config.client_side_validation && environment_uuid.nil? fail ArgumentError, "Missing the required parameter 'environment_uuid' when calling ClientApi.get_all_segments" end # resource path local_var_path = '/client/env/{environmentUUID}/target-segments'.sub('{' + 'environmentUUID' + '}', CGI.escape(environment_uuid.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'cluster'] = opts[:'cluster'] if !opts[:'cluster'].nil? query_params[:'rules'] = opts[:'rules'] if !opts[:'rules'].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[:debug_body] # return_type return_type = opts[:debug_return_type] || 'Array' # auth_names auth_names = opts[:debug_auth_names] || ['BearerAuth'] new_options = opts.merge( :operation => :"ClientApi.get_all_segments", :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: ClientApi#get_all_segments\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get feature evaluations for target # @param environment_uuid [String] Unique identifier for the environment object in the API. # @param feature [String] Unique identifier for the flag object in the API. # @param target [String] Unique identifier for the target object in the API. # @param [Hash] opts the optional parameters # @option opts [String] :cluster Unique identifier for the cluster for the account # @return [Evaluation] def get_evaluation_by_identifier(environment_uuid, feature, target, opts = {}) data, _status_code, _headers = get_evaluation_by_identifier_with_http_info(environment_uuid, feature, target, opts) data end # Get feature evaluations for target # @param environment_uuid [String] Unique identifier for the environment object in the API. # @param feature [String] Unique identifier for the flag object in the API. # @param target [String] Unique identifier for the target object in the API. # @param [Hash] opts the optional parameters # @option opts [String] :cluster Unique identifier for the cluster for the account # @return [Array<(Evaluation, Integer, Hash)>] Evaluation data, response status code and response headers def get_evaluation_by_identifier_with_http_info(environment_uuid, feature, target, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ClientApi.get_evaluation_by_identifier ...' end # verify the required parameter 'environment_uuid' is set if @api_client.config.client_side_validation && environment_uuid.nil? fail ArgumentError, "Missing the required parameter 'environment_uuid' when calling ClientApi.get_evaluation_by_identifier" end # verify the required parameter 'feature' is set if @api_client.config.client_side_validation && feature.nil? fail ArgumentError, "Missing the required parameter 'feature' when calling ClientApi.get_evaluation_by_identifier" end # verify the required parameter 'target' is set if @api_client.config.client_side_validation && target.nil? fail ArgumentError, "Missing the required parameter 'target' when calling ClientApi.get_evaluation_by_identifier" end # resource path local_var_path = '/client/env/{environmentUUID}/target/{target}/evaluations/{feature}'.sub('{' + 'environmentUUID' + '}', CGI.escape(environment_uuid.to_s)).sub('{' + 'feature' + '}', CGI.escape(feature.to_s)).sub('{' + 'target' + '}', CGI.escape(target.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'cluster'] = opts[:'cluster'] if !opts[:'cluster'].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[:debug_body] # return_type return_type = opts[:debug_return_type] || 'Evaluation' # auth_names auth_names = opts[:debug_auth_names] || ['BearerAuth'] new_options = opts.merge( :operation => :"ClientApi.get_evaluation_by_identifier", :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: ClientApi#get_evaluation_by_identifier\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get feature evaluations for target # @param environment_uuid [String] Unique identifier for the environment object in the API. # @param target [String] Unique identifier for the target object in the API. # @param [Hash] opts the optional parameters # @option opts [String] :cluster Unique identifier for the cluster for the account # @return [Pagination] def get_evaluations(environment_uuid, target, opts = {}) data, _status_code, _headers = get_evaluations_with_http_info(environment_uuid, target, opts) data end # Get feature evaluations for target # @param environment_uuid [String] Unique identifier for the environment object in the API. # @param target [String] Unique identifier for the target object in the API. # @param [Hash] opts the optional parameters # @option opts [String] :cluster Unique identifier for the cluster for the account # @return [Array<(Pagination, Integer, Hash)>] Pagination data, response status code and response headers def get_evaluations_with_http_info(environment_uuid, target, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ClientApi.get_evaluations ...' end # verify the required parameter 'environment_uuid' is set if @api_client.config.client_side_validation && environment_uuid.nil? fail ArgumentError, "Missing the required parameter 'environment_uuid' when calling ClientApi.get_evaluations" end # verify the required parameter 'target' is set if @api_client.config.client_side_validation && target.nil? fail ArgumentError, "Missing the required parameter 'target' when calling ClientApi.get_evaluations" end # resource path local_var_path = '/client/env/{environmentUUID}/target/{target}/evaluations'.sub('{' + 'environmentUUID' + '}', CGI.escape(environment_uuid.to_s)).sub('{' + 'target' + '}', CGI.escape(target.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'cluster'] = opts[:'cluster'] if !opts[:'cluster'].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[:debug_body] # return_type return_type = opts[:debug_return_type] || 'Pagination' # auth_names auth_names = opts[:debug_auth_names] || ['BearerAuth'] new_options = opts.merge( :operation => :"ClientApi.get_evaluations", :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: ClientApi#get_evaluations\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get all feature flags activations # All feature flags with activations in project environment # @param environment_uuid [String] Unique identifier for the environment object in the API. # @param [Hash] opts the optional parameters # @option opts [String] :cluster Unique identifier for the cluster for the account # @return [Array] def get_feature_config(environment_uuid, opts = {}) data, _status_code, _headers = get_feature_config_with_http_info(environment_uuid, opts) data end # Get all feature flags activations # All feature flags with activations in project environment # @param environment_uuid [String] Unique identifier for the environment object in the API. # @param [Hash] opts the optional parameters # @option opts [String] :cluster Unique identifier for the cluster for the account # @return [Array<(Array, Integer, Hash)>] Array data, response status code and response headers def get_feature_config_with_http_info(environment_uuid, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ClientApi.get_feature_config ...' end # verify the required parameter 'environment_uuid' is set if @api_client.config.client_side_validation && environment_uuid.nil? fail ArgumentError, "Missing the required parameter 'environment_uuid' when calling ClientApi.get_feature_config" end # resource path local_var_path = '/client/env/{environmentUUID}/feature-configs'.sub('{' + 'environmentUUID' + '}', CGI.escape(environment_uuid.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'cluster'] = opts[:'cluster'] if !opts[:'cluster'].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[:debug_body] # return_type return_type = opts[:debug_return_type] || 'Array' # auth_names auth_names = opts[:debug_auth_names] || ['BearerAuth'] new_options = opts.merge( :operation => :"ClientApi.get_feature_config", :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: ClientApi#get_feature_config\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get feature config # @param identifier [String] Unique identifier for the flag object in the API. # @param environment_uuid [String] Unique identifier for the environment object in the API. # @param [Hash] opts the optional parameters # @option opts [String] :cluster Unique identifier for the cluster for the account # @return [FeatureConfig] def get_feature_config_by_identifier(identifier, environment_uuid, opts = {}) data, _status_code, _headers = get_feature_config_by_identifier_with_http_info(identifier, environment_uuid, opts) data end # Get feature config # @param identifier [String] Unique identifier for the flag object in the API. # @param environment_uuid [String] Unique identifier for the environment object in the API. # @param [Hash] opts the optional parameters # @option opts [String] :cluster Unique identifier for the cluster for the account # @return [Array<(FeatureConfig, Integer, Hash)>] FeatureConfig data, response status code and response headers def get_feature_config_by_identifier_with_http_info(identifier, environment_uuid, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ClientApi.get_feature_config_by_identifier ...' end # verify the required parameter 'identifier' is set if @api_client.config.client_side_validation && identifier.nil? fail ArgumentError, "Missing the required parameter 'identifier' when calling ClientApi.get_feature_config_by_identifier" end # verify the required parameter 'environment_uuid' is set if @api_client.config.client_side_validation && environment_uuid.nil? fail ArgumentError, "Missing the required parameter 'environment_uuid' when calling ClientApi.get_feature_config_by_identifier" end # resource path local_var_path = '/client/env/{environmentUUID}/feature-configs/{identifier}'.sub('{' + 'identifier' + '}', CGI.escape(identifier.to_s)).sub('{' + 'environmentUUID' + '}', CGI.escape(environment_uuid.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'cluster'] = opts[:'cluster'] if !opts[:'cluster'].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[:debug_body] # return_type return_type = opts[:debug_return_type] || 'FeatureConfig' # auth_names auth_names = opts[:debug_auth_names] || ['BearerAuth'] new_options = opts.merge( :operation => :"ClientApi.get_feature_config_by_identifier", :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: ClientApi#get_feature_config_by_identifier\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Retrieve a segment by identifier # Used to retrieve a segment for a certain account id by identifier # @param identifier [String] Unique identifier for the segment object in the API # @param environment_uuid [String] Unique identifier for the environment object in the API # @param [Hash] opts the optional parameters # @option opts [String] :cluster Unique identifier for the cluster for the account # @option opts [String] :rules When set to rules=v2 will return AND rule compatible serving_rules field. When not set or set to any other value will return old rules field only compatible with OR rules. # @return [Segment] def get_segment_by_identifier(identifier, environment_uuid, opts = {}) data, _status_code, _headers = get_segment_by_identifier_with_http_info(identifier, environment_uuid, opts) data end # Retrieve a segment by identifier # Used to retrieve a segment for a certain account id by identifier # @param identifier [String] Unique identifier for the segment object in the API # @param environment_uuid [String] Unique identifier for the environment object in the API # @param [Hash] opts the optional parameters # @option opts [String] :cluster Unique identifier for the cluster for the account # @option opts [String] :rules When set to rules=v2 will return AND rule compatible serving_rules field. When not set or set to any other value will return old rules field only compatible with OR rules. # @return [Array<(Segment, Integer, Hash)>] Segment data, response status code and response headers def get_segment_by_identifier_with_http_info(identifier, environment_uuid, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ClientApi.get_segment_by_identifier ...' end # verify the required parameter 'identifier' is set if @api_client.config.client_side_validation && identifier.nil? fail ArgumentError, "Missing the required parameter 'identifier' when calling ClientApi.get_segment_by_identifier" end # verify the required parameter 'environment_uuid' is set if @api_client.config.client_side_validation && environment_uuid.nil? fail ArgumentError, "Missing the required parameter 'environment_uuid' when calling ClientApi.get_segment_by_identifier" end # resource path local_var_path = '/client/env/{environmentUUID}/target-segments/{identifier}'.sub('{' + 'identifier' + '}', CGI.escape(identifier.to_s)).sub('{' + 'environmentUUID' + '}', CGI.escape(environment_uuid.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'cluster'] = opts[:'cluster'] if !opts[:'cluster'].nil? query_params[:'rules'] = opts[:'rules'] if !opts[:'rules'].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[:debug_body] # return_type return_type = opts[:debug_return_type] || 'Segment' # auth_names auth_names = opts[:debug_auth_names] || ['BearerAuth'] new_options = opts.merge( :operation => :"ClientApi.get_segment_by_identifier", :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: ClientApi#get_segment_by_identifier\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Stream endpoint. # @param api_key [String] # @param [Hash] opts the optional parameters # @option opts [String] :cluster Unique identifier for the cluster for the account # @return [nil] def stream(api_key, opts = {}) stream_with_http_info(api_key, opts) nil end # Stream endpoint. # @param api_key [String] # @param [Hash] opts the optional parameters # @option opts [String] :cluster Unique identifier for the cluster for the account # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers def stream_with_http_info(api_key, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ClientApi.stream ...' end # verify the required parameter 'api_key' is set if @api_client.config.client_side_validation && api_key.nil? fail ArgumentError, "Missing the required parameter 'api_key' when calling ClientApi.stream" end # resource path local_var_path = '/stream' # query parameters query_params = opts[:query_params] || {} query_params[:'cluster'] = opts[:'cluster'] if !opts[:'cluster'].nil? # header parameters header_params = opts[:header_params] || {} header_params[:'API-Key'] = api_key # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] # auth_names auth_names = opts[:debug_auth_names] || ['BearerAuth'] new_options = opts.merge( :operation => :"ClientApi.stream", :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: ClientApi#stream\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end end end