Specify if we want to fallback to the server token
This commit is contained in:
parent
04aed76711
commit
a1637fa1e2
|
@ -12,8 +12,10 @@ export class BulkCommand extends AbstractCommand {
|
||||||
|
|
||||||
return this.postBodyRequest({
|
return this.postBodyRequest({
|
||||||
...options,
|
...options,
|
||||||
|
|
||||||
path: '/api/v1/bulk/remove-comments-of',
|
path: '/api/v1/bulk/remove-comments-of',
|
||||||
fields: attributes,
|
fields: attributes,
|
||||||
|
implicitToken: true,
|
||||||
defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
|
defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,9 @@ export class CustomPagesCommand extends AbstractCommand {
|
||||||
|
|
||||||
return this.getRequestBody<CustomPage>({
|
return this.getRequestBody<CustomPage>({
|
||||||
...options,
|
...options,
|
||||||
|
|
||||||
path,
|
path,
|
||||||
|
implicitToken: false,
|
||||||
defaultExpectedStatus: HttpStatusCode.OK_200
|
defaultExpectedStatus: HttpStatusCode.OK_200
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -22,8 +24,10 @@ export class CustomPagesCommand extends AbstractCommand {
|
||||||
|
|
||||||
return this.putBodyRequest({
|
return this.putBodyRequest({
|
||||||
...options,
|
...options,
|
||||||
|
|
||||||
path,
|
path,
|
||||||
fields: { content },
|
fields: { content },
|
||||||
|
implicitToken: true,
|
||||||
defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
|
defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@ export class FeedCommand extends AbstractCommand {
|
||||||
path,
|
path,
|
||||||
query: format ? { format } : undefined,
|
query: format ? { format } : undefined,
|
||||||
accept: 'application/xml',
|
accept: 'application/xml',
|
||||||
|
implicitToken: false,
|
||||||
defaultExpectedStatus: HttpStatusCode.OK_200
|
defaultExpectedStatus: HttpStatusCode.OK_200
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -36,6 +37,7 @@ export class FeedCommand extends AbstractCommand {
|
||||||
path,
|
path,
|
||||||
query,
|
query,
|
||||||
accept: 'application/json',
|
accept: 'application/json',
|
||||||
|
implicitToken: false,
|
||||||
defaultExpectedStatus: HttpStatusCode.OK_200
|
defaultExpectedStatus: HttpStatusCode.OK_200
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@ export class LogsCommand extends AbstractCommand {
|
||||||
|
|
||||||
path,
|
path,
|
||||||
query: { startDate, endDate, level },
|
query: { startDate, endDate, level },
|
||||||
|
implicitToken: true,
|
||||||
defaultExpectedStatus: HttpStatusCode.OK_200
|
defaultExpectedStatus: HttpStatusCode.OK_200
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -34,6 +35,7 @@ export class LogsCommand extends AbstractCommand {
|
||||||
|
|
||||||
path,
|
path,
|
||||||
query: { startDate, endDate },
|
query: { startDate, endDate },
|
||||||
|
implicitToken: true,
|
||||||
defaultExpectedStatus: HttpStatusCode.OK_200
|
defaultExpectedStatus: HttpStatusCode.OK_200
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,6 +60,7 @@ export class AbusesCommand extends AbstractCommand {
|
||||||
|
|
||||||
path,
|
path,
|
||||||
fields: body,
|
fields: body,
|
||||||
|
implicitToken: true,
|
||||||
defaultExpectedStatus: HttpStatusCode.OK_200
|
defaultExpectedStatus: HttpStatusCode.OK_200
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
@ -106,6 +107,7 @@ export class AbusesCommand extends AbstractCommand {
|
||||||
|
|
||||||
path,
|
path,
|
||||||
query,
|
query,
|
||||||
|
implicitToken: true,
|
||||||
defaultExpectedStatus: HttpStatusCode.OK_200
|
defaultExpectedStatus: HttpStatusCode.OK_200
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -138,6 +140,7 @@ export class AbusesCommand extends AbstractCommand {
|
||||||
|
|
||||||
path,
|
path,
|
||||||
query,
|
query,
|
||||||
|
implicitToken: true,
|
||||||
defaultExpectedStatus: HttpStatusCode.OK_200
|
defaultExpectedStatus: HttpStatusCode.OK_200
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -154,6 +157,7 @@ export class AbusesCommand extends AbstractCommand {
|
||||||
|
|
||||||
path,
|
path,
|
||||||
fields: body,
|
fields: body,
|
||||||
|
implicitToken: true,
|
||||||
defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
|
defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -164,7 +168,13 @@ export class AbusesCommand extends AbstractCommand {
|
||||||
const { abuseId } = options
|
const { abuseId } = options
|
||||||
const path = '/api/v1/abuses/' + abuseId
|
const path = '/api/v1/abuses/' + abuseId
|
||||||
|
|
||||||
return this.deleteRequest({ ...options, path, defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204 })
|
return this.deleteRequest({
|
||||||
|
...options,
|
||||||
|
|
||||||
|
path,
|
||||||
|
implicitToken: true,
|
||||||
|
defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
listMessages (options: OverrideCommandOptions & {
|
listMessages (options: OverrideCommandOptions & {
|
||||||
|
@ -173,7 +183,13 @@ export class AbusesCommand extends AbstractCommand {
|
||||||
const { abuseId } = options
|
const { abuseId } = options
|
||||||
const path = '/api/v1/abuses/' + abuseId + '/messages'
|
const path = '/api/v1/abuses/' + abuseId + '/messages'
|
||||||
|
|
||||||
return this.getRequestBody<ResultList<AbuseMessage>>({ ...options, path, defaultExpectedStatus: HttpStatusCode.OK_200 })
|
return this.getRequestBody<ResultList<AbuseMessage>>({
|
||||||
|
...options,
|
||||||
|
|
||||||
|
path,
|
||||||
|
implicitToken: true,
|
||||||
|
defaultExpectedStatus: HttpStatusCode.OK_200
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteMessage (options: OverrideCommandOptions & {
|
deleteMessage (options: OverrideCommandOptions & {
|
||||||
|
@ -183,7 +199,13 @@ export class AbusesCommand extends AbstractCommand {
|
||||||
const { abuseId, messageId } = options
|
const { abuseId, messageId } = options
|
||||||
const path = '/api/v1/abuses/' + abuseId + '/messages/' + messageId
|
const path = '/api/v1/abuses/' + abuseId + '/messages/' + messageId
|
||||||
|
|
||||||
return this.deleteRequest({ ...options, path, defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204 })
|
return this.deleteRequest({
|
||||||
|
...options,
|
||||||
|
|
||||||
|
path,
|
||||||
|
implicitToken: true,
|
||||||
|
defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
addMessage (options: OverrideCommandOptions & {
|
addMessage (options: OverrideCommandOptions & {
|
||||||
|
@ -198,6 +220,7 @@ export class AbusesCommand extends AbstractCommand {
|
||||||
|
|
||||||
path,
|
path,
|
||||||
fields: { message },
|
fields: { message },
|
||||||
|
implicitToken: true,
|
||||||
defaultExpectedStatus: HttpStatusCode.OK_200
|
defaultExpectedStatus: HttpStatusCode.OK_200
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ export class OverviewsCommand extends AbstractCommand {
|
||||||
getVideos (options: OverrideCommandOptions & {
|
getVideos (options: OverrideCommandOptions & {
|
||||||
page: number
|
page: number
|
||||||
}) {
|
}) {
|
||||||
const { token, page } = options
|
const { page } = options
|
||||||
const path = '/api/v1/overviews/videos'
|
const path = '/api/v1/overviews/videos'
|
||||||
|
|
||||||
const query = { page }
|
const query = { page }
|
||||||
|
@ -15,9 +15,9 @@ export class OverviewsCommand extends AbstractCommand {
|
||||||
return this.getRequestBody<VideosOverview>({
|
return this.getRequestBody<VideosOverview>({
|
||||||
...options,
|
...options,
|
||||||
|
|
||||||
token: token || null,
|
|
||||||
path,
|
path,
|
||||||
query,
|
query,
|
||||||
|
implicitToken: false,
|
||||||
defaultExpectedStatus: HttpStatusCode.OK_200
|
defaultExpectedStatus: HttpStatusCode.OK_200
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,16 +25,15 @@ export class SearchCommand extends AbstractCommand {
|
||||||
advancedChannelSearch (options: OverrideCommandOptions & {
|
advancedChannelSearch (options: OverrideCommandOptions & {
|
||||||
search: VideoChannelsSearchQuery
|
search: VideoChannelsSearchQuery
|
||||||
}) {
|
}) {
|
||||||
const { search, token } = options
|
const { search } = options
|
||||||
const path = '/api/v1/search/video-channels'
|
const path = '/api/v1/search/video-channels'
|
||||||
|
|
||||||
return this.getRequestBody<ResultList<VideoChannel>>({
|
return this.getRequestBody<ResultList<VideoChannel>>({
|
||||||
...options,
|
...options,
|
||||||
|
|
||||||
token: token || null,
|
|
||||||
|
|
||||||
path,
|
path,
|
||||||
query: search,
|
query: search,
|
||||||
|
implicitToken: false,
|
||||||
defaultExpectedStatus: HttpStatusCode.OK_200
|
defaultExpectedStatus: HttpStatusCode.OK_200
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -52,16 +51,15 @@ export class SearchCommand extends AbstractCommand {
|
||||||
advancedPlaylistSearch (options: OverrideCommandOptions & {
|
advancedPlaylistSearch (options: OverrideCommandOptions & {
|
||||||
search: VideoPlaylistsSearchQuery
|
search: VideoPlaylistsSearchQuery
|
||||||
}) {
|
}) {
|
||||||
const { search, token } = options
|
const { search } = options
|
||||||
const path = '/api/v1/search/video-playlists'
|
const path = '/api/v1/search/video-playlists'
|
||||||
|
|
||||||
return this.getRequestBody<ResultList<VideoPlaylist>>({
|
return this.getRequestBody<ResultList<VideoPlaylist>>({
|
||||||
...options,
|
...options,
|
||||||
|
|
||||||
token: token || null,
|
|
||||||
|
|
||||||
path,
|
path,
|
||||||
query: search,
|
query: search,
|
||||||
|
implicitToken: false,
|
||||||
defaultExpectedStatus: HttpStatusCode.OK_200
|
defaultExpectedStatus: HttpStatusCode.OK_200
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -85,16 +83,15 @@ export class SearchCommand extends AbstractCommand {
|
||||||
advancedVideoSearch (options: OverrideCommandOptions & {
|
advancedVideoSearch (options: OverrideCommandOptions & {
|
||||||
search: VideosSearchQuery
|
search: VideosSearchQuery
|
||||||
}) {
|
}) {
|
||||||
const { search, token } = options
|
const { search } = options
|
||||||
const path = '/api/v1/search/videos'
|
const path = '/api/v1/search/videos'
|
||||||
|
|
||||||
return this.getRequestBody<ResultList<Video>>({
|
return this.getRequestBody<ResultList<Video>>({
|
||||||
...options,
|
...options,
|
||||||
|
|
||||||
token: token || null,
|
|
||||||
|
|
||||||
path,
|
path,
|
||||||
query: search,
|
query: search,
|
||||||
|
implicitToken: false,
|
||||||
defaultExpectedStatus: HttpStatusCode.OK_200
|
defaultExpectedStatus: HttpStatusCode.OK_200
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,8 +24,8 @@ export class ConfigCommand extends AbstractCommand {
|
||||||
return this.getRequestBody<ServerConfig>({
|
return this.getRequestBody<ServerConfig>({
|
||||||
...options,
|
...options,
|
||||||
|
|
||||||
token: null,
|
|
||||||
path,
|
path,
|
||||||
|
implicitToken: false,
|
||||||
defaultExpectedStatus: HttpStatusCode.OK_200
|
defaultExpectedStatus: HttpStatusCode.OK_200
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -36,8 +36,8 @@ export class ConfigCommand extends AbstractCommand {
|
||||||
return this.getRequestBody<About>({
|
return this.getRequestBody<About>({
|
||||||
...options,
|
...options,
|
||||||
|
|
||||||
token: null,
|
|
||||||
path,
|
path,
|
||||||
|
implicitToken: false,
|
||||||
defaultExpectedStatus: HttpStatusCode.OK_200
|
defaultExpectedStatus: HttpStatusCode.OK_200
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -49,6 +49,7 @@ export class ConfigCommand extends AbstractCommand {
|
||||||
...options,
|
...options,
|
||||||
|
|
||||||
path,
|
path,
|
||||||
|
implicitToken: true,
|
||||||
defaultExpectedStatus: HttpStatusCode.OK_200
|
defaultExpectedStatus: HttpStatusCode.OK_200
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -63,6 +64,7 @@ export class ConfigCommand extends AbstractCommand {
|
||||||
|
|
||||||
path,
|
path,
|
||||||
fields: options.newCustomConfig,
|
fields: options.newCustomConfig,
|
||||||
|
implicitToken: true,
|
||||||
defaultExpectedStatus: HttpStatusCode.OK_200
|
defaultExpectedStatus: HttpStatusCode.OK_200
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -74,6 +76,7 @@ export class ConfigCommand extends AbstractCommand {
|
||||||
...options,
|
...options,
|
||||||
|
|
||||||
path,
|
path,
|
||||||
|
implicitToken: true,
|
||||||
defaultExpectedStatus: HttpStatusCode.OK_200
|
defaultExpectedStatus: HttpStatusCode.OK_200
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,8 +23,8 @@ export class ContactFormCommand extends AbstractCommand {
|
||||||
...options,
|
...options,
|
||||||
|
|
||||||
path,
|
path,
|
||||||
token: null,
|
|
||||||
fields: body,
|
fields: body,
|
||||||
|
implicitToken: false,
|
||||||
defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
|
defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ export class DebugCommand extends AbstractCommand {
|
||||||
...options,
|
...options,
|
||||||
|
|
||||||
path,
|
path,
|
||||||
|
implicitToken: true,
|
||||||
defaultExpectedStatus: HttpStatusCode.OK_200
|
defaultExpectedStatus: HttpStatusCode.OK_200
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -26,6 +27,7 @@ export class DebugCommand extends AbstractCommand {
|
||||||
|
|
||||||
path,
|
path,
|
||||||
fields: body,
|
fields: body,
|
||||||
|
implicitToken: true,
|
||||||
defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
|
defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,10 +22,9 @@ export class FollowsCommand extends AbstractCommand {
|
||||||
return this.getRequestBody<ResultList<ActorFollow>>({
|
return this.getRequestBody<ResultList<ActorFollow>>({
|
||||||
...options,
|
...options,
|
||||||
|
|
||||||
token: null,
|
|
||||||
|
|
||||||
path,
|
path,
|
||||||
query,
|
query,
|
||||||
|
implicitToken: false,
|
||||||
defaultExpectedStatus: HttpStatusCode.OK_200
|
defaultExpectedStatus: HttpStatusCode.OK_200
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -46,10 +45,9 @@ export class FollowsCommand extends AbstractCommand {
|
||||||
return this.getRequestBody<ResultList<ActorFollow>>({
|
return this.getRequestBody<ResultList<ActorFollow>>({
|
||||||
...options,
|
...options,
|
||||||
|
|
||||||
token: null,
|
|
||||||
|
|
||||||
path,
|
path,
|
||||||
query,
|
query,
|
||||||
|
implicitToken: false,
|
||||||
defaultExpectedStatus: HttpStatusCode.OK_200
|
defaultExpectedStatus: HttpStatusCode.OK_200
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -66,6 +64,7 @@ export class FollowsCommand extends AbstractCommand {
|
||||||
|
|
||||||
path,
|
path,
|
||||||
fields: { hosts },
|
fields: { hosts },
|
||||||
|
implicitToken: true,
|
||||||
defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
|
defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -79,6 +78,7 @@ export class FollowsCommand extends AbstractCommand {
|
||||||
...options,
|
...options,
|
||||||
|
|
||||||
path,
|
path,
|
||||||
|
implicitToken: true,
|
||||||
defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
|
defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -92,6 +92,7 @@ export class FollowsCommand extends AbstractCommand {
|
||||||
...options,
|
...options,
|
||||||
|
|
||||||
path,
|
path,
|
||||||
|
implicitToken: true,
|
||||||
defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
|
defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -105,6 +106,7 @@ export class FollowsCommand extends AbstractCommand {
|
||||||
...options,
|
...options,
|
||||||
|
|
||||||
path,
|
path,
|
||||||
|
implicitToken: true,
|
||||||
defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
|
defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -118,6 +120,7 @@ export class FollowsCommand extends AbstractCommand {
|
||||||
...options,
|
...options,
|
||||||
|
|
||||||
path,
|
path,
|
||||||
|
implicitToken: true,
|
||||||
defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
|
defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ export class JobsCommand extends AbstractCommand {
|
||||||
|
|
||||||
path,
|
path,
|
||||||
query,
|
query,
|
||||||
|
implicitToken: true,
|
||||||
defaultExpectedStatus: HttpStatusCode.OK_200
|
defaultExpectedStatus: HttpStatusCode.OK_200
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,7 @@ export class PluginsCommand extends AbstractCommand {
|
||||||
pluginType,
|
pluginType,
|
||||||
uninstalled
|
uninstalled
|
||||||
},
|
},
|
||||||
|
implicitToken: true,
|
||||||
defaultExpectedStatus: HttpStatusCode.OK_200
|
defaultExpectedStatus: HttpStatusCode.OK_200
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -75,6 +76,7 @@ export class PluginsCommand extends AbstractCommand {
|
||||||
|
|
||||||
path,
|
path,
|
||||||
query,
|
query,
|
||||||
|
implicitToken: true,
|
||||||
defaultExpectedStatus: HttpStatusCode.OK_200
|
defaultExpectedStatus: HttpStatusCode.OK_200
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -88,6 +90,7 @@ export class PluginsCommand extends AbstractCommand {
|
||||||
...options,
|
...options,
|
||||||
|
|
||||||
path,
|
path,
|
||||||
|
implicitToken: true,
|
||||||
defaultExpectedStatus: HttpStatusCode.OK_200
|
defaultExpectedStatus: HttpStatusCode.OK_200
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -104,6 +107,7 @@ export class PluginsCommand extends AbstractCommand {
|
||||||
|
|
||||||
path,
|
path,
|
||||||
fields: { settings },
|
fields: { settings },
|
||||||
|
implicitToken: true,
|
||||||
defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
|
defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -117,6 +121,7 @@ export class PluginsCommand extends AbstractCommand {
|
||||||
...options,
|
...options,
|
||||||
|
|
||||||
path,
|
path,
|
||||||
|
implicitToken: true,
|
||||||
defaultExpectedStatus: HttpStatusCode.OK_200
|
defaultExpectedStatus: HttpStatusCode.OK_200
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -131,6 +136,7 @@ export class PluginsCommand extends AbstractCommand {
|
||||||
...options,
|
...options,
|
||||||
|
|
||||||
path,
|
path,
|
||||||
|
implicitToken: false,
|
||||||
defaultExpectedStatus: HttpStatusCode.OK_200
|
defaultExpectedStatus: HttpStatusCode.OK_200
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -145,6 +151,7 @@ export class PluginsCommand extends AbstractCommand {
|
||||||
...options,
|
...options,
|
||||||
|
|
||||||
path,
|
path,
|
||||||
|
implicitToken: false,
|
||||||
defaultExpectedStatus: HttpStatusCode.OK_200
|
defaultExpectedStatus: HttpStatusCode.OK_200
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -161,6 +168,7 @@ export class PluginsCommand extends AbstractCommand {
|
||||||
|
|
||||||
path: apiPath,
|
path: apiPath,
|
||||||
fields: { npmName, path },
|
fields: { npmName, path },
|
||||||
|
implicitToken: true,
|
||||||
defaultExpectedStatus: HttpStatusCode.OK_200
|
defaultExpectedStatus: HttpStatusCode.OK_200
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -177,6 +185,7 @@ export class PluginsCommand extends AbstractCommand {
|
||||||
|
|
||||||
path: apiPath,
|
path: apiPath,
|
||||||
fields: { npmName, path },
|
fields: { npmName, path },
|
||||||
|
implicitToken: true,
|
||||||
defaultExpectedStatus: HttpStatusCode.OK_200
|
defaultExpectedStatus: HttpStatusCode.OK_200
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -192,6 +201,7 @@ export class PluginsCommand extends AbstractCommand {
|
||||||
|
|
||||||
path: apiPath,
|
path: apiPath,
|
||||||
fields: { npmName },
|
fields: { npmName },
|
||||||
|
implicitToken: true,
|
||||||
defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
|
defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -203,6 +213,7 @@ export class PluginsCommand extends AbstractCommand {
|
||||||
...options,
|
...options,
|
||||||
|
|
||||||
path,
|
path,
|
||||||
|
implicitToken: false,
|
||||||
defaultExpectedStatus: HttpStatusCode.OK_200
|
defaultExpectedStatus: HttpStatusCode.OK_200
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -222,6 +233,7 @@ export class PluginsCommand extends AbstractCommand {
|
||||||
|
|
||||||
path,
|
path,
|
||||||
query,
|
query,
|
||||||
|
implicitToken: false,
|
||||||
defaultExpectedStatus: HttpStatusCode.OK_200,
|
defaultExpectedStatus: HttpStatusCode.OK_200,
|
||||||
redirects: 0
|
redirects: 0
|
||||||
})
|
})
|
||||||
|
|
|
@ -16,6 +16,7 @@ export class RedundancyCommand extends AbstractCommand {
|
||||||
|
|
||||||
path,
|
path,
|
||||||
fields: { redundancyAllowed },
|
fields: { redundancyAllowed },
|
||||||
|
implicitToken: true,
|
||||||
defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
|
defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -42,6 +43,7 @@ export class RedundancyCommand extends AbstractCommand {
|
||||||
target
|
target
|
||||||
},
|
},
|
||||||
|
|
||||||
|
implicitToken: true,
|
||||||
defaultExpectedStatus: HttpStatusCode.OK_200
|
defaultExpectedStatus: HttpStatusCode.OK_200
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -57,6 +59,7 @@ export class RedundancyCommand extends AbstractCommand {
|
||||||
|
|
||||||
path,
|
path,
|
||||||
fields: { videoId },
|
fields: { videoId },
|
||||||
|
implicitToken: true,
|
||||||
defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
|
defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -71,6 +74,7 @@ export class RedundancyCommand extends AbstractCommand {
|
||||||
...options,
|
...options,
|
||||||
|
|
||||||
path,
|
path,
|
||||||
|
implicitToken: true,
|
||||||
defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
|
defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@ export class StatsCommand extends AbstractCommand {
|
||||||
|
|
||||||
path,
|
path,
|
||||||
query,
|
query,
|
||||||
|
implicitToken: false,
|
||||||
defaultExpectedStatus: HttpStatusCode.OK_200
|
defaultExpectedStatus: HttpStatusCode.OK_200
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,13 @@
|
||||||
import { HttpStatusCode } from '@shared/core-utils'
|
import { HttpStatusCode } from '@shared/core-utils'
|
||||||
import { makeDeleteRequest, makeGetRequest, makePostBodyRequest, makePutBodyRequest, makeUploadRequest, unwrapBody, unwrapText } from '../requests/requests'
|
import {
|
||||||
|
makeDeleteRequest,
|
||||||
|
makeGetRequest,
|
||||||
|
makePostBodyRequest,
|
||||||
|
makePutBodyRequest,
|
||||||
|
makeUploadRequest,
|
||||||
|
unwrapBody,
|
||||||
|
unwrapText
|
||||||
|
} from '../requests/requests'
|
||||||
import { ServerInfo } from '../server/servers'
|
import { ServerInfo } from '../server/servers'
|
||||||
|
|
||||||
export interface OverrideCommandOptions {
|
export interface OverrideCommandOptions {
|
||||||
|
@ -7,12 +15,14 @@ export interface OverrideCommandOptions {
|
||||||
expectedStatus?: number
|
expectedStatus?: number
|
||||||
}
|
}
|
||||||
|
|
||||||
interface CommonCommandOptions extends OverrideCommandOptions {
|
interface InternalCommonCommandOptions extends OverrideCommandOptions {
|
||||||
path: string
|
path: string
|
||||||
|
// If we automatically send the server token if the token is not provided
|
||||||
|
implicitToken: boolean
|
||||||
defaultExpectedStatus: number
|
defaultExpectedStatus: number
|
||||||
}
|
}
|
||||||
|
|
||||||
interface GetCommandOptions extends CommonCommandOptions {
|
interface InternalGetCommandOptions extends InternalCommonCommandOptions {
|
||||||
query?: { [ id: string ]: any }
|
query?: { [ id: string ]: any }
|
||||||
contentType?: string
|
contentType?: string
|
||||||
accept?: string
|
accept?: string
|
||||||
|
@ -37,15 +47,15 @@ abstract class AbstractCommand {
|
||||||
this.expectedStatus = status
|
this.expectedStatus = status
|
||||||
}
|
}
|
||||||
|
|
||||||
protected getRequestBody <T> (options: GetCommandOptions) {
|
protected getRequestBody <T> (options: InternalGetCommandOptions) {
|
||||||
return unwrapBody<T>(this.getRequest(options))
|
return unwrapBody<T>(this.getRequest(options))
|
||||||
}
|
}
|
||||||
|
|
||||||
protected getRequestText (options: GetCommandOptions) {
|
protected getRequestText (options: InternalGetCommandOptions) {
|
||||||
return unwrapText(this.getRequest(options))
|
return unwrapText(this.getRequest(options))
|
||||||
}
|
}
|
||||||
|
|
||||||
protected getRequest (options: GetCommandOptions) {
|
protected getRequest (options: InternalGetCommandOptions) {
|
||||||
const { redirects, query, contentType, accept } = options
|
const { redirects, query, contentType, accept } = options
|
||||||
|
|
||||||
return makeGetRequest({
|
return makeGetRequest({
|
||||||
|
@ -58,11 +68,11 @@ abstract class AbstractCommand {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
protected deleteRequest (options: CommonCommandOptions) {
|
protected deleteRequest (options: InternalCommonCommandOptions) {
|
||||||
return makeDeleteRequest(this.buildCommonRequestOptions(options))
|
return makeDeleteRequest(this.buildCommonRequestOptions(options))
|
||||||
}
|
}
|
||||||
|
|
||||||
protected putBodyRequest (options: CommonCommandOptions & {
|
protected putBodyRequest (options: InternalCommonCommandOptions & {
|
||||||
fields?: { [ fieldName: string ]: any }
|
fields?: { [ fieldName: string ]: any }
|
||||||
}) {
|
}) {
|
||||||
const { fields } = options
|
const { fields } = options
|
||||||
|
@ -74,7 +84,7 @@ abstract class AbstractCommand {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
protected postBodyRequest (options: CommonCommandOptions & {
|
protected postBodyRequest (options: InternalCommonCommandOptions & {
|
||||||
fields?: { [ fieldName: string ]: any }
|
fields?: { [ fieldName: string ]: any }
|
||||||
}) {
|
}) {
|
||||||
const { fields } = options
|
const { fields } = options
|
||||||
|
@ -86,7 +96,7 @@ abstract class AbstractCommand {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
protected postUploadRequest (options: CommonCommandOptions & {
|
protected postUploadRequest (options: InternalCommonCommandOptions & {
|
||||||
fields?: { [ fieldName: string ]: any }
|
fields?: { [ fieldName: string ]: any }
|
||||||
attaches?: any
|
attaches?: any
|
||||||
}) {
|
}) {
|
||||||
|
@ -101,7 +111,7 @@ abstract class AbstractCommand {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
protected putUploadRequest (options: CommonCommandOptions & {
|
protected putUploadRequest (options: InternalCommonCommandOptions & {
|
||||||
fields?: { [ fieldName: string ]: any }
|
fields?: { [ fieldName: string ]: any }
|
||||||
attaches?: any
|
attaches?: any
|
||||||
}) {
|
}) {
|
||||||
|
@ -116,15 +126,18 @@ abstract class AbstractCommand {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
private buildCommonRequestOptions (options: CommonCommandOptions) {
|
private buildCommonRequestOptions (options: InternalCommonCommandOptions) {
|
||||||
const { token, expectedStatus, defaultExpectedStatus, path } = options
|
const { token, expectedStatus, defaultExpectedStatus, path } = options
|
||||||
|
|
||||||
|
const fallbackToken = options.implicitToken
|
||||||
|
? this.server.accessToken
|
||||||
|
: undefined
|
||||||
|
|
||||||
return {
|
return {
|
||||||
url: this.server.url,
|
url: this.server.url,
|
||||||
path,
|
path,
|
||||||
|
|
||||||
// Token can be null if we don't want to add it
|
token: token !== undefined ? token : fallbackToken,
|
||||||
token: token !== undefined ? token : this.server.accessToken,
|
|
||||||
|
|
||||||
statusCodeExpected: expectedStatus ?? this.expectedStatus ?? defaultExpectedStatus
|
statusCodeExpected: expectedStatus ?? this.expectedStatus ?? defaultExpectedStatus
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@ export class AccountsCommand extends AbstractCommand {
|
||||||
|
|
||||||
path,
|
path,
|
||||||
query: { sort },
|
query: { sort },
|
||||||
|
implicitToken: false,
|
||||||
defaultExpectedStatus: HttpStatusCode.OK_200
|
defaultExpectedStatus: HttpStatusCode.OK_200
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -30,6 +31,7 @@ export class AccountsCommand extends AbstractCommand {
|
||||||
...options,
|
...options,
|
||||||
|
|
||||||
path,
|
path,
|
||||||
|
implicitToken: false,
|
||||||
defaultExpectedStatus: HttpStatusCode.OK_200
|
defaultExpectedStatus: HttpStatusCode.OK_200
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -48,6 +50,7 @@ export class AccountsCommand extends AbstractCommand {
|
||||||
|
|
||||||
path,
|
path,
|
||||||
query,
|
query,
|
||||||
|
implicitToken: true,
|
||||||
defaultExpectedStatus: HttpStatusCode.OK_200
|
defaultExpectedStatus: HttpStatusCode.OK_200
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,6 +56,7 @@ export class BlocklistCommand extends AbstractCommand {
|
||||||
accountName: account,
|
accountName: account,
|
||||||
host: server
|
host: server
|
||||||
},
|
},
|
||||||
|
implicitToken: true,
|
||||||
defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
|
defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -78,6 +79,7 @@ export class BlocklistCommand extends AbstractCommand {
|
||||||
accountName: account,
|
accountName: account,
|
||||||
host: server
|
host: server
|
||||||
},
|
},
|
||||||
|
implicitToken: true,
|
||||||
defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
|
defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -98,6 +100,7 @@ export class BlocklistCommand extends AbstractCommand {
|
||||||
...options,
|
...options,
|
||||||
|
|
||||||
path,
|
path,
|
||||||
|
implicitToken: true,
|
||||||
defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
|
defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -116,6 +119,7 @@ export class BlocklistCommand extends AbstractCommand {
|
||||||
...options,
|
...options,
|
||||||
|
|
||||||
path,
|
path,
|
||||||
|
implicitToken: true,
|
||||||
defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
|
defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -128,6 +132,7 @@ export class BlocklistCommand extends AbstractCommand {
|
||||||
|
|
||||||
path,
|
path,
|
||||||
query: { start, count, sort },
|
query: { start, count, sort },
|
||||||
|
implicitToken: true,
|
||||||
defaultExpectedStatus: HttpStatusCode.OK_200
|
defaultExpectedStatus: HttpStatusCode.OK_200
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@ export class SubscriptionsCommand extends AbstractCommand {
|
||||||
|
|
||||||
path,
|
path,
|
||||||
fields: { uri: options.targetUri },
|
fields: { uri: options.targetUri },
|
||||||
|
implicitToken: true,
|
||||||
defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
|
defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -33,6 +34,7 @@ export class SubscriptionsCommand extends AbstractCommand {
|
||||||
sort,
|
sort,
|
||||||
search
|
search
|
||||||
},
|
},
|
||||||
|
implicitToken: true,
|
||||||
defaultExpectedStatus: HttpStatusCode.OK_200
|
defaultExpectedStatus: HttpStatusCode.OK_200
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -48,6 +50,7 @@ export class SubscriptionsCommand extends AbstractCommand {
|
||||||
|
|
||||||
path,
|
path,
|
||||||
query: { sort },
|
query: { sort },
|
||||||
|
implicitToken: true,
|
||||||
defaultExpectedStatus: HttpStatusCode.OK_200
|
defaultExpectedStatus: HttpStatusCode.OK_200
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -61,6 +64,7 @@ export class SubscriptionsCommand extends AbstractCommand {
|
||||||
...options,
|
...options,
|
||||||
|
|
||||||
path,
|
path,
|
||||||
|
implicitToken: true,
|
||||||
defaultExpectedStatus: HttpStatusCode.OK_200
|
defaultExpectedStatus: HttpStatusCode.OK_200
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -74,6 +78,7 @@ export class SubscriptionsCommand extends AbstractCommand {
|
||||||
...options,
|
...options,
|
||||||
|
|
||||||
path,
|
path,
|
||||||
|
implicitToken: true,
|
||||||
defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
|
defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -88,6 +93,7 @@ export class SubscriptionsCommand extends AbstractCommand {
|
||||||
|
|
||||||
path,
|
path,
|
||||||
query: { 'uris[]': options.uris },
|
query: { 'uris[]': options.uris },
|
||||||
|
implicitToken: true,
|
||||||
defaultExpectedStatus: HttpStatusCode.OK_200
|
defaultExpectedStatus: HttpStatusCode.OK_200
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@ export class LiveCommand extends AbstractCommand {
|
||||||
...options,
|
...options,
|
||||||
|
|
||||||
path: path + '/' + options.videoId,
|
path: path + '/' + options.videoId,
|
||||||
|
implicitToken: true,
|
||||||
defaultExpectedStatus: HttpStatusCode.OK_200
|
defaultExpectedStatus: HttpStatusCode.OK_200
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -39,6 +40,7 @@ export class LiveCommand extends AbstractCommand {
|
||||||
|
|
||||||
path: path + '/' + videoId,
|
path: path + '/' + videoId,
|
||||||
fields,
|
fields,
|
||||||
|
implicitToken: true,
|
||||||
defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
|
defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -59,6 +61,7 @@ export class LiveCommand extends AbstractCommand {
|
||||||
path,
|
path,
|
||||||
attaches,
|
attaches,
|
||||||
fields: omit(fields, 'thumbnailfile', 'previewfile'),
|
fields: omit(fields, 'thumbnailfile', 'previewfile'),
|
||||||
|
implicitToken: true,
|
||||||
defaultExpectedStatus: HttpStatusCode.OK_200
|
defaultExpectedStatus: HttpStatusCode.OK_200
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@ export class ServicesCommand extends AbstractCommand {
|
||||||
|
|
||||||
path,
|
path,
|
||||||
query,
|
query,
|
||||||
|
implicitToken: false,
|
||||||
defaultExpectedStatus: HttpStatusCode.OK_200
|
defaultExpectedStatus: HttpStatusCode.OK_200
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue