export type UserSourceDynamicTenantConfig = {tenantIdFieldName: string, tenantResolverType: 'dynamic'}; export type UserSourceStaticTenantConfig = {tenantId: string, tenantResolverType: 'static'}; export type UserSourceNewTenantConfig = {tenantResolverType: 'new'}; export type FederationUserSourceConfig = {syncOnLogin: boolean, wellknownUrl: string, clientId: string, secret: string, tenantConfig: UserSourceDynamicTenantConfig | UserSourceStaticTenantConfig | UserSourceNewTenantConfig}; export type UpdateFederationUserSourceRequestDTO = {name?: string | undefined, configuration?: FederationUserSourceConfig | undefined, index?: number | undefined, description?: string | undefined}; export type UpdateApiResourcesUserSourcesV1FederationIdArgs = {id: string, body: UpdateFederationUserSourceRequestDTO}; export type UpdateApiResourcesUserSourcesV1FederationIdOptions = {baseUrl?: string | undefined, bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update Federation user source * * PUT /resources/user-sources/v1/federation/{id} */ export const updateApiResourcesUserSourcesV1FederationId = async (args: UpdateApiResourcesUserSourcesV1FederationIdArgs, options?: UpdateApiResourcesUserSourcesV1FederationIdOptions) => { const {baseUrl = "http://localhost:8181", fetch: fetchFn = fetch, bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (bearer !== undefined) headers.set('authorization', `Bearer ${bearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/resources/user-sources/v1/federation/${encodeURIComponent(String(args.id))}${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 };