ashkan18 / graphlient

Ruby GraphQL Client
MIT License
251 stars 44 forks source link

Add multipart request support #65

Open pucinsk opened 5 years ago

pucinsk commented 5 years ago

This PR allows send files via graphql. It adds FaradayMultipartAdapter to allow send multipart requests via graphlient gem. It accepts File instances and convert its to Faraday::UploadIO before sending.

dangerpr-bot commented 5 years ago
1 Warning
:warning: Unless you’re refactoring existing code, please update CHANGELOG.md.

Here's an example of a CHANGELOG.md entry:

* [#65](https://github.com/ashkan18/graphlient/pull/65): Add multipart request support - [@pucinsk](https://github.com/pucinsk).

Generated by :no_entry_sign: Danger

dblock commented 5 years ago

@pucinsk My biggest reservation about this PR is the creation of another adapter. Can we build multipart support into the existing one? What's the downside?

pucinsk commented 5 years ago

There are no downsides. I thought that it could be optional adapter. But if it would be better that files supporting would be enabled by default than I am more than willing to add this to main FaradayAdapter

ashkan18 commented 5 years ago

Thanks @pucinsk, yes that would be awesome to add support to existing adapter. Thanks so much!

dblock commented 5 years ago

Yes, 1 adapter > 2 adapters.

uiltonlopes commented 2 years ago

Hi can you merge the branch? I would like to use this functionality

uiltonlopes commented 2 years ago

This is pretty cool, but it seems strange to me that you would have to use a different adapter to send a file. Shouldn't I be able to do that by default?

Alright master. Can you help me with some file upload example that still manages to leverage the gem

dblock commented 2 years ago

This is pretty cool, but it seems strange to me that you would have to use a different adapter to send a file. Shouldn't I be able to do that by default?

Alright master. Can you help me with some file upload example that still manages to leverage the gem

I've never done that myself, so don't know how to do it with the current implementation. If you want to try and refactor this PR to support multipart I can try to help out fix any remaining issues on something that (almost) works.

PedroAugustoRamalhoDuarte commented 11 months ago

Hello guys, is there any way to send files with Graphlient, or only with this PR?

dblock commented 11 months ago

I don't know of one.