Skip to content

Commit

Permalink
[324] [Chore] Remove REquestConfigurationand use Maya MultiTarget
Browse files Browse the repository at this point in the history
  • Loading branch information
Shayokh144 committed Dec 1, 2022
1 parent 7cfad00 commit 4fc943c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ import RxSwift

protocol NetworkAPIProtocol {

func performRequest<T: Decodable>(_ configuration: RequestConfiguration, for type: T.Type) -> Single<T>
func performRequest<T: Decodable>(_ configuration: TargetType, for type: T.Type) -> Single<T>
}

extension NetworkAPIProtocol {
func request<T: Decodable>(
provider: MoyaProvider<RequestConfiguration>,
configuration: RequestConfiguration
provider: MoyaProvider<MultiTarget>,
configuration: TargetType
) -> Single<T> {
provider.rx.request(configuration)
provider.rx.request(MultiTarget(configuration))
.map(T.self)
}
}

This file was deleted.

6 changes: 3 additions & 3 deletions {PROJECT_NAME}/Sources/Data/NetworkAPI/NetworkAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ import RxSwift

final class NetworkAPI: NetworkAPIProtocol {

private let provider: MoyaProvider<RequestConfiguration>
private let provider: MoyaProvider<MultiTarget>

init(provider: MoyaProvider<RequestConfiguration> = MoyaProvider<RequestConfiguration>()) {
init(provider: MoyaProvider<MultiTarget> = MoyaProvider<MultiTarget>()) {
self.provider = provider
}

func performRequest<T: Decodable>(_ configuration: RequestConfiguration, for type: T.Type) -> Single<T> {
func performRequest<T: Decodable>(_ configuration: TargetType, for type: T.Type) -> Single<T> {
request(provider: provider, configuration: configuration)
}
}

0 comments on commit 4fc943c

Please sign in to comment.