Allow to pass client params when listing videos
This commit is contained in:
parent
97fa8ff6ea
commit
d8b3436f68
|
@ -51,6 +51,7 @@ export type CommonVideoParams = {
|
||||||
isLive?: boolean
|
isLive?: boolean
|
||||||
skipCount?: boolean
|
skipCount?: boolean
|
||||||
nsfw?: BooleanBothQuery
|
nsfw?: BooleanBothQuery
|
||||||
|
search?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
|
@ -178,15 +179,12 @@ export class VideoService {
|
||||||
|
|
||||||
getAccountVideos (parameters: CommonVideoParams & {
|
getAccountVideos (parameters: CommonVideoParams & {
|
||||||
account: Pick<Account, 'nameWithHost'>
|
account: Pick<Account, 'nameWithHost'>
|
||||||
search?: string
|
|
||||||
}): Observable<ResultList<Video>> {
|
}): Observable<ResultList<Video>> {
|
||||||
const { account, search } = parameters
|
const { account } = parameters
|
||||||
|
|
||||||
let params = new HttpParams()
|
let params = new HttpParams()
|
||||||
params = this.buildCommonVideosParams({ params, ...parameters })
|
params = this.buildCommonVideosParams({ params, ...parameters })
|
||||||
|
|
||||||
if (search) params = params.set('search', search)
|
|
||||||
|
|
||||||
return this.authHttp
|
return this.authHttp
|
||||||
.get<ResultList<Video>>(AccountService.BASE_ACCOUNT_URL + account.nameWithHost + '/videos', { params })
|
.get<ResultList<Video>>(AccountService.BASE_ACCOUNT_URL + account.nameWithHost + '/videos', { params })
|
||||||
.pipe(
|
.pipe(
|
||||||
|
@ -548,7 +546,10 @@ export class VideoService {
|
||||||
privacyOneOf,
|
privacyOneOf,
|
||||||
skipCount,
|
skipCount,
|
||||||
isLive,
|
isLive,
|
||||||
nsfw
|
nsfw,
|
||||||
|
search,
|
||||||
|
|
||||||
|
...otherOptions
|
||||||
} = options
|
} = options
|
||||||
|
|
||||||
const pagination = videoPagination
|
const pagination = videoPagination
|
||||||
|
@ -566,6 +567,9 @@ export class VideoService {
|
||||||
if (languageOneOf !== undefined) newParams = this.restService.addArrayParams(newParams, 'languageOneOf', languageOneOf)
|
if (languageOneOf !== undefined) newParams = this.restService.addArrayParams(newParams, 'languageOneOf', languageOneOf)
|
||||||
if (categoryOneOf !== undefined) newParams = this.restService.addArrayParams(newParams, 'categoryOneOf', categoryOneOf)
|
if (categoryOneOf !== undefined) newParams = this.restService.addArrayParams(newParams, 'categoryOneOf', categoryOneOf)
|
||||||
if (privacyOneOf !== undefined) newParams = this.restService.addArrayParams(newParams, 'privacyOneOf', privacyOneOf)
|
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
|
return newParams
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue