APIManager

public class APIManager
extension APIManager: RequestInterceptor

Main class of framework, which allow to play with the 4D rest api.

Alias

  • Alias for network completion request callback.

    Declaration

    Swift

    public typealias Completion = (Result<Moya.Response, APIError>) -> Swift.Void
  • Alias for network progression request callback.

    Declaration

    Swift

    public typealias ProgressHandler = Moya.ProgressBlock
  • Alias to customize records request

    Declaration

    Swift

    public typealias ConfigureRecordsRequest = (RecordsRequest) -> Void

Init

  • Create an api manager using server URL

    Declaration

    Swift

    public init(url: URL)

Targets

Authentication

  • Token for authentication

    Declaration

    Swift

    public var authToken: AuthToken? { get set }
  • Return if api shared instance has valid token ie. we are logged

    Declaration

    Swift

    public static var isSignIn: Bool { get }
  • Remove auth token from keychain.

    Declaration

    Swift

    public static func removeAuthToken()

testing

  • Activate stub response for test.

    Declaration

    Swift

    public var stub: Bool
  • A delegate to customize stub feature to test.

    Declaration

    Swift

    public weak var stubDelegate: StubDelegate?

attributes

  • Log level for network. By default .verbose. Pref key: api.network.logLevel

    Declaration

    Swift

    public lazy var networkLogLevel: LogLevel { get set }
  • List of Moya plugins.

    Declaration

    Swift

    public var plugins: [PluginType]
  • Undocumented

    Declaration

    Swift

    public var defaultQueue: DispatchQueue?
  • URL session configuration. Configure timeout, and other properties

    Declaration

    Swift

    public lazy var configuration: URLSessionConfiguration { get set }

configuration functions

Upload

request methods