Class: LaunchDarklyApi::ViewsBetaApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ ViewsBetaApi

Returns a new instance of ViewsBetaApi.



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

def api_client
  @api_client
end

Instance Method Details

#create_view(ld_api_version, project_key, view_post, opts = {}) ⇒ View

Create view Create a new view in the given project.

Parameters:

  • ld_api_version (String)

    Version of the endpoint.

  • project_key (String)
  • view_post (ViewPost)

    View object to create

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

    the optional parameters

Returns:



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

def create_view(ld_api_version, project_key, view_post, opts = {})
  data, _status_code, _headers = create_view_with_http_info(ld_api_version, project_key, view_post, opts)
  data
end

#create_view_with_http_info(ld_api_version, project_key, view_post, opts = {}) ⇒ Array<(View, Integer, Hash)>

Create view Create a new view in the given project.

Parameters:

  • ld_api_version (String)

    Version of the endpoint.

  • project_key (String)
  • view_post (ViewPost)

    View object to create

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

    the optional parameters

Returns:

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

    View data, 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
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/launchdarkly_api/api/views_beta_api.rb', line 41

def create_view_with_http_info(ld_api_version, project_key, view_post, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ViewsBetaApi.create_view ...'
  end
  # verify the required parameter 'ld_api_version' is set
  if @api_client.config.client_side_validation && ld_api_version.nil?
    fail ArgumentError, "Missing the required parameter 'ld_api_version' when calling ViewsBetaApi.create_view"
  end
  # verify enum value
  allowable_values = ["beta"]
  if @api_client.config.client_side_validation && !allowable_values.include?(ld_api_version)
    fail ArgumentError, "invalid value for \"ld_api_version\", must be one of #{allowable_values}"
  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 ViewsBetaApi.create_view"
  end
  # verify the required parameter 'view_post' is set
  if @api_client.config.client_side_validation && view_post.nil?
    fail ArgumentError, "Missing the required parameter 'view_post' when calling ViewsBetaApi.create_view"
  end
  # resource path
  local_var_path = '/api/v2/projects/{projectKey}/views'.sub('{' + 'projectKey' + '}', CGI.escape(project_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'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end
  header_params[:'LD-API-Version'] = ld_api_version

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

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(view_post)

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

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

  new_options = opts.merge(
    :operation => :"ViewsBetaApi.create_view",
    :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(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ViewsBetaApi#create_view\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_view(ld_api_version, project_key, view_key, opts = {}) ⇒ nil

Delete view Delete a specific view by its key.

Parameters:

  • ld_api_version (String)

    Version of the endpoint.

  • project_key (String)
  • view_key (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (nil)


115
116
117
118
# File 'lib/launchdarkly_api/api/views_beta_api.rb', line 115

def delete_view(ld_api_version, project_key, view_key, opts = {})
  delete_view_with_http_info(ld_api_version, project_key, view_key, opts)
  nil
end

#delete_view_with_http_info(ld_api_version, project_key, view_key, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Delete view Delete a specific view by its key.

Parameters:

  • ld_api_version (String)

    Version of the endpoint.

  • project_key (String)
  • view_key (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

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

    nil, response status code and response headers



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
177
178
179
180
181
182
183
184
185
186
187
# File 'lib/launchdarkly_api/api/views_beta_api.rb', line 127

def delete_view_with_http_info(ld_api_version, project_key, view_key, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ViewsBetaApi.delete_view ...'
  end
  # verify the required parameter 'ld_api_version' is set
  if @api_client.config.client_side_validation && ld_api_version.nil?
    fail ArgumentError, "Missing the required parameter 'ld_api_version' when calling ViewsBetaApi.delete_view"
  end
  # verify enum value
  allowable_values = ["beta"]
  if @api_client.config.client_side_validation && !allowable_values.include?(ld_api_version)
    fail ArgumentError, "invalid value for \"ld_api_version\", must be one of #{allowable_values}"
  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 ViewsBetaApi.delete_view"
  end
  # verify the required parameter 'view_key' is set
  if @api_client.config.client_side_validation && view_key.nil?
    fail ArgumentError, "Missing the required parameter 'view_key' when calling ViewsBetaApi.delete_view"
  end
  # resource path
  local_var_path = '/api/v2/projects/{projectKey}/views/{viewKey}'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.to_s)).sub('{' + 'viewKey' + '}', CGI.escape(view_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'])
  header_params[:'LD-API-Version'] = ld_api_version

  # 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 => :"ViewsBetaApi.delete_view",
    :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: ViewsBetaApi#delete_view\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_linked_resources(ld_api_version, project_key, view_key, resource_type, opts = {}) ⇒ ViewLinkedResources

Get linked resources Get a list of all linked resources for a given view.

Parameters:

  • ld_api_version (String)

    Version of the endpoint.

  • project_key (String)
  • view_key (String)
  • resource_type (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    The number of views to return.

  • :offset (Integer)

    Where to start in the list. Use this with pagination. For example, an offset of 10 skips the first ten items and then returns the next items in the list, up to the query &#x60;limit&#x60;.

  • :sort (String)

    Field to sort by. Default field is &#x60;linkedAt&#x60;, default order is ascending. (default to ‘linkedAt’)

Returns:



200
201
202
203
# File 'lib/launchdarkly_api/api/views_beta_api.rb', line 200

def get_linked_resources(ld_api_version, project_key, view_key, resource_type, opts = {})
  data, _status_code, _headers = get_linked_resources_with_http_info(ld_api_version, project_key, view_key, resource_type, opts)
  data
end

#get_linked_resources_with_http_info(ld_api_version, project_key, view_key, resource_type, opts = {}) ⇒ Array<(ViewLinkedResources, Integer, Hash)>

Get linked resources Get a list of all linked resources for a given view.

Parameters:

  • ld_api_version (String)

    Version of the endpoint.

  • project_key (String)
  • view_key (String)
  • resource_type (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    The number of views to return.

  • :offset (Integer)

    Where to start in the list. Use this with pagination. For example, an offset of 10 skips the first ten items and then returns the next items in the list, up to the query &#x60;limit&#x60;.

  • :sort (String)

    Field to sort by. Default field is &#x60;linkedAt&#x60;, default order is ascending. (default to ‘linkedAt’)

Returns:

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

    ViewLinkedResources data, response status code and response headers



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
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
290
291
292
# File 'lib/launchdarkly_api/api/views_beta_api.rb', line 216

def get_linked_resources_with_http_info(ld_api_version, project_key, view_key, resource_type, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ViewsBetaApi.get_linked_resources ...'
  end
  # verify the required parameter 'ld_api_version' is set
  if @api_client.config.client_side_validation && ld_api_version.nil?
    fail ArgumentError, "Missing the required parameter 'ld_api_version' when calling ViewsBetaApi.get_linked_resources"
  end
  # verify enum value
  allowable_values = ["beta"]
  if @api_client.config.client_side_validation && !allowable_values.include?(ld_api_version)
    fail ArgumentError, "invalid value for \"ld_api_version\", must be one of #{allowable_values}"
  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 ViewsBetaApi.get_linked_resources"
  end
  # verify the required parameter 'view_key' is set
  if @api_client.config.client_side_validation && view_key.nil?
    fail ArgumentError, "Missing the required parameter 'view_key' when calling ViewsBetaApi.get_linked_resources"
  end
  # verify the required parameter 'resource_type' is set
  if @api_client.config.client_side_validation && resource_type.nil?
    fail ArgumentError, "Missing the required parameter 'resource_type' when calling ViewsBetaApi.get_linked_resources"
  end
  # verify enum value
  allowable_values = ["flags", "segments", "aiConfigs", "metrics"]
  if @api_client.config.client_side_validation && !allowable_values.include?(resource_type)
    fail ArgumentError, "invalid value for \"resource_type\", must be one of #{allowable_values}"
  end
  allowable_values = ["linkedAt", "name"]
  if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort'])
    fail ArgumentError, "invalid value for \"sort\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/api/v2/projects/{projectKey}/views/{viewKey}/linked/{resourceType}'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.to_s)).sub('{' + 'viewKey' + '}', CGI.escape(view_key.to_s)).sub('{' + 'resourceType' + '}', CGI.escape(resource_type.to_s))

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

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

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

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

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

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

  new_options = opts.merge(
    :operation => :"ViewsBetaApi.get_linked_resources",
    :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: ViewsBetaApi#get_linked_resources\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_linked_views(ld_api_version, project_key, resource_type, resource_key, opts = {}) ⇒ Views

Get linked views for a given resource Get a list of all linked views for a resource. Flags, AI configs and metrics are identified by key. Segments are identified by segment ID.

Parameters:

  • ld_api_version (String)

    Version of the endpoint.

  • project_key (String)
  • resource_type (String)
  • resource_key (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :environment_id (String)

    Environment ID. Required when resourceType is &#39;segments&#39;

  • :limit (Integer)

    The number of views to return.

  • :offset (Integer)

    Where to start in the list. Use this with pagination. For example, an offset of 10 skips the first ten items and then returns the next items in the list, up to the query &#x60;limit&#x60;.

Returns:



305
306
307
308
# File 'lib/launchdarkly_api/api/views_beta_api.rb', line 305

def get_linked_views(ld_api_version, project_key, resource_type, resource_key, opts = {})
  data, _status_code, _headers = get_linked_views_with_http_info(ld_api_version, project_key, resource_type, resource_key, opts)
  data
end

#get_linked_views_with_http_info(ld_api_version, project_key, resource_type, resource_key, opts = {}) ⇒ Array<(Views, Integer, Hash)>

Get linked views for a given resource Get a list of all linked views for a resource. Flags, AI configs and metrics are identified by key. Segments are identified by segment ID.

Parameters:

  • ld_api_version (String)

    Version of the endpoint.

  • project_key (String)
  • resource_type (String)
  • resource_key (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :environment_id (String)

    Environment ID. Required when resourceType is &#39;segments&#39;

  • :limit (Integer)

    The number of views to return.

  • :offset (Integer)

    Where to start in the list. Use this with pagination. For example, an offset of 10 skips the first ten items and then returns the next items in the list, up to the query &#x60;limit&#x60;.

Returns:

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

    Views data, response status code and response headers



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

def get_linked_views_with_http_info(ld_api_version, project_key, resource_type, resource_key, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ViewsBetaApi.get_linked_views ...'
  end
  # verify the required parameter 'ld_api_version' is set
  if @api_client.config.client_side_validation && ld_api_version.nil?
    fail ArgumentError, "Missing the required parameter 'ld_api_version' when calling ViewsBetaApi.get_linked_views"
  end
  # verify enum value
  allowable_values = ["beta"]
  if @api_client.config.client_side_validation && !allowable_values.include?(ld_api_version)
    fail ArgumentError, "invalid value for \"ld_api_version\", must be one of #{allowable_values}"
  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 ViewsBetaApi.get_linked_views"
  end
  # verify the required parameter 'resource_type' is set
  if @api_client.config.client_side_validation && resource_type.nil?
    fail ArgumentError, "Missing the required parameter 'resource_type' when calling ViewsBetaApi.get_linked_views"
  end
  # verify enum value
  allowable_values = ["flags", "segments", "aiConfigs", "metrics"]
  if @api_client.config.client_side_validation && !allowable_values.include?(resource_type)
    fail ArgumentError, "invalid value for \"resource_type\", must be one of #{allowable_values}"
  end
  # verify the required parameter 'resource_key' is set
  if @api_client.config.client_side_validation && resource_key.nil?
    fail ArgumentError, "Missing the required parameter 'resource_key' when calling ViewsBetaApi.get_linked_views"
  end
  # resource path
  local_var_path = '/api/v2/projects/{projectKey}/view-associations/{resourceType}/{resourceKey}'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.to_s)).sub('{' + 'resourceType' + '}', CGI.escape(resource_type.to_s)).sub('{' + 'resourceKey' + '}', CGI.escape(resource_key.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'environmentId'] = opts[:'environment_id'] if !opts[:'environment_id'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?

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

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

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

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

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

  new_options = opts.merge(
    :operation => :"ViewsBetaApi.get_linked_views",
    :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: ViewsBetaApi#get_linked_views\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_view(ld_api_version, project_key, view_key, opts = {}) ⇒ View

Get view Retrieve a specific view by its key.

Parameters:

  • ld_api_version (String)

    Version of the endpoint.

  • project_key (String)
  • view_key (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :sort (String)

    A sort to apply to the list of views.

  • :limit (Integer)

    The number of views to return.

  • :offset (Integer)

    Where to start in the list. Use this with pagination. For example, an offset of 10 skips the first ten items and then returns the next items in the list, up to the query &#x60;limit&#x60;.

  • :filter (String)

    A filter to apply to the list of views.

  • :expand (Array<String>)

    A comma-separated list of fields to expand.

Returns:



407
408
409
410
# File 'lib/launchdarkly_api/api/views_beta_api.rb', line 407

def get_view(ld_api_version, project_key, view_key, opts = {})
  data, _status_code, _headers = get_view_with_http_info(ld_api_version, project_key, view_key, opts)
  data
end

#get_view_with_http_info(ld_api_version, project_key, view_key, opts = {}) ⇒ Array<(View, Integer, Hash)>

Get view Retrieve a specific view by its key.

Parameters:

  • ld_api_version (String)

    Version of the endpoint.

  • project_key (String)
  • view_key (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :sort (String)

    A sort to apply to the list of views.

  • :limit (Integer)

    The number of views to return.

  • :offset (Integer)

    Where to start in the list. Use this with pagination. For example, an offset of 10 skips the first ten items and then returns the next items in the list, up to the query &#x60;limit&#x60;.

  • :filter (String)

    A filter to apply to the list of views.

  • :expand (Array<String>)

    A comma-separated list of fields to expand.

Returns:

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

    View data, response status code and response headers



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
462
463
464
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
# File 'lib/launchdarkly_api/api/views_beta_api.rb', line 424

def get_view_with_http_info(ld_api_version, project_key, view_key, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ViewsBetaApi.get_view ...'
  end
  # verify the required parameter 'ld_api_version' is set
  if @api_client.config.client_side_validation && ld_api_version.nil?
    fail ArgumentError, "Missing the required parameter 'ld_api_version' when calling ViewsBetaApi.get_view"
  end
  # verify enum value
  allowable_values = ["beta"]
  if @api_client.config.client_side_validation && !allowable_values.include?(ld_api_version)
    fail ArgumentError, "invalid value for \"ld_api_version\", must be one of #{allowable_values}"
  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 ViewsBetaApi.get_view"
  end
  # verify the required parameter 'view_key' is set
  if @api_client.config.client_side_validation && view_key.nil?
    fail ArgumentError, "Missing the required parameter 'view_key' when calling ViewsBetaApi.get_view"
  end
  allowable_values = ["key", "name", "updatedAt"]
  if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort'])
    fail ArgumentError, "invalid value for \"sort\", must be one of #{allowable_values}"
  end
  allowable_values = ["allFlags", "allSegments", "allMetrics", "allAIConfigs", "allResources", "flagsSummary", "segmentsSummary", "metricsSummary", "aiConfigsSummary", "resourceSummary"]
  if @api_client.config.client_side_validation && opts[:'expand'] && !opts[:'expand'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"expand\", must include one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/api/v2/projects/{projectKey}/views/{viewKey}'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.to_s)).sub('{' + 'viewKey' + '}', CGI.escape(view_key.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
  query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?
  query_params[:'expand'] = @api_client.build_collection_param(opts[:'expand'], :multi) if !opts[:'expand'].nil?

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

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

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

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

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

  new_options = opts.merge(
    :operation => :"ViewsBetaApi.get_view",
    :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: ViewsBetaApi#get_view\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_views(ld_api_version, project_key, opts = {}) ⇒ Views

List views Get a list of all views in the given project.

Parameters:

  • ld_api_version (String)

    Version of the endpoint.

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

    the optional parameters

Options Hash (opts):

  • :sort (String)

    A sort to apply to the list of views.

  • :limit (Integer)

    The number of views to return.

  • :offset (Integer)

    Where to start in the list. Use this with pagination. For example, an offset of 10 skips the first ten items and then returns the next items in the list, up to the query &#x60;limit&#x60;.

  • :filter (String)

    A filter to apply to the list of views.

  • :expand (Array<String>)

    A comma-separated list of fields to expand.

Returns:



510
511
512
513
# File 'lib/launchdarkly_api/api/views_beta_api.rb', line 510

def get_views(ld_api_version, project_key, opts = {})
  data, _status_code, _headers = get_views_with_http_info(ld_api_version, project_key, opts)
  data
end

#get_views_with_http_info(ld_api_version, project_key, opts = {}) ⇒ Array<(Views, Integer, Hash)>

List views Get a list of all views in the given project.

Parameters:

  • ld_api_version (String)

    Version of the endpoint.

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

    the optional parameters

Options Hash (opts):

  • :sort (String)

    A sort to apply to the list of views.

  • :limit (Integer)

    The number of views to return.

  • :offset (Integer)

    Where to start in the list. Use this with pagination. For example, an offset of 10 skips the first ten items and then returns the next items in the list, up to the query &#x60;limit&#x60;.

  • :filter (String)

    A filter to apply to the list of views.

  • :expand (Array<String>)

    A comma-separated list of fields to expand.

Returns:

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

    Views data, response status code and response headers



526
527
528
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
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
# File 'lib/launchdarkly_api/api/views_beta_api.rb', line 526

def get_views_with_http_info(ld_api_version, project_key, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ViewsBetaApi.get_views ...'
  end
  # verify the required parameter 'ld_api_version' is set
  if @api_client.config.client_side_validation && ld_api_version.nil?
    fail ArgumentError, "Missing the required parameter 'ld_api_version' when calling ViewsBetaApi.get_views"
  end
  # verify enum value
  allowable_values = ["beta"]
  if @api_client.config.client_side_validation && !allowable_values.include?(ld_api_version)
    fail ArgumentError, "invalid value for \"ld_api_version\", must be one of #{allowable_values}"
  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 ViewsBetaApi.get_views"
  end
  allowable_values = ["key", "name", "updatedAt"]
  if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort'])
    fail ArgumentError, "invalid value for \"sort\", must be one of #{allowable_values}"
  end
  allowable_values = ["flagsSummary", "segmentsSummary", "metricsSummary", "aiConfigsSummary", "resourceSummary"]
  if @api_client.config.client_side_validation && opts[:'expand'] && !opts[:'expand'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"expand\", must include one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/api/v2/projects/{projectKey}/views'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
  query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?
  query_params[:'expand'] = @api_client.build_collection_param(opts[:'expand'], :csv) if !opts[:'expand'].nil?

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

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

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

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

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

  new_options = opts.merge(
    :operation => :"ViewsBetaApi.get_views",
    :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: ViewsBetaApi#get_views\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

Link resource Link one or multiple resources to a view: - Link flags using flag keys - Link AI configs using AI config keys - Link metrics using metric keys - Link segments using segment IDs

Parameters:

  • ld_api_version (String)

    Version of the endpoint.

  • project_key (String)
  • view_key (String)
  • resource_type (String)
  • view_link_request (ViewLinkRequest)

    The resource to link to the view. Flags are identified by key. Segments are identified by segment ID.

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

    the optional parameters

Returns:



606
607
608
609
# File 'lib/launchdarkly_api/api/views_beta_api.rb', line 606

def link_resource(ld_api_version, project_key, view_key, resource_type, view_link_request, opts = {})
  data, _status_code, _headers = link_resource_with_http_info(ld_api_version, project_key, view_key, resource_type, view_link_request, opts)
  data
end

Link resource Link one or multiple resources to a view: - Link flags using flag keys - Link AI configs using AI config keys - Link metrics using metric keys - Link segments using segment IDs

Parameters:

  • ld_api_version (String)

    Version of the endpoint.

  • project_key (String)
  • view_key (String)
  • resource_type (String)
  • view_link_request (ViewLinkRequest)

    The resource to link to the view. Flags are identified by key. Segments are identified by segment ID.

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

    the optional parameters

Returns:

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

    LinkResourceSuccessResponse data, response status code and response headers



620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
# File 'lib/launchdarkly_api/api/views_beta_api.rb', line 620

def link_resource_with_http_info(ld_api_version, project_key, view_key, resource_type, view_link_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ViewsBetaApi.link_resource ...'
  end
  # verify the required parameter 'ld_api_version' is set
  if @api_client.config.client_side_validation && ld_api_version.nil?
    fail ArgumentError, "Missing the required parameter 'ld_api_version' when calling ViewsBetaApi.link_resource"
  end
  # verify enum value
  allowable_values = ["beta"]
  if @api_client.config.client_side_validation && !allowable_values.include?(ld_api_version)
    fail ArgumentError, "invalid value for \"ld_api_version\", must be one of #{allowable_values}"
  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 ViewsBetaApi.link_resource"
  end
  # verify the required parameter 'view_key' is set
  if @api_client.config.client_side_validation && view_key.nil?
    fail ArgumentError, "Missing the required parameter 'view_key' when calling ViewsBetaApi.link_resource"
  end
  # verify the required parameter 'resource_type' is set
  if @api_client.config.client_side_validation && resource_type.nil?
    fail ArgumentError, "Missing the required parameter 'resource_type' when calling ViewsBetaApi.link_resource"
  end
  # verify enum value
  allowable_values = ["flags", "segments", "aiConfigs", "metrics"]
  if @api_client.config.client_side_validation && !allowable_values.include?(resource_type)
    fail ArgumentError, "invalid value for \"resource_type\", must be one of #{allowable_values}"
  end
  # verify the required parameter 'view_link_request' is set
  if @api_client.config.client_side_validation && view_link_request.nil?
    fail ArgumentError, "Missing the required parameter 'view_link_request' when calling ViewsBetaApi.link_resource"
  end
  # resource path
  local_var_path = '/api/v2/projects/{projectKey}/views/{viewKey}/link/{resourceType}'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.to_s)).sub('{' + 'viewKey' + '}', CGI.escape(view_key.to_s)).sub('{' + 'resourceType' + '}', CGI.escape(resource_type.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'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end
  header_params[:'LD-API-Version'] = ld_api_version

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

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(view_link_request)

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

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

  new_options = opts.merge(
    :operation => :"ViewsBetaApi.link_resource",
    :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(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ViewsBetaApi#link_resource\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

Unlink resource Unlink one or multiple resources from a view: - Unlink flags using flag keys - Unlink segments using segment IDs - Unlink AI configs using AI config keys - Unlink metrics using metric keys

Parameters:

  • ld_api_version (String)

    Version of the endpoint.

  • project_key (String)
  • view_key (String)
  • resource_type (String)
  • view_link_request (ViewLinkRequest)

    The resource to link to the view. Flags are identified by key. Segments are identified by segment ID.

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

    the optional parameters

Returns:



709
710
711
712
# File 'lib/launchdarkly_api/api/views_beta_api.rb', line 709

def unlink_resource(ld_api_version, project_key, view_key, resource_type, view_link_request, opts = {})
  data, _status_code, _headers = unlink_resource_with_http_info(ld_api_version, project_key, view_key, resource_type, view_link_request, opts)
  data
end

Unlink resource Unlink one or multiple resources from a view: - Unlink flags using flag keys - Unlink segments using segment IDs - Unlink AI configs using AI config keys - Unlink metrics using metric keys

Parameters:

  • ld_api_version (String)

    Version of the endpoint.

  • project_key (String)
  • view_key (String)
  • resource_type (String)
  • view_link_request (ViewLinkRequest)

    The resource to link to the view. Flags are identified by key. Segments are identified by segment ID.

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

    the optional parameters

Returns:



723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
# File 'lib/launchdarkly_api/api/views_beta_api.rb', line 723

def unlink_resource_with_http_info(ld_api_version, project_key, view_key, resource_type, view_link_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ViewsBetaApi.unlink_resource ...'
  end
  # verify the required parameter 'ld_api_version' is set
  if @api_client.config.client_side_validation && ld_api_version.nil?
    fail ArgumentError, "Missing the required parameter 'ld_api_version' when calling ViewsBetaApi.unlink_resource"
  end
  # verify enum value
  allowable_values = ["beta"]
  if @api_client.config.client_side_validation && !allowable_values.include?(ld_api_version)
    fail ArgumentError, "invalid value for \"ld_api_version\", must be one of #{allowable_values}"
  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 ViewsBetaApi.unlink_resource"
  end
  # verify the required parameter 'view_key' is set
  if @api_client.config.client_side_validation && view_key.nil?
    fail ArgumentError, "Missing the required parameter 'view_key' when calling ViewsBetaApi.unlink_resource"
  end
  # verify the required parameter 'resource_type' is set
  if @api_client.config.client_side_validation && resource_type.nil?
    fail ArgumentError, "Missing the required parameter 'resource_type' when calling ViewsBetaApi.unlink_resource"
  end
  # verify enum value
  allowable_values = ["flags", "segments", "aiConfigs", "metrics"]
  if @api_client.config.client_side_validation && !allowable_values.include?(resource_type)
    fail ArgumentError, "invalid value for \"resource_type\", must be one of #{allowable_values}"
  end
  # verify the required parameter 'view_link_request' is set
  if @api_client.config.client_side_validation && view_link_request.nil?
    fail ArgumentError, "Missing the required parameter 'view_link_request' when calling ViewsBetaApi.unlink_resource"
  end
  # resource path
  local_var_path = '/api/v2/projects/{projectKey}/views/{viewKey}/link/{resourceType}'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.to_s)).sub('{' + 'viewKey' + '}', CGI.escape(view_key.to_s)).sub('{' + 'resourceType' + '}', CGI.escape(resource_type.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'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end
  header_params[:'LD-API-Version'] = ld_api_version

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

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(view_link_request)

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

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

  new_options = opts.merge(
    :operation => :"ViewsBetaApi.unlink_resource",
    :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: ViewsBetaApi#unlink_resource\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_view(ld_api_version, project_key, view_key, view_patch, opts = {}) ⇒ View

Update view Edit an existing view. The request body must be a JSON object of the fields to update. The values you include replace the existing values for the fields. Here’s an example: “‘ { "description": "Example updated description", "tags": ["new-tag"] } “`

Parameters:

  • ld_api_version (String)

    Version of the endpoint.

  • project_key (String)
  • view_key (String)
  • view_patch (ViewPatch)

    A JSON representation of the view including only the fields to update.

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

    the optional parameters

Returns:



811
812
813
814
# File 'lib/launchdarkly_api/api/views_beta_api.rb', line 811

def update_view(ld_api_version, project_key, view_key, view_patch, opts = {})
  data, _status_code, _headers = update_view_with_http_info(ld_api_version, project_key, view_key, view_patch, opts)
  data
end

#update_view_with_http_info(ld_api_version, project_key, view_key, view_patch, opts = {}) ⇒ Array<(View, Integer, Hash)>

Update view Edit an existing view. The request body must be a JSON object of the fields to update. The values you include replace the existing values for the fields. Here&#39;s an example: &#x60;&#x60;&#x60; { &quot;description&quot;: &quot;Example updated description&quot;, &quot;tags&quot;: [&quot;new-tag&quot;] } &#x60;&#x60;&#x60;

Parameters:

  • ld_api_version (String)

    Version of the endpoint.

  • project_key (String)
  • view_key (String)
  • view_patch (ViewPatch)

    A JSON representation of the view including only the fields to update.

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

    the optional parameters

Returns:

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

    View data, response status code and response headers



824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
# File 'lib/launchdarkly_api/api/views_beta_api.rb', line 824

def update_view_with_http_info(ld_api_version, project_key, view_key, view_patch, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ViewsBetaApi.update_view ...'
  end
  # verify the required parameter 'ld_api_version' is set
  if @api_client.config.client_side_validation && ld_api_version.nil?
    fail ArgumentError, "Missing the required parameter 'ld_api_version' when calling ViewsBetaApi.update_view"
  end
  # verify enum value
  allowable_values = ["beta"]
  if @api_client.config.client_side_validation && !allowable_values.include?(ld_api_version)
    fail ArgumentError, "invalid value for \"ld_api_version\", must be one of #{allowable_values}"
  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 ViewsBetaApi.update_view"
  end
  # verify the required parameter 'view_key' is set
  if @api_client.config.client_side_validation && view_key.nil?
    fail ArgumentError, "Missing the required parameter 'view_key' when calling ViewsBetaApi.update_view"
  end
  # verify the required parameter 'view_patch' is set
  if @api_client.config.client_side_validation && view_patch.nil?
    fail ArgumentError, "Missing the required parameter 'view_patch' when calling ViewsBetaApi.update_view"
  end
  # resource path
  local_var_path = '/api/v2/projects/{projectKey}/views/{viewKey}'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.to_s)).sub('{' + 'viewKey' + '}', CGI.escape(view_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'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end
  header_params[:'LD-API-Version'] = ld_api_version

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

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(view_patch)

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

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

  new_options = opts.merge(
    :operation => :"ViewsBetaApi.update_view",
    :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(:PATCH, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ViewsBetaApi#update_view\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end