Repository URL to install this package:
|
Version:
1.1.3 ▾
|
import { Transport } from '../transport';
import AuxData from './auxData';
import BumpMenu from './bumpMenu';
import Config from './config';
import ImageParams from './imageParams';
import ImageSerieInfo from './imageSerieInfo';
import { interfaces } from './interfaces';
import IntroPage from './introPage';
import MenuItem from './menuItem';
import SessionStateUpdate from './sessionStateUpdate';
import Suggestion from './suggestion';
import VolvoCarSpec from './volvoCarSpec';
import VolvoRetailer from './volvoRetailer';
import LeasingParams from './leasingParams';
import UrlSettings from './urlSettings';
export declare class Client {
private sessionState;
private transport;
private sessionId;
private sessionTtl;
private origin;
private initialCategory;
private itemInterpreterOptions;
private language;
constructor(transport: Transport);
/**
* Get the session id or throw if null
*/
getSessionId(): string;
/**
* Initialize session. This must be called before calling any other member function with "session". For most
* other session calls a configuration needs to be loaded as well.
*
* This is not done in the constructor in order to allow state-/session-less calls without initializing a
* session.
*
* Preconditions: None.
*/
sessionInit(menuQuery: string, readMoreMode: interfaces.BopReadMoreMode): Promise<void>;
/**
* Loads a configuration into the current session and replaces to current configuration state.
*
* Preconditions: Initialized session.
*/
sessionLoadConfig(config: Config): Promise<string>;
/**
* Try to change item state for one item in the current configuration. An item has two states, On or Off, eg.
* an item is part of the current configuration or it is not. The result of this operation can only be
* determined by the server. Any call to this function may result in suggestions being returned through the
* callback on_suggestions. If suggestions
*
* Use DsClient.setLanguage in order to specify language. Leaving it undefined will cause the backend to
* resolve a preferred instead.
*
* Preconditions: Initialized session, loaded configuration, caller code has a valid instance of spv.ds.MenuItem.
*/
sessionToggleItem(menuItem: MenuItem): Promise<{
result: Suggestion[];
resultCode: "MULTIPLE_RESOLVERS";
resolversText: string;
} | {
result: Suggestion[];
resultCode: "RESOLVERS";
resolversText: string;
}>;
/**
* Apply a configuration change suggestion on the current configuration.
*
* Preconditions: Initialized session, loaded configuration, caller code has a valid instance of
* Suggestion retrieved by calling sessionToggleItem, no requests that modify the session configuration
* has been dispatched between suggestion construction and the call to this function.
*/
sessionApplySuggestion(suggestion: Suggestion): Promise<void>;
sessionGetConfig(encoding: string): Promise<Config>;
sessionGetAuxiliaryData(): AuxData;
sessionGetCurrentPriceMode(): Promise<interfaces.VDSPriceMode>;
sessionGetLeasingParams(): Promise<LeasingParams>;
sessionUpdateLeasingParams(drivingDistance: number, duration: number): Promise<LeasingParams>;
sessionGetImageSerieInfos(): ImageSerieInfo[];
sessionGetRootMenuItems(): BumpMenu[];
sessionGetItem(itemId: string): Partial<MenuItem>;
sessionGetStateUpdate(): SessionStateUpdate;
sessionGetUrlSettings(): UrlSettings;
/**
* Choose which collection of price rules to use for the current session
*
* Preconditions: Initialized session.
*/
sessionSetPriceLocalisation(localisationId: string): Promise<void>;
sessionSetPriceMode(priceMode: interfaces.VDSPriceMode, sendUpdate: interfaces.SendBopUpdateFlag, optionalInput: string[]): Promise<void>;
generatePublicConfig(): Promise<string>;
sessionLoadPublicConfig(configId: string): Promise<string>;
/**
* Requests an image for a serialized configuration.
*
* Preconditions: None.
*/
getConfigImage(config: Config, imgParams: ImageParams): Promise<string>;
/**
* Requests the "Intro page" data including available start configurations,
* typically one config for each car model.
*/
getIntroPage(): Promise<IntroPage>;
/**
* Get complete item info for items by item id
*
* Preconditions: Initialized session, loaded configuration.
*/
sessionGetItemInfo(itemIds: string[]): Promise<MenuItem[]>;
/**
* Requests all available retailers
*
* Preconditions: None.
*/
getVolvoRetailers(): Promise<VolvoRetailer[]>;
getSpecification(config: Config, localizationId: string): Promise<VolvoCarSpec>;
private updateStateFromBop(bop);
}
export default Client;