import { callApi } from 'helpers' import { ADS_API_URL } from 'config' import { DeviceType } from '../../components/Ads/types' export type AdsParams = { client_type: DeviceType, language: string, type_id: number, } export type AdType = { 'duration': number, 'frequency': number, 'id': number, 'impressions': number, 'link': string, 'media': { url: string, }, 'name': string, 'position': { 'id': number, 'name_eng': string, 'name_rus': string, 'source_type': string, }, remaining_views: number, 'time_close': number, 'type': { 'id': number, 'name_eng': string, 'name_rus': string, }, } export type PositionName = 'header' | 'block' | 'match_cell' | 'mobile' export type AdResponse = Record export type AdsListType = Array export const getAds = (params: AdsParams): Promise => { const config = { body: params, } return callApi({ config, url: ADS_API_URL, }) }