mirror of
https://codeberg.org/ultimateplayer1999/go-api-usage.git
synced 2025-07-15 10:49:44 -04:00
Compare commits
6 Commits
956c07e85c
...
main
Author | SHA1 | Date | |
---|---|---|---|
ace4c7e53f
|
|||
571a1bc3a7
|
|||
754585842a
|
|||
99f5658469
|
|||
4faecc1444
|
|||
b0951e95b5
|
13
README.md
13
README.md
@ -1,3 +1,12 @@
|
|||||||
Some examples for API usage in Go for the ssh.surf API
|
Some examples for API usage in Go for the ssh.surf API.
|
||||||
|
|
||||||
All of them based on .env files
|
All of them based on a .env file.
|
||||||
|
|
||||||
|
To install this package you can use the following while you have it setup for a Go project.
|
||||||
|
|
||||||
|
```text
|
||||||
|
go get github.com/joho/godotenv
|
||||||
|
```
|
||||||
|
|
||||||
|
# DISCLAIMER
|
||||||
|
The binaries may need to be rebuild. As they are build on Ubuntu and it may also depends on how you installed Golang.
|
||||||
|
21
keystatus.go
21
keystatus.go
@ -61,8 +61,19 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Print the response
|
// Print the response
|
||||||
fmt.Println("")
|
if resp.StatusCode == http.StatusOK {
|
||||||
fmt.Println("Key expire fulldate: ", r.KeyexpireString)
|
fmt.Println("")
|
||||||
fmt.Println("Key expire date: ", r.ExpireDate)
|
fmt.Println("Key status: Active")
|
||||||
fmt.Println("")
|
fmt.Println("Key expire fulldate: ", r.KeyexpireString)
|
||||||
}
|
fmt.Println("Key expire date: ", r.ExpireDate)
|
||||||
|
fmt.Println("")
|
||||||
|
} else if resp.StatusCode == http.StatusUnauthorized {
|
||||||
|
fmt.Println("")
|
||||||
|
fmt.Println("Key status: Expired")
|
||||||
|
fmt.Println("")
|
||||||
|
} else {
|
||||||
|
fmt.Println("")
|
||||||
|
fmt.Println("Recieved an other status code.")
|
||||||
|
fmt.Println("")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -14,7 +14,7 @@ import (
|
|||||||
type Response struct {
|
type Response struct {
|
||||||
Action string `json:"action"`
|
Action string `json:"action"`
|
||||||
Completed string `json:"completed"`
|
Completed string `json:"completed"`
|
||||||
NewAPIKey int `json:"newAPIKey"`
|
NewAPIKey string `json:"newAPIKey"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
Reference in New Issue
Block a user