Class: LaunchDarklyApi::SegmentsApi
- Inherits:
-
Object
- Object
- LaunchDarklyApi::SegmentsApi
- Defined in:
- lib/launchdarkly_api/api/segments_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#delete_segment(project_key, environment_key, segment_key, opts = {}) ⇒ nil
Delete segment Delete a segment.
-
#delete_segment_with_http_info(project_key, environment_key, segment_key, opts = {}) ⇒ Array<(nil, Integer, Hash)>
Delete segment Delete a segment.
-
#get_context_instance_segments_membership_by_env(project_key, environment_key, request_body, opts = {}) ⇒ ContextInstanceSegmentMemberships
List segment memberships for context instance For a given context instance with attributes, get membership details for all segments.
-
#get_context_instance_segments_membership_by_env_with_http_info(project_key, environment_key, request_body, opts = {}) ⇒ Array<(ContextInstanceSegmentMemberships, Integer, Hash)>
List segment memberships for context instance For a given context instance with attributes, get membership details for all segments.
-
#get_expiring_targets_for_segment(project_key, environment_key, segment_key, opts = {}) ⇒ ExpiringTargetGetResponse
Get expiring targets for segment Get a list of a segment’s context targets that are scheduled for removal.
-
#get_expiring_targets_for_segment_with_http_info(project_key, environment_key, segment_key, opts = {}) ⇒ Array<(ExpiringTargetGetResponse, Integer, Hash)>
Get expiring targets for segment Get a list of a segment's context targets that are scheduled for removal.
-
#get_expiring_user_targets_for_segment(project_key, environment_key, segment_key, opts = {}) ⇒ ExpiringUserTargetGetResponse
Get expiring user targets for segment > ### Contexts are now available > > After you have upgraded your LaunchDarkly SDK to use contexts instead of users, you should use [Get expiring targets for segment](/tag/Segments#operation/getExpiringTargetsForSegment) instead of this endpoint.
-
#get_expiring_user_targets_for_segment_with_http_info(project_key, environment_key, segment_key, opts = {}) ⇒ Array<(ExpiringUserTargetGetResponse, Integer, Hash)>
Get expiring user targets for segment > ### Contexts are now available > > After you have upgraded your LaunchDarkly SDK to use contexts instead of users, you should use [Get expiring targets for segment](/tag/Segments#operation/getExpiringTargetsForSegment) instead of this endpoint.
-
#get_segment(project_key, environment_key, segment_key, opts = {}) ⇒ UserSegment
Get segment Get a single segment by key.<br/><br/>Segments can be rule-based, list-based, or synced.
-
#get_segment_membership_for_context(project_key, environment_key, segment_key, context_key, opts = {}) ⇒ BigSegmentTarget
Get big segment membership for context Get the membership status (included/excluded) for a given context in this big segment.
-
#get_segment_membership_for_context_with_http_info(project_key, environment_key, segment_key, context_key, opts = {}) ⇒ Array<(BigSegmentTarget, Integer, Hash)>
Get big segment membership for context Get the membership status (included/excluded) for a given context in this big segment.
-
#get_segment_membership_for_user(project_key, environment_key, segment_key, user_key, opts = {}) ⇒ BigSegmentTarget
Get big segment membership for user > ### Contexts are now available > > After you have upgraded your LaunchDarkly SDK to use contexts instead of users, you should use [Get expiring targets for segment](/tag/Segments#operation/getExpiringTargetsForSegment) instead of this endpoint.
-
#get_segment_membership_for_user_with_http_info(project_key, environment_key, segment_key, user_key, opts = {}) ⇒ Array<(BigSegmentTarget, Integer, Hash)>
Get big segment membership for user > ### Contexts are now available > > After you have upgraded your LaunchDarkly SDK to use contexts instead of users, you should use [Get expiring targets for segment](/tag/Segments#operation/getExpiringTargetsForSegment) instead of this endpoint.
-
#get_segment_with_http_info(project_key, environment_key, segment_key, opts = {}) ⇒ Array<(UserSegment, Integer, Hash)>
Get segment Get a single segment by key.<br/><br/>Segments can be rule-based, list-based, or synced.
-
#get_segments(project_key, environment_key, opts = {}) ⇒ UserSegments
List segments Get a list of all segments in the given project.
-
#get_segments_with_http_info(project_key, environment_key, opts = {}) ⇒ Array<(UserSegments, Integer, Hash)>
List segments Get a list of all segments in the given project.
-
#initialize(api_client = ApiClient.default) ⇒ SegmentsApi
constructor
A new instance of SegmentsApi.
-
#patch_expiring_targets_for_segment(project_key, environment_key, segment_key, patch_segment_expiring_target_input_rep, opts = {}) ⇒ ExpiringTargetPatchResponse
Update expiring targets for segment Update expiring context targets for a segment.
-
#patch_expiring_targets_for_segment_with_http_info(project_key, environment_key, segment_key, patch_segment_expiring_target_input_rep, opts = {}) ⇒ Array<(ExpiringTargetPatchResponse, Integer, Hash)>
Update expiring targets for segment Update expiring context targets for a segment.
-
#patch_expiring_user_targets_for_segment(project_key, environment_key, segment_key, patch_segment_request, opts = {}) ⇒ ExpiringUserTargetPatchResponse
Update expiring user targets for segment > ### Contexts are now available > > After you have upgraded your LaunchDarkly SDK to use contexts instead of users, you should use [Update expiring targets for segment](/tag/Segments#operation/patchExpiringTargetsForSegment) instead of this endpoint.
-
#patch_expiring_user_targets_for_segment_with_http_info(project_key, environment_key, segment_key, patch_segment_request, opts = {}) ⇒ Array<(ExpiringUserTargetPatchResponse, Integer, Hash)>
Update expiring user targets for segment > ### Contexts are now available > > After you have upgraded your LaunchDarkly SDK to use contexts instead of users, you should use [Update expiring targets for segment](/tag/Segments#operation/patchExpiringTargetsForSegment) instead of this endpoint.
-
#patch_segment(project_key, environment_key, segment_key, patch_with_comment, opts = {}) ⇒ UserSegment
Patch segment Update a segment.
-
#patch_segment_with_http_info(project_key, environment_key, segment_key, patch_with_comment, opts = {}) ⇒ Array<(UserSegment, Integer, Hash)>
Patch segment Update a segment.
-
#post_segment(project_key, environment_key, segment_body, opts = {}) ⇒ UserSegment
Create segment Create a new segment.
-
#post_segment_with_http_info(project_key, environment_key, segment_body, opts = {}) ⇒ Array<(UserSegment, Integer, Hash)>
Create segment Create a new segment.
-
#update_big_segment_context_targets(project_key, environment_key, segment_key, segment_user_state, opts = {}) ⇒ nil
Update context targets on a big segment Update context targets included or excluded in a big segment.
-
#update_big_segment_context_targets_with_http_info(project_key, environment_key, segment_key, segment_user_state, opts = {}) ⇒ Array<(nil, Integer, Hash)>
Update context targets on a big segment Update context targets included or excluded in a big segment.
-
#update_big_segment_targets(project_key, environment_key, segment_key, segment_user_state, opts = {}) ⇒ nil
Update user context targets on a big segment Update user context targets included or excluded in a big segment.
-
#update_big_segment_targets_with_http_info(project_key, environment_key, segment_key, segment_user_state, opts = {}) ⇒ Array<(nil, Integer, Hash)>
Update user context targets on a big segment Update user context targets included or excluded in a big segment.
Constructor Details
#initialize(api_client = ApiClient.default) ⇒ SegmentsApi
Returns a new instance of SegmentsApi.
19 20 21 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 19 def initialize(api_client = ApiClient.default) @api_client = api_client end |
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
17 18 19 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 17 def api_client @api_client end |
Instance Method Details
#delete_segment(project_key, environment_key, segment_key, opts = {}) ⇒ nil
Delete segment Delete a segment.
29 30 31 32 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 29 def delete_segment(project_key, environment_key, segment_key, opts = {}) delete_segment_with_http_info(project_key, environment_key, segment_key, opts) nil end |
#delete_segment_with_http_info(project_key, environment_key, segment_key, opts = {}) ⇒ Array<(nil, Integer, Hash)>
Delete segment Delete a segment.
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 41 def delete_segment_with_http_info(project_key, environment_key, segment_key, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: SegmentsApi.delete_segment ...' end # verify the required parameter 'project_key' is set if @api_client.config.client_side_validation && project_key.nil? fail ArgumentError, "Missing the required parameter 'project_key' when calling SegmentsApi.delete_segment" end # verify the required parameter 'environment_key' is set if @api_client.config.client_side_validation && environment_key.nil? fail ArgumentError, "Missing the required parameter 'environment_key' when calling SegmentsApi.delete_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.delete_segment" end # resource path local_var_path = '/api/v2/segments/{projectKey}/{environmentKey}/{segmentKey}'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.to_s)).sub('{' + 'environmentKey' + '}', CGI.escape(environment_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] # auth_names auth_names = opts[:debug_auth_names] || ['ApiKey'] = 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, ) 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_context_instance_segments_membership_by_env(project_key, environment_key, request_body, opts = {}) ⇒ ContextInstanceSegmentMemberships
List segment memberships for context instance For a given context instance with attributes, get membership details for all segments. In the request body, pass in the context instance.
104 105 106 107 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 104 def get_context_instance_segments_membership_by_env(project_key, environment_key, request_body, opts = {}) data, _status_code, _headers = get_context_instance_segments_membership_by_env_with_http_info(project_key, environment_key, request_body, opts) data end |
#get_context_instance_segments_membership_by_env_with_http_info(project_key, environment_key, request_body, opts = {}) ⇒ Array<(ContextInstanceSegmentMemberships, Integer, Hash)>
List segment memberships for context instance For a given context instance with attributes, get membership details for all segments. In the request body, pass in the context instance.
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 116 def get_context_instance_segments_membership_by_env_with_http_info(project_key, environment_key, request_body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: SegmentsApi.get_context_instance_segments_membership_by_env ...' end # verify the required parameter 'project_key' is set if @api_client.config.client_side_validation && project_key.nil? fail ArgumentError, "Missing the required parameter 'project_key' when calling SegmentsApi.get_context_instance_segments_membership_by_env" end # verify the required parameter 'environment_key' is set if @api_client.config.client_side_validation && environment_key.nil? fail ArgumentError, "Missing the required parameter 'environment_key' when calling SegmentsApi.get_context_instance_segments_membership_by_env" end # verify the required parameter 'request_body' is set if @api_client.config.client_side_validation && request_body.nil? fail ArgumentError, "Missing the required parameter 'request_body' when calling SegmentsApi.get_context_instance_segments_membership_by_env" end # resource path local_var_path = '/api/v2/projects/{projectKey}/environments/{environmentKey}/segments/evaluate'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.to_s)).sub('{' + 'environmentKey' + '}', CGI.escape(environment_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' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(request_body) # return_type return_type = opts[:debug_return_type] || 'ContextInstanceSegmentMemberships' # auth_names auth_names = opts[:debug_auth_names] || ['ApiKey'] = opts.merge( :operation => :"SegmentsApi.get_context_instance_segments_membership_by_env", :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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: SegmentsApi#get_context_instance_segments_membership_by_env\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_expiring_targets_for_segment(project_key, environment_key, segment_key, opts = {}) ⇒ ExpiringTargetGetResponse
Get expiring targets for segment Get a list of a segment’s context targets that are scheduled for removal.
184 185 186 187 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 184 def get_expiring_targets_for_segment(project_key, environment_key, segment_key, opts = {}) data, _status_code, _headers = get_expiring_targets_for_segment_with_http_info(project_key, environment_key, segment_key, opts) data end |
#get_expiring_targets_for_segment_with_http_info(project_key, environment_key, segment_key, opts = {}) ⇒ Array<(ExpiringTargetGetResponse, Integer, Hash)>
Get expiring targets for segment Get a list of a segment's context targets that are scheduled for removal.
196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 196 def get_expiring_targets_for_segment_with_http_info(project_key, environment_key, segment_key, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: SegmentsApi.get_expiring_targets_for_segment ...' end # verify the required parameter 'project_key' is set if @api_client.config.client_side_validation && project_key.nil? fail ArgumentError, "Missing the required parameter 'project_key' when calling SegmentsApi.get_expiring_targets_for_segment" end # verify the required parameter 'environment_key' is set if @api_client.config.client_side_validation && environment_key.nil? fail ArgumentError, "Missing the required parameter 'environment_key' when calling SegmentsApi.get_expiring_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_targets_for_segment" end # resource path local_var_path = '/api/v2/segments/{projectKey}/{segmentKey}/expiring-targets/{environmentKey}'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.to_s)).sub('{' + 'environmentKey' + '}', CGI.escape(environment_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] || 'ExpiringTargetGetResponse' # auth_names auth_names = opts[:debug_auth_names] || ['ApiKey'] = opts.merge( :operation => :"SegmentsApi.get_expiring_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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: SegmentsApi#get_expiring_targets_for_segment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_expiring_user_targets_for_segment(project_key, environment_key, segment_key, opts = {}) ⇒ ExpiringUserTargetGetResponse
Get expiring user targets for segment > ### Contexts are now available > > After you have upgraded your LaunchDarkly SDK to use contexts instead of users, you should use [Get expiring targets for segment](/tag/Segments#operation/getExpiringTargetsForSegment) instead of this endpoint. To learn more, read [Contexts](docs.launchdarkly.com/home/observability/contexts). Get a list of a segment’s user targets that are scheduled for removal.
259 260 261 262 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 259 def get_expiring_user_targets_for_segment(project_key, environment_key, segment_key, opts = {}) data, _status_code, _headers = get_expiring_user_targets_for_segment_with_http_info(project_key, environment_key, segment_key, opts) data end |
#get_expiring_user_targets_for_segment_with_http_info(project_key, environment_key, segment_key, opts = {}) ⇒ Array<(ExpiringUserTargetGetResponse, Integer, Hash)>
Get expiring user targets for segment > ### Contexts are now available > > After you have upgraded your LaunchDarkly SDK to use contexts instead of users, you should use [Get expiring targets for segment](/tag/Segments#operation/getExpiringTargetsForSegment) instead of this endpoint. To learn more, read [Contexts](docs.launchdarkly.com/home/observability/contexts). Get a list of a segment's user targets that are scheduled for removal.
271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 271 def get_expiring_user_targets_for_segment_with_http_info(project_key, environment_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 'project_key' is set if @api_client.config.client_side_validation && project_key.nil? fail ArgumentError, "Missing the required parameter 'project_key' when calling SegmentsApi.get_expiring_user_targets_for_segment" end # verify the required parameter 'environment_key' is set if @api_client.config.client_side_validation && environment_key.nil? fail ArgumentError, "Missing the required parameter 'environment_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/{projectKey}/{segmentKey}/expiring-user-targets/{environmentKey}'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.to_s)).sub('{' + 'environmentKey' + '}', CGI.escape(environment_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'] = 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, ) 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(project_key, environment_key, segment_key, opts = {}) ⇒ UserSegment
Get segment Get a single segment by key.<br/><br/>Segments can be rule-based, list-based, or synced. Big segments include larger list-based segments and synced segments. Some fields in the response only apply to big segments.
334 335 336 337 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 334 def get_segment(project_key, environment_key, segment_key, opts = {}) data, _status_code, _headers = get_segment_with_http_info(project_key, environment_key, segment_key, opts) data end |
#get_segment_membership_for_context(project_key, environment_key, segment_key, context_key, opts = {}) ⇒ BigSegmentTarget
Get big segment membership for context Get the membership status (included/excluded) for a given context in this big segment. Big segments include larger list-based segments and synced segments. This operation does not support standard segments.
410 411 412 413 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 410 def get_segment_membership_for_context(project_key, environment_key, segment_key, context_key, opts = {}) data, _status_code, _headers = get_segment_membership_for_context_with_http_info(project_key, environment_key, segment_key, context_key, opts) data end |
#get_segment_membership_for_context_with_http_info(project_key, environment_key, segment_key, context_key, opts = {}) ⇒ Array<(BigSegmentTarget, Integer, Hash)>
Get big segment membership for context Get the membership status (included/excluded) for a given context in this big segment. Big segments include larger list-based segments and synced segments. This operation does not support standard segments.
423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 423 def get_segment_membership_for_context_with_http_info(project_key, environment_key, segment_key, context_key, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: SegmentsApi.get_segment_membership_for_context ...' end # verify the required parameter 'project_key' is set if @api_client.config.client_side_validation && project_key.nil? fail ArgumentError, "Missing the required parameter 'project_key' when calling SegmentsApi.get_segment_membership_for_context" end # verify the required parameter 'environment_key' is set if @api_client.config.client_side_validation && environment_key.nil? fail ArgumentError, "Missing the required parameter 'environment_key' when calling SegmentsApi.get_segment_membership_for_context" 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_segment_membership_for_context" end # verify the required parameter 'context_key' is set if @api_client.config.client_side_validation && context_key.nil? fail ArgumentError, "Missing the required parameter 'context_key' when calling SegmentsApi.get_segment_membership_for_context" end # resource path local_var_path = '/api/v2/segments/{projectKey}/{environmentKey}/{segmentKey}/contexts/{contextKey}'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.to_s)).sub('{' + 'environmentKey' + '}', CGI.escape(environment_key.to_s)).sub('{' + 'segmentKey' + '}', CGI.escape(segment_key.to_s)).sub('{' + 'contextKey' + '}', CGI.escape(context_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'] = opts.merge( :operation => :"SegmentsApi.get_segment_membership_for_context", :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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: SegmentsApi#get_segment_membership_for_context\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_segment_membership_for_user(project_key, environment_key, segment_key, user_key, opts = {}) ⇒ BigSegmentTarget
Get big segment membership for user > ### Contexts are now available > > After you have upgraded your LaunchDarkly SDK to use contexts instead of users, you should use [Get expiring targets for segment](/tag/Segments#operation/getExpiringTargetsForSegment) instead of this endpoint. To learn more, read [Contexts](docs.launchdarkly.com/home/observability/contexts). Get the membership status (included/excluded) for a given user in this big segment. This operation does not support standard segments.
491 492 493 494 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 491 def get_segment_membership_for_user(project_key, environment_key, segment_key, user_key, opts = {}) data, _status_code, _headers = get_segment_membership_for_user_with_http_info(project_key, environment_key, segment_key, user_key, opts) data end |
#get_segment_membership_for_user_with_http_info(project_key, environment_key, segment_key, user_key, opts = {}) ⇒ Array<(BigSegmentTarget, Integer, Hash)>
Get big segment membership for user > ### Contexts are now available > > After you have upgraded your LaunchDarkly SDK to use contexts instead of users, you should use [Get expiring targets for segment](/tag/Segments#operation/getExpiringTargetsForSegment) instead of this endpoint. To learn more, read [Contexts](docs.launchdarkly.com/home/observability/contexts). Get the membership status (included/excluded) for a given user in this big segment. This operation does not support standard segments.
504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 504 def get_segment_membership_for_user_with_http_info(project_key, environment_key, segment_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 'project_key' is set if @api_client.config.client_side_validation && project_key.nil? fail ArgumentError, "Missing the required parameter 'project_key' when calling SegmentsApi.get_segment_membership_for_user" end # verify the required parameter 'environment_key' is set if @api_client.config.client_side_validation && environment_key.nil? fail ArgumentError, "Missing the required parameter 'environment_key' when calling SegmentsApi.get_segment_membership_for_user" 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_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/{projectKey}/{environmentKey}/{segmentKey}/users/{userKey}'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.to_s)).sub('{' + 'environmentKey' + '}', CGI.escape(environment_key.to_s)).sub('{' + 'segmentKey' + '}', CGI.escape(segment_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'] = 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, ) 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(project_key, environment_key, segment_key, opts = {}) ⇒ Array<(UserSegment, Integer, Hash)>
Get segment Get a single segment by key.<br/><br/>Segments can be rule-based, list-based, or synced. Big segments include larger list-based segments and synced segments. Some fields in the response only apply to big segments.
346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 346 def get_segment_with_http_info(project_key, environment_key, segment_key, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: SegmentsApi.get_segment ...' end # verify the required parameter 'project_key' is set if @api_client.config.client_side_validation && project_key.nil? fail ArgumentError, "Missing the required parameter 'project_key' when calling SegmentsApi.get_segment" end # verify the required parameter 'environment_key' is set if @api_client.config.client_side_validation && environment_key.nil? fail ArgumentError, "Missing the required parameter 'environment_key' when calling SegmentsApi.get_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_segment" end # resource path local_var_path = '/api/v2/segments/{projectKey}/{environmentKey}/{segmentKey}'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.to_s)).sub('{' + 'environmentKey' + '}', CGI.escape(environment_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] || 'UserSegment' # auth_names auth_names = opts[:debug_auth_names] || ['ApiKey'] = 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, ) 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(project_key, environment_key, opts = {}) ⇒ UserSegments
List segments Get a list of all segments in the given project. Segments can be rule-based, list-based, or synced. Big segments include larger list-based segments and synced segments. Some fields in the response only apply to big segments. ### Filtering segments The ‘filter` parameter supports the following operators: `equals`, `anyOf`, and `exists`. You can also combine filters in the following ways: - Use a comma (`,`) as an AND operator - Use a vertical bar (`|`) as an OR operator - Use parentheses (`()`) to group filters #### Supported fields and operators You can only filter certain fields in segments when using the `filter` parameter. Additionally, you can only filter some fields with certain operators. When you search for segments, the `filter` parameter supports the following fields and operators: |<div style="width:120px">Field</div> |Description |Supported operators | |—|—|—| | `excludedKeys` | The segment keys of segments to exclude from the results. | `anyOf` | | `external` | Whether the segment is a synced segment. | `exists` | | `includedKeys` | The segment keys of segments to include in the results. | `anyOf` | | `query` | A "fuzzy" search across segment key, name, and description. Supply a string or list of strings to the operator. | `equals` | | `tags` | The segment tags. | `anyOf` | | `unbounded` | Whether the segment is a standard segment (`false`) or a big segment (`true`). Standard segments include rule-based segments and smaller list-based segments. Big segments include larger list-based segments and synced segments. | `equals` | Here are a few examples: * The filter `?filter=tags anyOf ["enterprise", "beta"],query equals "toggle"` matches segments with "toggle" in their key, name, or description that also have "enterprise" or "beta" as a tag. * The filter `?filter=excludedKeys anyOf ["segmentKey1", "segmentKey2"]` excludes the segments with those keys from the results. * The filter `?filter=unbounded equals true` matches larger list-based segments and synced segments. The documented values for `filter` query parameters are prior to URL encoding. For example, the `[` in `?filter=tags anyOf ["enterprise", "beta"]` must be encoded to `%5B`.
574 575 576 577 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 574 def get_segments(project_key, environment_key, opts = {}) data, _status_code, _headers = get_segments_with_http_info(project_key, environment_key, opts) data end |
#get_segments_with_http_info(project_key, environment_key, opts = {}) ⇒ Array<(UserSegments, Integer, Hash)>
List segments Get a list of all segments in the given project. Segments can be rule-based, list-based, or synced. Big segments include larger list-based segments and synced segments. Some fields in the response only apply to big segments. ### Filtering segments The `filter` parameter supports the following operators: `equals`, `anyOf`, and `exists`. You can also combine filters in the following ways: - Use a comma (`,`) as an AND operator - Use a vertical bar (`|`) as an OR operator - Use parentheses (`()`) to group filters #### Supported fields and operators You can only filter certain fields in segments when using the `filter` parameter. Additionally, you can only filter some fields with certain operators. When you search for segments, the `filter` parameter supports the following fields and operators: |<div style="width:120px">Field</div> |Description |Supported operators | |—|—|—| | `excludedKeys` | The segment keys of segments to exclude from the results. | `anyOf` | | `external` | Whether the segment is a synced segment. | `exists` | | `includedKeys` | The segment keys of segments to include in the results. | `anyOf` | | `query` | A "fuzzy" search across segment key, name, and description. Supply a string or list of strings to the operator. | `equals` | | `tags` | The segment tags. | `anyOf` | | `unbounded` | Whether the segment is a standard segment (`false`) or a big segment (`true`). Standard segments include rule-based segments and smaller list-based segments. Big segments include larger list-based segments and synced segments. | `equals` | Here are a few examples: * The filter `?filter=tags anyOf ["enterprise", "beta"],query equals "toggle"` matches segments with "toggle" in their key, name, or description that also have "enterprise" or "beta" as a tag. * The filter `?filter=excludedKeys anyOf ["segmentKey1", "segmentKey2"]` excludes the segments with those keys from the results. * The filter `?filter=unbounded equals true` matches larger list-based segments and synced segments. The documented values for `filter` query parameters are prior to URL encoding. For example, the `[` in `?filter=tags anyOf ["enterprise", "beta"]` must be encoded to `%5B`.
589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 589 def get_segments_with_http_info(project_key, environment_key, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: SegmentsApi.get_segments ...' end # verify the required parameter 'project_key' is set if @api_client.config.client_side_validation && project_key.nil? fail ArgumentError, "Missing the required parameter 'project_key' when calling SegmentsApi.get_segments" end # verify the required parameter 'environment_key' is set if @api_client.config.client_side_validation && environment_key.nil? fail ArgumentError, "Missing the required parameter 'environment_key' when calling SegmentsApi.get_segments" end # resource path local_var_path = '/api/v2/segments/{projectKey}/{environmentKey}'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.to_s)).sub('{' + 'environmentKey' + '}', CGI.escape(environment_key.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil? query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil? query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].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] || 'UserSegments' # auth_names auth_names = opts[:debug_auth_names] || ['ApiKey'] = 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, ) 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_targets_for_segment(project_key, environment_key, segment_key, patch_segment_expiring_target_input_rep, opts = {}) ⇒ ExpiringTargetPatchResponse
Update expiring targets for segment
Update expiring context targets for a segment. Updating a context target expiration uses the semantic patch format. To make a semantic patch request, you must append `domain-model=launchdarkly.semanticpatch` to your `Content-Type` header. To learn more, read [Updates using semantic patch](/reference#updates-using-semantic-patch). 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. ### Instructions Semantic patch requests support the following `kind` instructions for updating expiring context targets. <details> <summary>Click to expand instructions for <strong>updating expiring context targets</strong></summary> #### addExpiringTarget Schedules a date and time when LaunchDarkly will remove a context from segment targeting. The segment must already have the context as an individual target. ##### Parameters - `targetType`: The type of individual target for this context. Must be either `included` or `excluded`. - `contextKey`: The context key. - `contextKind`: The kind of context being targeted. - `value`: The date when the context should expire from the segment targeting, in Unix milliseconds. Here's an example: ```json { \"instructions\": [{ \"kind\": \"addExpiringTarget\", \"targetType\": \"included\", \"contextKey\": \"user-key-123abc\", \"contextKind\": \"user\", \"value\": 1754092860000 }] } ``` #### updateExpiringTarget Updates the date and time when LaunchDarkly will remove a context from segment targeting. ##### Parameters - `targetType`: The type of individual target for this context. Must be either `included` or `excluded`. - `contextKey`: The context key. - `contextKind`: The kind of context being targeted. - `value`: The new date when the context should expire from the segment targeting, in Unix milliseconds. - `version`: (Optional) The version of the expiring target to update. If included, update will fail if version doesn't match current version of the expiring target. Here's an example: ```json { \"instructions\": [{ \"kind\": \"updateExpiringTarget\", \"targetType\": \"included\", \"contextKey\": \"user-key-123abc\", \"contextKind\": \"user\", \"value\": 1754179260000 }] } ``` #### removeExpiringTarget Removes the scheduled expiration for the context in the segment. ##### Parameters - `targetType`: The type of individual target for this context. Must be either `included` or `excluded`. - `contextKey`: The context key. - `contextKind`: The kind of context being targeted. Here's an example: ```json { \"instructions\": [{ \"kind\": \"removeExpiringTarget\", \"targetType\": \"included\", \"contextKey\": \"user-key-123abc\", \"contextKind\": \"user\", }] } ``` </details>
653 654 655 656 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 653 def patch_expiring_targets_for_segment(project_key, environment_key, segment_key, patch_segment_expiring_target_input_rep, opts = {}) data, _status_code, _headers = patch_expiring_targets_for_segment_with_http_info(project_key, environment_key, segment_key, patch_segment_expiring_target_input_rep, opts) data end |
#patch_expiring_targets_for_segment_with_http_info(project_key, environment_key, segment_key, patch_segment_expiring_target_input_rep, opts = {}) ⇒ Array<(ExpiringTargetPatchResponse, Integer, Hash)>
Update expiring targets for segment
Update expiring context targets for a segment. Updating a context target expiration uses the semantic patch format. To make a semantic patch request, you must append `domain-model=launchdarkly.semanticpatch` to your `Content-Type` header. To learn more, read [Updates using semantic patch](/reference#updates-using-semantic-patch). 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. ### Instructions Semantic patch requests support the following `kind` instructions for updating expiring context targets. <details> <summary>Click to expand instructions for <strong>updating expiring context targets</strong></summary> #### addExpiringTarget Schedules a date and time when LaunchDarkly will remove a context from segment targeting. The segment must already have the context as an individual target. ##### Parameters - `targetType`: The type of individual target for this context. Must be either `included` or `excluded`. - `contextKey`: The context key. - `contextKind`: The kind of context being targeted. - `value`: The date when the context should expire from the segment targeting, in Unix milliseconds. Here's an example: ```json { \"instructions\": [{ \"kind\": \"addExpiringTarget\", \"targetType\": \"included\", \"contextKey\": \"user-key-123abc\", \"contextKind\": \"user\", \"value\": 1754092860000 }] } ``` #### updateExpiringTarget Updates the date and time when LaunchDarkly will remove a context from segment targeting. ##### Parameters - `targetType`: The type of individual target for this context. Must be either `included` or `excluded`. - `contextKey`: The context key. - `contextKind`: The kind of context being targeted. - `value`: The new date when the context should expire from the segment targeting, in Unix milliseconds. - `version`: (Optional) The version of the expiring target to update. If included, update will fail if version doesn't match current version of the expiring target. Here's an example: ```json { \"instructions\": [{ \"kind\": \"updateExpiringTarget\", \"targetType\": \"included\", \"contextKey\": \"user-key-123abc\", \"contextKind\": \"user\", \"value\": 1754179260000 }] } ``` #### removeExpiringTarget Removes the scheduled expiration for the context in the segment. ##### Parameters - `targetType`: The type of individual target for this context. Must be either `included` or `excluded`. - `contextKey`: The context key. - `contextKind`: The kind of context being targeted. Here's an example: ```json { \"instructions\": [{ \"kind\": \"removeExpiringTarget\", \"targetType\": \"included\", \"contextKey\": \"user-key-123abc\", \"contextKind\": \"user\", }] } ``` </details>
666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 666 def patch_expiring_targets_for_segment_with_http_info(project_key, environment_key, segment_key, patch_segment_expiring_target_input_rep, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: SegmentsApi.patch_expiring_targets_for_segment ...' end # verify the required parameter 'project_key' is set if @api_client.config.client_side_validation && project_key.nil? fail ArgumentError, "Missing the required parameter 'project_key' when calling SegmentsApi.patch_expiring_targets_for_segment" end # verify the required parameter 'environment_key' is set if @api_client.config.client_side_validation && environment_key.nil? fail ArgumentError, "Missing the required parameter 'environment_key' when calling SegmentsApi.patch_expiring_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_targets_for_segment" end # verify the required parameter 'patch_segment_expiring_target_input_rep' is set if @api_client.config.client_side_validation && patch_segment_expiring_target_input_rep.nil? fail ArgumentError, "Missing the required parameter 'patch_segment_expiring_target_input_rep' when calling SegmentsApi.patch_expiring_targets_for_segment" end # resource path local_var_path = '/api/v2/segments/{projectKey}/{segmentKey}/expiring-targets/{environmentKey}'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.to_s)).sub('{' + 'environmentKey' + '}', CGI.escape(environment_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' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(patch_segment_expiring_target_input_rep) # return_type return_type = opts[:debug_return_type] || 'ExpiringTargetPatchResponse' # auth_names auth_names = opts[:debug_auth_names] || ['ApiKey'] = opts.merge( :operation => :"SegmentsApi.patch_expiring_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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: SegmentsApi#patch_expiring_targets_for_segment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#patch_expiring_user_targets_for_segment(project_key, environment_key, segment_key, patch_segment_request, opts = {}) ⇒ ExpiringUserTargetPatchResponse
Update expiring user targets for segment
> ### Contexts are now available > > After you have upgraded your LaunchDarkly SDK to use contexts instead of users, you should use [Update expiring targets for segment](/tag/Segments#operation/patchExpiringTargetsForSegment) instead of this endpoint. To learn more, read [Contexts](https://docs.launchdarkly.com/home/observability/contexts). Update expiring user targets for a segment. Updating a user target expiration uses the semantic patch format. To make a semantic patch request, you must append `domain-model=launchdarkly.semanticpatch` to your `Content-Type` header. To learn more, read [Updates using semantic patch](/reference#updates-using-semantic-patch). 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. ### Instructions Semantic patch requests support the following `kind` instructions for updating expiring user targets. <details> <summary>Click to expand instructions for <strong>updating expiring user targets</strong></summary> #### addExpireUserTargetDate Schedules a date and time when LaunchDarkly will remove a user from segment targeting. ##### Parameters - `targetType`: A segment's target type, must be either `included` or `excluded`. - `userKey`: The user key. - `value`: The date when the user should expire from the segment targeting, in Unix milliseconds. #### updateExpireUserTargetDate Updates the date and time when LaunchDarkly will remove a user from segment targeting. ##### Parameters - `targetType`: A segment's target type, must be either `included` or `excluded`. - `userKey`: The user key. - `value`: The new date when the user should expire from the segment targeting, in Unix milliseconds. - `version`: The segment version. #### removeExpireUserTargetDate Removes the scheduled expiration for the user in the segment. ##### Parameters - `targetType`: A segment's target type, must be either `included` or `excluded`. - `userKey`: The user key. </details>
739 740 741 742 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 739 def patch_expiring_user_targets_for_segment(project_key, environment_key, segment_key, patch_segment_request, opts = {}) data, _status_code, _headers = patch_expiring_user_targets_for_segment_with_http_info(project_key, environment_key, segment_key, patch_segment_request, opts) data end |
#patch_expiring_user_targets_for_segment_with_http_info(project_key, environment_key, segment_key, patch_segment_request, opts = {}) ⇒ Array<(ExpiringUserTargetPatchResponse, Integer, Hash)>
Update expiring user targets for segment
> ### Contexts are now available > > After you have upgraded your LaunchDarkly SDK to use contexts instead of users, you should use [Update expiring targets for segment](/tag/Segments#operation/patchExpiringTargetsForSegment) instead of this endpoint. To learn more, read [Contexts](https://docs.launchdarkly.com/home/observability/contexts). Update expiring user targets for a segment. Updating a user target expiration uses the semantic patch format. To make a semantic patch request, you must append `domain-model=launchdarkly.semanticpatch` to your `Content-Type` header. To learn more, read [Updates using semantic patch](/reference#updates-using-semantic-patch). 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. ### Instructions Semantic patch requests support the following `kind` instructions for updating expiring user targets. <details> <summary>Click to expand instructions for <strong>updating expiring user targets</strong></summary> #### addExpireUserTargetDate Schedules a date and time when LaunchDarkly will remove a user from segment targeting. ##### Parameters - `targetType`: A segment's target type, must be either `included` or `excluded`. - `userKey`: The user key. - `value`: The date when the user should expire from the segment targeting, in Unix milliseconds. #### updateExpireUserTargetDate Updates the date and time when LaunchDarkly will remove a user from segment targeting. ##### Parameters - `targetType`: A segment's target type, must be either `included` or `excluded`. - `userKey`: The user key. - `value`: The new date when the user should expire from the segment targeting, in Unix milliseconds. - `version`: The segment version. #### removeExpireUserTargetDate Removes the scheduled expiration for the user in the segment. ##### Parameters - `targetType`: A segment's target type, must be either `included` or `excluded`. - `userKey`: The user key. </details>
752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 752 def patch_expiring_user_targets_for_segment_with_http_info(project_key, environment_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 'project_key' is set if @api_client.config.client_side_validation && project_key.nil? fail ArgumentError, "Missing the required parameter 'project_key' when calling SegmentsApi.patch_expiring_user_targets_for_segment" end # verify the required parameter 'environment_key' is set if @api_client.config.client_side_validation && environment_key.nil? fail ArgumentError, "Missing the required parameter 'environment_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/{projectKey}/{segmentKey}/expiring-user-targets/{environmentKey}'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.to_s)).sub('{' + 'environmentKey' + '}', CGI.escape(environment_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' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end # 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'] = 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, ) 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(project_key, environment_key, segment_key, patch_with_comment, opts = {}) ⇒ UserSegment
Patch segment Update a segment. The request body must be a valid semantic patch, JSON patch, or JSON merge patch. To learn more the different formats, read [Updates](/#section/Overview/Updates). ### Using semantic patches on a segment To make a semantic patch request, you must append ‘domain-model=launchdarkly.semanticpatch` to your `Content-Type` header. To learn more, read [Updates using semantic patch](/reference#updates-using-semantic-patch). The body of a semantic patch request for updating segments requires an `environmentKey` in addition to `instructions` and an optional `comment`. The body of the request takes the following properties: * `comment` (string): (Optional) A description of the update. * `environmentKey` (string): (Required) The key of the LaunchDarkly environment. * `instructions` (array): (Required) A list of actions the update should perform. Each action in the list must be an object with a `kind` property that indicates the instruction. If the action requires parameters, you must include those parameters as additional fields in the object. ### Instructions Semantic patch requests support the following `kind` instructions for updating segments. <details> <summary>Click to expand instructions for <strong>updating segment details and settings</strong></summary> #### addTags Adds tags to the segment. ##### Parameters - `values`: A list of tags to add. Here’s an example: “‘json { "instructions": [{ "kind": "addTags", "values": ["tag1", "tag2"] }] } “` #### removeTags Removes tags from the segment. ##### Parameters - `values`: A list of tags to remove. Here’s an example: “‘json { "instructions": [{ "kind": "removeTags", "values": ["tag1", "tag2"] }] } “` #### updateName Updates the name of the segment. ##### Parameters - `value`: Name of the segment. Here’s an example: “‘json { "instructions": [{ "kind": "updateName", "value": "Updated segment name" }] } “` </details> <details> <summary>Click to expand instructions for <strong>updating segment individual targets</strong></summary> #### addExcludedTargets Adds context keys to the individual context targets excluded from the segment for the specified `contextKind`. Returns an error if this causes the same context key to be both included and excluded. ##### Parameters - `contextKind`: The context kind the targets should be added to. - `values`: List of keys. Here’s an example: “‘json { "instructions": [{ "kind": "addExcludedTargets", "contextKind": "org", "values": [ "org-key-123abc", "org-key-456def" ] }] } “` #### addExcludedUsers Adds user keys to the individual user targets excluded from the segment. Returns an error if this causes the same user key to be both included and excluded. If you are working with contexts, use `addExcludedTargets` instead of this instruction. ##### Parameters - `values`: List of user keys. Here’s an example: “‘json { "instructions": [{ "kind": "addExcludedUsers", "values": [ "user-key-123abc", "user-key-456def" ] }] } “` #### addIncludedTargets Adds context keys to the individual context targets included in the segment for the specified `contextKind`. Returns an error if this causes the same context key to be both included and excluded. ##### Parameters - `contextKind`: The context kind the targets should be added to. - `values`: List of keys. Here’s an example: “‘json { "instructions": [{ "kind": "addIncludedTargets", "contextKind": "org", "values": [ "org-key-123abc", "org-key-456def" ] }] } “` #### addIncludedUsers Adds user keys to the individual user targets included in the segment. Returns an error if this causes the same user key to be both included and excluded. If you are working with contexts, use `addIncludedTargets` instead of this instruction. ##### Parameters - `values`: List of user keys. Here’s an example: “‘json { "instructions": [{ "kind": "addIncludedUsers", "values": [ "user-key-123abc", "user-key-456def" ] }] } “` #### removeExcludedTargets Removes context keys from the individual context targets excluded from the segment for the specified `contextKind`. ##### Parameters - `contextKind`: The context kind the targets should be removed from. - `values`: List of keys. Here’s an example: “‘json { "instructions": [{ "kind": "removeExcludedTargets", "contextKind": "org", "values": [ "org-key-123abc", "org-key-456def" ] }] } “` #### removeExcludedUsers Removes user keys from the individual user targets excluded from the segment. If you are working with contexts, use `removeExcludedTargets` instead of this instruction. ##### Parameters - `values`: List of user keys. Here’s an example: “‘json { "instructions": [{ "kind": "removeExcludedUsers", "values": [ "user-key-123abc", "user-key-456def" ] }] } “` #### removeIncludedTargets Removes context keys from the individual context targets included in the segment for the specified `contextKind`. ##### Parameters - `contextKind`: The context kind the targets should be removed from. - `values`: List of keys. Here’s an example: “‘json { "instructions": [{ "kind": "removeIncludedTargets", "contextKind": "org", "values": [ "org-key-123abc", "org-key-456def" ] }] } “` #### removeIncludedUsers Removes user keys from the individual user targets included in the segment. If you are working with contexts, use `removeIncludedTargets` instead of this instruction. ##### Parameters - `values`: List of user keys. Here’s an example: “‘json { "instructions": [{ "kind": "removeIncludedUsers", "values": [ "user-key-123abc", "user-key-456def" ] }] } “` </details> <details> <summary>Click to expand instructions for <strong>updating segment targeting rules</strong></summary> #### addClauses Adds the given clauses to the rule indicated by `ruleId`. ##### Parameters - `clauses`: Array of clause objects, with `contextKind` (string), `attribute` (string), `op` (string), `negate` (boolean), and `values` (array of strings, numbers, or dates) properties. The `contextKind`, if not provided, defaults to `user`. The `contextKind`, `attribute`, and `values` are case sensitive. The `op` must be lower-case. - `ruleId`: ID of a rule in the segment. Here’s an example: “‘json { "instructions": [{ "kind": "addClauses", "clauses": [ { "attribute": "email", "negate": false, "op": "contains", "values": ["value1"] } ], "ruleId": "a902ef4a-2faf-4eaf-88e1-ecc356708a29", }] } “` #### addRule Adds a new targeting rule to the segment. The rule may contain `clauses`. ##### Parameters - `clauses`: Array of clause objects, with `contextKind` (string), `attribute` (string), `op` (string), `negate` (boolean), and `values` (array of strings, numbers, or dates) properties. The `contextKind`, if not provided, defaults to `user`. The `contextKind`, `attribute`, and `values` are case sensitive. The `op` must be lower-case. - `description`: A description of the rule. Here’s an example: “‘json { "instructions": [{ "kind": "addRule", "clauses": [ { "attribute": "email", "op": "contains", "negate": false, "values": ["@launchdarkly.com"] } ], "description": "Targeting rule for LaunchDarkly employees", }] } “` #### addValuesToClause Adds `values` to the values of the clause that `ruleId` and `clauseId` indicate. Does not update the context kind, attribute, or operator. ##### Parameters - `ruleId`: ID of a rule in the segment. - `clauseId`: ID of a clause in that rule. - `values`: Array of strings, case sensitive. Here’s an example: “‘json { "instructions": [{ "kind": "addValuesToClause", "ruleId": "a902ef4a-2faf-4eaf-88e1-ecc356708a29", "clauseId": "10a58772-3121-400f-846b-b8a04e8944ed", "values": ["beta_testers"] }] } “` #### removeClauses Removes the clauses specified by `clauseIds` from the rule indicated by `ruleId`. ##### Parameters - `ruleId`: ID of a rule in the segment. - `clauseIds`: Array of IDs of clauses in the rule. Here’s an example: “‘json { "instructions": [{ "kind": "removeClauses", "ruleId": "a902ef4a-2faf-4eaf-88e1-ecc356708a29", "clauseIds": ["10a58772-3121-400f-846b-b8a04e8944ed", "36a461dc-235e-4b08-97b9-73ce9365873e"] }] } “` #### removeRule Removes the targeting rule specified by `ruleId`. Does nothing if the rule does not exist. ##### Parameters - `ruleId`: ID of a rule in the segment. Here’s an example: “‘json { "instructions": [{ "kind": "removeRule", "ruleId": "a902ef4a-2faf-4eaf-88e1-ecc356708a29" }] } “` #### removeValuesFromClause Removes `values` from the values of the clause indicated by `ruleId` and `clauseId`. Does not update the context kind, attribute, or operator. ##### Parameters - `ruleId`: ID of a rule in the segment. - `clauseId`: ID of a clause in that rule. - `values`: Array of strings, case sensitive. Here’s an example: “‘json { "instructions": [{ "kind": "removeValuesFromClause", "ruleId": "a902ef4a-2faf-4eaf-88e1-ecc356708a29", "clauseId": "10a58772-3121-400f-846b-b8a04e8944ed", "values": ["beta_testers"] }] } “` #### reorderRules Rearranges the rules to match the order given in `ruleIds`. Returns an error if `ruleIds` does not match the current set of rules in the segment. ##### Parameters - `ruleIds`: Array of IDs of all targeting rules in the segment. Here’s an example: “‘json { "instructions": [{ "kind": "reorderRules", "ruleIds": ["a902ef4a-2faf-4eaf-88e1-ecc356708a29", "63c238d1-835d-435e-8f21-c8d5e40b2a3d"] }] } “` #### updateClause Replaces the clause indicated by `ruleId` and `clauseId` with `clause`. ##### Parameters - `ruleId`: ID of a rule in the segment. - `clauseId`: ID of a clause in that rule. - `clause`: New `clause` object, with `contextKind` (string), `attribute` (string), `op` (string), `negate` (boolean), and `values` (array of strings, numbers, or dates) properties. The `contextKind`, if not provided, defaults to `user`. The `contextKind`, `attribute`, and `values` are case sensitive. The `op` must be lower-case. Here’s an example: “‘json { "instructions": [{ "kind": "updateClause", "ruleId": "a902ef4a-2faf-4eaf-88e1-ecc356708a29", "clauseId": "10c7462a-2062-45ba-a8bb-dfb3de0f8af5", "clause": { "contextKind": "user", "attribute": "country", "op": "in", "negate": false, "values": ["Mexico", "Canada"] } }] } “` #### updateRuleDescription Updates the description of the segment targeting rule. ##### Parameters - `description`: The new human-readable description for this rule. - `ruleId`: The ID of the rule. You can retrieve this by making a GET request for the segment. Here’s an example: “‘json { "instructions": [{ "kind": "updateRuleDescription", "description": "New rule description", "ruleId": "a902ef4a-2faf-4eaf-88e1-ecc356708a29" }] } “` #### updateRuleRolloutAndContextKind For a rule that includes a percentage of targets, updates the percentage and the context kind of the targets to include. ##### Parameters - `ruleId`: The ID of a targeting rule in the segment that includes a percentage of targets. - `weight`: The weight, in thousandths of a percent (0-100000). - `contextKind`: The context kind. Here’s an example: “‘json { "instructions": [{ "kind": "reorderRules", "ruleId": "a902ef4a-2faf-4eaf-88e1-ecc356708a29", "weight": "20000", "contextKind": "device" }] } “` </details> <details> <summary>Click to expand instructions for <strong>working with Big Segments</strong></summary> A "big segment" is a segment that is either a synced segment, or a list-based segment with more than 15,000 entries that includes only one targeted context kind. LaunchDarkly uses different implementations for different types of segments so that all of your segments have good performance. The following semantic patch instructions apply only to these [larger list-based segments](docs.launchdarkly.com/home/flags/segments-create#create-larger-list-based-segments). #### addBigSegmentExcludedTargets For use with [larger list-based segments](docs.launchdarkly.com/home/flags/segments-create#create-larger-list-based-segments) ONLY. Adds context keys to the context targets excluded from the segment. Returns an error if this causes the same context key to be both included and excluded. ##### Parameters - `values`: List of context keys. Here’s an example: “‘json { "instructions": [{ "kind": "addBigSegmentExcludedTargets", "values": [ "org-key-123abc", "org-key-456def" ] }] } “` #### addBigSegmentIncludedTargets For use with [larger list-based segments](docs.launchdarkly.com/home/flags/segments-create#create-larger-list-based-segments) ONLY. Adds context keys to the context targets included in the segment. Returns an error if this causes the same context key to be both included and excluded. ##### Parameters - `values`: List of context keys. Here’s an example: “‘json { "instructions": [{ "kind": "addBigSegmentIncludedTargets", "values": [ "org-key-123abc", "org-key-456def" ] }] } “` #### processBigSegmentImport For use with [larger list-based segments](docs.launchdarkly.com/home/flags/segments-create#create-larger-list-based-segments) ONLY. Processes a segment import. ##### Parameters - `importId`: The ID of the import. The import ID is returned in the `Location` header as part of the [Create big segment import](apidocs.launchdarkly.com/tag/Segments-(beta)#operation/createBigSegmentImport) request. Here’s an example: “‘json { "instructions": [{ "kind": "processBigSegmentImport", "importId": "a902ef4a-2faf-4eaf-88e1-ecc356708a29" }] } “` #### removeBigSegmentExcludedTargets For use with [larger list-based segments](docs.launchdarkly.com/home/flags/segments-create#create-larger-list-based-segments) ONLY. Removes context keys from the context targets excluded from the segment. ##### Parameters - `values`: List of context keys. Here’s an example: “‘json { "instructions": [{ "kind": "removeBigSegmentExcludedTargets", "values": [ "org-key-123abc", "org-key-456def" ] }] } “` #### removeBigSegmentIncludedTargets For use with [larger list-based segments](docs.launchdarkly.com/home/flags/segments-create#create-larger-list-based-segments) ONLY. Removes context keys from the context targets included in the segment. ##### Parameters - `values`: List of context keys. Here’s an example: “‘json { "instructions": [{ "kind": "removeBigSegmentIncludedTargets", "values": [ "org-key-123abc", "org-key-456def" ] }] } “` </details> ### Using JSON patches on a segment If you do not include the header described above, you can use a [JSON patch](/reference#updates-using-json-patch) or [JSON merge patch](datatracker.ietf.org/doc/html/rfc7386) representation of the desired changes. For example, to update the description for a segment with a JSON patch, use the following request body: “`json { "patch": [ { "op": "replace", "path": "/description", "value": "new description" } ] } “` To update fields in the segment that are arrays, set the `path` to the name of the field and then append `/<array index>`. Use `/0` to add the new entry to the beginning of the array. Use `/-` to add the new entry to the end of the array. For example, to add a rule to a segment, use the following request body: “`json { "patch":[ { "op": "add", "path": "/rules/0", "value": { "clauses": [{ "contextKind": "user", "attribute": "email", "op": "endsWith", "values": [".edu"], "negate": false }] } } ] } “` To add or remove targets from segments, we recommend using semantic patch. Semantic patch for segments includes specific instructions for adding and removing both included and excluded targets.
825 826 827 828 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 825 def patch_segment(project_key, environment_key, segment_key, patch_with_comment, opts = {}) data, _status_code, _headers = patch_segment_with_http_info(project_key, environment_key, segment_key, patch_with_comment, opts) data end |
#patch_segment_with_http_info(project_key, environment_key, segment_key, patch_with_comment, opts = {}) ⇒ Array<(UserSegment, Integer, Hash)>
Patch segment Update a segment. The request body must be a valid semantic patch, JSON patch, or JSON merge patch. To learn more the different formats, read [Updates](/#section/Overview/Updates). ### Using semantic patches on a segment To make a semantic patch request, you must append `domain-model=launchdarkly.semanticpatch` to your `Content-Type` header. To learn more, read [Updates using semantic patch](/reference#updates-using-semantic-patch). The body of a semantic patch request for updating segments requires an `environmentKey` in addition to `instructions` and an optional `comment`. The body of the request takes the following properties: * `comment` (string): (Optional) A description of the update. * `environmentKey` (string): (Required) The key of the LaunchDarkly environment. * `instructions` (array): (Required) A list of actions the update should perform. Each action in the list must be an object with a `kind` property that indicates the instruction. If the action requires parameters, you must include those parameters as additional fields in the object. ### Instructions Semantic patch requests support the following `kind` instructions for updating segments. <details> <summary>Click to expand instructions for <strong>updating segment details and settings</strong></summary> #### addTags Adds tags to the segment. ##### Parameters - `values`: A list of tags to add. Here's an example: ```json { "instructions": [{ "kind": "addTags", "values": ["tag1", "tag2"] }] } ``` #### removeTags Removes tags from the segment. ##### Parameters - `values`: A list of tags to remove. Here's an example: ```json { "instructions": [{ "kind": "removeTags", "values": ["tag1", "tag2"] }] } ``` #### updateName Updates the name of the segment. ##### Parameters - `value`: Name of the segment. Here's an example: ```json { "instructions": [{ "kind": "updateName", "value": "Updated segment name" }] } ``` </details> <details> <summary>Click to expand instructions for <strong>updating segment individual targets</strong></summary> #### addExcludedTargets Adds context keys to the individual context targets excluded from the segment for the specified `contextKind`. Returns an error if this causes the same context key to be both included and excluded. ##### Parameters - `contextKind`: The context kind the targets should be added to. - `values`: List of keys. Here's an example: ```json { "instructions": [{ "kind": "addExcludedTargets", "contextKind": "org", "values": [ "org-key-123abc", "org-key-456def" ] }] } ``` #### addExcludedUsers Adds user keys to the individual user targets excluded from the segment. Returns an error if this causes the same user key to be both included and excluded. If you are working with contexts, use `addExcludedTargets` instead of this instruction. ##### Parameters - `values`: List of user keys. Here's an example: ```json { "instructions": [{ "kind": "addExcludedUsers", "values": [ "user-key-123abc", "user-key-456def" ] }] } ``` #### addIncludedTargets Adds context keys to the individual context targets included in the segment for the specified `contextKind`. Returns an error if this causes the same context key to be both included and excluded. ##### Parameters - `contextKind`: The context kind the targets should be added to. - `values`: List of keys. Here's an example: ```json { "instructions": [{ "kind": "addIncludedTargets", "contextKind": "org", "values": [ "org-key-123abc", "org-key-456def" ] }] } ``` #### addIncludedUsers Adds user keys to the individual user targets included in the segment. Returns an error if this causes the same user key to be both included and excluded. If you are working with contexts, use `addIncludedTargets` instead of this instruction. ##### Parameters - `values`: List of user keys. Here's an example: ```json { "instructions": [{ "kind": "addIncludedUsers", "values": [ "user-key-123abc", "user-key-456def" ] }] } ``` #### removeExcludedTargets Removes context keys from the individual context targets excluded from the segment for the specified `contextKind`. ##### Parameters - `contextKind`: The context kind the targets should be removed from. - `values`: List of keys. Here's an example: ```json { "instructions": [{ "kind": "removeExcludedTargets", "contextKind": "org", "values": [ "org-key-123abc", "org-key-456def" ] }] } ``` #### removeExcludedUsers Removes user keys from the individual user targets excluded from the segment. If you are working with contexts, use `removeExcludedTargets` instead of this instruction. ##### Parameters - `values`: List of user keys. Here's an example: ```json { "instructions": [{ "kind": "removeExcludedUsers", "values": [ "user-key-123abc", "user-key-456def" ] }] } ``` #### removeIncludedTargets Removes context keys from the individual context targets included in the segment for the specified `contextKind`. ##### Parameters - `contextKind`: The context kind the targets should be removed from. - `values`: List of keys. Here's an example: ```json { "instructions": [{ "kind": "removeIncludedTargets", "contextKind": "org", "values": [ "org-key-123abc", "org-key-456def" ] }] } ``` #### removeIncludedUsers Removes user keys from the individual user targets included in the segment. If you are working with contexts, use `removeIncludedTargets` instead of this instruction. ##### Parameters - `values`: List of user keys. Here's an example: ```json { "instructions": [{ "kind": "removeIncludedUsers", "values": [ "user-key-123abc", "user-key-456def" ] }] } ``` </details> <details> <summary>Click to expand instructions for <strong>updating segment targeting rules</strong></summary> #### addClauses Adds the given clauses to the rule indicated by `ruleId`. ##### Parameters - `clauses`: Array of clause objects, with `contextKind` (string), `attribute` (string), `op` (string), `negate` (boolean), and `values` (array of strings, numbers, or dates) properties. The `contextKind`, if not provided, defaults to `user`. The `contextKind`, `attribute`, and `values` are case sensitive. The `op` must be lower-case. - `ruleId`: ID of a rule in the segment. Here's an example: ```json { "instructions": [{ "kind": "addClauses", "clauses": [ { "attribute": "email", "negate": false, "op": "contains", "values": ["value1"] } ], "ruleId": "a902ef4a-2faf-4eaf-88e1-ecc356708a29", }] } ``` #### addRule Adds a new targeting rule to the segment. The rule may contain `clauses`. ##### Parameters - `clauses`: Array of clause objects, with `contextKind` (string), `attribute` (string), `op` (string), `negate` (boolean), and `values` (array of strings, numbers, or dates) properties. The `contextKind`, if not provided, defaults to `user`. The `contextKind`, `attribute`, and `values` are case sensitive. The `op` must be lower-case. - `description`: A description of the rule. Here's an example: ```json { "instructions": [{ "kind": "addRule", "clauses": [ { "attribute": "email", "op": "contains", "negate": false, "values": ["@launchdarkly.com"] } ], "description": "Targeting rule for LaunchDarkly employees", }] } ``` #### addValuesToClause Adds `values` to the values of the clause that `ruleId` and `clauseId` indicate. Does not update the context kind, attribute, or operator. ##### Parameters - `ruleId`: ID of a rule in the segment. - `clauseId`: ID of a clause in that rule. - `values`: Array of strings, case sensitive. Here's an example: ```json { "instructions": [{ "kind": "addValuesToClause", "ruleId": "a902ef4a-2faf-4eaf-88e1-ecc356708a29", "clauseId": "10a58772-3121-400f-846b-b8a04e8944ed", "values": ["beta_testers"] }] } ``` #### removeClauses Removes the clauses specified by `clauseIds` from the rule indicated by `ruleId`. ##### Parameters - `ruleId`: ID of a rule in the segment. - `clauseIds`: Array of IDs of clauses in the rule. Here's an example: ```json { "instructions": [{ "kind": "removeClauses", "ruleId": "a902ef4a-2faf-4eaf-88e1-ecc356708a29", "clauseIds": ["10a58772-3121-400f-846b-b8a04e8944ed", "36a461dc-235e-4b08-97b9-73ce9365873e"] }] } ``` #### removeRule Removes the targeting rule specified by `ruleId`. Does nothing if the rule does not exist. ##### Parameters - `ruleId`: ID of a rule in the segment. Here's an example: ```json { "instructions": [{ "kind": "removeRule", "ruleId": "a902ef4a-2faf-4eaf-88e1-ecc356708a29" }] } ``` #### removeValuesFromClause Removes `values` from the values of the clause indicated by `ruleId` and `clauseId`. Does not update the context kind, attribute, or operator. ##### Parameters - `ruleId`: ID of a rule in the segment. - `clauseId`: ID of a clause in that rule. - `values`: Array of strings, case sensitive. Here's an example: ```json { "instructions": [{ "kind": "removeValuesFromClause", "ruleId": "a902ef4a-2faf-4eaf-88e1-ecc356708a29", "clauseId": "10a58772-3121-400f-846b-b8a04e8944ed", "values": ["beta_testers"] }] } ``` #### reorderRules Rearranges the rules to match the order given in `ruleIds`. Returns an error if `ruleIds` does not match the current set of rules in the segment. ##### Parameters - `ruleIds`: Array of IDs of all targeting rules in the segment. Here's an example: ```json { "instructions": [{ "kind": "reorderRules", "ruleIds": ["a902ef4a-2faf-4eaf-88e1-ecc356708a29", "63c238d1-835d-435e-8f21-c8d5e40b2a3d"] }] } ``` #### updateClause Replaces the clause indicated by `ruleId` and `clauseId` with `clause`. ##### Parameters - `ruleId`: ID of a rule in the segment. - `clauseId`: ID of a clause in that rule. - `clause`: New `clause` object, with `contextKind` (string), `attribute` (string), `op` (string), `negate` (boolean), and `values` (array of strings, numbers, or dates) properties. The `contextKind`, if not provided, defaults to `user`. The `contextKind`, `attribute`, and `values` are case sensitive. The `op` must be lower-case. Here's an example: ```json { "instructions": [{ "kind": "updateClause", "ruleId": "a902ef4a-2faf-4eaf-88e1-ecc356708a29", "clauseId": "10c7462a-2062-45ba-a8bb-dfb3de0f8af5", "clause": { "contextKind": "user", "attribute": "country", "op": "in", "negate": false, "values": ["Mexico", "Canada"] } }] } ``` #### updateRuleDescription Updates the description of the segment targeting rule. ##### Parameters - `description`: The new human-readable description for this rule. - `ruleId`: The ID of the rule. You can retrieve this by making a GET request for the segment. Here's an example: ```json { "instructions": [{ "kind": "updateRuleDescription", "description": "New rule description", "ruleId": "a902ef4a-2faf-4eaf-88e1-ecc356708a29" }] } ``` #### updateRuleRolloutAndContextKind For a rule that includes a percentage of targets, updates the percentage and the context kind of the targets to include. ##### Parameters - `ruleId`: The ID of a targeting rule in the segment that includes a percentage of targets. - `weight`: The weight, in thousandths of a percent (0-100000). - `contextKind`: The context kind. Here's an example: ```json { "instructions": [{ "kind": "reorderRules", "ruleId": "a902ef4a-2faf-4eaf-88e1-ecc356708a29", "weight": "20000", "contextKind": "device" }] } ``` </details> <details> <summary>Click to expand instructions for <strong>working with Big Segments</strong></summary> A "big segment" is a segment that is either a synced segment, or a list-based segment with more than 15,000 entries that includes only one targeted context kind. LaunchDarkly uses different implementations for different types of segments so that all of your segments have good performance. The following semantic patch instructions apply only to these [larger list-based segments](docs.launchdarkly.com/home/flags/segments-create#create-larger-list-based-segments). #### addBigSegmentExcludedTargets For use with [larger list-based segments](docs.launchdarkly.com/home/flags/segments-create#create-larger-list-based-segments) ONLY. Adds context keys to the context targets excluded from the segment. Returns an error if this causes the same context key to be both included and excluded. ##### Parameters - `values`: List of context keys. Here's an example: ```json { "instructions": [{ "kind": "addBigSegmentExcludedTargets", "values": [ "org-key-123abc", "org-key-456def" ] }] } ``` #### addBigSegmentIncludedTargets For use with [larger list-based segments](docs.launchdarkly.com/home/flags/segments-create#create-larger-list-based-segments) ONLY. Adds context keys to the context targets included in the segment. Returns an error if this causes the same context key to be both included and excluded. ##### Parameters - `values`: List of context keys. Here's an example: ```json { "instructions": [{ "kind": "addBigSegmentIncludedTargets", "values": [ "org-key-123abc", "org-key-456def" ] }] } ``` #### processBigSegmentImport For use with [larger list-based segments](docs.launchdarkly.com/home/flags/segments-create#create-larger-list-based-segments) ONLY. Processes a segment import. ##### Parameters - `importId`: The ID of the import. The import ID is returned in the `Location` header as part of the [Create big segment import](apidocs.launchdarkly.com/tag/Segments-(beta)#operation/createBigSegmentImport) request. Here's an example: ```json { "instructions": [{ "kind": "processBigSegmentImport", "importId": "a902ef4a-2faf-4eaf-88e1-ecc356708a29" }] } ``` #### removeBigSegmentExcludedTargets For use with [larger list-based segments](docs.launchdarkly.com/home/flags/segments-create#create-larger-list-based-segments) ONLY. Removes context keys from the context targets excluded from the segment. ##### Parameters - `values`: List of context keys. Here's an example: ```json { "instructions": [{ "kind": "removeBigSegmentExcludedTargets", "values": [ "org-key-123abc", "org-key-456def" ] }] } ``` #### removeBigSegmentIncludedTargets For use with [larger list-based segments](docs.launchdarkly.com/home/flags/segments-create#create-larger-list-based-segments) ONLY. Removes context keys from the context targets included in the segment. ##### Parameters - `values`: List of context keys. Here's an example: ```json { "instructions": [{ "kind": "removeBigSegmentIncludedTargets", "values": [ "org-key-123abc", "org-key-456def" ] }] } ``` </details> ### Using JSON patches on a segment If you do not include the header described above, you can use a [JSON patch](/reference#updates-using-json-patch) or [JSON merge patch](datatracker.ietf.org/doc/html/rfc7386) representation of the desired changes. For example, to update the description for a segment with a JSON patch, use the following request body: ```json { "patch": [ { "op": "replace", "path": "/description", "value": "new description" } ] } ``` To update fields in the segment that are arrays, set the `path` to the name of the field and then append `/<array index>`. Use `/0` to add the new entry to the beginning of the array. Use `/-` to add the new entry to the end of the array. For example, to add a rule to a segment, use the following request body: ```json { "patch":[ { "op": "add", "path": "/rules/0", "value": { "clauses": [{ "contextKind": "user", "attribute": "email", "op": "endsWith", "values": [".edu"], "negate": false }] } } ] } ``` To add or remove targets from segments, we recommend using semantic patch. Semantic patch for segments includes specific instructions for adding and removing both included and excluded targets.
838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 838 def patch_segment_with_http_info(project_key, environment_key, segment_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 'project_key' is set if @api_client.config.client_side_validation && project_key.nil? fail ArgumentError, "Missing the required parameter 'project_key' when calling SegmentsApi.patch_segment" end # verify the required parameter 'environment_key' is set if @api_client.config.client_side_validation && environment_key.nil? fail ArgumentError, "Missing the required parameter 'environment_key' when calling SegmentsApi.patch_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_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/{projectKey}/{environmentKey}/{segmentKey}'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.to_s)).sub('{' + 'environmentKey' + '}', CGI.escape(environment_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' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end # 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'] = 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, ) 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(project_key, environment_key, segment_body, opts = {}) ⇒ UserSegment
Create segment Create a new segment.
910 911 912 913 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 910 def post_segment(project_key, environment_key, segment_body, opts = {}) data, _status_code, _headers = post_segment_with_http_info(project_key, environment_key, segment_body, opts) data end |
#post_segment_with_http_info(project_key, environment_key, segment_body, opts = {}) ⇒ Array<(UserSegment, Integer, Hash)>
Create segment Create a new segment.
922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 922 def post_segment_with_http_info(project_key, environment_key, segment_body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: SegmentsApi.post_segment ...' end # verify the required parameter 'project_key' is set if @api_client.config.client_side_validation && project_key.nil? fail ArgumentError, "Missing the required parameter 'project_key' when calling SegmentsApi.post_segment" end # verify the required parameter 'environment_key' is set if @api_client.config.client_side_validation && environment_key.nil? fail ArgumentError, "Missing the required parameter 'environment_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/{projectKey}/{environmentKey}'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.to_s)).sub('{' + 'environmentKey' + '}', CGI.escape(environment_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' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end # 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'] = 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, ) 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_context_targets(project_key, environment_key, segment_key, segment_user_state, opts = {}) ⇒ nil
Update context targets on a big segment Update context targets included or excluded in a big segment. Big segments include larger list-based segments and synced segments. This operation does not support standard segments.
991 992 993 994 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 991 def update_big_segment_context_targets(project_key, environment_key, segment_key, segment_user_state, opts = {}) update_big_segment_context_targets_with_http_info(project_key, environment_key, segment_key, segment_user_state, opts) nil end |
#update_big_segment_context_targets_with_http_info(project_key, environment_key, segment_key, segment_user_state, opts = {}) ⇒ Array<(nil, Integer, Hash)>
Update context targets on a big segment Update context targets included or excluded in a big segment. Big segments include larger list-based segments and synced segments. This operation does not support standard segments.
1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 1004 def update_big_segment_context_targets_with_http_info(project_key, environment_key, segment_key, segment_user_state, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: SegmentsApi.update_big_segment_context_targets ...' end # verify the required parameter 'project_key' is set if @api_client.config.client_side_validation && project_key.nil? fail ArgumentError, "Missing the required parameter 'project_key' when calling SegmentsApi.update_big_segment_context_targets" end # verify the required parameter 'environment_key' is set if @api_client.config.client_side_validation && environment_key.nil? fail ArgumentError, "Missing the required parameter 'environment_key' when calling SegmentsApi.update_big_segment_context_targets" 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.update_big_segment_context_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_context_targets" end # resource path local_var_path = '/api/v2/segments/{projectKey}/{environmentKey}/{segmentKey}/contexts'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.to_s)).sub('{' + 'environmentKey' + '}', CGI.escape(environment_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' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end # 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'] = opts.merge( :operation => :"SegmentsApi.update_big_segment_context_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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: SegmentsApi#update_big_segment_context_targets\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#update_big_segment_targets(project_key, environment_key, segment_key, segment_user_state, opts = {}) ⇒ nil
Update user context targets on a big segment Update user context targets included or excluded in a big segment. Big segments include larger list-based segments and synced segments. This operation does not support standard segments.
1077 1078 1079 1080 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 1077 def update_big_segment_targets(project_key, environment_key, segment_key, segment_user_state, opts = {}) update_big_segment_targets_with_http_info(project_key, environment_key, segment_key, segment_user_state, opts) nil end |
#update_big_segment_targets_with_http_info(project_key, environment_key, segment_key, segment_user_state, opts = {}) ⇒ Array<(nil, Integer, Hash)>
Update user context targets on a big segment Update user context targets included or excluded in a big segment. Big segments include larger list-based segments and synced segments. This operation does not support standard segments.
1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 1090 def update_big_segment_targets_with_http_info(project_key, environment_key, segment_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 'project_key' is set if @api_client.config.client_side_validation && project_key.nil? fail ArgumentError, "Missing the required parameter 'project_key' when calling SegmentsApi.update_big_segment_targets" end # verify the required parameter 'environment_key' is set if @api_client.config.client_side_validation && environment_key.nil? fail ArgumentError, "Missing the required parameter 'environment_key' when calling SegmentsApi.update_big_segment_targets" 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.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/{projectKey}/{environmentKey}/{segmentKey}/users'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.to_s)).sub('{' + 'environmentKey' + '}', CGI.escape(environment_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' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end # 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'] = 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, ) 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 |