File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change 1+ package webhookrelay
2+
3+ import (
4+ "encoding/json"
5+ "net/http"
6+ )
7+
8+ type UserInfo struct {
9+ Status string `json:"status"`
10+ Data struct {
11+ ID string `json:"id"`
12+ Username string `json:"username"`
13+ Email string `json:"email"`
14+ AuthType string `json:"auth_type"`
15+ PlanID string `json:"plan_id"`
16+ Role string `json:"role"`
17+ } `json:"data"`
18+ }
19+
20+ // UserInfo returns current user details
21+ func (api * API ) UserInfo () (* UserInfo , error ) {
22+
23+ resp , err := api .makeRequest (http .MethodGet , "/user/info" , nil )
24+ if err != nil {
25+ return nil , err
26+ }
27+
28+ var userInfo UserInfo
29+ if err := json .Unmarshal (resp , & userInfo ); err != nil {
30+ return nil , err
31+ }
32+ return & userInfo , nil
33+ }
You can’t perform that action at this time.
0 commit comments