gitgithub-apigithub-api-v3

I am using GitHub API v3 and I need to order the list of users by username?


I am using this api https://api.github.com/search/users?q=language:kotlin&page=1&per_page=10

How do i order the list by the username? If it isn't possible by the api, what would be the best option to do that in Android?


Solution

  • That's currently not possible. For now, the github api only supports 3 types of sort values.

    Sorts the results of your query by number of followers or repositories, or when the person joined GitHub. Default: best match

    There really isn't a good way to overcome this problem from the android application side. You could try to query a large number of users and then perform the sorting on your side, but this approach is inherently flawed by the fact that when more 'users' are gotten from the api, you'll need to add them to the list and sort again.

    This would cause the list order to change and is highly likely to confuse your users. It's probably best to use one of the default sort options allowed by the github api.