import { HttpClient } from '@angular/common/http'; import { Observable } from 'rxjs'; import { BaseResponse } from '../interfaces/base-response.interface'; import { ListObject } from '../../models/list-object.model'; import { EnvironmentService } from '../../services/environment.service'; import { ErrorService } from './error.service'; import { BlobService } from './blob.service'; import { NotificationService } from '../../notification'; import { HeaderService } from './header.service'; export declare class ApiService { private readonly http; private readonly blobService; private readonly errorService; private readonly notificationService; private readonly headerService; /** * Stored apiUrl, that comes from the parent module. */ readonly apiUrl: string; constructor(environmentService: EnvironmentService, http: HttpClient, blobService: BlobService, errorService: ErrorService, notificationService: NotificationService, headerService: HeaderService); /** * Common Success Title of the notifications. * * @private * @memberof ApiService */ private readonly commonSuccessTitle; /** * GET request, that expects blob response. It will download it, if the response has 'content-disposition' header. * Otherwise it will throw an error notification. * @param path The relative path to the backend endpoint. For example * @param params The query params, that goes with the request. * @example getBlob('/api/some/route', { id: 5 }); */ getBlob(path: string, params?: object): Observable; /** * POST request, that expects blob response. It will download it, if the response has 'content-disposition' header. * Otherwise it will throw an error notification. * @param path The relative path to the backend endpoint. For example * @param params The query params, that goes with the request. * @example getBlob('/api/some/route', { id: 5 }); */ postForBlob(path: string, params?: object): Observable; /** * raw GET request, that expects T response. * @param path The relative path to the backend endpoint. * @param params The query params, that goes with the request. * @example get('/api/some/route', { id: 5 }); */ getRaw(path: string, params?: object): Observable; /** * GET request, that expects ListObject response. It is the response, that came from the backend response transformer. * This response can be used by the core's ListComponent. This function handles the BaseResponse's notifications and meta properties. * @param path The relative path to the backend endpoint. * @param params The query params, that goes with the request. * @example getList('/api/some/route', { search: 'some string' }); */ getList(path: string, params?: object): Observable>; /** * GET request, that expects T response. It is the response, that came from the backend response transformer. This function handles * the BaseResponse's notifications and meta properties. * @param path The relative path to the backend endpoint. * @param params The query params, that goes with the request. * @example getOne('/api/some/route', { someValue: 'some string' }); */ getOne(path: string, params?: object): Observable; /** * PUT request, the most common update method. This can be used as the update method of the core's EditComponent. * This function handles the BaseResponse's notifications and meta properties. * @param path The relative path to the backend endpoint. * @param body The object, that is the information for the backend. * @example put('/api/some/route', { newName: 'some string' }, true); */ put(path: string, body?: Object, showSuccess?: boolean): Observable; /** * POST request, the most common create method. This can be used as the create method of the core's CreateComponent. * This function handles the BaseResponse's notifications and meta properties. * @param path The relative path to the backend endpoint. * @param body The object, that is the information for the backend. * @example post('/api/some/route', { newName: 'some string' }); */ post(path: string, body?: Object, showSuccess?: boolean): Observable; /** * DELETE request, the most common destroy method. This function handles the BaseResponse's notifications and meta properties. * @param path The relative path to the backend endpoint. * @param body The object, that is the information for the backend. * @example delete('/api/some/route', { idToDelete: 2 }); */ delete(path: string, body?: Object, showSuccess?: boolean): Observable; /** * This function can be used by 3rd party plugins, to handle the core's response transformer. This function handles the notifications, * metas, etc... * @param response BaseResponse that came from the backend response transformer. Notifications, metas, etc... */ handleResponse(response: BaseResponse, text?: string): void; /** * [DEPRECATED] PUT request, the most common update method. This can be used as the update method of the core's EditComponent. * This function handles the BaseResponse's notifications and meta properties. * @param path The relative path to the backend endpoint. * @param form The FormData, that is the information for the backend. * @example put('/api/some/route', { newName: 'some string' }, true); */ putForm(path: string, form: FormData): Observable; /** * [DEPRECATED] POST request, the most common create method. This can be used as the create method of the core's CreateComponent. * This function handles the BaseResponse's notifications and meta properties. * @param path The relative path to the backend endpoint. * @param form The FormData, that is the information for the backend. * @example post('/api/some/route', { newName: 'some string' }, true); */ postForm(path: string, form: FormData): Observable; }