Skip to content
This repository was archived by the owner on Feb 8, 2020. It is now read-only.

Commit 2557b96

Browse files
committed
d.ts for wechat
1 parent 64b894b commit 2557b96

File tree

7 files changed

+84
-10
lines changed

7 files changed

+84
-10
lines changed

broid-wechat/lib/core/Adapter.d.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/// <reference types="bluebird" />
2+
/// <reference types="express" />
3+
import { ISendParameters } from '@broid/schemas';
4+
import * as Promise from 'bluebird';
5+
import { Router } from 'express';
6+
import { Observable } from 'rxjs/Rx';
7+
import { IAdapterOptions } from './interfaces';
8+
export declare class Adapter {
9+
serviceID: string;
10+
private appID;
11+
private appSecret;
12+
private client;
13+
private connected;
14+
private emitter;
15+
private logLevel;
16+
private logger;
17+
private parser;
18+
private router;
19+
private webhookServer;
20+
constructor(obj: IAdapterOptions);
21+
serviceId(): string;
22+
serviceName(): string;
23+
connect(): Observable<object>;
24+
disconnect(): Promise<null>;
25+
listen(): Observable<object>;
26+
users(): Promise<any | Error>;
27+
getRouter(): Router | null;
28+
send(data: ISendParameters): Promise<object | Error>;
29+
private uploadFile(url, fType, file);
30+
private setupRouter();
31+
}

broid-wechat/lib/core/Parser.d.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/// <reference types="bluebird" />
2+
import { IActivityStream } from '@broid/schemas';
3+
import * as Promise from 'bluebird';
4+
export declare class Parser {
5+
generatorName: string;
6+
serviceID: string;
7+
private logger;
8+
private userCache;
9+
private wechatClient;
10+
constructor(serviceName: string, wechatClient: any, serviceID: string, logLevel: string);
11+
validate(event: object | null): Promise<object | null>;
12+
parse(event: object): Promise<IActivityStream | null>;
13+
private getUserName(openid);
14+
private createActivityStream(normalized);
15+
private parseImage(normalized);
16+
private parseText(normalized);
17+
private parseMultiMedia(normalized, messageType, mediaType);
18+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/// <reference types="express" />
2+
/// <reference types="bluebird" />
3+
import * as Promise from 'bluebird';
4+
import * as express from 'express';
5+
import { IAdapterHTTPOptions } from './interfaces';
6+
export declare class WebHookServer {
7+
private express;
8+
private host;
9+
private httpClient;
10+
private logger;
11+
private port;
12+
constructor(options: IAdapterHTTPOptions, router: express.Router, logLevel: string);
13+
listen(): void;
14+
close(): Promise<null>;
15+
private setupExpress(router);
16+
}

broid-wechat/lib/core/index.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import { Adapter } from './Adapter';
2+
export = Adapter;

broid-wechat/lib/core/interfaces.d.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
export interface IAdapterHTTPOptions {
2+
host: string;
3+
port: number;
4+
}
5+
export interface IAdapterOptions {
6+
appID: string;
7+
appSecret: string;
8+
serviceID?: string;
9+
logLevel?: string;
10+
http?: IAdapterHTTPOptions;
11+
}

broid-wechat/lib/test/Parser.d.ts

Whitespace-only changes.

broid-wechat/yarn.lock

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1169,13 +1169,13 @@ debug-log@^1.0.1:
11691169
version "1.0.1"
11701170
resolved "https://registry.yarnpkg.com/debug-log/-/debug-log-1.0.1.tgz#2307632d4c04382b8df8a32f70b895046d52745f"
11711171

1172-
debug@2, [email protected], debug@^2.1.1, debug@^2.1.3:
1172+
debug@2, [email protected], debug@^2.1.1, debug@^2.1.3, debug@^2.6.0:
11731173
version "2.6.3"
11741174
resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.3.tgz#0f7eb8c30965ec08c72accfa0130c8b79984141d"
11751175
dependencies:
11761176
ms "0.7.2"
11771177

1178-
[email protected], debug@^2.2.0, debug@^2.6.0:
1178+
[email protected], debug@^2.2.0:
11791179
version "2.6.1"
11801180
resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.1.tgz#79855090ba2c4e3115cc7d8769491d58f0491351"
11811181
dependencies:
@@ -3783,11 +3783,7 @@ uuid@^2.0.1:
37833783
version "2.0.3"
37843784
resolved "https://registry.yarnpkg.com/uuid/-/uuid-2.0.3.tgz#67e2e863797215530dff318e5bf9dcebfd47b21a"
37853785

3786-
uuid@^3.0.0:
3787-
version "3.0.1"
3788-
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.0.1.tgz#6544bba2dfda8c1cf17e629a3a305e2bb1fee6c1"
3789-
3790-
uuid@^3.1.0:
3786+
uuid@^3.0.0, uuid@^3.1.0:
37913787
version "3.1.0"
37923788
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.1.0.tgz#3dd3d3e790abc24d7b0d3a034ffababe28ebbc04"
37933789

@@ -3819,9 +3815,9 @@ watch@^1.0.1:
38193815
exec-sh "^0.2.0"
38203816
minimist "^1.2.0"
38213817

3822-
"wechat-api@git+https://[email protected]/node-webot/wechat-api.git#295ad45e199ef93610c4d3a9350de6992a932d8c":
3823-
version "1.32.0"
3824-
resolved "git+https://git@github.com/node-webot/wechat-api.git#295ad45e199ef93610c4d3a9350de6992a932d8c"
3818+
wechat-api@^1.35.0:
3819+
version "1.35.1"
3820+
resolved "https://registry.yarnpkg.com/wechat-api/-/wechat-api-1.35.1.tgz#cd639bc1729ecb5d80a6ac92064c24d8ed8ee65b"
38253821
dependencies:
38263822
formstream ">=1.0.0"
38273823
urllib "2.21.0"

0 commit comments

Comments
 (0)