import express = require("express"); declare namespace Sails { import Request = express.Request; export interface Application {} export interface Model { attributes: Object; create(params: Object): WaterlinePromise; create(params: Array): WaterlinePromise; create(params: Object, cb: (err: Error, created: QueryResult)=>void): void; create(params: Array, cb: (err: Error, created: Array)=>void): void; find(): QueryBuilder; find(params: Object): QueryBuilder; find(params: Object): WaterlinePromise>; findOne(criteria: Object): WaterlinePromise; count(criteria: Object): WaterlinePromise; count(criteria: Array): WaterlinePromise; count(criteria: string): WaterlinePromise; count(criteria: number): WaterlinePromise; count(criteria: Object, cb: (err: Error, found: number)=>void); count(criteria: Array, cb: (err: Error, found: number)=>void); count(criteria: string, cb: (err: Error, found: number)=>void); count(criteria: number, cb: (err: Error, found: number)=>void); destroy(criteria: Object): WaterlinePromise>; destroy(criteria: Array): WaterlinePromise>; destroy(criteria: string): WaterlinePromise>; destroy(criteria: number): WaterlinePromise>; destroy(criteria: Object, cb: (err: Error, deleted: Array)=>void): void; destroy(criteria: Array, cb: (err: Error, deleted: Array)=>void): void; destroy(criteria: string, cb: (err: Error, deleted: Array)=>void): void; destroy(criteria: number, cb: (err: Error, deleted: Array)=>void): void; update(criteria: Object, changes: Object): WaterlinePromise>; update(criteria: Array, changes: Object): WaterlinePromise>; update(criteria: string, changes: Object): WaterlinePromise>; update(criteria: number, changes: Object): WaterlinePromise>; update(criteria: Object, changes: Array): WaterlinePromise>; update(criteria: Array, changes: Array): WaterlinePromise>; update(criteria: string, changes: Array): WaterlinePromise>; update(criteria: number, changes: Array): WaterlinePromise>; update(criteria: Object, changes: Array, cb: (err: Error, updated: Array)=>void): void; update(criteria: Array, changes: Array, cb: (err: Error, updated: Array)=>void): void; update(criteria: string, changes: Array, cb: (err: Error, updated: Array)=>void): void; update(criteria: number, changes: Array, cb: (err: Error, updated: Array)=>void): void; query(sqlQuery: string, cb: (err: Error, results: Array)=>void); native(cb: (err: Error, collection: Model)=>void); stream(criteria: Object, writeEnd: Object): NodeJS.WritableStream; stream(criteria: Array, writeEnd: Object): NodeJS.WritableStream; stream(criteria: string, writeEnd: Object): NodeJS.WritableStream; stream(criteria: number, writeEnd: Object): NodeJS.WritableStream; stream(criteria: Object, writeEnd: Object): Error; stream(criteria: Array, writeEnd: Object): Error; stream(criteria: string, writeEnd: Object): Error; stream(criteria: number, writeEnd: Object): Error; } export interface Req extends express.Request { } export interface Res extends express.Response { attachement(filename:string); badRequest(); badRequest(data:any); badRequest(data:any, pathToView:string); serverError(); serverError(data:any); serverError(data:any, pathToView:string); view(route: string); } export class WaterlinePromise extends Promise { exec(cb: (err: Error, results: Array)=>void); exec(cb: (err: Error, result: QueryResult)=>void); } export class Record { id: number; createdAt: Date; updatedAt: Date; } export class QueryResult extends Record { destroy(): Promise>; toJSON(): Object; } export class QueryBuilder extends Promise { exec(cb: (error: any, results: Array)=>void); where(condition: Object): QueryBuilder; limit(lim: number): QueryBuilder; skip(num: number): QueryBuilder; sort(criteria: string): QueryBuilder; populate(association: string): QueryBuilder; populate(association: string, filter: Object): QueryBuilder; } export interface Controller {} }