Skip to content

Commit

Permalink
Update generated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulLeCam committed Apr 16, 2024
1 parent 410a332 commit 6ff9e9e
Show file tree
Hide file tree
Showing 12 changed files with 1,244 additions and 642 deletions.
23 changes: 8 additions & 15 deletions demo/server/src/controllers/multiController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const getContextAggregation = async (
const { recipient, context } = req.body

//instantiate a reader
const reader = new PointsReader({
const reader = PointsReader.create({
ceramic,
issuer: ceramic.did!.id,
aggregationModelID,
Expand Down Expand Up @@ -75,7 +75,7 @@ const getTotalAggregation = async (
const { recipient } = req.body

//instantiate a reader
const reader = new PointsReader({
const reader = PointsReader.create({
ceramic,
issuer: ceramic.did!.id,
})
Expand All @@ -101,20 +101,14 @@ const updateContextAggregation = async (
const { ceramic, aggregationModelID } = await getContext()
const { amount, recipient, context } = req.body

//instantiate a writer and reader
const contextWriter = new PointsWriter<ContextAggregationContent>({
//instantiate a writer
const contextWriter = PointsWriter.fromAuthenticated<ContextAggregationContent>({
ceramic,
aggregationModelID,
})

const contextReader = new PointsReader({
ceramic,
issuer: ceramic.did!.id,
aggregationModelID,
})

// load the document for the recipient and context
const doc = await contextReader.loadAggregationDocumentFor([recipient, context])
const doc = await contextWriter.loadAggregationDocumentFor([recipient, context])
if (!doc) {
await contextWriter.setPointsAggregationFor([recipient, context], amount, {
recipient,
Expand Down Expand Up @@ -159,12 +153,11 @@ const updateTotalAggregation = async (
const { ceramic } = await getContext()
const { amount, recipient } = req.body

//instantiate a writer and reader
const totalWriter = new PointsWriter({ ceramic })
const totalReader = new PointsReader({ ceramic, issuer: ceramic.did!.id })
//instantiate a writer
const totalWriter = PointsWriter.fromAuthenticated({ ceramic })

// load the document for the recipient and context
const doc = await totalReader.loadAggregationDocumentFor([recipient])
const doc = await totalWriter.loadAggregationDocumentFor([recipient])
if (!doc) {
await totalWriter.setPointsAggregationFor([recipient], amount, {
recipient,
Expand Down
158 changes: 158 additions & 0 deletions docs/api/classes/points.GenericReader.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
# Class: GenericReader\<Content\>

[points](../modules/points.md).GenericReader

## Type parameters

| Name | Type |
| :------ | :------ |
| `Content` | extends `PointsContent` = `PointsContent` |

## Hierarchy

- **`GenericReader`**

[`ListWriter`](points.ListWriter.md)

[`SetReader`](points.SetReader.md)

## Table of contents

### Constructors

- [constructor](points.GenericReader.md#constructor)

### Accessors

- [ceramic](points.GenericReader.md#ceramic)
- [issuer](points.GenericReader.md#issuer)
- [loader](points.GenericReader.md#loader)
- [modelID](points.GenericReader.md#modelid)

### Methods

- [queryDocuments](points.GenericReader.md#querydocuments)
- [queryDocumentsFor](points.GenericReader.md#querydocumentsfor)

## Constructors

### constructor

**new GenericReader**\<`Content`\>(`params`): [`GenericReader`](points.GenericReader.md)\<`Content`\>

#### Type parameters

| Name | Type |
| :------ | :------ |
| `Content` | extends `PointsContent` = `PointsContent` |

#### Parameters

| Name | Type |
| :------ | :------ |
| `params` | [`GenericReaderParams`](../modules/points.md#genericreaderparams) |

#### Returns

[`GenericReader`](points.GenericReader.md)\<`Content`\>

#### Defined in

[libraries/points/src/generic-reader.ts:24](https://github.com/ceramicstudio/solutions-sdk/blob/410a332e8e4d42d225b25ac7932f63038da217ad/libraries/points/src/generic-reader.ts#L24)

## Accessors

### ceramic

`get` **ceramic**(): `CeramicAPI`

#### Returns

`CeramicAPI`

#### Defined in

[libraries/points/src/generic-reader.ts:41](https://github.com/ceramicstudio/solutions-sdk/blob/410a332e8e4d42d225b25ac7932f63038da217ad/libraries/points/src/generic-reader.ts#L41)

___

### issuer

`get` **issuer**(): `string`

#### Returns

`string`

#### Defined in

[libraries/points/src/generic-reader.ts:33](https://github.com/ceramicstudio/solutions-sdk/blob/410a332e8e4d42d225b25ac7932f63038da217ad/libraries/points/src/generic-reader.ts#L33)

___

### loader

`get` **loader**(): `DocumentLoader`

#### Returns

`DocumentLoader`

#### Defined in

[libraries/points/src/generic-reader.ts:45](https://github.com/ceramicstudio/solutions-sdk/blob/410a332e8e4d42d225b25ac7932f63038da217ad/libraries/points/src/generic-reader.ts#L45)

___

### modelID

`get` **modelID**(): `string`

#### Returns

`string`

#### Defined in

[libraries/points/src/generic-reader.ts:37](https://github.com/ceramicstudio/solutions-sdk/blob/410a332e8e4d42d225b25ac7932f63038da217ad/libraries/points/src/generic-reader.ts#L37)

## Methods

### queryDocuments

**queryDocuments**(`options?`): `Promise`\<[`QueryDocumentsResult`](../modules/points.md#querydocumentsresult)\<`Content`\>\>

#### Parameters

| Name | Type |
| :------ | :------ |
| `options?` | [`QueryDocumentsOptions`](../modules/points.md#querydocumentsoptions) |

#### Returns

`Promise`\<[`QueryDocumentsResult`](../modules/points.md#querydocumentsresult)\<`Content`\>\>

#### Defined in

[libraries/points/src/generic-reader.ts:49](https://github.com/ceramicstudio/solutions-sdk/blob/410a332e8e4d42d225b25ac7932f63038da217ad/libraries/points/src/generic-reader.ts#L49)

___

### queryDocumentsFor

**queryDocumentsFor**(`did`, `options?`): `Promise`\<[`QueryDocumentsResult`](../modules/points.md#querydocumentsresult)\<`Content`\>\>

#### Parameters

| Name | Type |
| :------ | :------ |
| `did` | `string` |
| `options?` | [`QueryDocumentsOptions`](../modules/points.md#querydocumentsoptions) |

#### Returns

`Promise`\<[`QueryDocumentsResult`](../modules/points.md#querydocumentsresult)\<`Content`\>\>

#### Defined in

[libraries/points/src/generic-reader.ts:53](https://github.com/ceramicstudio/solutions-sdk/blob/410a332e8e4d42d225b25ac7932f63038da217ad/libraries/points/src/generic-reader.ts#L53)
Loading

0 comments on commit 6ff9e9e

Please sign in to comment.