-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
45 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package client | ||
|
||
type HandOffTarget 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. | ||
Name string `json:"name"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package client | ||
|
||
import ( | ||
"context" | ||
"encoding/json" | ||
"net/http" | ||
) | ||
|
||
type HandOffTargets struct { | ||
Targets []*HandOffTarget `json:"targets"` | ||
} | ||
|
||
// ListHandOffTargets returns all of your hand off targets. | ||
// | ||
// Note: requires a `Management` API key. | ||
func (c *Client) ListHandOffTargets(ctx context.Context) (*HandOffTargets, error) { | ||
rsp, err := c.makeRequest(ctx, http.MethodGet, "hand-off-targets", nil) | ||
if err != nil { | ||
return nil, err | ||
} | ||
defer rsp.Body.Close() | ||
|
||
if err := responseError(rsp); err != nil { | ||
return nil, err | ||
} | ||
|
||
var targets HandOffTargets | ||
if err := json.NewDecoder(rsp.Body).Decode(&targets); err != nil { | ||
return nil, err | ||
} | ||
return &targets, nil | ||
} |