feat: mail entity download
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
* Entity management service
|
||||
*/
|
||||
|
||||
import { transceivePost, transceiveStream } from './transceive';
|
||||
import { transceivePost, transceiveStream, transceiveDownload } from './transceive';
|
||||
import type {
|
||||
EntityFetchRequest,
|
||||
EntityFetchResponse,
|
||||
@@ -27,6 +27,7 @@ import type {
|
||||
EntityListBulkRequest,
|
||||
EntityPatchResponse,
|
||||
EntityPatchRequest,
|
||||
EntityDownloadRequest,
|
||||
} from '../types/entity';
|
||||
import { useIntegrationStore } from '@KTXC/stores/integrationStore';
|
||||
import { EntityObject } from '../models';
|
||||
@@ -110,7 +111,7 @@ export const entityService = {
|
||||
|
||||
// Convert response to EntityObject instances
|
||||
const list: Record<string, EntityObject> = {};
|
||||
Object.entries(response).forEach(([identifier, entity]) => {
|
||||
Object.entries(response).forEach(([, entity]) => {
|
||||
list[entity.identifier] = createEntityObject(entity);
|
||||
});
|
||||
|
||||
@@ -216,6 +217,16 @@ export const entityService = {
|
||||
async transmit(request: EntityTransmitRequest): Promise<EntityTransmitResponse> {
|
||||
return await transceivePost<EntityTransmitRequest, EntityTransmitResponse>('entity.transmit', request);
|
||||
},
|
||||
|
||||
/**
|
||||
* Submit a browser-native attachment download request.
|
||||
*
|
||||
* The backend download endpoint is expected to honor the supplied selector
|
||||
* and respond with an attachment payload rather than JSON.
|
||||
*/
|
||||
download(request: EntityDownloadRequest): { transaction: string } {
|
||||
return transceiveDownload<EntityDownloadRequest>('entity.download', request);
|
||||
},
|
||||
};
|
||||
|
||||
export default entityService;
|
||||
|
||||
Reference in New Issue
Block a user