@knora/core
Version:
Knora ui module: core
92 lines (91 loc) • 2.84 kB
TypeScript
import { HttpClient, HttpErrorResponse, HttpHeaders, HttpParams } from '@angular/common/http';
import { KnoraApiConfig } from '@knora/api';
import { Observable } from 'rxjs/internal/Observable';
import { ApiServiceError } from '../declarations/api-service-error';
import { ApiServiceResult } from '../declarations/api-service-result';
export declare abstract class ApiService {
http: HttpClient;
private knoraApiConfig;
loading: boolean;
knoraApiUrl: string;
protected constructor(http: HttpClient, knoraApiConfig: KnoraApiConfig);
/**
* @deprecated since v9.5.0
*
* GET
*
* @param {string} path the URL for the GET request.
* @param {HttpParams} params the parameters for the GET request.
* @returns Observable of any
*/
httpGet(path: string, params?: HttpParams): Observable<any>;
/**
* @deprecated since v9.5.0
*
* Processes JSON-LD returned by Knora.
* Expands Iris and creates an empty context object.
*
* @param {ApiServiceResult} resourceResponse
*/
protected processJSONLD(resourceResponse: ApiServiceResult): Observable<any>;
/**
* @deprecated since v9.5.0
*
* POST
*
* @param {string} path
* @param {any} body
* @returns Observable of any
*/
httpPost(path: string, body?: any): Observable<any>;
/**
* @deprecated since v9.5.0
*
* PUT
*
* @param {string} path
* @param {any} body
* @returns Observable of any
*/
httpPut(path: string, body?: any): Observable<any>;
/**
* @deprecated since v9.5.0
*
* DELETE
*
* @param {string} path
* @returns Observable of any
*/
httpDelete(path: string): Observable<any>;
/**
* handle request error in case of server error
*
* @param {HttpErrorResponse} error
* @returns Observable of ApiServiceError
*/
protected handleRequestError(error: HttpErrorResponse): Observable<ApiServiceError>;
/**
* handle json error in case of type error in json response (json2typescript)
*
* @param {any} error
* @returns Observable of ApiServiceError
*/
protected handleJsonError(error: any): Observable<ApiServiceError>;
/**
* @deprecated since v9.5.0
*
* @param {string} server
*/
protected compareVersion(server: string): void;
/**
* Set headers to authorise http requests
*
* This method was replaced by interceptor. But since the implementation
* of new knora-api-js-lib services the interceptor is redundant.
* As long we not all services are replaced by knora-api-js-lib
* we have to use this setHeaders "hack" for the two services left.
*
* @returns HttpHeaders
*/
protected setHeaders(): HttpHeaders;
}