Skip to content

Commit

Permalink
[Deprecations/Docs] Address uncommented apis (elastic#204198)
Browse files Browse the repository at this point in the history
## Summary

elastic#203042 highlighted these APIs not having comments.

### Checklist

- [x]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials

(cherry picked from commit 25b171d)
  • Loading branch information
afharo committed Dec 16, 2024
1 parent 1ac650b commit 8e04723
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,14 @@ import { registerRoutes } from './routes';
import { config as deprecationConfig, DeprecationConfigType } from './deprecation_config';
import { registerApiDeprecationsInfo, registerConfigDeprecationsInfo } from './deprecations';

/**
* Deprecation Service: Internal Start contract
*/
export interface InternalDeprecationsServiceStart {
/**
* Creates a {@link DeprecationsClient} with provided SO client and ES client.
*
* @param esClient Scoped Elasticsearch client
* @param savedObjectsClient Scoped SO Client
*/
asScopedToClient(
esClient: IScopedClusterClient,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,27 +87,50 @@ import type { SavedObjectsClientContract } from '@kbn/core-saved-objects-api-ser
* @public
*/
export interface DeprecationsServiceSetup {
/**
* Registers deprecation messages or notices for a specific feature or functionality
* within the application. This allows developers to flag certain behaviors or APIs
* as deprecated, providing guidance and warnings for future deprecation plans.
*
* @param {RegisterDeprecationsConfig} deprecationContext - The configuration object containing
* information about the deprecated features, including messages, corrective actions,
* and any relevant metadata to inform users or developers about the deprecation.
*/
registerDeprecations: (deprecationContext: RegisterDeprecationsConfig) => void;
}

/**
* Options to provide when registering deprecations via {@link DeprecationsServiceSetup.registerDeprecations}.
* @public
*/
export interface RegisterDeprecationsConfig {
/**
* Method called when the user wants to list any existing deprecations.
* Returns the list of deprecation messages to warn about.
* @param {GetDeprecationsContext} context Scoped clients and helpers to ease fetching the deprecations.
*/
getDeprecations: (context: GetDeprecationsContext) => MaybePromise<DeprecationsDetails[]>;
}

/**
* Scoped clients and helpers to ease fetching the deprecations.
* @public
*/
export interface GetDeprecationsContext {
/** Elasticsearch client scoped to the current user */
esClient: IScopedClusterClient;
/** Saved Objects client scoped to the current user and space */
savedObjectsClient: SavedObjectsClientContract;
}

/**
* Provides a method to scope the {@link DeprecationsServiceSetup | Deprecations Service} to a specific domain.
* @public
*/
export interface DeprecationRegistryProvider {
/**
* Returns the {@link DeprecationsServiceSetup | Deprecations Service} scoped to a specific domain.
* @param domainId Domain ID to categorize the deprecations reported under it.
*/
getRegistry: (domainId: string) => DeprecationsServiceSetup;
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ import type { DomainDeprecationDetails } from '@kbn/core-deprecations-common';
* @public
*/
export interface DeprecationsClient {
/**
* Fetch all Kibana deprecations.
*/
getAllDeprecations: () => Promise<DomainDeprecationDetails[]>;
}

Expand All @@ -23,5 +26,8 @@ export interface DeprecationsClient {
* @public
*/
export interface DeprecationsRequestHandlerContext {
/**
* {@link DeprecationsClient | Deprecations client} exposed in the request handler context.
*/
client: DeprecationsClient;
}

0 comments on commit 8e04723

Please sign in to comment.