export type GetApiStoreNameUpdateArgs = {storeName: string, update: string, 'using-graph-uri'?: string | undefined, 'using-named-graph-uri'?: string | undefined}; export type GetApiStoreNameUpdateOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Executes a SPARQL Update operation against the store * * GET /{storeName}/update */ export const getApiStoreNameUpdate = async (args: GetApiStoreNameUpdateArgs, options: GetApiStoreNameUpdateOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.update != null) query.append("update", String(args.update)) if (args['using-graph-uri'] != null) query.append("using-graph-uri", String(args['using-graph-uri'])) if (args['using-named-graph-uri'] != null) query.append("using-named-graph-uri", String(args['using-named-graph-uri'])) const url = `${baseUrl.replace(/\/+$/, '')}/${encodeURIComponent(String(args.storeName))}/update${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };