No Description

ContentResource.swift 889B

    // // ContentResource.swift // PaiaiDataKit // // Created by ffib on 2018/12/29. // Copyright © 2018 yb. All rights reserved. // import Foundation import RxSwift import ObjectMapper struct NonMoreDataError: Error {} struct ContentResource<Content>: Resource { typealias Model = Content var host: String var path: Interfaces var parameter: Parameter var parseJSON: (JSON) -> Content? init(host: String = "https://api.pai.ai", path: Interfaces, parameter: Parameter, parseJSON: @escaping (JSON) -> Content?) { self.host = host self.path = path self.parameter = parameter self.parseJSON = parseJSON } func parse(_ json: JSON) -> Content? { return parseJSON(json) } func loadContent() -> Single<Content> { return NetworkApi.share.post(resource: self) } }