atlassian / atlassian/go-sentry-api

Cannot rename project with current implementation

Open
#16 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
55
Forks
45
PR merge metrics
No merged PRs in 30d

Description

It is impossible to use the Update project method to rename a project. Sending an object requires us to use the current slug. we can update the `Name` property but this one maps to the Legacy Name.

The current implementation use the slug from the object. Instead, the slug should be a separate parameter `UpdateProject(o Organization, projectSlug string, p Project)`

Another problem is to get the output value of the update method. For that, we should be able to pass a reference to the update method.

Current implementation:
```golang
// UpdateProject takes a organization and project then updates it on the server side
func (c *Client) UpdateProject(o Organization, p Project) error {
return c.do("PUT", fmt.Sprintf("projects/%s/%s", *o.Slug, *p.Slug), &p, &p)
}
```

Suggested implementation:
```golang
// UpdateProject takes a organization and project then updates it on the server side
func (c *Client) UpdateProject(o Organization, projectSlug string, p *Project) error {
return c.do("PUT", fmt.Sprintf("projects/%s/%s", *o.Slug, projectSlug), p, p)
}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at Client.UpdateProject and inspect its callers and the do method used in the current implementation. Verify how the project slug is used for the request path and how the updated project is returned. Done means a project can be renamed without using its new slug in the lookup and callers can receive the update response.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.