ds/impl/IDsProtocol.js

/**
 * @fileoverview Internal definitions used in DsClient
 *
 * @author anders.rejdebrant@spark-vision.com (Anders Rejdebrant)
 */


goog.provide('spv.ds.impl.IDsProtocol');

goog.require('spv.ds.Config');
goog.require('spv.ds.BipAttemptResultCode');
goog.require('spv.ds.UserConfigInfo');
goog.require('spv.ds.ConfigLoadResult');
goog.require('spv.ds.FacebookShareData');
goog.require('spv.ds.FreshConfig');
goog.require('spv.ds.ImageResult');
goog.require('spv.ds.IntroPage');
goog.require('spv.ds.ItemResources');
goog.require('spv.ds.PresentationStructure');
goog.require('spv.ds.PresentationStructureQuery');
goog.require('spv.ds.PublicConfigInfo');
goog.require('spv.ds.SessionStateUpdate');
goog.require('spv.ds.Summary');
goog.require('spv.ds.impl.AuxData');
goog.require('spv.ds.impl.GoalStateResolver');
goog.require('spv.ds.impl.SessionInitData');

goog.require('spv.ds.ipprot_nova.input.BopReadMoreMode');
goog.require('spv.ds.ipprot_nova.input.BopDisabledFlagMode');


/**
 * Server protocol interface
 *
 * @interface
 */
spv.ds.impl.IDsProtocol = function() {};


/**
 * @param {spv.ds.Config} conf
 * @param {spv.ds.ImageParams} img_params
 * @param {function(spv.ds.ImageResult)} on_success
 * @param {function(Error)} on_failure
 */
spv.ds.impl.IDsProtocol.prototype.getConfigImage = function(
		conf,
		img_params,
		on_success,
		on_failure) {};


/**
 * @param {function(spv.ds.IntroPage)} on_success
 * @param {function(Error)} on_failure
 */
spv.ds.impl.IDsProtocol.prototype.getIntroPage = function(
		on_success,
		on_failure) {};


/**
 * @param {string} item_id
 * @param {string} model
 * @param {string} category
 * @param {function(Array.<spv.ds.ReadMoreResource>)} on_success
 * @param {function(Error)} on_failure
 */
spv.ds.impl.IDsProtocol.prototype.getReadMore = function(
	item_id,
	model,
	category,
	language,
	on_success,
	on_failure) {};

/**
 * @param {Array<string>} item_ids
 * @param {string} category
 * @param {string} model
 * @param {string} language
 * @param {function(Object<string,spv.ds.ItemResources>)} on_success
 * @param {function(Error)} on_failure
 **/
spv.ds.impl.IDsProtocol.prototype.getItemResources = function(
	item_ids,
	category,
	model,
	language,
	on_success,
	on_failure) {};


/**
 * @param {string} username
 * @param {function(Array.<spv.ds.SavedConfig>)} on_success
 * @param {function(Error)} on_failure
 */
spv.ds.impl.IDsProtocol.prototype.getUserConfigList = function(
	username,
	on_success,
	on_failure) {};


/**
 * @param {string} session_id
 * @param {Array.<string>} group_ids
 * @param {function()} on_success
 * @param {function(Error)} on_failure
 */
spv.ds.impl.IDsProtocol.prototype.sessionAddGuiGroupSubscriptions = function(
	session_id,
	group_ids,
	on_success,
	on_failure ) {};


/**
 * @param {string} session_id
 * @param {function()} on_success
 * @param {function(Error)} on_failure
 */
spv.ds.impl.IDsProtocol.prototype.sessionClearGuiGroupSubscriptions = function(
	session_id,
	on_success,
	on_failure ) {};


/**
 * @param {string} session_id
 * @param {function(string)} on_success    Callback taking the generated pdf url
 * @param {function(Error)} on_failure
 */
spv.ds.impl.IDsProtocol.prototype.sessionGeneratePdf = function(
		session_id,
		on_success,
		on_failure) {};


/**
 * @param {string} session_id
 * @param {string} encoding
 * @param {function(spv.ds.Config)} on_success
 * @param {function(Error)} on_failure
 */
spv.ds.impl.IDsProtocol.prototype.sessionGetConfig = function(
		session_id,
		encoding,
		on_success,
		on_failure) {};


/**
 * @param {string} session_id
 * @param {function(Array.<string>)} on_success
 * @param {function(Error)} on_failure
 */
spv.ds.impl.IDsProtocol.prototype.sessionGetConfigNames = function(
		session_id,
		on_success,
		on_failure) {};


/**
 * @param {string} session_id
 * @param {function(spv.ds.FacebookShareData)} on_success
 * @param {function(Error)} on_failure
 */
spv.ds.impl.IDsProtocol.prototype.sessionGetFacebookShareData = function(
		session_id,
		on_success,
		on_failure) {};


/**
 * TODO: Remove this method once old booster is completely discontinued.
 *          Nova's getFreshConfigs is a session free call.
 * @param {string} session_id
 * @param {number} limit
 * @param {number} scale_width
 * @param {number} scale_height
 * @param {function(Array.<spv.ds.FreshConfig>)} on_success
 * @param {function(Error)} on_failure
 */
spv.ds.impl.IDsProtocol.prototype.sessionGetFreshConfigs = function(
		session_id,
		limit,
		scale_width,
		scale_height,
		on_success,
		on_failure) {};


/**
 * @param {number} limit
 * @param {number} scale_width
 * @param {number} scale_height
 * @param {function(Array.<spv.ds.FreshConfig>)} on_success
 * @param {function(Error)} on_failure
 */
spv.ds.impl.IDsProtocol.prototype.getFreshConfigs = function(
		limit,
		scale_width,
		scale_height,
		on_success,
		on_failure) {};


/**
 * @param {string} session_id
 * @param {spv.ds.ImageParams} img_params
 * @param {function(spv.ds.ImageResult)} on_success
 * @param {function(Error)} on_failure
 */
spv.ds.impl.IDsProtocol.prototype.sessionGetImage = function(
		session_id,
		img_params,
		on_success,
		on_failure) {};


/**
 * @param {string} session_id
 * @param {Array.<string>} item_ids
 * @param {string} language
 * @param {function(Array.<spv.ds.MenuItem>)} on_success
 * @param {function(Error)} on_failure
 */
spv.ds.impl.IDsProtocol.prototype.sessionGetItemInfo = function(
		session_id,
		item_ids,
		language,
		on_success,
		on_failure) {};


/**
 * @param {string} session_id
 * @param {number} serie_index
 * @param {number} frame_index
 * @param {string} file_type
 * @param {boolean} separate_background
 * @param {boolean} separate_shadow
 * @param {boolean} all_frames
 * @param {boolean} use_hd
 * @param {number} image_width
 * @param {number} image_height
 * @param {function(string)} on_success
 * @param {function(Error)} on_failure
 */
spv.ds.impl.IDsProtocol.prototype.sessionGetMediaKit = function(
	session_id,
	serie_index,
	frame_index,
	file_type,
	separate_background,
	separate_shadow,
	all_frames,
	use_hd,
	image_width,
	image_height,
	on_success,
	on_failure) {};


/**
 * @param {string} session_id
 * @param {string} item_id
 * @param {function(Array.<spv.ds.impl.GoalStateResolver>)} on_success
 * @param {function(Error)} on_failure
 */
spv.ds.impl.IDsProtocol.prototype.sessionGetStateResolvers = function(
		session_id,
		item_id,
		on_success,
		on_failure) {};


/**
 * @param {string} session_id
 * @param {string} language
 * @param {function(Array.<spv.ds.impl.GoalStateResolver>)} on_success
 * @param {function(Error)} on_failure
 */
spv.ds.impl.IDsProtocol.prototype.sessionGetInitialConsequenceOfChange = function(
		session_id,
		language,
		on_success,
		on_failure) {};


/**
 * @param {string} session_id
 * @param {function(spv.ds.Summary)} on_success
 * @param {function(Error)} on_failure
 */
spv.ds.impl.IDsProtocol.prototype.sessionGetSummary = function(
		session_id,
		on_success,
		on_failure) {};


/**
 * @param {string} session_id
 * @param {string} config_name
 * @param {spv.ds.ImageParams} img_params
 * @param {function(spv.ds.ImageResult)} on_success
 * @param {function(Error)} on_failure
 */
spv.ds.impl.IDsProtocol.prototype.sessionGetUserConfigImage = function(
		session_id,
		config_name,
		img_params,
		on_success,
		on_failure) {};


/**
 * @param {string} session_id
 * @param {string} filter_name
 * @param {spv.ds.PresentationStructureQuery} query
 * @param {function(spv.ds.PresentationStructure)} on_success
 * @param {function(Error)} on_failure
 */
spv.ds.impl.IDsProtocol.prototype.sessionGetPresentationStructure = function(
		session_id,
		filter_name,
		query,
		on_success,
		on_failure ) {};


