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

Add declarations #181

Open
wants to merge 2 commits into
base: devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions _tools/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"compilerOptions": {
"declaration": true,
"removeComments": true,
"preserveConstEnums": true,
"moduleResolution": "node",
Expand Down
26 changes: 26 additions & 0 deletions broid-alexa/lib/core/Adapter.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/// <reference types="bluebird" />
import * as Promise from 'bluebird';
import { Router } from 'express';
import { Observable } from 'rxjs/Rx';
import { IAdapter, IAdapterOptions } from './interfaces';
export declare class Adapter implements IAdapter {
private serviceID;
private connected;
private emitter;
private parser;
private logLevel;
private logger;
private router;
private webhookServer;
constructor(obj?: IAdapterOptions);
serviceName(): string;
getRouter(): Router | null;
users(): Promise<Map<string, object> | Error>;
channels(): Promise<Map<string, object> | Error>;
serviceId(): string;
connect(): Observable<object>;
disconnect(): Promise<null>;
listen(): Observable<object>;
send(data: any): Promise<object | Error>;
private setupRouter();
}
11 changes: 11 additions & 0 deletions broid-alexa/lib/core/Parser.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/// <reference types="bluebird" />
import * as Promise from 'bluebird';
export declare class Parser {
serviceID: string;
generatorName: string;
private logger;
constructor(serviceName: string, serviceID: string, logLevel: string);
validate(event: any): Promise<object | null>;
parse(event: any): Promise<object | null>;
private createActivityStream();
}
16 changes: 16 additions & 0 deletions broid-alexa/lib/core/WebHookServer.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/// <reference types="bluebird" />
import * as Promise from 'bluebird';
import * as express from 'express';
import { IAdapterHTTPOptions } from './interfaces';
export declare class WebHookServer {
emitAsync: any;
private express;
private logger;
private httpClient;
private host;
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-alexa/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;
24 changes: 24 additions & 0 deletions broid-alexa/lib/core/interfaces.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/// <reference types="bluebird" />
import * as Promise from 'bluebird';
import { Router } from 'express';
import { Observable } from 'rxjs/Rx';
export interface IAdapterHTTPOptions {
host: string;
port: number;
}
export interface IAdapterOptions {
http?: IAdapterHTTPOptions;
logLevel?: string;
serviceID?: string;
}
export interface IAdapter {
serviceName(): string;
serviceId(): string;
getRouter(): Router | null;
users(): Promise<Map<string, object> | Error>;
channels(): Promise<Map<string, object> | Error>;
connect(): Observable<object>;
disconnect(): Promise<null>;
listen(): Observable<object>;
send(data: any): Promise<object | Error>;
}
Empty file.
Empty file.
1 change: 1 addition & 0 deletions broid-alexa/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"engines": {
"node": ">=6.0.0"
},
"types": "./lib/core/index.d.ts",
"scripts": {
"build": "yarn run clean && yarn run copy && yarn run copy:config && tsc -p tsconfig.json",
"clean": "rm -rf lib && rm -rf tsconfig.json && rm -rf tslint.json",
Expand Down
4 changes: 2 additions & 2 deletions broid-alexa/src/core/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ export interface IAdapterHTTPOptions {

export interface IAdapterOptions {
http?: IAdapterHTTPOptions;
logLevel: string;
serviceID: string;
logLevel?: string;
serviceID?: string;
}

export interface IAdapter {
Expand Down
30 changes: 30 additions & 0 deletions broid-callr/lib/core/Adapter.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import * as Promise from 'bluebird';
import { Router } from 'express';
import { Observable } from 'rxjs/Rx';
import { IAdapterOptions } from './interfaces';
export declare class Adapter {
private serviceID;
private token;
private tokenSecret;
private connected;
private emitter;
private session;
private parser;
private logLevel;
private username;
private logger;
private router;
private webhookServer;
private webhookURL;
constructor(obj: IAdapterOptions);
users(): Promise<Error>;
channels(): Promise<Error>;
serviceName(): string;
serviceId(): string;
getRouter(): Router;
connect(): Observable<object>;
disconnect(): Promise<null>;
listen(): Observable<object>;
send(data: object): Promise<object | Error>;
private setupRouter();
}
14 changes: 14 additions & 0 deletions broid-callr/lib/core/Parser.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { IActivityStream } from '@broid/schemas';
import * as Promise from 'bluebird';
import { ICallrWebHookEvent } from './interfaces';
export declare class Parser {
serviceID: string;
generatorName: string;
private logger;
constructor(serviceName: string, serviceID: string, logLevel: string);
validate(event: any): Promise<object>;
parse(event: any): Promise<IActivityStream>;
normalize(event: ICallrWebHookEvent): Promise<any>;
private createIdentifier();
private createActivityStream(normalized);
}
14 changes: 14 additions & 0 deletions broid-callr/lib/core/WebHookServer.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import * as Promise from 'bluebird';
import * as express from 'express';
import { IAdapterHTTPOptions } from './interfaces';
export declare class WebHookServer {
private express;
private logger;
private httpClient;
private host;
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-callr/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;
17 changes: 17 additions & 0 deletions broid-callr/lib/core/interfaces.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
export interface IAdapterHTTPOptions {
host: string;
port: number;
}
export interface IAdapterOptions {
logLevel?: string;
serviceID?: string;
token: string;
tokenSecret: string;
username: string;
webhookURL: string;
http?: IAdapterHTTPOptions;
}
export interface ICallrWebHookEvent {
request: any;
response: any;
}
Empty file.
1 change: 1 addition & 0 deletions broid-callr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"engines": {
"node": ">=6.0.0"
},
"types": "./lib/core/index.d.ts",
"scripts": {
"build": "yarn run clean && yarn run copy && yarn run copy:config && tsc -p tsconfig.json",
"clean": "rm -rf lib && rm -rf tsconfig.json && rm -rf tslint.json",
Expand Down
4 changes: 2 additions & 2 deletions broid-callr/src/core/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ export interface IAdapterHTTPOptions {
}

export interface IAdapterOptions {
logLevel: string;
serviceID: string;
logLevel?: string;
serviceID?: string;
token: string;
tokenSecret: string;
username: string;
Expand Down
23 changes: 23 additions & 0 deletions broid-discord/lib/core/Adapter.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/// <reference types="bluebird" />
import * as Promise from 'bluebird';
import { Observable } from 'rxjs/Rx';
import { IAdapterOptions } from './interfaces';
export declare class Adapter {
serviceID: string;
token: string | null;
private connected;
private session;
private parser;
private logLevel;
private logger;
constructor(obj?: IAdapterOptions);
users(): Promise<any>;
channels(): Promise<any>;
serviceId(): string;
serviceName(): string;
getRouter(): null;
connect(): Observable<any>;
disconnect(): Promise<null>;
listen(): Observable<any>;
send(data: object): Promise<object | Error>;
}
12 changes: 12 additions & 0 deletions broid-discord/lib/core/Parser.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/// <reference types="bluebird" />
import * as Promise from 'bluebird';
export declare class Parser {
serviceID: string;
generatorName: string;
private logger;
constructor(serviceName: string, serviceID: string, logLevel: string);
validate(event: any): Promise<object | null>;
parse(event: any): Promise<any>;
private parseMedia(media, content);
private createActivityStream(normalized);
}
2 changes: 2 additions & 0 deletions broid-discord/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;
17 changes: 17 additions & 0 deletions broid-discord/lib/core/interfaces.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
export interface IAdapterOptions {
token: string;
serviceID?: string;
logLevel?: string;
}
export interface IUserInformations {
readonly id: string;
readonly username: string;
readonly is_bot: boolean;
readonly avatar: string;
}
export interface IChannelInformations {
readonly guildID: string;
readonly id: string;
readonly name: string;
readonly topic: string;
}
Empty file.
1 change: 1 addition & 0 deletions broid-discord/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"engines": {
"node": ">=6.0.0"
},
"types": "./lib/core/index.d.ts",
"scripts": {
"build": "yarn run clean && yarn run copy && yarn run copy:config && tsc -p tsconfig.json",
"clean": "rm -rf lib && rm -rf tsconfig.json && rm -rf tslint.json",
Expand Down
4 changes: 2 additions & 2 deletions broid-discord/src/core/interfaces.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export interface IAdapterOptions {
token: string;
serviceID: string;
logLevel: string;
serviceID?: string;
logLevel?: string;
}

export interface IUserInformations {
Expand Down
26 changes: 26 additions & 0 deletions broid-flowdock/lib/core/Adapter.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import * as Promise from 'bluebird';
import { Observable } from 'rxjs/Rx';
import { IAdapterOptions } from './interfaces';
export declare class Adapter {
private connected;
private serviceID;
private token;
private session;
private parser;
private logLevel;
private logger;
private storeUsers;
private storeFlows;
constructor(obj?: IAdapterOptions);
users(): Promise<Map<string, any>>;
channels(): Promise<Map<string, any>>;
serviceId(): string;
serviceName(): string;
getRouter(): null;
connect(): Observable<object>;
disconnect(): Promise<null>;
listen(): Observable<object>;
send(data: any): Promise<object | Error>;
private userByID(userID);
private flowByID(flowID);
}
11 changes: 11 additions & 0 deletions broid-flowdock/lib/core/Parser.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import * as Promise from 'bluebird';
export declare class Parser {
serviceID: string;
generatorName: string;
private logger;
constructor(serviceName: string, serviceID: string, logLevel: string);
validate(event: any): Promise<object>;
parse(event: any): Promise<any>;
private createIdentifier();
private createActivityStream(normalized);
}
2 changes: 2 additions & 0 deletions broid-flowdock/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;
5 changes: 5 additions & 0 deletions broid-flowdock/lib/core/interfaces.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export interface IAdapterOptions {
token: string;
serviceID?: string;
logLevel?: string;
}
Empty file.
1 change: 1 addition & 0 deletions broid-flowdock/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"engines": {
"node": ">=6.0.0"
},
"types": "./lib/core/index.d.ts",
"scripts": {
"build": "yarn run clean && yarn run copy && yarn run copy:config && tsc -p tsconfig.json",
"clean": "rm -rf lib && rm -rf tsconfig.json && rm -rf tslint.json",
Expand Down
4 changes: 2 additions & 2 deletions broid-flowdock/src/core/interfaces.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export interface IAdapterOptions {
token: string;
serviceID: string;
logLevel: string;
serviceID?: string;
logLevel?: string;
}
25 changes: 25 additions & 0 deletions broid-gitter/lib/core/Adapter.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import * as Promise from 'bluebird';
import { Observable } from 'rxjs/Rx';
import { IAdapterOptions } from './interfaces';
export declare class Adapter {
private ee;
private logLevel;
private logger;
private connected;
private me;
private parser;
private serviceID;
private session;
private token;
constructor(obj?: IAdapterOptions);
users(): Promise<Error>;
channels(): Promise<any>;
serviceName(): string;
serviceId(): string;
getRouter(): null;
connect(): Observable<object>;
disconnect(): Promise<null>;
listen(): Observable<object>;
send(data: any): Promise<object | Error>;
private joinRoom(room);
}
11 changes: 11 additions & 0 deletions broid-gitter/lib/core/Parser.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import * as Promise from 'bluebird';
export declare class Parser {
serviceID: string;
generatorName: string;
private logger;
constructor(serviceName: string, serviceID: string, logLevel: string);
validate(event: any): Promise<object | null>;
parse(event: any): Promise<object | null>;
private createIdentifier();
private createActivityStream(normalized);
}
2 changes: 2 additions & 0 deletions broid-gitter/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;
5 changes: 5 additions & 0 deletions broid-gitter/lib/core/interfaces.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export interface IAdapterOptions {
logLevel?: string;
serviceID?: string;
token: string;
}
Empty file.
Loading