fix: separate resource previews from downloads
This commit is contained in:
@@ -8,6 +8,7 @@ import type {
|
||||
WorkerCabinetPart,
|
||||
WorkerExportFormat,
|
||||
WorkerFailure,
|
||||
WorkerResourceIntent,
|
||||
WorkerResponse,
|
||||
} from './worker-protocol.js';
|
||||
|
||||
@@ -148,10 +149,27 @@ export class OneNoteWorkerClient {
|
||||
});
|
||||
}
|
||||
|
||||
getResource(
|
||||
getResourcePreview(
|
||||
sessionId: string,
|
||||
resourceId: string,
|
||||
sectionId?: string
|
||||
): Promise<ResourceWorkerResponse> {
|
||||
return this.getResource(sessionId, resourceId, 'preview', sectionId);
|
||||
}
|
||||
|
||||
getResourceDownload(
|
||||
sessionId: string,
|
||||
resourceId: string,
|
||||
sectionId?: string
|
||||
): Promise<ResourceWorkerResponse> {
|
||||
return this.getResource(sessionId, resourceId, 'download', sectionId);
|
||||
}
|
||||
|
||||
private getResource(
|
||||
sessionId: string,
|
||||
resourceId: string,
|
||||
intent: WorkerResourceIntent,
|
||||
sectionId?: string
|
||||
): Promise<ResourceWorkerResponse> {
|
||||
if (this.terminated) {
|
||||
return Promise.reject(
|
||||
@@ -173,6 +191,7 @@ export class OneNoteWorkerClient {
|
||||
requestId,
|
||||
sessionId,
|
||||
resourceId,
|
||||
intent,
|
||||
...(sectionId === undefined ? {} : { sectionId }),
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user