Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API: Getting issue index from times data #8513

Closed
bobemoe opened this issue Oct 14, 2019 · 5 comments · Fixed by #9200
Closed

API: Getting issue index from times data #8513

bobemoe opened this issue Oct 14, 2019 · 5 comments · Fixed by #9200
Labels
modifies/api This PR adds API routes or modifies them
Milestone

Comments

@bobemoe
Copy link
Contributor

bobemoe commented Oct 14, 2019

Gitea Version: 1.10.0+dev-409-g46a12f196

I'm using the /repos​/{owner}​/{repo}​/times​ endpoint that returns like this:

[
  {
    "id": 2,
    "created": "2019-10-14T10:36:03+01:00",
    "time": 900,
    "user_id": 1,
    "issue_id": 1397
  }
]

The above only gives the issue ID, and I cant find any way to then get the issue as the /repos/{owner}/{repo}/issues/{index} endpoint is wanting a issue number rather than the id.

Is there any way to get an issue by its ID rather than its Number?

Or to convert an ID to a Number?

Maybe the times endpoint should return the number as well as id?

@bobemoe
Copy link
Contributor Author

bobemoe commented Oct 15, 2019

So I ended up fetching all issues with /repos​/{owner}​/{repo}​/issues and building a lookup table from ID to Number. This workaround has one flaw; that PR's are not included in the list of issues.

I can fetch all PR's from /repos​/{owner}​/{repo}​/pulls but the PR's seem to have their own ID's that don't match the ID's from the /repos​/{owner}​/{repo}​/times data.

Sure the number of the PR matches the number of the Issue, so in theory I could fetch each issue with the same number as the PR and then get its ID to complete my lookup table. Seems a lot of fetching... :/

@lunny lunny added the type/proposal The new feature has not been accepted yet but needs to be discussed first. label Oct 17, 2019
@lunny
Copy link
Member

lunny commented Oct 17, 2019

I think maybe /repos​/{owner}​/{repo}​/times​ should return issue index.

@bobemoe
Copy link
Contributor Author

bobemoe commented Oct 17, 2019

There are also several other API endpoints that return similar data. I looks like {owner} and {repo} are in the URL for all but /user/times where an issue index alone would not be specific enough to identify the correct issue. Maybe this one (or all?) should return owner and repo too?

  • /repos​/{owner}​/{repo}​
  • /repos/{owner}/{repo}/issues/{id}/times
  • /repos/{owner}/{repo}/times/{user}
  • /user/times

@bobemoe bobemoe changed the title API: Get Issue by ID (not number) - or convert ID to Number. API: Getting issue index from times data Oct 17, 2019
@6543 6543 mentioned this issue Nov 28, 2019
19 tasks
@6543
Copy link
Member

6543 commented Nov 28, 2019

@bobemoe I'll work on it at #9200 so feel free to give me some hints

@bobemoe
Copy link
Contributor Author

bobemoe commented Nov 28, 2019

@6543 Cool thanks, i'm watching the PR and am happy to test, let me know when you're ready for feedback. I think I added enough info above, give me a shout if you've got questions.

zeripath pushed a commit that referenced this issue Dec 27, 2019
Extensively extend the times API.

close #8833; close #8513; close #8559
@lunny lunny added this to the 1.11.0 milestone Dec 28, 2019
@lunny lunny added modifies/api This PR adds API routes or modifies them and removed type/proposal The new feature has not been accepted yet but needs to be discussed first. labels Dec 28, 2019
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
modifies/api This PR adds API routes or modifies them
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants