Giter Site home page Giter Site logo

apiclient's People

Contributors

aeugene avatar darthrumata avatar rnkyr avatar serejahh avatar sergey-prikhodko avatar tykhonkov avatar vodolazkyi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

apiclient's Issues

Authorization plugin

Simple auth plugin is required. In case client won't use exchange tokens flow, the implementation of RestorationTokenPlugin is required only to provide auth token and looks like the following:

extension UserSessionController: AccessCredentialsProvider {
    
    public var accessToken: String? {
        get { return userSession.userMetadata.accessToken }
        set { /* no-op; we're not using session restoration flow */ }
    }
    
    public var exchangeToken: String? {
        get { return nil }
        set { }
    }
    
    public func commitCredentialsUpdate(_ update: (AccessCredentialsProvider) -> Void) {
        // no-op; we're not using session restoration flow
    }
    
    public func invalidate() {
        // no-op; we're not using session restoration flow
    }
}

empty response parsing

in case there's an empty response APIClient couldn't parse it and sends errors:
Error Domain=NSCocoaErrorDomain Code=3840 "No value." UserInfo={NSDebugDescription=No value.}

need to handle the case in JSONDeserializer:

func deserialize(_ response: HTTPURLResponse, data: Data) throws -> AnyObject {
        do {
           ...
        } catch {
            if (error as NSError).code == 3840 { // empty response
                return .success(NSArray())
            }
               ...
        }
    }

error parsing

currently, NetworkError being parsed only in case there's no body in response:

request.responseJSON(completionHandler: { response in
	guard let httpResponse = response.response, let data = response.data else {
	    AlamofireRequestExecutor.defineError(response.error, completion: completion)
	    return
	}

	completion(.success((httpResponse, data)))
})

in that case flow goes to APIClient and it invalidates response due to header (validateResult method)

dependency "APIClient" has no shared framework schemes for any of the platforms: iOS

It was working fine till Xcode 10.1 and Swift 4.2. Once I updated Xcode to 10.2.1 which support Swift 5.0, I started getting this error. I using Carthage manage dependencies.

Your Environment

  • Version of the component: 2.8
  • Swift version: 5.0
  • iOS version: 12.2.0
  • Device: n/a
  • Xcode version: 10.2.1
  • If you use Cocoapods: n/a
  • If you use Carthage: 0.33.0

Project that demonstrates the bug

Please add a link to a project we can download that reproduces the bug.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.