export type CreateApiApiGritCoreLoadSetsArgs = {body: BodyInit}; export type CreateApiApiGritCoreLoadSetsOptions = {baseUrl: string, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Creates a load set with load set blocks * * POST /api/grit/core/load_sets */ export const createApiApiGritCoreLoadSets = async (args: CreateApiApiGritCoreLoadSetsArgs, options: CreateApiApiGritCoreLoadSetsOptions) => { const {baseUrl, fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/grit/core/load_sets${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: args.body}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };