Class: LaunchDarklyApi::UserSettingsApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ UserSettingsApi

Returns a new instance of UserSettingsApi.



19
20
21
# File 'lib/launchdarkly_api/api/user_settings_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/user_settings_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#get_expiring_user_targets_for_user(project_key, environment_key, user_key, opts = {}) ⇒ UserTargetingExpirationOnFlagsForUser

Get expiring dates on flags for user

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.

  • user_key

    The user's key.

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

    the optional parameters

Returns:



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

def get_expiring_user_targets_for_user(project_key, environment_key, user_key, opts = {})
  data, _status_code, _headers = get_expiring_user_targets_for_user_with_http_info(project_key, environment_key, user_key, opts)
  data
end

#get_expiring_user_targets_for_user_with_http_info(project_key, environment_key, user_key, opts = {}) ⇒ Array<(UserTargetingExpirationOnFlagsForUser, Fixnum, Hash)>

Get expiring dates on flags for user

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.

  • user_key

    The user&#39;s key.

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

    the optional parameters

Returns:



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/user_settings_api.rb', line 39

def get_expiring_user_targets_for_user_with_http_info(project_key, environment_key, user_key, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: UserSettingsApi.get_expiring_user_targets_for_user ...'
  end
  # verify the required parameter 'project_key' is set
  if @api_client.config.client_side_validation && project_key.nil?
    fail ArgumentError, "Missing the required parameter 'project_key' when calling UserSettingsApi.get_expiring_user_targets_for_user"
  end
  # verify the required parameter 'environment_key' is set
  if @api_client.config.client_side_validation && environment_key.nil?
    fail ArgumentError, "Missing the required parameter 'environment_key' when calling UserSettingsApi.get_expiring_user_targets_for_user"
  end
  # verify the required parameter 'user_key' is set
  if @api_client.config.client_side_validation && user_key.nil?
    fail ArgumentError, "Missing the required parameter 'user_key' when calling UserSettingsApi.get_expiring_user_targets_for_user"
  end
  # resource path
  local_var_path = '/users/{projectKey}/{userKey}/expiring-user-targets/{environmentKey}'.sub('{' + 'projectKey' + '}', project_key.to_s).sub('{' + 'environmentKey' + '}', environment_key.to_s).sub('{' + 'userKey' + '}', user_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 => 'UserTargetingExpirationOnFlagsForUser')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: UserSettingsApi#get_expiring_user_targets_for_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_user_flag_setting(project_key, environment_key, user_key, feature_flag_key, opts = {}) ⇒ UserFlagSetting

Fetch a single flag setting for a user by key.

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.

  • user_key

    The user&#39;s key.

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



93
94
95
96
# File 'lib/launchdarkly_api/api/user_settings_api.rb', line 93

def get_user_flag_setting(project_key, environment_key, user_key, feature_flag_key, opts = {})
  data, _status_code, _headers = get_user_flag_setting_with_http_info(project_key, environment_key, user_key, feature_flag_key, opts)
  data
end

#get_user_flag_setting_with_http_info(project_key, environment_key, user_key, feature_flag_key, opts = {}) ⇒ Array<(UserFlagSetting, Fixnum, Hash)>

Fetch a single flag setting for a user by key.

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.

  • user_key

    The user&#39;s key.

  • 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<(UserFlagSetting, Fixnum, Hash)>)

    UserFlagSetting data, response status code and response headers



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
146
147
148
149
150
151
152
153
154
155
# File 'lib/launchdarkly_api/api/user_settings_api.rb', line 105

