export type DeleteUserPayload = {replacement?: string | undefined, replacementStrategy?: ('specifiedUser' | 'globalAdmin' | 'teamAdmin' | 'findReplacement') | undefined}; export type DeleteApiApiPublicV1UserUserArgs = {'X-VO-Api-Id': string, 'X-VO-Api-Key': string, user: string, body: DeleteUserPayload}; export type DeleteApiApiPublicV1UserUserOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Remove a user * * DELETE /api-public/v1/user/{user} */ export const deleteApiApiPublicV1UserUser = async (args: DeleteApiApiPublicV1UserUserArgs, options?: DeleteApiApiPublicV1UserUserOptions) => { const {baseUrl = "https://api.victorops.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args['X-VO-Api-Id'] != null) headers.set("X-VO-Api-Id", String(args['X-VO-Api-Id'])) if (args['X-VO-Api-Key'] != null) headers.set("X-VO-Api-Key", String(args['X-VO-Api-Key'])) const url = `${baseUrl.replace(/\/+$/, '')}/api-public/v1/user/${encodeURIComponent(String(args.user))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", 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 };