Skip to content

Commit

Permalink
Update Generic constraints.
Browse files Browse the repository at this point in the history
  • Loading branch information
LucianoPAlmeida committed May 1, 2019
1 parent ef3279a commit fc4edf7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
6 changes: 3 additions & 3 deletions Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
github "Alamofire/Alamofire" "4.8.2"
github "AliSoftware/OHHTTPStubs" "7.0.0"
github "Quick/Nimble" "v8.0.1"
github "Quick/Quick" "v2.0.0"
github "ReactiveCocoa/ReactiveSwift" "5.0.0"
github "ReactiveX/RxSwift" "4.4.2"
github "Quick/Quick" "v2.1.0"
github "ReactiveCocoa/ReactiveSwift" "5.0.1"
github "ReactiveX/RxSwift" "5.0.1"
github "antitypical/Result" "4.1.0"
12 changes: 6 additions & 6 deletions Sources/RxMoya/Observable+Response.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,25 @@ import RxSwift
#endif

/// Extension for processing raw NSData generated by network access.
extension ObservableType where E == Response {
extension ObservableType where Element == Response {

/// Filters out responses that don't fall within the given range, generating errors when others are encountered.
public func filter<R: RangeExpression>(statusCodes: R) -> Observable<E> where R.Bound == Int {
public func filter<R: RangeExpression>(statusCodes: R) -> Observable<Element> where R.Bound == Int {
return flatMap { Observable.just(try $0.filter(statusCodes: statusCodes)) }
}

/// Filters out responses that has the specified `statusCode`.
public func filter(statusCode: Int) -> Observable<E> {
public func filter(statusCode: Int) -> Observable<Element> {
return flatMap { Observable.just(try $0.filter(statusCode: statusCode)) }
}

/// Filters out responses where `statusCode` falls within the range 200 - 299.
public func filterSuccessfulStatusCodes() -> Observable<E> {
public func filterSuccessfulStatusCodes() -> Observable<Element> {
return flatMap { Observable.just(try $0.filterSuccessfulStatusCodes()) }
}

/// Filters out responses where `statusCode` falls within the range 200 - 399
public func filterSuccessfulStatusAndRedirectCodes() -> Observable<E> {
public func filterSuccessfulStatusAndRedirectCodes() -> Observable<Element> {
return flatMap { Observable.just(try $0.filterSuccessfulStatusAndRedirectCodes()) }
}

Expand All @@ -54,7 +54,7 @@ extension ObservableType where E == Response {
}
}

extension ObservableType where E == ProgressResponse {
extension ObservableType where Element == ProgressResponse {

/**
Filter completed progress response and maps to actual response
Expand Down
10 changes: 5 additions & 5 deletions Sources/RxMoya/Single+Response.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,25 @@ import RxSwift
#endif

/// Extension for processing raw NSData generated by network access.
extension PrimitiveSequence where TraitType == SingleTrait, ElementType == Response {
extension PrimitiveSequence where Trait == SingleTrait, Element == Response {

/// Filters out responses that don't fall within the given closed range, generating errors when others are encountered.
public func filter<R: RangeExpression>(statusCodes: R) -> Single<ElementType> where R.Bound == Int {
public func filter<R: RangeExpression>(statusCodes: R) -> Single<Element> where R.Bound == Int {
return flatMap { .just(try $0.filter(statusCodes: statusCodes)) }
}

/// Filters out responses that have the specified `statusCode`.
public func filter(statusCode: Int) -> Single<ElementType> {
public func filter(statusCode: Int) -> Single<Element> {
return flatMap { .just(try $0.filter(statusCode: statusCode)) }
}

/// Filters out responses where `statusCode` falls within the range 200 - 299.
public func filterSuccessfulStatusCodes() -> Single<ElementType> {
public func filterSuccessfulStatusCodes() -> Single<Element> {
return flatMap { .just(try $0.filterSuccessfulStatusCodes()) }
}

/// Filters out responses where `statusCode` falls within the range 200 - 399
public func filterSuccessfulStatusAndRedirectCodes() -> Single<ElementType> {
public func filterSuccessfulStatusAndRedirectCodes() -> Single<Element> {
return flatMap { .just(try $0.filterSuccessfulStatusAndRedirectCodes()) }
}

Expand Down

0 comments on commit fc4edf7

Please sign in to comment.