export type AdaptekApiCommonConstantsUserAuthorizationRoleType = 1 | 2 | 3 | 4 | 5 | 6 | 7; export type AdaptekApiApplicationCommonSecurityICurrentUser = {userId?: (number | null) | undefined, advisorId?: (number | null) | undefined, holdingCompanyId?: (number | null) | undefined, fmoId?: (number | null) | undefined, isNexTekAdmin?: boolean | undefined, isAdmin?: boolean | undefined, isAgencyAdmin?: boolean | undefined, roles?: (Array | null) | undefined}; export type AdaptekApiApplicationAdvisorsCommandsAssignAdvisorAssignAdvisorCommand = {advisorId?: number | undefined, holdingCompanyId?: number | undefined, roleType?: AdaptekApiCommonConstantsUserAuthorizationRoleType | undefined, isPrimaryAdvisor?: boolean | undefined, currentUser?: AdaptekApiApplicationCommonSecurityICurrentUser | undefined}; export type UpdateApiV1AdvisorsAdvisorIdHoldingCompanyArgs = {advisorId: number, body: AdaptekApiApplicationAdvisorsCommandsAssignAdvisorAssignAdvisorCommand}; export type UpdateApiV1AdvisorsAdvisorIdHoldingCompanyOptions = {baseUrl: string, oauth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Assigns advisor from holding area to a holding company * * PUT /v1/Advisors/{advisorId}/holdingCompany */ export const updateApiV1AdvisorsAdvisorIdHoldingCompany = async (args: UpdateApiV1AdvisorsAdvisorIdHoldingCompanyArgs, options: UpdateApiV1AdvisorsAdvisorIdHoldingCompanyOptions) => { const {baseUrl, fetch: fetchFn = fetch, oauth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (oauth2 !== undefined) headers.set('authorization', `Bearer ${oauth2}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/Advisors/${encodeURIComponent(String(args.advisorId))}/holdingCompany${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", 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 };