generated from array-in-a-matrix/matrix-bot-template
228 lines
14 KiB
Nim
228 lines
14 KiB
Nim
{.emit:"/*INCLUDESECTION*/ import { MatrixClient } from 'matrix-bot-sdk';".}
|
|
|
|
import matrixTypes
|
|
|
|
proc newMatrixClient*(homeserver, token: cstring): Client {.importjs: "new MatrixClient(#, #)".}
|
|
proc newMatrixClient*(homeserver, token: cstring, storage: Storage): Client {.importjs: "new MatrixClient(#, #, #)".}
|
|
proc newMatrixClient*(homeserver, token: cstring, storage: Storage, cryptoStore: ICryptoStorageProvider): Client {.importjs: "new MatrixClient(#, #, #, #)".}
|
|
|
|
proc onRoomMessage*(client: Client, callback: proc(roomId: cstring, event: Event)) {.importjs: "#.on('room.message', #)".}
|
|
|
|
proc onRoomTopic*(client: Client, callback: proc(roomId: cstring, event: Event)) {.importjs: "#.on('room.topic', #)".}
|
|
|
|
proc onRoomEvent*(client: Client, callback: proc(roomId: cstring, event: Event)) {.importjs: "#.on('room.event', #)".}
|
|
|
|
proc onRoomJoin*(client: Client, callback: proc(roomId: cstring, event: Event)) {.importjs: "#.on('room.join', #)".}
|
|
|
|
proc onRoomLeave*(client: Client, callback: proc(roomId: cstring, event: Event)) {.importjs: "#.on('room.leave', #)".}
|
|
|
|
proc onAccountData*(client: Client, callback: proc(event: Event)) {.importjs: "#.on('account_data', #)".}
|
|
|
|
proc onRoomAccountData*(client: Client, callback: proc(roomId: cstring, event: Event)) {.importjs: "#.on('onRoomAccountData', #)".}
|
|
|
|
# TODO: add more for each event type
|
|
|
|
proc impersonateUserId*(client: Client, userId: cstring = nil): void {.importjs: "#.impersonateUserId(#)".}
|
|
proc impersonateUserId*(client: Client, userId: cstring = nil, deviceId: cstring): void {.importjs: "#.impersonateUserId(#, #)".}
|
|
|
|
proc getIdentityServerClient*(client: Client, identityServerName: cstring) {.importjs: "#.getIdentityServerClient(#)".}
|
|
|
|
proc setJoinStrategy*(client: Client, strategy: IJoinRoomStrategy): void {.importjs: "#.setJoinStrategy(#)".}
|
|
|
|
proc addPreprocessor*(client: Client, preprocessor: IPreprocessor): void {.importjs: "#.addPreprocessor(#)".}
|
|
|
|
proc getServerVersions*(client: Client): ServerVersions {.importjs: "#.getServerVersions()".}
|
|
|
|
proc doesServerSupportUnstableFeature*(client: Client, feature: cstring): bool {.importjs: "#.doesServerSupportUnstableFeature(#)".}
|
|
|
|
proc doesServerSupportVersion*(client: Client, version: cstring): bool {.importjs: "#.doesServerSupportVersion(#)".}
|
|
|
|
proc doesServerSupportAnyOneVersion*(client: Client, versions: cstring) {.importjs: "#.doesServerSupportAnyOneVersion(#)".}
|
|
|
|
proc getOpenIDConnectToken*(client: Client) {.importjs: "#.getOpenIDConnectToken()".}
|
|
|
|
proc getAccountData*(client: Client, eventType: cstring) {.importjs: "#.getAccountData(#)".}
|
|
|
|
proc getRoomAccountData*(client: Client, eventType, roomId: cstring) {.importjs: "#.getRoomAccountData(#, #)".}
|
|
|
|
proc getSafeAccountData*(client: Client, eventType: cstring) {.importjs: "#.getSafeAccountData(#)".}
|
|
proc getSafeAccountData*(client: Client, eventType: cstring, defaultContent: auto = nil) {.importjs: "#.getSafeAccountData(#, #)".}
|
|
|
|
proc getSafeRoomAccountData*(client: Client, eventType: cstring, roomId: cstring) {.importjs: "#.getSafeRoomAccountData(#, #)".}
|
|
proc getSafeRoomAccountData*(client: Client, eventType: cstring, roomId: cstring, defaultContent: auto = nil) {.importjs: "#.getSafeRoomAccountData(#, #, #)".}
|
|
|
|
proc setAccountData*(client: Client, eventType: cstring, content: Content) {.importjs: "#.setAccountData(#, #)".}
|
|
|
|
proc setRoomAccountData*(client: Client, eventType, roomId: cstring, content: Content) {.importjs: "#.setRoomAccountData(#, #, #)".}
|
|
|
|
proc getPresenceStatus*(client: Client) {.importjs: "#.getPresenceStatus()".}
|
|
|
|
proc getPresenceStatusFor*(client: Client, userId: cstring) {.importjs: "#.getPresenceStatusFor(#)".}
|
|
|
|
proc setPresenceStatus*(presence: PresenceState, statusMessage: cstring = nil) {.importjs: "#.setPresenceStatus(#, #)".}
|
|
|
|
proc getPublishedAlias*(client: Client, roomIdOrAlias: cstring) {.importjs: "#.getPublishedAlias(#)".}
|
|
|
|
proc createRoomAlias*(client: Client, alias: cstring, roomId: cstring) {.importjs: "#.createRoomAlias(#, #)".}
|
|
|
|
proc deleteRoomAlias*(client: Client, alias: cstring) {.importjs: "#.deleteRoomAlias(#)".}
|
|
|
|
proc setDirectoryVisibility*(client: Client, roomId: cstring, visibility: cstring) {.importjs: "#.setDirectoryVisibility(#, #)".}
|
|
# TODO: visibility should be either "public" or "private"
|
|
|
|
proc getDirectoryVisibility*(client: Client, roomId: cstring) {.importjs: "#.getDirectoryVisibility(#)".}
|
|
|
|
proc resolveRoom*(client: Client, roomIdOrAlias: cstring) {.importjs: "#.resolveRoom(#)".}
|
|
|
|
proc lookupRoomAlias*(client: Client, roomAlias: cstring) {.importjs: "#.lookupRoomAlias(#)".}
|
|
|
|
proc inviteUser*(client: Client, userId, roomId: cstring) {.importjs: "#.inviteUser(#, #)".}
|
|
|
|
proc kickUser*(client: Client, userId, roomId: cstring) {.importjs: "#.kickUser(#, #)".}
|
|
proc kickUser*(client: Client, userId, roomId, reason: cstring) {.importjs: "#.kickUser(#, #, #)".}
|
|
|
|
proc banUser*(client: Client, userId, roomId: cstring) {.importjs: "#.banUser(#, #)".}
|
|
proc banUser*(client: Client, userId, roomId, reason: cstring) {.importjs: "#.banUser(#, #, #)".}
|
|
|
|
proc unbanUser*(client: Client, userId, roomId: cstring) {.importjs: "#.unbanUser(#, #)".}
|
|
|
|
proc getUserId*(client: Client) {.importjs: "#.getUserId()".}
|
|
|
|
proc getWhoAmI*(client: Client) {.importjs: "#.getWhoAmI()".}
|
|
|
|
proc stop*(client: Client): void {.importjs: "#.stop()".}
|
|
|
|
proc start*(client: Client, filter: Filter = nil) {.importjs: "#.start(#)".}
|
|
|
|
proc getEvent*(client: Client, roomId, eventId: cstring) {.importjs: "#.getEvent(#, #)".}
|
|
|
|
proc getRawEvent*(client: Client, roomId, eventId: cstring) {.importjs: "#.getRawEvent(#, #)".}
|
|
|
|
proc getRoomState*(client: Client, roomId: cstring) {.importjs: "#.getRoomState(#)".}
|
|
|
|
proc getRoomStateEvents*(client: Client, roomId, `type`: cstring, stateKey: cstring = nil ) {.importjs: "#.getRoomStateEvents(#, #, #)".}
|
|
|
|
proc getRoomStateEvent*(client: Client, roomId, `type`: cstring, stateKey: cstring = nil ) {.importjs: "#.getRoomStateEvent(#, #, #)".}
|
|
|
|
proc getEventContext*(client: Client, roomId, eventId: cstring) {.importjs: "#.getEventContext(#, #)".}
|
|
proc getEventContext*(client: Client, roomId, eventId: cstring, limit: int) {.importjs: "#.getEventContext(#, #, #)".}
|
|
|
|
proc getUserProfile*(client: Client, userId: cstring) {.importjs: "#.getUserProfile(#)".}
|
|
|
|
proc setDisplayName*(client: Client, displayName: cstring) {.importjs: "#.setDisplayName(#)".}
|
|
|
|
proc setAvatarUrl*(client: Client, avatarUrl: cstring) {.importjs: "#.setAvatarUrl(#)".}
|
|
|
|
proc joinRoom*(client: Client, roomIdOrAlias: cstring) {.importjs: "#.joinRoom(#)".}
|
|
proc joinRoom*(client: Client, roomIdOrAlias: cstring, viaServers: seq[string]) {.importjs: "#.joinRoom(#, #)".}
|
|
|
|
proc getJoinedRooms*(client: Client) {.importjs: "#.getJoinRooms()".}
|
|
|
|
proc getJoinedRoomMembers*(client: Client, roomId: cstring) {.importjs: "#.getJoinedRoomMembers(#)".}
|
|
|
|
proc getJoinedRoomMembersWithProfiles*(client: Client, roomId: cstring) {.importjs: "#.getJoinedRoomMembersWithProfiles(#)".}
|
|
|
|
proc getRoomMembers*(client: Client, roomId: cstring, batchToken: cstring = nil, membership: seq[string], notMembership: seq[string]) {.importjs: "#.getRoomMembers(#, #, #, #)".}
|
|
|
|
proc getAllRoomMembers*(client: Client, roomId: cstring) {.importjs: "#.getAllRoomMembers(#)".}
|
|
proc getAllRoomMembers*(client: Client, roomId, atToken: cstring) {.importjs: "#.getAllRoomMembers(#, #)".}
|
|
|
|
proc getRoomMembersByMembership*(client: Client, roomId: cstring, membership: Membership) {.importjs: "#.getRoomMembersByMembership(#, #)".}
|
|
proc getRoomMembersByMembership*(client: Client, roomId: cstring, membership: Membership, atToken: cstring) {.importjs: "#.getRoomMembersByMembership(#, #, #)".}
|
|
|
|
proc getRoomMembersWithoutMembership*(client: Client, roomId: cstring, membership: Membership) {.importjs: "#.getRoomMembersWithoutMembership(#, #)".}
|
|
proc getRoomMembersWithoutMembership*(client: Client, roomId: cstring, membership: Membership, atToken: cstring) {.importjs: "#.getRoomMembersWithoutMembership(#, #, #)".}
|
|
|
|
proc leaveRoom*(client: Client, roomId: cstring) {.importjs: "#.leaveRoom(#)".}
|
|
proc leaveRoom*(client: Client, roomId, reason: cstring) {.importjs: "#.leaveRoom(#, #)".}
|
|
|
|
proc forgetRoom*(client: Client, roomId: cstring) {.importjs: "#.forgetRoom(#)".}
|
|
|
|
proc sendReadReceipt*(client: Client, roomId: cstring, eventId: cstring) {.importjs: "#.sendReadReceipt(#, #)".}
|
|
|
|
proc setTyping*(client: Client, roomId: cstring, typing: bool) {.importjs: "#.setTyping(#, #)".}
|
|
proc setTyping*(client: Client, roomId: cstring, typing: bool, timeout: float) {.importjs: "#.setTyping(#, #, #)".}
|
|
|
|
proc replyText*(client: Client, roomId: cstring, event: Event, text: cstring) {.importjs: "#.replyText(#, #, #)".}
|
|
proc replyText*(client: Client, roomId: cstring, event: Event, text: cstring, html: cstring) {.importjs: "#.replyText(#, #, #, #)".}
|
|
|
|
proc replyHtmlText*(client: Client, roomId: cstring, event: Event, html: cstring) {.importjs: "#.replyHtmlText(#, #, #)".}
|
|
|
|
proc replyNotice*(client: Client, roomId: cstring, event: Event, text: cstring) {.importjs: "#.replyNotice(#, #, #)".}
|
|
proc replyNotice*(client: Client, roomId: cstring, event: Event, text: cstring, html: cstring) {.importjs: "#.replyNotice(#, #, #, #)".}
|
|
|
|
proc replyHtmlNotice*(client: Client, roomId: cstring, event: Event, html: cstring) {.importjs: "#.replyHtmlNotice(#, #, #)".}
|
|
|
|
proc sendNotice*(client: Client, roomId: cstring, text: cstring) {.importjs: "#.sendNotice(#, #)".}
|
|
|
|
proc sendHtmlNotice*(client: Client, roomId: cstring, html: cstring) {.importjs: "#.sendHtmlNotice(#, #)".}
|
|
|
|
proc sendText*(client: Client, roomId: cstring, text: cstring) {.importjs: "#.sendText(#, #)".}
|
|
|
|
proc sendHtmlText*(client: Client, roomId: cstring, html: cstring) {.importjs: "#.sendHtmlText(#, #)".}
|
|
|
|
proc sendMessage*(client: Client, roomId: cstring, content: Event) {.importjs: "#.sendMessage(#, #)".}
|
|
|
|
proc sendEvent*(client: Client, roomId: cstring, eventType: cstring, content: Event) {.importjs: "#.sendEvent(#, #, #)".}
|
|
|
|
proc sendRawEvent*(client: Client, roomId: cstring, eventType: cstring, content: Event) {.importjs: "#.sendRawEvent(#, #, #)".}
|
|
|
|
proc sendStateEvent*(client: Client, roomId: cstring, `type`: cstring, content: Event) {.importjs: "#.sendStateEvent(#, #, #, #)".}
|
|
|
|
proc redactEvent*(client: Client, roomId: cstring, eventId: cstring, reason: cstring = nil) {.importjs: "#.redactEvent(#, #, #)".}
|
|
|
|
proc createRoom*(client: Client) {.importjs: "#.createRoom()".}
|
|
proc createRoom*(client: Client, properties: RoomCreateOptions) {.importjs: "#.createRoom(#)".}
|
|
|
|
proc userHasPowerLevelFor*(client: Client, userId, roomId, eventType: cstring, isState: bool) {.importjs: "#.userHasPowerLevelFor(#, #, #, #)".}
|
|
|
|
proc userHasPowerLevelForAction*(client: Client, userId, roomId: cstring, action: PowerLevelAction) {.importjs: "#.userHasPowerLevelForAction(#, #, #)".}
|
|
|
|
proc calculatePowerLevelChangeBoundsOn*(client: Client, targetUserId, roomId: cstring) {.importjs: "#.calculatePowerLevelChangeBoundsOn(#, #)".}
|
|
|
|
proc setUserPowerLevel*(client: Client, userId, roomId: cstring, newLevel: int) {.importjs: "#.setUserPowerLevel(#, #, #)".}
|
|
|
|
proc mxcToHttp*(client: Client, mxc: cstring) {.importjs: "#.mxcToHttp(#)".}
|
|
|
|
proc mxcToHttpThumbnail*(client: Client, mxc: cstring, width, height: int, `method`: cstring): cstring {.importjs: "#.mxcToHttpThumbnail(#, #, #, #)".}
|
|
|
|
proc uploadContent*(client: Client, data: Buffer, contentType: cstring = "application/octet-stream") {.importjs: "#.uploadContent(#, #)".}
|
|
proc uploadContent*(client: Client, data: Buffer, contentType: cstring = "application/octet-stream", filename: cstring) {.importjs: "#.uploadContent(#, #, #)".}
|
|
|
|
proc downloadContent*(client: Client, mxcUrl: cstring) {.importjs: "#.downloadContent(#)".}
|
|
proc downloadContent*(client: Client, mxcUrl: cstring, allowRmote: bool) {.importjs: "#.downloadContent(#, #)".}
|
|
|
|
proc uploadContentFromUrl*(client: Client, url: cstring) {.importjs: "#.uploadContentFromUrl(#)".}
|
|
|
|
proc getRoomUpgradeHistory*(client: Client, roomId: cstring) {.importjs: "#.getRoomUpgradeHistory(#)".}
|
|
|
|
proc createSpace*(client: Client, opts: SpaceCreateOptions) {.importjs: "#.createSpace(#)".}
|
|
|
|
proc getSpace*(client: Client, roomIdOrAlias: cstring) {.importjs: "#.getSpace(#)".}
|
|
|
|
proc uploadDeviceOneTimeKeys*(client: Client, keys: OTKs) {.importjs: "#.uploadDeviceOneTimeKeys(#)".}
|
|
|
|
proc checkOneTimeKeyCounts*(client: Client) {.importjs: "#.checkOneTimeKeyCounts()".}
|
|
|
|
proc uploadFallbackKey*(client: Client, fallbackKey: FallbackKey) {.importjs: "#.uploadFallbackKey(#)".}
|
|
|
|
proc getUserDevices*(client: Client, userIds: seq[cstring], federationTimeoutMs: int) {.importjs: "#.getUserDevices(#, #)".}
|
|
|
|
proc getOwnDevices*(client: Client) {.importjs: "#.getOwnDevices()".}
|
|
|
|
proc claimOneTimeKeys*(client: Client, userDeviceMap: (cstring, (cstring, OTKAlgorithm)), federationTimeoutMs: int = 10) {.importjs: "#.claimOneTimeKeys(#, #)".}
|
|
|
|
proc sendToDevices*(client: Client, `type`: cstring, messages: (cstring, (cstring, auto))) {.importjs: "#.sendToDevices(#, #)".}
|
|
|
|
proc getRelationsForEvent*(client: Client, roomId, eventId: cstring) {.importjs: "#.getRelationsForEvent(#, #)".}
|
|
proc getRelationsForEvent*(client: Client, roomId, eventId, relationType: cstring) {.importjs: "#.getRelationsForEvent(#, #, #)".}
|
|
proc getRelationsForEvent*(client: Client, roomId, eventId, relationType, eventType: cstring) {.importjs: "#.getRelationsForEvent(#, #, #, #)".}
|
|
|
|
proc doRequest*(client: Client, `method`, endpoint: cstring) {.importjs: "#.doRequest(#, #)".}
|
|
proc doRequest*(client: Client, `method`, endpoint: cstring, qs: auto) {.importjs: "#.doRequest(#, #, #)".}
|
|
proc doRequest*(client: Client, `method`, endpoint: cstring, qs, body: auto) {.importjs: "#.doRequest(#, #, #, #)".}
|
|
proc doRequest*(client: Client, `method`, endpoint: cstring, qs, body: auto, timeout: int) {.importjs: "#.doRequest(#, #, #, #, #)".}
|
|
proc doRequest*(client: Client, `method`, endpoint: cstring, qs, body: auto, timeout: int, raw: bool) {.importjs: "#.doRequest(#, #, #, #, #, #)".}
|
|
proc doRequest*(client: Client, `method`, endpoint: cstring, qs, body: auto, timeout: int, raw: bool, contentType: cstring) {.importjs: "#.doRequest(#, #, #, #, #, #, #)".}
|
|
proc doRequest*(client: Client, `method`, endpoint: cstring, qs, body: auto, timeout: int, raw: bool, contentType: cstring, noEncoing: bool) {.importjs: "#.doRequest(#, #, #, #, #, #, #, #)".}
|