-
-
Notifications
You must be signed in to change notification settings - Fork 598
GraphQL API #510
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
GraphQL API #510
Conversation
[ci skip] [skip ci]
@@ -0,0 +1,25 @@ | |||
<?php | |||
namespace Github\Api; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 space line before namespace tag is required
@cursedcoder Done! |
/** | ||
* GraphQL API. | ||
* | ||
* @link http://developer.github.com/v3/markdown/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be https://developer.github.com/early-access/graphql/?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it should
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where can I find documentation about the endpoint? These docs just explain parameters.
Also, may you add a simple test?
/** | ||
* GraphQL API. | ||
* | ||
* @link http://developer.github.com/v3/markdown/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it should
namespace Github\Api; | ||
|
||
/** | ||
* GraphQL API. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be mention that this is the Early Access program?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@Nyholm I keep having the same problem with the tests. I don't know how the fake data is generated, so I cannot add simple GraphQL data. |
* | ||
* @return array | ||
*/ | ||
public function graphql($query) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want the signature to be:
$github->graphql()->graphql($query)
Compare to:
$github->graphql()->execute($query)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you want me to change it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think? What does @cursedcoder think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think execute() is more clear.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Nyholm Changed.
This test would work (I've not run it) class GraphQLTest extends TestCase
{
// ...
/**
* @test
*/
public function shouldShowGistComment()
{
$api = $this->getApiMock();
$api->expects($this->once())
->method('post')
->with('/graphql', 'bar')
->will($this->returnValue('foo'));
$result = $api-> graphql('bar');
$this->assertEquals('foo', $result);
}
protected function getApiClass()
{
return \Github\Api\GraphQL::class;
}
}
|
@Nyholm Added Test. |
@Nyholm Changed function name. |
@@ -0,0 +1,25 @@ | |||
class GraphQLTest extends TestCase | |||
{ | |||
// ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
copy/pate typo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What typo?
@@ -0,0 +1,25 @@ | |||
class GraphQLTest extends TestCase |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file should have class comment and namespace
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done (I think)
/** | ||
* @test | ||
*/ | ||
public function shouldShowGistComment() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update this method name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
* GraphQL API. | ||
* | ||
* Part of the Github API Early-Access Program | ||
* @link https://developer.github.com/early-access/graphql/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be an extra space before this line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
/** | ||
* @test | ||
*/ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this space.
|
||
$api->expects($this->once()) | ||
->method('post') | ||
->with('/graphql', 'bar') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I missed that you are building an array.
->with($this->equalTo('/graphql'), $this->equalTo(['query'=>'bar']))
@Nyholm Fixed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome. Thank you!
@Nyholm @cursedcoder Merge? |
Im 👍 to merge. But since other collaborators were involved here I would like to give them some time to review the changes as well. |
@xabbuh what would you say? |
Anyway merging this because we got 2/3 votes. |
Add support for the Github GraphQL API.