/**
 * @param {string} menu_query
 * @param {spv.ds.ipprot_nova.input.BopReadMoreMode} readmore_mode
 * @param {string} language
 * @param {number} ttl Time To Live for this session in seconds
 * @param {string} origin URL of the embedding page
 * @param {string} category
 * @param {function(spv.ds.impl.SessionInitData)} on_success
 * @param {function(Error)} on_failure
 */
spv.ds.impl.IDsProtocol.prototype.sessionCreate = function(
		menu_query,
		readmore_mode,
		language,
		ttl,
		origin,
		category,
		on_success,
		on_failure) {};


/**
 * @param {string} session_id
 * @param {string} language
 * @param {function(spv.ds.impl.SessionInitData)} on_success
 * @param {function(Error)} on_failure
 */
spv.ds.impl.IDsProtocol.prototype.sessionResume = function(
		session_id,
		language,
		on_success,
		on_failure) {};


/**
 * @param {string} session_id
 * @param {spv.ds.Config} config
 * @param {string} language
 * @param {function(spv.ds.ConfigLoadResult, spv.ds.SessionStateUpdate, spv.ds.impl.AuxData)} on_success
 * @param {function(Error)} on_failure
 */
spv.ds.impl.IDsProtocol.prototype.sessionLoadConfig = function(
		session_id,
		config,
		language,
		on_success,
		on_failure) {};


/**
 * @param {string} session_id
 * @param {string} config_name
 * @param {function(spv.ds.ConfigLoadResult, spv.ds.SessionStateUpdate, spv.ds.impl.AuxData)} on_success
 * @param {function(Error)} on_failure
 */
spv.ds.impl.IDsProtocol.prototype.sessionLoadConfigByName = function(
		session_id,
		config_name,
		on_success,
		on_failure) {};


/**
 * @param {string} session_id
 * @param {string} config_name
 * @param {function(spv.ds.ConfigLoadResult, spv.ds.SessionStateUpdate, spv.ds.impl.AuxData)} on_success
 * @param {function(Error)} on_failure
 */
spv.ds.impl.IDsProtocol.prototype.sessionLoadPublicConfig = function(
		session_id,
		config_name,
		on_success,
		on_failure) {};


/**
 * @param {string} session_id
 * @param {string} user_name
 * @param {string} password
 * @param {Function} on_success
 * @param {function(Error)} on_failure
 */
spv.ds.impl.IDsProtocol.prototype.sessionLogin = function(
		session_id,
		user_name,
		password,
		on_success,
		on_failure) {};


/**
 * @param {string} session_id
 * @param {function(boolean)} on_success
 * @param {function(Error)} on_failure
 */
spv.ds.impl.IDsProtocol.prototype.sessionLogout = function(
		session_id,
		on_success,
		on_failure) {};


/**
 * @param {string} session_id
 * @param {string} user_name
 * @param {string} password
 * @param {Function} on_success
 * @param {function(Error)} on_failure
 */
spv.ds.impl.IDsProtocol.prototype.sessionCreateUser = function(
		session_id,
		user_name,
		password,
		on_success,
		on_failure) {};


/**
 * @param {string} session_id
 * @param {function(boolean)} on_success
 * @param {function(Error)} on_failure
 */
spv.ds.impl.IDsProtocol.prototype.sessionHasLoggedInUser = function(
		session_id,
		on_success,
		on_failure) {};


/**
 * @param {string} session_id
 * @param {string} main_url
 * @param {string} user_name
 * @param {string} language
 * @param {Function} on_success
 * @param {function(Error)} on_failure
 */
spv.ds.impl.IDsProtocol.prototype.sessionSendResetPasswordMail = function(
		session_id,
		main_url,
		user_name,
		language,
		on_success,
		on_failure) {};


/**
 * @param {string} token
 * @param {string} new_password
 * @param {Function} on_success
 * @param {function(Error)} on_failure
 */
spv.ds.impl.IDsProtocol.prototype.resetPassword = function(
		token,
		new_password,
		on_success,
		on_failure) {};


/**
 * @param {string} session_id
 * @param {string} config_name
 * @param {Function} on_success
 * @param {function(Error)} on_failure
 */
spv.ds.impl.IDsProtocol.prototype.sessionRemoveConfigByName = function(
		session_id,
		config_name,
		on_success,
		on_failure) {};


/**
 * @param {string} session_id
 * @param {string} config_name
 * @param {boolean} allow_overwrite
 * @param {Function} on_success
 * @param {function(Error)} on_failure
 */
spv.ds.impl.IDsProtocol.prototype.sessionSaveConfigByName = function(
		session_id,
		config_name,
		allow_overwrite,
		on_success,
		on_failure) {};


