UNPKG

trade360-nodejs-sdk

Version:
134 lines (133 loc) 7.91 kB
import { IHttpServiceConfig, IMapper } from '../../common'; import { ISubscriptionHttpClient } from '../interfaces'; import { BaseHttpClient } from '../../base-http-client'; import { ChangeManualSuspensionsRequestDto, CompetitionsSubscriptionRequestDto, FixturesMetadataSubscriptionsRequestDto, FixturesSubscriptionRequestDto, GetFixtureScheduleRequestDto, GetSubscriptionsRequestDto, LeaguesSubscriptionRequestDto } from '../../common/subscription/dtos'; import { ChangeManualSuspensionsResponse, CompetitionsSubscriptionCollectionResponse, FixtureScheduleCollectionResponse, FixturesMetadataSubscriptionsCollectionResponse, FixturesSubscriptionCollectionResponse, GetManualSuspensionsResponse, LeaguesSubscriptionCollectionResponse, PackageQuotaResponse, SubscriptionsCollectionResponse } from '../../common/subscription/responses'; /** * SubscriptionHttpClient class is responsible for sending requests * to the subscription API. It is a HTTP client for the subscription * API. It contains the logic for sending requests to the subscription * API. * @param restApiBaseUrl The base URL of the customers API * @param packageCredentials The package credentials for the API * @param logger The logger instance * @param mapper The mapper instance * @returns A new instance of the SubscriptionHttpClient class with * the provided HTTP service configuration and mapper. * @implements ISubscriptionHttpClient interface for sending requests * to the subscription API and getting responses from the subscription * API. * @see ISubscriptionHttpClient interface for sending requests to the * subscription API and getting responses from the subscription API. * @see BaseHttpClient class for sending requests to the customers API. * */ export declare class SubscriptionHttpClient extends BaseHttpClient implements ISubscriptionHttpClient { private readonly mapper; constructor({ packageCredentials, restApiBaseUrl, logger }: IHttpServiceConfig, mapper: IMapper); /** * Sends a request to the subscription API to get the package * quota information. * @returns A promise that resolves to a PackageQuotaResponse * object containing the package quota information. */ getPackageQuota(): Promise<PackageQuotaResponse | undefined>; /** * Sends a request to the subscription API to get the fixtures schedule. * @param requestDto The request DTO for getting the fixtures schedule. * @returns A promise that resolves to a FixtureScheduleCollectionResponse * object containing the fixture schedule information. */ getFixturesSchedule(requestDto: GetFixtureScheduleRequestDto): Promise<FixtureScheduleCollectionResponse | undefined>; /** * Sends a request to the subscription API to subscribe to fixtures. * @param requestDto The request DTO for subscribing to fixtures. * @returns A promise that resolves to a * FixturesSubscriptionCollectionResponse object containing the * fixtures subscription information. */ subscribeByFixtures(requestDto: FixturesSubscriptionRequestDto): Promise<FixturesSubscriptionCollectionResponse | undefined>; /** * Sends a request to the subscription API to unsubscribe from fixtures. * @param requestDto The request DTO for unsubscribing from fixtures. * @returns A promise that resolves to a * FixturesSubscriptionCollectionResponse object containing the * fixtures unsubscription information. */ unSubscribeByFixtures(requestDto: FixturesSubscriptionRequestDto): Promise<FixturesSubscriptionCollectionResponse | undefined>; /** * Sends a request to the subscription API to subscribe to leagues. * @param requestDto The request DTO for subscribing to leagues. * @returns A promise that resolves to a * LeaguesSubscriptionCollectionResponse object containing the * leagues subscription information. */ subscribeByLeagues(requestDto: LeaguesSubscriptionRequestDto): Promise<LeaguesSubscriptionCollectionResponse | undefined>; /** * Sends a request to the subscription API to unsubscribe from leagues. * @param requestDto The request DTO for unsubscribing from leagues. * @returns A promise that resolves to a * LeaguesSubscriptionCollectionResponse object containing the leagues * unsubscription information. */ unSubscribeByLeagues(requestDto: LeaguesSubscriptionRequestDto): Promise<LeaguesSubscriptionCollectionResponse | undefined>; /** * Sends a request to the subscription API to get fixtures subscriptions. * @param requestDto The request DTO for getting fixtures subscriptions. * @returns A promise that resolves to a * GetSubscriptionsCollectionResponse object containing the fixtures * subscriptions information. */ getSubscriptions(requestDto: GetSubscriptionsRequestDto): Promise<SubscriptionsCollectionResponse | undefined>; /** * Sends a request to the subscription API to subscribe to competitions. * @param requestDto The request DTO for subscribing to competitions. * @returns A promise that resolves to a * CompetitionsSubscriptionCollectionResponse object containing the * competitions subscription information. */ subscribeByCompetitions(requestDto: CompetitionsSubscriptionRequestDto): Promise<CompetitionsSubscriptionCollectionResponse | undefined>; /** * Sends a request to the subscription API to unsubscribe from * competitions. * @param requestDto The request DTO for unsubscribing from competitions. * @returns A promise that resolves to a * CompetitionsSubscriptionCollectionResponse object containing the * competitions unsubscription information from the subscription API. */ unSubscribeByCompetitions(requestDto: CompetitionsSubscriptionRequestDto): Promise<CompetitionsSubscriptionCollectionResponse | undefined>; /** * Sends a request to the subscription API to get all manual suspensions. * @returns A promise that resolves to a GetManualSuspensionsResponse object * containing the manual suspensions information. */ getAllManualSuspensions(): Promise<GetManualSuspensionsResponse | undefined>; /** * Sends a request to the subscription API to add manual suspensions. * @param requestDto The request DTO for adding manual suspensions. * @returns A promise that resolves to a ChangeManualSuspensionsResponse * object containing the manual suspensions information. */ addManualSuspensions(requestDto: ChangeManualSuspensionsRequestDto): Promise<ChangeManualSuspensionsResponse | undefined>; /** * Sends a request to the subscription API to remove manual suspensions. * @param requestDto The request DTO for removing manual suspensions. * @returns A promise that resolves to a ChangeManualSuspensionsResponse * object containing the manual suspensions information. */ removeManualSuspensions(requestDto: ChangeManualSuspensionsRequestDto): Promise<ChangeManualSuspensionsResponse | undefined>; /** * Sends a request to the subscription API to get fixtures metadata * subscriptions. It sends a * GET request to API and FixturesMetadataCollectionResponse as the * response type. The request contains the properties for the * request to get fixture metadata from the API. The response will * automatically trim and provide data only for the configured * upcoming duration if the date range is more than configured max * duration. * @returns A promise that resolves to a * FixturesMetadataSubscriptionsCollectionResponse object containing * the fixtures metadata subscriptions information. */ getFixturesMetadataSubscriptions(requestDto: FixturesMetadataSubscriptionsRequestDto): Promise<FixturesMetadataSubscriptionsCollectionResponse | undefined>; }