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_client ⇒ Object

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'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'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'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_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's key. The key identifies the flag in your code.

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

    the optional parameters

Options Hash (opts):

  • :env (String) —

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

Returns:



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

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's key. The key identifies the flag in your code.

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

    the optional parameters

Returns:



210
211
212
213
# File 'lib/launchdarkly_api/api/feature_flags_api.rb', line 210

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's key. The key identifies the flag in your code.

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

    the optional parameters

Returns:



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

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's key. The key identifies the flag in your code.

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

    the optional parameters

Returns:



283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
# File 'lib/launchdarkly_api/api/feature_flags_api.rb', line 283

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'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



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

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:



331
332
333
334
# File 'lib/launchdarkly_api/api/feature_flags_api.rb', line 331

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



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

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's key. The key identifies the flag in your code.

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

    the optional parameters

Options Hash (opts):

  • :env (String) —

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

Returns:

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

    FeatureFlag data, response status code and response headers



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

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'] = opts[:'env'] 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 (String) —

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

  • :summary (BOOLEAN) —

    By default in api version >= 1, flags will not include their list of prerequisites, targets or rules. Set summary=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.

  • :tag (String) —

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

Returns:



392
393
394
395
# File 'lib/launchdarkly_api/api/feature_flags_api.rb', line 392

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 (String) —

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

  • :summary (BOOLEAN) —

    By default in api version >= 1, flags will not include their list of prerequisites, targets or rules. Set summary=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.

  • :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



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_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'] = opts[:'env'] if !opts[:'env'].nil?
  query_params[:'summary'] = opts[:'summary'] if !opts[:'summary'].nil?
  query_params[:'archived'] = opts[:'archived'] if !opts[:'archived'].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_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'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. 'http://jsonpatch.com/' Feature flag patches also support JSON Merge Patch format. 'https://tools.ietf.org/html/rfc7386' The addition of comments is also supported.

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

    the optional parameters

Returns:



454
455
456
457
# File 'lib/launchdarkly_api/api/feature_flags_api.rb', line 454

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'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. 'http://jsonpatch.com/' Feature flag patches also support JSON Merge Patch format. 'https://tools.ietf.org/html/rfc7386' 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



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
502
503
504
505
506
507
508
509
510
511
# File 'lib/launchdarkly_api/api/feature_flags_api.rb', line 465

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=flagKey will copy the full targeting configuration for all environments (including on/off state) from the original flag to the new flag.

Returns:



518
519
520
521
# File 'lib/launchdarkly_api/api/feature_flags_api.rb', line 518

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=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



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

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