Skip to content
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

Initial file upload concept #116

Closed
wants to merge 4 commits into from
Closed

Initial file upload concept #116

wants to merge 4 commits into from

Conversation

wpK
Copy link

@wpK wpK commented Jul 27, 2017

As discussed in #114, this is an example of file upload support without forcing to a specific server spec.

I made this PR to get the conversation going. The naming, progress handling, GraphQLFile input error handling all need to be improved on.

An example of use:

let imageData: Data = ...
let imageFileURL: URL = ...
let pdfInputStream: InputStream = ...
let pdfContentLength: UInt64 = ...

var files: [GraphQLFile] = []
files.append(GraphQLFile(fieldName: "files.0", originalName: "test-file-1.png", mimeType: "image/png", data: imageData))
files.append(GraphQLFile(fieldName: "files.1", originalName: "test-file-2.png", mimeType: "image/png", fileURL: imageData))
files.append(GraphQLFile(fieldName: "files.2", originalName: "test-file-3.pdf", mimeType: "application/pdf", inputStream: pdfData, contentLength: pdfContentLength))

let mutation = MultipleUploadMutation(files: files.map({Upload(fieldName: $0.fieldName, name: $0.originalName, type: $0.mimeType, size: $0.count)}))

let progressHandler = { progress in
  print("Upload progress: \(progress)")
}

let client = ApolloClient( ... )

// progressHandler is optional
client.performUpload(mutation: mutation, files: files, progressHandler: progressHandler) { (result, error) in
  ...
}

@apollo-cla
Copy link

@wpK: Thank you for submitting a pull request! Before we can merge it, you'll need to sign the Meteor Contributor Agreement here: https://contribute.meteor.com/

@martijnwalraven
Copy link
Contributor

@wpK: Thanks a lot, happy to see this get in! I'll try to take a closer look tomorrow or else over the weekend.

@martijnwalraven
Copy link
Contributor

Hey, I'm sorry I haven't gotten to this yet. I'll be on vacation for the next week and a half, but I'll take a look after.

@wpK
Copy link
Author

wpK commented Aug 22, 2017

@martijnwalraven No problem. Enjoy your vacation!

@FellnerDotDev
Copy link

@martijnwalraven I hope you have had a pleasant vacation. Is there any chance that the merge conflicts get resolved in the near future?

@martijnwalraven
Copy link
Contributor

@TheFellner I'm caught up in preparing for GraphQL Summit right now, but let's get back to this next week. I don't think this is ready to be merged, but it's a good starting point for discussing API design.

@gorbat-o
Copy link

Hey,

Is it still something you are working on ?

Thanks :)

@dphov
Copy link

dphov commented Jun 29, 2018

Please, someone, resolve this PR
@wpK

@vinayan3
Copy link

vinayan3 commented Jul 3, 2018

Is there anything we can do to help get this PR through? It'll be super useful to have it working in the client.

@LeeWong
Copy link

LeeWong commented Jul 3, 2018

Please merge this PR. Thanks.

@highthem
Copy link

highthem commented Nov 23, 2018

any news about this? is it released?
@wpK
@martijnwalraven

@marinofelipe
Copy link

This would be a great addition for us. Is there any news about it? Can we help somehow?

@psi-gh
Copy link
Contributor

psi-gh commented Jan 14, 2019

Waiting for this.

@tylergets
Copy link

Would also support this pull request, file uploads are mainstreamed in apollo-server now

@otri
Copy link

otri commented Feb 6, 2019

I'm hoping to get this working on my fork here:
https://github.com/otri/apollo-ios

It's still a work in progress today, but I hope to have it running very soon. I've resolved all the merge conflicts with master.

@otri
Copy link

otri commented Feb 6, 2019

Okay I've learned that there's a lot more to the schema codegen. Would need Apollo to figure this one out. My fork corrects for a conflict with Progress, but I couldn't actually get the implementation for the mutation hooked up.

@the-scott-davis
Copy link

This is so needed.... seems like a major oversight to not support this. @otri I took at look at your PR, looks solid, but as you said, need support from the Apollo team for the codegen part it appears.

@kimdv
Copy link
Contributor

kimdv commented Jun 11, 2019

Hi @wpK and @martijnwalraven

Do you need any help here?
I'm looking for this feature, so if you need help feel free to reach out! 🚀

@otri
Copy link

otri commented Jun 11, 2019 via email

@designatednerd
Copy link
Contributor

@wpK Are you interested in continuing this PR? If not I can close it out for you and take a stab myself.

@otri
Copy link

otri commented Jul 10, 2019 via email

@designatednerd
Copy link
Contributor

Thanks @otri - I'd like to get that confirmation from the original author, @wpK, before I close this (or if I don't hear from him in a couple weeks, I'll close it anyway).

@kimdv
Copy link
Contributor

kimdv commented Jul 11, 2019

@designatednerd I have a branch fork with the 0.10.1 working with file upload.
https://github.com/trifork/apollo-ios

I can rebase to 0.11.0 and open an PR?

@designatednerd
Copy link
Contributor

@kimdv absolutely!

@designatednerd
Copy link
Contributor

Closing this in favor of #626 since that one's been rebased

@wpK
Copy link
Author

wpK commented Jul 15, 2019

@designatednerd I haven't touched this in awhile. Last time I checked the Apollo server was adding official file upload support and I never got around to updating to the new spec. I'll watch #626 and when I have some more time try to contribute where I can.

@designatednerd
Copy link
Contributor

@wpK Thank you - Yeah #626 is ready for a look if you've got questions!

designatednerd added a commit that referenced this pull request Jul 18, 2019
BobaFetters added a commit that referenced this pull request Nov 2, 2023
Co-authored-by: Zach FettersMoore <zach.fetters@apollographql.com>
Co-authored-by: Maria Elisabeth Schreiber <maria.schreiber@apollographql.com>
Co-authored-by: gh-action-runner <runner@Mac-1698338401160.local>
Co-authored-by: Anthony Miller <anthonymdev@gmail.com>
Co-authored-by: gh-action-runner <runner@Mac-1698344533451.local>
Co-authored-by: Hesham Salman <iron-ham@github.com>
Co-authored-by: Syed Zohair Abbas Hadi <45510142+zohairhadi@users.noreply.github.com>
Co-authored-by: gh-action-runner <runner@Mac-1698701484703.local>
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.