This repository has been archived by the owner on Feb 8, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
84 additions
and
10 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
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(); | ||
} |
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,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); | ||
} |
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,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); | ||
} |
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,2 @@ | ||
import { Adapter } from './Adapter'; | ||
export = Adapter; |
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,11 @@ | ||
export interface IAdapterHTTPOptions { | ||
host: string; | ||
port: number; | ||
} | ||
export interface IAdapterOptions { | ||
appID: string; | ||
appSecret: string; | ||
serviceID?: string; | ||
logLevel?: string; | ||
http?: IAdapterHTTPOptions; | ||
} |
Empty file.
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 |
---|---|---|
|
@@ -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: | ||
|
@@ -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" | ||
|
||
|
@@ -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" | ||
|