export type UserSourceNewTenantConfig = {tenantResolverType: 'new'}; export type UserSourceFromSourceTenantConfig = {tenantResolverType: 'from-source'}; export type ExternalCustomCodeUserSourceConfig = {syncOnLogin: boolean, isMigrated: boolean, codePayload: string, getUserCodePayload?: string | undefined, tenantConfig: UserSourceNewTenantConfig | UserSourceFromSourceTenantConfig}; export type UpdateExternalCustomCodeUserSourceRequestDTO = {name?: string | undefined, configuration?: ExternalCustomCodeUserSourceConfig | undefined, index?: number | undefined, description?: string | undefined}; export type UpdateApiResourcesUserSourcesV1ExternalCustomCodeIdArgs = {id: string, body: UpdateExternalCustomCodeUserSourceRequestDTO}; export type UpdateApiResourcesUserSourcesV1ExternalCustomCodeIdOptions = {baseUrl?: string | undefined, bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update Custom-Code external user source * * PUT /resources/user-sources/v1/external/custom-code/{id} */ export const updateApiResourcesUserSourcesV1ExternalCustomCodeId = async (args: UpdateApiResourcesUserSourcesV1ExternalCustomCodeIdArgs, options?: UpdateApiResourcesUserSourcesV1ExternalCustomCodeIdOptions) => { 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/external/custom-code/${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 };