import { fetchUpdateResponse, type UpdateRequest } from "./fetchUpdateResponse"; import { UpdateHttpError } from "./updateError"; export class FetchJSONResponseError extends UpdateHttpError {} export const fetchJSON = async ( input: Omit, ): Promise => { const { response, body } = await fetchUpdateResponse({ ...input, resource: "artifact", }); if (response.status !== 200) { throw new FetchJSONResponseError(response.status, response.statusText); } return JSON.parse(body!) as T; };