export type CreateApiV1MockApisMockApiIdVersionHistoryCommitsVersionCommitIdRestoreOptions = {baseUrl?: string | undefined, tokenAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Restore the contents of all mock API entities to a given version * * POST /v1/mock-apis/{mockApiId}/version-history/commits/{versionCommitId}/restore */ export const createApiV1MockApisMockApiIdVersionHistoryCommitsVersionCommitIdRestore = async (options?: CreateApiV1MockApisMockApiIdVersionHistoryCommitsVersionCommitIdRestoreOptions) => { const {baseUrl = "https://wmc.wiremockapi.cloud", fetch: fetchFn = fetch, tokenAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (tokenAuth !== undefined) headers.set("Authorization", tokenAuth) const url = `${baseUrl.replace(/\/+$/, '')}/v1/mock-apis/${encodeURIComponent(String(args.mockApiId))}/version-history/commits/${encodeURIComponent(String(args.versionCommitId))}/restore${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };