1 import type { NodeMeta, PublicNodeMeta } from '@proton/drive-store'
2 import { ApiResult, type RealtimeUrlAndToken } from '@proton/docs-shared'
3 import type { DocsApi } from '../Api/DocsApi'
5 export class GetRealtimeUrlAndToken {
6 constructor(private docsApi: DocsApi) {}
8 async execute(lookup: NodeMeta | PublicNodeMeta, commitId?: string): Promise<ApiResult<RealtimeUrlAndToken>> {
9 const result = await this.docsApi.createRealtimeValetToken(lookup, commitId)
11 if (result.isFailed()) {
12 return ApiResult.fail(result.getError())
15 const value = result.getValue().ValetToken
20 includeDocumentNameInEmails: value.Preferences.find((p) => p.Name === 'IncludeDocumentName')?.Value ?? false,