export type GetApiV2TabTabIdRoleRoleIdArgs = {tabId: number, roleId: number}; export type GetApiV2TabTabIdRoleRoleIdOptions = {baseUrl: string, oauth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Retrieve the requested tab along with any extensions based on the supplied roleId * * GET /v2/tab/{tabId}/role/{roleId} * * Also accepts auth: sessionKey */ export const getApiV2TabTabIdRoleRoleId = async (args: GetApiV2TabTabIdRoleRoleIdArgs, options: GetApiV2TabTabIdRoleRoleIdOptions) => { const {baseUrl, fetch: fetchFn = fetch, oauth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (oauth2 !== undefined) headers.set('authorization', `Bearer ${oauth2}`) const url = `${baseUrl.replace(/\/+$/, '')}/v2/tab/${encodeURIComponent(String(args.tabId))}/role/${encodeURIComponent(String(args.roleId))}${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 };