Skip to content

Commit

Permalink
Add ViewChat Intent
Browse files Browse the repository at this point in the history
  • Loading branch information
symphony-jean-michael committed Nov 9, 2022
1 parent add64f8 commit 86aa01b
Show file tree
Hide file tree
Showing 4 changed files with 106 additions and 0 deletions.
103 changes: 103 additions & 0 deletions docs/intents/ref/ViewChat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
---
id: ViewChat
sidebar_label: ViewChat
title: ViewChat
hide_title: true
---
# `ViewChat`

Open an existing chat room.

## Intent Name

`ViewChat`

## Display Name

`View Chat`

## Possible Contexts

* [ChatRoom](../../context/ref/ChatRoom)
* [Contact](../../context/ref/Contact): It will open the **direct** chat where there is the current user and the contact
* [ContactList](../../context/ref/ContactList): It will open the **room** where there is the current user and the listed contacts. Contact List may need to display search results if there are multiple matches.

## Output

This intent returns as output:
* If the chat doesn't exist, will display a modal to create a chat
* if the chat gets created, return its ChatRoom context
* if none is created return void

## Example: ChatRoom

```js
const chatRoom = {
type: 'fdc3.chat.room',
providerName: "Symphony",
id: {
roomId: "j75xqXy25NBOdacUI3FNBH"
}
}

const intentResolution = await fdc3.raiseIntent('ViewChat', chatRoom);

const chatRoom = intentResolution.getResult(): // A chatRoom will be returned as context if the room was found
```

## Example: Contact

```js
const contact = {
type: 'fdc3.contact',
name: 'Jane Doe',
id: {
email: 'jane@mail.com'
}
}

const intentResolution = await fdc3.raiseIntent('ViewChat', contact);

const chatRoom = intentResolution.getResult(): // A chatRoom will be returned as context if the direct chat was found
```

## Example: ContactList

```js
const contacts = {
type: 'fdc3.contactList',
contacts: [
{
type: 'fdc3.contact',
name: 'Jane Doe',
id: {
email: 'jane.doe@mail.com'
}
},
{
type: 'fdc3.contact',
name: 'John Doe',
id: {
email: 'john.doe@mail.com'
}
},
]
}


const intentResolution = await fdc3.raiseIntent('ViewChat', contacts);

const chatRoom = intentResolution.getResult(): // A chatRoom will be returned as context if the room was found
```

## See Also

Context

* [ChatRoom](../../context/ref/ChatRoom)
* [Contact](../../context/ref/Contact)
* [ContactList](../../context/ref/ContactList)

Intents

* [StartChat](StartChat)
1 change: 1 addition & 0 deletions docs/intents/spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ A list of standardized intents are defined in the following pages:
* [`StartChat`](ref/StartChat)
* [`StartEmail`](ref/StartEmail)
* [`ViewAnalysis`](ref/ViewAnalysis)
* [`ViewChat`](ref/ViewChat)
* [`ViewChart`](ref/ViewChart)
* [`ViewHoldings`](ref/ViewHoldings)
* [`ViewInstrument`](ref/ViewInstrument)
Expand Down
1 change: 1 addition & 0 deletions src/intents/Intents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export enum Intents {
StartChat = 'StartChat',
StartEmail = 'StartEmail',
ViewAnalysis = 'ViewAnalysis',
ViewChat = 'ViewChat',
ViewChart = 'ViewChart',
ViewContact = 'ViewContact',
ViewHoldings = 'ViewHoldings',
Expand Down
1 change: 1 addition & 0 deletions website/sidebars.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"intents/ref/StartChat",
"intents/ref/StartEmail",
"intents/ref/ViewAnalysis",
"intents/ref/ViewChat",
"intents/ref/ViewChart",
"intents/ref/ViewHoldings",
"intents/ref/ViewInstrument",
Expand Down

0 comments on commit 86aa01b

Please sign in to comment.