/**
 * @param {string} session_id
 * @param {string} price_localization_id
 * @param {Function} on_success
 * @param {function(Error)} on_failure
 */
spv.ds.impl.IDsProtocol.prototype.sessionSetPriceLocalization = function(
		session_id,
		price_localization_id,
		on_success,
		on_failure) {};


/**
 * @param {string} session_id
 * @param {string} item_id
 * @param {string} category
 * @param {string} language
 * @param {function(spv.ds.SessionStateUpdate, spv.ds.impl.AuxData)} on_bop
 * @param {function(Array.<spv.ds.impl.GoalStateResolver>, spv.ds.BipAttemptResultCode, string)} on_resolvers
 * @param {function(Error)} on_failure
 */
spv.ds.impl.IDsProtocol.prototype.sessionToggleItem = function(
		session_id,
		item_id,
		category,
		language,
		on_bop,
		on_resolvers,
		on_failure ) {};


/**
 * @param {string} session_id
 * @param {string} category
 * @param {Array.<string>} item_ids
 * @param {string} language
 * @param {function(spv.ds.SessionStateUpdate, spv.ds.impl.AuxData)} on_success
 * @param {function(Error)} on_failure
 */
spv.ds.impl.IDsProtocol.prototype.sessionBip = function(
		session_id,
		category,
		item_ids,
		language,
		on_success,
		on_failure) {};


/**
 * @param {string} session_id
 * @param {string} language
 * @param {function(spv.ds.SessionStateUpdate, spv.ds.impl.AuxData)} on_success
 * @param {function(Error)} on_failure
 */
spv.ds.impl.IDsProtocol.prototype.sessionUpdateBop = function(
	session_id,
	language,
	on_success,
	on_failure ) {};


/**
 * @param {string} session_id
 * @param {function(string)} on_success
 * @param {function(Error)} on_failure
 */
spv.ds.impl.IDsProtocol.prototype.sessionSendHeartBeat = function(
	session_id,
	on_success,
	on_failure) {};



/**
 * @param {string} session_id
 * @param {number} config_id
 * @param {string} description
 * @param {Object.<string,string>} user_config_aux
 * @param {Object.<string,string>} config_storage_aux
 * @param {function()} on_success
 * @param {function(Error)} on_failure
 */
spv.ds.impl.IDsProtocol.prototype.userConfigV2Save = function(
	session_id,
	config_id,
	description,
	user_config_aux,
	config_storage_aux,
	on_success,
	on_failure) { };


/**
 * @param {string} session_id
 * @param {string} config_name
 * @param {string} config_description
 * @param {Object.<string,string>} user_config_aux
 * @param {Object.<string,string>} config_storage_aux
 * @param {function(number)} on_success
 * @param {function(Error)} on_failure
 */
spv.ds.impl.IDsProtocol.prototype.userConfigV2SaveAs = function(
	session_id,
	config_name,
	config_description,
	user_config_aux,
	config_storage_aux,
	on_success,
	on_failure) { };


/**
 * @param {string} session_id
 * @param {number} config_id
 * @param {function()} on_success
 * @param {function(Error)} on_failure
 */
spv.ds.impl.IDsProtocol.prototype.userConfigV2Delete = function(
	session_id,
	config_id,
	on_success,
	on_failure) { };


/**
 * @param {string} session_id
 * @param {function(Array<spv.ds.UserConfigInfo>)} on_success
 * @param {function(Error)} on_failure
 */
spv.ds.impl.IDsProtocol.prototype.userConfigV2List = function(
	session_id,
	on_success,
	on_failure) { };


/**
 * @param {string} session_id
 * @param {number} config_id
 * @param {function()} on_success
 * @param {function(Error)} on_failure
 */
spv.ds.impl.IDsProtocol.prototype.userConfigV2Load = function(
	session_id,
	config_id,
	on_success,
	on_failure) { };


/**
 * @param {string} session_id
 * @param {string} public_config_id
 * @param {Function} on_success
 * @param {function(Error)} on_failure
 */
spv.ds.impl.IDsProtocol.prototype.publicConfigV2Load = function(
	session_id,
	public_config_id,
	on_success,
	on_failure) {};


/**
 * @param {string} session_id
 * @param {string} description
 * @param {Object.<string, string>} config_storage_aux
 * @param {function(spv.ds.PublicConfigInfo)} on_success
 * @param {function(Error)} on_failure
 */
spv.ds.impl.IDsProtocol.prototype.publicConfigV2Save = function(
	session_id,
	description,
	config_storage_aux,
	on_success,
	on_failure) {};