/* tslint:disable */// Generated by Haxe TypeScript Declaration Generator :)
import { snikket as enums } from "./snikket-enums";
export namespace snikket {
export class Caps {
constructor(node: string, identities: snikket.Identity[], features: string[]);
node: string;
identities: snikket.Identity[];
features: string[];
isChannel(chatId: string): boolean;
discoReply(): snikket.Stanza;
addC(stanza: snikket.Stanza): snikket.Stanza;
verRaw(): snikket.Hash;
ver(): string;
}
}
export namespace snikket {
export class Identity {
constructor(category: string, type: string, name: string);
category: string;
type: string;
name: string;
addToDisco(stanza: snikket.Stanza): void;
ver(): string;
}
}
export namespace snikket {
export class GenericStream extends snikket.EventEmitter {
constructor();
_hx_constructor(): void;
clientId: string;
readonly csi: boolean;
connect(jid: string, sm: ArrayBuffer): void;
disconnect(): void;
sendStanza(stanza: snikket.Stanza): void;
newId(): string;
onIq(type: any, tag: string, xmlns: string, handler: (arg0: snikket.Stanza) => any): void;
sendIq(stanza: snikket.Stanza, callback: (stanza: snikket.Stanza) => void): void;
}
}
export namespace snikket {
export class Chat {
protected constructor(client: snikket.Client, stream: snikket.GenericStream, persistence: snikket.Persistence, chatId: string, uiState?: enums.UiState, isBlocked?: boolean, extensions?: snikket.Stanza, readUpToId?: string, readUpToBy?: string);
/**
* ID of this Chat
*/
readonly chatId: string;
/**
* Current state of this chat
*/
readonly uiState: enums.UiState;
readonly isBlocked: boolean;
/**
* Fetch a page of messages before some point
* @param beforeId id of the message to look before
* @param beforeTime timestamp of the message to look before,
* String in format YYYY-MM-DDThh:mm:ss[.sss]+00:00
* @param handler takes one argument, an array of ChatMessage that are found
*/
getMessagesBefore(beforeId: string, beforeTime: string, handler: (arg0: snikket.ChatMessage[]) => void): void;
/**
* Fetch a page of messages after some point
* @param afterId id of the message to look after
* @param afterTime timestamp of the message to look after,
* String in format YYYY-MM-DDThh:mm:ss[.sss]+00:00
* @param handler takes one argument, an array of ChatMessage that are found
*/
getMessagesAfter(afterId: string, afterTime: string, handler: (arg0: snikket.ChatMessage[]) => void): void;
/**
* Fetch a page of messages around (before, including, and after) some point
* @param aroundId id of the message to look around
* @param aroundTime timestamp of the message to look around,
* String in format YYYY-MM-DDThh:mm:ss[.sss]+00:00
* @param handler takes one argument, an array of ChatMessage that are found
*/
getMessagesAround(aroundId: string, aroundTime: string, handler: (arg0: snikket.ChatMessage[]) => void): void;
/**
* Send a ChatMessage to this Chat
* @param message the ChatMessage to send
*/
sendMessage(message: snikket.ChatMessageBuilder): void;
/**
* Signals that all messages up to and including this one have probably
* been displayed to the user
* @param message the ChatMessage most recently displayed
*/
markReadUpTo(message: snikket.ChatMessage): void;
/**
* Save this Chat on the server
*/
bookmark(): void;
/**
* Get the list of IDs of participants in this Chat
* @returns array of IDs
*/
getParticipants(): string[];
/**
* Get the details for one participant in this Chat
* @param participantId the ID of the participant to look up
*/
getParticipantDetails(participantId: string): snikket.Participant;
/**
* Correct an already-send message by replacing it with a new one
* @param localId the localId of the message to correct
* must be the localId of the first version ever sent, not a subsequent correction
* @param message the new ChatMessage to replace it with
*/
correctMessage(localId: string, message: snikket.ChatMessageBuilder): void;
/**
* Add new reaction to a message in this Chat
* @param m ChatMessage to react to
* @param reaction emoji of the reaction
*/
addReaction(m: snikket.ChatMessage, reaction: snikket.Reaction): void;
/**
* Remove an already-sent reaction from a message
* @param m ChatMessage to remove the reaction from
* @param reaction the emoji to remove
*/
removeReaction(m: snikket.ChatMessage, reaction: snikket.Reaction): void;
/**
* Call this whenever the user is typing, can call on every keystroke
* @param threadId optional, what thread the user has selected if any
* @param content optional, what the user has typed so far
*/
typing(threadId: string, content: string): void;
/**
* Call this whenever the user makes a chat or thread "active" in your UX
* If you call this with true you MUST later call it will false
* @param active true if the chat is "active", false otherwise
* @param threadId optional, what thread the user has selected if any
*/
setActive(active: boolean, threadId: string): void;
/**
* Archive this chat
*/
close(): void;
/**
* Pin or unpin this chat
*/
togglePinned(): void;
/**
* Block this chat so it will not re-open
*/
block(reportSpam: snikket.ChatMessage, onServer: boolean): void;
/**
* Unblock this chat so it will open again
*/
unblock(onServer: boolean): void;
/**
* An ID of the most recent message in this chat
*/
lastMessageId(): string;
/**
* The timestamp of the most recent message in this chat
*/
lastMessageTimestamp(): string;
/**
* Get the URI image to represent this Chat, or null
*/
getPhoto(): string;
/**
* Get the URI to a placeholder image to represent this Chat
*/
getPlaceholder(): string;
/**
* An ID of the last message displayed to the user
*/
readUpTo(): string;
/**
* The number of message that have not yet been displayed to the user
*/
unreadCount(): number;
/**
* A preview of the chat, such as the most recent message body
*/
preview(): string;
setDisplayName(fn: string): void;
/**
* The display name of this Chat
*/
getDisplayName(): string;
setTrusted(trusted: boolean): void;
/**
* Is this a chat with an entity we trust to see our online status?
*/
isTrusted(): boolean;
syncing(): boolean;
/**
* Can audio calls be started in this Chat?
*/
canAudioCall(): boolean;
/**
* Can video calls be started in this Chat?
*/
canVideoCall(): boolean;
/**
* Start a new call in this Chat
* @param audio do we want audio in this call
* @param video do we want video in this call
*/
startCall(audio: boolean, video: boolean): void;
addMedia(streams: MediaStream[]): void;
/**
* Accept any incoming calls in this Chat
*/
acceptCall(): void;
/**
* Hangup or reject any calls in this chat
*/
hangup(): void;
/**
* The current status of a call in this chat
*/
callStatus(): string;
/**
* A DTMFSender for a call in this chat, or NULL
*/
dtmf(): RTCDTMFSender;
/**
* All video tracks in all active calls in this chat
*/
videoTracks(): MediaStreamTrack[];
}
}
export namespace snikket {
export class DirectChat extends snikket.Chat {
protected constructor(client: snikket.Client, stream: snikket.GenericStream, persistence: snikket.Persistence, chatId: string, uiState?: enums.UiState, isBlocked?: boolean, extensions?: snikket.Stanza, readUpToId?: string, readUpToBy?: string);
getParticipants(): string[];
getParticipantDetails(participantId: string): snikket.Participant;
getMessagesBefore(beforeId: string, beforeTime: string, handler: (arg0: snikket.ChatMessage[]) => void): void;
getMessagesAfter(afterId: string, afterTime: string, handler: (arg0: snikket.ChatMessage[]) => void): void;
getMessagesAround(aroundId: string, aroundTime: string, handler: (arg0: snikket.ChatMessage[]) => void): void;
correctMessage(localId: string, message: snikket.ChatMessageBuilder): void;
sendMessage(message: snikket.ChatMessageBuilder): void;
removeReaction(m: snikket.ChatMessage, reaction: snikket.Reaction): void;
lastMessageId(): string;
markReadUpTo(message: snikket.ChatMessage): void;
bookmark(): void;
close(): void;
}
}
export namespace snikket {
export class Channel extends snikket.Chat {
protected constructor(client: snikket.Client, stream: snikket.GenericStream, persistence: snikket.Persistence, chatId: string, uiState?: enums.UiState, isBlocked?: boolean, extensions?: snikket.Stanza, readUpToId?: string, readUpToBy?: string, disco?: snikket.Caps);
setPresence(resource: string, presence: snikket.Presence): void;
isTrusted(): boolean;
preview(): string;
syncing(): boolean;
canAudioCall(): boolean;
canVideoCall(): boolean;
getParticipants(): string[];
getParticipantDetails(participantId: string): snikket.Participant;
getMessagesBefore(beforeId: string, beforeTime: string, handler: (arg0: snikket.ChatMessage[]) => void): void;
getMessagesAfter(afterId: string, afterTime: string, handler: (arg0: snikket.ChatMessage[]) => void): void;
getMessagesAround(aroundId: string, aroundTime: string, handler: (arg0: snikket.ChatMessage[]) => void): void;
correctMessage(localId: string, message: snikket.ChatMessageBuilder): void;
sendMessage(message: snikket.ChatMessageBuilder): void;
removeReaction(m: snikket.ChatMessage, reaction: snikket.Reaction): void;
lastMessageId(): string;
markReadUpTo(message: snikket.ChatMessage): void;
bookmark(): void;
close(): void;
}
}
export namespace snikket {
export class AvailableChat {
protected constructor(chatId: string, displayName: string, note: string, caps: snikket.Caps);
/**
* The ID of the Chat this search result represents
*/
chatId: string;
/**
* The display name of this search result
*/
displayName: string;
/**
* A human-readable note associated with this search result
*/
note: string;
/**
* Is this search result a channel?
*/
isChannel(): boolean;
}
}
export namespace snikket {
export class SerializedChat {
constructor(chatId: string, trusted: boolean, avatarSha1: ArrayBuffer, presence: Map<string,snikket.Presence>, displayName: string, uiState: enums.UiState, isBlocked: boolean, extensions: string, readUpToId: string, readUpToBy: string, disco: snikket.Caps, klass: string);
chatId: string;
trusted: boolean;
avatarSha1: ArrayBuffer;
presence: Map<string,snikket.Presence>;
displayName: string;
uiState: enums.UiState;
isBlocked: boolean;
extensions: string;
readUpToId: string;
readUpToBy: string;
disco: snikket.Caps;
klass: string;
toChat(client: snikket.Client, stream: snikket.GenericStream, persistence: snikket.Persistence): snikket.Chat;
}
}
export namespace snikket {
export class ChatAttachment {
constructor(name: string, mime: string, size: number, uris: string[], hashes: snikket.Hash[]);
name: string;
mime: string;
size: number;
uris: string[];
hashes: snikket.Hash[];
}
}
export namespace snikket {
export class ChatMessage {
protected constructor(params: {attachments?: snikket.ChatAttachment[], direction?: enums.MessageDirection, from: snikket.JID, lang?: string, localId?: string, payloads?: snikket.Stanza[], reactions?: Map<string,snikket.Reaction[]>, recipients?: snikket.JID[], replyId?: string, replyTo?: snikket.JID[], replyToMessage?: snikket.ChatMessage, senderId: string, serverId?: string, serverIdBy?: string, stanza?: snikket.Stanza, status?: enums.MessageStatus, syncPoint?: boolean, text?: string, threadId?: string, timestamp: string, to: snikket.JID, type?: enums.MessageType, versions?: snikket.ChatMessage[]});
/**
* The ID as set by the creator of this message
*/
localId: string;
/**
* The ID as set by the authoritative server
*/
serverId: string;
/**
* The ID of the server which set the serverId
*/
serverIdBy: string;
/**
* The type of this message (Chat, Call, etc)
*/
type: enums.MessageType;
/**
* The timestamp of this message, in format YYYY-MM-DDThh:mm:ss[.sss]Z
*/
timestamp: string;
/**
* The ID of the sender of this message
*/
senderId: string;
/**
* Message this one is in reply to, or NULL
*/
readonly replyToMessage: snikket.ChatMessage;
/**
* ID of the thread this message is in, or NULL
*/
threadId: string;
/**
* Array of attachments to this message
*/
attachments: snikket.ChatAttachment[];
/**
* Map of reactions to this message
*/
readonly reactions: Map<string,snikket.Reaction[]>;
/**
* Body text of this message or NULL
*/
text: string;
/**
* Language code for the body text
*/
lang: string;
/**
* Direction of this message
*/
direction: enums.MessageDirection;
/**
* Status of this message
*/
status: enums.MessageStatus;
/**
* Array of past versions of this message, if it has been edited
*/
versions: snikket.ChatMessage[];
stanza: snikket.Stanza;
/**
* Create a new ChatMessage in reply to this one
*/
reply(): snikket.ChatMessageBuilder;
getReplyId(): string;
/**
* Get HTML version of the message body
* WARNING: this is possibly untrusted HTML. You must parse or sanitize appropriately!
*/
html(): string;
/**
* The ID of the Chat this message is associated with
*/
chatId(): string;
/**
* The ID of the account associated with this message
*/
account(): string;
/**
* Is this an incoming message?
*/
isIncoming(): boolean;
/**
* The URI of an icon for the thread associated with this message, or NULL
*/
threadIcon(): string;
/**
* The last status of the call if this message is related to a call
*/
callStatus(): string;
/**
* The session id of the call if this message is related to a call
*/
callSid(): string;
/**
* The duration of the call if this message is related to a call
*/
callDuration(): string;
}
}
export namespace snikket {
export class ChatMessageBuilder {
/**
* @returns a new blank ChatMessageBuilder
*/
constructor(params?: {attachments?: snikket.ChatAttachment[], direction?: enums.MessageDirection, html?: string, lang?: string, localId?: string, payloads?: snikket.Stanza[], reactions?: Map<string,snikket.Reaction[]>, replyId?: string, replyToMessage?: snikket.ChatMessage, senderId?: string, serverId?: string, serverIdBy?: string, status?: enums.MessageStatus, syncPoint?: boolean, text?: string, threadId?: string, timestamp?: string, type?: enums.MessageType, versions?: snikket.ChatMessage[]});
/**
* The ID as set by the creator of this message
*/
localId: string;
/**
* The ID as set by the authoritative server
*/
serverId: string;
/**
* The ID of the server which set the serverId
*/
serverIdBy: string;
/**
* The type of this message (Chat, Call, etc)
*/
type: enums.MessageType;
/**
* The timestamp of this message, in format YYYY-MM-DDThh:mm:ss[.sss]+00:00
*/
timestamp: string;
/**
* Message this one is in reply to, or NULL
*/
replyToMessage: snikket.ChatMessage;
/**
* ID of the thread this message is in, or NULL
*/
threadId: string;
/**
* Array of attachments to this message
*/
readonly attachments: snikket.ChatAttachment[];
/**
* Map of reactions to this message
*/
reactions: Map<string,snikket.Reaction[]>;
/**
* Body text of this message or NULL
*/
text: string;
/**
* Language code for the body text
*/
lang: string;
/**
* Direction of this message
*/
direction: enums.MessageDirection;
/**
* Status of this message
*/
status: enums.MessageStatus;
/**
* Array of past versions of this message, if it has been edited
*/
readonly versions: snikket.ChatMessage[];
addAttachment(attachment: snikket.ChatAttachment): void;
/**
* Set rich text using an HTML string
* Also sets the plain text body appropriately
*/
setHtml(html: string): void;
/**
* The ID of the Chat this message is associated with
*/
chatId(): string;
/**
* The ID of the sender of this message
*/
get_senderId(): string;
isIncoming(): boolean;
build(): snikket.ChatMessage;
}
}
export namespace snikket {
export class EventHandler {
constructor(handlers: snikket.EventHandler[], callback: (arg0: any) => any, onlyOnce?: boolean);
call(data: any): any;
once(): snikket.EventHandler;
unsubscribe(): void;
}
}
export namespace snikket {
export class EventEmitter {
protected constructor();
once(eventName: string, callback: (arg0: any) => any): snikket.EventHandler;
trigger(eventName: string, eventData: any): any;
}
}
export namespace snikket.jingle {
export interface Session {
get_sid(): string;
accept(): void;
hangup(): void;
addMedia(streams: MediaStream[]): void;
callStatus(): string;
videoTracks(): MediaStreamTrack[];
dtmf(): RTCDTMFSender;
}
}
export namespace snikket.jingle {
export class Attribute {
constructor(key: string, value: string);
readonly key: string;
readonly value: string;
toSdp(): string;
toString(): string;
static parse(input: string): snikket.jingle.Attribute;
}
}
export namespace snikket.jingle {
export class Media {
constructor(mid: string, media: string, connectionData: string, port: string, protocol: string, attributes: snikket.jingle.Attribute[], formats: number[]);
readonly mid: string;
readonly media: string;
readonly connectionData: string;
readonly port: string;
readonly protocol: string;
readonly attributes: snikket.jingle.Attribute[];
readonly formats: number[];
toSdp(): string;
contentElement(initiator: boolean): snikket.Stanza;
toElement(sessionAttributes: snikket.jingle.Attribute[], initiator: boolean): snikket.Stanza;
getUfragPwd(sessionAttributes?: snikket.jingle.Attribute[]): {pwd: string, ufrag: string};
toTransportElement(sessionAttributes: snikket.jingle.Attribute[]): snikket.Stanza;
static fromElement(content: snikket.Stanza, initiator: boolean, hasGroup: boolean, existingDescription?: snikket.jingle.SessionDescription): snikket.jingle.Media;
}
}
export namespace snikket.jingle {
export class SessionDescription {
constructor(version: number, name: string, media: snikket.jingle.Media[], attributes: snikket.jingle.Attribute[], identificationTags: string[]);
readonly version: number;
readonly name: string;
readonly media: snikket.jingle.Media[];
readonly attributes: snikket.jingle.Attribute[];
readonly identificationTags: string[];
getUfragPwd(): {pwd: string, ufrag: string};
getFingerprint(): snikket.jingle.Attribute;
getDtlsSetup(): string;
addContent(newDescription: snikket.jingle.SessionDescription): snikket.jingle.SessionDescription;
toSdp(): string;
toStanza(action: string, sid: string, initiator: boolean): snikket.Stanza;
static parse(input: string): snikket.jingle.SessionDescription;
static fromStanza(iq: snikket.Stanza, initiator: boolean, existingDescription?: snikket.jingle.SessionDescription): snikket.jingle.SessionDescription;
}
}
export namespace snikket.jingle {
export class InitiatedSession implements snikket.jingle.Session {
protected constructor(client: snikket.Client, counterpart: snikket.JID, sid: string, remoteDescription: snikket.jingle.SessionDescription);
get_sid(): string;
accept(): void;
hangup(): void;
addMedia(streams: MediaStream[]): void;
callStatus(): string;
videoTracks(): MediaStreamTrack[];
dtmf(): RTCDTMFSender;
supplyMedia(streams: MediaStream[]): void;
}
}
export namespace snikket {
export class Client extends snikket.EventEmitter {
/**
* Create a new Client to connect to a particular account
* @param address the account to connect to
* @param persistence the persistence layer to use for storage
*/
constructor(address: string, persistence: snikket.Persistence);
/**
* Set to false to suppress sending available presence
*/
sendAvailable: boolean;
/**
* Start this client running and trying to connect to the server
*/
start(): void;
/**
* Destroy local data for this account
* @param completely if true chats, messages, etc will be deleted as well
*/
logout(completely: boolean): void;
/**
* Sets the password to be used in response to the password needed event
* @param password
*/
usePassword(password: string): void;
/**
* Get the account ID for this Client
* @returns account id
*/
accountId(): string;
/**
* Get the current display name for this account
* @returns display name
*/
displayName(): string;
/**
* Set the current display name for this account on the server
* @param display name to set (ignored if empty or NULL)
*/
setDisplayName(displayName: string): void;
/**
* Turn a file into a ChatAttachment for attaching to a ChatMessage
*/
prepareAttachment(source: File, callback: (arg0: snikket.ChatAttachment) => void): void;
/**
* @returns array of open chats, sorted by last activity
*/
getChats(): snikket.Chat[];
/**
* Search for chats the user can start or join
* @param q the search query to use
* @param callback takes two arguments, the query that was used and the array of results
*/
findAvailableChats(q: string, callback: (arg0: string, arg1: snikket.AvailableChat[]) => void): void;
/**
* Start or join a chat from the search results
* @returns the chat that was started
*/
startChat(availableChat: snikket.AvailableChat): snikket.Chat;
/**
* Find a chat by id
* @returns the chat if known, or NULL
*/
getChat(chatId: string): snikket.Chat;
subscribePush(reg: ServiceWorkerRegistration, push_service: string, vapid_key: {privateKey: CryptoKey, publicKey: CryptoKey}): void;
enablePush(push_service: string, vapid_private_key: CryptoKey, endpoint: string, p256dh: ArrayBuffer, auth: ArrayBuffer): void;
/**
* Event fired when client needs a password for authentication
* @param handler takes one argument, the Client that needs a password
*/
addPasswordNeededListener(handler: (arg0: snikket.Client) => void): void;
/**
* Event fired when client is connected and fully synchronized
* @param handler takes no arguments
*/
addStatusOnlineListener(handler: () => void): void;
/**
* Event fired when client is disconnected
* @param handler takes no arguments
*/
addStatusOfflineListener(handler: () => void): void;
/**
* Event fired when connection fails with a fatal error and will not be retried
* @param handler takes no arguments
*/
addConnectionFailedListener(handler: () => void): void;
addUserStateListener(handler: (arg0: string, arg1: string, arg2: string, arg3: enums.UserState) => void): void;
/**
* Event fired when a new ChatMessage comes in on any Chat
* Also fires when status of a ChatMessage changes,
* when a ChatMessage is edited, or when a reaction is added
* @param handler takes two arguments, the ChatMessage and ChatMessageEvent enum describing what happened
*/
addChatMessageListener(handler: (arg0: snikket.ChatMessage, arg1: enums.ChatMessageEvent) => void): void;
/**
* Event fired when syncing a new ChatMessage that was send when offline.
* Normally you don't want this, but it may be useful if you want to notify on app start.
* @param handler takes one argument, the ChatMessage
*/
addSyncMessageListener(handler: (arg0: snikket.ChatMessage) => void): void;
/**
* Event fired when a Chat's metadata is updated, or when a new Chat is added
* @param handler takes one argument, an array of Chats that were updated
*/
addChatsUpdatedListener(handler: (arg0: snikket.Chat[]) => void): void;
/**
* Event fired when a new call comes in
* @param handler takes two arguments, the call Session and the associated Chat ID
*/
addCallRingListener(handler: (arg0: snikket.jingle.Session, arg1: string) => void): void;
/**
* Event fired when a call is retracted or hung up
* @param handler takes one argument, the associated Chat ID
*/
addCallRetractListener(handler: (arg0: string) => void): void;
/**
* Event fired when an outgoing call starts ringing
* @param handler takes one argument, the associated Chat ID
*/
addCallRingingListener(handler: (arg0: string) => void): void;
/**
* Event fired when a call is asking for media to send
* @param handler takes three arguments, the call Session,
* a boolean indicating if audio is desired,
* and a boolean indicating if video is desired
*/
addCallMediaListener(handler: (arg0: snikket.jingle.InitiatedSession, arg1: boolean, arg2: boolean) => void): void;
/**
* Event fired when call has a new MediaStreamTrack to play
* @param handler takes three arguments, the associated Chat ID,
* the new MediaStreamTrack, and an array of any associated MediaStreams
*/
addCallTrackListener(handler: (arg0: string, arg1: MediaStreamTrack, arg2: MediaStream[]) => void): void;
/**
* Let the SDK know the UI is in the foreground
*/
setInForeground(): void;
/**
* Let the SDK know the UI is in the foreground
*/
setNotInForeground(): void;
}
}
export namespace snikket {
export class Config {
protected constructor();
/**
* Produce /.well-known/ni/ paths instead of ni:/// URIs
* for referencing media by hash.
* This can be useful eg for intercepting with a Service Worker.
*/
static relativeHashUri: boolean;
}
}
export namespace haxe.io {
export class Bytes {
protected constructor(data: ArrayBuffer);
readonly length: number;
/**
* Copies `len` bytes from `src` into this instance.
* @param pos Zero-based location in `this` instance at which to start writing
* bytes.
* @param src Source `Bytes` instance from which to copy bytes.
* @param srcpos Zero-based location at `src` from which bytes will be copied.
* @param len Number of bytes to be copied.
*/
blit(pos: number, src: haxe.io.Bytes, srcpos: number, len: number): void;
/**
* Sets `len` consecutive bytes starting from index `pos` of `this` instance
* to `value`.
*/
fill(pos: number, len: number, value: number): void;
/**
* Returns a new `Bytes` instance that contains a copy of `len` bytes of
* `this` instance, starting at index `pos`.
*/
sub(pos: number, len: number): haxe.io.Bytes;
/**
* Returns the 16-bit unsigned integer at the given position `pos` (in
* little-endian encoding).
*/
getUInt16(pos: number): number;
/**
* Returns the `len`-bytes long string stored at the given position `pos`,
* interpreted with the given `encoding` (UTF-8 by default).
*/
getString(pos: number, len: number, encoding?: any): string;
/**
* Returns a `String` representation of the bytes interpreted as UTF-8.
*/
toString(): string;
/**
* Returns a hexadecimal `String` representation of the bytes of `this`
* instance.
*/
toHex(): string;
/**
* Returns the `Bytes` representation of the given `String`, using the
* specified encoding (UTF-8 by default).
*/
static ofString(s: string, encoding?: any): haxe.io.Bytes;
/**
* Returns the `Bytes` representation of the given `BytesData`.
*/
static ofData(b: ArrayBuffer): haxe.io.Bytes;
/**
* Converts the given hexadecimal `String` to `Bytes`. `s` must be a string of
* even length consisting only of hexadecimal digits. For example:
* `"0FDA14058916052309"`.
*/
static ofHex(s: string): haxe.io.Bytes;
}
}
export namespace snikket {
export class Hash {
protected constructor(algorithm: string, hash: ArrayBuffer);
algorithm: string;
toUri(): string;
toHex(): string;
toBase64(): string;
toBase64Url(): string;
static fromHex(algorithm: string, hash: string): snikket.Hash;
static fromUri(uri: string): snikket.Hash;
static sha1(bytes: haxe.io.Bytes): snikket.Hash;
static sha256(bytes: haxe.io.Bytes): snikket.Hash;
}
}
export namespace snikket {
export class Identicon {
protected constructor();
static svg(source: string): string;
}
}
export namespace snikket {
export class JID {
constructor(node: string, domain: string, resource?: string);
node: string;
domain: string;
resource: string;
asBare(): snikket.JID;
withResource(resource: string): snikket.JID;
isValid(): boolean;
isDomain(): boolean;
isBare(): boolean;
equals(rhs: snikket.JID): boolean;
asString(): string;
static parse(jid: string): snikket.JID;
}
}
export namespace snikket {
export class Notification {
constructor(title: string, body: string, accountId: string, chatId: string, messageId: string, type: enums.MessageType, callStatus: string, callSid: string, imageUri: string, lang: string, timestamp: string);
readonly title: string;
readonly body: string;
readonly accountId: string;
readonly chatId: string;
readonly messageId: string;
readonly type: enums.MessageType;
readonly callStatus: string;
readonly callSid: string;
readonly imageUri: string;
readonly lang: string;
readonly timestamp: string;
static fromChatMessage(m: snikket.ChatMessage): snikket.Notification;
static fromThinStanza(stanza: snikket.Stanza): snikket.Notification;
}
}
export namespace snikket {
export class Participant {
protected constructor(displayName: string, photoUri: string, placeholderUri: string, isSelf: boolean);
displayName: string;
photoUri: string;
placeholderUri: string;
isSelf: boolean;
}
}
export namespace snikket {
export class Presence {
constructor(caps: snikket.Caps, mucUser: snikket.Stanza);
caps: snikket.Caps;
mucUser: snikket.Stanza;
}
}
export namespace snikket.Push {
export function receive(data: string, persistence: snikket.Persistence): snikket.Notification;
}
export namespace snikket {
export class Reaction {
constructor(senderId: string, timestamp: string, text: string, envelopeId?: string, key?: string);
senderId: string;
timestamp: string;
text: string;
key: string;
envelopeId: string;
render<T>(forText: (arg0: string) => T, forImage: (arg0: string, arg1: string) => T): T;
}
}
export namespace snikket {
export class CustomEmojiReaction extends snikket.Reaction {
constructor(senderId: string, timestamp: string, text: string, uri: string, envelopeId?: string);
uri: string;
render<T>(forText: (arg0: string) => T, forImage: (arg0: string, arg1: string) => T): T;
}
}
export namespace snikket {
export class ReactionUpdate {
constructor(updateId: string, serverId: string, serverIdBy: string, localId: string, chatId: string, senderId: string, timestamp: string, reactions: snikket.Reaction[], kind: enums.ReactionUpdateKind);
updateId: string;
serverId: string;
serverIdBy: string;
localId: string;
chatId: string;
senderId: string;
timestamp: string;
reactions: snikket.Reaction[];
kind: enums.ReactionUpdateKind;
getReactions(existingReactions: snikket.Reaction[]): snikket.Reaction[];
}
}
export namespace snikket._Stanza {
export interface NodeInterface {
serialize(): string;
clone(): snikket._Stanza.NodeInterface;
traverse(f: (arg0: snikket.Stanza) => boolean): snikket._Stanza.NodeInterface;
}
}
export namespace snikket {
export class StanzaError {
constructor(type_: string, condition_: string, text_?: string);
type: string;
condition: string;
text: string;
}
}
export namespace snikket {
export class Stanza implements snikket._Stanza.NodeInterface {
constructor(name: string, attr?: { [key: string]: string });
readonly name: string;
readonly attr: { [key: string]: string };
readonly children: any[];
serialize(): string;
toString(): string;
tag(name: string, attr?: { [key: string]: string }): snikket.Stanza;
text(content: string): snikket.Stanza;
textTag(tagName: string, textContent: string, attr?: { [key: string]: string }): snikket.Stanza;
up(): snikket.Stanza;
reset(): snikket.Stanza;
addChild(stanza: snikket.Stanza): snikket.Stanza;
addDirectChild(child: any): snikket.Stanza;
clone(): snikket.Stanza;
allTags(name?: string, xmlns?: string): snikket.Stanza[];
allText(): string[];
getFirstChild(): snikket.Stanza;
getChildren(): snikket._Stanza.NodeInterface[];
getChild(name?: string, xmlns?: string): snikket.Stanza;
getChildText(name?: string, xmlns?: string): string;
getText(): string;
find(path: string): any;
findChild(path: string): snikket.Stanza;
findText(path: string): string;
traverse(f: (arg0: snikket.Stanza) => boolean): snikket.Stanza;
getError(): snikket.StanzaError;
removeChildren(name?: string, xmlns_?: string): void;
static parse(s: string): snikket.Stanza;
static parseXmlBool(x: string): boolean;
}
}
export namespace snikket {
export class Version {
protected constructor();
static readonly HUMAN: string;
}
}
export namespace snikket {
export interface Persistence {
lastId(accountId: string, chatId: string, callback: (serverId: string) => void): void;
storeChats(accountId: string, chats: snikket.Chat[]): void;
getChats(accountId: string, callback: (chats: snikket.SerializedChat[]) => void): void;
getChatsUnreadDetails(accountId: string, chats: snikket.Chat[], callback: (details: {chatId: string, message: snikket.ChatMessage, unreadCount: number}[]) => void): void;
storeReaction(accountId: string, update: snikket.ReactionUpdate, callback: (arg0: snikket.ChatMessage) => void): void;
storeMessages(accountId: string, message: snikket.ChatMessage[], callback: (arg0: snikket.ChatMessage[]) => void): void;
updateMessage(accountId: string, message: snikket.ChatMessage): void;
updateMessageStatus(accountId: string, localId: string, status: enums.MessageStatus, callback: (arg0: snikket.ChatMessage) => void): void;
getMessage(accountId: string, chatId: string, serverId: string, localId: string, callback: (arg0: snikket.ChatMessage) => void): void;
getMessagesBefore(accountId: string, chatId: string, beforeId: string, beforeTime: string, callback: (messages: snikket.ChatMessage[]) => void): void;
getMessagesAfter(accountId: string, chatId: string, afterId: string, afterTime: string, callback: (messages: snikket.ChatMessage[]) => void): void;
getMessagesAround(accountId: string, chatId: string, aroundId: string, aroundTime: string, callback: (messages: snikket.ChatMessage[]) => void): void;
hasMedia(hashAlgorithm: string, hash: ArrayBuffer, callback: (has: boolean) => void): void;
storeMedia(mime: string, bytes: ArrayBuffer, callback: () => void): void;
removeMedia(hashAlgorithm: string, hash: ArrayBuffer): void;
storeCaps(caps: snikket.Caps): void;
getCaps(ver: string, callback: (arg0: snikket.Caps) => void): void;
storeLogin(login: string, clientId: string, displayName: string, token: string): void;
getLogin(login: string, callback: (clientId: string, token: string, fastCount: number, displayName: string) => void): void;
removeAccount(accountId: string, completely: boolean): void;
storeStreamManagement(accountId: string, data: ArrayBuffer): void;
getStreamManagement(accountId: string, callback: (arg0: ArrayBuffer) => void): void;
storeService(accountId: string, serviceId: string, name: string, node: string, caps: snikket.Caps): void;
findServicesWithFeature(accountId: string, feature: string, callback: (arg0: {caps: snikket.Caps, name: string, node: string, serviceId: string}[]) => void): void;
}
}
export namespace snikket.persistence {
export class Dummy implements snikket.Persistence {
/**
* Create a basic persistence layer that persists nothing
* @returns new persistence layer
*/
constructor();
lastId(accountId: string, chatId: string, callback: (arg0: string) => void): void;
storeChats(accountId: string, chat: snikket.Chat[]): void;
getChats(accountId: string, callback: (arg0: snikket.SerializedChat[]) => void): void;
storeMessages(accountId: string, messages: snikket.ChatMessage[], callback: (arg0: snikket.ChatMessage[]) => void): void;
updateMessage(accountId: string, message: snikket.ChatMessage): void;
getMessage(accountId: string, chatId: string, serverId: string, localId: string, callback: (arg0: snikket.ChatMessage) => void): void;
getMessagesBefore(accountId: string, chatId: string, beforeId: string, beforeTime: string, callback: (arg0: snikket.ChatMessage[]) => void): void;
getMessagesAfter(accountId: string, chatId: string, afterId: string, afterTime: string, callback: (arg0: snikket.ChatMessage[]) => void): void;
getMessagesAround(accountId: string, chatId: string, aroundId: string, aroundTime: string, callback: (arg0: snikket.ChatMessage[]) => void): void;
getChatsUnreadDetails(accountId: string, chats: snikket.Chat[], callback: (arg0: {chatId: string, message: snikket.ChatMessage, unreadCount: number}[]) => void): void;
storeReaction(accountId: string, update: snikket.ReactionUpdate, callback: (arg0: snikket.ChatMessage) => void): void;
updateMessageStatus(accountId: string, localId: string, status: enums.MessageStatus, callback: (arg0: snikket.ChatMessage) => void): void;
getMediaUri(hashAlgorithm: string, hash: ArrayBuffer, callback: (arg0: string) => void): void;
hasMedia(hashAlgorithm: string, hash: ArrayBuffer, callback: (arg0: boolean) => void): void;
storeMedia(mime: string, bd: ArrayBuffer, callback: () => void): void;
removeMedia(hashAlgorithm: string, hash: ArrayBuffer): void;
storeCaps(caps: snikket.Caps): void;
getCaps(ver: string, callback: (arg0: snikket.Caps) => void): void;
storeLogin(login: string, clientId: string, displayName: string, token: string): void;
getLogin(login: string, callback: (arg0: string, arg1: string, arg2: number, arg3: string) => void): void;
removeAccount(accountId: string, completely: boolean): void;
storeStreamManagement(accountId: string, sm: ArrayBuffer): void;
getStreamManagement(accountId: string, callback: (arg0: ArrayBuffer) => void): void;
storeService(accountId: string, serviceId: string, name: string, node: string, caps: snikket.Caps): void;
findServicesWithFeature(accountId: string, feature: string, callback: (arg0: {caps: snikket.Caps, name: string, node: string, serviceId: string}[]) => void): void;
}
}
export namespace snikket.persistence {
export interface KeyValueStore {
get(k: string, callback: (arg0: string) => void): void;
set(k: string, v: string, callback: () => void): void;
}
}
export namespace snikket.persistence {
export interface MediaStore {
hasMedia(hashAlgorithm: string, hash: ArrayBuffer, callback: (has: boolean) => void): void;
removeMedia(hashAlgorithm: string, hash: ArrayBuffer): void;
storeMedia(mime: string, bytes: ArrayBuffer, callback: () => void): void;
}
}
export namespace snikket.persistence {
export class Sqlite implements snikket.persistence.KeyValueStore, snikket.Persistence {
/**
* Create a basic persistence layer based on sqlite
* @param dbfile path to sqlite database
* @params media a MediaStore to use for media
* @returns new persistence layer
*/
constructor(dbfile: string, media: snikket.persistence.MediaStore);
get(k: string, callback: (arg0: string) => void): void;
set(k: string, v: string, callback: () => void): void;
lastId(accountId: string, chatId: string, callback: (arg0: string) => void): void;
storeChats(accountId: string, chats: snikket.Chat[]): void;
getChats(accountId: string, callback: (arg0: snikket.SerializedChat[]) => void): void;
storeMessages(accountId: string, messages: snikket.ChatMessage[], callback: (arg0: snikket.ChatMessage[]) => void): void;
updateMessage(accountId: string, message: snikket.ChatMessage): void;
getMessage(accountId: string, chatId: string, serverId: string, localId: string, callback: (arg0: snikket.ChatMessage) => void): void;
getMessagesBefore(accountId: string, chatId: string, beforeId: string, beforeTime: string, callback: (arg0: snikket.ChatMessage[]) => void): void;
getMessagesAfter(accountId: string, chatId: string, afterId: string, afterTime: string, callback: (arg0: snikket.ChatMessage[]) => void): void;
getMessagesAround(accountId: string, chatId: string, aroundId: string, aroundTime: string, callback: (arg0: snikket.ChatMessage[]) => void): void;
getChatsUnreadDetails(accountId: string, chats: snikket.Chat[], callback: (arg0: {chatId: string, message: snikket.ChatMessage, unreadCount: number}[]) => void): void;
storeReaction(accountId: string, update: snikket.ReactionUpdate, callback: (arg0: snikket.ChatMessage) => void): void;
updateMessageStatus(accountId: string, localId: string, status: enums.MessageStatus, callback: (arg0: snikket.ChatMessage) => void): void;
hasMedia(hashAlgorithm: string, hash: ArrayBuffer, callback: (arg0: boolean) => void): void;
removeMedia(hashAlgorithm: string, hash: ArrayBuffer): void;
storeMedia(mime: string, bd: ArrayBuffer, callback: () => void): void;
storeCaps(caps: snikket.Caps): void;
getCaps(ver: string, callback: (arg0: snikket.Caps) => void): void;
storeLogin(accountId: string, clientId: string, displayName: string, token: string): void;
getLogin(accountId: string, callback: (arg0: string, arg1: string, arg2: number, arg3: string) => void): void;
removeAccount(accountId: string, completely: boolean): void;
storeStreamManagement(accountId: string, sm: ArrayBuffer): void;
getStreamManagement(accountId: string, callback: (arg0: ArrayBuffer) => void): void;
storeService(accountId: string, serviceId: string, name: string, node: string, caps: snikket.Caps): void;
findServicesWithFeature(accountId: string, feature: string, callback: (arg0: {caps: snikket.Caps, name: string, node: string, serviceId: string}[]) => void): void;
}
}