export type CreateApiGroupsGroupMatchArgs = {group: string, body: BodyInit}; export type CreateApiGroupsGroupMatchOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Check if project name matches group pattern * * POST /groups/{group}/match */ export const createApiGroupsGroupMatch = async (args: CreateApiGroupsGroupMatchArgs, options: CreateApiGroupsGroupMatchOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "text/plain") const url = `${baseUrl.replace(/\/+$/, '')}/groups/${encodeURIComponent(String(args.group))}/match${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: args.body}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };