gitpoint / git-point

GitHub in your pocket :iphone:
https://gitpoint.co/
MIT License
4.72k stars 790 forks source link

Add github trending #44

Open Huang-Libo opened 7 years ago

Huang-Libo commented 7 years ago

Just like https://github.com/trending

astelvida commented 7 years ago

I've tried adding that feature to one of my projects - but GitHub doesn't provide an api specifically for getting the exact data at that url. The solution closest to that is to use the Search API and give it some options. For instance for finding popular API's created in the last day using js:

curl -G https://api.github.com/search/repositories --data-urlencode "sort=stars" --data-urlencode "order=desc" --data-urlencode "q=language:javascript" --data-urlencode "q=created:>date -v-1d '+%Y-%m-%d'"

But clearly, that doesn't give the same results as https://github.com/trending/javascript

If anyone found a better/actual way of getting trending repos, please share. :)

housseindjirdeh commented 7 years ago

I really wanted to include this as part of the first release but just like you mentioned @astelvida - there was no direct available endpoint for it :O

Will love to hear any suggestions from anybody on how we can do this. If there is no better solution, I'm okay with using the queried search API just like you mentioned and calling it 'Popular Repositories this past day/week/etc'

housseindjirdeh commented 7 years ago

In terms of design - I think this can fit perfectly within the Search screen. Right now we have a placeholder when a search hasn't been made (Search for any repository/user). I think having the list of popular/trending repositories here would awesome.

We can start with just having popular repositories of today and I would be happy to close this PR with it. We can create a separate ticket to add a toggle of sorts for today/this week/this month if we prefer 🕺

Huang-Libo commented 7 years ago

You can have a look at this repo, its trending api is closed to https://github.com/trending, it maybe have some time lag because of cache, but still awesome. By the way, this API is used by CodeHub APP now.

housseindjirdeh commented 7 years ago

Thank you so much @Huang-Libo that is perfect!!! Makes things so much simpler :tada: :tada: :tada:

RolfKoenders commented 7 years ago

@Huang-Libo That api would definitely work for us! @housseindjirdeh What would be a nice place to show this? Add an star to the tabbar and show a nice view of the trending repo's? There is not really a 'other' menu option. We could maybe replace the profile with a hamburger icon and show a list of other options?

andrewda commented 7 years ago

It might fit well somewhere on the search screen, too.

RolfKoenders commented 7 years ago

@andrewda Yea i was thinking that to. As a option next to Repositories & Users? But are we then searching in trending when the user clicks search?

andrewda commented 7 years ago

Yea, I was thinking that would be a good spot. How about on that tab instead of a search bar we have a drop down with languages?

note to self: you can use a language parameter on the codehub trending API http://trending.codehub-app.com/v2/trending?language=python

RolfKoenders commented 7 years ago

@andrewda That sounds like a nice feature!

housseindjirdeh commented 7 years ago

@andrewda @RolfKoenders yep on the search screen was exactly what I was thinking, but I don't think it should be a tab besides repos and users specifically because it'll seem like users have to search for trending. I was thinking showing a list of trending repositories (and a title) as a placeholder on that screen before the user searches for anything (instead of the message Search for any repository/user. Does that make sense?

However I do think having a dropdown is a good idea 🤔 I really like @andrewda's idea but as a user it's an extra step to find trending so I'm leaning towards showing it as a default. Repositories tab will default to showing trending repositories of today and Users tab will default to trending users of today. We can later add support of a dropdown to change timelines. How does that sound?

RolfKoenders commented 7 years ago

@housseindjirdeh Showing the trending repositories before searching sounds like a nice idea indeed. Btw, if i am correct the owner of that api stated in the readme to not use those endpoints since its for their app. We could host/setup our own instance of it, or i could build a similar api maybe with some more options/filters we would like. So we can make the api to our needs.

housseindjirdeh commented 7 years ago

@RolfKoenders thank you for noticing that, I didn't catch that in the README! We definitely can't use those endpoints since that's the case - I would absolutely love if we can set up a similar instance or even one with more options, filters. I hope this won't be too much work however so let's use this and our Gitter channel to chat all the details.

RolfKoenders commented 7 years ago

@housseindjirdeh You need the auto complete usernames features ;) I will document a plan and share it to discuss!

RolfKoenders commented 7 years ago

I have created a first draft of the approach. You can read it here. https://github.com/RolfKoenders/gitpoint-api-docs

I'm going to investigate which data we can retrieve by scraping. Since we then have the repository name we could use the API to retrieve more details about that repository and save that in the data store. After we know which data will be stored we can start working on the API calls.

RolfKoenders commented 7 years ago

I assigned this issue to myself. Follow up message on the message above this one. Im starting on the actual API at this moment, the next phase is the deployment part and then the actual screens in the app. Follow the progress here

lex111 commented 6 years ago

@RolfKoenders I will take it?

RolfKoenders commented 6 years ago

I have the API ready you can use that! :D I was working on implementing it but takes me longer then expected to do it properly with the redux system, and i have a busy period.. If you need help let me know.

Until we are going to re-deploy it to the correct account @housseindjirdeh you can use this url: http://gp-public-160495907.eu-west-1.elb.amazonaws.com/trending/today

Docs: https://github.com/RolfKoenders/gitpoint-api-docs/blob/master/api/swagger.yml

lex111 commented 6 years ago

@RolfKoenders Thanks, it's cool, I'll see what can be done.