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

#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)


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

def delete_feature_flag(project_key, feature_flag_key, opts = {})
  delete_feature_flag_with_http_info(project_key, feature_flag_key, opts)
  return 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



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

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&#39;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&#x3D;production will restrict the returned configurations to just your production environment.

Returns:



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

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)
  return 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:



154
155
156
157
# File 'lib/launchdarkly_api/api/feature_flags_api.rb', line 154

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)
  return data
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



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
207
208
209
210
211
212
# File 'lib/launchdarkly_api/api/feature_flags_api.rb', line 166

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:



220
221
222
223
# File 'lib/launchdarkly_api/api/feature_flags_api.rb', line 220

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)
  return 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



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
268
269
270
271
272
273
# File 'lib/launchdarkly_api/api/feature_flags_api.rb', line 231

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 (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;production will restrict the returned configurations to just your production environment.

Returns:

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

    FeatureFlag data, response status code and response headers



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

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&#x3D;production will restrict the returned configurations to just your production environment.

  • :tag (String)

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

Returns:



282
283
284
285
# File 'lib/launchdarkly_api/api/feature_flags_api.rb', line 282

def get_feature_flags(project_key, opts = {})
  data, _status_code, _headers = get_feature_flags_with_http_info(project_key, opts)
  return 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&#x3D;production will restrict the returned configurations to just your production environment.

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



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

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[:'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&#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:



343
344
345
346
# File 'lib/launchdarkly_api/api/feature_flags_api.rb', line 343

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)
  return 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



355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
# File 'lib/launchdarkly_api/api/feature_flags_api.rb', line 355

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 = {}) ⇒ nil

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

Returns:

  • (nil)


409
410
411
412
# File 'lib/launchdarkly_api/api/feature_flags_api.rb', line 409

def post_feature_flag(project_key, feature_flag_body, opts = {})
  post_feature_flag_with_http_info(project_key, feature_flag_body, opts)
  return nil
end

#post_feature_flag_with_http_info(project_key, feature_flag_body, opts = {}) ⇒ Array<(nil, 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

Returns:

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

    nil, response status code and response headers



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
448
449
450
451
452
453
454
455
456
457
458
459
460
461
# File 'lib/launchdarkly_api/api/feature_flags_api.rb', line 420

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

  # 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)
  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