durationMin: number // seconds
durationMax: number // seconds
+ sort: string
+
constructor (options?: {
startDate?: string
endDate?: string
tagsAllOf?: string
durationMin?: string
durationMax?: string
+ sort?: string
}) {
if (!options) return
if (isNaN(this.durationMin)) this.durationMin = undefined
if (isNaN(this.durationMax)) this.durationMax = undefined
+
+ this.sort = options.sort || '-match'
}
containsValues () {
const obj = this.toUrlObject()
for (const k of Object.keys(obj)) {
+ if (k === 'sort') continue // Exception
+
if (obj[k] !== undefined) return true
}
this.tagsAllOf = undefined
this.durationMin = undefined
this.durationMax = undefined
+
+ this.sort = '-match'
}
toUrlObject () {
tagsOneOf: this.tagsOneOf,
tagsAllOf: this.tagsAllOf,
durationMin: this.durationMin,
- durationMax: this.durationMax
+ durationMax: this.durationMax,
+ sort: this.sort
}
}
tagsOneOf: this.tagsOneOf ? this.tagsOneOf.split(',') : undefined,
tagsAllOf: this.tagsAllOf ? this.tagsAllOf.split(',') : undefined,
durationMin: this.durationMin,
- durationMax: this.durationMax
+ durationMax: this.durationMax,
+ sort: this.sort
}
}
}