import type { House } from '@entities' import type { FilterType, HttpClient, IncludeType } from '@services' import { endpointMaker } from '@services' import type { ApiError, Response } from '@types' export type GetHousesInput = { houseIds: string[] include?: IncludeType filter?: FilterType pagination?: { per: string; page: string } params?: { [key: string]: string } } const getHouses = (http: HttpClient) => ({ query: ( input: GetHousesInput, ): Promise> => { const query = endpointMaker({ includes: input.include, filter: input.filter, pagination: input.pagination, }) if (input.houseIds.length > 0) { const ids = `?ids=${input.houseIds.join(',')}` return http.get(`v3/admin/houses${ids}`, { ...input.params, }) } return http.get(`v3/admin/houses${query}`) }, }) export default getHouses