generated from array-in-a-matrix/matrix-bot-template
18 lines
817 B
Nim
18 lines
817 B
Nim
{.emit:"import { MatrixAuth } from 'matrix-bot-sdk';".}
|
|
|
|
type auth = ref object
|
|
homeserverUrl: cstring
|
|
|
|
type Client = ref object
|
|
homeserverUrl*: cstring
|
|
accessToken*: cstring
|
|
|
|
proc newMatrixAuth*(homeserver: cstring): auth {.importjs: "new MatrixAuth(#)".}
|
|
|
|
proc passwordLogin*(auth: auth, username, password: cstring): Client {.importjs: "await #.passwordLogin(#, #)".}
|
|
proc passwordLogin*(auth: auth, username, password, deviceName: cstring): Client {.importjs: "await #.passwordLogin(#, #, #)".}
|
|
|
|
proc passwordRegister*(localpart, password: cstring): Client {.importjs: "await #.passwordRegister(#, #)".}
|
|
proc passwordRegister*(localpart, password, deviceName: cstring): Client {.importjs: "await #.passwordRegister(#, #, #)".}
|
|
|
|
proc accessToken*(client: Client): cstring {.importjs: "#.accessToken".}
|