Skip to content

Commit b2eeb54

Browse files
authored
(fix): endpoint <api-url>/workspaces/<workspace-id>/tags/<tag-id> does not exist anymore (#22)
1 parent 14b6666 commit b2eeb54

File tree

2 files changed

+19
-14
lines changed

2 files changed

+19
-14
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased]
88

9+
## [v0.2.2] - 2020-03-18
10+
11+
## Fixed
12+
13+
- the endpoint `workspaces/<workspace-id>/tags/<tag-id>` does not exist anymore, instead the
14+
`api.Client` will get all tags of the workspace (`api.Client.GetTags`) and filter the response
15+
to find the tag by its id.
16+
917
## [v0.2.1] - 2020-03-02
1018

1119
## Fixed

api/client.go

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -290,24 +290,21 @@ type GetTagParam struct {
290290

291291
// GetTag get a single tag, if it exists
292292
func (c *Client) GetTag(p GetTagParam) (*dto.Tag, error) {
293-
var tag *dto.Tag
294-
295-
r, err := c.NewRequest(
296-
"GET",
297-
fmt.Sprintf(
298-
"workspaces/%s/tags/%s",
299-
p.Workspace,
300-
p.TagID,
301-
),
302-
nil,
303-
)
293+
tags, err := c.GetTags(GetTagsParam{
294+
Workspace: p.Workspace,
295+
})
304296

305297
if err != nil {
306-
return tag, err
298+
return nil, err
299+
}
300+
301+
for _, t := range tags {
302+
if t.ID == p.TagID {
303+
return &t, nil
304+
}
307305
}
308306

309-
_, err = c.Do(r, &tag)
310-
return tag, err
307+
return nil, fmt.Errorf("tag %s not found on workspace %s", p.TagID, p.Workspace)
311308
}
312309

313310
// GetProjectParam params to get a Project

0 commit comments

Comments
 (0)