/** * ================================================================= * Source file taken from :: ibmmfpfanalytics.d.ts * ================================================================= */ declare module ibmmfpfanalytics { /** * Initializes the ibmmfpfanalytics. * * @example * ibmmfpfanalytics.init('device-uuid-12345', 'application1', 'mfp'); * * @param {string} deviceID The deviceId. * @param {string} appName The Application name. * @param {string} contextRoot The the context root (default is mfp). * * @methodOf ibmmfpfanalytics# */ function init(deviceID: string, appName: string, contextRoot: string): void; /** * Turns on/off the capture of analytics data, according to the value off enableLogs. * * @example * ibmmfpfanalytics.enable(true) * * @methodOf ibmmfpfanalytics# */ function enable(enableLogs: boolean): void; /** * Get the current state of ibmmfpfanalytics. * * The state object is kept by ibmmfpfanalytics and contains the following key: * * enabled (boolean) - Value is true if capture is enabled, false otherwise. * * @returns {Object} the current state of ibmmfpfanalytics. * @methodOf ibmmfpfanalytics# */ function state(): Object; /** * * Send any analytics data collected up to this point to the IBM MobileFirst server. * * @returns {Promise} Resolved with success status, rejected with an error message. * @example * ibmmfpfanalytics.send() * .then(function (response) { * console.log(response); * }) *.catch(function (error) { * console.log(error); * }); * * @methodOf ibmmfpfanalytics# * @name ibmmfpfanalytics#send */ function send(): Promise
* * @example * logger.fatal('my record'); * // or * logger.fatal({data: [1,2,3]}); * // or * logger.fatal({data: [1,2,3]}, 'MyData'); * * @param {string or object} [message] The message to log. * @param {string} [name] The name of the message to log. * * @memberof ibmmfpfanalytics.logger * @method fatal */ fatal(message: string | Object, name: string): void; /** * * Set the capture property of logger. * * @example * logger.capture(true); * @param {boolean} captureFlag true, for capturing log messages, false - for not capturing log messages. * * @memberof ibmmfpfanalytics.logger * @method capture */ static capture(captureFlag: boolean): void; /** * * Set the enablement property of logger * * @example * logger.enable(true); * @param {boolean} enablementFlag true, for enabling log messages, false - for not enabling log messages. * * @memberof ibmmfpfanalytics.logger * @method enable */ static enable(enablementFlag: boolean): void; } } /** * ================================================================= * Source file taken from :: securityutils.d.ts * ================================================================= */ declare module WL.SecurityUtils { /** * Generates a key by using the PBKDF2 algorithm. * * @param {Object} options Required. * @param {string} options.password Required. Password that is used to generate the key. * @param {string} options.salt Required. Salt that is used to to generate the key. * @param {number} options.iterations Required. Number of iterations that is used for the key generation algorithm. * * @return {Promise} Resolved when the operation succeeds, first parameter is the hex encoded key. * Rejected when there is a failure. * * @methodOf WL.SecurityUtils# */ function keygen(options: Object): WLPromise; /** * Encrypts text with a key. * * @param {Object} options Required. * @param {string} options.key Required. Text to encrypt. * @param {string} options.text Required. Key that is used for encryption. * * @return {Promise} Resolved when the operation succeeds, first parameter is an object which includes the cipher text. * Rejected when there is a failure. * * @methodOf WL.SecurityUtils# */ function encrypt(options: Object): WLPromise; /** * Decryption function. * * @param {Object} options Required. * @param {string} options.key Required. Key. * @param {string} options.ct Required. Cipher Text. * @param {string} options.iv Required. Initialization Vector. * @param {string} options.src Required. Source ('obj' = iOS, 'java' = Android, 'js' = Web). * @param {number} options.v Required. Version. * * @return {Promise} Resolved when the operation succeeds, first parameter is the decrypted text. * Rejected when there is a failure. * * @methodOf WL.SecurityUtils# */ function decrypt(options: Object): WLPromise; /** * Generates a random hex string locally. * * @param {number} [bytes] Optional. Number of bytes that is used to generate the string. Default is 32 bytes. * * @return {Promise} Resolved when the operation succeeds, first parameter is the random hex string. * Rejected when there is a failure. * * @methodOf WL.SecurityUtils# */ function localRandomString(bytes?: number): WLPromise; /** * Encodes input as base64 string. * * @param {string} input Required. Input string. * * @return {Promise} Resolved when the operation succeeds, first parameter is the input string encoded. * Rejected when there is a failure. * * @methodOf WL.SecurityUtils# */ function base64Encode(input: string): WLPromise; /** * Decodes input base64 string to a non base64 encoded string. * * @param {string} input Required. Input base64 encoded string. * * @return {Promise} Resolved when the operation succeeds, first parameter is the input string decoded. * Rejected when there is a failure. * * @methodOf WL.SecurityUtils# */ function base64Decode(input: string): WLPromise; /** * ONLY FOR IOS * Choose wether internal/native or openssl basaed encryption will be applied. * * @param {boolean} enable Required. true native false openssl. * * @return {Promise} Resolved when the operation succeeds. * Rejected when there is a failure. * * @methodOf WL.SecurityUtils# */ function enableOSNativeEncryption(enable: boolean): WLPromise; } /** * ================================================================= * Source file taken from :: wlapp.d.ts * ================================================================= */ declare module WL.App { /** * @deprecated Since version 8.0 * @description Shows the default IBM MobileFirst splash screen on the activity that was passed as a parameter * @methodOf WL.App# * @name WL.App#showSplashScreen */ function showSplashScreen(): void; /** * @deprecated Since version 8.0 * @description Hides the default IBM MobileFirst splash screen if it is shown, * and does nothing if the default MobileFirst splash screen is already hidden * @methodOf WL.App# * @name WL.App#hideSplashScreen */ function hideSplashScreen(): void; /** * This method is applicable to iOS, Android and WP8. * @description * Sets the MobileFirst server URL to the specified URL. * * Changes the MobileFirst server URL to the new URL, cleans the HTTP client context, and calls successCallback when finished. * After calling this method, the application is not logged in to any server. * If the specified URL is malformed, then failCallback is called and the MobileFirst server URL remains unchanged. * * Notes: * The responsibility for checking the validity of the URL is on the developer. * When using this function you might want to perform additional clean-up, for example partial or full wipe of JSONStore or HTML5 LocalStorage. * For more information on clean-up, see {@link WL.JSONStore}. * * @example * WL.App.setServerUrl("http://9.148.23.88:10080/context", successCallback, failCallback); * * @param {string} url Mandatory. The URL of the new server, including protocol, IP, port, and context. * @param successCallback Optional. The callback function that is called after the MobileFirst URL is set to the specified URL. * @param failCallback Optional. The callback function that is called if this method fails or is not supported. * @methodOf WL.App# */ function setServerUrl(url: string, successCallback?: Function, failCallback?: Function ): void; /** * @description * Gets MobileFirst server URL. * This method is asynchronous, so the MobileFirst server URL is returned as an argument to the successCallback function. * * @param successCallback Mandatory. The callback function that is called with the MobileFirst server URL as an argument. * @param failCallback Optional. The callback function that is called if this method fails. * @methodOf WL.App# */ function getServerUrl(successCallback: Function , failCallback?: Function): void; /** * Extracts a string that contains an error message. * @description * * Extracts a string that contains the error message within the specified exception object. * Use for exceptions that are thrown by the IBM MobileFirst client runtime framework. * @param {exception} exception Mandatory. The exception object from which the error string is extracted. * @methodOf WL.App# * @name WL.App#getErrorMessage */ function getErrorMessage(exception: any): string; } declare module WL.NativePage { /** * @deprecated Since version 8.0 * Switches the currently displayed, web-based screen with a natively written page * @param className Mandatory. String. The name of the native class. For iOS, the name of the class (for example, BarCodeController). * For Android, the complete name of the class and package (for example, com.neebula.barcode.Scanner). * @param callback Mandatory. Function. A function object that is called when the native page switches back to the web view. * This function is passed a single JSON object parameter when invoked. * @param data Optional. Object. A JSON object that is sent to the native class. For iOS, The data must be single string or a flat record of strings. * * @example * // Good * WL.NativePage.show("com.scan.BarCode", function(data){alert(data);}, {key1 : 'value1'}); * WL.NativePage.show("com.scan.BarCode", function(data){alert(data);}, {key1 : 'value1', key2 : 'value2'}); * * // Bad * WL.NativePage.show("com.scan.BarCode", function(data){alert(data);}, {key1 : 'value1', innerStruct : {innerKey1 : 'innervalue1'}}); * * @methodOf WL.NativePage# * @name WL.NativePage#show */ function show(className: string, callback: Function, data?: Object): void; } /** * ================================================================= * Source file taken from :: wlauthorizationmanager.web.d.ts * ================================================================= */ declare module WL.AuthorizationManager { /** * @deprecated Use WLAuthorizationManager.obtainAccessToken() instead. * @description Obtains an access token for the specified resource scope from the MobileFirst authorization server. * @param {String} scope Optional. Scope for which to obtain the access token. * @returns A promise object that can be used to receive the access token asynchronously. * The access token is sent as an object with the following properties: * scope - the scope which the access token was obtained for. * value - the access token value. * asAuthorizationRequestHeaderField - the access token value required for an authorization header. * asFormEncodedBodyParameter - the access token value required for the HTTP-request entity body. * @example * WL.AuthorizationManager.obtainAccessToken(scope) * .then ( * function(accessToken) { * // success flow with the access token * }, * function(error) { * // failure flow * } * }; * * @methodOf WL.AuthorizationManager# */ function obtainAccessToken(scope?: string): WLPromise; /** * @deprecated Use WLAuthorizationManager.login() instead. * @description Logs into the specified security check. * @param {String} securityCheck Mandatory. Name of the security check to log into. * @param {Object} credentials Mandatory. Credentials for logging into the specified security check. * @returns A promise object that can be used to login asynchronously. * @methodOf WLAuthorizationManager# */ function login(securityCheck: string, credentials: Object): WLPromise; /** * @deprecated Use WLAuthorizationManager.logout() instead. * @description Logs out of the specified security check. * @param {String} securityCheck Mandatory. Name of the security check to log out of. * @returns A promise object that can be used to logout asynchronously. * @methodOf WLAuthorizationManager# */ function logout(securityCheck: string): WLPromise; /** * @deprecated Use WLAuthorizationManager.isAuthorizationRequired() instead. * @description Checks whether the provided response status and headers represent a protected resource that requires authorization. * @param {Integer} responseStatus Mandatory. Specifies the response status code. * @param {String} responseHeaders Mandatory. A String representation of the response headers separated by CRLF, as returned from XMLHttpRequest.getAllResponseHeaders(). * @returns A boolean value, indicating whether authorization is required (true), or not (false).
* @methodOf WLAuthorizationManager#
*/
function isAuthorizationRequired(responseStatus: number, responseHeaders: Object): boolean;
/**
* @deprecated Use WLAuthorizationManager.clearAccessToken() instead.
* @description Checks whether the provided response status and headers represent a protected resource that requires authorization.
* @param {Integer} responseStatus Mandatory. Specifies the response status code.
* @param {String} responseHeaders Mandatory. A String representation of the response headers separated by CRLF, as returned from XMLHttpRequest.getAllResponseHeaders().
* @returns A boolean value, indicating whether authorization is required (true), or not (false).
* @methodOf WLAuthorizationManager#
*/
function clearAccessToken(accessToken: Object): WLPromise;
/**
* @deprecated Use WLAuthorizationManager.getResourceScope() instead.
* @description Returns the scope of the protected resource for the provided response headers.
* When you create a SecurityCheckChallengeHandler, you must implement the following methods:
*
* - handleChallenge() - The MobileFirst framework calls this method only for the relevant challenge. This function is used to perform required actions,
* such as hiding the application screen, displaying the login screen, or other actions required to pass the challenge successfully.
* - handleSuccess() - This method is called when the MobileFirst Server reports an authentication success.
* - handleFailure() - This method is called when the MobileFirst Server reports an authentication failure.
*
*
* The following APIs are available on the generated GatewayCheckChallengeHandler:
*
* - cancel() - Notifies the MobileFirst framework that the authentication process needs to be canceled.
* The MobileFirst framework then disposes of the original request that triggered the authentication.
* - submitChallengeAnswer(answer) - Call this method to send an answer back to the security check that triggered this challenge. The answer should be in a JSON format.
*
* @param securityCheckName security check name that represents the challenge,
* Used to identify which security check requires authentication.
*
* @methodOf WL.Client#
*
*/
function createSecurityCheckChallengeHandler(securityCheckName: string): WL.Client.SecurityCheckChallengeHandler;
class AbstractChallengeHandler {
isWLHandler: boolean;
activeRequest: Object;
requestWaitingList: Object[];
/**
* This function is called whenever the response is considered relevant to this challenge. This function is used to perform required actions,
* such as hiding the application screen, displaying the login screen, or other actions required to pass the challenge successfully.
* @param challenge Challenge to handle
* @methodOf WL.Client.AbstractChallengeHandler#
* @name WL.Client.AbstractChallengeHandler#handleChallenge
*/
handleChallenge(challenge: Object): void;
/**
* Notifies the MobileFirst framework that the authentication process needs to be canceled.
* The MobileFirst framework then disposes of the original request that triggered the authentication
* @param err Error message if available
* @methodOf WL.Client.AbstractChallengeHandler#
* @name WL.Client.AbstractChallengeHandler#cancel
*/
cancel(): void;
}
class SecurityCheckChallengeHandler extends AbstractChallengeHandler{
MAX_NUMBER_OF_FAILURES: number;
numOfFailures: number;
/**
* This method is called when the MobileFirst Server reports an authentication success.
**/
handleSuccess(identity?: any): void;
/**
* This method is called when the MobileFirst Server reports an authentication failure.
**/
handleFailure(err?: any): void;
/**
* Call this method to send an answer back to the security check that triggered this challenge. The answer should be in a JSON format.
**/
submitChallengeAnswer(answer: Object): void;
}
class GatewayChallengeHandler extends AbstractChallengeHandler{
/**
* User calls this function when the the challenge was handled successfully.
* When a success is submitted, the state of successes is checked for all challenges issued per original request.
* What this means is that, if all challenges are successfully met, the original message would be resent automatically.
*/
submitSuccess(): void;
/**
* Must be implemented by developer.
*
* This method will be invoked by the IBM MobileFirst Platform for every server response.
* It is responsible to detect whether server response contains data
* that should be processed by this challenge handler.
* @param transport Response that arrived from the server
* @return true if the response is a challenge that this handler handles
*/
canHandleResponse(transport: any): boolean;
/**
* Used to send collected credentials to a specific URL. The developer can also specify request parameters, headers, and callback.
* @param reqURL URL to send data to
* @param options Other options like timeout, extra headers
* @param submitLoginFormCallback Callback method when operation is done
*/
submitLoginForm(reqURL: string, options: Object, submitLoginFormCallback: Function): void;
}
/**
* Gets the display name of the device. The display name is retrieved from the MobileFirst Server registration data.
* Note: Remote disable and active notifying customizations, if any, will be ignored when this API call is made. The default UI will be displayed instead. This limitation is applicable to iOS & Windows only.
*
* @param {Object} options An object that contains onSucess and onFailure completion callback functions.
* The onSuccess function receives a JSON object parameter that contains the server's response, which includes the
* display name of the the device or null if no display name was set. For example:
*
onSucess and onFailure completion callback functions.
*
* @methodOf WL.Client#
*/
function setDeviceDisplayName(deviceDisplayName: string, options: Object): void;
}
/**
* =================================================================
* Source file taken from :: wlgap.d.ts
* =================================================================
*/
declare module WL.App {
/**
* supported only on Android environment
* returns the screen height
* @returns {number} screen height
*/
function getScreenHeight(): number;
/**
* supported only on Android environment
* returns the screen width
* @returns {number} screen width
*/
function getScreenWidth(): number;
/**
* supported only on Android environment
* retrieving screen size
* @param {Function} callback Mandatory function. The callback function that is invoked when the size is received.
*/
function getScreenSize(callback: Function): void;
/**
* supported only on Android, Windows Phone and iOS environments
* reset server context
*/
function resetServerContext(): void;
/**
* supported only on Android, Windows Phone and iOS environments
* returns user preference value for the given key
* @param {string} key
* @param {Object} options
* @param {Function} options.onSuccess
* @param {Function} options.onFailure
*/
function readUserPref(key: string, options: Object): void;
/**
* supported only on Android, Windows Phone and iOS environments
* writes user preference with the give key,value pair
* @param {string} key
* @param {Object} value
*/
function writeUserPref(key: string, value: Object): void;
/**
* supported only on Android, Windows Phone and iOS environments
* get init parameters
* @param {string} parameters
* @param {Function} successCallback Mandatory function.
* @param {Function} failCallback Mandatory function.
*/
function getInitParameters(parameters: string, successCallback: Function, failCallback: Function): void;
/**
* supported only on Android, Windows Phone and iOS environments
* Send an action to the native code. The action will be processed immediately, if the target receiver has been registered.
* Otherwise, the action will be stored in the cache and processed as soon as the target receiver becomes available (registered).
* @param {string} action - a string that identifies target receivers; all receivers registered with the specified action will receive the message.
* @param {Object} data - an optional data object to be passed to target receivers along with action;
* @param {string} tag
*/
function sendActionToNative(action: string, data?: Object, tag?: string): void;
/**
* supported only on Android, Windows Phone and iOS environments
* Registers an action receiver. In JavaScript a receiver should be implemented as a callback that can receive an object.
* @param {string} id - a string that identifies the receiver. This string will be specified in the native code when sending notifications to JavaScript.
* @param {Function} callback - implementation of receiver. This callback will be called when an action identified by "id" is sent from the native code.
* @param {string} tag
*/
function addActionReceiver(id: string, callback: Function, tag?: string): void;
/**
* supported only on Android, Windows Phone and iOS environments
* Removes (unregisters) an action receiver. All further messages addressed to this receiver will be placed to the cache. The pending
* messages will be delivered as soon as the receiver is registered again with the same id.
* @param id - a string that identifies the receiver to be unregistered.
*/
function removeActionReceiver(id: string): void;
}
declare module WL.Badge {
/**
* Sets the application badge to the number provided.
* @description Sets the application badge to the number provided.
* @note {Note} This object is only applicable to iOS and Windows Phone 8 applications.
*
*
* @param number Mandatory. Integer. An integer that is displayed as a badge over the application icon.
* For iOS, a value lesser than or equal to 0 removes the application badge. Values that are too long (5 digits, or more) to be entirely displayed in an iPhone device are truncated with ellipsis.
* For Windows Phone 8, a value lesser than or equal to 0 removes the application badge. A number greater than 99 sets the tile count to 99.
*
* @methodOf WL.Badge#
*/
function setNumber(num: number): void;
}
/**
* =================================================================
* Source file taken from :: wlproperties.d.ts
* =================================================================
*/
declare module WL{
var AppProperty : {
DOWNLOAD_APP_LINK: string,
ENVIRONMENT: string,
APP_DISPLAY_NAME: string,
APP_LOGIN_TYPE: string,
APP_VERSION: string,
HEIGHT: string,
IID: string,
LATEST_VERSION: string,
LOGIN_DISPLAY_TYPE: string,
LOGIN_REALM: string,
MAIN_FILE_PATH: string,
SHOW_IN_TASKBAR: string,
THUMBNAIL_IMAGE_URL: string,
WELCOME_PAGE_URL: string,
WIDTH: string,
WORKLIGHT_ROOT_URL: string,
WORKLIGHT_RELATIVE_URL: string,
APP_SERVICES_URL: string,
APP_SERVICES_RELATIVE_URL: string,
WLCLIENT_TIMEOUT_IN_MILLIS: string
};
var AppLoginType : {
LOGIN_ON_STARTUP: string,
LOGIN_ON_DEMAND: string,
NO_LOGIN: string
};
var UserInfo : {
IS_USER_AUTHENTICATED: string,
USER_NAME: string,
LOGIN_NAME: string,
USER_ID: string
};
var Orientation : {
AUTO: number,
LANDSCAPE: number,
PORTRAIT: number
};
var FixedViewType : {
TOP: string,
BOTTOM: string
};
var Language : {
DIRECTION_LTR: number,
DIRECTION_RTL: number,
LANGUAGES_RTL: string[]
};
var WLErrorCode : {
UNEXPECTED_ERROR: string,
API_INVOCATION_FAILURE: string,
USER_INSTANCE_ACCESS_VIOLATION: string,
AUTHENTICATION_REQUIRED: string,
DOMAIN_ACCESS_FORBIDDEN: string,
// Client Side Errors
UNRESPONSIVE_HOST: string,
LOGIN_FAILURE: string,
REQUEST_TIMEOUT: string,
PROCEDURE_ERROR: string,
UNSUPPORTED_VERSION: string,
UNSUPPORTED_BROWSER: string,
DISABLED_COOKIES: string,
CONNECTION_IN_PROGRESS: string,
AUTHORIZATION_FAILURE: string,
CHALLENGE_HANDLING_CANCELED: string
};
var FBRealmPopupOptions : {
width: number,
height: number
};
var EPField : {
// NOTICE - value must be equal to the field name!!!
SUPPORT_COOKIES: string,
DESKTOP: string,
WEB: string,
MOBILE: string,
USES_AUTHENTICATOR: string,
SAVES_USERNAME: string,
HAS_NATIVE_LOGGER: string,
USES_NATIVE_TOOLBAR: string,
USES_CORDOVA: string,
SUPPORT_DIRECT_UPDATE_FROM_SERVER: string,
SUPPORT_DIAGNOSTIC: string,
ISIOS: string,
WEB_BROWSER_ONLY: string,
SUPPORT_CHALLENGE: string,
SUPPORT_SHELL: string,
SUPPORT_DEVICE_AUTH: string,
SERVER_ADDRESS_CONFIGURABLE: string,
SUPPORT_WL_USER_PREF: string,
SUPPORT_WL_NATIVE_XHR: string,
SUPPORT_WL_SERVER_CHANGE: string,
SUPPORT_OAUTH: string
};
var BaseProfileData : {
SUPPORT_COOKIES: boolean,
SUPPORT_DIRECT_UPDATE_FROM_SERVER: boolean,
SUPPORT_DIAGNOSTIC: boolean,
SUPPORT_DEVICE_AUTH: boolean,
SERVER_ADDRESS_CONFIGURABLE: boolean,
SUPPORT_WL_USER_PREF: boolean
};
var WebProfileData : {
WEB: boolean
};
var DesktopProfileData : {
DESKTOP: boolean,
USES_AUTHENTICATOR: boolean,
SAVES_USERNAME: boolean
};
var MobileProfileData : {
USES_AUTHENTICATOR: boolean,
SAVES_USERNAME: boolean
};
}
/**
* =================================================================
* Source file taken from :: wlresourcerequest.web.d.ts
* =================================================================
*/
declare module WL{
class ResourceRequest {
/**
* @deprecated Use WLResourceRequest instead.
* @class
* The WL.ResourceRequest object is used to send a request to any protected or unprotected resource using an absolute or relative URL.
* It exposes a set of methods that allow you to set up and configure the requested object.
*
* If a request is sent to a protected resource, the WLResourceRequest object automatically handles the MobileFirst OAuth-based security model
* protocol and invokes the required challenges.
* The WL.AuthorizationManager and WL.ResourceRequest classes are supported for the following hybrid environments only:
* Android, iOS, Windows Phone 8 and Window 8.
*
* @param {string} url Mandatory. Specifies absolute or relative URL. If you send a request to an adapter, you must add the /adapters path element.
* For example: /adapters/myAdapterName/myMethodName
* @param {string} method Mandatory. Request method, usually WLResourceRequest.GET or WLResourceRequest.POST
* @param {object} options Optional. An object containing the following properties:
*
* options.timeout: (integer) Optional. Request timeout, in milliseconds.
* options.scope: (string) Optional. Protecting scope of the requested resource.
*
* @example
* var request = new WL.ResourceRequest('/adapters/sampleAdapter/multiplyNumbers', WLResourceRequest.GET);
* request.setQueryParameter('params', [5, 6]);
* request.send().then(
* function(response) {
* // success flow, the result can be found in response.responseJSON
* },
* function(error) {
* // failure flow
* // the error code and description can be found in error.errorCode and error.errorMsg fields respectively
* }
* );
*
* @name WL.ResourceRequest
*/
constructor(_url: string, _method: string, _options?: Object);
/**
* @deprecated Use WLResourceRequest.getUrl() instead.
* @description Returns request URL. The URL must have been passed to the constructor.
* @methodOf WL.ResourceRequest#
*/
getUrl(): string;
/**
* @deprecated Use WLResourceRequest.getMethod() instead.
* @description Returns current request method. A valid request method must have been passed to constructor.
* @methodOf WL.ResourceRequest#
*/
getMethod(): string;
/**
* @deprecated Use WLResourceRequest.getQueryParameters() instead.
* @description Returns query parameters as a JSON object with key-value pairs.
* @methodOf WL.ResourceRequest#
*/
getQueryParameters(): Object;
/**
* @deprecated Use WLResourceRequest.setQueryParameters() instead.
* @description Sets query parameters.
* @param {object} parameters Optional. A JSON object with key-value pairs.
* If this parameter is null, or undefined, the query parameters are cleared.
* @methodOf WL.ResourceRequest#
*/
setQueryParameters(parameters?: Object): void;
/**
* @deprecated Use WLResourceRequest.setQueryParameter() instead.
* @description Sets a new query parameter. If a parameter with the same name already exists, it will be replaced.
* @param {String} name Mandatory. Parameter name.
* @param value Mandatory. Parameter value. Should be string, number or boolean.
* @methodOf WL.ResourceRequest#
*/
setQueryParameter(name: string, value: string|number|boolean): void;
/**
* @deprecated Use WLResourceRequest.getHeaders() instead.
* @description Returns array of header values.
* @param {string} name Optional. Header name. If header name is specified, this function returns an array of header values
* stored with this header, or undefined, if the specified header name is not found. If name is null, or undefined,
* this function returns all headers.
* @methodOf WL.ResourceRequest#
*/
getHeaders(name?: string): Object[];
/**
* @deprecated Use WLResourceRequest.getHeaderNames() instead.
* @description Returns array of header names. It can be empty, if no headers have been added.
* @methodOf WL.ResourceRequest#
*/
getHeaderNames(): string[];
/**
* @deprecated Use WLResourceRequest.getHeader() instead.
* @description Returns a first header value stored with the specified header name. The value is returned as a string.
* Can be undefined if a header with the specified name does not exist.
* @param {String} name Mandatory. Header name.
* @methodOf WL.ResourceRequest#
*/
getHeader(name: string): string;
/**
* @deprecated Use WLResourceRequest.setHeaders() instead.
* @description Sets request headers. The existing headers are replaced.
* @param {Object} requestHeaders Optional. JSON object with request headers. Each header value should be either string, or array of strings. This function
* throws an error if one of the specified header values is not valid. If this parameter is not specified, all headers will be removed.
* @methodOf WL.ResourceRequest#
*/
setHeaders(requestHeaders?: Object): void;
/**
* @deprecated Use WLResourceRequest.setHeader() instead.
* @description Sets a new header or replaces an existing header with the same name.
* @param {String} name Mandatory. Header name.
* @param value Mandatory. Header value. The value must be of a simple type (string, boolean or value).
* @methodOf WL.ResourceRequest#
*/
setHeader(name: string, value: string|number|boolean): void;
/**
* @deprecated Use WLResourceRequest.addHeader() instead.
* @description Adds a new header. If a header with the same name already exists, the header value will be added to the existing header. The name is
* case insensitive.
* @param {String} name Mandatory. Header name.
* @param value Mandatory. Header value. The value must be of a simple type (string, number or boolean).
* @methodOf WL.ResourceRequest#
*/
addHeader(name: string, value: string|number|boolean): void;
/**
* @deprecated Use WLResourceRequest.getTimeout() instead.
* @description Returns request timeout, in milliseconds.
* @methodOf WL.ResourceRequest#
*/
getTimeout(): number;
/**
* @deprecated Use WLResourceRequest.setTimeout() instead.
* @description Sets request timeout. If timeout is not specified, then a default timeout will be used.
* @param {Integer} requestTimeout Mandatory. Request timeout, in milliseconds.
* @methodOf WL.ResourceRequest#
*/
setTimeout(requestTimeout: number): void;
/**
* @deprecated Use WLResourceRequest.send() instead.
* @description Sends the request to a server.
* @param content Optional. Body content. It can be of a simple type (like string), object, or undefined.
* @returns Promise
* @example
* var request = WL.ResourceRequest(url, method, options);
* request.send(content).then(
* function(response) {
* // success flow
* },
* function(error) {
* // fail flow
* }
* );
*
* @methodOf WL.ResourceRequest#
*/
send(content?: any): WLPromise;
/**
* @deprecated Use WLResourceRequest.sendFormParameters() instead.
* @description Sends the request to a server with URL encoded form parameters.
* @param {Object} json Mandatory. Body content as JSON object or string as form data. The JSON object values must be a simple type.
* The content type will be set to application/x-www-form-urlencoded.
* @returns Promise
* @example
* var request = WL.ResourceRequest(url, method, options);
* request.send(json).then(
* function(response) {
* // success flow
* },
* function(error) {
* // fail flow
* }
* );
*
* @methodOf WL.ResourceRequest#
*/
sendFormParameters(json: Object): WLPromise;
static GET: string;
static POST: string;
static PUT: string;
static DELETE: string;
static HEAD: string;
static OPTIONS: string;
static TRACE: string;
static CONNECT: string;
}
}
/**
* =================================================================
* Source file taken from :: worklight.d.ts
* =================================================================
*/
declare module WL.Events {
var WORKLIGHT_IS_CONNECTED: string;
var WORKLIGHT_IS_DISCONNECTED: string;
}
declare module WL.Environment {
var PREVIEW: string;
var IPHONE: string;
var IPAD: string;
var DESKTOPBROWSER: string;
var ANDROID: string;
var WINDOWS_PHONE_8: string;
var WINDOWS8: string;
var MOBILE_WEB: string;
}
declare class WLPromise{
state():string;
always():Object;
then(onSuccess?:Function, onFailure?:Function, onProgress?:Function):WLPromise;
promise(obj?:Object):Object;
fail(failCallbacks:Function|Function[], additionalFailCallbacks?:Function|Function[]):WLPromise;
done(doneCallbacks:Function|Function[], additionalDoneCallbacks?:Function|Function[]):WLPromise;
progress(progressCallbacks:Function|Function[], additionalProgressCallbacks?:Function|Function[]):WLPromise;
}