0.0.3HearRo SDK
Abstraction for interacting with the HearRo API.
The SDK will manage the GraphQL client and handle packing/unpacking DidComm messages where appropriate.
Almost All functions return promises that can be async/awaited to recieve the results of the function.
Most API interaction with HearRo is via DidComm messages with the User's agent. All HearRo users have a static connection to their cloud agent, and the keys for interacting with this agent are provided in their embeded wallet. This wallet is never sent over the wire unencrypted - once they log in, the wallet must be opened (decrypted) locally. At this point the user will be able to interact with their cloud agent, who is responsible for managing their cloud wallet and all their conections to HearRo resources.
Log's out the user.
Closes their wallet and removes stored user data
Get user's connections
Promise<(Array<Connection> | Error)>:
array of connections
Get user's conversations
Promise<(Array<Conversation> | Error)>:
array of conversations
Add a participant to the conversation
This will add a participant that the user is already connected with (see hearro#connections)
Promise<(Null | Error)>:
resolves if the participant was sucessfully added
Invite a user to a conversation
This sends a conversation invite to the user's email. At the moment this is scoped to the organization that is accessing the API. The invite will show up in the user's invite list
Promise<(Null | Error)>:
resolves when the invite was sent
Load existing Convesation Messages
Promise<(Array<ConversationMessage> | Error)>:
array of conversation messages
Subscribe to conversation messages
This function will return a susbscription to the conversation message stream
Promise<(CovnersationSubscription | Error)>:
subscription to conversation message stream
var cMessages = hearrosdk.subscribeConversationMessages({ conversationId: foo })
cMessages.subscribe({
next({ message }) {
console.log("messge received", message)
},
error (err) {
console.log("error with the subscription", err.message)
}
})
Create a new conversation
(String)
add a user friendly label to the conversation meta
(Array<String>)
list of initial participants to add. These are the connectionIds of existing connections
retreived from
connections
Get a list of items in conversation
This call omits the data field in the ConversationItem. To download the conversation item use loadConversationItemData
Promise<(Array<ConversationItem> | Error)>:
array of conversation items
Create a new conversation item
This is step one of two for uploading data to a conversation. It provisions the item and returns an item id that can be used to push the data to the conversation.
Save conversation item data
This allows you to upload data for a previously created item. This uses the FileReader api to read binary data from the provided file param. This binary data is base64 encoded before being sent over the wire to the conversation
Get RTC Session details
Returns detailed information about an RTC Session
Promise<(RTCSession | Error)>:
rec session information
Type: Object
Type: Object
Type: Object
Type: Object
Type: Object
(String)
: conversation participant that owns the item
(String)
: id of the item in the conversation. While universally unique, only accessible in the context of the conversation.
(String)
: id of the conversation this item belongs to
(String)
: name of the item
(String)
: mime type of the item (e.g. "application/pdf")
(Number)
: size of the item
(Number)
: status of the item (Created, Error, Completed)
(String)
: base64 encoded raw data for the item
(Object)
: additional optional metadata for this object
Type: Object
Type: Object
Type: Object
Type: Object
Type: Object
(String)
: message body
(String)
: id of the conversation
(String)
: id over the message
(String)
: conversation Peer DID for the sender
(String)
: RFC3339 timestamp when the sender sent the message
(String)
: RFC3339 timestemp when HearRo received the message
Type: Object
(String)
: rtc session did
(String)
: id of the conversation that owns this session
((Array | undefined))
: list of allowed participants. If undefined all conversation participants may join
(String)
: did of the participant that created the session
(String)
: RFC3339 timestamp when the session was started
(String)
: HearRo rtc server responsible for this session
(Number)
: session state. Allowed values are: Active - 0; Locked - 1; Finished - 3; Archived - 4