Class: LaunchDarklyApi::CodeReferencesApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ CodeReferencesApi

Returns a new instance of CodeReferencesApi.



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

def api_client
  @api_client
end

Instance Method Details

#delete_branches(repo, request_body, opts = {}) ⇒ nil

Delete branches Asynchronously delete a number of branches.

Parameters:

  • repo (String)

    The repository name to delete branches for.

  • request_body (Array<String>)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (nil)


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

def delete_branches(repo, request_body, opts = {})
  delete_branches_with_http_info(repo, request_body, opts)
  nil
end

#delete_branches_with_http_info(repo, request_body, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Delete branches Asynchronously delete a number of branches.

Parameters:

  • repo (String)

    The repository name to delete branches for.

  • request_body (Array<String>)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

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

    nil, response status code and response headers



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

def delete_branches_with_http_info(repo, request_body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CodeReferencesApi.delete_branches ...'
  end
  # verify the required parameter 'repo' is set
  if @api_client.config.client_side_validation && repo.nil?
    fail ArgumentError, "Missing the required parameter 'repo' when calling CodeReferencesApi.delete_branches"
  end
  # verify the required parameter 'request_body' is set
  if @api_client.config.client_side_validation && request_body.nil?
    fail ArgumentError, "Missing the required parameter 'request_body' when calling CodeReferencesApi.delete_branches"
  end
  # resource path
  local_var_path = '/api/v2/code-refs/repositories/{repo}/branch-delete-tasks'.sub('{' + 'repo' + '}', CGI.escape(repo.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

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

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

  # return_type
  return_type = opts[:debug_return_type]

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

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

#delete_repository(repo, opts = {}) ⇒ nil

Delete repository Delete a repository with the specified name.

Parameters:

  • repo (String)

    The repository name

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

    the optional parameters

Returns:

  • (nil)


101
102
103
104
# File 'lib/launchdarkly_api/api/code_references_api.rb', line 101

def delete_repository(repo, opts = {})
  delete_repository_with_http_info(repo, opts)
  nil
end

#delete_repository_with_http_info(repo, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Delete repository Delete a repository with the specified name.

Parameters:

  • repo (String)

    The repository name

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



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
156
157
# File 'lib/launchdarkly_api/api/code_references_api.rb', line 111

def delete_repository_with_http_info(repo, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CodeReferencesApi.delete_repository ...'
  end
  # verify the required parameter 'repo' is set
  if @api_client.config.client_side_validation && repo.nil?
    fail ArgumentError, "Missing the required parameter 'repo' when calling CodeReferencesApi.delete_repository"
  end
  # resource path
  local_var_path = '/api/v2/code-refs/repositories/{repo}'.sub('{' + 'repo' + '}', CGI.escape(repo.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'])

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

#get_branch(repo, branch, opts = {}) ⇒ BranchRep

Get branch Get a specific branch in a repository.

Parameters:

  • repo (String)

    The repository name

  • branch (String)

    The url-encoded branch name

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

    the optional parameters

Options Hash (opts):

  • :proj_key (String)

    Filter results to a specific project

  • :flag_key (String)

    Filter results to a specific flag key

Returns:



167
168
169
170
# File 'lib/launchdarkly_api/api/code_references_api.rb', line 167

def get_branch(repo, branch, opts = {})
  data, _status_code, _headers = get_branch_with_http_info(repo, branch, opts)
  data
end

#get_branch_with_http_info(repo, branch, opts = {}) ⇒ Array<(BranchRep, Integer, Hash)>

Get branch Get a specific branch in a repository.

Parameters:

  • repo (String)

    The repository name

  • branch (String)

    The url-encoded branch name

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

    the optional parameters

Options Hash (opts):

  • :proj_key (String)

    Filter results to a specific project

  • :flag_key (String)

    Filter results to a specific flag key

Returns:

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

    BranchRep data, response status code and response headers



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
220
221
222
223
224
225
226
227
228
229
230
231
232
# File 'lib/launchdarkly_api/api/code_references_api.rb', line 180

def get_branch_with_http_info(repo, branch, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CodeReferencesApi.get_branch ...'
  end
  # verify the required parameter 'repo' is set
  if @api_client.config.client_side_validation && repo.nil?
    fail ArgumentError, "Missing the required parameter 'repo' when calling CodeReferencesApi.get_branch"
  end
  # verify the required parameter 'branch' is set
  if @api_client.config.client_side_validation && branch.nil?
    fail ArgumentError, "Missing the required parameter 'branch' when calling CodeReferencesApi.get_branch"
  end
  # resource path
  local_var_path = '/api/v2/code-refs/repositories/{repo}/branches/{branch}'.sub('{' + 'repo' + '}', CGI.escape(repo.to_s)).sub('{' + 'branch' + '}', CGI.escape(branch.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'projKey'] = opts[:'proj_key'] if !opts[:'proj_key'].nil?
  query_params[:'flagKey'] = opts[:'flag_key'] if !opts[:'flag_key'].nil?

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

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

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

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

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

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

#get_branches(repo, opts = {}) ⇒ BranchCollectionRep

List branches Get a list of branches.

Parameters:

  • repo (String)

    The repository name

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

    the optional parameters

Returns:



239
240
241
242
# File 'lib/launchdarkly_api/api/code_references_api.rb', line 239

def get_branches(repo, opts = {})
  data, _status_code, _headers = get_branches_with_http_info(repo, opts)
  data
end

#get_branches_with_http_info(repo, opts = {}) ⇒ Array<(BranchCollectionRep, Integer, Hash)>

List branches Get a list of branches.

Parameters:

  • repo (String)

    The repository name

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

    the optional parameters

Returns:

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

    BranchCollectionRep data, response status code and response headers



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

def get_branches_with_http_info(repo, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CodeReferencesApi.get_branches ...'
  end
  # verify the required parameter 'repo' is set
  if @api_client.config.client_side_validation && repo.nil?
    fail ArgumentError, "Missing the required parameter 'repo' when calling CodeReferencesApi.get_branches"
  end
  # resource path
  local_var_path = '/api/v2/code-refs/repositories/{repo}/branches'.sub('{' + 'repo' + '}', CGI.escape(repo.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'])

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

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

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

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

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

#get_extinctions(opts = {}) ⇒ ExtinctionCollectionRep

List extinctions Get a list of all extinctions. LaunchDarkly creates an extinction event after you remove all code references to a flag. To learn more, read [Understanding extinction events](docs.launchdarkly.com/home/code/code-references#understanding-extinction-events).

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :repo_name (String)

    Filter results to a specific repository

  • :branch_name (String)

    Filter results to a specific branch. By default, only the default branch will be queried for extinctions.

  • :proj_key (String)

    Filter results to a specific project

  • :flag_key (String)

    Filter results to a specific flag key

  • :from (Integer)

    Filter results to a specific timeframe based on commit time, expressed as a Unix epoch time in milliseconds. Must be used with &#x60;to&#x60;.

  • :to (Integer)

    Filter results to a specific timeframe based on commit time, expressed as a Unix epoch time in milliseconds. Must be used with &#x60;from&#x60;.

Returns:



307
308
309
310
# File 'lib/launchdarkly_api/api/code_references_api.rb', line 307

def get_extinctions(opts = {})
  data, _status_code, _headers = get_extinctions_with_http_info(opts)
  data
end

#get_extinctions_with_http_info(opts = {}) ⇒ Array<(ExtinctionCollectionRep, Integer, Hash)>

List extinctions Get a list of all extinctions. LaunchDarkly creates an extinction event after you remove all code references to a flag. To learn more, read [Understanding extinction events](docs.launchdarkly.com/home/code/code-references#understanding-extinction-events).

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :repo_name (String)

    Filter results to a specific repository

  • :branch_name (String)

    Filter results to a specific branch. By default, only the default branch will be queried for extinctions.

  • :proj_key (String)

    Filter results to a specific project

  • :flag_key (String)

    Filter results to a specific flag key

  • :from (Integer)

    Filter results to a specific timeframe based on commit time, expressed as a Unix epoch time in milliseconds. Must be used with &#x60;to&#x60;.

  • :to (Integer)

    Filter results to a specific timeframe based on commit time, expressed as a Unix epoch time in milliseconds. Must be used with &#x60;from&#x60;.

Returns:

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

    ExtinctionCollectionRep data, response status code and response headers



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

def get_extinctions_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CodeReferencesApi.get_extinctions ...'
  end
  # resource path
  local_var_path = '/api/v2/code-refs/extinctions'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'repoName'] = opts[:'repo_name'] if !opts[:'repo_name'].nil?
  query_params[:'branchName'] = opts[:'branch_name'] if !opts[:'branch_name'].nil?
  query_params[:'projKey'] = opts[:'proj_key'] if !opts[:'proj_key'].nil?
  query_params[:'flagKey'] = opts[:'flag_key'] if !opts[:'flag_key'].nil?
  query_params[:'from'] = opts[:'from'] if !opts[:'from'].nil?
  query_params[:'to'] = opts[:'to'] if !opts[:'to'].nil?

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

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

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

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

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

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

#get_repositories(opts = {}) ⇒ RepositoryCollectionRep

List repositories Get a list of connected repositories. Optionally, you can include branch metadata with the ‘withBranches` query parameter. Embed references for the default branch with `ReferencesForDefaultBranch`. You can also filter the list of code references by project key and flag key.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :with_branches (String)

    If set to any value, the endpoint returns repositories with associated branch data

  • :with_references_for_default_branch (String)

    If set to any value, the endpoint returns repositories with associated branch data, as well as code references for the default git branch

  • :proj_key (String)

    A LaunchDarkly project key. If provided, this filters code reference results to the specified project.

  • :flag_key (String)

    If set to any value, the endpoint returns repositories with associated branch data, as well as code references for the default git branch

Returns:



380
381
382
383
# File 'lib/launchdarkly_api/api/code_references_api.rb', line 380

def get_repositories(opts = {})
  data, _status_code, _headers = get_repositories_with_http_info(opts)
  data
end

#get_repositories_with_http_info(opts = {}) ⇒ Array<(RepositoryCollectionRep, Integer, Hash)>

List repositories Get a list of connected repositories. Optionally, you can include branch metadata with the &#x60;withBranches&#x60; query parameter. Embed references for the default branch with &#x60;ReferencesForDefaultBranch&#x60;. You can also filter the list of code references by project key and flag key.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :with_branches (String)

    If set to any value, the endpoint returns repositories with associated branch data

  • :with_references_for_default_branch (String)

    If set to any value, the endpoint returns repositories with associated branch data, as well as code references for the default git branch

  • :proj_key (String)

    A LaunchDarkly project key. If provided, this filters code reference results to the specified project.

  • :flag_key (String)

    If set to any value, the endpoint returns repositories with associated branch data, as well as code references for the default git branch

Returns:

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

    RepositoryCollectionRep data, response status code and response headers



393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
# File 'lib/launchdarkly_api/api/code_references_api.rb', line 393

def get_repositories_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CodeReferencesApi.get_repositories ...'
  end
  # resource path
  local_var_path = '/api/v2/code-refs/repositories'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'withBranches'] = opts[:'with_branches'] if !opts[:'with_branches'].nil?
  query_params[:'withReferencesForDefaultBranch'] = opts[:'with_references_for_default_branch'] if !opts[:'with_references_for_default_branch'].nil?
  query_params[:'projKey'] = opts[:'proj_key'] if !opts[:'proj_key'].nil?
  query_params[:'flagKey'] = opts[:'flag_key'] if !opts[:'flag_key'].nil?

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

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

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

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

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

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

#get_repository(repo, opts = {}) ⇒ RepositoryRep

Get repository Get a single repository by name.

Parameters:

  • repo (String)

    The repository name

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

    the optional parameters

Returns:



446
447
448
449
# File 'lib/launchdarkly_api/api/code_references_api.rb', line 446

def get_repository(repo, opts = {})
  data, _status_code, _headers = get_repository_with_http_info(repo, opts)
  data
end

#get_repository_with_http_info(repo, opts = {}) ⇒ Array<(RepositoryRep, Integer, Hash)>

Get repository Get a single repository by name.

Parameters:

  • repo (String)

    The repository name

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

    the optional parameters

Returns:

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

    RepositoryRep data, response status code and response headers



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
498
499
500
501
502
# File 'lib/launchdarkly_api/api/code_references_api.rb', line 456

def get_repository_with_http_info(repo, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CodeReferencesApi.get_repository ...'
  end
  # verify the required parameter 'repo' is set
  if @api_client.config.client_side_validation && repo.nil?
    fail ArgumentError, "Missing the required parameter 'repo' when calling CodeReferencesApi.get_repository"
  end
  # resource path
  local_var_path = '/api/v2/code-refs/repositories/{repo}'.sub('{' + 'repo' + '}', CGI.escape(repo.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'])

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

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

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

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

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

#get_root_statistic(opts = {}) ⇒ StatisticsRoot

Get links to code reference repositories for each project Get links for all projects that have code references.

Parameters:

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

    the optional parameters

Returns:



508
509
510
511
# File 'lib/launchdarkly_api/api/code_references_api.rb', line 508

def get_root_statistic(opts = {})
  data, _status_code, _headers = get_root_statistic_with_http_info(opts)
  data
end

#get_root_statistic_with_http_info(opts = {}) ⇒ Array<(StatisticsRoot, Integer, Hash)>

Get links to code reference repositories for each project Get links for all projects that have code references.

Parameters:

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

    the optional parameters

Returns:

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

    StatisticsRoot data, response status code and response headers



517
518
519
520
521
522
523
524
525
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
# File 'lib/launchdarkly_api/api/code_references_api.rb', line 517

def get_root_statistic_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CodeReferencesApi.get_root_statistic ...'
  end
  # resource path
  local_var_path = '/api/v2/code-refs/statistics'

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

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

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

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

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

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

#get_statistics(project_key, opts = {}) ⇒ StatisticCollectionRep

Get code references statistics for flags Get statistics about all the code references across repositories for all flags in your project that have code references in the default branch, for example, ‘main`. Optionally, you can include the `flagKey` query parameter to limit your request to statistics about code references for a single flag. This endpoint returns the number of references to your flag keys in your repositories, as well as a link to each repository.

Parameters:

  • project_key (String)

    The project key

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

    the optional parameters

Options Hash (opts):

  • :flag_key (String)

    Filter results to a specific flag key

Returns:



567
568
569
570
# File 'lib/launchdarkly_api/api/code_references_api.rb', line 567

def get_statistics(project_key, opts = {})
  data, _status_code, _headers = get_statistics_with_http_info(project_key, opts)
  data
end

#get_statistics_with_http_info(project_key, opts = {}) ⇒ Array<(StatisticCollectionRep, Integer, Hash)>

Get code references statistics for flags Get statistics about all the code references across repositories for all flags in your project that have code references in the default branch, for example, &#x60;main&#x60;. Optionally, you can include the &#x60;flagKey&#x60; query parameter to limit your request to statistics about code references for a single flag. This endpoint returns the number of references to your flag keys in your repositories, as well as a link to each repository.

Parameters:

  • project_key (String)

    The project key

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

    the optional parameters

Options Hash (opts):

  • :flag_key (String)

    Filter results to a specific flag key

Returns:

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

    StatisticCollectionRep data, response status code and response headers



578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
# File 'lib/launchdarkly_api/api/code_references_api.rb', line 578

def get_statistics_with_http_info(project_key, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CodeReferencesApi.get_statistics ...'
  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 CodeReferencesApi.get_statistics"
  end
  # resource path
  local_var_path = '/api/v2/code-refs/statistics/{projectKey}'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'flagKey'] = opts[:'flag_key'] if !opts[:'flag_key'].nil?

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

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

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

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

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

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

#patch_repository(repo, patch_operation, opts = {}) ⇒ RepositoryRep

Update repository Update a repository’s settings. The request must be a valid JSON Patch document describing the changes to be made to the repository.

Parameters:

  • repo (String)

    The repository name

  • patch_operation (Array<PatchOperation>)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



633
634
635
636
# File 'lib/launchdarkly_api/api/code_references_api.rb', line 633

def patch_repository(repo, patch_operation, opts = {})
  data, _status_code, _headers = patch_repository_with_http_info(repo, patch_operation, opts)
  data
end

#patch_repository_with_http_info(repo, patch_operation, opts = {}) ⇒ Array<(RepositoryRep, Integer, Hash)>

Update repository Update a repository&#39;s settings. The request must be a valid JSON Patch document describing the changes to be made to the repository.

Parameters:

  • repo (String)

    The repository name

  • patch_operation (Array<PatchOperation>)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

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

    RepositoryRep data, response status code and response headers



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
699
# File 'lib/launchdarkly_api/api/code_references_api.rb', line 644

def patch_repository_with_http_info(repo, patch_operation, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CodeReferencesApi.patch_repository ...'
  end
  # verify the required parameter 'repo' is set
  if @api_client.config.client_side_validation && repo.nil?
    fail ArgumentError, "Missing the required parameter 'repo' when calling CodeReferencesApi.patch_repository"
  end
  # verify the required parameter 'patch_operation' is set
  if @api_client.config.client_side_validation && patch_operation.nil?
    fail ArgumentError, "Missing the required parameter 'patch_operation' when calling CodeReferencesApi.patch_repository"
  end
  # resource path
  local_var_path = '/api/v2/code-refs/repositories/{repo}'.sub('{' + 'repo' + '}', CGI.escape(repo.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

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

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

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

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

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

#post_extinction(repo, branch, extinction, opts = {}) ⇒ nil

Create extinction Create a new extinction.

Parameters:

  • repo (String)

    The repository name

  • branch (String)

    The URL-encoded branch name

  • extinction (Array<Extinction>)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (nil)


708
709
710
711
# File 'lib/launchdarkly_api/api/code_references_api.rb', line 708

def post_extinction(repo, branch, extinction, opts = {})
  post_extinction_with_http_info(repo, branch, extinction, opts)
  nil
end

#post_extinction_with_http_info(repo, branch, extinction, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Create extinction Create a new extinction.

Parameters:

  • repo (String)

    The repository name

  • branch (String)

    The URL-encoded branch name

  • extinction (Array<Extinction>)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

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

    nil, response status code and response headers



720
721
722
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
# File 'lib/launchdarkly_api/api/code_references_api.rb', line 720

def post_extinction_with_http_info(repo, branch, extinction, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CodeReferencesApi.post_extinction ...'
  end
  # verify the required parameter 'repo' is set
  if @api_client.config.client_side_validation && repo.nil?
    fail ArgumentError, "Missing the required parameter 'repo' when calling CodeReferencesApi.post_extinction"
  end
  # verify the required parameter 'branch' is set
  if @api_client.config.client_side_validation && branch.nil?
    fail ArgumentError, "Missing the required parameter 'branch' when calling CodeReferencesApi.post_extinction"
  end
  # verify the required parameter 'extinction' is set
  if @api_client.config.client_side_validation && extinction.nil?
    fail ArgumentError, "Missing the required parameter 'extinction' when calling CodeReferencesApi.post_extinction"
  end
  # resource path
  local_var_path = '/api/v2/code-refs/repositories/{repo}/branches/{branch}/extinction-events'.sub('{' + 'repo' + '}', CGI.escape(repo.to_s)).sub('{' + 'branch' + '}', CGI.escape(branch.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

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

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

  # return_type
  return_type = opts[:debug_return_type]

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

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

#post_repository(repository_post, opts = {}) ⇒ RepositoryRep

Create repository Create a repository with the specified name.

Parameters:

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

    the optional parameters

Returns:



786
787
788
789
# File 'lib/launchdarkly_api/api/code_references_api.rb', line 786

def post_repository(repository_post, opts = {})
  data, _status_code, _headers = post_repository_with_http_info(repository_post, opts)
  data
end

#post_repository_with_http_info(repository_post, opts = {}) ⇒ Array<(RepositoryRep, Integer, Hash)>

Create repository Create a repository with the specified name.

Parameters:

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

    the optional parameters

Returns:

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

    RepositoryRep data, response status code and response headers



796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
# File 'lib/launchdarkly_api/api/code_references_api.rb', line 796

def post_repository_with_http_info(repository_post, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CodeReferencesApi.post_repository ...'
  end
  # verify the required parameter 'repository_post' is set
  if @api_client.config.client_side_validation && repository_post.nil?
    fail ArgumentError, "Missing the required parameter 'repository_post' when calling CodeReferencesApi.post_repository"
  end
  # resource path
  local_var_path = '/api/v2/code-refs/repositories'

  # 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

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

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

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

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

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

#put_branch(repo, branch, put_branch, opts = {}) ⇒ nil

Upsert branch Create a new branch if it doesn’t exist, or update the branch if it already exists.

Parameters:

  • repo (String)

    The repository name

  • branch (String)

    The URL-encoded branch name

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

    the optional parameters

Returns:

  • (nil)


856
857
858
859
# File 'lib/launchdarkly_api/api/code_references_api.rb', line 856

def put_branch(repo, branch, put_branch, opts = {})
  put_branch_with_http_info(repo, branch, put_branch, opts)
  nil
end

#put_branch_with_http_info(repo, branch, put_branch, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Upsert branch Create a new branch if it doesn&#39;t exist, or update the branch if it already exists.

Parameters:

  • repo (String)

    The repository name

  • branch (String)

    The URL-encoded branch name

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



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
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
# File 'lib/launchdarkly_api/api/code_references_api.rb', line 868

def put_branch_with_http_info(repo, branch, put_branch, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CodeReferencesApi.put_branch ...'
  end
  # verify the required parameter 'repo' is set
  if @api_client.config.client_side_validation && repo.nil?
    fail ArgumentError, "Missing the required parameter 'repo' when calling CodeReferencesApi.put_branch"
  end
  # verify the required parameter 'branch' is set
  if @api_client.config.client_side_validation && branch.nil?
    fail ArgumentError, "Missing the required parameter 'branch' when calling CodeReferencesApi.put_branch"
  end
  # verify the required parameter 'put_branch' is set
  if @api_client.config.client_side_validation && put_branch.nil?
    fail ArgumentError, "Missing the required parameter 'put_branch' when calling CodeReferencesApi.put_branch"
  end
  # resource path
  local_var_path = '/api/v2/code-refs/repositories/{repo}/branches/{branch}'.sub('{' + 'repo' + '}', CGI.escape(repo.to_s)).sub('{' + 'branch' + '}', CGI.escape(branch.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

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

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

  # return_type
  return_type = opts[:debug_return_type]

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

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