import { Base } from '@adexchange/aeg-common'; import { ILimelightApiFindOrdersOptions, ILimelightApiFindActiveCampaignsOptions, ILimelightApiOptions, LimelightApiFindActiveCampaignsResponse, LimelightApiFindActiveCampaignsExpandedResponse, LimelightApiFindCustomersResponse, LimelightApiFindOrdersResponse, LimelightApiFindUpdatedOrdersResponse, LimelightApiGetCampaignResponse, LimelightApiGetCustomerResponse, LimelightApiGetOrderResponse, LimelightApiGetOrdersResponse, LimelightApiGetProductsResponse, LimelightApiShippingMethodResponse, LimelightApiUpdateOrdersRequest, LimelightApiUpdateOrdersResponse, LimelightApiGatewayResponse, LimelightApiGatewaysResponse } from './types/types'; export interface IComposeApiCallResponseType { uri: string; form: any; timeout: number; } /** * Limelight API wrapper */ export default class Api extends Base { private _user; private _password; private _domain; private _conf; private _eventEmitter; private _membershipResponseCodes; private _validateCredentialsThrottle; private _findActiveCampaignsThrottle; private _getCampaignThrottle; private _getOrderThrottle; private _getOrdersThrottle; private _findOrdersThrottle; private _findUpdatedOrdersThrottle; private _updateOrdersThrottle; private _getCustomerThrottle; private _findCustomersThrottle; private _getProductsThrottle; private _findShippingMethodsThrottle; private _getGatewayThrottle; private _getGatewaysThrottle; constructor(user: string, password: string, domain: string); membershipResponseCodeDesc(code: number): string; validateCredentials(options?: ILimelightApiOptions): Promise; findActiveCampaigns(options?: ILimelightApiOptions): Promise; findActiveCampaignsExpanded(options?: ILimelightApiFindActiveCampaignsOptions): Promise; getCampaign(campaignId: number, options?: ILimelightApiOptions): Promise; getOrder(orderId: number, options?: ILimelightApiOptions): Promise; getOrders(orderIds: number[], options?: ILimelightApiOptions): Promise; findOrders(campaignId: string | number, startDate: string, endDate: string, options?: ILimelightApiFindOrdersOptions): Promise; findUpdatedOrders(campaignId: string | number, groupKeys: string[], startDate: string, endDate: string, options?: ILimelightApiOptions): Promise; updateOrders(orderUpdates: LimelightApiUpdateOrdersRequest, options?: ILimelightApiOptions): Promise; getCustomer(customerId: number, options?: ILimelightApiOptions): Promise; findCustomers(campaignId: number | string, startDate: string, endDate: string, options?: ILimelightApiOptions): Promise; getProducts(productIds: number[], options?: ILimelightApiOptions): Promise; findShippingMethods(campaignId: string | number, options?: ILimelightApiOptions): Promise; getGateway(gatewayId: number, options?: ILimelightApiOptions): Promise; getGateways(gatewayIds: number[], options?: ILimelightApiOptions): Promise; private _validateCredentials(options?); private _findActiveCampaigns(options?); private _getCampaign(campaignId, options?); private _getOrder(orderId, options?); private _getOrders(orderIds, options?); private _findOrders(campaignId, startDate, endDate, options?); private _findUpdatedOrders(campaignId, groupKeys, startDate, endDate, options?); private _updateOrders(orderUpdates, options?); private _getCustomer(customerId, options?); private _findCustomers(campaignId, startDate, endDate, options?); private _getProducts(productIds, options?); private _findShippingMethods(campaignId, options?); private _getGateway(gatewayId, options?); private _getGateways(gatewayIds, options?); private _composeApiCall(apiType, method, params, options?); private _apiRequest(apiType, method, params, options?); private _cleanseGateway(gateway); private _cleanseOrder(orderId, order); private _cleanseCampaign(id, campaign); private _cleanseCustomer(id, customer); private _cleanseShippingInfo(id, shippingMethod); private _cleanseProducts(productIds, product); private _parseCsv(csvString); private _mergeOptions(params, options); /** * We do not want any concurrency on LL, it has to be throttled */ private _sequential(fn); }