forked from vulncheck-oss/sdk-go
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlogout.go
More file actions
32 lines (27 loc) · 742 Bytes
/
logout.go
File metadata and controls
32 lines (27 loc) · 742 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package sdk
import (
"encoding/json"
"fmt"
)
type Response struct {
Benchmark float64 `json:"_benchmark"`
Data UserData `json:"data"`
Type string `json:"type"`
Error bool `json:"error"`
Errors []string `json:"errors"`
Success bool `json:"success"`
}
// https://docs.vulncheck.com/api/logout
func (c *Client) Logout() (responseJSON *Response, err error) {
resp, err := c.Request("GET", "/logout")
if err != nil {
return nil, err
}
defer resp.Body.Close()
_ = json.NewDecoder(resp.Body).Decode(&responseJSON)
return responseJSON, nil
}
// Strings representation of the response
func (r Response) String() string {
return fmt.Sprintf("Benchmark: %v\nResponse: %v\n", r.Benchmark, r.Success)
}