-async function getOrCreateVideoAndAccountAndChannel (options: {
- videoObject: { id: string } | string,
- syncParam?: SyncParam,
- fetchType?: VideoFetchByUrlType,
- allowRefresh?: boolean // true by default
-}) {
+type GetVideoResult <T> = Promise<{
+ video: T
+ created: boolean
+ autoBlacklisted?: boolean
+}>
+
+type GetVideoParamAll = {
+ videoObject: { id: string } | string
+ syncParam?: SyncParam
+ fetchType?: 'all'
+ allowRefresh?: boolean
+}
+
+type GetVideoParamImmutable = {
+ videoObject: { id: string } | string
+ syncParam?: SyncParam
+ fetchType: 'only-immutable-attributes'
+ allowRefresh: false
+}
+
+type GetVideoParamOther = {
+ videoObject: { id: string } | string
+ syncParam?: SyncParam
+ fetchType?: 'all' | 'only-video'
+ allowRefresh?: boolean
+}
+
+function getOrCreateVideoAndAccountAndChannel (options: GetVideoParamAll): GetVideoResult<MVideoAccountLightBlacklistAllFiles>
+function getOrCreateVideoAndAccountAndChannel (options: GetVideoParamImmutable): GetVideoResult<MVideoImmutable>
+function getOrCreateVideoAndAccountAndChannel (
+ options: GetVideoParamOther
+): GetVideoResult<MVideoAccountLightBlacklistAllFiles | MVideoThumbnail>
+async function getOrCreateVideoAndAccountAndChannel (
+ options: GetVideoParamAll | GetVideoParamImmutable | GetVideoParamOther
+): GetVideoResult<MVideoAccountLightBlacklistAllFiles | MVideoThumbnail | MVideoImmutable> {