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_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.
-
#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.
-
#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_request, 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_request, 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_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.
104 105 106 107 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 104 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.
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 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 116 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/contexts). Get a list of a segment’s user targets that are scheduled for removal.
179 180 181 182 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 179 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/contexts). Get a list of a segment's user targets that are scheduled for removal.
191 192 193 194 195 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 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 191 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.
254 255 256 257 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 254 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. This operation does not support standard segments.
330 331 332 333 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 330 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. This operation does not support standard segments.
343 344 345 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 401 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 343 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/contexts). Get the membership status (included/excluded) for a given user in this Big Segment. This operation does not support standard segments.
411 412 413 414 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 411 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/contexts). Get the membership status (included/excluded) for a given user in this Big Segment. This operation does not support standard segments.
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 482 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 424 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.
266 267 268 269 270 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 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 266 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.
490 491 492 493 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 490 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.
501 502 503 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 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 501 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] || {} # 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_request, 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 context targets. #### addExpiringTarget Schedules a date and time when LaunchDarkly will remove a context from segment targeting. ##### Parameters - `targetType`: A segment's target type, 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. #### updateExpiringTarget Updates the date and time when LaunchDarkly will remove a context from segment targeting. ##### Parameters - `targetType`: A segment's target type, 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`: The segment version. #### removeExpiringTarget Removes the scheduled expiration for the context in the segment. ##### Parameters - `targetType`: A segment's target type, must be either `included` or `excluded`. - `contextKey`: The context key. - `contextKind`: The kind of context being targeted.
561 562 563 564 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 561 def patch_expiring_targets_for_segment(project_key, environment_key, segment_key, patch_segment_request, opts = {}) data, _status_code, _headers = patch_expiring_targets_for_segment_with_http_info(project_key, environment_key, segment_key, patch_segment_request, opts) data end |
#patch_expiring_targets_for_segment_with_http_info(project_key, environment_key, segment_key, patch_segment_request, 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 context targets. #### addExpiringTarget Schedules a date and time when LaunchDarkly will remove a context from segment targeting. ##### Parameters - `targetType`: A segment's target type, 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. #### updateExpiringTarget Updates the date and time when LaunchDarkly will remove a context from segment targeting. ##### Parameters - `targetType`: A segment's target type, 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`: The segment version. #### removeExpiringTarget Removes the scheduled expiration for the context in the segment. ##### Parameters - `targetType`: A segment's target type, must be either `included` or `excluded`. - `contextKey`: The context key. - `contextKind`: The kind of context being targeted.
574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 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 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 574 def patch_expiring_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_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_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_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_request) # 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/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 user targets. #### 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.
647 648 649 650 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 647 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/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 user targets. #### 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.
660 661 662 663 664 665 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 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 660 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. ### 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. #### 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. #### 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. #### addExcludedTargets Adds context keys to the individual context targets excluded 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. #### 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. #### 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. #### 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. #### 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. #### 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. #### updateName Updates the name of the segment. ##### Parameters - `value`: Name of the segment. ## Using JSON patches on a segment You can also use JSON patch. To learn more, read [Updates using JSON patches](/reference#updates-using-json-patch). For example, to update the description for a segment, 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>`. Using `/0` adds the new entry to the beginning 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.
733 734 735 736 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 733 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. ### 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. #### 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. #### 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. #### addExcludedTargets Adds context keys to the individual context targets excluded 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. #### 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. #### 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. #### 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. #### 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. #### 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. #### updateName Updates the name of the segment. ##### Parameters - `value`: Name of the segment. ## Using JSON patches on a segment You can also use JSON patch. To learn more, read [Updates using JSON patches](/reference#updates-using-json-patch). For example, to update the description for a segment, 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>`. Using `/0` adds the new entry to the beginning 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.
746 747 748 749 750 751 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 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 746 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.
818 819 820 821 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 818 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.
830 831 832 833 834 835 836 837 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 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 830 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.
899 900 901 902 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 899 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.
912 913 914 915 916 917 918 919 920 921 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 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 912 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.
985 986 987 988 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 985 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.
998 999 1000 1001 1002 1003 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 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 998 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 |