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
-
#create_big_segment_export(project_key, environment_key, segment_key, opts = {}) ⇒ nil
Create big segment export Starts a new export process for a big segment.
-
#create_big_segment_export_with_http_info(project_key, environment_key, segment_key, opts = {}) ⇒ Array<(nil, Integer, Hash)>
Create big segment export Starts a new export process for a big segment.
-
#create_big_segment_import(project_key, environment_key, segment_key, opts = {}) ⇒ nil
Create big segment import Start a new import process for a big segment.
-
#create_big_segment_import_with_http_info(project_key, environment_key, segment_key, opts = {}) ⇒ Array<(nil, Integer, Hash)>
Create big segment import Start a new import process for a big segment.
-
#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_big_segment_export(project_key, environment_key, segment_key, export_id, opts = {}) ⇒ Export
Get big segment export Returns information about a big segment export process.
-
#get_big_segment_export_with_http_info(project_key, environment_key, segment_key, export_id, opts = {}) ⇒ Array<(Export, Integer, Hash)>
Get big segment export Returns information about a big segment export process.
-
#get_big_segment_import(project_key, environment_key, segment_key, import_id, opts = {}) ⇒ Import
Get big segment import Returns information about a big segment import process.
-
#get_big_segment_import_with_http_info(project_key, environment_key, segment_key, import_id, opts = {}) ⇒ Array<(Import, Integer, Hash)>
Get big segment import Returns information about a big segment import process.
-
#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](launchdarkly.com/docs/api/segments/get-expiring-targets-for-segment) 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](launchdarkly.com/docs/api/segments/get-expiring-targets-for-segment) 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](launchdarkly.com/docs/api/segments/get-expiring-targets-for-segment) 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](launchdarkly.com/docs/api/segments/get-expiring-targets-for-segment) 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](launchdarkly.com/docs/api/segments/patch-expiring-targets-for-segment) 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](launchdarkly.com/docs/api/segments/patch-expiring-targets-for-segment) 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
#create_big_segment_export(project_key, environment_key, segment_key, opts = {}) ⇒ nil
Create big segment export Starts a new export process for a big segment. This is an export for a synced segment or a list-based segment that can include more than 15,000 entries.
29 30 31 32 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 29 def create_big_segment_export(project_key, environment_key, segment_key, opts = {}) create_big_segment_export_with_http_info(project_key, environment_key, segment_key, opts) nil end |
#create_big_segment_export_with_http_info(project_key, environment_key, segment_key, opts = {}) ⇒ Array<(nil, Integer, Hash)>
Create big segment export Starts a new export process for a big segment. This is an export for a synced segment or a list-based segment that can include more than 15,000 entries.
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 create_big_segment_export_with_http_info(project_key, environment_key, segment_key, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: SegmentsApi.create_big_segment_export ...' 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.create_big_segment_export" 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.create_big_segment_export" 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.create_big_segment_export" end # resource path local_var_path = '/api/v2/segments/{projectKey}/{environmentKey}/{segmentKey}/exports'.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.create_big_segment_export", :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#create_big_segment_export\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#create_big_segment_import(project_key, environment_key, segment_key, opts = {}) ⇒ nil
Create big segment import Start a new import process for a big segment. This is an import for a list-based segment that can include more than 15,000 entries.
107 108 109 110 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 107 def create_big_segment_import(project_key, environment_key, segment_key, opts = {}) create_big_segment_import_with_http_info(project_key, environment_key, segment_key, opts) nil end |
#create_big_segment_import_with_http_info(project_key, environment_key, segment_key, opts = {}) ⇒ Array<(nil, Integer, Hash)>
Create big segment import Start a new import process for a big segment. This is an import for a list-based segment that can include more than 15,000 entries.
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 176 177 178 179 180 181 182 183 184 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 122 def create_big_segment_import_with_http_info(project_key, environment_key, segment_key, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: SegmentsApi.create_big_segment_import ...' 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.create_big_segment_import" 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.create_big_segment_import" 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.create_big_segment_import" end # resource path local_var_path = '/api/v2/segments/{projectKey}/{environmentKey}/{segmentKey}/imports'.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(['multipart/form-data']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} form_params['file'] = opts[:'file'] if !opts[:'file'].nil? form_params['mode'] = opts[:'mode'] if !opts[:'mode'].nil? form_params['waitOnApprovals'] = opts[:'wait_on_approvals'] if !opts[:'wait_on_approvals'].nil? # 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.create_big_segment_import", :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#create_big_segment_import\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#delete_segment(project_key, environment_key, segment_key, opts = {}) ⇒ nil
Delete segment Delete a segment.
193 194 195 196 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 193 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.
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 251 252 253 254 255 256 257 258 259 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 205 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_big_segment_export(project_key, environment_key, segment_key, export_id, opts = {}) ⇒ Export
Get big segment export Returns information about a big segment export process. This is an export for a synced segment or a list-based segment that can include more than 15,000 entries.
269 270 271 272 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 269 def get_big_segment_export(project_key, environment_key, segment_key, export_id, opts = {}) data, _status_code, _headers = get_big_segment_export_with_http_info(project_key, environment_key, segment_key, export_id, opts) data end |
#get_big_segment_export_with_http_info(project_key, environment_key, segment_key, export_id, opts = {}) ⇒ Array<(Export, Integer, Hash)>
Get big segment export Returns information about a big segment export process. This is an export for a synced segment or a list-based segment that can include more than 15,000 entries.
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 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 282 def get_big_segment_export_with_http_info(project_key, environment_key, segment_key, export_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: SegmentsApi.get_big_segment_export ...' 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_big_segment_export" 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_big_segment_export" 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_big_segment_export" end # verify the required parameter 'export_id' is set if @api_client.config.client_side_validation && export_id.nil? fail ArgumentError, "Missing the required parameter 'export_id' when calling SegmentsApi.get_big_segment_export" end # resource path local_var_path = '/api/v2/segments/{projectKey}/{environmentKey}/{segmentKey}/exports/{exportID}'.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('{' + 'exportID' + '}', CGI.escape(export_id.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] || 'Export' # auth_names auth_names = opts[:debug_auth_names] || ['ApiKey'] = opts.merge( :operation => :"SegmentsApi.get_big_segment_export", :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_big_segment_export\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_big_segment_import(project_key, environment_key, segment_key, import_id, opts = {}) ⇒ Import
Get big segment import Returns information about a big segment import process. This is the import of a list-based segment that can include more than 15,000 entries.
350 351 352 353 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 350 def get_big_segment_import(project_key, environment_key, segment_key, import_id, opts = {}) data, _status_code, _headers = get_big_segment_import_with_http_info(project_key, environment_key, segment_key, import_id, opts) data end |
#get_big_segment_import_with_http_info(project_key, environment_key, segment_key, import_id, opts = {}) ⇒ Array<(Import, Integer, Hash)>
Get big segment import Returns information about a big segment import process. This is the import of a list-based segment that can include more than 15,000 entries.
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 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 363 def get_big_segment_import_with_http_info(project_key, environment_key, segment_key, import_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: SegmentsApi.get_big_segment_import ...' 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_big_segment_import" 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_big_segment_import" 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_big_segment_import" end # verify the required parameter 'import_id' is set if @api_client.config.client_side_validation && import_id.nil? fail ArgumentError, "Missing the required parameter 'import_id' when calling SegmentsApi.get_big_segment_import" end # resource path local_var_path = '/api/v2/segments/{projectKey}/{environmentKey}/{segmentKey}/imports/{importID}'.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('{' + 'importID' + '}', CGI.escape(import_id.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] || 'Import' # auth_names auth_names = opts[:debug_auth_names] || ['ApiKey'] = opts.merge( :operation => :"SegmentsApi.get_big_segment_import", :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_big_segment_import\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.
430 431 432 433 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 430 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.
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 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 442 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.
510 511 512 513 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 510 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.
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 563 564 565 566 567 568 569 570 571 572 573 574 575 576 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 522 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](launchdarkly.com/docs/api/segments/get-expiring-targets-for-segment) instead of this endpoint. To learn more, read [Contexts](launchdarkly.com/docs/home/observability/contexts). Get a list of a segment’s user targets that are scheduled for removal.
585 586 587 588 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 585 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](launchdarkly.com/docs/api/segments/get-expiring-targets-for-segment) instead of this endpoint. To learn more, read [Contexts](launchdarkly.com/docs/home/observability/contexts). Get a list of a segment's user targets that are scheduled for removal.
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 644 645 646 647 648 649 650 651 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 597 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.
660 661 662 663 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 660 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.
736 737 738 739 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 736 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.
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 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 749 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](launchdarkly.com/docs/api/segments/get-expiring-targets-for-segment) instead of this endpoint. To learn more, read [Contexts](launchdarkly.com/docs/home/observability/contexts). Get the membership status (included/excluded) for a given user in this big segment. This operation does not support standard segments.
817 818 819 820 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 817 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](launchdarkly.com/docs/api/segments/get-expiring-targets-for-segment) instead of this endpoint. To learn more, read [Contexts](launchdarkly.com/docs/home/observability/contexts). Get the membership status (included/excluded) for a given user in this big segment. This operation does not support standard segments.
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 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 830 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.
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 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 672 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`.
900 901 902 903 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 900 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`.
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 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 915 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](https://launchdarkly.com/docs/api#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>
979 980 981 982 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 979 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](https://launchdarkly.com/docs/api#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>
992 993 994 995 996 997 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 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 992 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](https://launchdarkly.com/docs/api/segments/patch-expiring-targets-for-segment) instead of this endpoint. To learn more, read [Contexts](https://launchdarkly.com/docs/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](https://launchdarkly.com/docs/api#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>
1065 1066 1067 1068 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 1065 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](https://launchdarkly.com/docs/api/segments/patch-expiring-targets-for-segment) instead of this endpoint. To learn more, read [Contexts](https://launchdarkly.com/docs/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](https://launchdarkly.com/docs/api#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>
1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 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 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 1078 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](launchdarkly.com/docs/api#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](launchdarkly.com/docs/api#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](launchdarkly.com/docs/home/flags/segments-create#create-larger-list-based-segments). #### addBigSegmentExcludedTargets For use with [larger list-based segments](launchdarkly.com/docs/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](launchdarkly.com/docs/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](launchdarkly.com/docs/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](launchdarkly.com/docs/api/segments/create-big-segment-import) request. Here’s an example: “‘json { "instructions": [{ "kind": "processBigSegmentImport", "importId": "a902ef4a-2faf-4eaf-88e1-ecc356708a29" }] } “` #### removeBigSegmentExcludedTargets For use with [larger list-based segments](launchdarkly.com/docs/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](launchdarkly.com/docs/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](launchdarkly.com/docs/api#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.
1151 1152 1153 1154 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 1151 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](launchdarkly.com/docs/api#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](launchdarkly.com/docs/api#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](launchdarkly.com/docs/home/flags/segments-create#create-larger-list-based-segments). #### addBigSegmentExcludedTargets For use with [larger list-based segments](launchdarkly.com/docs/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](launchdarkly.com/docs/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](launchdarkly.com/docs/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](launchdarkly.com/docs/api/segments/create-big-segment-import) request. Here's an example: ```json { "instructions": [{ "kind": "processBigSegmentImport", "importId": "a902ef4a-2faf-4eaf-88e1-ecc356708a29" }] } ``` #### removeBigSegmentExcludedTargets For use with [larger list-based segments](launchdarkly.com/docs/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](launchdarkly.com/docs/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](launchdarkly.com/docs/api#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.
1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 1164 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.
1236 1237 1238 1239 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 1236 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.
1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 1248 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.
1317 1318 1319 1320 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 1317 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.
1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 1330 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.
1403 1404 1405 1406 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 1403 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.
1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 |
# File 'lib/launchdarkly_api/api/segments_api.rb', line 1416 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 |