1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-11 00:08:30 +01:00
unleash.unleash/src/lib/openapi/spec/public-signup-token-schema.ts
andreas-unleash 193c12acd8
chore: docs for public signup token tag (#3486)
<!-- Thanks for creating a PR! To make it easier for reviewers and
everyone else to understand what your changes relate to, please add some
relevant content to the headings below. Feel free to ignore or delete
sections that you don't think are relevant. Thank you! ❤️ -->

## About the changes
<!-- Describe the changes introduced. What are they and why are they
being introduced? Feel free to also add screenshots or steps to view the
changes if they're visual. -->

<!-- Does it close an issue? Multiple? -->
Closes #
[1-863](https://linear.app/unleash/issue/1-836/update-endpoints-for-tag-public-signup-tokens)

<!-- (For internal contributors): Does it relate to an issue on public
roadmap? -->
<!--
Relates to [roadmap](https://github.com/orgs/Unleash/projects/10) item:
#
-->

### Important files
<!-- PRs can contain a lot of changes, but not all changes are equally
important. Where should a reviewer start looking to get an overview of
the changes? Are any files particularly important? -->


## Discussion points
<!-- Anything about the PR you'd like to discuss before it gets merged?
Got any questions or doubts? -->

---------

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
Co-authored-by: Thomas Heartman <thomas@getunleash.ai>
2023-04-21 11:26:54 +00:00

89 lines
2.8 KiB
TypeScript

import { FromSchema } from 'json-schema-to-ts';
import { userSchema } from './user-schema';
import { roleSchema } from './role-schema';
export const publicSignupTokenSchema = {
$id: '#/components/schemas/publicSignupTokenSchema',
description:
'Used for transporting a [public invite link](https://docs.getunleash.io/reference/public-signup#public-sign-up-tokens)',
type: 'object',
additionalProperties: false,
required: [
'secret',
'url',
'name',
'expiresAt',
'createdAt',
'createdBy',
'enabled',
'role',
],
properties: {
secret: {
description:
'The actual value of the token. This is the part that is used by Unleash to create an invite link',
type: 'string',
example: 'a3c84b25409ea8ca1782ef17f94a42fc',
},
url: {
description:
'The public signup link for the token. Users who follow this link will be taken to a signup page where they can create an Unleash user.',
type: 'string',
example:
'https://sandbox.getunleash.io/enterprise/new-user?invite=a3c84b25409ea8ca1782ef17f94a42fc',
},
name: {
description: "The token's name. Only for displaying in the UI",
type: 'string',
example: 'Invite public viewers',
},
enabled: {
description:
'Whether the token is active. This property will always be `false` for a token that has expired.',
type: 'boolean',
example: true,
},
expiresAt: {
type: 'string',
description: 'The time when the token will expire.',
format: 'date-time',
example: '2023-04-12T11:13:31.960Z',
},
createdAt: {
type: 'string',
format: 'date-time',
description: 'When the token was created.',
example: '2023-04-12T11:13:31.960Z',
},
createdBy: {
description: "The creator's email or username",
example: 'someone@example.com',
type: 'string',
nullable: true,
},
users: {
type: 'array',
description: 'Array of users that have signed up using the token.',
items: {
$ref: '#/components/schemas/userSchema',
},
nullable: true,
},
role: {
description:
'Users who sign up using this token will be given this role.',
$ref: '#/components/schemas/roleSchema',
},
},
components: {
schemas: {
userSchema,
roleSchema,
},
},
} as const;
export type PublicSignupTokenSchema = FromSchema<
typeof publicSignupTokenSchema
>;