Skip to content

Generic API#6

Merged
Tornquist merged 8 commits intomasterfrom
generic-api
Feb 20, 2019
Merged

Generic API#6
Tornquist merged 8 commits intomasterfrom
generic-api

Conversation

@Tornquist
Copy link
Copy Markdown
Owner

💚 Summary

  • Build APIQueue to hold in-flight and failed requests
    • Failed request retry only works for types named in the queue
  • Update API interface to support generics. Automatically handles error and decoding logic, but requires all callbacks to support decodable types.
  • Merge all API extensions into a single routes file

Impact:

  • This greatly reduces the amount of duplicated API code and makes the API code that does exist much easier to test.
  • This limits the retry logic to types named within APIQueue. I'm disappointed that this was necessary, but I needed a named place to store the APIRequests by backing generic type so that I could send them back into the API as decodable objects. Without the named types I was unable to retrieve them properly.

@codecov
Copy link
Copy Markdown

codecov bot commented Feb 20, 2019

Codecov Report

Merging #6 into master will increase coverage by 15%.
The diff coverage is 93.4%.

Impacted file tree graph

@@           Coverage Diff            @@
##           master       #6    +/-   ##
========================================
+ Coverage   77.45%   92.45%   +15%     
========================================
  Files          11        9     -2     
  Lines         448      464    +16     
========================================
+ Hits          347      429    +82     
+ Misses        101       35    -66
Impacted Files Coverage Δ
Shared/Interface/TimeError.swift 100% <100%> (+27.77%) ⬆️
Shared/Network/APIRequest.swift 96.77% <100%> (+10.56%) ⬆️
Shared/Network/API.swift 86.53% <82%> (+24.42%) ⬆️
Shared/Network/API+Routes.swift 94.59% <94.59%> (ø)
Shared/Network/APIQueue.swift 97.97% <97.97%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 161e3d4...9e7b6da. Read the comment docs.

@Tornquist
Copy link
Copy Markdown
Owner Author

👍

@Tornquist Tornquist merged commit 860ac53 into master Feb 20, 2019
@Tornquist Tornquist deleted the generic-api branch February 20, 2019 13:56
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.

1 participant