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

Commit

Permalink
d.ts for wechat
Browse files Browse the repository at this point in the history
  • Loading branch information
tenorok committed Dec 17, 2017
1 parent 64b894b commit 2557b96
Show file tree
Hide file tree
Showing 7 changed files with 84 additions and 10 deletions.
31 changes: 31 additions & 0 deletions broid-wechat/lib/core/Adapter.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/// <reference types="bluebird" />
/// <reference types="express" />
import { ISendParameters } from '@broid/schemas';
import * as Promise from 'bluebird';
import { Router } from 'express';
import { Observable } from 'rxjs/Rx';
import { IAdapterOptions } from './interfaces';
export declare class Adapter {
serviceID: string;
private appID;
private appSecret;
private client;
private connected;
private emitter;
private logLevel;
private logger;
private parser;
private router;
private webhookServer;
constructor(obj: IAdapterOptions);
serviceId(): string;
serviceName(): string;
connect(): Observable<object>;
disconnect(): Promise<null>;
listen(): Observable<object>;
users(): Promise<any | Error>;
getRouter(): Router | null;
send(data: ISendParameters): Promise<object | Error>;
private uploadFile(url, fType, file);
private setupRouter();
}
18 changes: 18 additions & 0 deletions broid-wechat/lib/core/Parser.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/// <reference types="bluebird" />
import { IActivityStream } from '@broid/schemas';
import * as Promise from 'bluebird';
export declare class Parser {
generatorName: string;
serviceID: string;
private logger;
private userCache;
private wechatClient;
constructor(serviceName: string, wechatClient: any, serviceID: string, logLevel: string);
validate(event: object | null): Promise<object | null>;
parse(event: object): Promise<IActivityStream | null>;
private getUserName(openid);
private createActivityStream(normalized);
private parseImage(normalized);
private parseText(normalized);
private parseMultiMedia(normalized, messageType, mediaType);
}
16 changes: 16 additions & 0 deletions broid-wechat/lib/core/WebHookServer.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/// <reference types="express" />
/// <reference types="bluebird" />
import * as Promise from 'bluebird';
import * as express from 'express';
import { IAdapterHTTPOptions } from './interfaces';
export declare class WebHookServer {
private express;
private host;
private httpClient;
private logger;
private port;
constructor(options: IAdapterHTTPOptions, router: express.Router, logLevel: string);
listen(): void;
close(): Promise<null>;
private setupExpress(router);
}
2 changes: 2 additions & 0 deletions broid-wechat/lib/core/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import { Adapter } from './Adapter';
export = Adapter;
11 changes: 11 additions & 0 deletions broid-wechat/lib/core/interfaces.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export interface IAdapterHTTPOptions {
host: string;
port: number;
}
export interface IAdapterOptions {
appID: string;
appSecret: string;
serviceID?: string;
logLevel?: string;
http?: IAdapterHTTPOptions;
}
Empty file.
16 changes: 6 additions & 10 deletions broid-wechat/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1169,13 +1169,13 @@ debug-log@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/debug-log/-/debug-log-1.0.1.tgz#2307632d4c04382b8df8a32f70b895046d52745f"

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

[email protected], debug@^2.2.0, debug@^2.6.0:
[email protected], debug@^2.2.0:
version "2.6.1"
resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.1.tgz#79855090ba2c4e3115cc7d8769491d58f0491351"
dependencies:
Expand Down Expand Up @@ -3783,11 +3783,7 @@ uuid@^2.0.1:
version "2.0.3"
resolved "https://registry.yarnpkg.com/uuid/-/uuid-2.0.3.tgz#67e2e863797215530dff318e5bf9dcebfd47b21a"

uuid@^3.0.0:
version "3.0.1"
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.0.1.tgz#6544bba2dfda8c1cf17e629a3a305e2bb1fee6c1"

uuid@^3.1.0:
uuid@^3.0.0, uuid@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.1.0.tgz#3dd3d3e790abc24d7b0d3a034ffababe28ebbc04"

Expand Down Expand Up @@ -3819,9 +3815,9 @@ watch@^1.0.1:
exec-sh "^0.2.0"
minimist "^1.2.0"

"wechat-api@git+https://[email protected]/node-webot/wechat-api.git#295ad45e199ef93610c4d3a9350de6992a932d8c":
version "1.32.0"
resolved "git+https://git@github.com/node-webot/wechat-api.git#295ad45e199ef93610c4d3a9350de6992a932d8c"
wechat-api@^1.35.0:
version "1.35.1"
resolved "https://registry.yarnpkg.com/wechat-api/-/wechat-api-1.35.1.tgz#cd639bc1729ecb5d80a6ac92064c24d8ed8ee65b"
dependencies:
formstream ">=1.0.0"
urllib "2.21.0"
Expand Down

0 comments on commit 2557b96

Please sign in to comment.