Plugin

public protocol Plugin

Protocol that serves to provide plugin functionality to TRON.

  • willSendRequest(_:) Default implementation

    Notifies that request is about to be converted to Alamofire.Request

    Default Implementation

    Declaration

    Swift

    func willSendRequest<Model, ErrorModel>(_ request: BaseRequest<Model, ErrorModel>)

    Parameters

    request

    TRON BaseRequest

  • Notifies that request formed from tronRequest, is about to be sent.

    Default Implementation

    Declaration

    Swift

    func willSendAlamofireRequest<Model, ErrorModel>(_ request: Request, formedFrom tronRequest: BaseRequest<Model, ErrorModel>)

    Parameters

    request

    Alamofire.Request instance

    formedFrom

    TRON.BaseRequest instance or one of the subclasses

  • Notifies that request, formed from tronRequest, was sent.

    Default Implementation

    Declaration

    Swift

    func didSendAlamofireRequest<Model, ErrorModel>(_ request: Request, formedFrom tronRequest: BaseRequest<Model, ErrorModel>)

    Parameters

    request

    Alamofire.Request instance

    tronRequest

    TRON.BaseRequest or one of the subclasses

  • Notifies that response was received for request, formed from tronRequest.

    Default Implementation

    Declaration

    Swift

    func willProcessResponse<Model, ErrorModel>(response: (URLRequest?, HTTPURLResponse?, Data?, Error?),
                                                forRequest request: Request,
                                                formedFrom tronRequest: BaseRequest<Model, ErrorModel>)

    Parameters

    response

    Tuple with (URLRequest?, HTTPURLResponse?, Data?, Error?)

    request

    Alamofire.Request instance

    tronRequest

    TRON.BaseRequest or one of the subclasses

  • Notifies that response for request, formed from tronRequest, was successfully parsed into result.

    Default Implementation

    Declaration

    Swift

    func didSuccessfullyParseResponse<Model, ErrorModel>(_ response: (URLRequest?, HTTPURLResponse?, Data?, Error?),
                                                         creating result: Model,
                                                         forRequest request: Request,
                                                         formedFrom tronRequest: BaseRequest<Model, ErrorModel>)

    Parameters

    response

    Tuple with (URLRequest?, HTTPURLResponse?, Data?, Error?)

    result

    parsed Model

    request

    Alamofire.Request instance

    tronRequest

    TRON.BaseRequest or one of the subclasses

  • Notifies that request processed response and created APIError<ErrorModel> instance.

    Default Implementation

    Declaration

    Swift

    func didReceiveError<Model, ErrorModel: ErrorSerializable>(_ error: ErrorModel,
                                                               forResponse response: (URLRequest?, HTTPURLResponse?, Data?, Error?),
                                                               request: Alamofire.Request,
                                                               formedFrom tronRequest: BaseRequest<Model, ErrorModel>)

    Parameters

    error

    parsed APIError instance

    response

    Tuple with (URLRequest?, HTTPURLResponse?, Data?, Error?)

    request

    Alamofire.Request instance

    tronRequest

    TRON.BaseRequest or one of the subclasses

  • Notifies that request processed response and created APIError<ErrorModel> instance.

    Default Implementation

    Declaration

    Swift

    func didReceiveDownloadError<Model, ErrorModel: DownloadErrorSerializable>(_ error: ErrorModel,
                                                                               forResponse response: (URLRequest?, HTTPURLResponse?, URL?, Error?),
                                                                               request: Alamofire.Request,
                                                                               formedFrom tronRequest: BaseRequest<Model, ErrorModel>)

    Parameters

    error

    parsed APIError instance

    response

    Tuple with (URLRequest?, HTTPURLResponse?, URL?, Error?)

    request

    Alamofire.Request instance

    tronRequest

    TRON.BaseRequest or one of the subclasses

  • Notifies about data response that was received for request, formed from tronRequest. This method is called after parsing has completed.

    Default Implementation

    Declaration

    Swift

    func didReceiveDataResponse<Model, ErrorModel>(_ response: DataResponse<Model, AFError>, forRequest request: Alamofire.Request, formedFrom tronRequest: BaseRequest<Model, ErrorModel>)

    Parameters

    response

    DataResponse instance

    request

    Alamofire.Request instance

    tronRequest

    TRON.BaseRequest or one of the subclasses

  • Notifies about download response that was received for request, formed from tronRequest. This method is called after parsing has completed.

    Default Implementation

    Declaration

    Swift

    func didReceiveDownloadResponse<Model, ErrorModel: DownloadErrorSerializable>(_ response: DownloadResponse<Model, AFError>,
                                                                                  forRequest request: Alamofire.DownloadRequest,
                                                                                  formedFrom tronRequest: BaseRequest<Model, ErrorModel>)

    Parameters

    _response

    DownloadResponse instance

    request

    Alamofire.Request instance

    tronRequest

    TRON.BaseRequest or one of the subclasses.

  • Notifies that response for request, formed from tronRequest, was successfully parsed into result.

    Default Implementation

    Declaration

    Swift

    func didSuccessfullyParseDownloadResponse<Model, ErrorModel: DownloadErrorSerializable>(_ response: (URLRequest?, HTTPURLResponse?, URL?, Error?),
                                                                                            creating result: Model,
                                                                                            forRequest request: Request,
                                                                                            formedFrom tronRequest: BaseRequest<Model, ErrorModel>)

    Parameters

    response

    Tuple with (URLRequest?, HTTPURLResponse?, URL?, Error?)

    result

    parsed Model

    request

    Alamofire.Request instance

    tronRequest

    TRON.BaseRequest or one of the subclasses