Skip to content
This repository was archived by the owner on Mar 10, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 29 additions & 29 deletions docs/@ceramic-sdk/model-client/classes/ModelClient.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
Represents a client for interacting with Ceramic models.

The `ModelClient` class extends the `StreamClient` class to provide additional
methods specific to working with Ceramic models, including fetching and posting
methods specific to working with Ceramic models, including fetching and creating
model definitions, retrieving initialization events, and decoding stream data.

## Extends
Expand Down Expand Up @@ -62,6 +62,34 @@ The `CeramicClient` instance associated with this StreamClient.

## Methods

### createDefinition()

> **createDefinition**(`definition`, `signer`?): `Promise`\<[`StreamID`](../../identifiers/classes/StreamID.md)\>

Creates a model definition and returns the resulting stream ID.

#### Parameters

• **definition**: `MapIn`\<`RequiredProps`\<`object`\>, `$TypeOf`\> & `MapIn`\<`OptionalProps`\<`object`\>, `$TypeOf`\> \| `MapIn`\<`RequiredProps`\<`object`\>, `$TypeOf`\> & `MapIn`\<`OptionalProps`\<`object`\>, `$TypeOf`\>

The model JSON definition to post.

• **signer?**: `DID`

(Optional) A `DID` instance for signing the model definition.

#### Returns

`Promise`\<[`StreamID`](../../identifiers/classes/StreamID.md)\>

A promise that resolves to the `StreamID` of the posted model.

#### Throws

Will throw an error if the definition is invalid or the signing process fails.

***

### getDID()

> **getDID**(`provided`?): `DID`
Expand Down Expand Up @@ -236,31 +264,3 @@ console.log(streamState);
#### Inherited from

