export namespace Models { export type ISOString = string; export enum PlaySegmentType { NEWEST = 'new', TRENDING = 'hot', BEST = 'best' } export interface IStreamSegmentQueryParams { segment: PlaySegmentType; releasedAfter?: ISOString; releasedBefore?: ISOString; limit?: number; } export enum StreamTypes { Mainstream = 'Mainstream', Channel = 'Channel', Player = 'Player', PlayType = 'PlayType', Event = 'Event', College = 'College' } export enum NotificationTypes { NewPlaysInStream = 'NewPlaysInStream', NewReplyToMyComment = 'NewReplyToMyComment', NewLikeOnMyComment = 'NewLikeOnMyComment', NewFollowerOfStream = 'NewFollowerOfStream', MyPlayReleased = 'MyPlayReleased', NewCommentOnPlay = 'NewCommentOnPlay', NewRatingOnPlay = 'NewRatingOnPlay' } export enum UserRoles { Admin = 'Admin', Partner = 'Partner', User = 'User' } export interface IUserCredentials { email: string; password: string; } export interface IUserRegistration { user_name: string; email: string; password: string; } export interface IIdTime { id: string; time: ISOString; } export interface IUser { _id: string; role: UserRoles; user_name: string; email: string; hashed_password: string; join_date: ISOString; saved_plays: IIdTime[]; streams_following: IIdTime[]; player_stream?: string; channel_stream?: string; device_ids: string[]; } export interface IDeviceIdDTO { device_id: string; } export interface IUserToken { user: IUser; auth_token: string; } export type StreamFollowingCounts = { [streamId: string]: number }; export interface IAuthDTOData { user: IUser; saved_plays: IStreamPlaysDTO; streams_following: IStream[]; user_ratings: Models.IRating[]; player_stream?: Models.IStream; channel_stream?: Models.IStream; } export interface IAuthDTO { auth_token?: string; data: IAuthDTOData; } export interface IRating { _id: string; time: ISOString; play_id: string; user_id: string; value: number; } export interface IChannelInfo { description: string; youtube_link: string; owner: string; } export interface IEventInfo { description: string; city: string; state: string; start_date: ISOString; end_date: ISOString; } export interface IPlayerInfo { height: number; weight: number; position: string; grad_year: number; school_name: string; city: string; state: string; } export interface IInputPlayDTO extends IPlayVideoUploadResponse { caption: string; streams: string[]; released_at?: ISOString; // if not supplied, will be set to current time related_url?: string; } export interface IPlay extends IInputPlayDTO { _id: string; uploader_id: string; released_at: string; } export interface IPlayDTO extends IPlay { num_comments: number; avg_comm_rating: number; num_ratings: number; } export interface IInputStream { type: StreamTypes; name: string; photo_url: string; player_info?: IPlayerInfo; channel_info?: IChannelInfo; event_info?: IEventInfo; is_suggestion?: boolean; } export interface IStream extends IInputStream { _id: string; is_suggestion: boolean; } export interface IEmailAvailabilityDTO { is_email_available: boolean; } export interface ICreatePlayerStreamResponse { user?: IUser; stream: Models.IStream; } export interface IInputComment { user_rating: number; user_name: string; user_photo?: string; text: string; parent?: string; } export interface IInputFeedback { email?: string; message: string; time: string; } export interface IFeedback extends IInputFeedback { _id: string; } export interface IComment extends IInputComment { _id: string; user_id: string; play_id: string; time: ISOString; likes: IIdTime[]; } export interface IInputStreamCollection { title: string; description: string; display_rank: number; streams: string[]; } export interface IStreamCollection extends IInputStreamCollection { _id: string; } export interface IPlayScreenDTO { play: IPlayDTO; streams: Models.IStream[]; } export interface IStreamCollectionsDTO { collections: IStreamCollection[]; streams: IStream[]; } export interface INotification { type: NotificationTypes; time: ISOString; } export interface INewPlaysInStream extends INotification { type: NotificationTypes.NewPlaysInStream; stream: IStream; plays: IPlayDTO[]; } export interface INewReplyToMyComment extends INotification { type: NotificationTypes.NewReplyToMyComment; play: IPlayDTO; comment: IComment; reply: IComment; } export interface INewLikeOnMyComment extends INotification { type: NotificationTypes.NewLikeOnMyComment; comment: IComment; userWhoLiked: IUser; } export interface INewFollowerOfMyStream extends INotification { type: NotificationTypes.NewFollowerOfStream; streamId: string; follower: IUser; } export interface IMyPlayReleased extends INotification { type: NotificationTypes.MyPlayReleased; play: IPlayDTO; } export interface INewCommentOnPlay extends INotification { type: NotificationTypes.NewCommentOnPlay; play: IPlayDTO; comment: IComment; } export interface INewRatingOnPlay extends INotification { type: NotificationTypes.NewRatingOnPlay; play: IPlayDTO; rating: IRating; user: IUser; } export interface IStreamPlaysDTO { streams: IStream[]; plays: IPlayDTO[]; } export interface IPhotoUploadResponse { source_photo_url: string; encoded_photo_url: string; } export interface IPlayVideoUploadResponse { source_video_url: string; encoded_video_url: string; thumbnail_url: string; blurred_thumbnail_url: string; } // tslint:disable-next-line:max-file-line-count }