-
Notifications
You must be signed in to change notification settings - Fork 5
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
API Service - optional Configuration to every request #41
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.
Thank you very much for your effort. Couple small issues and this should work.
Because of fact that I have no longer access to this repository I cannot push updates to cocoapods.
Please take a look on my fork: RxSwiftAPI, I've rebuild whole core of library which was causing crashes and memory leaks. Also your changes are already there in APILayer. It's still in development but I'm testing it in my current project and is much more stable than old one.
|
||
- Returns: ApiRequest object which allows to follow progress and manage request. | ||
*/ | ||
func postFile(from localFileUrl: URL, to destinationUrl: URL, with aditionalHeaders: [ApiHeader]? = nil, inBackground: Bool = true, useProgress: Bool = true, completion: ApiResponseCompletionHandler? = nil) -> ApiRequest { | ||
func postFile(from localFileUrl: URL, to destinationUrl: URL, with aditionalHeaders: [ApiHeader]? = nil, inBackground: Bool = true, useProgress: Bool = true, configuration: ApiService.Configuration = ApiService.Configuration.foreground, completion: ApiResponseCompletionHandler? = nil) -> ApiRequest { | ||
let configuration: Configuration = inBackground ? .background : .foreground |
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.
Without removing this line, configuration from method parameter won't be used 😉.
Also inserting configuration as a parameter IMO inBackground
is no longer needed.
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.
That is true! In real i didn't dig that deep, it was just mechanical expansion of every method that had something to do with ApiRequest. Thank you for noticing! Hours of debugging in the future saved! 🥇
The parameter inBackground
indeed is not needed when combined with the other
|
||
- Returns: ApiRequest object which allows to follow progress and manage request. | ||
*/ | ||
func putFile(from localFileUrl: URL, to destinationUrl: URL, with aditionalHeaders: [ApiHeader]? = nil, inBackground: Bool = true, useProgress: Bool = true, completion: ApiResponseCompletionHandler? = nil) -> ApiRequest { | ||
func putFile(from localFileUrl: URL, to destinationUrl: URL, with aditionalHeaders: [ApiHeader]? = nil, inBackground: Bool = true, useProgress: Bool = true, configuration: ApiService.Configuration = ApiService.Configuration.foreground, completion: ApiResponseCompletionHandler? = nil) -> ApiRequest { | ||
let configuration: Configuration = inBackground ? .background : .foreground |
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.
The same, here.
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.
🏅
|
||
- Returns: ApiRequest object which allows to follow progress and manage request. | ||
*/ | ||
func patchFile(from localFileUrl: URL, to destinationUrl: URL, with aditionalHeaders: [ApiHeader]? = nil, inBackground: Bool = true, useProgress: Bool = true, completion: ApiResponseCompletionHandler? = nil) -> ApiRequest { | ||
func patchFile(from localFileUrl: URL, to destinationUrl: URL, with aditionalHeaders: [ApiHeader]? = nil, inBackground: Bool = true, useProgress: Bool = true, configuration: ApiService.Configuration = ApiService.Configuration.foreground, completion: ApiResponseCompletionHandler? = nil) -> ApiRequest { | ||
let configuration: Configuration = inBackground ? .background : .foreground |
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.
And here.
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.
🎖
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.
Thank you very much for your effort. Couple small issues and this should work.
Because of fact that I have no longer access to this repository I cannot push updates to cocoapods.
Please take a look on my fork: RxSwiftAPI, I've rebuild whole core of library which was causing crashes and memory leaks. Also your changes are already there in APILayer. It's still in development but I'm testing it in my current project and is much more stable than old one.
Is it possible to reach you somehow? Please check contact info in my bio
The requests are by default using the Configuration, current changes are introducing custom configuration to every request started from API Service Layer.
For example we can now set timeouts to requests from API Service.