[`StreamClient`](../../stream-client/classes/StreamClient.md).[`getStreamState`](../../stream-client/classes/StreamClient.md#getstreamstate)

***

### postDefinition()

> **postDefinition**(`definition`, `signer`?): `Promise`\<[`StreamID`](../../identifiers/classes/StreamID.md)\>

Posts a model definition and returns the resulting stream ID.

#### Parameters

• **definition**: `MapIn`\<`RequiredProps`\<`object`\>, `$TypeOf`\> & `MapIn`\<`OptionalProps`\<`object`\>, `$TypeOf`\> \| `MapIn`\<`RequiredProps`\<`object`\>, `$TypeOf`\> & `MapIn`\<`OptionalProps`\<`object`\>, `$TypeOf`\>

The model JSON definition to post.

• **signer?**: `DID`

(Optional) A `DID` instance for signing the model definition.

#### Returns

`Promise`\<[`StreamID`](../../identifiers/classes/StreamID.md)\>

A promise that resolves to the `StreamID` of the posted model.

#### Throws

Will throw an error if the definition is invalid or the signing process fails.
4 changes: 2 additions & 2 deletions docs/@ceramic-sdk/model-instance-client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@

- [CreateDataEventParams](type-aliases/CreateDataEventParams.md)
- [CreateInitEventParams](type-aliases/CreateInitEventParams.md)
- [CreateInstanceParams](type-aliases/CreateInstanceParams.md)
- [CreateSingletonParams](type-aliases/CreateSingletonParams.md)
- [PostDataParams](type-aliases/PostDataParams.md)
- [PostDeterministicInitParams](type-aliases/PostDeterministicInitParams.md)
- [PostSignedInitParams](type-aliases/PostSignedInitParams.md)
- [UnknownContent](type-aliases/UnknownContent.md)

## Functions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Extends the StreamClient to add functionality for interacting with Ceramic model

The `ModelInstanceClient` class provides methods to:
- Retrieve events and document states
- Post deterministic and signed initialization events
- Create instances and singleton of models
- Update existing documents with new content

## Extends
Expand Down Expand Up @@ -63,6 +63,43 @@ The `CeramicClient` instance associated with this StreamClient.

## Methods

### createInstance()

> **createInstance**\<`T`\>(`params`): `Promise`\<[`CommitID`](../../identifiers/classes/CommitID.md)\>

Creates an instance of a model. The model must have an account relation of list or set.

#### Type Parameters

• **T** *extends* [`UnknownContent`](../type-aliases/UnknownContent.md) = [`UnknownContent`](../type-aliases/UnknownContent.md)

#### Parameters

• **params**: [`CreateInstanceParams`](../type-aliases/CreateInstanceParams.md)\<`T`\>

#### Returns

`Promise`\<[`CommitID`](../../identifiers/classes/CommitID.md)\>

***

### createSingleton()

> **createSingleton**(`params`): `Promise`\<[`CommitID`](../../identifiers/classes/CommitID.md)\>

Creates an instance of a model with account relation single.
By definition this instance will always be a singleton.

#### Parameters

• **params**: [`CreateSingletonParams`](../type-aliases/CreateSingletonParams.md)

#### Returns

`Promise`\<[`CommitID`](../../identifiers/classes/CommitID.md)\>

***

### getCurrentID()

> **getCurrentID**(`streamID`): [`CommitID`](../../identifiers/classes/CommitID.md)
Expand Down Expand Up @@ -241,61 +278,6 @@ current state of the stream.

***

### postDeterministicInit()

> **postDeterministicInit**(`params`): `Promise`\<[`CommitID`](../../identifiers/classes/CommitID.md)\>

Posts a deterministic initialization event and returns its commit ID.

#### Parameters

• **params**: [`PostDeterministicInitParams`](../type-aliases/PostDeterministicInitParams.md)

Parameters for posting the deterministic init event.

#### Returns

`Promise`\<[`CommitID`](../../identifiers/classes/CommitID.md)\>

A promise that resolves to the `CommitID` of the posted event.

#### Remarks

This method ensures that the resulting stream ID is deterministic, derived
from the `uniqueValue` parameter. Commonly used for model instance documents
of type `set` and `single`.

***

### postSignedInit()

> **postSignedInit**\<`T`\>(`params`): `Promise`\<[`CommitID`](../../identifiers/classes/CommitID.md)\>

Posts a signed initialization event and returns its commit ID.

#### Type Parameters

• **T** *extends* [`UnknownContent`](../type-aliases/UnknownContent.md) = [`UnknownContent`](../type-aliases/UnknownContent.md)

#### Parameters

• **params**: [`PostSignedInitParams`](../type-aliases/PostSignedInitParams.md)\<`T`\>

Parameters for posting the signed init event.

#### Returns

`Promise`\<[`CommitID`](../../identifiers/classes/CommitID.md)\>

A promise that resolves to the `CommitID` of the posted event.

#### Remarks

This method results in a non-deterministic stream ID, typically used for
model instance documents of type `list`.

***

### streamStateToDocumentState()

> **streamStateToDocumentState**(`streamState`): `DocumentState`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

***

[Ceramic SDK](../../../README.md) / [@ceramic-sdk/model-instance-client](../README.md) / PostSignedInitParams
[Ceramic SDK](../../../README.md) / [@ceramic-sdk/model-instance-client](../README.md) / CreateInstanceParams

# Type Alias: PostSignedInitParams\<T\>
# Type Alias: CreateInstanceParams\<T\>

> **PostSignedInitParams**\<`T`\>: `Omit`\<[`CreateInitEventParams`](CreateInitEventParams.md)\<`T`\>, `"controller"`\> & `object`
> **CreateInstanceParams**\<`T`\>: `Omit`\<[`CreateInitEventParams`](CreateInitEventParams.md)\<`T`\>, `"controller"`\> & `object`

Parameters for posting a signed initialization event.
Parameters for creating an instance of a model.

## Type declaration

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

***

[Ceramic SDK](../../../README.md) / [@ceramic-sdk/model-instance-client](../README.md) / PostDeterministicInitParams
[Ceramic SDK](../../../README.md) / [@ceramic-sdk/model-instance-client](../README.md) / CreateSingletonParams

# Type Alias: PostDeterministicInitParams
# Type Alias: CreateSingletonParams

> **PostDeterministicInitParams**: `object`
> **CreateSingletonParams**: `object`

Parameters for posting a deterministic initialization event.
Parameters for creating a singleton instance of a model.

## Type declaration

Expand Down
34 changes: 0 additions & 34 deletions docs/@ceramic-sdk/model-instance-handler/README.md

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading