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

765 'ChatRoom' & 'ChatMessage' contexts and 'SendChatMessage' Intent #794

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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

### Added

* Added a `SendChatMessage` intent to be used when a user wants to send a message to an existing chat room. ([#794](https://github.com/finos/FDC3/pull/794))
* Added a context type representing a chat message (`fdc3.chat.message`). ([#794](https://github.com/finos/FDC3/pull/794))
* Added a context type representing a chat room (`fdc3.chat.room`). ([#794](https://github.com/finos/FDC3/pull/794))

### Changed

* Updated the `StartChat` intent to return a reference to the room. ([#794](https://github.com/finos/FDC3/pull/794))

### Deprecated

### Fixed
Expand Down
7 changes: 5 additions & 2 deletions docs/context/ref/ChatInitSettings.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,19 +66,22 @@ const initSettings = {
}

const res = fdc3.raiseIntent('StartChat', initSettings);
const roomRefs = await res.getResult();

// Return a reference to the room
const chatRoom = await res.getResult();
```

## See Also

Other Types

- [ChatRoom](ChatRoom)
- [ContactList](ContactList)

Intents

- [StartChat](../../intents/ref/StartChat)
- [StartCall](../../intents/ref/StartCall)
- [SendChatMessage](../../intents/ref/StartChat)
- [ViewContact](../../intents/ref/ViewContact)

FINOS Financial Objects
Expand Down
51 changes: 51 additions & 0 deletions docs/context/ref/ChatMessage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
id: ChatMessage
sidebar_label: ChatMessage
title: ChatMessage
hide_title: true
---
# `ChatMessage`

A context representing a chat message. Typically used to send the message or to pre-populate a message for sending.

## Type

`fdc3.chat.message`

## Schema

- https://fdc3.finos.org/schemas/next/chatMessage.schema.json

## Details

| Property | Type | Required | Example Value |
|-------------|---------|----------|-------------------|
| `type` | string | Yes | `'fdc3.chat.message'` |
| `chatRoom` | ChatRoom | Yes | `{ type: 'fdc3.chat.room', providerName: 'Symphony', id:{ roomId: 'j75xqXy25NBOdacUI3FNBH'} }` |
| `message` | [Message](https://fdc3.finos.org/schemas/next/message.schema.json) | Yes | `'A message to send'` |
mistryvinay marked this conversation as resolved.
Show resolved Hide resolved

## Example

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

## See Also

Intents
- [StartChat](../../intents/ref/StartChat)
- [StartCall](../../intents/ref/StartCall)
- [SendChatMessage](../../intents/ref/SendChatMessage)

FINOS Financial Objects
- [Contact](https://fo.finos.org/docs/objects/contact)
64 changes: 64 additions & 0 deletions docs/context/ref/ChatRoom.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
---
id: ChatRoom
sidebar_label: ChatRoom
title: Contact
hide_title: true
---
# `ChatRoom`

Reference to the chat room(s) (which could be used later to send a message to the room(s)).

## Type

`fdc3.chat.room`

## Schema

https://fdc3.finos.org/schemas/next/chatRoom.schema.json

## Details

| Property | Type | Required | Example Value |
|-------------|---------|----------|-------------------|
| `type` | string | Yes | `'fdc3.chat.room'` |
| `providerName` | string | Yes | `'Symphony'` |
| `id` | object | Yes | `{ roomId: 'j75xqXy25NBOdacUI3FNBH', anyOtherKey: 'abcdef'}` |
| `url` | string | No | `'http://symphony.com/ref/room/j75xqXy25NBOdacUI3FNBH___pqSsuJRdA'` |
| `name` | string | No | `'My new room'` |

The `url` is an universal url to access to the room. It could be opened from a browser, a mobile app, etc...

## Example

```js
const chatRoom = {
type: "fdc3.chat.room",
providerName: "Symphony",
id: {
roomId: "j75xqXy25NBOdacUI3FNBH"
}
url: "http://symphony.com/ref/room/j75xqXy25NBOdacUI3FNBH___pqSsuJRdA",
name: 'My new room'
};

//Chat rooms are returned by the StartChat intent as a result
const intentResolution = await fdc3.raiseIntent("StartChat", context);

try {
const chatRooms = await intentResolution.getResult():
} catch (error) {
//chat room were not created...
}
```

## See Also

Other Types
* [ChatInitSettings](ChatInitSettings)

Intents
- [StartChat](../../intents/ref/StartChat)
- [SendChatMessage](../../intents/ref/SendChatMessage)

FINOS Financial Objects
- [Contact](https://fo.finos.org/docs/objects/contact)
2 changes: 2 additions & 0 deletions docs/context/spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ The following are standard FDC3 context types:

* [`fdc3.chart`](ref/Chart) ([schema](/schemas/next/chart.schema.json))
* [`fdc3.chat.initSettings`](ref/ChatInitSettings) ([schema](/schemas/next/chatInitSettings.schema.json))
* [`fdc3.chat.room`](ref/ChatRoom) ([schema](/schemas/next/chatRoom.schema.json))
* [`fdc3.chat.message`](ref/ChatMessage) ([schema](/schemas/next/chatMessage.schema.json))
* [`fdc3.contact`](ref/Contact) ([schema](/schemas/next/contact.schema.json))
* [`fdc3.contactList`](ref/ContactList) ([schema](/schemas/next/contactList.schema.json))
* [`fdc3.country`](ref/Country) ([schema](/schemas/next/country.schema.json))
Expand Down
50 changes: 50 additions & 0 deletions docs/intents/ref/SendChatMessage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---
id: SendChatMessage
sidebar_label: SendChatMessage
title: SendChatMessage
hide_title: true
---
# `SendChatMessage`

Send a message to an existing chat room.

## Intent Name

`SendChatMessage`

## Display Name

`Send Chat Message`

## Possible Contexts

* [ChatMessage](../../context/ref/ChatMessage)

## Example

```js
// Start a chat and retrieve a reference to the chat room created
const intentResolution = await fdc3.raiseIntent("StartChat", context);
const chatRoom = intentResolution.getResult();

//Some time later

let chatMessage: ChatMessage = {
type: "fdc3.chat.message",
chatRoom,
message: "Another message to send in the room"
}

await fdc3.raiseIntent("SendChatMessage", context, intentResolution.source);
```

## See Also

Context
- [ChatMessage](../../context/ref/ChatMessage)
- [ChatRoom](../../context/ref/ChatRoom)

Intents
* [StartChat](StartChat)
* [StartCall](StartCall)
* [StartEmail](StartEmail)
8 changes: 6 additions & 2 deletions docs/intents/ref/StartChat.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ hide_title: true
---
# `StartChat`

Initiate a chat with a contact, a list of contacts or detailed initialization settings.
Initiate a chat with a contact, a list of contacts or detailed initialization settings. This could be launched from within another application. For example initiating a chat from a research or OMS application.

## Intent Name

Expand Down Expand Up @@ -60,16 +60,20 @@ const initSettings = {
}

const resolution = fdc3.raiseIntent('StartChat', initSettings);
const chatRoomRefs = await resolution.getResult();

// Return a reference to the room
const chatRoom = await resolution.getResult();
```

## See Also

Context
- [ChatRoom](../../context/ref/ChatRoom)
- [Contact](../../context/ref/Contact)
- [ContactList](../../context/ref/ContactList)
- [ChatInitSettings](../../context/ref/ChatInitSettings)

Intents
* [SendChatMessage](SendChatMessage)
* [StartCall](StartCall)
* [StartEmail](StartEmail)
1 change: 1 addition & 0 deletions src/context/ContextType.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export enum ContextTypes {
Chart = 'fdc3.chart',
ChatInitSettings = 'fdc3.chat.initSettings',
ChatRoom = 'fdc3.chat.room',
Contact = 'fdc3.contact',
ContactList = 'fdc3.contactList',
Country = 'fdc3.country',
Expand Down
2 changes: 2 additions & 0 deletions src/context/schemas.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"Context": ["https://fdc3.finos.org/schemas/next/context.schema.json"],
"Chart": ["https://fdc3.finos.org/schemas/next/chart.schema.json"],
"ChatInitSettings": ["https://fdc3.finos.org/schemas/next/chatInitSettings.schema.json"],
"ChatMessage": ["https://fdc3.finos.org/schemas/next/chatMessage.schema.json"],
"ChatRoom": ["https://fdc3.finos.org/schemas/next/chatRoom.schema.json"],
"Contact": ["https://fdc3.finos.org/schemas/next/contact.schema.json"],
"ContactList": ["https://fdc3.finos.org/schemas/next/contactList.schema.json"],
"Country": ["https://fdc3.finos.org/schemas/next/country.schema.json"],
Expand Down
13 changes: 13 additions & 0 deletions src/context/schemas/chatMessage.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://fdc3.finos.org/schemas/next/chatMessage.schema.json",
"type": "object",
"title": "ChatMessage",
"allOf": [{ "$ref": "context.schema.json#" }],
"properties": {
"type": { "const": "fdc3.chat.message" },
"chatRoom": { "$ref": "chatRoom.schema.json#" },
"message": { "$ref": "message.schema.json#" }
},
"required": ["type", "chatRoom", "message"]
}
15 changes: 15 additions & 0 deletions src/context/schemas/chatRoom.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://fdc3.finos.org/schemas/next/chatRoom.schema.json",
"type": "object",
"title": "ChatRoom",
"allOf": [{ "$ref": "context.schema.json#" }],
"properties": {
"type": { "const": "fdc3.chat.room" },
"providerName": { "type": "string" },
"id": { "type": "object" },
"url": { "type": "string" },
"name": { "type": "string" }
},
"required": ["providerName", "id"]
}
1 change: 1 addition & 0 deletions src/intents/Intents.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export enum Intents {
SendChatMessage = 'SendChatMessage',
StartCall = 'StartCall',
StartChat = 'StartChat',
StartEmail = 'StartEmail',
Expand Down
3 changes: 3 additions & 0 deletions website/sidebars.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"intents/ref/StartCall",
"intents/ref/StartChat",
"intents/ref/StartEmail",
"intents/ref/SendChatMessage",
"intents/ref/ViewAnalysis",
"intents/ref/ViewChart",
"intents/ref/ViewHoldings",
Expand All @@ -62,6 +63,8 @@
"context/ref/Context",
"context/ref/Chart",
"context/ref/ChatInitSettings",
"context/ref/ChatMessage",
"context/ref/ChatRoom",
"context/ref/Contact",
"context/ref/ContactList",
"context/ref/Country",
Expand Down
13 changes: 13 additions & 0 deletions website/static/schemas/next/chatMessage.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://fdc3.finos.org/schemas/next/chatMessage.schema.json",
"type": "object",
"title": "ChatMessage",
"allOf": [{ "$ref": "context.schema.json#" }],
"properties": {
"type": { "const": "fdc3.chat.message" },
"chatRoom": { "$ref": "chatRoom.schema.json#" },
"message": { "$ref": "message.schema.json#" }
mistryvinay marked this conversation as resolved.
Show resolved Hide resolved
},
"required": ["type", "chatRoom", "message"]
}
15 changes: 15 additions & 0 deletions website/static/schemas/next/chatRoom.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://fdc3.finos.org/schemas/next/chatRoom.schema.json",
"type": "object",
"title": "ChatRoom",
"allOf": [{ "$ref": "context.schema.json#" }],
"properties": {
"type": { "const": "fdc3.chat.room" },
"providerName": { "type": "string" },
"id": { "type": "object" },
"url": { "type": "string" },
"name": { "type": "string" }
},
"required": ["providerName", "id"]
}
4 changes: 2 additions & 2 deletions website/versioned_docs/version-2.0/intents/ref/StartChat.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ original_id: StartChat
---
# `StartChat`

Initiate a chat with a contact, a list of contacts or detailed initialization settings.
Initiate a chat with a contact, a list of contacts or detailed initialization settings. This could be launched from within another application. For example initiating a chat from a research or OMS application.

## Intent Name

Expand Down Expand Up @@ -61,7 +61,7 @@ const initSettings = {
}

const resolution = fdc3.raiseIntent('StartChat', initSettings);
const chatRoomRefs = await resolution.getResult();
const chatRooms = await resolution.getResult();
```

## See Also
Expand Down