Changeset View
Changeset View
Standalone View
Standalone View
lib/types/messages/toggle-pin.js
// @flow | // @flow | ||||
import t, { type TInterface } from 'tcomb'; | |||||
import { tID, tNumber, tShape } from '../../utils/validation-utils.js'; | |||||
import { messageTypes } from '../message-types-enum.js'; | |||||
import type { RelativeUserInfo } from '../user-types.js'; | import type { RelativeUserInfo } from '../user-types.js'; | ||||
export type TogglePinMessageData = { | export type TogglePinMessageData = { | ||||
+type: 21, | +type: 21, | ||||
+threadID: string, | +threadID: string, | ||||
+targetMessageID: string, | +targetMessageID: string, | ||||
+action: 'pin' | 'unpin', | +action: 'pin' | 'unpin', | ||||
+pinnedContent: string, | +pinnedContent: string, | ||||
+creatorID: string, | +creatorID: string, | ||||
+time: number, | +time: number, | ||||
}; | }; | ||||
export type RawTogglePinMessageInfo = { | export type RawTogglePinMessageInfo = { | ||||
...TogglePinMessageData, | ...TogglePinMessageData, | ||||
+id: string, | +id: string, | ||||
}; | }; | ||||
export const rawTogglePinMessageInfoValidator: TInterface<RawTogglePinMessageInfo> = | |||||
tShape<RawTogglePinMessageInfo>({ | |||||
type: tNumber(messageTypes.TOGGLE_PIN), | |||||
threadID: tID, | |||||
targetMessageID: tID, | |||||
action: t.enums.of(['pin', 'unpin']), | |||||
pinnedContent: t.String, | |||||
creatorID: t.String, | |||||
time: t.Number, | |||||
id: tID, | |||||
}); | |||||
export type TogglePinMessageInfo = { | export type TogglePinMessageInfo = { | ||||
+type: 21, | +type: 21, | ||||
+id: string, | +id: string, | ||||
+threadID: string, | +threadID: string, | ||||
+targetMessageID: string, | +targetMessageID: string, | ||||
+action: 'pin' | 'unpin', | +action: 'pin' | 'unpin', | ||||
+pinnedContent: string, | +pinnedContent: string, | ||||
+creator: RelativeUserInfo, | +creator: RelativeUserInfo, | ||||
+time: number, | +time: number, | ||||
}; | }; |