Class: LaunchDarklyApi::InsightsPullRequestsBetaApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ InsightsPullRequestsBetaApi

Returns a new instance of InsightsPullRequestsBetaApi.



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

def api_client
  @api_client
end

Instance Method Details

#get_pull_requests(project_key, opts = {}) ⇒ PullRequestCollectionRep

List pull requests Get a list of pull requests ### Expanding the pull request collection response LaunchDarkly supports expanding the pull request collection response to include additional fields. To expand the response, append the ‘expand` query parameter and include the following: * `deployments` includes details on all of the deployments associated with each pull request * `flagReferences` includes details on all of the references to flags in each pull request * `leadTime` includes details about the lead time of the pull request for each stage For example, use `?expand=deployments` to include the `deployments` field in the response. By default, this field is not included in the response.

Parameters:

  • project_key (String)

    The project key

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

    the optional parameters

Options Hash (opts):

  • :environment_key (String)

    Required if you are using the <code>sort</code> parameter's <code>leadTime</code> option to sort pull requests.

  • :application_key (String)

    Filter the results to pull requests deployed to a comma separated list of applications

  • :status (String)

    Filter results to pull requests with the given status. Options: `open`, `merged`, `closed`, `deployed`.

  • :query (String)

    Filter list of pull requests by title or author

  • :limit (Integer)

    The number of pull requests to return. Default is 20. Maximum allowed is 100.

  • :expand (String)

    Expand properties in response. Options: `deployments`, `flagReferences`, `leadTime`.

  • :sort (String)

    Sort results. Requires the `environmentKey` to be set. Options: `leadTime` (asc) and `-leadTime` (desc). When query option is excluded, default sort is by created or merged date.

  • :from (Time)

    Unix timestamp in milliseconds. Default value is 7 days ago.

  • :to (Time)

    Unix timestamp in milliseconds. Default value is now.

  • :after (String)

    Identifier used for pagination

  • :before (String)

    Identifier used for pagination

Returns:



38
39
40
41
# File 'lib/launchdarkly_api/api/insights_pull_requests_beta_api.rb', line 38

def get_pull_requests(project_key, opts = {})
  data, _status_code, _headers = get_pull_requests_with_http_info(project_key, opts)
  data
end

#get_pull_requests_with_http_info(project_key, opts = {}) ⇒ Array<(PullRequestCollectionRep, Integer, Hash)>

List pull requests Get a list of pull requests ### Expanding the pull request collection response LaunchDarkly supports expanding the pull request collection response to include additional fields. To expand the response, append the &#x60;expand&#x60; query parameter and include the following: * &#x60;deployments&#x60; includes details on all of the deployments associated with each pull request * &#x60;flagReferences&#x60; includes details on all of the references to flags in each pull request * &#x60;leadTime&#x60; includes details about the lead time of the pull request for each stage For example, use &#x60;?expand&#x3D;deployments&#x60; to include the &#x60;deployments&#x60; field in the response. By default, this field is not included in the response.

Parameters:

  • project_key (String)

    The project key

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

    the optional parameters

Options Hash (opts):

  • :environment_key (String)

    Required if you are using the &lt;code&gt;sort&lt;/code&gt; parameter&#39;s &lt;code&gt;leadTime&lt;/code&gt; option to sort pull requests.

  • :application_key (String)

    Filter the results to pull requests deployed to a comma separated list of applications

  • :status (String)

    Filter results to pull requests with the given status. Options: &#x60;open&#x60;, &#x60;merged&#x60;, &#x60;closed&#x60;, &#x60;deployed&#x60;.

  • :query (String)

    Filter list of pull requests by title or author

  • :limit (Integer)

    The number of pull requests to return. Default is 20. Maximum allowed is 100.

  • :expand (String)

    Expand properties in response. Options: &#x60;deployments&#x60;, &#x60;flagReferences&#x60;, &#x60;leadTime&#x60;.

  • :sort (String)

    Sort results. Requires the &#x60;environmentKey&#x60; to be set. Options: &#x60;leadTime&#x60; (asc) and &#x60;-leadTime&#x60; (desc). When query option is excluded, default sort is by created or merged date.

  • :from (Time)

    Unix timestamp in milliseconds. Default value is 7 days ago.

  • :to (Time)

    Unix timestamp in milliseconds. Default value is now.

  • :after (String)

    Identifier used for pagination

  • :before (String)

    Identifier used for pagination

Returns:

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

    PullRequestCollectionRep data, response status code and response headers



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
107
108
109
110
111
112
113
114
115
116
117
# File 'lib/launchdarkly_api/api/insights_pull_requests_beta_api.rb', line 59

def get_pull_requests_with_http_info(project_key, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: InsightsPullRequestsBetaApi.get_pull_requests ...'
  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 InsightsPullRequestsBetaApi.get_pull_requests"
  end
  # resource path
  local_var_path = '/api/v2/engineering-insights/pull-requests'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'projectKey'] = project_key
  query_params[:'environmentKey'] = opts[:'environment_key'] if !opts[:'environment_key'].nil?
  query_params[:'applicationKey'] = opts[:'application_key'] if !opts[:'application_key'].nil?
  query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?
  query_params[:'query'] = opts[:'query'] if !opts[:'query'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'expand'] = opts[:'expand'] if !opts[:'expand'].nil?
  query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
  query_params[:'from'] = opts[:'from'] if !opts[:'from'].nil?
  query_params[:'to'] = opts[:'to'] if !opts[:'to'].nil?
  query_params[:'after'] = opts[:'after'] if !opts[:'after'].nil?
  query_params[:'before'] = opts[:'before'] if !opts[:'before'].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] || 'PullRequestCollectionRep'

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

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