Skip to content

Commit efe5357

Browse files
committed
ignored too much stuff
1 parent 25a6376 commit efe5357

3 files changed

Lines changed: 214 additions & 2 deletions

File tree

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
node_modules
22
built
33
.vscode
4-
/directLine.*
4+
/directLine.js
5+
/directLine.js.map

directLine.d.ts

Lines changed: 211 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,211 @@
1+
import { Observable } from 'rxjs/Observable';
2+
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
3+
4+
// Direct Line 3.0 types
5+
6+
export interface Conversation {
7+
conversationId: string;
8+
token: string;
9+
eTag?: string;
10+
streamUrl?: string;
11+
}
12+
export declare type MediaType = "image/png" | "image/jpg" | "image/jpeg" | "image/gif" | "audio/mpeg" | "audio/mp4" | "video/mp4";
13+
export interface Media {
14+
contentType: MediaType;
15+
contentUrl: string;
16+
name?: string;
17+
}
18+
export interface Button {
19+
type: "imBack" | "postBack" | "openUrl" | "signin";
20+
title: string;
21+
value: string;
22+
image?: string;
23+
}
24+
export interface HeroCard {
25+
contentType: "application/vnd.microsoft.card.hero";
26+
content: {
27+
title?: string;
28+
subtitle?: string;
29+
text?: string;
30+
images?: {
31+
url: string;
32+
}[];
33+
buttons?: Button[];
34+
};
35+
}
36+
export interface Thumbnail {
37+
contentType: "application/vnd.microsoft.card.thumbnail";
38+
content: {
39+
title?: string;
40+
subtitle?: string;
41+
text?: string;
42+
images?: {
43+
url: string;
44+
}[];
45+
buttons?: Button[];
46+
tap?: string;
47+
};
48+
}
49+
export interface Signin {
50+
contentType: "application/vnd.microsoft.card.signin";
51+
content: {
52+
text?: string;
53+
buttons?: Button[];
54+
};
55+
}
56+
export interface ReceiptItem {
57+
title?: string;
58+
subtitle?: string;
59+
text?: string;
60+
image?: {
61+
url: string;
62+
};
63+
price?: string;
64+
quantity?: string;
65+
tap?: string;
66+
}
67+
export interface Receipt {
68+
contentType: "application/vnd.microsoft.card.receipt";
69+
content: {
70+
title?: string;
71+
facts?: {
72+
key: string;
73+
value: string;
74+
}[];
75+
items?: ReceiptItem[];
76+
tap?: string;
77+
tax?: string;
78+
VAT?: string;
79+
total?: string;
80+
buttons?: Button[];
81+
};
82+
}
83+
export interface FlexCard {
84+
contentType: "application/vnd.microsoft.card.flex";
85+
content: {
86+
title?: string;
87+
subtitle?: string;
88+
text?: string;
89+
images?: {
90+
url: string;
91+
tap?: Button;
92+
}[];
93+
buttons?: Button[];
94+
aspect?: string;
95+
};
96+
}
97+
export interface AudioCard {
98+
contentType: "application/vnd.microsoft.card.audio";
99+
content: {
100+
title?: string;
101+
subtitle?: string;
102+
text?: string;
103+
media?: {
104+
url: string;
105+
profile?: string;
106+
}[];
107+
buttons?: Button[];
108+
autoloop?: boolean;
109+
autostart?: boolean;
110+
};
111+
}
112+
export interface VideoCard {
113+
contentType: "application/vnd.microsoft.card.video";
114+
content: {
115+
title?: string;
116+
subtitle?: string;
117+
text?: string;
118+
media?: {
119+
url: string;
120+
profile?: string;
121+
}[];
122+
buttons?: Button[];
123+
image?: {
124+
url: string;
125+
alt?: string;
126+
};
127+
autoloop?: boolean;
128+
autostart?: boolean;
129+
};
130+
}
131+
export interface AnimationCard {
132+
contentType: "application/vnd.microsoft.card.animation";
133+
content: {
134+
title?: string;
135+
subtitle?: string;
136+
text?: string;
137+
media?: {
138+
url: string;
139+
profile?: string;
140+
}[];
141+
buttons?: Button[];
142+
image?: {
143+
url: string;
144+
alt?: string;
145+
};
146+
autoloop?: boolean;
147+
autostart?: boolean;
148+
};
149+
}
150+
export declare type Attachment = Media | HeroCard | Thumbnail | Signin | Receipt | AudioCard | VideoCard | AnimationCard | FlexCard;
151+
export interface User {
152+
id: string;
153+
name?: string;
154+
iconUrl?: string;
155+
}
156+
export interface IActivity {
157+
type: string;
158+
channelData?: any;
159+
channelId?: string;
160+
conversation?: {
161+
id: string;
162+
};
163+
eTag?: string;
164+
from?: User;
165+
id?: string;
166+
timestamp?: string;
167+
}
168+
export declare type AttachmentLayout = "list" | "carousel";
169+
export interface Message extends IActivity {
170+
type: "message";
171+
text?: string;
172+
locale?: string;
173+
textFormat?: "plain" | "markdown" | "xml";
174+
attachmentLayout?: AttachmentLayout;
175+
attachments?: Attachment[];
176+
entities?: any[];
177+
}
178+
export interface Typing extends IActivity {
179+
type: "typing";
180+
}
181+
export declare type Activity = Message | Typing;
182+
export declare enum ConnectionStatus {
183+
Uninitialized = 0,
184+
Connecting = 1,
185+
Online = 2,
186+
ExpiredToken = 3,
187+
FailedToConnect = 4,
188+
Ended = 5,
189+
}
190+
export interface IBotConnection {
191+
connectionStatus$: BehaviorSubject<ConnectionStatus>;
192+
activity$: Observable<Activity>;
193+
reconnect(conversation: Conversation): void;
194+
end(): void;
195+
postActivity(activity: Activity): Observable<string>;
196+
}
197+
198+
export interface DirectLineOptions {
199+
secret?: string;
200+
token?: string;
201+
domain?: string;
202+
webSocket?: boolean;
203+
}
204+
export declare class DirectLine implements IBotConnection {
205+
constructor(options: DirectLineOptions);
206+
connectionStatus$: BehaviorSubject<ConnectionStatus>;
207+
activity$: Observable<Activity>;
208+
reconnect(conversation: Conversation): void;
209+
end(): void;
210+
postActivity(activity: Activity): Observable<string>;
211+
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "botframework-directlinejs",
33
"version": "0.6.0",
4-
"description": "client library for the Microsoft Bot Framework Direct Line protocol",
4+
"description": "client library for the Microsoft Bot Framework Direct Line 3.0 protocol",
55
"main": "built/directLine.js",
66
"types": "directLine.d.ts",
77
"scripts": {

0 commit comments

Comments
 (0)