export type GetApiApiAuthCustomRolesArgs = {sellerId: string | string}; export type GetApiApiAuthCustomRolesOptions = {baseUrl?: string | undefined, jwt?: string | undefined, fetch?: typeof fetch | undefined}; /** * List custom roles * * GET /api/auth/custom-roles */ export const getApiApiAuthCustomRoles = async (args: GetApiApiAuthCustomRolesArgs, options?: GetApiApiAuthCustomRolesOptions) => { const {baseUrl = "https://vivenu.com", fetch: fetchFn = fetch, jwt} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.sellerId != null) query.append("sellerId", String(args.sellerId)) if (jwt !== undefined) headers.set('authorization', `Bearer ${jwt}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/auth/custom-roles${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };