Created
October 7, 2012 21:30
-
-
Save paulbatum/3849662 to your computer and use it in GitHub Desktop.
TypeScript declaration file for Windows Azure Mobile Services server scripts
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
// TypeScript declaration file for Windows Azure Mobile Services server scripts | |
// WORK IN PROGRESS | |
interface ZumoError { | |
} | |
interface StatusCodes { | |
OK: number; | |
NOT_FOUND: number; | |
} | |
interface Tables { | |
getTable(tableName: string): Table; | |
} | |
interface Table extends Query { | |
update(item: { }): void; | |
update(item: { }, options: { | |
success: () => void; | |
error?: (err: ZumoError) => void; | |
}): void; | |
insert(item: { }): void; | |
insert(item: { }, options: { | |
success: () => void; | |
error?: (err: ZumoError) => void; | |
}): void; | |
del(id: number): void; | |
del(item: { }): void; | |
del(item: { }, options: { | |
success: () => void; | |
error?: (err: ZumoError) => void; | |
}): void; | |
} | |
interface Query { | |
orderBy(column: string, ...more: string[]): Query; | |
orderByDescending(column: string, ...more: string[]): Query; | |
select(column: string, ...more: string[]): Query; | |
select(projection: () => any): Query; | |
skip(recordCount: number): Query; | |
take(recordCount: number): Query; | |
where(exampleObject: { }): Query; | |
where(predicate: () => bool): Query; | |
where(predicate: (arg1: any) => bool, arg1: any): Query; | |
where(predicate: (arg1: any, arg2: any) => bool, arg1: any, arg2: any): Query; | |
where(predicate: (arg1: any, arg2: any, arg3: any) => bool, arg1: any, arg2: any, arg3: any): Query; | |
where(predicate: (arg1: any, arg2: any, arg3: any, ...args: any[]) => bool, arg1: any, arg2: any, arg3: any, ...args: any[]): Query; | |
read(options: { | |
success: (results: any[]) => void; | |
error?: (err: ZumoError) => void; | |
}): void; | |
} | |
interface RequestBase { | |
respond(): void; | |
respond(status: number): void; | |
respond(status: number, response: any): void; | |
parameters: any; | |
} | |
interface Request extends RequestBase { | |
execute(): void; | |
execute(options: { | |
success: () => void; | |
error?: (err: ZumoError) => void; | |
}): void; | |
} | |
interface ReadRequest extends RequestBase { | |
execute(): void; | |
execute(options: { | |
success: (results: any[]) => void; | |
error?: (err: ZumoError) => void; | |
}): void; | |
} | |
interface User { | |
userId: string; | |
level: string; | |
} | |
// Globals | |
declare var statusCodes: StatusCodes; | |
declare var tables: Tables; | |
// Script templates | |
function read(query: any, user: User, request: ReadRequest) { | |
} | |
function insert(item: any, user: User, request: Request) { | |
} | |
function update(item: { id: number; }, user: User, request: Request) { | |
} | |
function del(id: number, user: User, request: Request) { | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment