@omnia/foundation
Version:
Provide omnia foundation typings and tooling work on client side for omnia extension
38 lines (37 loc) • 1.88 kB
TypeScript
import { Http } from '@angular/http';
import { IRequestDictionary } from "../../../models";
import { ToasterService } from "./ToasterService";
import { LocalizationService } from "./LocalizationService";
import { DialogService } from "./DialogService";
import { TutorialInterceptor } from "./TutorialInterceptor";
export interface IAjaxRequest {
addQueryString(key?: string, value?: string): IAjaxRequest;
addQueryStrings(parameters?: IRequestDictionary): IAjaxRequest;
addHeader(key?: string, value?: string): IAjaxRequest;
addHeaders(parameters?: IRequestDictionary): IAjaxRequest;
cache(isCache?: boolean): IAjaxRequest;
doGet<T>(disableErrorHandling?: boolean): IAjaxResult;
doUpdate<T>(body?: any, disableErrorHandling?: boolean): IAjaxResult;
doPost<T>(body?: any, disableErrorHandling?: boolean): IAjaxResult;
doDelete<T>(disableErrorHandling?: boolean): IAjaxResult;
}
export interface IAjaxResult {
subscribe: (success?: (value: any) => void, error?: (error: any) => void) => void;
}
export declare class AjaxService {
protected http: Http;
protected toasterService: ToasterService;
protected localizationService: LocalizationService;
protected dialogService: DialogService;
protected tutorialInterceptor: TutorialInterceptor;
constructor(http: Http, toasterService: ToasterService, localizationService: LocalizationService, dialogService: DialogService, tutorialInterceptor: TutorialInterceptor);
buildRequest: (apiPath: string, dataType?: string) => IAjaxRequest;
protected getFullApiPath(apiPath: string): string;
private trimStart;
private trimEnd;
private showError;
private getErrorMessage(data, status, headers, config);
private formatErrorMessage;
private showTokenExpireDialog;
private hasErrorWhenCreatingSharePointContext;
}