forked from BasedHardware/omi
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMemoryExportServiceNotion.swift
More file actions
28 lines (25 loc) · 915 Bytes
/
Copy pathMemoryExportServiceNotion.swift
File metadata and controls
28 lines (25 loc) · 915 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import Foundation
extension MemoryExportService {
/// Writes memories to the "Omi Memories" page in the connected Notion
/// workspace over Notion's hosted MCP (create once, replace on later syncs).
func exportToNotion() async throws -> MemoryExportResult {
let memories = try await fetchMemories(limit: 400)
guard !memories.isEmpty else { throw MemoryExportError.noMemories }
let markdown = buildMarkdownPack(memories: memories, destination: .notion)
let pageURL = try await NotionMCPConnector.shared.syncMemories(markdown: markdown)
let detail = "Updated Notion page"
persistStatus(
destination: .notion,
exportedCount: memories.count,
detailText: detail,
filePath: nil
)
return MemoryExportResult(
memoryCount: memories.count,
detailText: detail,
destinationURL: pageURL,
fileURL: nil,
clipboardText: nil
)
}
}