2021-07-16 10:42:24 +02:00
|
|
|
import { HttpStatusCode } from '@shared/models'
|
2021-08-17 08:26:20 +02:00
|
|
|
import { unwrapBody, unwrapTextOrDecode, unwrapBodyOrDecodeToJSON } from '../requests'
|
2021-07-09 10:21:10 +02:00
|
|
|
import { AbstractCommand, OverrideCommandOptions } from '../shared'
|
|
|
|
|
|
|
|
export class StreamingPlaylistsCommand extends AbstractCommand {
|
|
|
|
|
|
|
|
get (options: OverrideCommandOptions & {
|
|
|
|
url: string
|
|
|
|
}) {
|
2021-08-17 08:26:20 +02:00
|
|
|
return unwrapTextOrDecode(this.getRawRequest({
|
2021-07-09 10:21:10 +02:00
|
|
|
...options,
|
|
|
|
|
|
|
|
url: options.url,
|
|
|
|
implicitToken: false,
|
|
|
|
defaultExpectedStatus: HttpStatusCode.OK_200
|
|
|
|
}))
|
|
|
|
}
|
|
|
|
|
|
|
|
getSegment (options: OverrideCommandOptions & {
|
|
|
|
url: string
|
|
|
|
range?: string
|
|
|
|
}) {
|
2021-07-09 16:23:01 +02:00
|
|
|
return unwrapBody<Buffer>(this.getRawRequest({
|
2021-07-09 10:21:10 +02:00
|
|
|
...options,
|
|
|
|
|
|
|
|
url: options.url,
|
|
|
|
range: options.range,
|
|
|
|
implicitToken: false,
|
2021-07-09 14:15:11 +02:00
|
|
|
defaultExpectedStatus: HttpStatusCode.OK_200
|
2021-07-09 10:21:10 +02:00
|
|
|
}))
|
|
|
|
}
|
|
|
|
|
|
|
|
getSegmentSha256 (options: OverrideCommandOptions & {
|
|
|
|
url: string
|
|
|
|
}) {
|
2021-08-17 08:26:20 +02:00
|
|
|
return unwrapBodyOrDecodeToJSON<{ [ id: string ]: string }>(this.getRawRequest({
|
2021-07-09 10:21:10 +02:00
|
|
|
...options,
|
|
|
|
|
|
|
|
url: options.url,
|
|
|
|
implicitToken: false,
|
|
|
|
defaultExpectedStatus: HttpStatusCode.OK_200
|
|
|
|
}))
|
|
|
|
}
|
|
|
|
}
|