export type CreateApiApiV1ConsoleCliDeviceUserCodeDenyArgs = {user_code: string}; export type CreateApiApiV1ConsoleCliDeviceUserCodeDenyOptions = {baseUrl: string, HTTPBearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Console Cli Device Deny * * POST /api/v1/console/cli/device/{user_code}/deny */ export const createApiApiV1ConsoleCliDeviceUserCodeDeny = async (args: CreateApiApiV1ConsoleCliDeviceUserCodeDenyArgs, options: CreateApiApiV1ConsoleCliDeviceUserCodeDenyOptions) => { const {baseUrl, fetch: fetchFn = fetch, HTTPBearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (HTTPBearer !== undefined) headers.set('authorization', `Bearer ${HTTPBearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/console/cli/device/${encodeURIComponent(String(args.user_code))}/deny${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 };