mironal / TwitterAPIKit

Swift library for the Twitter API v1 and v2 🍷
MIT License
118 stars 23 forks source link

Refresh oauth20 helper #138

Closed mironal closed 1 year ago

mironal commented 1 year ago

134

Example

client.refreshOAuth20Token(type: .publicClient) { result in
    switch result {
        case .succes(let refresh):
            if refresh.refreshed {
                // If necessary, we will handle the saving process, etc.
                // storeToken(oauth20: refresh.token)
            }
    }
}
let refresh = try await client.refreshOAuth20Token(type: .publicClient, forceRefresh: false)
if refresh.refreshed {
    // If necessary, we will handle the saving process, etc.
    // storeToken(oauth20: refresh.token)
}
codecov-commenter commented 1 year ago

Codecov Report

Merging #138 (b2b236e) into main (70a3c7d) will decrease coverage by 0.04%. The diff coverage is 63.09%.

@@            Coverage Diff             @@
##             main     #138      +/-   ##
==========================================
- Coverage   80.29%   80.24%   -0.05%     
==========================================
  Files         256      256              
  Lines        6895     6979      +84     
==========================================
+ Hits         5536     5600      +64     
- Misses       1359     1379      +20     
Impacted Files Coverage Δ
Sources/TwitterAPIKit/TwitterAPIKitError.swift 28.64% <0.00%> (-4.69%) :arrow_down:
Sources/TwitterAPIKit/TwitterAPISession.swift 68.88% <66.66%> (-0.16%) :arrow_down:
Sources/TwitterAPIKit/TwitterAPIClient.swift 83.49% <95.45%> (+14.00%) :arrow_up:
Sources/TwitterAPIKit/Extensions/Concurrency.swift 100.00% <100.00%> (ø)
Sources/TwitterAPIKit/AuthAPI/OAuth20API.swift 25.00% <0.00%> (+18.18%) :arrow_up:

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

mironal commented 1 year ago

135