export type CreateApiVcsEventsVcsTypeArgs = {vcs_type: 'github' | 'gitlab' | 'bitbucket' | 'azuredevops'}; export type CreateApiVcsEventsVcsTypeOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Create a VCS Event * * POST /vcs-events/{vcs_type} */ export const createApiVcsEventsVcsType = async (args: CreateApiVcsEventsVcsTypeArgs, options?: CreateApiVcsEventsVcsTypeOptions) => { const {baseUrl = "https://api.firefly.ai/v2", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() const url = `${baseUrl.replace(/\/+$/, '')}/vcs-events/${encodeURIComponent(String(args.vcs_type))}${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 };