Approval methods: approve, refuse
The Approval Verbs approve, refuse as typed SDK methods, with inputs, result, refusals and an example.
Reference for Approval, one group of Approval methods.
Approval.approve
Approve allows the pending Action an Approval holds, and that Action runs. Verb page.
interface ApprovalVerbs {
approve(input: ApprovalApproveInput, options?: SB.CallOptions): SB.Call<Approval>
}Emits Approval.approved.
Inputs
| Input | Type | Required | Description |
|---|---|---|---|
approval | Approval | required | The open Approval. |
note | text | Why it is approved. |
Returns
| Output | Type | Required | Description |
|---|---|---|---|
approval | Approval | required | The approved Approval. |
Refuses when
| Check | Error | Fix | Then call |
|---|---|---|---|
| The key is valid, but its scopes do not allow this operation. | forbidden | Use a key whose scopes cover the operation, or ask an owner of the namespace to grant them. | None. |
| The record is not in a state that allows this Verb, so the call is refused. | refused | Read the record, run the Verb that moves it to an allowed state, then retry. | None. |
Example
import { $ } from 'startup-builder'
const approval = await $.Approval.approve({ approval: 'approval_TlxQeWh9uX' })Approval.refuse
Refuse declines an Approval, which sets the Action it holds to refused with the reason given. Verb page.
interface ApprovalVerbs {
refuse(input: ApprovalRefuseInput, options?: SB.CallOptions): SB.Call<Approval>
}Emits Approval.refused.
Inputs
| Input | Type | Required | Description |
|---|---|---|---|
approval | Approval | required | The open Approval. |
reason | text | required | Why it is refused. |
Returns
| Output | Type | Required | Description |
|---|---|---|---|
approval | Approval | required | The refused Approval. |
Refuses when
| Check | Error | Fix | Then call |
|---|---|---|---|
| The key is valid, but its scopes do not allow this operation. | forbidden | Use a key whose scopes cover the operation, or ask an owner of the namespace to grant them. | None. |
| The record is not in a state that allows this Verb, so the call is refused. | refused | Read the record, run the Verb that moves it to an allowed state, then retry. | None. |
Example
import { $ } from 'startup-builder'
const approval = await $.Approval.refuse({ approval: 'approval_TlxQeWh9uX', reason: 'Example reason' })