-import { intoArray } from '@app/helpers'
+import { splitIntoArray } from '@app/helpers'
import {
BooleanBothQuery,
BooleanQuery,
searchTarget: SearchTargetType
resultType: AdvancedSearchResultType
+ excludeAlreadyWatched?: boolean
+
constructor (options?: {
startDate?: string
endDate?: string
sort?: string
searchTarget?: SearchTargetType
resultType?: AdvancedSearchResultType
+
+ excludeAlreadyWatched?: boolean
}) {
if (!options) return
this.categoryOneOf = options.categoryOneOf || undefined
this.licenceOneOf = options.licenceOneOf || undefined
this.languageOneOf = options.languageOneOf || undefined
- this.tagsOneOf = intoArray(options.tagsOneOf)
- this.tagsAllOf = intoArray(options.tagsAllOf)
+ this.tagsOneOf = splitIntoArray(options.tagsOneOf)
+ this.tagsAllOf = splitIntoArray(options.tagsAllOf)
this.durationMin = options.durationMin ? parseInt(options.durationMin, 10) : undefined
this.durationMax = options.durationMax ? parseInt(options.durationMax, 10) : undefined
this.resultType = options.resultType || undefined
+ this.excludeAlreadyWatched = options.excludeAlreadyWatched || undefined
+
if (!this.resultType && this.hasVideoFilter()) {
this.resultType = 'videos'
}
host: this.host,
sort: this.sort,
searchTarget: this.searchTarget,
- resultType: this.resultType
+ resultType: this.resultType,
+ excludeAlreadyWatched: this.excludeAlreadyWatched
}
}
originallyPublishedStartDate: this.originallyPublishedStartDate,
originallyPublishedEndDate: this.originallyPublishedEndDate,
nsfw: this.nsfw,
- categoryOneOf: intoArray(this.categoryOneOf),
- licenceOneOf: intoArray(this.licenceOneOf),
- languageOneOf: intoArray(this.languageOneOf),
+ categoryOneOf: splitIntoArray(this.categoryOneOf),
+ licenceOneOf: splitIntoArray(this.licenceOneOf),
+ languageOneOf: splitIntoArray(this.languageOneOf),
tagsOneOf: this.tagsOneOf,
tagsAllOf: this.tagsAllOf,
durationMin: this.durationMin,
host: this.host,
isLive,
sort: this.sort,
- searchTarget: this.searchTarget
+ searchTarget: this.searchTarget,
+ excludeAlreadyWatched: this.excludeAlreadyWatched
}
}