Allow to pass client params when listing videos

This commit is contained in:
Chocobozzz 2024-12-09 09:50:27 +01:00
parent 97fa8ff6ea
commit d8b3436f68
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
1 changed files with 9 additions and 5 deletions

View File

@ -51,6 +51,7 @@ export type CommonVideoParams = {
isLive?: boolean
skipCount?: boolean
nsfw?: BooleanBothQuery
search?: string
}
@Injectable()
@ -178,15 +179,12 @@ export class VideoService {
getAccountVideos (parameters: CommonVideoParams & {
account: Pick<Account, 'nameWithHost'>
search?: string
}): Observable<ResultList<Video>> {
const { account, search } = parameters
const { account } = parameters
let params = new HttpParams()
params = this.buildCommonVideosParams({ params, ...parameters })
if (search) params = params.set('search', search)
return this.authHttp
.get<ResultList<Video>>(AccountService.BASE_ACCOUNT_URL + account.nameWithHost + '/videos', { params })
.pipe(
@ -548,7 +546,10 @@ export class VideoService {
privacyOneOf,
skipCount,
isLive,
nsfw
nsfw,
search,
...otherOptions
} = options
const pagination = videoPagination
@ -566,6 +567,9 @@ export class VideoService {
if (languageOneOf !== undefined) newParams = this.restService.addArrayParams(newParams, 'languageOneOf', languageOneOf)
if (categoryOneOf !== undefined) newParams = this.restService.addArrayParams(newParams, 'categoryOneOf', categoryOneOf)
if (privacyOneOf !== undefined) newParams = this.restService.addArrayParams(newParams, 'privacyOneOf', privacyOneOf)
if (search) newParams = newParams.set('search', search)
newParams = this.restService.addObjectParams(newParams, otherOptions)
return newParams
}