Class: LaunchDarklyApi::ApprovalsBetaApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ ApprovalsBetaApi

Returns a new instance of ApprovalsBetaApi.



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

def api_client
  @api_client
end

Instance Method Details

#get_approval_request(id, opts = {}) ⇒ ExpandableApprovalRequestResponse

Get approval request Get an approval request by approval request ID. ### Expanding approval response LaunchDarkly supports the ‘expand` query param to include additional fields in the response, with the following fields: - `flag` includes the flag the approval request belongs to - `project` includes the project the approval request belongs to - `environment` includes the environment the approval request belongs to For example, `expand=project,flag` includes the `project` and `flag` fields in the response.

Parameters:

  • id (String)

    The approval request ID

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

    the optional parameters

Options Hash (opts):

  • :expand (String)

    A comma-separated list of fields to expand in the response. Supported fields are explained above.

Returns:



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

def get_approval_request(id, opts = {})
  data, _status_code, _headers = get_approval_request_with_http_info(id, opts)
  data
end

#get_approval_request_with_http_info(id, opts = {}) ⇒ Array<(ExpandableApprovalRequestResponse, Integer, Hash)>

Get approval request Get an approval request by approval request ID. ### Expanding approval response LaunchDarkly supports the &#x60;expand&#x60; query param to include additional fields in the response, with the following fields: - &#x60;flag&#x60; includes the flag the approval request belongs to - &#x60;project&#x60; includes the project the approval request belongs to - &#x60;environment&#x60; includes the environment the approval request belongs to For example, &#x60;expand&#x3D;project,flag&#x60; includes the &#x60;project&#x60; and &#x60;flag&#x60; fields in the response.

Parameters:

  • id (String)

    The approval request ID

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

    the optional parameters

Options Hash (opts):

  • :expand (String)

    A comma-separated list of fields to expand in the response. Supported fields are explained above.

Returns:



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

def get_approval_request_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ApprovalsBetaApi.get_approval_request ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling ApprovalsBetaApi.get_approval_request"
  end
  # resource path
  local_var_path = '/api/v2/approval-requests/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'expand'] = opts[:'expand'] 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'])

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

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

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

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

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

#get_approval_requests(opts = {}) ⇒ ExpandableApprovalRequestsResponse

List approval requests Get all approval requests. ### Filtering approvals LaunchDarkly supports the ‘filter` query param for filtering, with the following fields: - `notifyMemberIds` filters for only approvals that are assigned to a member in the specified list. For example: `filter=notifyMemberIds anyOf ["memberId1", "memberId2"]`. - `requestorId` filters for only approvals that correspond to the ID of the member who requested the approval. For example: `filter=requestorId equals 457034721476302714390214`. - `projectKey` filters for only approvals that correspond to the specified project key. For example: `filter=projectKey equals my-project`. - `reviewStatus` filters for only approvals which correspond to the review status in the specified list. The possible values are `approved`, `declined`, and `pending`. For example: `filter=reviewStatus anyOf ["pending", "approved"]`. - `status` filters for only approvals which correspond to the status in the specified list. The possible values are `pending`, `scheduled`, `failed`, and `completed`. For example: `filter=status anyOf ["pending", "scheduled"]`. You can also apply multiple filters at once. For example, setting `filter=projectKey equals my-project, reviewStatus anyOf ["pending","approved"]` matches approval requests which correspond to the `my-project` project key, and a review status of either `pending` or `approved`. ### Expanding approval response LaunchDarkly supports the `expand` query param to include additional fields in the response, with the following fields: - `flag` includes the flag the approval request belongs to - `project` includes the project the approval request belongs to - `environment` includes the environment the approval request belongs to For example, `expand=project,flag` includes the `project` and `flag` fields in the response.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :filter (String)

    A comma-separated list of filters. Each filter is of the form &#x60;field operator value&#x60;. Supported fields are explained above.

  • :expand (String)

    A comma-separated list of fields to expand in the response. Supported fields are explained above.

  • :limit (Integer)

    The number of approvals to return. Defaults to -1, which returns all approvals.

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



96
97
98
99
# File 'lib/launchdarkly_api/api/approvals_beta_api.rb', line 96

def get_approval_requests(opts = {})
  data, _status_code, _headers = get_approval_requests_with_http_info(opts)
  data
end

#get_approval_requests_with_http_info(opts = {}) ⇒ Array<(ExpandableApprovalRequestsResponse, Integer, Hash)>

List approval requests Get all approval requests. ### Filtering approvals LaunchDarkly supports the &#x60;filter&#x60; query param for filtering, with the following fields: - &#x60;notifyMemberIds&#x60; filters for only approvals that are assigned to a member in the specified list. For example: &#x60;filter&#x3D;notifyMemberIds anyOf [&quot;memberId1&quot;, &quot;memberId2&quot;]&#x60;. - &#x60;requestorId&#x60; filters for only approvals that correspond to the ID of the member who requested the approval. For example: &#x60;filter&#x3D;requestorId equals 457034721476302714390214&#x60;. - &#x60;projectKey&#x60; filters for only approvals that correspond to the specified project key. For example: &#x60;filter&#x3D;projectKey equals my-project&#x60;. - &#x60;reviewStatus&#x60; filters for only approvals which correspond to the review status in the specified list. The possible values are &#x60;approved&#x60;, &#x60;declined&#x60;, and &#x60;pending&#x60;. For example: &#x60;filter&#x3D;reviewStatus anyOf [&quot;pending&quot;, &quot;approved&quot;]&#x60;. - &#x60;status&#x60; filters for only approvals which correspond to the status in the specified list. The possible values are &#x60;pending&#x60;, &#x60;scheduled&#x60;, &#x60;failed&#x60;, and &#x60;completed&#x60;. For example: &#x60;filter&#x3D;status anyOf [&quot;pending&quot;, &quot;scheduled&quot;]&#x60;. You can also apply multiple filters at once. For example, setting &#x60;filter&#x3D;projectKey equals my-project, reviewStatus anyOf [&quot;pending&quot;,&quot;approved&quot;]&#x60; matches approval requests which correspond to the &#x60;my-project&#x60; project key, and a review status of either &#x60;pending&#x60; or &#x60;approved&#x60;. ### Expanding approval response LaunchDarkly supports the &#x60;expand&#x60; query param to include additional fields in the response, with the following fields: - &#x60;flag&#x60; includes the flag the approval request belongs to - &#x60;project&#x60; includes the project the approval request belongs to - &#x60;environment&#x60; includes the environment the approval request belongs to For example, &#x60;expand&#x3D;project,flag&#x60; includes the &#x60;project&#x60; and &#x60;flag&#x60; fields in the response.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :filter (String)

    A comma-separated list of filters. Each filter is of the form &#x60;field operator value&#x60;. Supported fields are explained above.

  • :expand (String)

    A comma-separated list of fields to expand in the response. Supported fields are explained above.

  • :limit (Integer)

    The number of approvals to return. Defaults to -1, which returns all approvals.

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



109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# File 'lib/launchdarkly_api/api/approvals_beta_api.rb', line 109

def get_approval_requests_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ApprovalsBetaApi.get_approval_requests ...'
  end
  # resource path
  local_var_path = '/api/v2/approval-requests'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?
  query_params[:'expand'] = opts[:'expand'] if !opts[:'expand'].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'])

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

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

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

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

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