XAMPPRocky / octocrab

A modern, extensible GitHub API Client for Rust.
Other
1.1k stars 265 forks source link

Add the ability to get repository ID and use repositories by ID #683

Closed InAnYan closed 1 month ago

InAnYan commented 2 months ago

I haven't dug the GitHub API docs enough, but it seems there is such a thing: https://stackoverflow.com/questions/13902593/how-does-one-find-out-ones-own-repo-id

Getting repo id: https://stackoverflow.com/a/77904644

Accessing by repo ID: https://stackoverflow.com/a/74290453

As a user on StackOverflow said, it's undocumented, but GitHub support said it is supported.

Rationale for this feature:

  1. Symmetry: issue_number/issue, id/comment, etc. But repo is accessed by 2 strings
  2. No need to pass and handle bluky strings in users code. Just a slim number. (Besides you even require a String, not any other more generic type)
  3. It would be easier to write a wrapper around several Git Hosts, as one my use ids extensively, but this GitHub prefers strings of owner/repo..
InAnYan commented 2 months ago

I see you have RepositoryId type and ther is an id type in repository type.

But repository handler is tied up to owner/repo