From 4c7034ab7238f19d9802e17c6730a1396a53985b Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Wed, 21 Oct 2020 16:12:41 -0400 Subject: [PATCH 1/3] Changes open argument from name to target, adds AppMetadata as optional type --- src/api/DesktopAgent.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/api/DesktopAgent.ts b/src/api/DesktopAgent.ts index 1025ddec5..6c18160db 100644 --- a/src/api/DesktopAgent.ts +++ b/src/api/DesktopAgent.ts @@ -22,7 +22,7 @@ import { Context } from '../context/ContextTypes'; export interface DesktopAgent { /** - * Launches an app by name. + * Launches an app by target, which can be optionally a string like a name, or an AppMetadata object. * * If a Context object is passed in, this object will be provided to the opened application via a contextListener. * The Context argument is functionally equivalent to opening the target app with no context and broadcasting the context directly to it. @@ -30,13 +30,15 @@ export interface DesktopAgent { * If opening errors, it returns an `Error` with a string from the `OpenError` enumeration. * * ```javascript - * //no context + * //no context and string as target * agent.open('myApp'); + * //no context and AppMetadata object as target + * agent.open({name: 'myApp', title: 'The title for the application myApp.', description: '...'}); * //with context * agent.open('myApp', context); * ``` */ - open(name: string, context?: Context): Promise; + open(target: AppMetadata | string, context?: Context): Promise; /** * Find out more information about a particular intent by passing its name, and optionally its context. From 79ebe0cc0d1b89b862bfec88ca4695294e2132f2 Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Wed, 21 Oct 2020 16:48:27 -0400 Subject: [PATCH 2/3] Adds AppMetadata object to target argument --- src/api/DesktopAgent.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/api/DesktopAgent.ts b/src/api/DesktopAgent.ts index 6c18160db..c2e851d51 100644 --- a/src/api/DesktopAgent.ts +++ b/src/api/DesktopAgent.ts @@ -9,6 +9,7 @@ import { ContextHandler } from './ContextHandler'; import { IntentResolution } from './IntentResolution'; import { Listener } from './Listener'; import { Context } from '../context/ContextTypes'; +import { AppMetadata } from './AppMetadata'; /** * A Desktop Agent is a desktop component (or aggregate of components) that serves as a @@ -115,12 +116,14 @@ export interface DesktopAgent { * const appIntent = await fdc3.findIntent("StartChat", context); * //use the returned AppIntent object to target one of the returned chat apps with the context * await fdc3.raiseIntent("StartChat", context, appIntent.apps[0].name); + * //or use one of the AppMetadata objects returned in the AppIntent object's 'apps' array + * await fdc3.raiseIntent("StartChat", context, appMetadata); * ``` */ raiseIntent( intent: string, context: Context, - target?: string + target?: string | AppMetadata ): Promise; /** From 7a27e26726eb3302ecdf1b8bcb049fdfb6fd4f09 Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Thu, 22 Oct 2020 08:56:21 -0400 Subject: [PATCH 3/3] Reverse order of argument type for consistency --- src/api/DesktopAgent.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api/DesktopAgent.ts b/src/api/DesktopAgent.ts index c2e851d51..ca0e822a7 100644 --- a/src/api/DesktopAgent.ts +++ b/src/api/DesktopAgent.ts @@ -39,7 +39,7 @@ export interface DesktopAgent { * agent.open('myApp', context); * ``` */ - open(target: AppMetadata | string, context?: Context): Promise; + open(target: string | AppMetadata, context?: Context): Promise; /** * Find out more information about a particular intent by passing its name, and optionally its context.