export type P4ImportJobResult = {last_changelist?: number | undefined, last_import_unix?: (number | null) | undefined, running_job_id?: (string | null) | undefined, error_count?: number | undefined, last_error?: (string | null) | undefined, last_error_unix?: (number | null) | undefined}; export type CreateApiReposRepoIdP4ImportStateMarkStoppedArgs = {body: P4ImportJobResult}; export type CreateApiReposRepoIdP4ImportStateMarkStoppedOptions = {baseUrl?: string | undefined, OAuth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Mark P4 import as stopped * * POST /repos/{repo_id}/p4-import-state/mark-stopped */ export const createApiReposRepoIdP4ImportStateMarkStopped = async (args: CreateApiReposRepoIdP4ImportStateMarkStoppedArgs, options?: CreateApiReposRepoIdP4ImportStateMarkStoppedOptions) => { const {baseUrl = "https://api.diversion.dev/v0", fetch: fetchFn = fetch, OAuth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (OAuth2 !== undefined) headers.set('authorization', `Bearer ${OAuth2}`) const url = `${baseUrl.replace(/\/+$/, '')}/repos/${encodeURIComponent(String(args.repo_id))}/p4-import-state/mark-stopped${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", 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 undefined };