1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-05 19:42:24 +02:00

Rename command files

This commit is contained in:
Chocobozzz 2021-07-06 10:22:37 +02:00
parent c1bc8ee478
commit f59545d97a
No known key found for this signature in database
GPG key ID: 583A612D890159BE
10 changed files with 9 additions and 9 deletions

View file

@ -0,0 +1,42 @@
import { HttpStatusCode } from '../../core-utils/miscs/http-error-codes'
import { AbstractCommand, OverrideCommandOptions } from '../shared'
type FeedType = 'videos' | 'video-comments' | 'subscriptions'
export class FeedCommand extends AbstractCommand {
getXML (options: OverrideCommandOptions & {
feed: FeedType
format?: string
}) {
const { feed, format } = options
const path = '/feeds/' + feed + '.xml'
return this.getRequestText({
...options,
path,
query: format ? { format } : undefined,
accept: 'application/xml',
defaultExpectedStatus: HttpStatusCode.OK_200
})
}
getJSON (options: OverrideCommandOptions & {
feed: FeedType
query?: { [ id: string ]: any }
}) {
const { feed, query } = options
const path = '/feeds/' + feed + '.json'
return this.getRequestText({
...options,
path,
query,
accept: 'application/json',
defaultExpectedStatus: HttpStatusCode.OK_200
})
}
}