Skip to content

Initial file upload concept#116

Closed
wpK wants to merge 4 commits intoapollographql:masterfrom
wpK:master
Closed

Initial file upload concept#116
wpK wants to merge 4 commits intoapollographql:masterfrom
wpK:master

Conversation

@wpK
Copy link
Copy Markdown

@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
Copy Markdown

@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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Author

wpK commented Aug 22, 2017

@martijnwalraven No problem. Enjoy your vacation!

@FellnerDotDev
Copy link
Copy Markdown

@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
Copy Markdown
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
Copy Markdown

Hey,

Is it still something you are working on ?

Thanks :)

@dphov
Copy link
Copy Markdown

dphov commented Jun 29, 2018

Please, someone, resolve this PR
@wpK

@vinayan3
Copy link
Copy Markdown

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
Copy Markdown

LeeWong commented Jul 3, 2018

Please merge this PR. Thanks.

@highthem
Copy link
Copy Markdown

highthem commented Nov 23, 2018

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

@marinofelipe
Copy link
Copy Markdown

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

@psi-gh
Copy link
Copy Markdown
Contributor

psi-gh commented Jan 14, 2019

Waiting for this.

@tylergets
Copy link
Copy Markdown

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

@otri
Copy link
Copy Markdown

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
Copy Markdown

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
Copy Markdown

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
Copy Markdown
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
Copy Markdown

otri commented Jun 11, 2019 via email

@designatednerd
Copy link
Copy Markdown
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
Copy Markdown

otri commented Jul 10, 2019 via email

@designatednerd
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor

@kimdv absolutely!

@designatednerd
Copy link
Copy Markdown
Contributor

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

@wpK
Copy link
Copy Markdown
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
Copy Markdown
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.