Files
xSaherElmApiSDKHolder/projects/x-saherelm-api-sdk/src/lib/base/i-x-entity-actions.interface.ts
T
2026-04-17 16:22:31 +03:30

473 lines
13 KiB
TypeScript

import { Observable } from 'rxjs';
import { XBaseRangeRequestDto } from 'x-framework-core';
import { HttpEvent, HttpResponse } from '@angular/common/http';
import { XQueryDto, XQueryResultDto } from 'x-framework-identity-sdk';
export interface IXEntityActions<TModel, TKey> {
//
//#region Repository Implementation ...
//
//#region Retrieve ...
//
//#region Get ...
/**
* Retrieve Specified Item based on Id
*
* @param id the Object ID ...
* @param containsDetail specify retrieve full details
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
callGet(
id: TKey,
containsDetail?: boolean,
observe?: 'body',
reportProgress?: boolean
): Observable<TModel>;
callGet(
id: TKey,
containsDetail?: boolean,
observe?: 'response',
reportProgress?: boolean
): Observable<HttpResponse<TModel>>;
callGet(
id: TKey,
containsDetail?: boolean,
observe?: 'events',
reportProgress?: boolean
): Observable<HttpEvent<TModel>>;
callGet(
id: TKey,
containsDetail?: boolean,
observe?: any,
reportProgress?: boolean
): Observable<any>;
//#endregion
//
//#region GetAll ...
/**
* Retrieve all Items
*
* @param containsDetail specify retrieve full details
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
callGetAll(
containsDetail?: boolean,
observe?: 'body',
reportProgress?: boolean
): Observable<Array<TModel>>;
callGetAll(
containsDetail?: boolean,
observe?: 'response',
reportProgress?: boolean
): Observable<HttpResponse<Array<TModel>>>;
callGetAll(
containsDetail?: boolean,
observe?: 'events',
reportProgress?: boolean
): Observable<HttpEvent<Array<TModel>>>;
callGetAll(
containsDetail?: boolean,
observe?: any,
reportProgress?: boolean
): Observable<any>;
//#endregion
//
//#region FindOne ...
/**
* Fine first Item which matched to the query string
*
* @param query search pattern
* @param containsDetail specify retrieve full details
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
callFindOne(
query: string,
containsDetail?: boolean,
observe?: 'body',
reportProgress?: boolean
): Observable<TModel>;
callFindOne(
query: string,
containsDetail?: boolean,
observe?: 'response',
reportProgress?: boolean
): Observable<HttpResponse<TModel>>;
callFindOne(
query: string,
containsDetail?: boolean,
observe?: 'events',
reportProgress?: boolean
): Observable<HttpEvent<TModel>>;
callFindOne(
query: string,
containsDetail?: boolean,
observe?: any,
reportProgress?: boolean
): Observable<any>;
//#endregion
//
//#region FindMany ...
/**
* Find a Collection of items which matched to Specified Query string
*
* @param query search pattern
* @param containsDetail specify retrieve full details
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
callFindMany(
query: string,
containsDetail?: boolean,
observe?: 'body',
reportProgress?: boolean
): Observable<Array<TModel>>;
callFindMany(
query: string,
containsDetail?: boolean,
observe?: 'response',
reportProgress?: boolean
): Observable<HttpResponse<Array<TModel>>>;
callFindMany(
query: string,
containsDetail?: boolean,
observe?: 'events',
reportProgress?: boolean
): Observable<HttpEvent<Array<TModel>>>;
callFindMany(
query: string,
containsDetail?: boolean,
observe?: any,
reportProgress?: boolean
): Observable<any>;
//#endregion
//
//#region Query ...
/**
* Retrieve Items based on XQuery model
*
* @param query specify data projection attributes
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
callQuery(
query: XQueryDto,
observe?: 'body',
reportProgress?: boolean
): Observable<XQueryResultDto<TModel>>;
callQuery(
query: XQueryDto,
observe?: 'response',
reportProgress?: boolean
): Observable<HttpResponse<XQueryResultDto<TModel>>>;
callQuery(
query: XQueryDto,
observe?: 'events',
reportProgress?: boolean
): Observable<HttpEvent<XQueryResultDto<TModel>>>;
callQuery(
query: XQueryDto,
observe?: any,
reportProgress?: boolean
): Observable<any>;
//#endregion
//#endregion
//
//#region Add ...
//
//#region Add ...
/**
* Add New Item
*
* @param body the new Content which requires to add
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
callAdd(
body: TModel,
connectionId?: string,
observe?: 'body',
reportProgress?: boolean
): Observable<TModel>;
callAdd(
body: TModel,
connectionId?: string,
observe?: 'response',
reportProgress?: boolean
): Observable<HttpResponse<TModel>>;
callAdd(
body: TModel,
connectionId?: string,
observe?: 'events',
reportProgress?: boolean
): Observable<HttpEvent<TModel>>;
callAdd(
body: TModel,
connectionId?: string,
observe?: any,
reportProgress?: boolean
): Observable<any>;
//#endregion
//
//#region AddOrUpdate ...
/**
* Add New Item or Update Exists Item
*
* @param body hte instance of Entity
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
callAddOrUpdate(
body: TModel,
connectionId?: string,
observe?: 'body',
reportProgress?: boolean
): Observable<TModel>;
callAddOrUpdate(
body: TModel,
connectionId?: string,
observe?: 'response',
reportProgress?: boolean
): Observable<HttpResponse<TModel>>;
callAddOrUpdate(
body: TModel,
connectionId?: string,
observe?: 'events',
reportProgress?: boolean
): Observable<HttpEvent<TModel>>;
callAddOrUpdate(
body: TModel,
connectionId?: string,
observe?: any,
reportProgress?: boolean
): Observable<any>;
//#endregion
//
//#region AddMany ...
/**
* Add a Collection of items
*
* @param body an instance of XBaseRangeRequest which contains a collection of items
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
callAddMany(
body: XBaseRangeRequestDto<TModel>,
connectionId?: string,
observe?: 'body',
reportProgress?: boolean
): Observable<void>;
callAddMany(
body: XBaseRangeRequestDto<TModel>,
connectionId?: string,
observe?: 'response',
reportProgress?: boolean
): Observable<HttpResponse<void>>;
callAddMany(
body: XBaseRangeRequestDto<TModel>,
connectionId?: string,
observe?: 'events',
reportProgress?: boolean
): Observable<HttpEvent<void>>;
callAddMany(
body: XBaseRangeRequestDto<TModel>,
connectionId?: string,
observe?: any,
reportProgress?: boolean
): Observable<any>;
//#endregion
//#endregion
//
//#region Update ...
//
//#region Update ...
/**
* Update Specified Item
*
* @param body the instance with all changes
* @param id the Id of Object which are going to replace or update with this
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
callUpdate(
id: TKey,
body: TModel,
connectionId?: string,
observe?: 'body',
reportProgress?: boolean
): Observable<TModel>;
callUpdate(
id: TKey,
body: TModel,
connectionId?: string,
observe?: 'response',
reportProgress?: boolean
): Observable<HttpResponse<TModel>>;
callUpdate(
id: TKey,
body: TModel,
connectionId?: string,
observe?: 'events',
reportProgress?: boolean
): Observable<HttpEvent<TModel>>;
callUpdate(
id: TKey,
body: TModel,
connectionId?: string,
observe?: any,
reportProgress?: boolean
): Observable<any>;
//#endregion
//
//#region UpdateMany ...
/**
* Update a Collection of Items
*
* @param body an instance of XBaseRangeRequestDto
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
callUpdateMany(
body: XBaseRangeRequestDto<TModel>,
connectionId?: string,
observe?: 'body',
reportProgress?: boolean
): Observable<boolean>;
callUpdateMany(
body: XBaseRangeRequestDto<TModel>,
connectionId?: string,
observe?: 'response',
reportProgress?: boolean
): Observable<HttpResponse<boolean>>;
callUpdateMany(
body: XBaseRangeRequestDto<TModel>,
connectionId?: string,
observe?: 'events',
reportProgress?: boolean
): Observable<HttpEvent<boolean>>;
callUpdateMany(
body: XBaseRangeRequestDto<TModel>,
connectionId?: string,
observe?: any,
reportProgress?: boolean
): Observable<any>;
//#endregion
//#endregion
//
//#region Exists ...
/**
* Check an items is Exists or not
*
* @param id the id of item
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
callIsExists(
id: TKey,
observe?: 'body',
reportProgress?: boolean
): Observable<boolean>;
callIsExists(
id: TKey,
observe?: 'response',
reportProgress?: boolean
): Observable<HttpResponse<boolean>>;
callIsExists(
id: TKey,
observe?: 'events',
reportProgress?: boolean
): Observable<HttpEvent<boolean>>;
callIsExists(
id: TKey,
observe?: any,
reportProgress?: boolean
): Observable<any>;
//#endregion
//
//#region Remove ...
//
//#region Remove ...
/**
* Remove Specified item by its ID
*
* @param id pointer to specific instance
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
callRemove(
id: TKey,
connectionId?: string,
observe?: 'body',
reportProgress?: boolean
): Observable<TModel>;
callRemove(
id: TKey,
connectionId?: string,
observe?: 'response',
reportProgress?: boolean
): Observable<HttpResponse<TModel>>;
callRemove(
id: TKey,
connectionId?: string,
observe?: 'events',
reportProgress?: boolean
): Observable<HttpEvent<TModel>>;
callRemove(
id: TKey,
connectionId?: string,
observe?: any,
reportProgress?: boolean
): Observable<any>;
//#endregion
//
//#region RemoveMany ...
/**
* Remove a Collection of Items base on RangeRequest
*
* @param body an instance of XBaseRangeRequestDto
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
callRemoveMany(
body: XBaseRangeRequestDto<TModel>,
connectionId?: string,
observe?: 'body',
reportProgress?: boolean
): Observable<void>;
callRemoveMany(
body: XBaseRangeRequestDto<TModel>,
connectionId?: string,
observe?: 'response',
reportProgress?: boolean
): Observable<HttpResponse<void>>;
callRemoveMany(
body: XBaseRangeRequestDto<TModel>,
connectionId?: string,
observe?: 'events',
reportProgress?: boolean
): Observable<HttpEvent<void>>;
callRemoveMany(
body: XBaseRangeRequestDto<TModel>,
connectionId?: string,
observe?: any,
reportProgress?: boolean
): Observable<any>;
//#endregion
//#endregion
//#endregion
}