From 13d776f832ac132134eb5ce0bc8ab09ea1d2fe41 Mon Sep 17 00:00:00 2001 From: Andrew Garner Date: Thu, 12 Sep 2024 11:43:21 +0100 Subject: [PATCH] Add hand-off target upsert --- hand_off_target_upsert.go | 28 ++++++++++++++++++++++++++++ version.go | 2 +- 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 hand_off_target_upsert.go diff --git a/hand_off_target_upsert.go b/hand_off_target_upsert.go new file mode 100644 index 0000000..fabf002 --- /dev/null +++ b/hand_off_target_upsert.go @@ -0,0 +1,28 @@ +package client + +import ( + "context" + "net/http" +) + +type UpsertHandOffTargetParams struct { + // ID is your identifier of choice for this hand-off target. + 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"