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:
parent
c1bc8ee478
commit
f59545d97a
10 changed files with 9 additions and 9 deletions
42
shared/extra-utils/feeds/feeds-command.ts
Normal file
42
shared/extra-utils/feeds/feeds-command.ts
Normal 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
|
||||
})
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue