Use explicit interface for SavedObjectsClientContract (#132795)

* No explicit interface for `SavedObjectsClientContract`

* fix doc, do not export the client class

* fix doc more

* fix import from plugins

* fix import from plugins bis

* update generated doc
This commit is contained in:
Pierre Gayvallet 2022-05-25 16:51:16 +02:00 committed by GitHub
parent c51fb17e4c
commit 4043c33be1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
36 changed files with 448 additions and 337 deletions

View file

@ -14,9 +14,8 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->
| Class | Description |
| --- | --- |
| [SavedObjectsClient](./kibana-plugin-core-public.savedobjectsclient.md) | Saved Objects is Kibana's data persisentence mechanism allowing plugins to use Elasticsearch for storing plugin state. The client-side SavedObjectsClient is a thin convenience library around the SavedObjects HTTP API for interacting with Saved Objects. |
| [ScopedHistory](./kibana-plugin-core-public.scopedhistory.md) | A wrapper around a <code>History</code> instance that is scoped to a particular base path of the history stack. Behaves similarly to the <code>basename</code> option except that this wrapper hides any history stack entries from outside the scope of this base path.<!-- -->This wrapper also allows Core and Plugins to share a single underlying global <code>History</code> instance without exposing the history of other applications.<!-- -->The [createSubHistory](./kibana-plugin-core-public.scopedhistory.createsubhistory.md) method is particularly useful for applications that contain any number of "sub-apps" which should not have access to the main application's history or basePath. |
| [SimpleSavedObject](./kibana-plugin-core-public.simplesavedobject.md) | This class is a very simple wrapper for SavedObjects loaded from the server with the [SavedObjectsClient](./kibana-plugin-core-public.savedobjectsclient.md)<!-- -->.<!-- -->It provides basic functionality for creating/saving/deleting saved objects, but doesn't include any type-specific implementations. |
| [SimpleSavedObject](./kibana-plugin-core-public.simplesavedobject.md) | This class is a very simple wrapper for SavedObjects loaded from the server with the [SavedObjectsClientContract](./kibana-plugin-core-public.savedobjectsclientcontract.md)<!-- -->.<!-- -->It provides basic functionality for creating/saving/deleting saved objects, but doesn't include any type-specific implementations. |
| [ToastsApi](./kibana-plugin-core-public.toastsapi.md) | Methods for adding and removing global toast messages. |
## Enumerations
@ -98,7 +97,7 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->
| [OverlayStart](./kibana-plugin-core-public.overlaystart.md) | |
| [Plugin\_2](./kibana-plugin-core-public.plugin_2.md) | The interface that should be returned by a <code>PluginInitializer</code>. |
| [PluginInitializerContext](./kibana-plugin-core-public.plugininitializercontext.md) | The available core services passed to a <code>PluginInitializer</code> |
| [ResolvedSimpleSavedObject](./kibana-plugin-core-public.resolvedsimplesavedobject.md) | This interface is a very simple wrapper for SavedObjects resolved from the server with the [SavedObjectsClient](./kibana-plugin-core-public.savedobjectsclient.md)<!-- -->. |
| [ResolvedSimpleSavedObject](./kibana-plugin-core-public.resolvedsimplesavedobject.md) | This interface is a very simple wrapper for SavedObjects resolved from the server with the [SavedObjectsClientContract](./kibana-plugin-core-public.savedobjectsclientcontract.md)<!-- -->. |
| [ResponseErrorBody](./kibana-plugin-core-public.responseerrorbody.md) | |
| [SavedObject](./kibana-plugin-core-public.savedobject.md) | |
| [SavedObjectAttributes](./kibana-plugin-core-public.savedobjectattributes.md) | The data for a Saved Object is stored as an object in the <code>attributes</code> property. |
@ -113,6 +112,7 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->
| [SavedObjectsBulkResolveResponse](./kibana-plugin-core-public.savedobjectsbulkresolveresponse.md) | |
| [SavedObjectsBulkUpdateObject](./kibana-plugin-core-public.savedobjectsbulkupdateobject.md) | |
| [SavedObjectsBulkUpdateOptions](./kibana-plugin-core-public.savedobjectsbulkupdateoptions.md) | |
| [SavedObjectsClientContract](./kibana-plugin-core-public.savedobjectsclientcontract.md) | The client-side SavedObjectsClient is a thin convenience library around the SavedObjects HTTP API for interacting with Saved Objects. |
| [SavedObjectsCollectMultiNamespaceReferencesResponse](./kibana-plugin-core-public.savedobjectscollectmultinamespacereferencesresponse.md) | The response when object references are collected. |
| [SavedObjectsCreateOptions](./kibana-plugin-core-public.savedobjectscreateoptions.md) | |
| [SavedObjectsFindOptions](./kibana-plugin-core-public.savedobjectsfindoptions.md) | |
@ -178,7 +178,6 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->
| [ResolveDeprecationResponse](./kibana-plugin-core-public.resolvedeprecationresponse.md) | |
| [SavedObjectAttribute](./kibana-plugin-core-public.savedobjectattribute.md) | Type definition for a Saved Object attribute value |
| [SavedObjectAttributeSingle](./kibana-plugin-core-public.savedobjectattributesingle.md) | Don't use this type, it's simply a helper type for [SavedObjectAttribute](./kibana-plugin-core-public.savedobjectattribute.md) |
| [SavedObjectsClientContract](./kibana-plugin-core-public.savedobjectsclientcontract.md) | SavedObjectsClientContract as implemented by the [SavedObjectsClient](./kibana-plugin-core-public.savedobjectsclient.md) |
| [SavedObjectsImportWarning](./kibana-plugin-core-public.savedobjectsimportwarning.md) | Composite type of all the possible types of import warnings.<!-- -->See [SavedObjectsImportSimpleWarning](./kibana-plugin-core-public.savedobjectsimportsimplewarning.md) and [SavedObjectsImportActionRequiredWarning](./kibana-plugin-core-public.savedobjectsimportactionrequiredwarning.md) for more details. |
| [SavedObjectsNamespaceType](./kibana-plugin-core-public.savedobjectsnamespacetype.md) | The namespace type dictates how a saved object can be interacted in relation to namespaces. Each type is mutually exclusive: \* single (default): This type of saved object is namespace-isolated, e.g., it exists in only one namespace. \* multiple: This type of saved object is shareable, e.g., it can exist in one or more namespaces. \* multiple-isolated: This type of saved object is namespace-isolated, e.g., it exists in only one namespace, but object IDs must be unique across all namespaces. This is intended to be an intermediate step when objects with a "single" namespace type are being converted to a "multiple" namespace type. In other words, objects with a "multiple-isolated" namespace type will be \*share-capable\*, but will not actually be shareable until the namespace type is changed to "multiple". \* agnostic: This type of saved object is global. |
| [StartServicesAccessor](./kibana-plugin-core-public.startservicesaccessor.md) | Allows plugins to get access to APIs available in start inside async handlers, such as [App.mount](./kibana-plugin-core-public.app.mount.md)<!-- -->. Promise will not resolve until Core and plugin dependencies have completed <code>start</code>. |

View file

@ -4,7 +4,7 @@
## ResolvedSimpleSavedObject interface
This interface is a very simple wrapper for SavedObjects resolved from the server with the [SavedObjectsClient](./kibana-plugin-core-public.savedobjectsclient.md)<!-- -->.
This interface is a very simple wrapper for SavedObjects resolved from the server with the [SavedObjectsClientContract](./kibana-plugin-core-public.savedobjectsclientcontract.md)<!-- -->.
<b>Signature:</b>

View file

@ -15,5 +15,5 @@ export interface SavedObjectsBulkResolveResponse<T = unknown>
| Property | Type | Description |
| --- | --- | --- |
| [resolved\_objects](./kibana-plugin-core-public.savedobjectsbulkresolveresponse.resolved_objects.md) | Array&lt;SavedObjectsResolveResponse&lt;T&gt;&gt; | |
| [resolved\_objects](./kibana-plugin-core-public.savedobjectsbulkresolveresponse.resolved_objects.md) | Array&lt;ResolvedSimpleSavedObject&lt;T&gt;&gt; | |

View file

@ -7,5 +7,5 @@
<b>Signature:</b>
```typescript
resolved_objects: Array<SavedObjectsResolveResponse<T>>;
resolved_objects: Array<ResolvedSimpleSavedObject<T>>;
```

View file

@ -1,13 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-core-public](./kibana-plugin-core-public.md) &gt; [SavedObjectsClient](./kibana-plugin-core-public.savedobjectsclient.md) &gt; [bulkCreate](./kibana-plugin-core-public.savedobjectsclient.bulkcreate.md)
## SavedObjectsClient.bulkCreate property
Creates multiple documents at once
<b>Signature:</b>
```typescript
bulkCreate: (objects?: SavedObjectsBulkCreateObject[], options?: SavedObjectsBulkCreateOptions) => Promise<SavedObjectsBatchResponse<unknown>>;
```

View file

@ -1,21 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-core-public](./kibana-plugin-core-public.md) &gt; [SavedObjectsClient](./kibana-plugin-core-public.savedobjectsclient.md) &gt; [bulkGet](./kibana-plugin-core-public.savedobjectsclient.bulkget.md)
## SavedObjectsClient.bulkGet property
Returns an array of objects by id
<b>Signature:</b>
```typescript
bulkGet: (objects?: Array<{
id: string;
type: string;
}>) => Promise<SavedObjectsBatchResponse<unknown>>;
```
## Example
bulkGet(\[ { id: 'one', type: 'config' }<!-- -->, { id: 'foo', type: 'index-pattern' } \])

View file

@ -1,13 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-core-public](./kibana-plugin-core-public.md) &gt; [SavedObjectsClient](./kibana-plugin-core-public.savedobjectsclient.md) &gt; [create](./kibana-plugin-core-public.savedobjectsclient.create.md)
## SavedObjectsClient.create property
Persists an object
<b>Signature:</b>
```typescript
create: <T = unknown>(type: string, attributes: T, options?: SavedObjectsCreateOptions) => Promise<SimpleSavedObject<T>>;
```

View file

@ -1,13 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-core-public](./kibana-plugin-core-public.md) &gt; [SavedObjectsClient](./kibana-plugin-core-public.savedobjectsclient.md) &gt; [delete](./kibana-plugin-core-public.savedobjectsclient.delete.md)
## SavedObjectsClient.delete property
Deletes an object
<b>Signature:</b>
```typescript
delete: (type: string, id: string, options?: SavedObjectsDeleteOptions | undefined) => ReturnType<SavedObjectsApi['delete']>;
```

View file

@ -1,13 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-core-public](./kibana-plugin-core-public.md) &gt; [SavedObjectsClient](./kibana-plugin-core-public.savedobjectsclient.md) &gt; [find](./kibana-plugin-core-public.savedobjectsclient.find.md)
## SavedObjectsClient.find property
Search for objects
<b>Signature:</b>
```typescript
find: <T = unknown, A = unknown>(options: SavedObjectsFindOptions) => Promise<SavedObjectsFindResponsePublic<T, unknown>>;
```

View file

@ -1,13 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-core-public](./kibana-plugin-core-public.md) &gt; [SavedObjectsClient](./kibana-plugin-core-public.savedobjectsclient.md) &gt; [get](./kibana-plugin-core-public.savedobjectsclient.get.md)
## SavedObjectsClient.get property
Fetches a single object
<b>Signature:</b>
```typescript
get: <T = unknown>(type: string, id: string) => Promise<SimpleSavedObject<T>>;
```

View file

@ -1,38 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-core-public](./kibana-plugin-core-public.md) &gt; [SavedObjectsClient](./kibana-plugin-core-public.savedobjectsclient.md)
## SavedObjectsClient class
Saved Objects is Kibana's data persisentence mechanism allowing plugins to use Elasticsearch for storing plugin state. The client-side SavedObjectsClient is a thin convenience library around the SavedObjects HTTP API for interacting with Saved Objects.
<b>Signature:</b>
```typescript
export declare class SavedObjectsClient
```
## Remarks
The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the `SavedObjectsClient` class.
## Properties
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [bulkCreate](./kibana-plugin-core-public.savedobjectsclient.bulkcreate.md) | | (objects?: SavedObjectsBulkCreateObject\[\], options?: SavedObjectsBulkCreateOptions) =&gt; Promise&lt;SavedObjectsBatchResponse&lt;unknown&gt;&gt; | Creates multiple documents at once |
| [bulkGet](./kibana-plugin-core-public.savedobjectsclient.bulkget.md) | | (objects?: Array&lt;{ id: string; type: string; }&gt;) =&gt; Promise&lt;SavedObjectsBatchResponse&lt;unknown&gt;&gt; | Returns an array of objects by id |
| [bulkResolve](./kibana-plugin-core-public.savedobjectsclient.bulkresolve.md) | | &lt;T = unknown&gt;(objects?: Array&lt;{ id: string; type: string; }&gt;) =&gt; Promise&lt;{ resolved\_objects: ResolvedSimpleSavedObject&lt;T&gt;\[\]; }&gt; | Resolves an array of objects by id, using any legacy URL aliases if they exist |
| [create](./kibana-plugin-core-public.savedobjectsclient.create.md) | | &lt;T = unknown&gt;(type: string, attributes: T, options?: SavedObjectsCreateOptions) =&gt; Promise&lt;SimpleSavedObject&lt;T&gt;&gt; | Persists an object |
| [delete](./kibana-plugin-core-public.savedobjectsclient.delete.md) | | (type: string, id: string, options?: SavedObjectsDeleteOptions \| undefined) =&gt; ReturnType&lt;SavedObjectsApi\['delete'\]&gt; | Deletes an object |
| [find](./kibana-plugin-core-public.savedobjectsclient.find.md) | | &lt;T = unknown, A = unknown&gt;(options: SavedObjectsFindOptions) =&gt; Promise&lt;SavedObjectsFindResponsePublic&lt;T, unknown&gt;&gt; | Search for objects |
| [get](./kibana-plugin-core-public.savedobjectsclient.get.md) | | &lt;T = unknown&gt;(type: string, id: string) =&gt; Promise&lt;SimpleSavedObject&lt;T&gt;&gt; | Fetches a single object |
| [resolve](./kibana-plugin-core-public.savedobjectsclient.resolve.md) | | &lt;T = unknown&gt;(type: string, id: string) =&gt; Promise&lt;ResolvedSimpleSavedObject&lt;T&gt;&gt; | Resolves a single object |
## Methods
| Method | Modifiers | Description |
| --- | --- | --- |
| [bulkUpdate(objects)](./kibana-plugin-core-public.savedobjectsclient.bulkupdate.md) | | Update multiple documents at once |
| [update(type, id, attributes, { version, references, upsert })](./kibana-plugin-core-public.savedobjectsclient.update.md) | | Updates an object |

View file

@ -1,13 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-core-public](./kibana-plugin-core-public.md) &gt; [SavedObjectsClient](./kibana-plugin-core-public.savedobjectsclient.md) &gt; [resolve](./kibana-plugin-core-public.savedobjectsclient.resolve.md)
## SavedObjectsClient.resolve property
Resolves a single object
<b>Signature:</b>
```typescript
resolve: <T = unknown>(type: string, id: string) => Promise<ResolvedSimpleSavedObject<T>>;
```

View file

@ -1,28 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-core-public](./kibana-plugin-core-public.md) &gt; [SavedObjectsClient](./kibana-plugin-core-public.savedobjectsclient.md) &gt; [update](./kibana-plugin-core-public.savedobjectsclient.update.md)
## SavedObjectsClient.update() method
Updates an object
<b>Signature:</b>
```typescript
update<T = unknown>(type: string, id: string, attributes: T, { version, references, upsert }?: SavedObjectsUpdateOptions): Promise<SimpleSavedObject<T>>;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| type | string | |
| id | string | |
| attributes | T | |
| { version, references, upsert } | SavedObjectsUpdateOptions | |
<b>Returns:</b>
Promise&lt;SimpleSavedObject&lt;T&gt;&gt;

View file

@ -0,0 +1,27 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-core-public](./kibana-plugin-core-public.md) &gt; [SavedObjectsClientContract](./kibana-plugin-core-public.savedobjectsclientcontract.md) &gt; [bulkCreate](./kibana-plugin-core-public.savedobjectsclientcontract.bulkcreate.md)
## SavedObjectsClientContract.bulkCreate() method
Creates multiple documents at once
<b>Signature:</b>
```typescript
bulkCreate(objects: SavedObjectsBulkCreateObject[], options?: SavedObjectsBulkCreateOptions): Promise<SavedObjectsBatchResponse<unknown>>;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| objects | SavedObjectsBulkCreateObject\[\] | |
| options | SavedObjectsBulkCreateOptions | |
<b>Returns:</b>
Promise&lt;SavedObjectsBatchResponse&lt;unknown&gt;&gt;
The result of the create operation containing created saved objects.

View file

@ -0,0 +1,33 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-core-public](./kibana-plugin-core-public.md) &gt; [SavedObjectsClientContract](./kibana-plugin-core-public.savedobjectsclientcontract.md) &gt; [bulkGet](./kibana-plugin-core-public.savedobjectsclientcontract.bulkget.md)
## SavedObjectsClientContract.bulkGet() method
Returns an array of objects by id
<b>Signature:</b>
```typescript
bulkGet(objects: Array<{
id: string;
type: string;
}>): Promise<SavedObjectsBatchResponse<unknown>>;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| objects | Array&lt;{ id: string; type: string; }&gt; | an array ids, or an array of objects containing id and optionally type |
<b>Returns:</b>
Promise&lt;SavedObjectsBatchResponse&lt;unknown&gt;&gt;
The saved objects with the given type and ids requested
## Example
bulkGet(\[ { id: 'one', type: 'config' }<!-- -->, { id: 'foo', type: 'index-pattern' } \])

View file

@ -1,22 +1,32 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-core-public](./kibana-plugin-core-public.md) &gt; [SavedObjectsClient](./kibana-plugin-core-public.savedobjectsclient.md) &gt; [bulkResolve](./kibana-plugin-core-public.savedobjectsclient.bulkresolve.md)
[Home](./index.md) &gt; [kibana-plugin-core-public](./kibana-plugin-core-public.md) &gt; [SavedObjectsClientContract](./kibana-plugin-core-public.savedobjectsclientcontract.md) &gt; [bulkResolve](./kibana-plugin-core-public.savedobjectsclientcontract.bulkresolve.md)
## SavedObjectsClient.bulkResolve property
## SavedObjectsClientContract.bulkResolve() method
Resolves an array of objects by id, using any legacy URL aliases if they exist
<b>Signature:</b>
```typescript
bulkResolve: <T = unknown>(objects?: Array<{
bulkResolve<T = unknown>(objects: Array<{
id: string;
type: string;
}>) => Promise<{
resolved_objects: ResolvedSimpleSavedObject<T>[];
}>;
}>): Promise<SavedObjectsBulkResolveResponse<T>>;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| objects | Array&lt;{ id: string; type: string; }&gt; | an array of objects containing id, type |
<b>Returns:</b>
Promise&lt;SavedObjectsBulkResolveResponse&lt;T&gt;&gt;
The bulk resolve result for the saved objects for the given types and ids.
## Example
bulkResolve(\[ { id: 'one', type: 'config' }<!-- -->, { id: 'foo', type: 'index-pattern' } \])

View file

@ -1,15 +1,15 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-core-public](./kibana-plugin-core-public.md) &gt; [SavedObjectsClient](./kibana-plugin-core-public.savedobjectsclient.md) &gt; [bulkUpdate](./kibana-plugin-core-public.savedobjectsclient.bulkupdate.md)
[Home](./index.md) &gt; [kibana-plugin-core-public](./kibana-plugin-core-public.md) &gt; [SavedObjectsClientContract](./kibana-plugin-core-public.savedobjectsclientcontract.md) &gt; [bulkUpdate](./kibana-plugin-core-public.savedobjectsclientcontract.bulkupdate.md)
## SavedObjectsClient.bulkUpdate() method
## SavedObjectsClientContract.bulkUpdate() method
Update multiple documents at once
<b>Signature:</b>
```typescript
bulkUpdate<T = unknown>(objects?: SavedObjectsBulkUpdateObject[]): Promise<SavedObjectsBatchResponse<T>>;
bulkUpdate<T = unknown>(objects: SavedObjectsBulkUpdateObject[]): Promise<SavedObjectsBatchResponse<T>>;
```
## Parameters

View file

@ -0,0 +1,26 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-core-public](./kibana-plugin-core-public.md) &gt; [SavedObjectsClientContract](./kibana-plugin-core-public.savedobjectsclientcontract.md) &gt; [create](./kibana-plugin-core-public.savedobjectsclientcontract.create.md)
## SavedObjectsClientContract.create() method
Persists an object
<b>Signature:</b>
```typescript
create<T = unknown>(type: string, attributes: T, options?: SavedObjectsCreateOptions): Promise<SimpleSavedObject<T>>;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| type | string | |
| attributes | T | |
| options | SavedObjectsCreateOptions | |
<b>Returns:</b>
Promise&lt;SimpleSavedObject&lt;T&gt;&gt;

View file

@ -0,0 +1,26 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-core-public](./kibana-plugin-core-public.md) &gt; [SavedObjectsClientContract](./kibana-plugin-core-public.savedobjectsclientcontract.md) &gt; [delete](./kibana-plugin-core-public.savedobjectsclientcontract.delete.md)
## SavedObjectsClientContract.delete() method
Deletes an object
<b>Signature:</b>
```typescript
delete(type: string, id: string, options?: SavedObjectsDeleteOptions): Promise<{}>;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| type | string | |
| id | string | |
| options | SavedObjectsDeleteOptions | |
<b>Returns:</b>
Promise&lt;{}&gt;

View file

@ -0,0 +1,26 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-core-public](./kibana-plugin-core-public.md) &gt; [SavedObjectsClientContract](./kibana-plugin-core-public.savedobjectsclientcontract.md) &gt; [find](./kibana-plugin-core-public.savedobjectsclientcontract.find.md)
## SavedObjectsClientContract.find() method
Search for objects
<b>Signature:</b>
```typescript
find<T = unknown, A = unknown>(options: SavedObjectsFindOptions): Promise<SavedObjectsFindResponsePublic<T>>;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| options | SavedObjectsFindOptions | {<!-- -->string<!-- -->} options.type {<!-- -->string<!-- -->} options.search {<!-- -->string<!-- -->} options.searchFields - see Elasticsearch Simple Query String Query field argument for more information {<!-- -->integer<!-- -->} \[options.page=1\] {<!-- -->integer<!-- -->} \[options.perPage=20\] {<!-- -->array<!-- -->} options.fields {<!-- -->object<!-- -->} \[options.hasReference\] - { type, id } |
<b>Returns:</b>
Promise&lt;SavedObjectsFindResponsePublic&lt;T&gt;&gt;
A find result with objects matching the specified search.

View file

@ -0,0 +1,27 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-core-public](./kibana-plugin-core-public.md) &gt; [SavedObjectsClientContract](./kibana-plugin-core-public.savedobjectsclientcontract.md) &gt; [get](./kibana-plugin-core-public.savedobjectsclientcontract.get.md)
## SavedObjectsClientContract.get() method
Fetches a single object
<b>Signature:</b>
```typescript
get<T = unknown>(type: string, id: string): Promise<SimpleSavedObject<T>>;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| type | string | |
| id | string | |
<b>Returns:</b>
Promise&lt;SimpleSavedObject&lt;T&gt;&gt;
The saved object for the given type and id.

View file

@ -2,12 +2,28 @@
[Home](./index.md) &gt; [kibana-plugin-core-public](./kibana-plugin-core-public.md) &gt; [SavedObjectsClientContract](./kibana-plugin-core-public.savedobjectsclientcontract.md)
## SavedObjectsClientContract type
## SavedObjectsClientContract interface
SavedObjectsClientContract as implemented by the [SavedObjectsClient](./kibana-plugin-core-public.savedobjectsclient.md)
The client-side SavedObjectsClient is a thin convenience library around the SavedObjects HTTP API for interacting with Saved Objects.
<b>Signature:</b>
```typescript
export declare type SavedObjectsClientContract = PublicMethodsOf<SavedObjectsClient>;
export interface SavedObjectsClientContract
```
## Methods
| Method | Description |
| --- | --- |
| [bulkCreate(objects, options)](./kibana-plugin-core-public.savedobjectsclientcontract.bulkcreate.md) | Creates multiple documents at once |
| [bulkGet(objects)](./kibana-plugin-core-public.savedobjectsclientcontract.bulkget.md) | Returns an array of objects by id |
| [bulkResolve(objects)](./kibana-plugin-core-public.savedobjectsclientcontract.bulkresolve.md) | Resolves an array of objects by id, using any legacy URL aliases if they exist |
| [bulkUpdate(objects)](./kibana-plugin-core-public.savedobjectsclientcontract.bulkupdate.md) | Update multiple documents at once |
| [create(type, attributes, options)](./kibana-plugin-core-public.savedobjectsclientcontract.create.md) | Persists an object |
| [delete(type, id, options)](./kibana-plugin-core-public.savedobjectsclientcontract.delete.md) | Deletes an object |
| [find(options)](./kibana-plugin-core-public.savedobjectsclientcontract.find.md) | Search for objects |
| [get(type, id)](./kibana-plugin-core-public.savedobjectsclientcontract.get.md) | Fetches a single object |
| [resolve(type, id)](./kibana-plugin-core-public.savedobjectsclientcontract.resolve.md) | Resolves a single object |
| [update(type, id, attributes, options)](./kibana-plugin-core-public.savedobjectsclientcontract.update.md) | Updates an object |

View file

@ -0,0 +1,29 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-core-public](./kibana-plugin-core-public.md) &gt; [SavedObjectsClientContract](./kibana-plugin-core-public.savedobjectsclientcontract.md) &gt; [resolve](./kibana-plugin-core-public.savedobjectsclientcontract.resolve.md)
## SavedObjectsClientContract.resolve() method
Resolves a single object
<b>Signature:</b>
```typescript
resolve<T = unknown>(type: string, id: string): Promise<ResolvedSimpleSavedObject<T>>;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| type | string | |
| id | string | |
<b>Returns:</b>
Promise&lt;ResolvedSimpleSavedObject&lt;T&gt;&gt;
The resolve result for the saved object for the given type and id.
Saved objects that Kibana fails to find are replaced with an error object and an "exactMatch" outcome. The rationale behind the outcome is that "exactMatch" is the default outcome, and the outcome only changes if an alias is found. This behavior for the `resolve` API is unique to the public client, which batches individual calls with `bulkResolve` under the hood. We don't throw an error in that case for legacy compatibility reasons.

View file

@ -0,0 +1,28 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-core-public](./kibana-plugin-core-public.md) &gt; [SavedObjectsClientContract](./kibana-plugin-core-public.savedobjectsclientcontract.md) &gt; [update](./kibana-plugin-core-public.savedobjectsclientcontract.update.md)
## SavedObjectsClientContract.update() method
Updates an object
<b>Signature:</b>
```typescript
update<T = unknown>(type: string, id: string, attributes: T, options?: SavedObjectsUpdateOptions): Promise<SimpleSavedObject<T>>;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| type | string | |
| id | string | |
| attributes | T | |
| options | SavedObjectsUpdateOptions | {<!-- -->integer<!-- -->} options.version - ensures version matches that of persisted object {<!-- -->object<!-- -->} options.migrationVersion - The optional migrationVersion of this document |
<b>Returns:</b>
Promise&lt;SimpleSavedObject&lt;T&gt;&gt;

View file

@ -4,7 +4,7 @@
## SavedObjectsStart.client property
[SavedObjectsClient](./kibana-plugin-core-public.savedobjectsclient.md)
[SavedObjectsClientContract](./kibana-plugin-core-public.savedobjectsclientcontract.md)
<b>Signature:</b>

View file

@ -15,5 +15,5 @@ export interface SavedObjectsStart
| Property | Type | Description |
| --- | --- | --- |
| [client](./kibana-plugin-core-public.savedobjectsstart.client.md) | SavedObjectsClientContract | [SavedObjectsClient](./kibana-plugin-core-public.savedobjectsclient.md) |
| [client](./kibana-plugin-core-public.savedobjectsstart.client.md) | SavedObjectsClientContract | [SavedObjectsClientContract](./kibana-plugin-core-public.savedobjectsclientcontract.md) |

View file

@ -4,7 +4,7 @@
## SimpleSavedObject class
This class is a very simple wrapper for SavedObjects loaded from the server with the [SavedObjectsClient](./kibana-plugin-core-public.savedobjectsclient.md)<!-- -->.
This class is a very simple wrapper for SavedObjects loaded from the server with the [SavedObjectsClientContract](./kibana-plugin-core-public.savedobjectsclientcontract.md)<!-- -->.
It provides basic functionality for creating/saving/deleting saved objects, but doesn't include any type-specific implementations.