You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.0 KiB
Go

package main
import (
"fmt"
"net/http"
// "strings"
"io/ioutil"
)
const (
ApiEndpoint = "https://hodlhodl.com/api/v1"
TestApiEndpoint = "https://hhtestnet.com/api/v1"
ApiKey = "***REMOVED***"
)
type response struct {
Status string `json:"status"`
ExchangeRateProviders []struct {
Name string `json:"name"`
CurrencyCodes []string `json:"currency_codes"`
} `json:"exchange_rate_providers"`
}
func main() {
fmt.Println("hello world")
//body:= strings.NewReader(' -X POST -H "Authorization: Bearer ***REMOVED***" -H "Content-Type: application/json"`)
req, err := http.NewRequest("POST", TestApiEndpoint + "/notifications/read", nil)
if err != nil {
fmt.Println(err)
}
req.Header.Add("Authorization", "Bearer " + ApiKey)
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err!= nil {
fmt.Println(err)
}
fmt.Println(resp.Status)
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
fmt.Println(err)
}
fmt.Println(string(body))
defer resp.Body.Close()
}