basic lib start

This commit is contained in:
array-in-a-matrix 2023-12-07 18:56:17 -05:00
parent 7f6ceb1d32
commit accc0dfa84
2 changed files with 13 additions and 1 deletions

View file

@ -1 +0,0 @@
import std/[jsconsole, asyncjs]

13
src/nimbotsdk.nim Normal file
View file

@ -0,0 +1,13 @@
import std/[asyncjs]
{.emit:"import { MatrixAuth } from 'matrix-bot-sdk';".}
type auth = ref object
homeserverUrl: cstring
type Client = ref object
accessToken: cstring
proc newMatrixAuth*(homeserver: cstring): auth {.importjs: "new MatrixAuth(#)".}
proc passwordLogin*(auth: auth, username, password: cstring): Client {.importjs: "await #.passwordLogin(#, #)".}
proc accessToken*(client: Client): cstring {.importjs: "#.accessToken".}