Skip to content

Commit e304bc0

Browse files
authored
Merge pull request #1 from noodle-bag/fix/gitee-issue-endpoints
fix(issue): adapt create/close/reopen endpoints to current Gitee API
2 parents 3091f9a + fd53b1c commit e304bc0

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

internal/api/client.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -268,18 +268,18 @@ func (c *Client) GetIssue(ctx context.Context, owner, repo, number string) (*Iss
268268
}
269269

270270
func (c *Client) CreateIssue(ctx context.Context, owner, repo, title, body string) (*Issue, error) {
271-
payload := map[string]any{"title": title, "body": body}
271+
payload := map[string]any{"repo": repo, "title": title, "body": body}
272272
var issue Issue
273-
if err := c.Request(ctx, http.MethodPost, fmt.Sprintf("repos/%s/%s/issues", owner, repo), nil, payload, &issue); err != nil {
273+
if err := c.Request(ctx, http.MethodPost, fmt.Sprintf("repos/%s/issues", owner), nil, payload, &issue); err != nil {
274274
return nil, err
275275
}
276276
return &issue, nil
277277
}
278278

279279
func (c *Client) UpdateIssueState(ctx context.Context, owner, repo, number, state string) (*Issue, error) {
280-
payload := map[string]any{"state": state}
280+
payload := map[string]any{"repo": repo, "state": state}
281281
var issue Issue
282-
if err := c.Request(ctx, http.MethodPatch, fmt.Sprintf("repos/%s/%s/issues/%s", owner, repo, number), nil, payload, &issue); err != nil {
282+
if err := c.Request(ctx, http.MethodPatch, fmt.Sprintf("repos/%s/issues/%s", owner, number), nil, payload, &issue); err != nil {
283283
return nil, err
284284
}
285285
return &issue, nil

0 commit comments

Comments
 (0)