export type FirebaseServiceAccountConfig = {type: string, project_id: string, private_key_id: string, private_key: string, client_email: string, client_id: string, auth_uri: string, token_uri: string, auth_provider_x509_cert_url: string, client_x509_cert_url: string, universe_domain: string}; export type UserSourceStaticTenantConfig = {tenantId: string, tenantResolverType: 'static'}; export type UserSourceNewTenantConfig = {tenantResolverType: 'new'}; export type ExternalFirebaseUserSourceConfig = {syncOnLogin: boolean, isMigrated: boolean, apiKey: string, serviceAccount: FirebaseServiceAccountConfig, tenantConfig: UserSourceStaticTenantConfig | UserSourceNewTenantConfig}; export type UpdateExternalFirebaseUserSourceRequestDTO = {name?: string | undefined, configuration?: ExternalFirebaseUserSourceConfig | undefined, index?: number | undefined, description?: string | undefined}; export type UpdateApiResourcesUserSourcesV1ExternalFirebaseIdArgs = {id: string, body: UpdateExternalFirebaseUserSourceRequestDTO}; export type UpdateApiResourcesUserSourcesV1ExternalFirebaseIdOptions = {baseUrl?: string | undefined, bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update Firebase external user source * * PUT /resources/user-sources/v1/external/firebase/{id} */ export const updateApiResourcesUserSourcesV1ExternalFirebaseId = async (args: UpdateApiResourcesUserSourcesV1ExternalFirebaseIdArgs, options?: UpdateApiResourcesUserSourcesV1ExternalFirebaseIdOptions) => { 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/firebase/${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 };