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

Fix intent examples in docs #65

Merged
merged 1 commit into from
Mar 24, 2019
Merged
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
40 changes: 28 additions & 12 deletions docs/intents-intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The findIntents call returns an object, not the actual apps :

// I know 'StartChat' exists as a concept, and want to know more about it ...
const appIntent = await agent.findIntent("StartChat");
// returns a single AppIntent:
// {
//     intent: { name: "StartChat", displayName: "Chat" },
//     apps: [{ name: "Skype" }, { name: "Symphony" }, { name: "Slack" }]
// }

// raise the intent against a particular app
await agent.raiseIntent(appIntent.intent.name, context, appIntent.apps[0].name);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know, but this isn't the API docs, I wanted to be concise and unspecific and get the idea across of what it turns. Do you think I should change it? It could still be an object with that name in my example.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool - just checking.

```

### Find available intents for a contact
```javascript
const intentsAndApps = await fdc3.findIntentsByContext({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fine, but I noticed that the example in the api docs for findIntentsByContext says findIntentsForContext - we need to change that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, I noticed the same while doing this and then promptly forgot to change it! Will update the PR...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can do that on a separate commit if you like

type: "fdc3.contact",
name: "Nick Kolba",
id:{
id: {
email:"[email protected]"
}
});
}
});
```
40 changes: 28 additions & 12 deletions website/versioned_docs/version-1.0/intents-intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:"[email protected]"
}
});
}
});
```