From 1ca9f7c3f7afac2af4c4c25b98426731f7e789c6 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 20 Aug 2019 19:05:31 +0200 Subject: Type toFormattedJSON --- server/typings/models/account/account-blocklist.ts | 10 +++++++- server/typings/models/account/account.ts | 21 ++++++++++++++--- server/typings/models/account/actor-follow.ts | 16 +++++++++++-- server/typings/models/account/actor.ts | 23 ++++++++++++++---- server/typings/models/account/avatar.ts | 8 +++++++ server/typings/models/server/plugin.ts | 7 ++++++ server/typings/models/server/server-blocklist.ts | 10 +++++++- server/typings/models/server/server.ts | 10 +++++++- .../models/user/user-notification-setting.ts | 6 +++++ server/typings/models/user/user.ts | 25 +++++++++++++++++--- .../typings/models/video/schedule-video-update.ts | 6 +++++ server/typings/models/video/video-abuse.ts | 10 +++++++- server/typings/models/video/video-blacklist.ts | 9 +++++++- server/typings/models/video/video-caption.ts | 14 ++++++++--- .../typings/models/video/video-change-ownership.ts | 11 ++++++++- server/typings/models/video/video-channels.ts | 27 +++++++++++++++++++--- server/typings/models/video/video-comment.ts | 10 +++++++- server/typings/models/video/video-import.ts | 11 +++++++-- .../typings/models/video/video-playlist-element.ts | 11 +++++++-- server/typings/models/video/video-playlist.ts | 14 ++++++++--- server/typings/models/video/video-rate.ts | 9 +++++++- server/typings/models/video/video.ts | 27 ++++++++++++++++++++-- 22 files changed, 260 insertions(+), 35 deletions(-) (limited to 'server/typings/models') diff --git a/server/typings/models/account/account-blocklist.ts b/server/typings/models/account/account-blocklist.ts index d20d97aa8..c9cb55332 100644 --- a/server/typings/models/account/account-blocklist.ts +++ b/server/typings/models/account/account-blocklist.ts @@ -1,6 +1,6 @@ import { AccountBlocklistModel } from '../../../models/account/account-blocklist' import { PickWith } from '../../utils' -import { MAccountDefault } from './account' +import { MAccountDefault, MAccountFormattable } from './account' type Use = PickWith @@ -15,3 +15,11 @@ export type MAccountBlocklistId = Pick export type MAccountBlocklistAccounts = MAccountBlocklist & Use<'ByAccount', MAccountDefault> & Use<'BlockedAccount', MAccountDefault> + +// ############################################################################ + +// Format for API or AP object + +export type MAccountBlocklistFormattable = Pick & + Use<'ByAccount', MAccountFormattable> & + Use<'BlockedAccount', MAccountFormattable> diff --git a/server/typings/models/account/account.ts b/server/typings/models/account/account.ts index 9a8784e6b..33940517e 100644 --- a/server/typings/models/account/account.ts +++ b/server/typings/models/account/account.ts @@ -9,9 +9,11 @@ import { MActorId, MActorServer, MActorSummary, - MActorUrl + MActorSummaryFormattable, + MActorUrl, + MActorFormattable } from './actor' -import { PickWith } from '../../utils' +import { FunctionProperties, PickWith } from '../../utils' import { MAccountBlocklistId } from './account-blocklist' import { MChannelDefault } from '@server/typings/models' @@ -67,7 +69,8 @@ export type MAccountServer = MAccount & // For API -export type MAccountSummary = Pick & +export type MAccountSummary = FunctionProperties & + Pick & Use<'Actor', MActorSummary> export type MAccountSummaryBlocks = MAccountSummary & @@ -75,3 +78,15 @@ export type MAccountSummaryBlocks = MAccountSummary & export type MAccountAPI = MAccount & Use<'Actor', MActorAPI> + +// ############################################################################ + +// Format for API or AP object + +export type MAccountSummaryFormattable = FunctionProperties & + Pick & + Use<'Actor', MActorSummaryFormattable> + +export type MAccountFormattable = FunctionProperties & + Pick & + Use<'Actor', MActorFormattable> diff --git a/server/typings/models/account/actor-follow.ts b/server/typings/models/account/actor-follow.ts index 87050ac63..17a47b8df 100644 --- a/server/typings/models/account/actor-follow.ts +++ b/server/typings/models/account/actor-follow.ts @@ -3,14 +3,15 @@ import { MActor, MActorAccount, MActorAccountChannel, - MActorChannel, MActorChannelAccountActor, MActorDefault, + MActorFormattable, MActorHost, MActorUsername } from './actor' import { PickWith } from '../../utils' import { ActorModel } from '@server/models/activitypub/actor' +import { MChannelDefault } from '@server/typings/models' type Use = PickWith @@ -43,9 +44,12 @@ export type MActorFollowFull = MActorFollow & // For subscriptions +type SubscriptionFollowing = MActorDefault & + PickWith + export type MActorFollowActorsDefaultSubscription = MActorFollow & Use<'ActorFollower', MActorDefault> & - Use<'ActorFollowing', MActorDefault & MActorChannel> + Use<'ActorFollowing', SubscriptionFollowing> export type MActorFollowFollowingFullFollowerAccount = MActorFollow & Use<'ActorFollower', MActorAccount> & @@ -53,3 +57,11 @@ export type MActorFollowFollowingFullFollowerAccount = MActorFollow & export type MActorFollowSubscriptions = MActorFollow & Use<'ActorFollowing', MActorChannelAccountActor> + +// ############################################################################ + +// Format for API or AP object + +export type MActorFollowFormattable = Pick & + Use<'ActorFollower', MActorFormattable> & + Use<'ActorFollowing', MActorFormattable> diff --git a/server/typings/models/account/actor.ts b/server/typings/models/account/actor.ts index 7d99a433b..14ab2cd5b 100644 --- a/server/typings/models/account/actor.ts +++ b/server/typings/models/account/actor.ts @@ -1,8 +1,8 @@ import { ActorModel } from '../../../models/activitypub/actor' -import { PickWith } from '../../utils' +import { FunctionProperties, PickWith } from '../../utils' import { MAccount, MAccountDefault, MAccountId, MAccountIdActor } from './account' -import { MServer, MServerHost, MServerHostBlocks } from '../server' -import { MAvatar } from './avatar' +import { MServer, MServerHost, MServerHostBlocks, MServerRedundancyAllowed } from '../server' +import { MAvatar, MAvatarFormattable } from './avatar' import { MChannel, MChannelAccountActor, MChannelAccountDefault, MChannelId, MChannelIdActor } from '../video' type Use = PickWith @@ -29,6 +29,7 @@ export type MActorLight = Omit // Some association attributes export type MActorHost = Use<'Server', MServerHost> +export type MActorRedundancyAllowed = Use<'Server', MServerRedundancyAllowed> export type MActorDefaultLight = MActorLight & Use<'Server', MServerHost> & @@ -92,7 +93,8 @@ export type MActorFullActor = MActor & // API -export type MActorSummary = Pick & +export type MActorSummary = FunctionProperties & + Pick & Use<'Server', MServerHost> & Use<'Avatar', MAvatar> @@ -101,3 +103,16 @@ export type MActorSummaryBlocks = MActorSummary & export type MActorAPI = Omit + +// ############################################################################ + +// Format for API or AP object + +export type MActorSummaryFormattable = FunctionProperties & + Pick & + Use<'Server', MServerHost> & + Use<'Avatar', MAvatarFormattable> + +export type MActorFormattable = MActorSummaryFormattable & + Pick & + Use<'Server', MServer> diff --git a/server/typings/models/account/avatar.ts b/server/typings/models/account/avatar.ts index 257c48bfc..8af6cc787 100644 --- a/server/typings/models/account/avatar.ts +++ b/server/typings/models/account/avatar.ts @@ -1,3 +1,11 @@ import { AvatarModel } from '../../../models/avatar/avatar' +import { FunctionProperties } from '@server/typings/utils' export type MAvatar = AvatarModel + +// ############################################################################ + +// Format for API or AP object + +export type MAvatarFormattable = FunctionProperties & + Pick diff --git a/server/typings/models/server/plugin.ts b/server/typings/models/server/plugin.ts index b1e2e149d..94674c318 100644 --- a/server/typings/models/server/plugin.ts +++ b/server/typings/models/server/plugin.ts @@ -1,3 +1,10 @@ import { PluginModel } from '@server/models/server/plugin' export type MPlugin = PluginModel + +// ############################################################################ + +// Format for API or AP object + +export type MPluginFormattable = Pick diff --git a/server/typings/models/server/server-blocklist.ts b/server/typings/models/server/server-blocklist.ts index 0ca00b5c2..c81f604f5 100644 --- a/server/typings/models/server/server-blocklist.ts +++ b/server/typings/models/server/server-blocklist.ts @@ -1,6 +1,6 @@ import { ServerBlocklistModel } from '@server/models/server/server-blocklist' import { PickWith } from '@server/typings/utils' -import { MAccountDefault, MServer } from '@server/typings/models' +import { MAccountDefault, MAccountFormattable, MServer, MServerFormattable } from '@server/typings/models' type Use = PickWith @@ -13,3 +13,11 @@ export type MServerBlocklist = Omit & Use<'BlockedServer', MServer> + +// ############################################################################ + +// Format for API or AP object + +export type MServerBlocklistFormattable = Pick & + Use<'ByAccount', MAccountFormattable> & + Use<'BlockedServer', MServerFormattable> diff --git a/server/typings/models/server/server.ts b/server/typings/models/server/server.ts index c059cff79..190cc0c28 100644 --- a/server/typings/models/server/server.ts +++ b/server/typings/models/server/server.ts @@ -1,5 +1,5 @@ import { ServerModel } from '../../../models/server/server' -import { PickWith } from '../../utils' +import { FunctionProperties, PickWith } from '../../utils' import { MAccountBlocklistId } from '../account' type Use = PickWith @@ -11,6 +11,14 @@ export type MServer = Omit // ############################################################################ export type MServerHost = Pick +export type MServerRedundancyAllowed = Pick export type MServerHostBlocks = MServerHost & Use<'BlockedByAccounts', MAccountBlocklistId[]> + +// ############################################################################ + +// Format for API or AP object + +export type MServerFormattable = FunctionProperties & + Pick diff --git a/server/typings/models/user/user-notification-setting.ts b/server/typings/models/user/user-notification-setting.ts index 585d30a66..c674add1b 100644 --- a/server/typings/models/user/user-notification-setting.ts +++ b/server/typings/models/user/user-notification-setting.ts @@ -1,3 +1,9 @@ import { UserNotificationSettingModel } from '@server/models/account/user-notification-setting' export type MNotificationSetting = Omit + +// ############################################################################ + +// Format for API or AP object + +export type MNotificationSettingFormattable = MNotificationSetting diff --git a/server/typings/models/user/user.ts b/server/typings/models/user/user.ts index 466cde33b..52d6d4a05 100644 --- a/server/typings/models/user/user.ts +++ b/server/typings/models/user/user.ts @@ -1,7 +1,17 @@ import { UserModel } from '../../../models/account/user' -import { PickWith } from '../../utils' -import { MAccount, MAccountDefault, MAccountDefaultChannelDefault, MAccountId, MAccountIdActorId, MAccountUrl } from '../account' -import { MNotificationSetting } from './user-notification-setting' +import { PickWith, PickWithOpt } from '../../utils' +import { + MAccount, + MAccountDefault, + MAccountDefaultChannelDefault, + MAccountFormattable, + MAccountId, + MAccountIdActorId, + MAccountUrl +} from '../account' +import { MNotificationSetting, MNotificationSettingFormattable } from './user-notification-setting' +import { AccountModel } from '@server/models/account/account' +import { MChannelFormattable } from '@server/typings/models' type Use = PickWith @@ -11,6 +21,7 @@ export type MUser = Omit // ############################################################################ @@ -49,3 +60,11 @@ export type MUserNotifSettingAccount = MUser & export type MUserDefault = MUser & Use<'NotificationSetting', MNotificationSetting> & Use<'Account', MAccountDefault> + +// ############################################################################ + +// Format for API or AP object + +export type MUserFormattable = MUserQuotaUsed & + Use<'Account', MAccountFormattable & PickWithOpt> & + PickWithOpt diff --git a/server/typings/models/video/schedule-video-update.ts b/server/typings/models/video/schedule-video-update.ts index 069705536..ada9af06e 100644 --- a/server/typings/models/video/schedule-video-update.ts +++ b/server/typings/models/video/schedule-video-update.ts @@ -1,3 +1,9 @@ import { ScheduleVideoUpdateModel } from '../../../models/video/schedule-video-update' export type MScheduleVideoUpdate = Omit + +// ############################################################################ + +// Format for API or AP object + +export type MScheduleVideoUpdateFormattable = Pick diff --git a/server/typings/models/video/video-abuse.ts b/server/typings/models/video/video-abuse.ts index 0474cac5b..e38c3f586 100644 --- a/server/typings/models/video/video-abuse.ts +++ b/server/typings/models/video/video-abuse.ts @@ -1,7 +1,7 @@ import { VideoAbuseModel } from '../../../models/video/video-abuse' import { PickWith } from '../../utils' import { MVideo } from './video' -import { MAccountDefault } from '../account' +import { MAccountDefault, MAccountFormattable } from '../account' type Use = PickWith @@ -21,3 +21,11 @@ export type MVideoAbuseAccountVideo = MVideoAbuse & Pick & Use<'Video', MVideo> & Use<'Account', MAccountDefault> + +// ############################################################################ + +// Format for API or AP object + +export type MVideoAbuseFormattable = MVideoAbuse & + Use<'Account', MAccountFormattable> & + Use<'Video', Pick> diff --git a/server/typings/models/video/video-blacklist.ts b/server/typings/models/video/video-blacklist.ts index cc539f95c..1dedfa37f 100644 --- a/server/typings/models/video/video-blacklist.ts +++ b/server/typings/models/video/video-blacklist.ts @@ -1,6 +1,6 @@ import { VideoBlacklistModel } from '../../../models/video/video-blacklist' import { PickWith } from '@server/typings/utils' -import { MVideo } from '@server/typings/models' +import { MVideo, MVideoFormattable } from '@server/typings/models' type Use = PickWith @@ -15,3 +15,10 @@ export type MVideoBlacklistUnfederated = Pick export type MVideoBlacklistVideo = MVideoBlacklist & Use<'Video', MVideo> + +// ############################################################################ + +// Format for API or AP object + +export type MVideoBlacklistFormattable = MVideoBlacklist & + Use<'Video', MVideoFormattable> diff --git a/server/typings/models/video/video-caption.ts b/server/typings/models/video/video-caption.ts index fe0e664c2..7cb2a2ad3 100644 --- a/server/typings/models/video/video-caption.ts +++ b/server/typings/models/video/video-caption.ts @@ -1,6 +1,6 @@ import { VideoCaptionModel } from '../../../models/video/video-caption' -import { PickWith } from '@server/typings/utils' -import { VideoModel } from '@server/models/video/video' +import { FunctionProperties, PickWith } from '@server/typings/utils' +import { MVideo, MVideoUUID } from '@server/typings/models' type Use = PickWith @@ -13,4 +13,12 @@ export type MVideoCaption = Omit export type MVideoCaptionLanguage = Pick export type MVideoCaptionVideo = MVideoCaption & - Use<'Video', Pick> + Use<'Video', Pick> + +// ############################################################################ + +// Format for API or AP object + +export type MVideoCaptionFormattable = FunctionProperties & + Pick & + Use<'Video', MVideoUUID> diff --git a/server/typings/models/video/video-change-ownership.ts b/server/typings/models/video/video-change-ownership.ts index 0410115c6..72634cdb2 100644 --- a/server/typings/models/video/video-change-ownership.ts +++ b/server/typings/models/video/video-change-ownership.ts @@ -1,6 +1,6 @@ import { VideoChangeOwnershipModel } from '@server/models/video/video-change-ownership' import { PickWith } from '@server/typings/utils' -import { MAccountDefault, MVideoWithFileThumbnail } from '@server/typings/models' +import { MAccountDefault, MAccountFormattable, MVideo, MVideoWithFileThumbnail } from '@server/typings/models' type Use = PickWith @@ -12,3 +12,12 @@ export type MVideoChangeOwnershipFull = MVideoChangeOwnership & Use<'Initiator', MAccountDefault> & Use<'NextOwner', MAccountDefault> & Use<'Video', MVideoWithFileThumbnail> + +// ############################################################################ + +// Format for API or AP object + +export type MVideoChangeOwnershipFormattable = Pick & + Use<'Initiator', MAccountFormattable> & + Use<'NextOwner', MAccountFormattable> & + Use<'Video', Pick> diff --git a/server/typings/models/video/video-channels.ts b/server/typings/models/video/video-channels.ts index b6506ed9f..2be7dd7ed 100644 --- a/server/typings/models/video/video-channels.ts +++ b/server/typings/models/video/video-channels.ts @@ -1,19 +1,23 @@ -import { PickWith } from '../../utils' +import { FunctionProperties, PickWith, PickWithOpt } from '../../utils' import { VideoChannelModel } from '../../../models/video/video-channel' import { MAccountActor, MAccountAPI, MAccountDefault, + MAccountFormattable, MAccountLight, MAccountSummaryBlocks, + MAccountSummaryFormattable, MAccountUserId, MActor, MActorAccountChannelId, MActorAPI, MActorDefault, MActorDefaultLight, + MActorFormattable, MActorLight, - MActorSummary + MActorSummary, + MActorSummaryFormattable } from '../account' import { MVideo } from './video' @@ -86,7 +90,8 @@ export type MChannelActorAccountDefaultVideos = MChannel & // For API -export type MChannelSummary = Pick & +export type MChannelSummary = FunctionProperties & + Pick & Use<'Actor', MActorSummary> export type MChannelSummaryAccount = MChannelSummary & @@ -95,3 +100,19 @@ export type MChannelSummaryAccount = MChannelSummary & export type MChannelAPI = MChannel & Use<'Actor', MActorAPI> & Use<'Account', MAccountAPI> + +// ############################################################################ + +// Format for API or AP object + +export type MChannelSummaryFormattable = FunctionProperties & + Pick & + Use<'Actor', MActorSummaryFormattable> + +export type MChannelAccountSummaryFormattable = MChannelSummaryFormattable & + Use<'Account', MAccountSummaryFormattable> + +export type MChannelFormattable = FunctionProperties & + Pick & + Use<'Actor', MActorFormattable> & + PickWithOpt diff --git a/server/typings/models/video/video-comment.ts b/server/typings/models/video/video-comment.ts index 187461213..e8bccba0f 100644 --- a/server/typings/models/video/video-comment.ts +++ b/server/typings/models/video/video-comment.ts @@ -1,6 +1,6 @@ import { VideoCommentModel } from '../../../models/video/video-comment' import { PickWith } from '../../utils' -import { MAccountDefault } from '../account' +import { MAccountDefault, MAccountFormattable } from '../account' import { MVideoAccountLight, MVideoFeed, MVideoIdUrl } from './video' type Use = PickWith @@ -8,6 +8,7 @@ type Use = PickWith +export type MCommentTotalReplies = MComment & { totalReplies?: number } export type MCommentId = Pick // ############################################################################ @@ -41,3 +42,10 @@ export type MCommentOwnerVideoFeed = MCommentOwner & // ############################################################################ export type MCommentAPI = MComment & { totalReplies: number } + +// ############################################################################ + +// Format for API or AP object + +export type MCommentFormattable = MCommentTotalReplies & + Use<'Account', MAccountFormattable> diff --git a/server/typings/models/video/video-import.ts b/server/typings/models/video/video-import.ts index ada723713..c6a1c5b66 100644 --- a/server/typings/models/video/video-import.ts +++ b/server/typings/models/video/video-import.ts @@ -1,6 +1,6 @@ import { VideoImportModel } from '@server/models/video/video-import' -import { PickWith } from '@server/typings/utils' -import { MUser, MVideo, MVideoAccountLight, MVideoTag, MVideoThumbnail, MVideoWithFile } from '@server/typings/models' +import { PickWith, PickWithOpt } from '@server/typings/utils' +import { MUser, MVideo, MVideoAccountLight, MVideoFormattable, MVideoTag, MVideoThumbnail, MVideoWithFile } from '@server/typings/models' type Use = PickWith @@ -22,3 +22,10 @@ export type MVideoImportDefault = MVideoImport & export type MVideoImportDefaultFiles = MVideoImport & Use<'User', MUser> & Use<'Video', VideoAssociation & MVideoWithFile> + +// ############################################################################ + +// Format for API or AP object + +export type MVideoImportFormattable = MVideoImport & + PickWithOpt diff --git a/server/typings/models/video/video-playlist-element.ts b/server/typings/models/video/video-playlist-element.ts index 5a039d7b1..1c256fd25 100644 --- a/server/typings/models/video/video-playlist-element.ts +++ b/server/typings/models/video/video-playlist-element.ts @@ -1,6 +1,6 @@ import { VideoPlaylistElementModel } from '@server/models/video/video-playlist-element' import { PickWith } from '@server/typings/utils' -import { MVideoPlaylistPrivacy, MVideoThumbnail, MVideoUrl } from '@server/typings/models' +import { MVideoFormattable, MVideoPlaylistPrivacy, MVideoThumbnail, MVideoUrl } from '@server/typings/models' type Use = PickWith @@ -23,6 +23,13 @@ export type MVideoPlaylistVideoThumbnail = MVideoPlaylistElement & // For API -export type MVideoPlaylistAP = MVideoPlaylistElement & +export type MVideoPlaylistElementAP = MVideoPlaylistElement & Use<'Video', MVideoUrl> & Use<'VideoPlaylist', MVideoPlaylistPrivacy> + +// ############################################################################ + +// Format for API or AP object + +export type MVideoPlaylistElementFormattable = MVideoPlaylistElement & + Use<'Video', MVideoFormattable> diff --git a/server/typings/models/video/video-playlist.ts b/server/typings/models/video/video-playlist.ts index 633818405..a926106c5 100644 --- a/server/typings/models/video/video-playlist.ts +++ b/server/typings/models/video/video-playlist.ts @@ -1,8 +1,8 @@ import { VideoPlaylistModel } from '../../../models/video/video-playlist' import { PickWith } from '../../utils' -import { MAccount, MAccountDefault, MAccountSummary } from '../account' +import { MAccount, MAccountDefault, MAccountSummary, MAccountSummaryFormattable } from '../account' import { MThumbnail } from './thumbnail' -import { MChannelDefault, MChannelSummary } from './video-channels' +import { MChannelDefault, MChannelSummary, MChannelSummaryFormattable } from './video-channels' import { MVideoPlaylistElementLight } from '@server/typings/models/video/video-playlist-element' type Use = PickWith @@ -16,7 +16,7 @@ export type MVideoPlaylist = Omit export type MVideoPlaylistPrivacy = Pick export type MVideoPlaylistUUID = Pick -export type MVideoPlaylistVideosLength = MVideoPlaylist & { videosLength: number } +export type MVideoPlaylistVideosLength = MVideoPlaylist & { videosLength?: number } // ############################################################################ @@ -78,3 +78,11 @@ export type MVideoPlaylistFullSummary = MVideoPlaylist & Use<'Thumbnail', MThumbnail> & Use<'OwnerAccount', MAccountSummary> & Use<'VideoChannel', MChannelSummary> + +// ############################################################################ + +// Format for API or AP object + +export type MVideoPlaylistFormattable = MVideoPlaylistVideosLength & + Use<'OwnerAccount', MAccountSummaryFormattable> & + Use<'VideoChannel', MChannelSummaryFormattable> diff --git a/server/typings/models/video/video-rate.ts b/server/typings/models/video/video-rate.ts index fc9329993..2ff8a625b 100644 --- a/server/typings/models/video/video-rate.ts +++ b/server/typings/models/video/video-rate.ts @@ -1,6 +1,6 @@ import { AccountVideoRateModel } from '@server/models/account/account-video-rate' import { PickWith } from '@server/typings/utils' -import { MAccountAudience, MAccountUrl, MVideo } from '..' +import { MAccountAudience, MAccountUrl, MVideo, MVideoFormattable } from '..' type Use = PickWith @@ -14,3 +14,10 @@ export type MAccountVideoRateAccountUrl = MAccountVideoRate & export type MAccountVideoRateAccountVideo = MAccountVideoRate & Use<'Account', MAccountAudience> & Use<'Video', MVideo> + +// ############################################################################ + +// Format for API or AP object + +export type MAccountVideoRateFormattable = Pick & + Use<'Video', MVideoFormattable> diff --git a/server/typings/models/video/video.ts b/server/typings/models/video/video.ts index 914eb7f57..bc6d56607 100644 --- a/server/typings/models/video/video.ts +++ b/server/typings/models/video/video.ts @@ -1,12 +1,19 @@ import { VideoModel } from '../../../models/video/video' import { PickWith, PickWithOpt } from '../../utils' -import { MChannelAccountDefault, MChannelAccountLight, MChannelActor, MChannelUserId } from './video-channels' +import { + MChannelAccountDefault, + MChannelAccountLight, + MChannelAccountSummaryFormattable, + MChannelActor, + MChannelFormattable, + MChannelUserId +} from './video-channels' import { MTag } from './tag' import { MVideoCaptionLanguage } from './video-caption' import { MStreamingPlaylist, MStreamingPlaylistRedundancies } from './video-streaming-playlist' import { MVideoFile, MVideoFileRedundanciesOpt } from './video-file' import { MThumbnail } from './thumbnail' -import { MVideoBlacklistLight, MVideoBlacklistUnfederated } from './video-blacklist' +import { MVideoBlacklist, MVideoBlacklistLight, MVideoBlacklistUnfederated } from './video-blacklist' import { MScheduleVideoUpdate } from './schedule-video-update' import { MUserVideoHistoryTime } from '../user/user-video-history' @@ -144,3 +151,19 @@ export type MVideoForUser = MVideo & Use<'ScheduleVideoUpdate', MScheduleVideoUpdate> & Use<'VideoBlacklist', MVideoBlacklistLight> & Use<'Thumbnails', MThumbnail[]> + +// ############################################################################ + +// Format for API or AP object + +export type MVideoFormattable = MVideo & + PickWithOpt & + Use<'VideoChannel', MChannelAccountSummaryFormattable> & + PickWithOpt> & + PickWithOpt> + +export type MVideoFormattableDetails = MVideoFormattable & + Use<'VideoChannel', MChannelFormattable> & + Use<'Tags', MTag[]> & + Use<'VideoStreamingPlaylists', MStreamingPlaylistRedundancies[]> & + Use<'VideoFiles', MVideoFileRedundanciesOpt[]> -- cgit v1.2.3