From ee2606aae54181be4c25316d0301394213f9f4fa Mon Sep 17 00:00:00 2001 From: Riko Eksteen Date: Fri, 22 Mar 2019 17:39:58 +0000 Subject: [PATCH] Fix #63 Use correct examples for using intent APIs --- docs/intents-intro.md | 40 +++++++++++++------ .../version-1.0/intents-intro.md | 40 +++++++++++++------ 2 files changed, 56 insertions(+), 24 deletions(-) diff --git a/docs/intents-intro.md b/docs/intents-intro.md index 913314919..3330f2510 100644 --- a/docs/intents-intro.md +++ b/docs/intents-intro.md @@ -19,24 +19,40 @@ FDC3 Intents define a standard set of verbs that can be used to put together com ## Using Intents Combined with [Context Data](context-intro.md) and [App Directory](appd-intro.md) standards, Intents enable rich service discovery on the desktop. For example: -### Directing a market data platform to show a chart +### Ask for a chart to be displayed ```javascript -fdc3.open("my-platform","ViewChart",{ - type:"fdc3.instrument", +const result = await fdc3.raiseIntent("ViewChart", { + type: "fdc3.instrument", name: "IBM", - id:{ + id: { ticker:"ibm" - } - }); + } +}); ``` -### Discovering apps that can start a chat +### Ask a specific application to display a chart ```javascript -fdc3.raiseIntent("StartChat",{ - type:"fdc3.contact", +const result = await fdc3.raiseIntent("ViewChart", { + type: "fdc3.instrument", + name: "IBM", + id: { + ticker:"ibm" + } +}, "market-data-app"); +``` + +### Find applications that can start a chat +```javascript +const intentApps = await fdc3.findIntent("StartChat"); +``` + +### Find available intents for a contact +```javascript +const intentsAndApps = await fdc3.findIntentsByContext({ + type: "fdc3.contact", name: "Nick Kolba", - id:{ + id: { email:"nick@openfin.co" - } - }); + } +}); ``` \ No newline at end of file diff --git a/website/versioned_docs/version-1.0/intents-intro.md b/website/versioned_docs/version-1.0/intents-intro.md index f875a8589..20c5e79b9 100644 --- a/website/versioned_docs/version-1.0/intents-intro.md +++ b/website/versioned_docs/version-1.0/intents-intro.md @@ -20,24 +20,40 @@ FDC3 Intents define a standard set of verbs that can be used to put together com ## Using Intents Combined with [Context Data](context-intro.md) and [App Directory](appd-intro.md) standards, Intents enable rich service discovery on the desktop. For example: -### Directing a market data platform to show a chart +### Ask for a chart to be displayed ```javascript -fdc3.open("my-platform","ViewChart",{ - type:"fdc3.instrument", +const result = await fdc3.raiseIntent("ViewChart", { + type: "fdc3.instrument", name: "IBM", - id:{ + id: { ticker:"ibm" - } - }); + } +}); ``` -### Discovering apps that can start a chat +### Ask a specific application to display a chart ```javascript -fdc3.raiseIntent("StartChat",{ - type:"fdc3.contact", +const result = await fdc3.raiseIntent("ViewChart", { + type: "fdc3.instrument", + name: "IBM", + id: { + ticker:"ibm" + } +}, "market-data-app"); +``` + +### Find applications that can start a chat +```javascript +const intentApps = await fdc3.findIntent("StartChat"); +``` + +### Find available intents for a contact +```javascript +const intentsAndApps = await fdc3.findIntentsByContext({ + type: "fdc3.contact", name: "Nick Kolba", - id:{ + id: { email:"nick@openfin.co" - } - }); + } +}); ``` \ No newline at end of file