Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

767 Add ViewChat Intent #796

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

### Added

* Added a `ViewChat` Intent to be used when a user wants to open an existing chat room. ([#796](https://github.com/finos/FDC3/pull/796))

### Changed

* Updated definition of the `Instrument` context type to include optional market identifiers ([#819](https://github.com/finos/FDC3/pull/819))
Expand Down
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