Class: LaunchDarklyApi::UsersApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ UsersApi

Returns a new instance of UsersApi.



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

def api_client
  @api_client
end

Instance Method Details

#delete_user(project_key, environment_key, user_key, opts = {}) ⇒ nil

Delete user

Use contexts instead > > After you have upgraded your LaunchDarkly SDK to use contexts instead of users, you should use Delete context instances instead of this endpoint. Delete a user by key.

Parameters:

  • project_key (String)

    The project key

  • environment_key (String)

    The environment key

  • user_key (String)

    The user key

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

    the optional parameters

Returns:

  • (nil)


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

def delete_user(project_key, environment_key, user_key, opts = {})
  delete_user_with_http_info(project_key, environment_key, user_key, opts)
  nil
end

#delete_user_with_http_info(project_key, environment_key, user_key, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Delete user > ### Use contexts instead > > After you have upgraded your LaunchDarkly SDK to use contexts instead of users, you should use Delete context instances instead of this endpoint. Delete a user by key.

Parameters:

  • project_key (String)

    The project key

  • environment_key (String)

    The environment key

  • user_key (String)

    The user key

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/launchdarkly_api/api/users_api.rb', line 41

def delete_user_with_http_info(project_key, environment_key, user_key, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: UsersApi.delete_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 UsersApi.delete_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 UsersApi.delete_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 UsersApi.delete_user"
  end
  # resource path
  local_var_path = '/api/v2/users/{projectKey}/{environmentKey}/{userKey}'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.to_s)).sub('{' + 'environmentKey' + '}', CGI.escape(environment_key.to_s)).sub('{' + 'userKey' + '}', CGI.escape(user_key.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type]

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKey']

  new_options = opts.merge(
    :operation => :"UsersApi.delete_user",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: UsersApi#delete_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_search_users(project_key, environment_key, opts = {}) ⇒ Users

Find users

Parameters:

  • project_key (String)

    The project key

  • environment_key (String)

    The environment key

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

    the optional parameters

Options Hash (opts):

  • :q (String)

    Full-text search for users based on name, first name, last name, e-mail address, or key

  • :limit (Integer)

    Specifies the maximum number of items in the collection to return (max: 50, default: 20)

  • :search_after (String)

    Limits results to users with sort values after the value you specify. You can use this for pagination, but we recommend using the `next` link we provide instead.

  • :filter (String)

    A comma-separated list of user attribute filters. Each filter is in the form of attributeKey:attributeValue

Returns:



107
108
109
110
# File 'lib/launchdarkly_api/api/users_api.rb', line 107

def get_search_users(project_key, environment_key, opts = {})
  data, _status_code, _headers = get_search_users_with_http_info(project_key, environment_key, opts)
  data
end

#get_search_users_with_http_info(project_key, environment_key, opts = {}) ⇒ Array<(Users, Integer, Hash)>

Find users > ### Use contexts instead > > After you have upgraded your LaunchDarkly SDK to use contexts instead of users, you should use Search for context instances instead of this endpoint. Search users in LaunchDarkly based on their last active date, a user attribute filter set, or a search query. An example user attribute filter set is `filter=firstName:Anna,activeTrial:false`. This matches users that have the user attribute `firstName` set to `Anna`, that also have the attribute `activeTrial` set to `false`. To paginate through results, follow the `next` link in the `_links` object. To learn more, read Representations.

Parameters:

  • project_key (String)

    The project key

  • environment_key (String)

    The environment key

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

    the optional parameters

Options Hash (opts):

  • :q (String)

    Full-text search for users based on name, first name, last name, e-mail address, or key

  • :limit (Integer)

    Specifies the maximum number of items in the collection to return (max: 50, default: 20)

  • :search_after (String)

    Limits results to users with sort values after the value you specify. You can use this for pagination, but we recommend using the `next` link we provide instead.

  • :filter (String)

    A comma-separated list of user attribute filters. Each filter is in the form of attributeKey:attributeValue

Returns:

  • (Array<(Users, Integer, Hash)>)

    Users data, response status code and response headers



122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
# File 'lib/launchdarkly_api/api/users_api.rb', line 122

def get_search_users_with_http_info(project_key, environment_key, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: UsersApi.get_search_users ...'
  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 UsersApi.get_search_users"
  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 UsersApi.get_search_users"
  end
  # resource path
  local_var_path = '/api/v2/user-search/{projectKey}/{environmentKey}'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.to_s)).sub('{' + 'environmentKey' + '}', CGI.escape(environment_key.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'q'] = opts[:'q'] if !opts[:'q'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'searchAfter'] = opts[:'search_after'] if !opts[:'search_after'].nil?
  query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Users'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKey']

  new_options = opts.merge(
    :operation => :"UsersApi.get_search_users",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: UsersApi#get_search_users\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_user(project_key, environment_key, user_key, opts = {}) ⇒ UserRecord

Get user

Use contexts instead > > After you have upgraded your LaunchDarkly SDK to use contexts instead of users, you should use Get context instances instead of this endpoint. Get a user by key. The user object contains all attributes sent in variation calls for that key.

Parameters:

  • project_key (String)

    The project key

  • environment_key (String)

    The environment key

  • user_key (String)

    The user key

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

    the optional parameters

Returns:



185
186
187
188
# File 'lib/launchdarkly_api/api/users_api.rb', line 185

def get_user(project_key, environment_key, user_key, opts = {})
  data, _status_code, _headers = get_user_with_http_info(project_key, environment_key, user_key, opts)
  data
end

#get_user_with_http_info(project_key, environment_key, user_key, opts = {}) ⇒ Array<(UserRecord, Integer, Hash)>

Get user > ### Use contexts instead > > After you have upgraded your LaunchDarkly SDK to use contexts instead of users, you should use Get context instances instead of this endpoint. Get a user by key. The `user` object contains all attributes sent in `variation` calls for that key.

Parameters:

  • project_key (String)

    The project key

  • environment_key (String)

    The environment key

  • user_key (String)

    The user key

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

    the optional parameters

Returns:

  • (Array<(UserRecord, Integer, Hash)>)

    UserRecord data, response status code and response headers



197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
# File 'lib/launchdarkly_api/api/users_api.rb', line 197

def get_user_with_http_info(project_key, environment_key, user_key, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: UsersApi.get_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 UsersApi.get_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 UsersApi.get_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 UsersApi.get_user"
  end
  # resource path
  local_var_path = '/api/v2/users/{projectKey}/{environmentKey}/{userKey}'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.to_s)).sub('{' + 'environmentKey' + '}', CGI.escape(environment_key.to_s)).sub('{' + 'userKey' + '}', CGI.escape(user_key.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'UserRecord'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKey']

  new_options = opts.merge(
    :operation => :"UsersApi.get_user",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: UsersApi#get_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_users(project_key, environment_key, opts = {}) ⇒ UsersRep

List users

Parameters:

  • project_key (String)

    The project key

  • environment_key (String)

    The environment key

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

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    The number of elements to return per page

  • :search_after (String)

    Limits results to users with sort values after the value you specify. You can use this for pagination, but we recommend using the `next` link we provide instead.

Returns:



261
262
263
264
# File 'lib/launchdarkly_api/api/users_api.rb', line 261

def get_users(project_key, environment_key, opts = {})
  data, _status_code, _headers = get_users_with_http_info(project_key, environment_key, opts)
  data
end

#get_users_with_http_info(project_key, environment_key, opts = {}) ⇒ Array<(UsersRep, Integer, Hash)>

List users > ### Use contexts instead > > After you have upgraded your LaunchDarkly SDK to use contexts instead of users, you should use Search for contexts instead of this endpoint. List all users in the environment. Includes the total count of users. This is useful for exporting all users in the system for further analysis. Each page displays users up to a set `limit`. The default is 20. To page through, follow the `next` link in the `_links` object. To learn more, read Representations.

Parameters:

  • project_key (String)

    The project key

  • environment_key (String)

    The environment key

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

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    The number of elements to return per page

  • :search_after (String)

    Limits results to users with sort values after the value you specify. You can use this for pagination, but we recommend using the `next` link we provide instead.

Returns:

  • (Array<(UsersRep, Integer, Hash)>)

    UsersRep data, response status code and response headers



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

def get_users_with_http_info(project_key, environment_key, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: UsersApi.get_users ...'
  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 UsersApi.get_users"
  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 UsersApi.get_users"
  end
  # resource path
  local_var_path = '/api/v2/users/{projectKey}/{environmentKey}'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.to_s)).sub('{' + 'environmentKey' + '}', CGI.escape(environment_key.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'searchAfter'] = opts[:'search_after'] if !opts[:'search_after'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'UsersRep'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKey']

  new_options = opts.merge(
    :operation => :"UsersApi.get_users",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: UsersApi#get_users\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end