Tenant methods: invite, pin, provision, requestSetup
The Tenant Verbs invite, pin, provision, requestSetup as typed SDK methods, with inputs, result, refusals and an example.
Reference for Tenant, one group of Tenant methods.
Tenant.invite
Invite asks a Person to join a Customer’s Tenant, and resizes the Subscription when the Offer prices per member. Verb page.
interface TenantVerbs {
invite(input: TenantInviteInput, options?: SB.CallOptions): SB.Call<TenantInviteOutput>
}Emits Tenant.invited.
Inputs
| Input | Type | Required | Description |
|---|---|---|---|
tenant | Tenant | required | The Customer’s Tenant. |
email | email | required | Where the invitation goes. |
Returns
| Output | Type | Required | Description |
|---|---|---|---|
person | Person | required | The invited Person. |
tenant | Tenant | required | The Tenant the Person was invited to. |
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. |
Example
import { $ } from 'startup-builder'
const { person, tenant } = await $.Tenant.invite({ tenant: 'ten_Bu63f0he26', email: 'dana@leaseline.app' })Tenant.pin
Pin moves a Tenant’s keys to another API version, or to latest, once a call with its test key passes there. Verb page.
interface TenantVerbs {
pin(input: TenantPinInput, options?: SB.CallOptions): SB.Call<Tenant>
}Emits Tenant.pinned.
Inputs
| Input | Type | Required | Description |
|---|---|---|---|
tenant | Tenant | required | The Tenant whose keys move. |
apiVersion | string | required | The version to answer at, such as v2, or latest to track the newest. |
Returns
| Output | Type | Required | Description |
|---|---|---|---|
tenant | Tenant | required | The Tenant, answering at its new version. |
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. |
| Until a call with the Tenant’s test key succeeds at the target version | refused | Clear what the check names, then call it again. | None. |
Example
import { $ } from 'startup-builder'
const tenant = await $.Tenant.pin({ tenant: 'ten_Bu63f0he26', apiVersion: 'v2' })Tenant.provision
Provision creates a Customer’s Tenant in a Startup’s App, holding that Customer’s records apart from every other. Verb page.
interface TenantVerbs {
provision(input: TenantProvisionInput, options?: SB.CallOptions): SB.Call<Tenant>
}Emits Tenant.provisioned.
Inputs
| Input | Type | Required | Description |
|---|---|---|---|
customer | Customer | required | The Customer the Tenant serves. |
Returns
| Output | Type | Required | Description |
|---|---|---|---|
tenant | Tenant | required | The new Tenant. |
Refuses when
| Check | Error | Fix | Then call |
|---|---|---|---|
| The operation is part of an Offer the caller has not accepted or paid for. | payment-required | Accept the Offer named in the response, then retry the call. | Offer.accept |
| 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 tenant = await $.Tenant.provision({ customer: 'cus_K1BROJhqzZ' })Tenant.requestSetup
RequestSetup sends a Customer’s admin a link to connect their own sign-in, directory or verified domain to the Tenant. Verb page.
interface TenantVerbs {
requestSetup(input: TenantRequestSetupInput, options?: SB.CallOptions): SB.Call<TenantRequestSetupOutput>
}Emits Tenant.setupRequested.
Inputs
| Input | Type | Required | Description |
|---|---|---|---|
tenant | Tenant | required | The Tenant to set up. |
admin | Person | required | The Customer’s admin who receives the link. |
intent | string | required | What the link sets up. |
Returns
| Output | Type | Required | Description |
|---|---|---|---|
link | url | required | The single-use setup link, valid for 7 days. |
tenant | Tenant | required | The Tenant being set up. |
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. |
Example
import { $ } from 'startup-builder'
const { link, tenant } = await $.Tenant.requestSetup({ tenant: 'ten_Bu63f0he26', admin: 'person_sLqbXbW683', intent: 'sso' })