Skip to content

Add basic search api implementation. #186

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

Merged
merged 8 commits into from
Dec 13, 2014
Merged

Add basic search api implementation. #186

merged 8 commits into from
Dec 13, 2014

Conversation

stackpr
Copy link
Contributor

@stackpr stackpr commented Sep 8, 2014

Example usage:

$client->api('search')->find('issues', "repo:$repo $filter");

The new search api seems to need its own class since it returns objects in a different format. This basic function seems to mimic your API syntax pretty closely.

*/
public function find($type = 'issues', $q = '', $sort = 'updated', $order = 'desc')
{
if (!in_array($type, array('issues', 'repositories', 'code', 'users'))) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of this, it would be much more consistent to have 4 methods on the class

@stackpr stackpr changed the title KnpLabs/php-github-api#178 - adds a basic search api implementation. Add basic search api implementation. Sep 8, 2014
@stackpr
Copy link
Contributor Author

stackpr commented Sep 8, 2014

I split into 4 methods and made the $op param required. However, I did not add the @method annotation - no magic methods are in use. The example changes to:

$client->api('search')->issues("repo:$repo $filter");

@stof
Copy link
Contributor

stof commented Sep 8, 2014

But $client->search() is also supported, and it is recommended over $client->api('search') because it allows IDE autocompletion for the Search API (if the @method is added). See #177
this is why @method should be added.

@stackpr
Copy link
Contributor Author

stackpr commented Sep 8, 2014

Added to Client.php - I thought you were directing an edit to the class I added (i.e., Search.php).

*/
public function repositories($q, $sort = 'updated', $order = 'desc')
{
return $this->get("/search/repositories", array('q' => $q, 'sort' => $sort, 'order' => $order));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use single quotes (same in other methods)

@stof
Copy link
Contributor

stof commented Sep 23, 2014

@Nek- I would like seeing this feature merged (and released). It would be very helpful

@Nek-
Copy link
Contributor

Nek- commented Sep 24, 2014

@wittiws could you add the test or you want somebody else to do it ?

@Nek- Nek- closed this Sep 24, 2014
@Nek- Nek- reopened this Sep 24, 2014
@stackpr
Copy link
Contributor Author

stackpr commented Sep 24, 2014

@Nek- I'm willing, but I'm not sure when I will be able to get to adding the tests.

@guillermoandrae
Copy link
Contributor

@Nek + @stof + @wittiws : I can handle the tests for this over the weekend if noone has started.

@YevKov
Copy link

YevKov commented Nov 29, 2014

@Nek + @stof + @wittiws + @guillermoandrae

Hi guys!
I'm working on tests. Going to finish this weekend.

@YevKov
Copy link

YevKov commented Nov 29, 2014

@wittiws https://github.com/wittiws/php-github-api/pull/1
Done. Can you please merge it?

Thanks.

UPD: also added documentation (search.md).

@Nek
Copy link

Nek commented Nov 29, 2014

Guys, please stop mentioning me in this thread. I'm Nek, the guy you want to refer is Nek-. Mind the dash. Thanks!

Yevgen Kovalienia and others added 2 commits November 30, 2014 13:04
@YevKov
Copy link

YevKov commented Dec 1, 2014

@Nek- Implementation + tests + docs => Done. Can you please merge this pull request now and release new minor version?
I depend on this functionality and will be very happy to make it done.
Thank you.

@YevKov
Copy link

YevKov commented Dec 7, 2014

@stof Hi Christophe! Can you please help to make it done by merging?

pilot added a commit that referenced this pull request Dec 13, 2014
Add basic search api implementation.
@pilot pilot merged commit eac0ecc into KnpLabs:master Dec 13, 2014
@pilot
Copy link
Contributor

pilot commented Dec 13, 2014

@YevKov
Copy link

YevKov commented Dec 14, 2014

@pilot Thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants