Class: LaunchDarklyApi::FeatureFlagsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/launchdarkly_api/api/feature_flags_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ FeatureFlagsApi

Returns a new instance of FeatureFlagsApi.



19
20
21
# File 'lib/launchdarkly_api/api/feature_flags_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/launchdarkly_api/api/feature_flags_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#copy_feature_flag(project_key, feature_flag_key, feature_flag_copy_body, opts = {}) ⇒ FeatureFlag

Copies the feature flag configuration from one environment to the same feature flag in another environment.

Parameters:

  • project_key

    The project key, used to tie the flags together under one project so they can be managed together.

  • feature_flag_key

    The feature flag's key. The key identifies the flag in your code.

  • feature_flag_copy_body

    Copy feature flag configurations between environments.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



28
29
30
31
# File 'lib/launchdarkly_api/api/feature_flags_api.rb', line 28

def copy_feature_flag(project_key, feature_flag_key, feature_flag_copy_body, opts = {})
  data, _status_code, _headers = copy_feature_flag_with_http_info(project_key, feature_flag_key, feature_flag_copy_body, opts)
  data
end

#copy_feature_flag_with_http_info(project_key, feature_flag_key, feature_flag_copy_body, opts = {}) ⇒ Array<(FeatureFlag, Fixnum, Hash)>

Copies the feature flag configuration from one environment to the same feature flag in another environment.

Parameters:

  • project_key

    The project key, used to tie the flags together under one project so they can be managed together.

  • feature_flag_key

    The feature flag&#39;s key. The key identifies the flag in your code.

  • feature_flag_copy_body

    Copy feature flag configurations between environments.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(FeatureFlag, Fixnum, Hash)>)

    FeatureFlag data, response status code and response headers



39
40
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
# File 'lib/launchdarkly_api/api/feature_flags_api.rb', line 39

