Managing tenants for the current user
await nile.withContext({ tenantId })
. withContext
returns a copy of the nile instance with a context that captures what was passed. It also accepts a second parameter for convenience for multiple requests.
withContext
every time may not be necessary in those environments. see extensions for more informationcreate()
get()
list()
POST /api/tenants
. The current user is automatically linked to the new tenant.
name
: Name of the tenant (required)id
: Optional. Unique ID to use instead of auto-generatingTenant
object:
Response
with 401 or 400 on failure.
GET /api/tenants/{id}
.
id
: Optional. If omitted, uses the current contextTenant
object or a raw Response
.
PUT /api/tenants/{id}
.
name
: New name of the tenantid
: Optional. If omitted, uses contextTenant
object or a Response
.
DELETE /api/tenants/{id}
. This is a soft delete.
Response
with status 204 on success.
GET /api/tenants/by-user
.
Tenant
objects:
User
objects, or a Response
on error.
User
object or a Response
.
Response
.
Response
.
Invite
objects.
callbackUrl
is the value that is used to return the user to a page that renders HTML. There is a primary endpoint that is used to exchange the token in the email to join the tenant. Upon a successful exchange, the user will be redirected to the callbackUrl
email
: Email of the user to invitecallbackUrl
: Optional URL to redirect after acceptanceredirectUrl
: Optional URL used as the base in the emailInvite
object or a Response
.
Response
indicating success or failure.
Response
.