|
//
// UploadResource.swift
// PaiaiDataKit
//
// Created by ffib on 2019/1/2.
// Copyright © 2019 yb. All rights reserved.
//
import Foundation
import RxSwift
struct UploadResource<Content>: Resource {
typealias Model = Content
var path: Interfaces
var parameter: Parameter
var parseJSON: (JSON) -> Content?
init(path: Interfaces, parameter: Parameter, parseJSON: @escaping (JSON) -> Content?) {
self.path = path
self.parameter = parameter
self.parseJSON = parseJSON
}
func parse(_ json: JSON) -> Content? {
return parseJSON(json)
}
func upload() -> Single<Content> {
return NetworkApi.share.upload(resource: self)
}
}
|