Changeset View
Changeset View
Standalone View
Standalone View
lib/types/link-types.js
// @flow | // @flow | ||||
import t, { type TInterface } from 'tcomb'; | |||||
import { tID, tShape } from '../utils/validation-utils.js'; | |||||
export type InviteLinkVerificationRequest = { | export type InviteLinkVerificationRequest = { | ||||
+secret: string, | +secret: string, | ||||
}; | }; | ||||
export type InviteLinkVerificationResponse = | export type InviteLinkVerificationResponse = | ||||
| { | | { | ||||
+status: 'valid' | 'already_joined', | +status: 'valid' | 'already_joined', | ||||
+community: { | +community: { | ||||
Show All 10 Lines | export type InviteLink = { | ||||
+primary: boolean, | +primary: boolean, | ||||
+role: string, | +role: string, | ||||
+communityID: string, | +communityID: string, | ||||
+expirationTime: number, | +expirationTime: number, | ||||
+limitOfUses: number, | +limitOfUses: number, | ||||
+numberOfUses: number, | +numberOfUses: number, | ||||
}; | }; | ||||
export const inviteLinkValidator: TInterface<InviteLink> = tShape<InviteLink>({ | |||||
name: t.String, | |||||
primary: t.Boolean, | |||||
role: tID, | |||||
communityID: tID, | |||||
expirationTime: t.Number, | |||||
limitOfUses: t.Number, | |||||
numberOfUses: t.Number, | |||||
}); | |||||
export type FetchInviteLinksResponse = { | export type FetchInviteLinksResponse = { | ||||
+links: $ReadOnlyArray<InviteLink>, | +links: $ReadOnlyArray<InviteLink>, | ||||
}; | }; |