-import { BooleanBothQuery, SearchTargetType } from '@shared/models'
+import { BooleanBothQuery, BooleanQuery, SearchTargetType, VideosSearchQuery } from '@shared/models'
export class AdvancedSearch {
startDate: string // ISO 8601
durationMin: number // seconds
durationMax: number // seconds
+ isLive: BooleanQuery
+
sort: string
searchTarget: SearchTargetType
tagsOneOf?: any
tagsAllOf?: any
+ isLive?: BooleanQuery
+
durationMin?: string
durationMax?: string
sort?: string
this.originallyPublishedEndDate = options.originallyPublishedEndDate || undefined
this.nsfw = options.nsfw || undefined
+ this.isLive = options.isLive || undefined
+
this.categoryOneOf = options.categoryOneOf || undefined
this.licenceOneOf = options.licenceOneOf || undefined
this.languageOneOf = options.languageOneOf || undefined
this.tagsAllOf = undefined
this.durationMin = undefined
this.durationMax = undefined
+ this.isLive = undefined
this.sort = '-match'
}
tagsAllOf: this.tagsAllOf,
durationMin: this.durationMin,
durationMax: this.durationMax,
+ isLive: this.isLive,
sort: this.sort,
searchTarget: this.searchTarget
}
}
- toAPIObject () {
+ toAPIObject (): VideosSearchQuery {
+ let isLive: boolean
+ if (this.isLive) isLive = this.isLive === 'true'
+
return {
startDate: this.startDate,
endDate: this.endDate,
tagsAllOf: this.tagsAllOf,
durationMin: this.durationMin,
durationMax: this.durationMax,
+ isLive,
sort: this.sort,
searchTarget: this.searchTarget
}