fetchEndpointSource
One-shot cached fetch of a Wave-2 endpointSource block — the imperative sibling of useEndpointSource for Options-API fetch flows and services.
import { fetchEndpointSource } from '@conduction/nextcloud-vue'
const payload = await fetchEndpointSource(
{ url: '/apps/pipelinq/api/analytics/overview', params: { period: '@workspace.datePreset?' }, responsePath: 'summary' },
{ workspace: { datePreset: 'month' } }, // token context
{ force: false }, // force: true bypasses the shared cache
)
Behaviour (shared with the composable):
paramsvalues resolve through the SAME@-token grammar widget filters use; optional (…?) tokens drop when unresolved, an unresolved REQUIRED token returnsnullwithout a request.- Requests dedupe + short-TTL cache per
(method, url, resolved params)— module-wide, so concurrent callers share ONE http call. { fresh: true }joins a request still in flight but never serves a settled cache entry.{ force: true, refresh }bypasses the cache and joins only a request of the samerefreshtoken (the refresh event's payload object), so the widgets of one refresh share a request and a later refresh never gets an earlier one's answer.- The response is plucked at
responsePath(dot-path);undefinedplucks returnnull. - App-relative URLs route through
generateUrl; absolute (http/https) URLs pass untouched. method: 'POST'sends the resolved params as the JSON body.
See invalidateEndpointSourceCache to drop the shared cache.