Skip to content

Typed models for working with webhooks #28

@NathanBaulch

Description

@NathanBaulch

Not a huge deal but it would be nice if this package included typed models for easier webhook processing.

For example, I'd like to process the payload data in a video.live_stream.created webhook event however there are incompatible differences with the near-identical muxgo.LiveStream struct.

var payload struct {
    Type string           `json:"type"`
    Data muxgo.LiveStream `json:"data"`
}
if err := resty.Unmarshalc(resty.New(), "application/json", body, &payload); err != nil {
    panic("json: cannot unmarshal number into Go struct field LiveStream.data.created_at of type string")
}

In this particular case, the webhook uses integer dates whereas the API model uses RFC3339 dates.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions