-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add adaptive cards (and attachment) support (#44)
* add adaptiveCardProvider * add adaptivecards package * add adaptive cards implementation * add adaptive cards tests * update docs * include ts-node require * update node version * update mocha version * add yarn to circle config
- Loading branch information
1 parent
6b2e716
commit e1be08f
Showing
8 changed files
with
193 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,16 @@ | ||
machine: | ||
node: | ||
version: 6.1.0 | ||
version: 8.0.0 | ||
environment: | ||
PATH: "${PATH}:${HOME}/${CIRCLE_PROJECT_REPONAME}/node_modules/.bin" | ||
|
||
dependencies: | ||
override: | ||
- yarn | ||
cache_directories: | ||
- ~/.cache/yarn | ||
|
||
test: | ||
override: | ||
- yarn lint && yarn coverage | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { IAdaptiveCard } from 'adaptivecards'; | ||
import { IAttachment, IMessage, Message} from 'botbuilder'; | ||
|
||
export function getAdaptiveCard() : IAdaptiveCard { | ||
const action = { | ||
type: 'Action.OpenUrl', | ||
url: 'http://adaptivecards.io', | ||
title: 'Learn More' | ||
}; | ||
|
||
return { | ||
type: 'AdaptiveCard', | ||
version: '1.0', | ||
body: [ | ||
{ | ||
type: 'TextBlock', | ||
text: 'Hello World!', | ||
size: 'large' | ||
}, | ||
{ | ||
type: 'TextBlock', | ||
text: '*Sincerely yours,*' | ||
}, | ||
{ | ||
type: 'TextBlock', | ||
text: 'Adaptive Cards', | ||
separation: 'none' | ||
} | ||
], | ||
actions: [ action ] | ||
}; | ||
} | ||
|
||
export function getAdaptiveCardAttachment(adaptiveCard?: IAdaptiveCard): IAttachment { | ||
adaptiveCard = adaptiveCard || getAdaptiveCard(); | ||
|
||
return { | ||
contentType: 'application/vnd.microsoft.card.adaptive', | ||
content: adaptiveCard | ||
}; | ||
} | ||
|
||
export function getAdaptiveCardMessage(adaptiveCard?: IAdaptiveCard): IMessage { | ||
return new Message() | ||
.addAttachment(getAdaptiveCardAttachment(adaptiveCard)) | ||
.toMessage(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,9 +63,9 @@ | |
version "2.0.29" | ||
resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-2.0.29.tgz#5002e14f75e2d71e564281df0431c8c1b4a2a36a" | ||
|
||
"@types/mocha@^2.2.41": | ||
version "2.2.42" | ||
resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-2.2.42.tgz#ab769f51d37646b6fe8d4a086a98c285b1fab3f5" | ||
"@types/mocha@^2.2.44": | ||
version "2.2.44" | ||
resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-2.2.44.tgz#1d4a798e53f35212fd5ad4d04050620171cd5b5e" | ||
|
||
"@types/node@*", "@types/node@^8.0.26": | ||
version "8.0.27" | ||
|
@@ -86,6 +86,10 @@ [email protected]: | |
version "1.0.9" | ||
resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.0.9.tgz#91b4792588a7738c25f35dd6f63752a2f8776135" | ||
|
||
adaptivecards@^1.0.0-beta9: | ||
version "1.0.0-beta9" | ||
resolved "https://registry.yarnpkg.com/adaptivecards/-/adaptivecards-1.0.0-beta9.tgz#bc22f61978c58666c8e862c9ad5b4b43b0b61fa8" | ||
|
||
ajv@^4.9.1: | ||
version "4.11.8" | ||
resolved "https://registry.yarnpkg.com/ajv/-/ajv-4.11.8.tgz#82ffb02b29e662ae53bdc20af15947706739c536" | ||
|