json.Marshal on muxgo.PlaybackRestriction errors out, v3.2.0
nickolasteixeira opened this issue · 2 comments
When using the muxClient.PlaybackRestrictionsApi.ListPlaybackRestrictions()
method, I'm trying to json.Marshal the response into a []muxgo.PlaybackRestriction
struct and get an err back:
json: cannot unmarshal object into Go value of type []muxgo.PlaybackRestriction
I believe in the api_playback_restrictions.go
, specifically the ListPlaybackRestrictions method, it returns back a slice of []PlaybackRestriction
, which the PlaybackRestriction type does not include the Data
field.
So anytime I try to list all my playbacks and json.Marshal them, they error out because the Data Field is missing. Here' an example json response from your api.
{
"data": [
{
"updated_at": "1643990876",
"referrer": {
"allowed_domains": [
"example.com",
"hello.com"
]
},
"id": "xxxxxxxx",
"created_at": "1643990876"
},
{
"updated_at": "1643990866",
"referrer": {
"allowed_domains": [
"example2.com",
"hello2.com"
]
},
"id": "xxxxxx",
"created_at": "1643990866"
}
Also, the same issues are happening for the Create and Get actions on the PlaybackRestriction
API. No Data Field on the PlaybackRestriction
struct.
Hey @nickolasteixeira, thank you for raising this, you're right, there's a problem in the implementation here. We'll address this.
Fixed in 4.0.0.