MCPcopy Index your code
hub / github.com/simstudioai/sim / fetchNote

Function fetchNote

apps/sim/connectors/obsidian/obsidian.ts:131–154  ·  view source on GitHub ↗

* Fetches a single note as structured JSON with content, frontmatter, stats, and tags.

(
  baseUrl: string,
  accessToken: string,
  filePath: string,
  retryOptions?: Parameters<typeof secureFetchWithRetry>[2]
)

Source from the content-addressed store, hash-verified

129 * Fetches a single note as structured JSON with content, frontmatter, stats, and tags.
130 */
131async function fetchNote(
132 baseUrl: string,
133 accessToken: string,
134 filePath: string,
135 retryOptions?: Parameters<typeof secureFetchWithRetry>[2]
136): Promise<NoteJson> {
137 const response = await secureFetchWithRetry(
138 `${baseUrl}/vault/${filePath.split('/').map(encodeURIComponent).join('/')}`,
139 {
140 method: 'GET',
141 headers: {
142 Authorization: `Bearer ${accessToken}`,
143 Accept: 'application/vnd.olrapi.note+json',
144 },
145 },
146 retryOptions
147 )
148
149 if (!response.ok) {
150 throw new Error(`Obsidian API error fetching ${filePath}: ${response.status}`)
151 }
152
153 return (await response.json()) as NoteJson
154}
155
156/**
157 * Extracts a display title from a file path.

Callers 1

obsidian.tsFile · 0.85

Calls 2

secureFetchWithRetryFunction · 0.90
joinMethod · 0.80

Tested by

no test coverage detected