class LaunchDarklyApi::FeatureFlagsApi

Attributes

api_client[RW]

Public Class Methods

new(api_client = ApiClient.default) click to toggle source
# File lib/launchdarkly_api/api/feature_flags_api.rb, line 19
def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Public Instance Methods

copy_feature_flag(proj_key, feature_flag_key, flag_copy_config_post, opts = {}) click to toggle source

Copy feature flag The includedActions and excludedActions define the parts of the flag configuration that are copied or not copied. By default, the entire flag configuration is copied. You can have either `includedActions` or `excludedActions` but not both. Valid `includedActions` and `excludedActions` include: - `updateOn` - `updatePrerequisites` - `updateTargets` - `updateRules` - `updateFallthrough` - `updateOffVariation` The `source` and `target` must be JSON objects if using curl, specifying the environment key and (optional) current flag configuration version in that environment. For example: “`json { "key": "production", "currentVersion": 3 } “` If target is specified as above, the API will test to ensure that the current flag version in the `production` environment is `3`, and reject attempts to copy settings to `production` otherwise. You can use this to enforce optimistic locking on copy attempts. @param proj_key [String] The project key. @param feature_flag_key [String] The feature flag's key. The key identifies the flag in your code. @param flag_copy_config_post [FlagCopyConfigPost] @param [Hash] opts the optional parameters @return [FeatureFlag]

# File lib/launchdarkly_api/api/feature_flags_api.rb, line 29
def copy_feature_flag(proj_key, feature_flag_key, flag_copy_config_post, opts = {})
  data, _status_code, _headers = copy_feature_flag_with_http_info(proj_key, feature_flag_key, flag_copy_config_post, opts)
  data
end
copy_feature_flag_with_http_info(proj_key, feature_flag_key, flag_copy_config_post, opts = {}) click to toggle source

Copy feature flag The includedActions and excludedActions define the parts of the flag configuration that are copied or not copied. By default, the entire flag configuration is copied. You can have either &#x60;includedActions&#x60; or &#x60;excludedActions&#x60; but not both. Valid &#x60;includedActions&#x60; and &#x60;excludedActions&#x60; include: - &#x60;updateOn&#x60; - &#x60;updatePrerequisites&#x60; - &#x60;updateTargets&#x60; - &#x60;updateRules&#x60; - &#x60;updateFallthrough&#x60; - &#x60;updateOffVariation&#x60; The &#x60;source&#x60; and &#x60;target&#x60; must be JSON objects if using curl, specifying the environment key and (optional) current flag configuration version in that environment. For example: &#x60;&#x60;&#x60;json { "key&quot;: "production&quot;, "currentVersion&quot;: 3 } &#x60;&#x60;&#x60; If target is specified as above, the API will test to ensure that the current flag version in the &#x60;production&#x60; environment is &#x60;3&#x60;, and reject attempts to copy settings to &#x60;production&#x60; otherwise. You can use this to enforce optimistic locking on copy attempts. @param proj_key [String] The project key. @param feature_flag_key [String] The feature flag&#39;s key. The key identifies the flag in your code. @param flag_copy_config_post [FlagCopyConfigPost] @param [Hash] opts the optional parameters @return [Array<(FeatureFlag, Integer, Hash)>] FeatureFlag data, response status code and response headers

# File lib/launchdarkly_api/api/feature_flags_api.rb, line 41
def copy_feature_flag_with_http_info(proj_key, feature_flag_key, flag_copy_config_post, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FeatureFlagsApi.copy_feature_flag ...'
  end
  # verify the required parameter 'proj_key' is set
  if @api_client.config.client_side_validation && proj_key.nil?
    fail ArgumentError, "Missing the required parameter 'proj_key' when calling FeatureFlagsApi.copy_feature_flag"
  end
  # verify the required parameter 'feature_flag_key' is set
  if @api_client.config.client_side_validation && feature_flag_key.nil?
    fail ArgumentError, "Missing the required parameter 'feature_flag_key' when calling FeatureFlagsApi.copy_feature_flag"
  end
  # verify the required parameter 'flag_copy_config_post' is set
  if @api_client.config.client_side_validation && flag_copy_config_post.nil?
    fail ArgumentError, "Missing the required parameter 'flag_copy_config_post' when calling FeatureFlagsApi.copy_feature_flag"
  end
  # resource path
  local_var_path = '/api/v2/flags/{projKey}/{featureFlagKey}/copy'.sub('{' + 'projKey' + '}', CGI.escape(proj_key.to_s)).sub('{' + 'featureFlagKey' + '}', CGI.escape(feature_flag_key.to_s))

  # 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(flag_copy_config_post)

  # return_type
  return_type = opts[:debug_return_type] || 'FeatureFlag'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKey']

  new_options = opts.merge(
    :operation => :"FeatureFlagsApi.copy_feature_flag",
    :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: FeatureFlagsApi#copy_feature_flag\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
delete_feature_flag(proj_key, key, opts = {}) click to toggle source

Delete feature flag Delete a feature flag in all environments. Use with caution: only delete feature flags your application no longer uses. @param proj_key [String] The project key. @param key [String] The feature flag&#39;s key. The key identifies the flag in your code. @param [Hash] opts the optional parameters @return [nil]

# File lib/launchdarkly_api/api/feature_flags_api.rb, line 105
def delete_feature_flag(proj_key, key, opts = {})
  delete_feature_flag_with_http_info(proj_key, key, opts)
  nil
end
delete_feature_flag_with_http_info(proj_key, key, opts = {}) click to toggle source

Delete feature flag Delete a feature flag in all environments. Use with caution: only delete feature flags your application no longer uses. @param proj_key [String] The project key. @param key [String] The feature flag&#39;s key. The key identifies the flag in your code. @param [Hash] opts the optional parameters @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers

# File lib/launchdarkly_api/api/feature_flags_api.rb, line 116
def delete_feature_flag_with_http_info(proj_key, key, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FeatureFlagsApi.delete_feature_flag ...'
  end
  # verify the required parameter 'proj_key' is set
  if @api_client.config.client_side_validation && proj_key.nil?
    fail ArgumentError, "Missing the required parameter 'proj_key' when calling FeatureFlagsApi.delete_feature_flag"
  end
  # verify the required parameter 'key' is set
  if @api_client.config.client_side_validation && key.nil?
    fail ArgumentError, "Missing the required parameter 'key' when calling FeatureFlagsApi.delete_feature_flag"
  end
  # resource path
  local_var_path = '/api/v2/flags/{projKey}/{key}'.sub('{' + 'projKey' + '}', CGI.escape(proj_key.to_s)).sub('{' + 'key' + '}', CGI.escape(key.to_s))

  # 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[:debug_body]

  # return_type
  return_type = opts[:debug_return_type]

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKey']

  new_options = opts.merge(
    :operation => :"FeatureFlagsApi.delete_feature_flag",
    :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: FeatureFlagsApi#delete_feature_flag\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_expiring_user_targets(proj_key, env_key, flag_key, opts = {}) click to toggle source

Get expiring user targets for feature flag Get a list of user targets on a feature flag that are scheduled for removal. @param proj_key [String] The project key. @param env_key [String] The environment key. @param flag_key [String] The feature flag key. @param [Hash] opts the optional parameters @return [ExpiringUserTargetGetResponse]

# File lib/launchdarkly_api/api/feature_flags_api.rb, line 173
def get_expiring_user_targets(proj_key, env_key, flag_key, opts = {})
  data, _status_code, _headers = get_expiring_user_targets_with_http_info(proj_key, env_key, flag_key, opts)
  data
end
get_expiring_user_targets_with_http_info(proj_key, env_key, flag_key, opts = {}) click to toggle source

Get expiring user targets for feature flag Get a list of user targets on a feature flag that are scheduled for removal. @param proj_key [String] The project key. @param env_key [String] The environment key. @param flag_key [String] The feature flag key. @param [Hash] opts the optional parameters @return [Array<(ExpiringUserTargetGetResponse, Integer, Hash)>] ExpiringUserTargetGetResponse data, response status code and response headers

# File lib/launchdarkly_api/api/feature_flags_api.rb, line 185
def get_expiring_user_targets_with_http_info(proj_key, env_key, flag_key, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FeatureFlagsApi.get_expiring_user_targets ...'
  end
  # verify the required parameter 'proj_key' is set
  if @api_client.config.client_side_validation && proj_key.nil?
    fail ArgumentError, "Missing the required parameter 'proj_key' when calling FeatureFlagsApi.get_expiring_user_targets"
  end
  # verify the required parameter 'env_key' is set
  if @api_client.config.client_side_validation && env_key.nil?
    fail ArgumentError, "Missing the required parameter 'env_key' when calling FeatureFlagsApi.get_expiring_user_targets"
  end
  # verify the required parameter 'flag_key' is set
  if @api_client.config.client_side_validation && flag_key.nil?
    fail ArgumentError, "Missing the required parameter 'flag_key' when calling FeatureFlagsApi.get_expiring_user_targets"
  end
  # resource path
  local_var_path = '/api/v2/flags/{projKey}/{flagKey}/expiring-user-targets/{envKey}'.sub('{' + 'projKey' + '}', CGI.escape(proj_key.to_s)).sub('{' + 'envKey' + '}', CGI.escape(env_key.to_s)).sub('{' + 'flagKey' + '}', CGI.escape(flag_key.to_s))

  # 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'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'ExpiringUserTargetGetResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKey']

  new_options = opts.merge(
    :operation => :"FeatureFlagsApi.get_expiring_user_targets",
    :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: FeatureFlagsApi#get_expiring_user_targets\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_feature_flag(proj_key, key, opts = {}) click to toggle source

Get feature flag Get a single feature flag by key. By default, this returns the configurations for all environments. You can filter environments with the `env` query parameter. For example, setting `env=production` restricts the returned configurations to just the `production` environment. @param proj_key [String] The project key @param key [String] The feature flag key @param [Hash] opts the optional parameters @option opts [String] :env Filter configurations by environment @return [FeatureFlag]

# File lib/launchdarkly_api/api/feature_flags_api.rb, line 248
def get_feature_flag(proj_key, key, opts = {})
  data, _status_code, _headers = get_feature_flag_with_http_info(proj_key, key, opts)
  data
end
get_feature_flag_status(proj_key, env_key, key, opts = {}) click to toggle source

Get feature flag status Get the status for a particular feature flag. @param proj_key [String] The project key @param env_key [String] The environment key @param key [String] The feature flag key @param [Hash] opts the optional parameters @return [FlagStatusRep]

# File lib/launchdarkly_api/api/feature_flags_api.rb, line 320
def get_feature_flag_status(proj_key, env_key, key, opts = {})
  data, _status_code, _headers = get_feature_flag_status_with_http_info(proj_key, env_key, key, opts)
  data
end
get_feature_flag_status_across_environments(proj_key, key, opts = {}) click to toggle source

Get flag status across environments Get the status for a particular feature flag across environments. @param proj_key [String] The project key @param key [String] The feature flag key @param [Hash] opts the optional parameters @option opts [String] :env Optional environment filter @return [FeatureFlagStatusAcrossEnvironments]

# File lib/launchdarkly_api/api/feature_flags_api.rb, line 395
def get_feature_flag_status_across_environments(proj_key, key, opts = {})
  data, _status_code, _headers = get_feature_flag_status_across_environments_with_http_info(proj_key, key, opts)
  data
end
get_feature_flag_status_across_environments_with_http_info(proj_key, key, opts = {}) click to toggle source

Get flag status across environments Get the status for a particular feature flag across environments. @param proj_key [String] The project key @param key [String] The feature flag key @param [Hash] opts the optional parameters @option opts [String] :env Optional environment filter @return [Array<(FeatureFlagStatusAcrossEnvironments, Integer, Hash)>] FeatureFlagStatusAcrossEnvironments data, response status code and response headers

# File lib/launchdarkly_api/api/feature_flags_api.rb, line 407
def get_feature_flag_status_across_environments_with_http_info(proj_key, key, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FeatureFlagsApi.get_feature_flag_status_across_environments ...'
  end
  # verify the required parameter 'proj_key' is set
  if @api_client.config.client_side_validation && proj_key.nil?
    fail ArgumentError, "Missing the required parameter 'proj_key' when calling FeatureFlagsApi.get_feature_flag_status_across_environments"
  end
  # verify the required parameter 'key' is set
  if @api_client.config.client_side_validation && key.nil?
    fail ArgumentError, "Missing the required parameter 'key' when calling FeatureFlagsApi.get_feature_flag_status_across_environments"
  end
  # resource path
  local_var_path = '/api/v2/flag-status/{projKey}/{key}'.sub('{' + 'projKey' + '}', CGI.escape(proj_key.to_s)).sub('{' + 'key' + '}', CGI.escape(key.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'env'] = opts[:'env'] if !opts[:'env'].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] || 'FeatureFlagStatusAcrossEnvironments'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKey']

  new_options = opts.merge(
    :operation => :"FeatureFlagsApi.get_feature_flag_status_across_environments",
    :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: FeatureFlagsApi#get_feature_flag_status_across_environments\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_feature_flag_status_with_http_info(proj_key, env_key, key, opts = {}) click to toggle source

Get feature flag status Get the status for a particular feature flag. @param proj_key [String] The project key @param env_key [String] The environment key @param key [String] The feature flag key @param [Hash] opts the optional parameters @return [Array<(FlagStatusRep, Integer, Hash)>] FlagStatusRep data, response status code and response headers

# File lib/launchdarkly_api/api/feature_flags_api.rb, line 332
def get_feature_flag_status_with_http_info(proj_key, env_key, key, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FeatureFlagsApi.get_feature_flag_status ...'
  end
  # verify the required parameter 'proj_key' is set
  if @api_client.config.client_side_validation && proj_key.nil?
    fail ArgumentError, "Missing the required parameter 'proj_key' when calling FeatureFlagsApi.get_feature_flag_status"
  end
  # verify the required parameter 'env_key' is set
  if @api_client.config.client_side_validation && env_key.nil?
    fail ArgumentError, "Missing the required parameter 'env_key' when calling FeatureFlagsApi.get_feature_flag_status"
  end
  # verify the required parameter 'key' is set
  if @api_client.config.client_side_validation && key.nil?
    fail ArgumentError, "Missing the required parameter 'key' when calling FeatureFlagsApi.get_feature_flag_status"
  end
  # resource path
  local_var_path = '/api/v2/flag-statuses/{projKey}/{envKey}/{key}'.sub('{' + 'projKey' + '}', CGI.escape(proj_key.to_s)).sub('{' + 'envKey' + '}', CGI.escape(env_key.to_s)).sub('{' + 'key' + '}', CGI.escape(key.to_s))

  # 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'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'FlagStatusRep'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKey']

  new_options = opts.merge(
    :operation => :"FeatureFlagsApi.get_feature_flag_status",
    :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: FeatureFlagsApi#get_feature_flag_status\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_feature_flag_statuses(proj_key, env_key, opts = {}) click to toggle source

List feature flag statuses Get a list of statuses for all feature flags. The status includes the last time the feature flag was requested, as well as a state, which is one of the following: - `new`: the feature flag was created within the last seven days, and has not been requested yet - `active`: the feature flag was requested by your servers or clients within the last seven days - `inactive`: the feature flag was created more than seven days ago, and hasn't been requested by your servers or clients within the past seven days - `launched`: one variation of the feature flag has been rolled out to all your users for at least 7 days @param proj_key [String] The project key @param env_key [String] Filter configurations by environment @param [Hash] opts the optional parameters @return [FeatureFlagStatuses]

# File lib/launchdarkly_api/api/feature_flags_api.rb, line 466
def get_feature_flag_statuses(proj_key, env_key, opts = {})
  data, _status_code, _headers = get_feature_flag_statuses_with_http_info(proj_key, env_key, opts)
  data
end
get_feature_flag_statuses_with_http_info(proj_key, env_key, opts = {}) click to toggle source

List feature flag statuses Get a list of statuses for all feature flags. The status includes the last time the feature flag was requested, as well as a state, which is one of the following: - &#x60;new&#x60;: the feature flag was created within the last seven days, and has not been requested yet - &#x60;active&#x60;: the feature flag was requested by your servers or clients within the last seven days - &#x60;inactive&#x60;: the feature flag was created more than seven days ago, and hasn&#39;t been requested by your servers or clients within the past seven days - &#x60;launched&#x60;: one variation of the feature flag has been rolled out to all your users for at least 7 days @param proj_key [String] The project key @param env_key [String] Filter configurations by environment @param [Hash] opts the optional parameters @return [Array<(FeatureFlagStatuses, Integer, Hash)>] FeatureFlagStatuses data, response status code and response headers

# File lib/launchdarkly_api/api/feature_flags_api.rb, line 477
def get_feature_flag_statuses_with_http_info(proj_key, env_key, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FeatureFlagsApi.get_feature_flag_statuses ...'
  end
  # verify the required parameter 'proj_key' is set
  if @api_client.config.client_side_validation && proj_key.nil?
    fail ArgumentError, "Missing the required parameter 'proj_key' when calling FeatureFlagsApi.get_feature_flag_statuses"
  end
  # verify the required parameter 'env_key' is set
  if @api_client.config.client_side_validation && env_key.nil?
    fail ArgumentError, "Missing the required parameter 'env_key' when calling FeatureFlagsApi.get_feature_flag_statuses"
  end
  # resource path
  local_var_path = '/api/v2/flag-statuses/{projKey}/{envKey}'.sub('{' + 'projKey' + '}', CGI.escape(proj_key.to_s)).sub('{' + 'envKey' + '}', CGI.escape(env_key.to_s))

  # 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'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'FeatureFlagStatuses'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKey']

  new_options = opts.merge(
    :operation => :"FeatureFlagsApi.get_feature_flag_statuses",
    :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: FeatureFlagsApi#get_feature_flag_statuses\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_feature_flag_with_http_info(proj_key, key, opts = {}) click to toggle source

Get feature flag Get a single feature flag by key. By default, this returns the configurations for all environments. You can filter environments with the &#x60;env&#x60; query parameter. For example, setting &#x60;env&#x3D;production&#x60; restricts the returned configurations to just the &#x60;production&#x60; environment. @param proj_key [String] The project key @param key [String] The feature flag key @param [Hash] opts the optional parameters @option opts [String] :env Filter configurations by environment @return [Array<(FeatureFlag, Integer, Hash)>] FeatureFlag data, response status code and response headers

# File lib/launchdarkly_api/api/feature_flags_api.rb, line 260
def get_feature_flag_with_http_info(proj_key, key, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FeatureFlagsApi.get_feature_flag ...'
  end
  # verify the required parameter 'proj_key' is set
  if @api_client.config.client_side_validation && proj_key.nil?
    fail ArgumentError, "Missing the required parameter 'proj_key' when calling FeatureFlagsApi.get_feature_flag"
  end
  # verify the required parameter 'key' is set
  if @api_client.config.client_side_validation && key.nil?
    fail ArgumentError, "Missing the required parameter 'key' when calling FeatureFlagsApi.get_feature_flag"
  end
  # resource path
  local_var_path = '/api/v2/flags/{projKey}/{key}'.sub('{' + 'projKey' + '}', CGI.escape(proj_key.to_s)).sub('{' + 'key' + '}', CGI.escape(key.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'env'] = opts[:'env'] if !opts[:'env'].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] || 'FeatureFlag'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKey']

  new_options = opts.merge(
    :operation => :"FeatureFlagsApi.get_feature_flag",
    :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: FeatureFlagsApi#get_feature_flag\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_feature_flags(proj_key, opts = {}) click to toggle source

List feature flags Get a list of all features in the given project. By default, each feature includes configurations for each environment. You can filter environments with the env query parameter. For example, setting `env=production` restricts the returned configurations to just your production environment. You can also filter feature flags by tag with the tag query parameter. We support the following fields for filters: - `query` is a string that matches against the flags' keys and names. It is not case sensitive. - `archived` is a boolean to filter the list to archived flags. When this is absent, only unarchived flags are returned. - `type` is a string allowing filtering to `temporary` or `permanent` flags. - `status` is a string allowing filtering to `new`, `inactive`, `active`, or `launched` flags in the specified environment. This filter also requires a `filterEnv` field to be set to a valid environment. For example: `filter=status:active,filterEnv:production`. - `tags` is a + separated list of tags. It filters the list to members who have all of the tags in the list. - `hasExperiment` is a boolean with values of true or false and returns any flags that have an attached metric. - `hasDataExport` is a boolean with values of true or false and returns any flags that are currently exporting data in the specified environment. This includes flags that are exporting data via Experimentation. This filter also requires a `filterEnv` field to be set to a valid environment key. e.g. `filter=hasExperiment:true,filterEnv:production` - `evaluated` is an object that contains a key of `after` and a value in Unix time in milliseconds. This returns all flags that have been evaluated since the time you specify in the environment provided. This filter also requires a `filterEnv` field to be set to a valid environment. For example: `filter=evaluated:{"after": 1590768455282},filterEnv:production`. - `filterEnv` is a string with the key of a valid environment. The filterEnv field is used for filters that are environment specific. If there are multiple environment specific filters you should only declare this parameter once. For example: `filter=evaluated:{"after": 1590768455282},filterEnv:production,status:active`. An example filter is `query:abc,tags:foo+bar`. This matches flags with the string `abc` in their key or name, ignoring case, which also have the tags `foo` and `bar`. By default, this returns all flags. You can page through the list with the `limit` parameter and by following the `first`, `prev`, `next`, and `last` links in the returned `_links` field. These links will not be present if the pages they refer to don't exist. For example, the `first` and `prev` links will be missing from the response on the first page. @param proj_key [String] The project key @param [Hash] opts the optional parameters @option opts [String] :env Filter configurations by environment @option opts [String] :tag Filter feature flags by tag @option opts [Integer] :limit The number of feature flags to return. Defaults to -1, which returns all flags @option opts [Integer] :offset Where to start in the list. Use this with pagination. For example, an offset of 10 skips the first ten items and then returns the next limit items @option opts [String] :query A string that matches against the flags&#39; keys and names. It is not case sensitive @option opts [Boolean] :archived A boolean to filter the list to archived flags. When this is absent, only unarchived flags will be returned @option opts [Boolean] :summary By default in API version &gt;&#x3D; 1, flags will not include their list of prerequisites, targets or rules. Set summary&#x3D;0 to include these fields for each flag returned @option opts [String] :filter A comma-separated list of filters. Each filter is of the form field:value @option opts [String] :sort A comma-separated list of fields to sort by. Fields prefixed by a dash ( - ) sort in descending order @return [FeatureFlags]

# File lib/launchdarkly_api/api/feature_flags_api.rb, line 543
def get_feature_flags(proj_key, opts = {})
  data, _status_code, _headers = get_feature_flags_with_http_info(proj_key, opts)
  data
end
get_feature_flags_with_http_info(proj_key, opts = {}) click to toggle source

List feature flags Get a list of all features in the given project. By default, each feature includes configurations for each environment. You can filter environments with the env query parameter. For example, setting &#x60;env&#x3D;production&#x60; restricts the returned configurations to just your production environment. You can also filter feature flags by tag with the tag query parameter. We support the following fields for filters: - &#x60;query&#x60; is a string that matches against the flags&#39; keys and names. It is not case sensitive. - &#x60;archived&#x60; is a boolean to filter the list to archived flags. When this is absent, only unarchived flags are returned. - &#x60;type&#x60; is a string allowing filtering to &#x60;temporary&#x60; or &#x60;permanent&#x60; flags. - &#x60;status&#x60; is a string allowing filtering to &#x60;new&#x60;, &#x60;inactive&#x60;, &#x60;active&#x60;, or &#x60;launched&#x60; flags in the specified environment. This filter also requires a &#x60;filterEnv&#x60; field to be set to a valid environment. For example: &#x60;filter&#x3D;status:active,filterEnv:production&#x60;. - &#x60;tags&#x60; is a + separated list of tags. It filters the list to members who have all of the tags in the list. - &#x60;hasExperiment&#x60; is a boolean with values of true or false and returns any flags that have an attached metric. - &#x60;hasDataExport&#x60; is a boolean with values of true or false and returns any flags that are currently exporting data in the specified environment. This includes flags that are exporting data via Experimentation. This filter also requires a &#x60;filterEnv&#x60; field to be set to a valid environment key. e.g. &#x60;filter&#x3D;hasExperiment:true,filterEnv:production&#x60; - &#x60;evaluated&#x60; is an object that contains a key of &#x60;after&#x60; and a value in Unix time in milliseconds. This returns all flags that have been evaluated since the time you specify in the environment provided. This filter also requires a &#x60;filterEnv&#x60; field to be set to a valid environment. For example: &#x60;filter&#x3D;evaluated:{&quot;after&quot;: 1590768455282},filterEnv:production&#x60;. - &#x60;filterEnv&#x60; is a string with the key of a valid environment. The filterEnv field is used for filters that are environment specific. If there are multiple environment specific filters you should only declare this parameter once. For example: &#x60;filter&#x3D;evaluated:{&quot;after&quot;: 1590768455282},filterEnv:production,status:active&#x60;. An example filter is &#x60;query:abc,tags:foo+bar&#x60;. This matches flags with the string &#x60;abc&#x60; in their key or name, ignoring case, which also have the tags &#x60;foo&#x60; and &#x60;bar&#x60;. By default, this returns all flags. You can page through the list with the &#x60;limit&#x60; parameter and by following the &#x60;first&#x60;, &#x60;prev&#x60;, &#x60;next&#x60;, and &#x60;last&#x60; links in the returned &#x60;_links&#x60; field. These links will not be present if the pages they refer to don&#39;t exist. For example, the &#x60;first&#x60; and &#x60;prev&#x60; links will be missing from the response on the first page. @param proj_key [String] The project key @param [Hash] opts the optional parameters @option opts [String] :env Filter configurations by environment @option opts [String] :tag Filter feature flags by tag @option opts [Integer] :limit The number of feature flags to return. Defaults to -1, which returns all flags @option opts [Integer] :offset Where to start in the list. Use this with pagination. For example, an offset of 10 skips the first ten items and then returns the next limit items @option opts [String] :query A string that matches against the flags&#39; keys and names. It is not case sensitive @option opts [Boolean] :archived A boolean to filter the list to archived flags. When this is absent, only unarchived flags will be returned @option opts [Boolean] :summary By default in API version &gt;&#x3D; 1, flags will not include their list of prerequisites, targets or rules. Set summary&#x3D;0 to include these fields for each flag returned @option opts [String] :filter A comma-separated list of filters. Each filter is of the form field:value @option opts [String] :sort A comma-separated list of fields to sort by. Fields prefixed by a dash ( - ) sort in descending order @return [Array<(FeatureFlags, Integer, Hash)>] FeatureFlags data, response status code and response headers

# File lib/launchdarkly_api/api/feature_flags_api.rb, line 562
def get_feature_flags_with_http_info(proj_key, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FeatureFlagsApi.get_feature_flags ...'
  end
  # verify the required parameter 'proj_key' is set
  if @api_client.config.client_side_validation && proj_key.nil?
    fail ArgumentError, "Missing the required parameter 'proj_key' when calling FeatureFlagsApi.get_feature_flags"
  end
  # resource path
  local_var_path = '/api/v2/flags/{projKey}'.sub('{' + 'projKey' + '}', CGI.escape(proj_key.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'env'] = opts[:'env'] if !opts[:'env'].nil?
  query_params[:'tag'] = opts[:'tag'] if !opts[:'tag'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
  query_params[:'query'] = opts[:'query'] if !opts[:'query'].nil?
  query_params[:'archived'] = opts[:'archived'] if !opts[:'archived'].nil?
  query_params[:'summary'] = opts[:'summary'] if !opts[:'summary'].nil?
  query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?
  query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].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] || 'FeatureFlags'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKey']

  new_options = opts.merge(
    :operation => :"FeatureFlagsApi.get_feature_flags",
    :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: FeatureFlagsApi#get_feature_flags\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
patch_expiring_user_targets(proj_key, env_key, flag_key, patch_with_comment, opts = {}) click to toggle source

Update expiring user targets on feature flag Update the list of user targets on a feature flag that are scheduled for removal. @param proj_key [String] The project key. @param env_key [String] The environment key. @param flag_key [String] The feature flag key. @param patch_with_comment [PatchWithComment] @param [Hash] opts the optional parameters @return [ExpiringUserTargetPatchResponse]

# File lib/launchdarkly_api/api/feature_flags_api.rb, line 627
def patch_expiring_user_targets(proj_key, env_key, flag_key, patch_with_comment, opts = {})
  data, _status_code, _headers = patch_expiring_user_targets_with_http_info(proj_key, env_key, flag_key, patch_with_comment, opts)
  data
end
patch_expiring_user_targets_with_http_info(proj_key, env_key, flag_key, patch_with_comment, opts = {}) click to toggle source

Update expiring user targets on feature flag Update the list of user targets on a feature flag that are scheduled for removal. @param proj_key [String] The project key. @param env_key [String] The environment key. @param flag_key [String] The feature flag key. @param patch_with_comment [PatchWithComment] @param [Hash] opts the optional parameters @return [Array<(ExpiringUserTargetPatchResponse, Integer, Hash)>] ExpiringUserTargetPatchResponse data, response status code and response headers

# File lib/launchdarkly_api/api/feature_flags_api.rb, line 640
def patch_expiring_user_targets_with_http_info(proj_key, env_key, flag_key, patch_with_comment, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FeatureFlagsApi.patch_expiring_user_targets ...'
  end
  # verify the required parameter 'proj_key' is set
  if @api_client.config.client_side_validation && proj_key.nil?
    fail ArgumentError, "Missing the required parameter 'proj_key' when calling FeatureFlagsApi.patch_expiring_user_targets"
  end
  # verify the required parameter 'env_key' is set
  if @api_client.config.client_side_validation && env_key.nil?
    fail ArgumentError, "Missing the required parameter 'env_key' when calling FeatureFlagsApi.patch_expiring_user_targets"
  end
  # verify the required parameter 'flag_key' is set
  if @api_client.config.client_side_validation && flag_key.nil?
    fail ArgumentError, "Missing the required parameter 'flag_key' when calling FeatureFlagsApi.patch_expiring_user_targets"
  end
  # verify the required parameter 'patch_with_comment' is set
  if @api_client.config.client_side_validation && patch_with_comment.nil?
    fail ArgumentError, "Missing the required parameter 'patch_with_comment' when calling FeatureFlagsApi.patch_expiring_user_targets"
  end
  # resource path
  local_var_path = '/api/v2/flags/{projKey}/{flagKey}/expiring-user-targets/{envKey}'.sub('{' + 'projKey' + '}', CGI.escape(proj_key.to_s)).sub('{' + 'envKey' + '}', CGI.escape(env_key.to_s)).sub('{' + 'flagKey' + '}', CGI.escape(flag_key.to_s))

  # 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(patch_with_comment)

  # return_type
  return_type = opts[:debug_return_type] || 'ExpiringUserTargetPatchResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKey']

  new_options = opts.merge(
    :operation => :"FeatureFlagsApi.patch_expiring_user_targets",
    :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: FeatureFlagsApi#patch_expiring_user_targets\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
patch_feature_flag(proj_key, key, patch_with_comment, opts = {}) click to toggle source

Update feature flag Perform a partial update to a feature @param proj_key [String] The project key. @param key [String] The feature flag&#39;s key. The key identifies the flag in your code. @param patch_with_comment [PatchWithComment] @param [Hash] opts the optional parameters @return [FeatureFlag]

# File lib/launchdarkly_api/api/feature_flags_api.rb, line 709
def patch_feature_flag(proj_key, key, patch_with_comment, opts = {})
  data, _status_code, _headers = patch_feature_flag_with_http_info(proj_key, key, patch_with_comment, opts)
  data
end
patch_feature_flag_with_http_info(proj_key, key, patch_with_comment, opts = {}) click to toggle source

Update feature flag Perform a partial update to a feature @param proj_key [String] The project key. @param key [String] The feature flag&#39;s key. The key identifies the flag in your code. @param patch_with_comment [PatchWithComment] @param [Hash] opts the optional parameters @return [Array<(FeatureFlag, Integer, Hash)>] FeatureFlag data, response status code and response headers

# File lib/launchdarkly_api/api/feature_flags_api.rb, line 721
def patch_feature_flag_with_http_info(proj_key, key, patch_with_comment, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FeatureFlagsApi.patch_feature_flag ...'
  end
  # verify the required parameter 'proj_key' is set
  if @api_client.config.client_side_validation && proj_key.nil?
    fail ArgumentError, "Missing the required parameter 'proj_key' when calling FeatureFlagsApi.patch_feature_flag"
  end
  # verify the required parameter 'key' is set
  if @api_client.config.client_side_validation && key.nil?
    fail ArgumentError, "Missing the required parameter 'key' when calling FeatureFlagsApi.patch_feature_flag"
  end
  # verify the required parameter 'patch_with_comment' is set
  if @api_client.config.client_side_validation && patch_with_comment.nil?
    fail ArgumentError, "Missing the required parameter 'patch_with_comment' when calling FeatureFlagsApi.patch_feature_flag"
  end
  # resource path
  local_var_path = '/api/v2/flags/{projKey}/{key}'.sub('{' + 'projKey' + '}', CGI.escape(proj_key.to_s)).sub('{' + 'key' + '}', CGI.escape(key.to_s))

  # 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(patch_with_comment)

  # return_type
  return_type = opts[:debug_return_type] || 'FeatureFlag'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKey']

  new_options = opts.merge(
    :operation => :"FeatureFlagsApi.patch_feature_flag",
    :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: FeatureFlagsApi#patch_feature_flag\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
post_feature_flag(proj_key, feature_flag_body, opts = {}) click to toggle source

Create a feature flag Create a feature flag with the given name, key, and variations @param proj_key [String] The project key. @param feature_flag_body [FeatureFlagBody] @param [Hash] opts the optional parameters @option opts [String] :clone The key of the feature flag to be cloned. The key identifies the flag in your code. For example, setting &#x60;clone&#x3D;flagKey&#x60; copies the full targeting configuration for all environments, including &#x60;on/off&#x60; state, from the original flag to the new flag. @return [FeatureFlag]

# File lib/launchdarkly_api/api/feature_flags_api.rb, line 786
def post_feature_flag(proj_key, feature_flag_body, opts = {})
  data, _status_code, _headers = post_feature_flag_with_http_info(proj_key, feature_flag_body, opts)
  data
end
post_feature_flag_with_http_info(proj_key, feature_flag_body, opts = {}) click to toggle source

Create a feature flag Create a feature flag with the given name, key, and variations @param proj_key [String] The project key. @param feature_flag_body [FeatureFlagBody] @param [Hash] opts the optional parameters @option opts [String] :clone The key of the feature flag to be cloned. The key identifies the flag in your code. For example, setting &#x60;clone&#x3D;flagKey&#x60; copies the full targeting configuration for all environments, including &#x60;on/off&#x60; state, from the original flag to the new flag. @return [Array<(FeatureFlag, Integer, Hash)>] FeatureFlag data, response status code and response headers

# File lib/launchdarkly_api/api/feature_flags_api.rb, line 798
def post_feature_flag_with_http_info(proj_key, feature_flag_body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FeatureFlagsApi.post_feature_flag ...'
  end
  # verify the required parameter 'proj_key' is set
  if @api_client.config.client_side_validation && proj_key.nil?
    fail ArgumentError, "Missing the required parameter 'proj_key' when calling FeatureFlagsApi.post_feature_flag"
  end
  # verify the required parameter 'feature_flag_body' is set
  if @api_client.config.client_side_validation && feature_flag_body.nil?
    fail ArgumentError, "Missing the required parameter 'feature_flag_body' when calling FeatureFlagsApi.post_feature_flag"
  end
  # resource path
  local_var_path = '/api/v2/flags/{projKey}'.sub('{' + 'projKey' + '}', CGI.escape(proj_key.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'clone'] = opts[:'clone'] if !opts[:'clone'].nil?

  # 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(feature_flag_body)

  # return_type
  return_type = opts[:debug_return_type] || 'FeatureFlag'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKey']

  new_options = opts.merge(
    :operation => :"FeatureFlagsApi.post_feature_flag",
    :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: FeatureFlagsApi#post_feature_flag\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end