@@ -98,6 +98,15 @@ export interface Signin {
9898 }
9999}
100100
101+ export interface OAuth {
102+ contentType : "application/vnd.microsoft.card.oauth" ,
103+ content : {
104+ text ?: string ,
105+ connectionname : string ,
106+ buttons ?: CardAction [ ]
107+ }
108+ }
109+
101110export interface ReceiptItem {
102111 title ?: string ,
103112 subtitle ?: string ,
@@ -181,7 +190,7 @@ export interface AnimationCard {
181190 }
182191}
183192
184- export type KnownMedia = Media | HeroCard | Thumbnail | Signin | Receipt | AudioCard | VideoCard | AnimationCard | FlexCard | AdaptiveCard ;
193+ export type KnownMedia = Media | HeroCard | Thumbnail | Signin | OAuth | Receipt | AudioCard | VideoCard | AnimationCard | FlexCard | AdaptiveCard ;
185194export type Attachment = KnownMedia | UnknownMedia ;
186195
187196export interface User {
@@ -277,7 +286,8 @@ export interface IBotConnection {
277286 activity$ : Observable < Activity > ,
278287 end ( ) : void ,
279288 referenceGrammarId ?: string ,
280- postActivity ( activity : Activity ) : Observable < string >
289+ postActivity ( activity : Activity ) : Observable < string > ,
290+ getSessionId ? : ( ) => Observable < string >
281291}
282292
283293export class DirectLine implements IBotConnection {
@@ -465,6 +475,31 @@ export class DirectLine implements IBotConnection {
465475 this . tokenRefreshSubscription . unsubscribe ( ) ;
466476 this . connectionStatus$ . next ( ConnectionStatus . Ended ) ;
467477 }
478+
479+ getSessionId ( ) : Observable < string > {
480+ // If we're not connected to the bot, get connected
481+ // Will throw an error if we are not connected
482+ konsole . log ( "getSessionId" ) ;
483+ return this . checkConnection ( true )
484+ . flatMap ( _ =>
485+ Observable . ajax ( {
486+ method : "GET" ,
487+ url : `${ this . domain } /session/getsessionid` ,
488+ withCredentials : true ,
489+ timeout,
490+ headers : {
491+ "Content-Type" : "application/json" ,
492+ "Authorization" : `Bearer ${ this . token } `
493+ }
494+ } )
495+ . map ( ajaxResponse => {
496+ konsole . log ( "getSessionId response: " + ajaxResponse . response . sessionId ) ;
497+ return ajaxResponse . response . sessionId as string ;
498+ } )
499+ . catch ( error => this . catchPostError ( error ) )
500+ )
501+ . catch ( error => this . catchExpiredToken ( error ) ) ;
502+ }
468503
469504 postActivity ( activity : Activity ) {
470505 // Use postMessageWithAttachments for messages with attachments that are local files (e.g. an image to upload)
0 commit comments