YLSNKGUDSJN3S37GCAHLNBIK22PVZNLFFLMFGM533XGZ56FVHLZQC
55NYCTVRAG7AFJJGNOKSB6NFFNWG5DOMCNZS2JM6EV6MUWCTD2JQC
W4S5ZVBQG3G3MCXNCKZFHAQX7XH3UW6WTKVXN2XGRFG5EJ7JPLNQC
YHNJXHEFIHKZUGR22VCEZQLWR6AADOMXN4GURZXZRXOTWEOZO7AAC
AETEUT6ER7MJXNYTBH5RHUT5URSRWNBJPXU2CA4URLSNAZYMWPIAC
S4P2B3FPF57HPHTIAYGMPCVKB7573IB5ZBKNXVBTB6ICCPF55WNQC
QWIXQSP22VFGDT23HBBOAHSCPQBWYJHBDD3SDECPB6J6WWKKYLLAC
THULBVNUJHXMNETYBU2WSMFWD7VPSSNPSOAAVVINL7LIOENEHZRQC
JFLKJBID7LCJ7KIIYBWTQZT3TO2WSZHRKRCZTHUXBMS5PTBRZYZAC
V7HS237PBWI3JIA2FKGHVZ6CXT2BFE6VMXGZSJD7RGD6A3U2ISGQC
LE5S25TSDLEYUHK7WQINNHJGSZNFR5XBFXSV567X4ZSVGRVT3UFQC
module setup
import os
import json
struct Config {
pub:
matrix_host string
as_token string
}
pub fn config() Config {
json_str := os.read_file('config.json') or { '{}' }
cfg := json.decode(Config, json_str) or { Config{} }
return cfg
}
mut config := http.FetchConfig {
method: http.Method.get
}
config.headers['Authorization'] = "Bearer $self.token"
url := "https://$self.host/_matrix/client/r0/$api"
resp := http.fetch(url, config) ?
println("$url $resp.text")
mut config := http.FetchConfig{
method: http.Method.get
}
config.headers['Authorization'] = 'Bearer $self.token'
url := 'https://$self.host/_matrix/client/r0/$api'
resp := http.fetch(url, config) ?
println('$url $resp.text')