aboutsummaryrefslogtreecommitdiff
path: root/response.go
blob: fc9859f09afd929be76ca858995a53f3e3140685 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
package inwx

import "encoding/json"

// A Response contains the Status of a response to a Call
// as well as the response parameters.
// Data is nil if there are no response parameters.
type Response struct {
	StatusCode Status           `json:"code"`
	Data       *json.RawMessage `json:"resData"`
}

// Into unmarshals the Response into a Call specific response struct.
func (r *Response) Into(resp any) error {
	return json.Unmarshal(*r.Data, resp)
}