aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/extra-utils/videos/services-command.ts
blob: 313b7878c59004037b57cc4c2653ab42a54f4af9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import { HttpStatusCode } from '../../core-utils/miscs/http-error-codes'
import { AbstractCommand, OverrideCommandOptions } from '../shared'

export class ServicesCommand extends AbstractCommand {

  getOEmbed (options: OverrideCommandOptions & {
    oembedUrl: string
    format?: string
    maxHeight?: number
    maxWidth?: number
  }) {
    const path = '/services/oembed'
    const query = {
      url: options.oembedUrl,
      format: options.format,
      maxheight: options.maxHeight,
      maxwidth: options.maxWidth
    }

    return this.getRequest({
      ...options,

      path,
      query,
      implicitToken: false,
      defaultExpectedStatus: HttpStatusCode.OK_200
    })
  }
}