feat: implement entity patch
Some checks failed
Build Test / test (pull_request) Successful in 35s
JS Unit Tests / test (pull_request) Failing after 34s
PHP Unit Tests / test (pull_request) Successful in 1m9s

Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
2026-05-20 21:37:14 -04:00
parent aff17840ed
commit 453d720046
5 changed files with 117 additions and 43 deletions

View File

@@ -25,6 +25,8 @@ import type {
EntityListStreamRequest,
EntityListBulkResponse,
EntityListBulkRequest,
EntityPatchResponse,
EntityPatchRequest,
} from '../types/entity';
import { useIntegrationStore } from '@KTXC/stores/integrationStore';
import { EntityObject } from '../models';
@@ -150,6 +152,27 @@ export const entityService = {
return createEntityObject(response);
},
/**
* Patch existing entities with new properties
*
* @param request - patch request parameters
*
* @returns Promise with patch results keyed by target entity identifier
*/
async patch(request: EntityPatchRequest): Promise<EntityPatchResponse> {
const properties = {
'@type': request.properties['@type'] ?? 'mail:message',
...(Object.prototype.hasOwnProperty.call(request.properties, 'flags')
? { flags: request.properties.flags }
: {}),
}
return await transceivePost<EntityPatchRequest, EntityPatchResponse>('entity.patch', {
...request,
properties,
});
},
/**
* Delete entities by their identifiers
*