]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - shared/server-commands/videos/streaming-playlists-command.ts
shared/ typescript types dir server-commands
[github/Chocobozzz/PeerTube.git] / shared / server-commands / videos / streaming-playlists-command.ts
CommitLineData
c0e8b12e 1import { HttpStatusCode } from '@shared/models'
0305db28 2import { unwrapBody, unwrapTextOrDecode, unwrapBodyOrDecodeToJSON } from '../requests'
57f879a5
C
3import { AbstractCommand, OverrideCommandOptions } from '../shared'
4
5export class StreamingPlaylistsCommand extends AbstractCommand {
6
7 get (options: OverrideCommandOptions & {
8 url: string
9 }) {
0305db28 10 return unwrapTextOrDecode(this.getRawRequest({
57f879a5
C
11 ...options,
12
13 url: options.url,
14 implicitToken: false,
15 defaultExpectedStatus: HttpStatusCode.OK_200
16 }))
17 }
18
19 getSegment (options: OverrideCommandOptions & {
20 url: string
21 range?: string
22 }) {
dd0ebb71 23 return unwrapBody<Buffer>(this.getRawRequest({
57f879a5
C
24 ...options,
25
26 url: options.url,
27 range: options.range,
28 implicitToken: false,
12edc149 29 defaultExpectedStatus: HttpStatusCode.OK_200
57f879a5
C
30 }))
31 }
32
33 getSegmentSha256 (options: OverrideCommandOptions & {
34 url: string
35 }) {
0305db28 36 return unwrapBodyOrDecodeToJSON<{ [ id: string ]: string }>(this.getRawRequest({
57f879a5
C
37 ...options,
38
39 url: options.url,
40 implicitToken: false,
41 defaultExpectedStatus: HttpStatusCode.OK_200
42 }))
43 }
44}