generated from array-in-a-matrix/matrix-bot-template
wrapped several client methods
This commit is contained in:
parent
b66bc60f9c
commit
43d843762c
|
@ -1,82 +1,129 @@
|
|||
{.emit:"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: CryptoStore): Client {.importjs: "new MatrixClient(#, #, #, #)".}
|
||||
|
||||
|
||||
proc onRoomMessage*(client: Client, callback: proc(roomId: cstring, event: Event)) {.importjs: "#.on('room.message', #)".}
|
||||
# TODO: add more for each event name
|
||||
|
||||
# impersonateUserId
|
||||
# getIdentityServerClient
|
||||
# setJoinStrategy
|
||||
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', #)".}
|
||||
# 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()".}
|
||||
# TODO: returns promise that is needed
|
||||
|
||||
# doesServerSupportUnstableFeature
|
||||
# doesServerSupportVersion
|
||||
# doesServerSupportAnyOneVersion
|
||||
# getOpenIDConnectToken
|
||||
# getAccountData
|
||||
# getRoomAccountData
|
||||
# getSafeAccountData
|
||||
# getSafeRoomAccountData
|
||||
# setAccountData
|
||||
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()".}
|
||||
# TODO: returns promise that is needed
|
||||
|
||||
proc getPresenceStatusFor*(client: Client, userId: cstring) {.importjs: "#.getPresenceStatusFor(#)".}
|
||||
# TODO: returns promise that is needed
|
||||
|
||||
proc setPresenceStatus*(presence: PresenceState, statusMessage: cstring = nil) {.importjs: "#.setPresenceStatus(#, #)".}
|
||||
|
||||
# getPublishedAlias
|
||||
# createRoomAlias
|
||||
# deleteRoomAlias
|
||||
# setDirectoryVisibility
|
||||
# getDirectoryVisibility
|
||||
# resolveRoom
|
||||
# lookupRoomAlias
|
||||
# inviteUser
|
||||
# kickUser
|
||||
# banUser
|
||||
# unbanUser
|
||||
# getUserId
|
||||
# getWhoAmI
|
||||
# stop
|
||||
proc getPublishedAlias*(client: Client, roomIdOrAlias: cstring) {.importjs: "#.getPublishedAlias(#)".}
|
||||
|
||||
proc start*(client: Client, filter: Filter = nil) {.importjs: "#.start(#)".} #? returns a promise
|
||||
proc createRoomAlias*(client: Client, alias: cstring, roomId: cstring) {.importjs: "#.createRoomAlias(#, #)".}
|
||||
|
||||
# getEvent
|
||||
# getRawEvent
|
||||
# getRoomState
|
||||
# getRoomStateEvents
|
||||
# getRoomStateEvent
|
||||
# getEventContext
|
||||
# getUserProfile
|
||||
# setDisplayName
|
||||
# setAvatarUrl
|
||||
# joinRoom
|
||||
# getJoinedRooms
|
||||
# getJoinedRoomMembers
|
||||
# getJoinedRoomMembersWithProfiles
|
||||
# getRoomMembers
|
||||
# getAllRoomMembers
|
||||
# getRoomMembersByMembership
|
||||
# getRoomMembersWithoutMembership
|
||||
# leaveRoom
|
||||
# forgetRoom
|
||||
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, )
|
||||
|
||||
proc getRawEvent*(client: Client, )
|
||||
|
||||
proc getRoomState*(client: Client, )
|
||||
|
||||
proc getRoomStateEvents*(client: Client, )
|
||||
|
||||
proc getRoomStateEvent*(client: Client, )
|
||||
|
||||
proc getEventContext*(client: Client, )
|
||||
|
||||
proc getUserProfile*(client: Client, )
|
||||
|
||||
proc setDisplayName*(client: Client, )
|
||||
|
||||
proc setAvatarUrl*(client: Client, )
|
||||
|
||||
proc joinRoom*(client: Client, )
|
||||
|
||||
proc getJoinedRooms*(client: Client, )
|
||||
|
||||
proc getJoinedRoomMembers*(client: Client, )
|
||||
|
||||
proc getJoinedRoomMembersWithProfiles*(client: Client, )
|
||||
|
||||
proc getRoomMembers*(client: Client, )
|
||||
|
||||
proc getAllRoomMembers*(client: Client, )
|
||||
|
||||
proc getRoomMembersByMembership*(client: Client, )
|
||||
|
||||
proc getRoomMembersWithoutMembership*(client: Client, )
|
||||
|
||||
proc leaveRoom*(client: Client, )
|
||||
|
||||
proc forgetRoom*(client: Client, )
|
||||
|
||||
#? below returns promises but are not dealt with
|
||||
proc sendReadReceipt*(client: Client, roomId: cstring, eventId: cstring) {.importjs: "#.sendReadReceipt(#, #)".}
|
||||
|
||||
proc setTyping*(client: Client, roomId: cstring, typing: bool) {.importjs: "#.setTyping(#, #)".}
|
||||
|
@ -110,25 +157,46 @@ proc sendStateEvent*(client: Client, roomId: cstring, `type`: cstring, content:
|
|||
|
||||
proc redactEvent*(client: Client, roomId: cstring, eventId: cstring, reason: cstring = nil) {.importjs: "#.redactEvent(#, #, #)".}
|
||||
|
||||
# createRoom
|
||||
# userHasPowerLevelFor
|
||||
# userHasPowerLevelForAction
|
||||
# calculatePowerLevelChangeBoundsOn
|
||||
# setUserPowerLevel
|
||||
# mxcToHttp
|
||||
# mxcToHttpThumbnail
|
||||
# uploadContent
|
||||
# downloadContent
|
||||
# uploadContentFromUrl
|
||||
# getRoomUpgradeHistory
|
||||
# createSpace
|
||||
# getSpace
|
||||
# uploadDeviceOneTimeKeys
|
||||
# checkOneTimeKeyCounts
|
||||
# uploadFallbackKey
|
||||
# getUserDevices
|
||||
# getOwnDevices
|
||||
# claimOneTimeKeys
|
||||
# sendToDevices
|
||||
# getRelationsForEvent
|
||||
# doRequest
|
||||
proc createRoom*(client: Client, )
|
||||
|
||||
proc userHasPowerLevelFor*(client: Client, )
|
||||
|
||||
proc userHasPowerLevelForAction*(client: Client, )
|
||||
|
||||
proc calculatePowerLevelChangeBoundsOn*(client: Client, )
|
||||
|
||||
proc setUserPowerLevel*(client: Client, )
|
||||
|
||||
proc mxcToHttp*(client: Client, )
|
||||
|
||||
proc mxcToHttpThumbnail*(client: Client, )
|
||||
|
||||
proc uploadContent*(client: Client, )
|
||||
|
||||
proc downloadContent*(client: Client, )
|
||||
|
||||
proc uploadContentFromUrl*(client: Client, )
|
||||
|
||||
proc getRoomUpgradeHistory*(client: Client, )
|
||||
|
||||
proc createSpace*(client: Client, )
|
||||
|
||||
proc getSpace*(client: Client, )
|
||||
|
||||
proc uploadDeviceOneTimeKeys*(client: Client, )
|
||||
|
||||
proc checkOneTimeKeyCounts*(client: Client, )
|
||||
|
||||
proc uploadFallbackKey*(client: Client, )
|
||||
|
||||
proc getUserDevices*(client: Client, )
|
||||
|
||||
proc getOwnDevices*(client: Client, )
|
||||
|
||||
proc claimOneTimeKeys*(client: Client, )
|
||||
|
||||
proc sendToDevices*(client: Client, )
|
||||
|
||||
proc getRelationsForEvent*(client: Client, )
|
||||
|
||||
proc doRequest*(client: Client, )
|
|
@ -33,3 +33,5 @@ type IPreprocessor* = ref object
|
|||
type ServerVersions* = ref object
|
||||
|
||||
type PresenceState* = ref object
|
||||
|
||||
type IJoinRoomStrategy* = ref object
|
Loading…
Reference in a new issue