import { get } from './apiClient';
import type { ServiceCatalog, RecentApi, PopularApi } from '../types/apihub';
import type { ApiDetailInfo } from '../types/service';

export const getCatalog = () => get<ServiceCatalog[]>('/api-hub/catalog');
export const getRecentApis = () => get<RecentApi[]>('/api-hub/recent-apis');
export const getPopularApis = () => get<PopularApi[]>('/api-hub/popular-apis');
export const getServiceCatalog = (serviceId: number) =>
  get<ServiceCatalog>(`/api-hub/services/${serviceId}`);
export const getApiHubApiDetail = (serviceId: number, apiId: number) =>
  get<ApiDetailInfo>(`/api-hub/services/${serviceId}/apis/${apiId}`);
