Milestone Functions accept name to identify #418
No reviewers
Labels
No Label
has/backport
has/pull
in progress
invalid
kind/breaking
kind/bug
kind/build
kind/deployment
kind/docs
kind/enhancement
kind/feature
kind/lint
kind/proposal
kind/question
kind/refactor
kind/security
kind/testing
kind/translation
kind/ui
need/backport
priority/critical
priority/low
priority/maybe
priority/medium
reviewed/duplicate
reviewed/invalid
reviewed/wontfix
skip-changelog
status/blocked
status/needs-feedback
status/needs-reviews
status/wip
upstream/gitea
No Milestone
No Assignees
4 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: gitea/go-sdk#418
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "6543/go-sdk:GetMilestones_add-name-to-id-resove-function"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
close #383
followup of #388
source https://github.com/go-gitea/gitea/pull/12649
@ -63,2 +72,3 @@
milestone := new(Milestone)
resp, err := c.getParsedResponse("GET", fmt.Sprintf("/repos/%s/%s/milestones/%d", owner, repo, id), nil, nil, milestone)
resp, err := c.getParsedResponse("GET", fmt.Sprintf("/repos/%s/%s/milestones/%s", owner, repo, id), nil, nil, milestone)
The id needs a PathEscape
@ -132,3 +155,3 @@
}
milestone := new(Milestone)
resp, err := c.getParsedResponse("PATCH", fmt.Sprintf("/repos/%s/%s/milestones/%d", owner, repo, id), jsonHeader, bytes.NewReader(body), milestone)
resp, err := c.getParsedResponse("PATCH", fmt.Sprintf("/repos/%s/%s/milestones/%s", owner, repo, id), jsonHeader, bytes.NewReader(body), milestone)
simy. here
@zeripath done
One general nit, and then one personal nit.
I personally really dislike
interface
options. In my opinion if we are allowing multiple ways to get something, it should have a func for each.Even if one of them converts an
int
to astring
and then simply delegates back to the other, it makes library usage much cleaner imo@ -143,0 +178,4 @@
// milestoneValueToString return string of int/int6/string and if it was converted
func milestoneValueToString(value interface{}) (string, bool, error) {
ii, ok := value.(int64)
This can all be a switch statement
switch v := value.(type) {}
I think is probably a more self-documented solution.