Class: Cerca::Resources::ApprovalRequests

Inherits:
Object
  • Object
show all
Defined in:
lib/cerca/resources/approval_requests.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ ApprovalRequests

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of ApprovalRequests.

Parameters:



67
68
69
# File 'lib/cerca/resources/approval_requests.rb', line 67

def initialize(client:)
  @client = client
end

Instance Method Details

#list(agent_id, cursor: nil, limit: nil, thread_id: nil, request_options: {}) ⇒ Cerca::Internal::ApprovalRequestsCursorPage<Cerca::Models::ApprovalRequest>

Some parameter documentations has been truncated, see Models::ApprovalRequestListParams for more details.

List approvals

Parameters:

  • agent_id (String)
  • cursor (String)

    Opaque pagination cursor returned by a previous request.

  • limit (String)

    Maximum number of items to return. Defaults to 20 and preserves parseInt semanti

  • thread_id (String)

    Optional thread id filter.

  • request_options (Cerca::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/cerca/resources/approval_requests.rb', line 26

def list(agent_id, params = {})
  parsed, options = Cerca::ApprovalRequestListParams.dump_request(params)
  query = Cerca::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["agents/%1$s/approvals", agent_id],
    query: query.transform_keys(thread_id: "threadId"),
    page: Cerca::Internal::ApprovalRequestsCursorPage,
    model: Cerca::ApprovalRequest,
    options: options
  )
end

#resolve(agent_id, thread_id, approval_id, decision:, grant: nil, request_options: {}) ⇒ Cerca::Models::ApprovalRequest

Create approval

Parameters:

Returns:

See Also:



53
54
55
56
57
58
59
60
61
62
# File 'lib/cerca/resources/approval_requests.rb', line 53

def resolve(agent_id, thread_id, approval_id, params)
  parsed, options = Cerca::ApprovalRequestResolveParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["agents/%1$s/threads/%2$s/approvals/%3$s", agent_id, thread_id, approval_id],
    body: parsed,
    model: Cerca::ApprovalRequest,
    options: options
  )
end