diff --git a/hand_off_target_upsert.go b/hand_off_target_upsert.go new file mode 100644 index 0000000..0a3c811 --- /dev/null +++ b/hand_off_target_upsert.go @@ -0,0 +1,29 @@ +package client + +import ( + "context" + "net/http" +) + +type UpsertHandOffTargetParams struct { + // ID is your identifier of choice for this hand-off target. Can be anything consisting + // of letters, numbers, or any of the following characters: `_` `-` `+` `=`. + ID string `json:"id"` + + // Name is the hand-off target’s name. This cannot be nil. + Name string `json:"name"` +} + +// UpsertHandOffTarget inserts or updates a hand-off target +func (c *Client) UpsertHandOffTarget(ctx context.Context, p *UpsertHandOffTargetParams) error { + rsp, err := c.makeRequest(ctx, http.MethodPost, "hand-off-targets", p) + if err != nil { + return err + } + defer rsp.Body.Close() + + if err := responseError(rsp); err != nil { + return err + } + return nil +} diff --git a/version.go b/version.go index daa9b78..6895659 100644 --- a/version.go +++ b/version.go @@ -1,3 +1,3 @@ package client -const version = "0.1.1" +const version = "0.2.0"