-
Notifications
You must be signed in to change notification settings - Fork 90
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
implemented file upload capability #53
base: master
Are you sure you want to change the base?
Conversation
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.
Besides the code level comments I have added, we still need:
- Unit tests to cover new functionality added
- A GraphQL API server to be able to test this feature against as an integration test
@@ -81,11 +81,13 @@ public function __construct( | |||
* @param Query|QueryBuilderInterface $query | |||
* @param bool $resultsAsArray | |||
* @param array $variables | |||
* @param array $variables |
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.
why do we have duplicate $variable definition in docblock?
foreach ($files as $key => $content) { | ||
$map->{$key} = [ | ||
$content['path'] | ||
]; | ||
|
||
$postDataFields[$key] = [ | ||
'name' => $key, | ||
'contents' => fopen($content['file'], 'r'), | ||
]; | ||
} |
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.
Please define a new class File
to be used to pass file data instead of passing them as array fields.
Monday.com supports files: https://monday.com/developers/v2#mutations-section-add-file-to-column |
$request = $request->withBody(Psr7\stream_for(json_encode($bodyArray))); | ||
|
||
if (!$files) { | ||
$request = $request->withBody(Psr7\stream_for(json_encode($bodyArray))); |
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 couples Guzzle tightly to the client. I think stream discovery should be used here. For example with php-http/discovery
's \Http\Discovery\Psr17FactoryDiscovery
:
\Http\Discovery\Psr17FactoryDiscovery::findStreamFactory()->createStream(\json_encode($bodyArray));
Lighthouse also supports file uploads. https://lighthouse-php.com/master/digging-deeper/file-uploads.html#handling-file-uploads It's been awhile since this PR has had any activity. It would be good to get this merged. |
No description provided.