-
Notifications
You must be signed in to change notification settings - Fork 35
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
Background upload / download using URLSession transport #54
Comments
I think it should be possible to make this work with the generated client. I can't offer much support on using background tasks with URLSession, but how you can proceed:
After you have it working, you could contribute your changes back to https://github.com/apple/swift-openapi-urlsession so that it also works for others using background tasks. But you should be able to use the generator in this repo, and the runtime library without any modifications, all the changes should be isolated to the URLSession transport. |
+1 would be nice to have background support |
This is somewhat tricky since background sessions work with files instead of data streams. The code needs to be changed to upload a file or download a file, and per-task delegate is not available with background sessions. |
Good points. Yeah I imagine that if background tasks are to be supported here, we need a proposed design of how it'd all work. Let's just use this issue to track any progress on that, ideally driven by someone who has a use case here. |
We are heavily using openapi to generate our REST library.
In this library we do files upload and download.
Everything works pretty well but now we want to allow background requests.
That means we need to use an URLSession with
URLSessionConfiguration.background()
.I saw we could override the URLSession but the most challenging part is we need a dedicate delegate for each API we have running in the background.
What's the best way to manage that with an openapi generated library?
For now, we are considering doing it manually, so removing this library from our code :'(
The text was updated successfully, but these errors were encountered: