Skip to content
This repository has been archived by the owner on Oct 17, 2021. It is now read-only.

Interceptor

mattt edited this page Sep 18, 2020 · 2 revisions

Interceptor

RequestInterceptor which can use multiple RequestAdapter and RequestRetrier values.

open class Interceptor:​ RequestInterceptor

Inheritance

RequestInterceptor

Initializers

init(adaptHandler:​retryHandler:​)

Creates an instance from AdaptHandler and RetryHandler closures.

public init(adaptHandler:@escaping AdaptHandler, retryHandler:@escaping RetryHandler)

Parameters

  • adaptHandler:​ AdaptHandler closure to be used.
  • retryHandler:​ RetryHandler closure to be used.

init(adapter:​retrier:​)

Creates an instance from RequestAdapter and RequestRetrier values.

public init(adapter:​ RequestAdapter, retrier:​ RequestRetrier)

Parameters

  • adapter:​ RequestAdapter value to be used.
  • retrier:​ RequestRetrier value to be used.

init(adapters:​retriers:​)

Creates an instance from the arrays of RequestAdapter and RequestRetrier values.

public init(adapters:[RequestAdapter] = [], retriers:[RequestRetrier] = [])

Parameters

  • adapters:​ RequestAdapter values to be used.
  • retriers:​ RequestRetrier values to be used.

Properties

adapters

All RequestAdapters associated with the instance. These adapters will be run until one fails.

let adapters:[RequestAdapter]

retriers

All RequestRetriers associated with the instance. These retriers will be run one at a time until one triggers retry.

let retriers:[RequestRetrier]

Methods

adapt(_:​for:​completion:​)

open func adapt(_ urlRequest:​ URLRequest, for session:​ Session, completion:@escaping (Result<URLRequest, Error>) -> Void)

retry(_:​for:​dueTo:​completion:​)

open func retry(_ request:​ Request, for session:​ Session, dueTo error:​ Error, completion:@escaping (RetryResult) -> Void)
Types
Protocols
Global Typealiases
Clone this wiki locally