Skip to content

Commit d5f25d3

Browse files
Add ViewChat Intent
1 parent 29ce01a commit d5f25d3

4 files changed

Lines changed: 106 additions & 0 deletions

File tree

docs/intents/ref/ViewChat.md

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
---
2+
id: ViewChat
3+
sidebar_label: ViewChat
4+
title: ViewChat
5+
hide_title: true
6+
---
7+
# `ViewChat`
8+
9+
Open an existing chat room.
10+
11+
## Intent Name
12+
13+
`ViewChat`
14+
15+
## Display Name
16+
17+
`View Chat`
18+
19+
## Possible Contexts
20+
21+
* [ChatRoom](../../context/ref/ChatRoom)
22+
* [Contact](../../context/ref/Contact): It will open the **direct** chat where there is the current user and the contact
23+
* [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.
24+
25+
## Output
26+
27+
This intent returns as output:
28+
* If the chat doesn't exist, will display a modal to create a chat
29+
* if the chat gets created, return its ChatRoom context
30+
* if none is created return void
31+
32+
## Example: ChatRoom
33+
34+
```js
35+
const chatRoom = {
36+
type: 'fdc3.chat.room',
37+
providerName: "Symphony",
38+
id: {
39+
roomId: "j75xqXy25NBOdacUI3FNBH"
40+
}
41+
}
42+
43+
const intentResolution = await fdc3.raiseIntent('ViewChat', chatRoom);
44+
45+
const chatRoom = intentResolution.getResult(): // A chatRoom will be returned as context if the room was found
46+
```
47+
48+
## Example: Contact
49+
50+
```js
51+
const contact = {
52+
type: 'fdc3.contact',
53+
name: 'Jane Doe',
54+
id: {
55+
email: 'jane@mail.com'
56+
}
57+
}
58+
59+
const intentResolution = await fdc3.raiseIntent('ViewChat', contact);
60+
61+
const chatRoom = intentResolution.getResult(): // A chatRoom will be returned as context if the direct chat was found
62+
```
63+
64+
## Example: ContactList
65+
66+
```js
67+
const contacts = {
68+
type: 'fdc3.contactList',
69+
contacts: [
70+
{
71+
type: 'fdc3.contact',
72+
name: 'Jane Doe',
73+
id: {
74+
email: 'jane.doe@mail.com'
75+
}
76+
},
77+
{
78+
type: 'fdc3.contact',
79+
name: 'John Doe',
80+
id: {
81+
email: 'john.doe@mail.com'
82+
}
83+
},
84+
]
85+
}
86+
87+
88+
const intentResolution = await fdc3.raiseIntent('ViewChat', contacts);
89+
90+
const chatRoom = intentResolution.getResult(): // A chatRoom will be returned as context if the room was found
91+
```
92+
93+
## See Also
94+
95+
Context
96+
97+
* [ChatRoom](../../context/ref/ChatRoom)
98+
* [Contact](../../context/ref/Contact)
99+
* [ContactList](../../context/ref/ContactList)
100+
101+
Intents
102+
103+
* [StartChat](StartChat)

docs/intents/spec.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ A list of standardized intents are defined in the following pages:
152152
* [`StartChat`](ref/StartChat)
153153
* [`StartEmail`](ref/StartEmail)
154154
* [`ViewAnalysis`](ref/ViewAnalysis)
155+
* [`ViewChat`](ref/ViewChat)
155156
* [`ViewChart`](ref/ViewChart)
156157
* [`ViewHoldings`](ref/ViewHoldings)
157158
* [`ViewInstrument`](ref/ViewInstrument)

src/intents/Intents.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ export enum Intents {
33
StartChat = 'StartChat',
44
StartEmail = 'StartEmail',
55
ViewAnalysis = 'ViewAnalysis',
6+
ViewChat = 'ViewChat',
67
ViewChart = 'ViewChart',
78
ViewContact = 'ViewContact',
89
ViewHoldings = 'ViewHoldings',

website/sidebars.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
"intents/ref/StartChat",
4444
"intents/ref/StartEmail",
4545
"intents/ref/ViewAnalysis",
46+
"intents/ref/ViewChat",
4647
"intents/ref/ViewChart",
4748
"intents/ref/ViewHoldings",
4849
"intents/ref/ViewInstrument",

0 commit comments

Comments
 (0)