import type { IHttpClient } from '@equinor/fusion-framework-module-http'; import { BaseModuleProvider } from '@equinor/fusion-framework-module/provider'; import type { ITelemetryProvider, TelemetryConnectable } from '@equinor/fusion-framework-module-telemetry'; import type { ClientMethod } from './types.js'; import type { ApiClientFactory } from './types.js'; import { ContextApiClient } from './context/index.js'; import BookmarksApiClient from './bookmarks/client.js'; import { NotificationApiClient } from './notification/index.js'; import { PeopleApiClient } from './people/client.js'; import { AppStateApiClient } from './app-state/client.js'; export { ApiProviderError } from './ApiProviderError.js'; /** * Public interface for the services module provider. * * Exposes factory methods for creating domain-specific API clients * for bookmarks, context, notification, and people services. * Each factory resolves a named HTTP client, attaches response * validation, and returns a typed client instance. * * @template TClient - The underlying HTTP client type. */ export interface IApiProvider extends TelemetryConnectable { /** * Creates a typed client for the bookmarks API. * * @template TMethod - The client execution method (`'json'` or `'json$'`). * @param method - The execution method to use for requests. * @returns A configured {@link BookmarksApiClient} instance. */ createBookmarksClient(method: TMethod): Promise>; /** * Creates a typed client for the context API. * * @template TMethod - The client execution method (`'json'` or `'json$'`). * @param method - The execution method to use for requests. * @returns A configured {@link ContextApiClient} instance. */ createContextClient(method: TMethod): Promise>; /** * Creates a typed client for the notification API. * * @template TMethod - The client execution method (`'json'` or `'json$'`). * @param method - The execution method to use for requests. * @returns A configured {@link NotificationApiClient} instance. */ createNotificationClient(method: TMethod): Promise>; /** * Creates a typed client for the people API. * * @returns A configured {@link PeopleApiClient} instance. */ createPeopleClient(): Promise>; /** * Creates a typed client for the App State API. * * @template TMethod - The client execution method (`'json'` or `'json$'`). * @param method - The execution method to use for requests. * @returns A configured {@link AppStateApiClient} instance. */ createAppStateClient(method: TMethod): Promise>; } /** * Internal configuration shape for {@link ApiProvider}. * * @template TClient - The underlying HTTP client type. */ type ApiProviderConfig = { createClient: ApiClientFactory; }; /** * Default implementation of {@link IApiProvider}. * * Manages the lifecycle of domain-specific API clients (bookmarks, context, * notification, people) by resolving named HTTP clients through the * configured {@link ApiClientFactory} and attaching response-validation * middleware. * * @template TClient - The underlying HTTP client type. */ export declare class ApiProvider extends BaseModuleProvider> implements IApiProvider { #private; /** Factory used to create the underlying HTTP client for this provider. */ protected _createClientFn: ApiClientFactory; /** * Creates a services provider from an HTTP client factory. * * @param config - Provider configuration containing the client factory. * @throws Never directly; created factories rethrow the original client-creation error. */ constructor(config: ApiProviderConfig); /** * Connects optional operational telemetry for API client selection. * * Records one `fusion.services.create-client.duration` per client creation, plus one * sanitized failure when no client can be selected. Service names, URIs and errors are * not recorded; discovery resolution and HTTP attempts are reported by their own modules. * * @param telemetry - Host telemetry provider, or `undefined` to record nothing. */ connectTelemetry(telemetry: ITelemetryProvider | undefined): void; /** * Creates a typed notification API client and attaches response validation. * * @template TMethod - The client execution method. * @param method - The execution method to use for requests. * @returns A configured notification API client. */ createNotificationClient(method: TMethod): Promise>; /** * Creates a typed bookmarks API client. * * @template TMethod - The client execution method. * @param method - The execution method to use for requests. * @returns A configured bookmarks API client. */ createBookmarksClient(method: TMethod): Promise>; /** * Creates a typed context API client and attaches response validation. * * @template TMethod - The client execution method. * @param method - The execution method to use for requests. * @returns A configured context API client. */ createContextClient(method: TMethod): Promise>; /** * Creates a typed people API client and attaches response validation. * * @returns A configured people API client. */ createPeopleClient(): Promise>; /** * Creates a typed App State API client and attaches response validation. * * @template TMethod - The client execution method. * @param method - The execution method to use for requests. * @returns A configured App State API client. */ createAppStateClient(method: TMethod): Promise>; }