mirror of
https://github.com/awfufu/qbot.git
synced 2026-03-01 13:29:43 +08:00
init: first commit
This commit is contained in:
17
api/get_csrf_token.go
Normal file
17
api/get_csrf_token.go
Normal file
@@ -0,0 +1,17 @@
|
||||
package api
|
||||
|
||||
import "encoding/json"
|
||||
|
||||
func GetCsrfToken(c Client) (int32, error) {
|
||||
data, err := c.Send("get_csrf_token", nil)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
var resp struct {
|
||||
Token int32 `json:"token"`
|
||||
}
|
||||
if err := json.Unmarshal(data, &resp); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return resp.Token, nil
|
||||
}
|
||||
Reference in New Issue
Block a user