class LaunchDarklyApi::SegmentsApi

Attributes

api_client[RW]

Public Class Methods

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

Public Instance Methods

delete_segment(proj_key, env_key, key, opts = {}) click to toggle source

Delete segment Delete a user segment. @param proj_key [String] The project key. @param env_key [String] The environment key. @param key [String] The user segment key. @param [Hash] opts the optional parameters @return [nil]

# File lib/launchdarkly_api/api/segments_api.rb, line 29
def delete_segment(proj_key, env_key, key, opts = {})
  delete_segment_with_http_info(proj_key, env_key, key, opts)
  nil
end
delete_segment_with_http_info(proj_key, env_key, key, opts = {}) click to toggle source

Delete segment Delete a user segment. @param proj_key [String] The project key. @param env_key [String] The environment key. @param key [String] The user segment key. @param [Hash] opts the optional parameters @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers

# File lib/launchdarkly_api/api/segments_api.rb, line 41
def delete_segment_with_http_info(proj_key, env_key, key, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SegmentsApi.delete_segment ...'
  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 SegmentsApi.delete_segment"
  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 SegmentsApi.delete_segment"
  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 SegmentsApi.delete_segment"
  end
  # resource path
  local_var_path = '/api/v2/segments/{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] || {}

  # 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 => :"SegmentsApi.delete_segment",
    :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: SegmentsApi#delete_segment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_expiring_user_targets_for_segment(proj_key, env_key, segment_key, opts = {}) click to toggle source

Get expiring user targets for segment Get a list of a segment's user targets that are scheduled for removal @param proj_key [String] The project key. @param env_key [String] The environment key. @param segment_key [String] The segment key. @param [Hash] opts the optional parameters @return [ExpiringUserTargetGetResponse]

# File lib/launchdarkly_api/api/segments_api.rb, line 102
def get_expiring_user_targets_for_segment(proj_key, env_key, segment_key, opts = {})
  data, _status_code, _headers = get_expiring_user_targets_for_segment_with_http_info(proj_key, env_key, segment_key, opts)
  data
end
get_expiring_user_targets_for_segment_with_http_info(proj_key, env_key, segment_key, opts = {}) click to toggle source

Get expiring user targets for segment Get a list of a segment&#39;s user targets that are scheduled for removal @param proj_key [String] The project key. @param env_key [String] The environment key. @param segment_key [String] The segment 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/segments_api.rb, line 114
def get_expiring_user_targets_for_segment_with_http_info(proj_key, env_key, segment_key, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SegmentsApi.get_expiring_user_targets_for_segment ...'
  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 SegmentsApi.get_expiring_user_targets_for_segment"
  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 SegmentsApi.get_expiring_user_targets_for_segment"
  end
  # verify the required parameter 'segment_key' is set
  if @api_client.config.client_side_validation && segment_key.nil?
    fail ArgumentError, "Missing the required parameter 'segment_key' when calling SegmentsApi.get_expiring_user_targets_for_segment"
  end
  # resource path
  local_var_path = '/api/v2/segments/{projKey}/{segmentKey}/expiring-user-targets/{envKey}'.sub('{' + 'projKey' + '}', CGI.escape(proj_key.to_s)).sub('{' + 'envKey' + '}', CGI.escape(env_key.to_s)).sub('{' + 'segmentKey' + '}', CGI.escape(segment_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 => :"SegmentsApi.get_expiring_user_targets_for_segment",
    :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: SegmentsApi#get_expiring_user_targets_for_segment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_segment(proj_key, env_key, key, opts = {}) click to toggle source

Get segment Get a single user segment by key @param proj_key [String] The project key. @param env_key [String] The environment key. @param key [String] The segment key @param [Hash] opts the optional parameters @return [UserSegment]

# File lib/launchdarkly_api/api/segments_api.rb, line 177
def get_segment(proj_key, env_key, key, opts = {})
  data, _status_code, _headers = get_segment_with_http_info(proj_key, env_key, key, opts)
  data
end
get_segment_membership_for_user(proj_key, env_key, key, user_key, opts = {}) click to toggle source

Get Big Segment membership for user Returns the membership status (included/excluded) for a given user in this segment. Note this operation @param proj_key [String] The project key. @param env_key [String] The environment key. @param key [String] The segment key. @param user_key [String] The user key. @param [Hash] opts the optional parameters @return [BigSegmentTarget]

# File lib/launchdarkly_api/api/segments_api.rb, line 253
def get_segment_membership_for_user(proj_key, env_key, key, user_key, opts = {})
  data, _status_code, _headers = get_segment_membership_for_user_with_http_info(proj_key, env_key, key, user_key, opts)
  data
end
get_segment_membership_for_user_with_http_info(proj_key, env_key, key, user_key, opts = {}) click to toggle source

Get Big Segment membership for user Returns the membership status (included/excluded) for a given user in this segment. Note this operation @param proj_key [String] The project key. @param env_key [String] The environment key. @param key [String] The segment key. @param user_key [String] The user key. @param [Hash] opts the optional parameters @return [Array<(BigSegmentTarget, Integer, Hash)>] BigSegmentTarget data, response status code and response headers

# File lib/launchdarkly_api/api/segments_api.rb, line 266
def get_segment_membership_for_user_with_http_info(proj_key, env_key, key, user_key, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SegmentsApi.get_segment_membership_for_user ...'
  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 SegmentsApi.get_segment_membership_for_user"
  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 SegmentsApi.get_segment_membership_for_user"
  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 SegmentsApi.get_segment_membership_for_user"
  end
  # verify the required parameter 'user_key' is set
  if @api_client.config.client_side_validation && user_key.nil?
    fail ArgumentError, "Missing the required parameter 'user_key' when calling SegmentsApi.get_segment_membership_for_user"
  end
  # resource path
  local_var_path = '/api/v2/segments/{projKey}/{envKey}/{key}/users/{userKey}'.sub('{' + 'projKey' + '}', CGI.escape(proj_key.to_s)).sub('{' + 'envKey' + '}', CGI.escape(env_key.to_s)).sub('{' + 'key' + '}', CGI.escape(key.to_s)).sub('{' + 'userKey' + '}', CGI.escape(user_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] || 'BigSegmentTarget'

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

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

Get segment Get a single user segment by key @param proj_key [String] The project key. @param env_key [String] The environment key. @param key [String] The segment key @param [Hash] opts the optional parameters @return [Array<(UserSegment, Integer, Hash)>] UserSegment data, response status code and response headers

# File lib/launchdarkly_api/api/segments_api.rb, line 189
def get_segment_with_http_info(proj_key, env_key, key, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SegmentsApi.get_segment ...'
  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 SegmentsApi.get_segment"
  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 SegmentsApi.get_segment"
  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 SegmentsApi.get_segment"
  end
  # resource path
  local_var_path = '/api/v2/segments/{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] || 'UserSegment'

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

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

List segments Get a list of all user segments in the given project @param proj_key [String] The project key. @param env_key [String] The environment key. @param [Hash] opts the optional parameters @return [UserSegments]

# File lib/launchdarkly_api/api/segments_api.rb, line 332
def get_segments(proj_key, env_key, opts = {})
  data, _status_code, _headers = get_segments_with_http_info(proj_key, env_key, opts)
  data
end
get_segments_with_http_info(proj_key, env_key, opts = {}) click to toggle source

List segments Get a list of all user segments in the given project @param proj_key [String] The project key. @param env_key [String] The environment key. @param [Hash] opts the optional parameters @return [Array<(UserSegments, Integer, Hash)>] UserSegments data, response status code and response headers

# File lib/launchdarkly_api/api/segments_api.rb, line 343
def get_segments_with_http_info(proj_key, env_key, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SegmentsApi.get_segments ...'
  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 SegmentsApi.get_segments"
  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 SegmentsApi.get_segments"
  end
  # resource path
  local_var_path = '/api/v2/segments/{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] || 'UserSegments'

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

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

Update expiring user targets for segment Update the list of a segment's user targets that are scheduled for removal<br /><br />Requires a semantic patch representation of the desired changes to the resource. To learn more about semantic patches, read [Updates](/#section/Updates/Updates-via-semantic-patches).<br /><br />If the request is well-formed but any of its instructions failed to process, this operation returns status code `200`. In this case, the response `errors` array will be non-empty. @param proj_key [String] The project key. @param env_key [String] The environment key. @param segment_key [String] The user segment key. @param patch_segment_request [PatchSegmentRequest] @param [Hash] opts the optional parameters @return [ExpiringUserTargetPatchResponse]

# File lib/launchdarkly_api/api/segments_api.rb, line 403
def patch_expiring_user_targets_for_segment(proj_key, env_key, segment_key, patch_segment_request, opts = {})
  data, _status_code, _headers = patch_expiring_user_targets_for_segment_with_http_info(proj_key, env_key, segment_key, patch_segment_request, opts)
  data
end
patch_expiring_user_targets_for_segment_with_http_info(proj_key, env_key, segment_key, patch_segment_request, opts = {}) click to toggle source

Update expiring user targets for segment Update the list of a segment&#39;s user targets that are scheduled for removal&lt;br /&gt;&lt;br /&gt;Requires a semantic patch representation of the desired changes to the resource. To learn more about semantic patches, read [Updates](/#section/Updates/Updates-via-semantic-patches).&lt;br /&gt;&lt;br /&gt;If the request is well-formed but any of its instructions failed to process, this operation returns status code &#x60;200&#x60;. In this case, the response &#x60;errors&#x60; array will be non-empty. @param proj_key [String] The project key. @param env_key [String] The environment key. @param segment_key [String] The user segment key. @param patch_segment_request [PatchSegmentRequest] @param [Hash] opts the optional parameters @return [Array<(ExpiringUserTargetPatchResponse, Integer, Hash)>] ExpiringUserTargetPatchResponse data, response status code and response headers

# File lib/launchdarkly_api/api/segments_api.rb, line 416
def patch_expiring_user_targets_for_segment_with_http_info(proj_key, env_key, segment_key, patch_segment_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SegmentsApi.patch_expiring_user_targets_for_segment ...'
  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 SegmentsApi.patch_expiring_user_targets_for_segment"
  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 SegmentsApi.patch_expiring_user_targets_for_segment"
  end
  # verify the required parameter 'segment_key' is set
  if @api_client.config.client_side_validation && segment_key.nil?
    fail ArgumentError, "Missing the required parameter 'segment_key' when calling SegmentsApi.patch_expiring_user_targets_for_segment"
  end
  # verify the required parameter 'patch_segment_request' is set
  if @api_client.config.client_side_validation && patch_segment_request.nil?
    fail ArgumentError, "Missing the required parameter 'patch_segment_request' when calling SegmentsApi.patch_expiring_user_targets_for_segment"
  end
  # resource path
  local_var_path = '/api/v2/segments/{projKey}/{segmentKey}/expiring-user-targets/{envKey}'.sub('{' + 'projKey' + '}', CGI.escape(proj_key.to_s)).sub('{' + 'envKey' + '}', CGI.escape(env_key.to_s)).sub('{' + 'segmentKey' + '}', CGI.escape(segment_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_segment_request)

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

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

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

Patch segment Update a user segment. The request body must be a valid JSON patch or JSON merge patch document. To learn more about semantic patches, read [Updates](/#section/Updates). @param proj_key [String] The project key. @param env_key [String] The environment key. @param key [String] The user segment key. @param patch_with_comment [PatchWithComment] @param [Hash] opts the optional parameters @return [UserSegment]

# File lib/launchdarkly_api/api/segments_api.rb, line 486
def patch_segment(proj_key, env_key, key, patch_with_comment, opts = {})
  data, _status_code, _headers = patch_segment_with_http_info(proj_key, env_key, key, patch_with_comment, opts)
  data
end
patch_segment_with_http_info(proj_key, env_key, key, patch_with_comment, opts = {}) click to toggle source

Patch segment Update a user segment. The request body must be a valid JSON patch or JSON merge patch document. To learn more about semantic patches, read [Updates](/#section/Updates). @param proj_key [String] The project key. @param env_key [String] The environment key. @param key [String] The user segment key. @param patch_with_comment [PatchWithComment] @param [Hash] opts the optional parameters @return [Array<(UserSegment, Integer, Hash)>] UserSegment data, response status code and response headers

# File lib/launchdarkly_api/api/segments_api.rb, line 499
def patch_segment_with_http_info(proj_key, env_key, key, patch_with_comment, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SegmentsApi.patch_segment ...'
  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 SegmentsApi.patch_segment"
  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 SegmentsApi.patch_segment"
  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 SegmentsApi.patch_segment"
  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 SegmentsApi.patch_segment"
  end
  # resource path
  local_var_path = '/api/v2/segments/{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'])
  # 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] || 'UserSegment'

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

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

Create segment Create a new user segment @param proj_key [String] The project key. @param env_key [String] The environment key. @param segment_body [SegmentBody] @param [Hash] opts the optional parameters @return [UserSegment]

# File lib/launchdarkly_api/api/segments_api.rb, line 568
def post_segment(proj_key, env_key, segment_body, opts = {})
  data, _status_code, _headers = post_segment_with_http_info(proj_key, env_key, segment_body, opts)
  data
end
post_segment_with_http_info(proj_key, env_key, segment_body, opts = {}) click to toggle source

Create segment Create a new user segment @param proj_key [String] The project key. @param env_key [String] The environment key. @param segment_body [SegmentBody] @param [Hash] opts the optional parameters @return [Array<(UserSegment, Integer, Hash)>] UserSegment data, response status code and response headers

# File lib/launchdarkly_api/api/segments_api.rb, line 580
def post_segment_with_http_info(proj_key, env_key, segment_body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SegmentsApi.post_segment ...'
  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 SegmentsApi.post_segment"
  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 SegmentsApi.post_segment"
  end
  # verify the required parameter 'segment_body' is set
  if @api_client.config.client_side_validation && segment_body.nil?
    fail ArgumentError, "Missing the required parameter 'segment_body' when calling SegmentsApi.post_segment"
  end
  # resource path
  local_var_path = '/api/v2/segments/{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'])
  # 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(segment_body)

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

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

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

Update targets on a Big Segment Update targets included or excluded in a Big Segment @param proj_key [String] The project key. @param env_key [String] The environment key. @param key [String] The segment key. @param segment_user_state [SegmentUserState] @param [Hash] opts the optional parameters @return [nil]

# File lib/launchdarkly_api/api/segments_api.rb, line 646
def update_big_segment_targets(proj_key, env_key, key, segment_user_state, opts = {})
  update_big_segment_targets_with_http_info(proj_key, env_key, key, segment_user_state, opts)
  nil
end
update_big_segment_targets_with_http_info(proj_key, env_key, key, segment_user_state, opts = {}) click to toggle source

Update targets on a Big Segment Update targets included or excluded in a Big Segment @param proj_key [String] The project key. @param env_key [String] The environment key. @param key [String] The segment key. @param segment_user_state [SegmentUserState] @param [Hash] opts the optional parameters @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers

# File lib/launchdarkly_api/api/segments_api.rb, line 659
def update_big_segment_targets_with_http_info(proj_key, env_key, key, segment_user_state, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SegmentsApi.update_big_segment_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 SegmentsApi.update_big_segment_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 SegmentsApi.update_big_segment_targets"
  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 SegmentsApi.update_big_segment_targets"
  end
  # verify the required parameter 'segment_user_state' is set
  if @api_client.config.client_side_validation && segment_user_state.nil?
    fail ArgumentError, "Missing the required parameter 'segment_user_state' when calling SegmentsApi.update_big_segment_targets"
  end
  # resource path
  local_var_path = '/api/v2/segments/{projKey}/{envKey}/{key}/users'.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 '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(segment_user_state)

  # return_type
  return_type = opts[:debug_return_type]

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

  new_options = opts.merge(
    :operation => :"SegmentsApi.update_big_segment_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(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: SegmentsApi#update_big_segment_targets\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end