Last active
December 28, 2015 03:49
-
-
Save muratg/7438117 to your computer and use it in GitHub Desktop.
JabbR definitions 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
/* Sample code -- create a .ts file, and paste the following to get started | |
/// <reference path="types.d.ts" /> | |
/// <reference path="signalr.d.ts" /> | |
// Proxies | |
var monitor: IMonitorProxy = (<any>$.connection).monitor; | |
var chat: IChatProxy = (<any>$.connection).chat; | |
// Client implementations go here... add some functions. | |
monitor.client = { | |
}; | |
chat.client = { | |
}; | |
$.connection.hub.start().done((a) => { | |
// alert('connected.'); | |
// (do something) | |
}); | |
*/ | |
// Client interfaces. These are the return types for the proxies. | |
// Implement these in your .ts file, but do not manually edit them here. | |
interface IMonitorClient { } | |
interface IChatClient { } | |
// Data interfaces | |
interface ClientMessage { | |
Id: string; | |
Content: string; | |
Room: string; | |
} | |
interface UserViewModel { | |
Name: string; | |
Hash: string; | |
Active: boolean; | |
Status: string; | |
Note: string; | |
AfkNote: string; | |
IsAfk: boolean; | |
Flag: string; | |
Country: string; | |
LastActivity: string; | |
IsAdmin: boolean; | |
} | |
interface LobbyRoomViewModel { | |
Name: string; | |
Count: number; | |
Private: boolean; | |
Closed: boolean; | |
Topic: string; | |
} | |
interface MessageViewModel { | |
HtmlEncoded: boolean; | |
Id: string; | |
Content: string; | |
HtmlContent: string; | |
When: string; | |
User: UserViewModel; | |
MessageType: number; | |
UserRoomPresence: string; | |
ImageUrl: string; | |
Source: string; | |
} | |
interface RoomViewModel { | |
Name: string; | |
Count: number; | |
Private: boolean; | |
Topic: string; | |
Closed: boolean; | |
Welcome: string; | |
Users: Array<UserViewModel>; | |
Owners: Array<string>; | |
RecentMessages: Array<MessageViewModel>; | |
} | |
interface ClientNotification { | |
Room: string; | |
ImageUrl: string; | |
Source: string; | |
Content: string; | |
} | |
// Hub interfaces | |
interface IMonitor { | |
} | |
interface IChat { | |
onConnected(): IPromise<void>; | |
join(): IPromise<void>; | |
join(reconnecting: boolean): IPromise<void>; | |
send(content: string, roomName: string): IPromise<boolean>; | |
send(clientMessage: ClientMessage): IPromise<boolean>; | |
getUserInfo(): IPromise<UserViewModel>; | |
onReconnected(): IPromise<void>; | |
onDisconnected(): IPromise<void>; | |
getCommands(): IPromise<any>; | |
getShortcuts(): IPromise<any>; | |
getRooms(): IPromise<Array<LobbyRoomViewModel>>; | |
getPreviousMessages(messageId: string): IPromise<Array<MessageViewModel>>; | |
loadRooms(roomNames: Array<any>): IPromise<void>; | |
getRoomInfo(roomName: string): IPromise<RoomViewModel>; | |
postNotification(notification: ClientNotification): IPromise<void>; | |
postNotification(notification: ClientNotification, executeContentProviders: boolean): IPromise<void>; | |
typing(roomName: string): IPromise<void>; | |
updateActivity(): IPromise<void>; | |
tabOrderChanged(tabOrdering: Array<any>): IPromise<void>; | |
} | |
// Generetated proxies | |
interface IMonitorProxy { | |
server: IMonitor; | |
client: IMonitorClient; | |
} | |
interface IChatProxy { | |
server: IChat; | |
client: IChatClient; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment