TL;DR: There is no simple way to know if a "user" is an Organization or a simple User from the GitHub POV.
I've seen that the type user_type was removed, in favor of splitting user in two distinct part: user and org.
When we do not have a complete control about the GitHub username (coming from a user input for example), it becomes hard to know if we are talking about an organization or a user; the only way I found would be to call /orgs/:user first: if it returns 404, then it may be a user, otherwise it is an organization.
As an example, if we want to get information of a specific repository (for the example, let's say the ocaml repository from the ocaml organization), there is a need of extra works to know if the repository owner is an organization or a user.
Chosen solution
Reintroduce the type user_type, and adding them to both user and org type; this is the simplest solution to ensure the backward compatibility with older versions.
Other solution
Having a type looking like
type github_user =
| User of user_info
| Org of organization
And everywhere we may have one or another (repository owner, fetching a specific user, ...) using this type. Otherwise using the concerned type (organization when listing a user organization for example).
(Sorry, this small PR comes right after you released the last version :/)
Problem
TL;DR: There is no simple way to know if a "user" is an
Organization
or a simpleUser
from the GitHub POV.I've seen that the type
user_type
was removed, in favor of splittinguser
in two distinct part:user
andorg
.When we do not have a complete control about the GitHub username (coming from a user input for example), it becomes hard to know if we are talking about an organization or a user; the only way I found would be to call
/orgs/:user
first: if it returns 404, then it may be a user, otherwise it is an organization.As an example, if we want to get information of a specific repository (for the example, let's say the
ocaml
repository from theocaml
organization), there is a need of extra works to know if the repository owner is an organization or a user.Chosen solution
Reintroduce the type
user_type
, and adding them to bothuser
andorg
type; this is the simplest solution to ensure the backward compatibility with older versions.Other solution
Having a type looking like
And everywhere we may have one or another (repository owner, fetching a specific user, ...) using this type. Otherwise using the concerned type (
organization
when listing a user organization for example).(Sorry, this small PR comes right after you released the last version :/)