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