export type AdaptekApiCommonModelsApiModelsAdvisorsCommandsAffiliationsModelV2 = {ga?: boolean | undefined, gab?: boolean | undefined, gi?: boolean | undefined, glb?: boolean | undefined, gs?: boolean | undefined, ascentium?: boolean | undefined, complianceApplication?: boolean | undefined}; export type UpdateApiV1AdvisorsAdvisorIdAffiliationsArgs = {advisorId: number, body: AdaptekApiCommonModelsApiModelsAdvisorsCommandsAffiliationsModelV2}; export type UpdateApiV1AdvisorsAdvisorIdAffiliationsOptions = {baseUrl: string, oauth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Grants or Revokes an Agents App Access from their affiliation to Ascentium, GA, GAB, GI, GLB or GS. * Intended only for use by PHP and Home Office integration. Used when someone affiliates * with a one of the companies passed in via the Body of the request. * * PUT /v1/Advisors/{advisorId}/Affiliations */ export const updateApiV1AdvisorsAdvisorIdAffiliations = async (args: UpdateApiV1AdvisorsAdvisorIdAffiliationsArgs, options: UpdateApiV1AdvisorsAdvisorIdAffiliationsOptions) => { 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))}/Affiliations${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 };