import createFetchWrapper from "./createFetchWrapper" ; import { PaginationParams , ErrorResponse , Video , Videos , VideoFilterParams , } from "./types" ; type SearchReturn = Videos | ErrorResponse ; type PopularReturn = Videos | ErrorResponse ; type ShowReturn = Video ; export default function generatePhotoEndpoints ( apiKey ) { const fetchWrapper = createFetchWrapper ( apiKey , "video" ) ; return { search ( params ) { return fetchWrapper ( `/search` , params ) ; } , popular ( params = { } ) { return fetchWrapper ( `/popular` , params ) ; } , show ( { id } ) { return fetchWrapper ( `/videos/${ id }` ) ; } , } ; }