From 23a3a8827cb8b862f5cc7ee2819f39918303beca Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 6 Jul 2021 14:30:20 +0200 Subject: Introduce overviews command --- shared/extra-utils/overviews/overviews-command.ts | 25 +++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 shared/extra-utils/overviews/overviews-command.ts (limited to 'shared/extra-utils/overviews/overviews-command.ts') diff --git a/shared/extra-utils/overviews/overviews-command.ts b/shared/extra-utils/overviews/overviews-command.ts new file mode 100644 index 000000000..0ac3cbd33 --- /dev/null +++ b/shared/extra-utils/overviews/overviews-command.ts @@ -0,0 +1,25 @@ +import { HttpStatusCode } from '@shared/core-utils' +import { VideosOverview } from '@shared/models' +import { AbstractCommand, OverrideCommandOptions } from '../shared' + +export class OverviewsCommand extends AbstractCommand { + + getVideos (options: OverrideCommandOptions & { + page: number + token?: string + }) { + const { token, page } = options + const path = '/api/v1/overviews/videos' + + const query = { page } + + return this.getRequestBody({ + ...options, + + token: token || null, + path, + query, + defaultExpectedStatus: HttpStatusCode.OK_200 + }) + } +} -- cgit v1.2.3 From af971e06c620bd46a5aa64c8833364e7022b5e3d Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 6 Jul 2021 15:22:51 +0200 Subject: Introduce search command --- shared/extra-utils/overviews/overviews-command.ts | 1 - 1 file changed, 1 deletion(-) (limited to 'shared/extra-utils/overviews/overviews-command.ts') diff --git a/shared/extra-utils/overviews/overviews-command.ts b/shared/extra-utils/overviews/overviews-command.ts index 0ac3cbd33..6f56b0ce4 100644 --- a/shared/extra-utils/overviews/overviews-command.ts +++ b/shared/extra-utils/overviews/overviews-command.ts @@ -6,7 +6,6 @@ export class OverviewsCommand extends AbstractCommand { getVideos (options: OverrideCommandOptions & { page: number - token?: string }) { const { token, page } = options const path = '/api/v1/overviews/videos' -- cgit v1.2.3 From a1637fa1e25b60a88f7cfe50aac8953f50d55761 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 8 Jul 2021 10:55:16 +0200 Subject: Specify if we want to fallback to the server token --- shared/extra-utils/overviews/overviews-command.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'shared/extra-utils/overviews/overviews-command.ts') diff --git a/shared/extra-utils/overviews/overviews-command.ts b/shared/extra-utils/overviews/overviews-command.ts index 6f56b0ce4..e15644d94 100644 --- a/shared/extra-utils/overviews/overviews-command.ts +++ b/shared/extra-utils/overviews/overviews-command.ts @@ -7,7 +7,7 @@ export class OverviewsCommand extends AbstractCommand { getVideos (options: OverrideCommandOptions & { page: number }) { - const { token, page } = options + const { page } = options const path = '/api/v1/overviews/videos' const query = { page } @@ -15,9 +15,9 @@ export class OverviewsCommand extends AbstractCommand { return this.getRequestBody({ ...options, - token: token || null, path, query, + implicitToken: false, defaultExpectedStatus: HttpStatusCode.OK_200 }) } -- cgit v1.2.3 From c0e8b12e7fd554ba4d2ceb0c4900804c6a4c63ea Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 16 Jul 2021 10:42:24 +0200 Subject: Refactor requests --- shared/extra-utils/overviews/overviews-command.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'shared/extra-utils/overviews/overviews-command.ts') diff --git a/shared/extra-utils/overviews/overviews-command.ts b/shared/extra-utils/overviews/overviews-command.ts index e15644d94..d4a2ac254 100644 --- a/shared/extra-utils/overviews/overviews-command.ts +++ b/shared/extra-utils/overviews/overviews-command.ts @@ -1,4 +1,4 @@ -import { HttpStatusCode } from '@shared/core-utils' +import { HttpStatusCode } from '@shared/models' import { VideosOverview } from '@shared/models' import { AbstractCommand, OverrideCommandOptions } from '../shared' -- cgit v1.2.3 From 4c7e60bc17ee5830399bac4aa273356903421b4c Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 16 Jul 2021 14:27:30 +0200 Subject: Reorganize imports --- shared/extra-utils/overviews/overviews-command.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'shared/extra-utils/overviews/overviews-command.ts') diff --git a/shared/extra-utils/overviews/overviews-command.ts b/shared/extra-utils/overviews/overviews-command.ts index d4a2ac254..06b4892d2 100644 --- a/shared/extra-utils/overviews/overviews-command.ts +++ b/shared/extra-utils/overviews/overviews-command.ts @@ -1,5 +1,4 @@ -import { HttpStatusCode } from '@shared/models' -import { VideosOverview } from '@shared/models' +import { HttpStatusCode, VideosOverview } from '@shared/models' import { AbstractCommand, OverrideCommandOptions } from '../shared' export class OverviewsCommand extends AbstractCommand { -- cgit v1.2.3