spv.bvds.BvdsClient
Classspv.bvds.BvdsClient
> spv.ds.DsClient
spv.bvds.BvdsClient(service_url, in_settings)
service_url
{string
}
in_settings
{spv.ds.DsClientSettings
=}
.assertInitializedSession()
[protected]Inherited from spv.ds.DsClient
.
Throw exception if session is not initialized.
.constructDefaultImageParams()
Inherited from spv.ds.DsClient
.
Create a ImageParams instance with default values, however, defaults are likely not good enough for most contexts. Preconditions: None. @export
spv.ds.ImageParams
}
.constructFailureWrapperForQueue(wrap_me)
[protected]Inherited from spv.ds.DsClient
.
Constructs the standard failure callback wrapper for queued session requests
wrap_me
{function
(Error
)}
function
(Error
)}
.extractArticleNumberFromAux(item_aux_obj)
item_aux_obj
{Object
}
Object
.<string
,string
>}
.generatePublicConfig(on_success, on_failure)
Inherited from spv.ds.DsClient
.
Save the current configuration for the logged in user as a public config. The generated name is returned as a string to the on_success function. Preconditions: Initialized session, loaded configuration, logged in user. @export
on_success
{function
(string
)}
on_failure
{function
(Error
)}
.getConfigImage(conf, img_params, on_success, on_failure)
Inherited from spv.ds.DsClient
.
Requests an image for a serialized configuration. Preconditions: None. @export
conf
{spv.ds.Config
}
img_params
{spv.ds.ImageParams
}
on_success
{function
(spv.ds.ImageResult
)}
on_failure
{function
(Error
)}
.getFreshConfigs(limit, scale_width, scale_height, on_success, on_failure)
Inherited from spv.ds.DsClient
.
Requests the most recently built car configurations. @export
limit
{number
}
scale_width
{number
}
scale_height
{number
}
on_success
{function
(Array
.<spv.ds.FreshConfig
>)}
on_failure
{function
(Error
)}
.getIntroPage(on_success, on_failure)
Inherited from spv.ds.DsClient
.
Requests the "Intro page" data including available start-configurations, typically one config for each car model. Preconditions: None. @export
on_success
{function
(spv.ds.IntroPage
)}
on_failure
{function
(Error
)}
.getSessionId()
Inherited from spv.ds.DsClient
.
Get the session id or throw if null @export
string
}
.getUserConfigList(username, on_success, on_failure)
Inherited from spv.ds.DsClient
.
Gets all configurations stored in the database by the given username. This is a heavy operation and is included here for utility purposes. @export
username
{string
}
on_success
{function
(Array
.<spv.ds.SavedConfig
>)}
on_failure
{function
(Error
)}
.sessionApplySuggestion(suggestion, on_success, on_failure)
Inherited from spv.ds.DsClient
.
Apply a configuration change suggestion on the current configuration. Preconditions: Initialized session, loaded configuration, caller code has a valid instance of spv.ds.Suggestion retrieved by calling sessionToggleItem, no requests that modify the session configuration has been dispatched between suggestion construction and the call to this function. @export
suggestion
{spv.ds.Suggestion
}
on_success
{Function
}
on_failure
{function
(Error
)}
.sessionCheckForArticleNumber(item_id)
Makes a lookup for the given item id to see if it has an article number. An object is returned with {state: somestate, value: thearticlenumber}. Possible state values: "FOUND": An article number was found and is returned in the value field. "NO_AUX_DATA": There's no additional data for this item, what so ever. "NO_SPECIFIC_AUX_DATA": There's no Bvds specific aux data for this item. "NO_ARTNO_AUX_DATA": It has Bvds aux data, but no article number in it. Only if state === "FOUND" will the value contain a string with the article number. .value will be undefined in all other cases. @export
item_id
{string
}
Object
.<string
,string
>}
.sessionDequeueNextRequest()
[protected]Inherited from spv.ds.DsClient
.
Session requests that require synchronization must use this function This function is not allowed to throw exceptions.
.sessionEnqueueRequest(request)
[protected]Inherited from spv.ds.DsClient
.
Session requests that require synchronization must use this function
request
{Function
}
.sessionGeneratePdf(on_success, on_failure)
Inherited from spv.ds.DsClient
.
Create a pdf using current session state and returns the pdf url through a callback if a pdf was generated successfully. Preconditions: Initialized session, loaded configuration. @export
on_success
{function
(string
)}
on_failure
{function
(Error
)}
.sessionGetArticleNumber(item_id)
Gets the article number for an item or null if it doesn't have one. @export
item_id
{string
}
string
}
.sessionGetAuxiliaryData()
[protected]Inherited from spv.ds.DsClient
.
Returns the auxiliary data arriving with the latest bop. Preconditions: Initialized session, loaded configuration.
Object
.<string
, Object
>}
.sessionGetConfig(encoding, on_success, on_failure)
Inherited from spv.ds.DsClient
.
Requests the current session config Available encodings are: "" : internal encoding, only for debug Preconditions: Initialized session, loaded config. @export
encoding
{string
}
on_success
{function
(spv.ds.Config
)}
on_failure
{function
(Error
)}
.sessionGetConfigNames(on_success, on_failure)
Inherited from spv.ds.DsClient
.
Get the saved configs for the logged in user Preconditions: Initialized session, logged in user. @export
on_success
{function
(Array
.<string
>)}
on_failure
{function
(Error
)}
.sessionGetCurrentConfig()
Gets the current configuration. Preconditions: Initialized session, loaded configuration. This requires the CurrentConfigAuxPlugin to work. @export
spv.ds.Config
}
.sessionGetFacebookShareData(on_success, on_failure)
Inherited from spv.ds.DsClient
.
Requests the text, images etc used for facebook sharing. Preconditions: Initialized session, loaded configuration. @export
on_success
{function
(spv.ds.FacebookShareData
)}
on_failure
{function
(Error
)}
.sessionGetFreshConfigs(limit, scale_width, scale_height, on_success, on_failure)
[deprecated]Deprecated. @export
Inherited from spv.ds.DsClient
.
Requests the most recently built car configurations.
limit
{number
}
scale_width
{number
}
scale_height
{number
}
on_success
{function
(Array
.<spv.ds.FreshConfig
>)}
on_failure
{function
(Error
)}
.sessionGetImage(img_params, on_success, on_failure)
Inherited from spv.ds.DsClient
.
Builds an image for the current configuration state in this session. Preconditions: Initialized session, loaded configuration. @export
img_params
{spv.ds.ImageParams
}
on_success
{function
(spv.ds.ImageResult
)}
on_failure
{function
(Error
)}
.sessionGetImageSerieInfos()
Inherited from spv.ds.DsClient
.
Get image serie info for the current configuration Preconditions: Initialized session, loaded configuration. @export
Array
.<spv.ds.ImageSerieInfo
>}
.sessionGetIntroDisclaimer()
Inherited from spv.ds.DsClient
.
Gets the disclaimer to be displayed when the configurator is started. @export
spv.ds.Disclaimer
}
.sessionGetItemInfo(item_ids, on_success, on_failure)
Inherited from spv.ds.DsClient
.
Get complete item info for items by item id Preconditions: Initialized session, loaded configuration. @export
item_ids
{Array
.<string
>}
on_success
{function
(Array
.<spv.ds.MenuItem
>)}
on_failure
{function
(Error
)}
.sessionGetItemSummaryArticleNumber(item_summary)
item_summary
{spv.ds.ItemSummary
}
string
}
.sessionGetLongText(item_id)
Inherited from spv.ds.DsClient
.
Get 'long_text' text for item_id or empty string on failure Texts are configuration dependent. In practice updating texts is only needed after loading a configuration, not when simply toggling an item in the configuration. Preconditions: Initialized session, loaded configuration. @export
item_id
{string
}
string
}
.sessionGetMediumText(item_id)
Inherited from spv.ds.DsClient
.
Get 'medium_text' text for item_id or empty string on failure Texts are configuration dependent. In practice updating texts is only needed after loading a configuration, not when simply toggling an item in the configuration. Preconditions: Initialized session, loaded configuration. @export
item_id
{string
}
string
}
.sessionGetModelDisclaimer(model_id)
Inherited from spv.ds.DsClient
.
Get the disclaimer specific for a model. If no model id is passed, it'll default to the active configuration's model. @export
model_id
{string
=}
spv.ds.Disclaimer
}
.sessionGetRootMenuItems()
Inherited from spv.ds.DsClient
.
Get the root menu items for the current configuration Preconditions: Initialized session, loaded config. @export
Array
.<spv.ds.MenuItem
>}
.sessionGetShortText(item_id)
Inherited from spv.ds.DsClient
.
Get 'short_text' text for item_id or empty string on failure Texts are configuration dependent. In practice updating texts is only needed after loading a configuration, not when simply toggling an item in the configuration. Preconditions: Initialized session, loaded configuration. @export
item_id
{string
}
string
}
.sessionGetStateUpdate()
Get the last state update. Call this function on successful load of configs or on successful sessionToggleItem. Preconditions: Initialized session, loaded configuration. @export
spv.ds.SessionStateUpdate
}
.sessionGetSummary(on_success, on_failure)
Get the summary for the current session and configuration. This override excludes the item summaries with no text. Preconditions: Initialized session, loaded configuration. @export
on_success
{function
(spv.ds.Summary
)}
on_failure
{function
(Error
)}
.sessionGetSummaryArticleNumbers(summary)
Finds the article number for the items in a summary. Use BvdsClient.sessionGetSummary() to fetch the configuration's summary. @export
summary
{spv.ds.Summary
}
Array
.<string
>}
.sessionGetUrlSettings()
Inherited from spv.ds.DsClient
.
Get base urls needed for most HTTP GET paths to images Preconditions: Initialized session. @export
spv.ds.UrlSettings
}
.sessionGetUserConfigImage(config_name, img_params, on_success, on_failure)
Inherited from spv.ds.DsClient
.
Requests an image for a saved configuration Preconditions: Initialized session, logged in user. @export
config_name
{string
}
img_params
{spv.ds.ImageParams
}
on_success
{function
(spv.ds.ImageResult
)}
on_failure
{function
(Error
)}
.sessionInit(menu_query, readmore_mode, on_success, on_failure)
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. This override makes sure the initial session state is updated. Preconditions: None. @export
menu_query
{string
}
readmore_mode
{spv.ds.ipprot_nova.input.BopReadMoreMode
}
on_success
{function
(spv.ds.IntroPage
)}
on_failure
{function
(Error
)}
.sessionLoadConfig(config, on_success, on_failure)
Inherited from spv.ds.DsClient
.
Loads a configuration into the current session and replaces to current configuration state. Preconditions: Initialized session. @export
config
{spv.ds.Config
}
on_success
{function
(spv.ds.ConfigLoadResult
)}
on_failure
{function
(Error
)}
.sessionLoadConfigByName(config_name, on_success, on_failure)
Inherited from spv.ds.DsClient
.
Loads a configuration into the current session and replaces to current configuration state. The config is referenced by it's name retrieved from sessionGetConfigNames. Preconditions: Initialized session, logged in user. @export
config_name
{string
}
on_success
{function
(spv.ds.ConfigLoadResult
)}
on_failure
{function
(Error
)}
.sessionLoadPublicConfig(public_config_id, on_success, on_failure)
Inherited from spv.ds.DsClient
.
Loads a configuration from the "public" database into the current session replacing the current configuration state. "Public Configs" are anonymous configurations saved without any user information that can be loaded by a unique key. Preconditions: Initialized session. @export
public_config_id
{string
}
on_success
{function
(spv.ds.ConfigLoadResult
)}
on_failure
{function
(Error
)}
.sessionLogin(user_name, on_success, on_failure)
Inherited from spv.ds.DsClient
.
Login a user by username, passwords are not required at the moment since no private information is supposed to be saved using this system. An account will be crated if the username has not been used before. Preconditions: Initialized session. @export
user_name
{string
}
on_success
{Function
}
on_failure
{function
(Error
)}
.sessionRemoveConfigByName(config_name, on_success, on_failure)
Inherited from spv.ds.DsClient
.
Remove a saved configuration for the logged in user Preconditions: Initialized session, logged in user. @export
config_name
{string
}
on_success
{Function
}
on_failure
{function
(Error
)}
.sessionResetRequestQueue()
[protected]Inherited from spv.ds.DsClient
.
Resets session request queue
.sessionSaveConfigByName(config_name, allow_overwrite, on_success, on_failure)
Inherited from spv.ds.DsClient
.
Save the current configuration for the logged in user Preconditions: Initialized session, loaded configuration, logged in user. @export
config_name
{string
}
allow_overwrite
{boolean
}
on_success
{Function
}
on_failure
{function
(Error
)}
.sessionSendHeartBeat(on_success, on_failure)
Inherited from spv.ds.DsClient
.
Call this function to keep the session alive Preconditions: Initialized session. @export
on_success
{function
()}
on_failure
{function
(Error
)}
.sessionSetPriceLocalization(price_localization_id, on_success, on_failure)
Inherited from spv.ds.DsClient
.
Choose which collection of price rules to use for the current session Preconditions: Initialized session. @export
price_localization_id
{string
}
on_success
{Function
}
on_failure
{function
(Error
)}
.sessionToggleItem(menu_item, on_success, on_suggestions, on_failure)
Inherited from spv.ds.DsClient
.
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 Preconditions: Initialized session, loaded configuration, caller code has a valid instance of spv.ds.MenuItem. @export
menu_item
{spv.ds.MenuItem
}
on_success
{Function
}
on_suggestions
{function
(Array
.<spv.ds.Suggestion
>)}
on_failure
{function
(Error
)}
.sessionUpdateBop(on_success, on_failure)
[protected]Inherited from spv.ds.DsClient
.
Requests a fresh bop and stores the new state in the client.
on_success
{function
()}
on_failure
{function
(Error
)}