@eclipse-scout/core
Version:
Eclipse Scout runtime
121 lines • 7.66 kB
TypeScript
/// <reference types="jquery" />
import { AjaxCall, AjaxCallModel, AjaxError } from '../index';
/**
* Utility to perform Ajax requests in an easy way.
* It basically uses the class {@link AjaxCall} and provides some common functions to call a REST backend.
*/
export declare const ajax: {
/**
* Performs an HTTP GET request.
* @param options additional settings for the request.
* Since jQuery is used to perform the request, all the jQuery Ajax settings are accepted.
* @param model additional properties for the {@link AjaxCall}.
* @returns a promise which is resolved when the request succeeds.
* In case of an error the promise is rejected with an {@link AjaxError} as argument.
*/
get(url: string, options?: JQuery.AjaxSettings, model?: AjaxCallModel): JQuery.Promise<any, AjaxError>;
/**
* Performs an HTTP POST request.
* @param data the data to be sent.
* @param options additional settings for the request.
* Since jQuery is used to perform the request, all the jQuery Ajax settings are accepted.
* @param model additional properties for the {@link AjaxCall}.
* @returns a promise which is resolved when the request succeeds.
* In case of an error the promise is rejected with an {@link AjaxError} as argument.
*/
post(url: string, data?: any, options?: JQuery.AjaxSettings, model?: AjaxCallModel): JQuery.Promise<any, AjaxError>;
/**
* Performs an HTTP PUT request.
* @param data the data to be sent.
* @param options additional settings for the request.
* Since jQuery is used to perform the request, all the jQuery Ajax settings are accepted.
* @param model additional properties for the {@link AjaxCall}.
* @returns a promise which is resolved when the request succeeds.
* In case of an error the promise is rejected with an {@link AjaxError} as argument.
*/
put(url: string, data?: any, options?: JQuery.AjaxSettings, model?: AjaxCallModel): JQuery.Promise<any, AjaxError>;
/**
* Performs an HTTP DELETE request.
* @param options additional settings for the request.
* Since jQuery is used to perform the request, all the jQuery Ajax settings are accepted.
* @param model additional properties for the {@link AjaxCall}.
* @returns a promise which is resolved when the request succeeds.
* In case of an error the promise is rejected with an {@link AjaxError} as argument.
*/
remove(url: string, options?: JQuery.AjaxSettings, model?: AjaxCallModel): JQuery.Promise<any, AjaxError>;
/**
* Performs an HTTP GET request using JSON as format for the request and the response.
* @param options additional settings for the request.
* Since jQuery is used to perform the request, all the jQuery Ajax settings are accepted.
* @param model additional properties for the {@link AjaxCall}.
* @returns a promise which is resolved when the request succeeds.
* In case of an error the promise is rejected with an {@link AjaxError} as argument.
*/
getJson(url: string, options?: JQuery.AjaxSettings, model?: AjaxCallModel): JQuery.Promise<any, AjaxError>;
/**
* Performs an HTTP POST request using JSON as format for the request and the response.
* @param data the data to be sent. If the data is not a string it will be converted to a string using JSON.stringify().
* @param options additional settings for the request.
* Since jQuery is used to perform the request, all the jQuery Ajax settings are accepted.
* @param model additional properties for the {@link AjaxCall}.
* @returns a promise which is resolved when the request succeeds.
* In case of an error the promise is rejected with an {@link AjaxError} as argument.
*/
postJson(url: string, data?: any, options?: JQuery.AjaxSettings, model?: AjaxCallModel): JQuery.Promise<any, AjaxError>;
/**
* Performs an HTTP PUT request using JSON as format for the request and the response.
* @param data the data to be sent. If the data is not a string it will be converted to a string using JSON.stringify().
* @param options additional settings for the request.
* Since jQuery is used to perform the request, all the jQuery Ajax settings are accepted.
* @param model additional properties for the {@link AjaxCall}.
* @returns a promise which is resolved when the request succeeds.
* In case of an error the promise is rejected with an {@link AjaxError} as argument.
*/
putJson(url: string, data?: any, options?: JQuery.AjaxSettings, model?: AjaxCallModel): JQuery.Promise<any, AjaxError>;
/**
* Performs an HTTP DELETE request using JSON as format for the request and the response.
* @param options additional settings for the request.
* Since jQuery is used to perform the request, all the jQuery Ajax settings are accepted.
* @param model additional properties for the {@link AjaxCall}.
* @returns a promise which is resolved when the request succeeds.
* In case of an error the promise is rejected with an {@link AjaxError} as argument.
*/
removeJson(url: string, options?: JQuery.AjaxSettings, model?: AjaxCallModel): JQuery.Promise<any, AjaxError>;
/**
* Performs an Ajax request using JSON as format for the request and the response.
* The default HTTP method is POST.
* @param options additional settings for the request.
* Since jQuery is used to perform the request, all the jQuery Ajax settings are accepted.
* @param model additional properties for the {@link AjaxCall}.
* @returns a promise which is resolved when the request succeeds.
* In case of an error the promise is rejected with an {@link AjaxError} as argument.
*/
callJson(options?: JQuery.UrlAjaxSettings, model?: AjaxCallModel): JQuery.Promise<any, AjaxError>;
/**
* Performs an Ajax request.
* @param options additional settings for the request.
* Since jQuery is used to perform the request, all the jQuery Ajax settings are accepted.
* @param model additional properties for the {@link AjaxCall}.
* @returns a promise which is resolved when the request succeeds.
* In case of an error the promise is rejected with an {@link AjaxError} as argument.
*/
call(options: JQuery.UrlAjaxSettings, model?: AjaxCallModel): JQuery.Promise<any, AjaxError>;
/**
* Prepares an Ajax call with JSON as format for the request and the response,
* but does not execute it yet. The default HTTP method is POST.
* @param options additional settings for the request.
* Since jQuery is used to perform the request, all the jQuery Ajax settings are accepted.
* @param model additional properties for the {@link AjaxCall}.
* @returns the prepared Ajax call object. Execute it with the call() function.
*/
createCallJson(options?: JQuery.UrlAjaxSettings, model?: AjaxCallModel): AjaxCall;
/**
* Prepares an Ajax call, but does not execute it yet.
* @param options additional settings for the request.
* Since jQuery is used to perform the request, all the jQuery Ajax settings are accepted.
* @param model additional properties for the {@link AjaxCall}.
* @returns the prepared Ajax call object. Execute it with the call() function.
*/
createCall(options: JQuery.UrlAjaxSettings, model?: AjaxCallModel): AjaxCall;
};
//# sourceMappingURL=ajax.d.ts.map