def get_user_flag_setting_with_http_info(project_key, environment_key, user_key, feature_flag_key, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: UserSettingsApi.get_user_flag_setting ...'
  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 UserSettingsApi.get_user_flag_setting"
  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 UserSettingsApi.get_user_flag_setting"
  end
  # verify the required parameter 'user_key' is set
  if @api_client.config.client_side_validation && user_key.nil?
    fail ArgumentError, "Missing the required parameter 'user_key' when calling UserSettingsApi.get_user_flag_setting"
  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 UserSettingsApi.get_user_flag_setting"
  end
  # resource path
  local_var_path = '/users/{projectKey}/{environmentKey}/{userKey}/flags/{featureFlagKey}'.sub('{' + 'projectKey' + '}', project_key.to_s).sub('{' + 'environmentKey' + '}', environment_key.to_s).sub('{' + 'userKey' + '}', user_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 => 'UserFlagSetting')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: UserSettingsApi#get_user_flag_setting\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_user_flag_settings(project_key, environment_key, user_key, opts = {}) ⇒ UserFlagSettings

Fetch a single flag setting for a user by key.

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.

  • user_key

    The user&#39;s key.

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

    the optional parameters

Returns:



162
163
164
165
# File 'lib/launchdarkly_api/api/user_settings_api.rb', line 162

def get_user_flag_settings(project_key, environment_key, user_key, opts = {})
  data, _status_code, _headers = get_user_flag_settings_with_http_info(project_key, environment_key, user_key, opts)
  data
end

#get_user_flag_settings_with_http_info(project_key, environment_key, user_key, opts = {}) ⇒ Array<(UserFlagSettings, Fixnum, Hash)>

Fetch a single flag setting for a user by key.

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.

  • user_key

    The user&#39;s key.

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

    the optional parameters

Returns:

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

    UserFlagSettings data, response status code and response headers



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
213
214
215
216
217
218
219
# File 'lib/launchdarkly_api/api/user_settings_api.rb', line 173

def get_user_flag_settings_with_http_info(project_key, environment_key, user_key, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: UserSettingsApi.get_user_flag_settings ...'
  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 UserSettingsApi.get_user_flag_settings"
  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 UserSettingsApi.get_user_flag_settings"
  end
  # verify the required parameter 'user_key' is set
  if @api_client.config.client_side_validation && user_key.nil?
    fail ArgumentError, "Missing the required parameter 'user_key' when calling UserSettingsApi.get_user_flag_settings"
  end
  # resource path
  local_var_path = '/users/{projectKey}/{environmentKey}/{userKey}/flags'.sub('{' + 'projectKey' + '}', project_key.to_s).sub('{' + 'environmentKey' + '}', environment_key.to_s).sub('{' + 'userKey' + '}', user_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 => 'UserFlagSettings')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: UserSettingsApi#get_user_flag_settings\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#patch_expiring_user_targets_for_flags(project_key, environment_key, user_key, patch_comment, opts = {}) ⇒ UserTargetingExpirationOnFlagsForUser

Update, add, or delete expiring user targets for a single user on all flags

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.

  • user_key

    The user&#39;s key.

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



227
228
229
230
# File 'lib/launchdarkly_api/api/user_settings_api.rb', line 227

def patch_expiring_user_targets_for_flags(project_key, environment_key, user_key, patch_comment, opts = {})
  data, _status_code, _headers = patch_expiring_user_targets_for_flags_with_http_info(project_key, environment_key, user_key, patch_comment, opts)
  data
end

#patch_expiring_user_targets_for_flags_with_http_info(project_key, environment_key, user_key, patch_comment, opts = {}) ⇒ Array<(UserTargetingExpirationOnFlagsForUser, Fixnum, Hash)>

Update, add, or delete expiring user targets for a single user on all flags

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.

  • user_key

    The user&#39;s key.

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



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
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
# File 'lib/launchdarkly_api/api/user_settings_api.rb', line 239

def patch_expiring_user_targets_for_flags_with_http_info(project_key, environment_key, user_key, patch_comment, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: UserSettingsApi.patch_expiring_user_targets_for_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 UserSettingsApi.patch_expiring_user_targets_for_flags"
  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 UserSettingsApi.patch_expiring_user_targets_for_flags"
  end
  # verify the required parameter 'user_key' is set
  if @api_client.config.client_side_validation && user_key.nil?
    fail ArgumentError, "Missing the required parameter 'user_key' when calling UserSettingsApi.patch_expiring_user_targets_for_flags"
  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 UserSettingsApi.patch_expiring_user_targets_for_flags"
  end
  # resource path
  local_var_path = '/users/{projectKey}/{userKey}/expiring-user-targets/{environmentKey}'.sub('{' + 'projectKey' + '}', project_key.to_s).sub('{' + 'environmentKey' + '}', environment_key.to_s).sub('{' + 'userKey' + '}', user_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 => 'UserTargetingExpirationOnFlagsForUser')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: UserSettingsApi#patch_expiring_user_targets_for_flags\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#put_flag_setting(project_key, environment_key, user_key, feature_flag_key, user_settings_body, opts = {}) ⇒ nil

Specifically enable or disable a feature flag for a user based on their key.

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.

  • user_key

    The user&#39;s key.

  • feature_flag_key

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

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

    the optional parameters

Returns:

  • (nil)


298
299
300
301
# File 'lib/launchdarkly_api/api/user_settings_api.rb', line 298

def put_flag_setting(project_key, environment_key, user_key, feature_flag_key, , opts = {})
  put_flag_setting_with_http_info(project_key, environment_key, user_key, feature_flag_key, , opts)
  nil
end

#put_flag_setting_with_http_info(project_key, environment_key, user_key, feature_flag_key, user_settings_body, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Specifically enable or disable a feature flag for a user based on their key.

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.

  • user_key

    The user&#39;s key.

  • feature_flag_key

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

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
# File 'lib/launchdarkly_api/api/user_settings_api.rb', line 311

def put_flag_setting_with_http_info(project_key, environment_key, user_key, feature_flag_key, , opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: UserSettingsApi.put_flag_setting ...'
  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 UserSettingsApi.put_flag_setting"
  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 UserSettingsApi.put_flag_setting"
  end
  # verify the required parameter 'user_key' is set
  if @api_client.config.client_side_validation && user_key.nil?
    fail ArgumentError, "Missing the required parameter 'user_key' when calling UserSettingsApi.put_flag_setting"
  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 UserSettingsApi.put_flag_setting"
  end
  # verify the required parameter 'user_settings_body' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'user_settings_body' when calling UserSettingsApi.put_flag_setting"
  end
  # resource path
  local_var_path = '/users/{projectKey}/{environmentKey}/{userKey}/flags/{featureFlagKey}'.sub('{' + 'projectKey' + '}', project_key.to_s).sub('{' + 'environmentKey' + '}', environment_key.to_s).sub('{' + 'userKey' + '}', user_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()
  auth_names = ['Token']
  data, status_code, headers = @api_client.call_api(:PUT, 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: UserSettingsApi#put_flag_setting\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end