File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,6 +5,10 @@ All notable changes to this module will be documented in this file.
55The format is based on [ Keep a Changelog] ( https://keepachangelog.com/en/1.0.0/ ) , and this project adheres
66to [ Semantic Versioning] ( https://semver.org/spec/v2.0.0.html ) .
77
8+ ## Unreleased
9+
10+ - [ postMessage] ( https://solid-contrib.github.io/data-modules/chats-rdflib-api/interfaces/ChatsModule.html#postMessage )
11+
812## 0.4.0
913
1014- [ readChat] ( https://solid-contrib.github.io/data-modules/chats-rdflib-api/interfaces/ChatsModule.html#readChat )
Original file line number Diff line number Diff line change 1+ import ChatsModule from "../dist/index.js" ;
2+ import { Fetcher , graph , UpdateManager } from "rdflib" ;
3+ import { faker } from "@faker-js/faker" ;
4+
5+ const store = graph ( ) ;
6+ const fetcher = new Fetcher ( store ) ;
7+ const updater = new UpdateManager ( store ) ;
8+
9+ const module = new ChatsModule ( { store, fetcher, updater } ) ;
10+
11+ const chatUri = "http://localhost:3000/alice/public/chats/lobby/index.ttl#this" ;
12+
13+ await module . postMessage ( {
14+ chatUri,
15+ text : `${ faker . word . noun ( ) } ${ faker . word . verb ( ) } ${ faker . word . adverb ( ) } ` ,
16+ authorWebId : "https://localhost:3000/alice/profile/card#me"
17+ } ) ;
18+
19+ const chat = await module . readChat ( chatUri ) ;
20+
21+ console . log ( chat . name ) ;
22+ console . table ( chat . latestMessages ) ;
You can’t perform that action at this time.
0 commit comments