export type HashTypeInput = {hashType?: ('SHA256' | 'MD5' | 'SHA1') | undefined}; export type PatchApiSitesSiteCodeHashArgs = {siteCode: string, body: HashTypeInput}; export type PatchApiSitesSiteCodeHashOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get a hash code of the contents of the original application file * * PATCH /sites/{siteCode}/hash */ export const patchApiSitesSiteCodeHash = async (args: PatchApiSitesSiteCodeHashArgs, options?: PatchApiSitesSiteCodeHashOptions) => { const {baseUrl = "https://api.kameleoon.com", fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "*/*") if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/sites/${encodeURIComponent(String(args.siteCode))}/hash${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return res.blob() };