resp, err := http.Get("https://example.com") if err != nil { fmt.Println("Error:", err) return } defer resp.Body.Close() responseCode := ClientResponseCode(resp.StatusCode, resp.Status) log.Println(responseCode)
var responseCode ClientResponseCode err := jsonapi.UnmarshalPayload(resp.Body, &responseCode) if err != nil { fmt.Println("Error:", err) return } log.Printf("Response code: %d - %s\n", responseCode.Code, responseCode.Message)In this example, `jsonapi.UnmarshalPayload` is used to unmarshal the JSON response body into the `ClientResponseCode` struct. The response code and message are printed out. Overall, the `github.com.go-openapi.runtime` package provides a useful `ClientResponseCode` struct that can be used to handle HTTP response codes and messages in Go.