def copy_feature_flag_with_http_info(project_key, feature_flag_key, feature_flag_copy_body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FeatureFlagsApi.copy_feature_flag ...'
  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 FeatureFlagsApi.copy_feature_flag"
  end
  # verify the required parameter 'feature_flag_key' is set
  if @api_client.config.client_side_validation && feature_flag_key.nil?
    fail ArgumentError, "Missing the required parameter 'feature_flag_key' when calling FeatureFlagsApi.copy_feature_flag"
  end
  # verify the required parameter 'feature_flag_copy_body' is set
  if @api_client.config.client_side_validation && feature_flag_copy_body.nil?
    fail ArgumentError, "Missing the required parameter 'feature_flag_copy_body' when calling FeatureFlagsApi.copy_feature_flag"
  end
  # resource path
  local_var_path = '/flags/{projectKey}/{featureFlagKey}/copy'.sub('{' + 'projectKey' + '}', project_key.to_s).sub('{' + 'featureFlagKey' + '}', feature_flag_key.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(feature_flag_copy_body)
  auth_names = ['Token']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'FeatureFlag')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FeatureFlagsApi#copy_feature_flag\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_feature_flag(project_key, feature_flag_key, opts = {}) ⇒ nil

Delete a feature flag in all environments. Be careful– only delete feature flags that are no longer being used by your application.

Parameters:

  • project_key

    The project key, used to tie the flags together under one project so they can be managed together.

  • feature_flag_key

    The feature flag&#39;s key. The key identifies the flag in your code.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (nil)


91
92
93
94
# File 'lib/launchdarkly_api/api/feature_flags_api.rb', line 91

def delete_feature_flag(project_key, feature_flag_key, opts = {})
  delete_feature_flag_with_http_info(project_key, feature_flag_key, opts)
  nil
end

#delete_feature_flag_with_http_info(project_key, feature_flag_key, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Delete a feature flag in all environments. Be careful– only delete feature flags that are no longer being used by your application.

Parameters:

  • project_key

    The project key, used to tie the flags together under one project so they can be managed together.

  • feature_flag_key

    The feature flag&#39;s key. The key identifies the flag in your code.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(nil, Fixnum, Hash)>)

    nil, response status code and response headers



101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# File 'lib/launchdarkly_api/api/feature_flags_api.rb', line 101

def delete_feature_flag_with_http_info(project_key, feature_flag_key, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FeatureFlagsApi.delete_feature_flag ...'
  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 FeatureFlagsApi.delete_feature_flag"
  end
  # verify the required parameter 'feature_flag_key' is set
  if @api_client.config.client_side_validation && feature_flag_key.nil?
    fail ArgumentError, "Missing the required parameter 'feature_flag_key' when calling FeatureFlagsApi.delete_feature_flag"
  end
  # resource path
  local_var_path = '/flags/{projectKey}/{featureFlagKey}'.sub('{' + 'projectKey' + '}', project_key.to_s).sub('{' + 'featureFlagKey' + '}', feature_flag_key.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['Token']
  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FeatureFlagsApi#delete_feature_flag\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_expiring_user_targets(project_key, environment_key, feature_flag_key, opts = {}) ⇒ UserTargetingExpirationForFlags

Get expiring user targets for feature flag

Parameters:

  • project_key

    The project key, used to tie the flags together under one project so they can be managed together.

  • environment_key

    The environment key, used to tie together flag configuration and users under one environment so they can be managed together.

  • feature_flag_key

    The feature flag&#39;s key. The key identifies the flag in your code.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



149
150
151
152
# File 'lib/launchdarkly_api/api/feature_flags_api.rb', line 149

def get_expiring_user_targets(project_key, environment_key, feature_flag_key, opts = {})
  data, _status_code, _headers = get_expiring_user_targets_with_http_info(project_key, environment_key, feature_flag_key, opts)
  data
end

#get_expiring_user_targets_with_http_info(project_key, environment_key, feature_flag_key, opts = {}) ⇒ Array<(UserTargetingExpirationForFlags, Fixnum, Hash)>

Get expiring user targets for feature flag

Parameters:

  • project_key

    The project key, used to tie the flags together under one project so they can be managed together.

  • environment_key

    The environment key, used to tie together flag configuration and users under one environment so they can be managed together.

  • feature_flag_key

    The feature flag&#39;s key. The key identifies the flag in your code.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
# File 'lib/launchdarkly_api/api/feature_flags_api.rb', line 160

def get_expiring_user_targets_with_http_info(project_key, environment_key, feature_flag_key, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FeatureFlagsApi.get_expiring_user_targets ...'
  end
  # verify the required parameter 'project_key' is set
  if @api_client.config.client_side_validation && project_key.nil?
    fail ArgumentError, "Missing the required parameter 'project_key' when calling FeatureFlagsApi.get_expiring_user_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 FeatureFlagsApi.get_expiring_user_targets"
  end
  # verify the required parameter 'feature_flag_key' is set
  if @api_client.config.client_side_validation && feature_flag_key.nil?
    fail ArgumentError, "Missing the required parameter 'feature_flag_key' when calling FeatureFlagsApi.get_expiring_user_targets"
  end
  # resource path
  local_var_path = '/flags/{projectKey}/{featureFlagKey}/expiring-user-targets/{environmentKey}'.sub('{' + 'projectKey' + '}', project_key.to_s).sub('{' + 'environmentKey' + '}', environment_key.to_s).sub('{' + 'featureFlagKey' + '}', feature_flag_key.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['Token']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'UserTargetingExpirationForFlags')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FeatureFlagsApi#get_expiring_user_targets\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_feature_flag(project_key, feature_flag_key, opts = {}) ⇒ FeatureFlag

Get a single feature flag by key.

Parameters:

  • project_key

    The project key, used to tie the flags together under one project so they can be managed together.

  • feature_flag_key

    The feature flag&#39;s key. The key identifies the flag in your code.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :env (Array<String>)

    By default, each feature will include configurations for each environment. You can filter environments with the env query parameter. For example, setting env&#x3D; will restrict the returned configurations to just your production environment.

Returns:



213
214
215
216
# File 'lib/launchdarkly_api/api/feature_flags_api.rb', line 213

def get_feature_flag(project_key, feature_flag_key, opts = {})
  data, _status_code, _headers = get_feature_flag_with_http_info(project_key, feature_flag_key, opts)
  data
end

#get_feature_flag_status(project_key, environment_key, feature_flag_key, opts = {}) ⇒ FeatureFlagStatus

Get the status for a particular feature flag.

Parameters:

  • project_key

    The project key, used to tie the flags together under one project so they can be managed together.

  • environment_key

    The environment key, used to tie together flag configuration and users under one environment so they can be managed together.

  • feature_flag_key

    The feature flag&#39;s key. The key identifies the flag in your code.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



274
275
276
277
# File 'lib/launchdarkly_api/api/feature_flags_api.rb', line 274

def get_feature_flag_status(project_key, environment_key, feature_flag_key, opts = {})
  data, _status_code, _headers = get_feature_flag_status_with_http_info(project_key, environment_key, feature_flag_key, opts)
  data
end

#get_feature_flag_status_across_environments(project_key, feature_flag_key, opts = {}) ⇒ FeatureFlagStatusAcrossEnvironments

Get the status for a particular feature flag across environments

Parameters:

  • project_key

    The project key, used to tie the flags together under one project so they can be managed together.

  • feature_flag_key

    The feature flag&#39;s key. The key identifies the flag in your code.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



337
338
339
340
# File 'lib/launchdarkly_api/api/feature_flags_api.rb', line 337

def get_feature_flag_status_across_environments(project_key, feature_flag_key, opts = {})
  data, _status_code, _headers = get_feature_flag_status_across_environments_with_http_info(project_key, feature_flag_key, opts)
  data
end

#get_feature_flag_status_across_environments_with_http_info(project_key, feature_flag_key, opts = {}) ⇒ Array<(FeatureFlagStatusAcrossEnvironments, Fixnum, Hash)>

Get the status for a particular feature flag across environments

Parameters:

  • project_key

    The project key, used to tie the flags together under one project so they can be managed together.

  • feature_flag_key

    The feature flag&#39;s key. The key identifies the flag in your code.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
# File 'lib/launchdarkly_api/api/feature_flags_api.rb', line 347

def get_feature_flag_status_across_environments_with_http_info(project_key, feature_flag_key, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FeatureFlagsApi.get_feature_flag_status_across_environments ...'
  end
  # verify the required parameter 'project_key' is set
  if @api_client.config.client_side_validation && project_key.nil?
    fail ArgumentError, "Missing the required parameter 'project_key' when calling FeatureFlagsApi.get_feature_flag_status_across_environments"
  end
  # verify the required parameter 'feature_flag_key' is set
  if @api_client.config.client_side_validation && feature_flag_key.nil?
    fail ArgumentError, "Missing the required parameter 'feature_flag_key' when calling FeatureFlagsApi.get_feature_flag_status_across_environments"
  end
  # resource path
  local_var_path = '/flag-status/{projectKey}/{featureFlagKey}'.sub('{' + 'projectKey' + '}', project_key.to_s).sub('{' + 'featureFlagKey' + '}', feature_flag_key.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['Token']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'FeatureFlagStatusAcrossEnvironments')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FeatureFlagsApi#get_feature_flag_status_across_environments\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_feature_flag_status_with_http_info(project_key, environment_key, feature_flag_key, opts = {}) ⇒ Array<(FeatureFlagStatus, Fixnum, Hash)>

Get the status for a particular feature flag.

Parameters:

  • project_key

    The project key, used to tie the flags together under one project so they can be managed together.

  • environment_key

    The environment key, used to tie together flag configuration and users under one environment so they can be managed together.

  • feature_flag_key

    The feature flag&#39;s key. The key identifies the flag in your code.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(FeatureFlagStatus, Fixnum, Hash)>)

    FeatureFlagStatus data, response status code and response headers



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
# File 'lib/launchdarkly_api/api/feature_flags_api.rb', line 285

def get_feature_flag_status_with_http_info(project_key, environment_key, feature_flag_key, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FeatureFlagsApi.get_feature_flag_status ...'
  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 FeatureFlagsApi.get_feature_flag_status"
  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 FeatureFlagsApi.get_feature_flag_status"
  end
  # verify the required parameter 'feature_flag_key' is set
  if @api_client.config.client_side_validation && feature_flag_key.nil?
    fail ArgumentError, "Missing the required parameter 'feature_flag_key' when calling FeatureFlagsApi.get_feature_flag_status"
  end
  # resource path
  local_var_path = '/flag-statuses/{projectKey}/{environmentKey}/{featureFlagKey}'.sub('{' + 'projectKey' + '}', project_key.to_s).sub('{' + 'environmentKey' + '}', environment_key.to_s).sub('{' + 'featureFlagKey' + '}', feature_flag_key.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['Token']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'FeatureFlagStatus')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FeatureFlagsApi#get_feature_flag_status\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_feature_flag_statuses(project_key, environment_key, opts = {}) ⇒ FeatureFlagStatuses

Get a list of statuses for all feature flags. The status includes the last time the feature flag was requested, as well as the state of the flag.

Parameters:

  • project_key

    The project key, used to tie the flags together under one project so they can be managed together.

  • environment_key

    The environment key, used to tie together flag configuration and users under one environment so they can be managed together.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



395
396
397
398
# File 'lib/launchdarkly_api/api/feature_flags_api.rb', line 395

def get_feature_flag_statuses(project_key, environment_key, opts = {})
  data, _status_code, _headers = get_feature_flag_statuses_with_http_info(project_key, environment_key, opts)
  data
end

#get_feature_flag_statuses_with_http_info(project_key, environment_key, opts = {}) ⇒ Array<(FeatureFlagStatuses, Fixnum, Hash)>

Get a list of statuses for all feature flags. The status includes the last time the feature flag was requested, as well as the state of the flag.

Parameters:

  • project_key

    The project key, used to tie the flags together under one project so they can be managed together.

  • environment_key

    The environment key, used to tie together flag configuration and users under one environment so they can be managed together.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(FeatureFlagStatuses, Fixnum, Hash)>)

    FeatureFlagStatuses data, response status code and response headers



405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
# File 'lib/launchdarkly_api/api/feature_flags_api.rb', line 405

def get_feature_flag_statuses_with_http_info(project_key, environment_key, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FeatureFlagsApi.get_feature_flag_statuses ...'
  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 FeatureFlagsApi.get_feature_flag_statuses"
  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 FeatureFlagsApi.get_feature_flag_statuses"
  end
  # resource path
  local_var_path = '/flag-statuses/{projectKey}/{environmentKey}'.sub('{' + 'projectKey' + '}', project_key.to_s).sub('{' + 'environmentKey' + '}', environment_key.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['Token']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'FeatureFlagStatuses')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FeatureFlagsApi#get_feature_flag_statuses\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_feature_flag_with_http_info(project_key, feature_flag_key, opts = {}) ⇒ Array<(FeatureFlag, Fixnum, Hash)>

Get a single feature flag by key.

Parameters:

  • project_key

    The project key, used to tie the flags together under one project so they can be managed together.

  • feature_flag_key

    The feature flag&#39;s key. The key identifies the flag in your code.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :env (Array<String>)

    By default, each feature will include configurations for each environment. You can filter environments with the env query parameter. For example, setting env&#x3D; will restrict the returned configurations to just your production environment.

Returns:

  • (Array<(FeatureFlag, Fixnum, Hash)>)

    FeatureFlag data, response status code and response headers



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
260
261
262
263
264
265
266
267
# File 'lib/launchdarkly_api/api/feature_flags_api.rb', line 224

def get_feature_flag_with_http_info(project_key, feature_flag_key, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FeatureFlagsApi.get_feature_flag ...'
  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 FeatureFlagsApi.get_feature_flag"
  end
  # verify the required parameter 'feature_flag_key' is set
  if @api_client.config.client_side_validation && feature_flag_key.nil?
    fail ArgumentError, "Missing the required parameter 'feature_flag_key' when calling FeatureFlagsApi.get_feature_flag"
  end
  # resource path
  local_var_path = '/flags/{projectKey}/{featureFlagKey}'.sub('{' + 'projectKey' + '}', project_key.to_s).sub('{' + 'featureFlagKey' + '}', feature_flag_key.to_s)

  # query parameters
  query_params = {}
  query_params[:'env'] = @api_client.build_collection_param(opts[:'env'], :multi) if !opts[:'env'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['Token']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'FeatureFlag')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FeatureFlagsApi#get_feature_flag\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_feature_flags(project_key, opts = {}) ⇒ FeatureFlags

Get a list of all features in the given project.

Parameters:

  • project_key

    The project key, used to tie the flags together under one project so they can be managed together.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :env (Array<String>)

    By default, each feature will include configurations for each environment. You can filter environments with the env query parameter. For example, setting env&#x3D; will restrict the returned configurations to just your production environment.

  • :summary (BOOLEAN)

    By default in api version &gt;&#x3D; 1, flags will not include their list of prerequisites, targets or rules. Set summary&#x3D;0 to include these fields for each flag returned.

  • :archived (BOOLEAN)

    When set to 1, archived flags will be included in the list of flags returned. By default, archived flags are not included in the list of flags.

  • :limit (Float)

    The number of objects to return. Defaults to -1, which returns everything.

  • :number (BOOLEAN)

    Where to start in the list. This is for use with pagination. For example, an offset of 10 would skip the first 10 items and then return the next limit items.

  • :filter (String)

    A comma-separated list of filters. Each filter is of the form field:value.

  • :sort (String)

    A comma-separated list of fields to sort by. A field prefixed by a - will be sorted in descending order.

  • :tag (String)

    Filter by tag. A tag can be used to group flags across projects.

Returns:



460
461
462
463
# File 'lib/launchdarkly_api/api/feature_flags_api.rb', line 460

def get_feature_flags(project_key, opts = {})
  data, _status_code, _headers = get_feature_flags_with_http_info(project_key, opts)
  data
end

#get_feature_flags_with_http_info(project_key, opts = {}) ⇒ Array<(FeatureFlags, Fixnum, Hash)>

Get a list of all features in the given project.

Parameters:

  • project_key

    The project key, used to tie the flags together under one project so they can be managed together.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :env (Array<String>)

    By default, each feature will include configurations for each environment. You can filter environments with the env query parameter. For example, setting env&#x3D; will restrict the returned configurations to just your production environment.

  • :summary (BOOLEAN)

    By default in api version &gt;&#x3D; 1, flags will not include their list of prerequisites, targets or rules. Set summary&#x3D;0 to include these fields for each flag returned.

  • :archived (BOOLEAN)

    When set to 1, archived flags will be included in the list of flags returned. By default, archived flags are not included in the list of flags.

  • :limit (Float)

    The number of objects to return. Defaults to -1, which returns everything.

  • :number (BOOLEAN)

    Where to start in the list. This is for use with pagination. For example, an offset of 10 would skip the first 10 items and then return the next limit items.

  • :filter (String)

    A comma-separated list of filters. Each filter is of the form field:value.

  • :sort (String)

    A comma-separated list of fields to sort by. A field prefixed by a - will be sorted in descending order.

  • :tag (String)

    Filter by tag. A tag can be used to group flags across projects.

Returns:

  • (Array<(FeatureFlags, Fixnum, Hash)>)

    FeatureFlags data, response status code and response headers



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
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
# File 'lib/launchdarkly_api/api/feature_flags_api.rb', line 477

def get_feature_flags_with_http_info(project_key, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FeatureFlagsApi.get_feature_flags ...'
  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 FeatureFlagsApi.get_feature_flags"
  end
  # resource path
  local_var_path = '/flags/{projectKey}'.sub('{' + 'projectKey' + '}', project_key.to_s)

  # query parameters
  query_params = {}
  query_params[:'env'] = @api_client.build_collection_param(opts[:'env'], :multi) if !opts[:'env'].nil?
  query_params[:'summary'] = opts[:'summary'] if !opts[:'summary'].nil?
  query_params[:'archived'] = opts[:'archived'] if !opts[:'archived'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'number'] = opts[:'number'] if !opts[:'number'].nil?
  query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?
  query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
  query_params[:'tag'] = opts[:'tag'] if !opts[:'tag'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['Token']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'FeatureFlags')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FeatureFlagsApi#get_feature_flags\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#patch_expiring_user_targets(project_key, environment_key, feature_flag_key, patch_comment, opts = {}) ⇒ UserTargetingExpirationForFlags

Update, add, or delete expiring user targets on feature flag

Parameters:

  • project_key

    The project key, used to tie the flags together under one project so they can be managed together.

  • environment_key

    The environment key, used to tie together flag configuration and users under one environment so they can be managed together.

  • feature_flag_key

    The feature flag&#39;s key. The key identifies the flag in your code.

  • patch_comment

    Requires a JSON Patch representation of the desired changes to the project, and an optional comment. &#39;jsonpatch.com/&#39; Feature flag patches also support JSON Merge Patch format. &#39;tools.ietf.org/html/rfc7386&#39; The addition of comments is also supported.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



531
532
533
534
# File 'lib/launchdarkly_api/api/feature_flags_api.rb', line 531

def patch_expiring_user_targets(project_key, environment_key, feature_flag_key, patch_comment, opts = {})
  data, _status_code, _headers = patch_expiring_user_targets_with_http_info(project_key, environment_key, feature_flag_key, patch_comment, opts)
  data
end

#patch_expiring_user_targets_with_http_info(project_key, environment_key, feature_flag_key, patch_comment, opts = {}) ⇒ Array<(UserTargetingExpirationForFlags, Fixnum, Hash)>

Update, add, or delete expiring user targets on feature flag

Parameters:

  • project_key

    The project key, used to tie the flags together under one project so they can be managed together.

  • environment_key

    The environment key, used to tie together flag configuration and users under one environment so they can be managed together.

  • feature_flag_key

    The feature flag&#39;s key. The key identifies the flag in your code.

  • patch_comment

    Requires a JSON Patch representation of the desired changes to the project, and an optional comment. &#39;jsonpatch.com/&#39; Feature flag patches also support JSON Merge Patch format. &#39;tools.ietf.org/html/rfc7386&#39; The addition of comments is also supported.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



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
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
# File 'lib/launchdarkly_api/api/feature_flags_api.rb', line 543

def patch_expiring_user_targets_with_http_info(project_key, environment_key, feature_flag_key, patch_comment, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FeatureFlagsApi.patch_expiring_user_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 FeatureFlagsApi.patch_expiring_user_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 FeatureFlagsApi.patch_expiring_user_targets"
  end
  # verify the required parameter 'feature_flag_key' is set
  if @api_client.config.client_side_validation && feature_flag_key.nil?
    fail ArgumentError, "Missing the required parameter 'feature_flag_key' when calling FeatureFlagsApi.patch_expiring_user_targets"
  end
  # verify the required parameter 'patch_comment' is set
  if @api_client.config.client_side_validation && patch_comment.nil?
    fail ArgumentError, "Missing the required parameter 'patch_comment' when calling FeatureFlagsApi.patch_expiring_user_targets"
  end
  # resource path
  local_var_path = '/flags/{projectKey}/{featureFlagKey}/expiring-user-targets/{environmentKey}'.sub('{' + 'projectKey' + '}', project_key.to_s).sub('{' + 'environmentKey' + '}', environment_key.to_s).sub('{' + 'featureFlagKey' + '}', feature_flag_key.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(patch_comment)
  auth_names = ['Token']
  data, status_code, headers = @api_client.call_api(:PATCH, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'UserTargetingExpirationForFlags')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FeatureFlagsApi#patch_expiring_user_targets\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#patch_feature_flag(project_key, feature_flag_key, patch_comment, opts = {}) ⇒ FeatureFlag

Perform a partial update to a feature.

Parameters:

  • project_key

    The project key, used to tie the flags together under one project so they can be managed together.

  • feature_flag_key

    The feature flag&#39;s key. The key identifies the flag in your code.

  • patch_comment

    Requires a JSON Patch representation of the desired changes to the project, and an optional comment. &#39;jsonpatch.com/&#39; Feature flag patches also support JSON Merge Patch format. &#39;tools.ietf.org/html/rfc7386&#39; The addition of comments is also supported.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



600
601
602
603
# File 'lib/launchdarkly_api/api/feature_flags_api.rb', line 600

def patch_feature_flag(project_key, feature_flag_key, patch_comment, opts = {})
  data, _status_code, _headers = patch_feature_flag_with_http_info(project_key, feature_flag_key, patch_comment, opts)
  data
end

#patch_feature_flag_with_http_info(project_key, feature_flag_key, patch_comment, opts = {}) ⇒ Array<(FeatureFlag, Fixnum, Hash)>

Perform a partial update to a feature.

Parameters:

  • project_key

    The project key, used to tie the flags together under one project so they can be managed together.

  • feature_flag_key

    The feature flag&#39;s key. The key identifies the flag in your code.

  • patch_comment

    Requires a JSON Patch representation of the desired changes to the project, and an optional comment. &#39;jsonpatch.com/&#39; Feature flag patches also support JSON Merge Patch format. &#39;tools.ietf.org/html/rfc7386&#39; The addition of comments is also supported.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(FeatureFlag, Fixnum, Hash)>)

    FeatureFlag data, response status code and response headers



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
652
653
654
655
656
657
# File 'lib/launchdarkly_api/api/feature_flags_api.rb', line 611

def patch_feature_flag_with_http_info(project_key, feature_flag_key, patch_comment, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FeatureFlagsApi.patch_feature_flag ...'
  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 FeatureFlagsApi.patch_feature_flag"
  end
  # verify the required parameter 'feature_flag_key' is set
  if @api_client.config.client_side_validation && feature_flag_key.nil?
    fail ArgumentError, "Missing the required parameter 'feature_flag_key' when calling FeatureFlagsApi.patch_feature_flag"
  end
  # verify the required parameter 'patch_comment' is set
  if @api_client.config.client_side_validation && patch_comment.nil?
    fail ArgumentError, "Missing the required parameter 'patch_comment' when calling FeatureFlagsApi.patch_feature_flag"
  end
  # resource path
  local_var_path = '/flags/{projectKey}/{featureFlagKey}'.sub('{' + 'projectKey' + '}', project_key.to_s).sub('{' + 'featureFlagKey' + '}', feature_flag_key.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(patch_comment)
  auth_names = ['Token']
  data, status_code, headers = @api_client.call_api(:PATCH, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'FeatureFlag')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FeatureFlagsApi#patch_feature_flag\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#post_feature_flag(project_key, feature_flag_body, opts = {}) ⇒ FeatureFlag

Creates a new feature flag.

Parameters:

  • project_key

    The project key, used to tie the flags together under one project so they can be managed together.

  • feature_flag_body

    Create a new feature flag.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :clone (String)

    The key of the feature flag to be cloned. The key identifies the flag in your code. For example, setting clone&#x3D;flagKey will copy the full targeting configuration for all environments (including on/off state) from the original flag to the new flag.

Returns:



664
665
666
667
# File 'lib/launchdarkly_api/api/feature_flags_api.rb', line 664

def post_feature_flag(project_key, feature_flag_body, opts = {})
  data, _status_code, _headers = post_feature_flag_with_http_info(project_key, feature_flag_body, opts)
  data
end

#post_feature_flag_with_http_info(project_key, feature_flag_body, opts = {}) ⇒ Array<(FeatureFlag, Fixnum, Hash)>

Creates a new feature flag.

Parameters:

  • project_key

    The project key, used to tie the flags together under one project so they can be managed together.

  • feature_flag_body

    Create a new feature flag.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :clone (String)

    The key of the feature flag to be cloned. The key identifies the flag in your code. For example, setting clone&#x3D;flagKey will copy the full targeting configuration for all environments (including on/off state) from the original flag to the new flag.

Returns:

  • (Array<(FeatureFlag, Fixnum, Hash)>)

    FeatureFlag data, response status code and response headers



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
# File 'lib/launchdarkly_api/api/feature_flags_api.rb', line 675

def post_feature_flag_with_http_info(project_key, feature_flag_body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FeatureFlagsApi.post_feature_flag ...'
  end
  # verify the required parameter 'project_key' is set
  if @api_client.config.client_side_validation && project_key.nil?
    fail ArgumentError, "Missing the required parameter 'project_key' when calling FeatureFlagsApi.post_feature_flag"
  end
  # verify the required parameter 'feature_flag_body' is set
  if @api_client.config.client_side_validation && feature_flag_body.nil?
    fail ArgumentError, "Missing the required parameter 'feature_flag_body' when calling FeatureFlagsApi.post_feature_flag"
  end
  # resource path
  local_var_path = '/flags/{projectKey}'.sub('{' + 'projectKey' + '}', project_key.to_s)

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

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(feature_flag_body)
  auth_names = ['Token']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'FeatureFlag')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FeatureFlagsApi#post_feature_flag\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end