Request

public protocol Request

Represents a request to the LINE Platform. A request is composed of various components such as method, path, parameters and so on. By conforming to the Request protocol, you can implement your own request type for any API requests for the LINE Platform. To get a response, build a Request object and then send it with a Session object.

  • Represents a response type of the request. Response objects are decodable from raw data from an HTTP response.

    Declaration

    Swift

    associatedtype Response : Decodable
  • The HTTPMethod enumeration member used for the request.

    Declaration

    Swift

    var method: HTTPMethod { get }
  • baseURL Default implementation

    The base URL of the current request.

    Default Implementation

    Declaration

    Swift

    var baseURL: URL { get }
  • The API entry path for the request.

    Declaration

    Swift

    var path: String { get }
  • pathQueries Default implementation

    The query items which should be appended to the path. Only applies to POST requests. For GET request, use parameters to specify the path queries.

    Default Implementation

    Declaration

    Swift

    var pathQueries: [URLQueryItem]? { get }
  • parameters Default implementation

    Parameters to be encoded and sent. The default value is nil.

    Default Implementation

    Declaration

    Swift

    var parameters: Parameters? { get }
  • The AuthenticateMethod enumeration member used for the request.

    Declaration

    Swift

    var authentication: AuthenticateMethod { get }
  • contentType Default implementation

    The ContentType enumeration member used for the HTTP body data of the request. The default value is .json.

    Default Implementation

    Declaration

    Swift

    var contentType: ContentType { get }
  • adapters Default implementation

    The request adapters for synthesizing the request. Use the RequestAdapter protocol to set up adapters. The items in adapters will be applied to and modify the underlying URLRequest object. By default, the LINE SDK will adapt the request by setting its header and body according to the properties of the request.

    You can provide your own adapters to change the request properties. However, it’s more likely that you want to provide adapters with suffixAdapters instead, to modify the request according to the default result provided by the LINE SDK. The resulting adapters would be adapters + (suffixAdapters ?? []).

    Default Implementation

    Declaration

    Swift

    var adapters: [RequestAdapter] { get }
  • suffixAdapters Default implementation

    Additional adapters to be appended to adapters. The default value is nil.

    Default Implementation

    Declaration

    Swift

    var suffixAdapters: [RequestAdapter]? { get }
  • pipelines Default implementation

    The pipelines to intercept or parse the response. Use ResponsePipeline enumeration members to set up pipelines. The items in pipelines will be applied to the underlying URLResponse object and the received Data object. By default, the LINE SDK provides pipelines for handling token refreshes and bad HTTP status codes. The last pipeline will attempt to decode the data to a Response object.

    You can provide your own pipelines to change the response handling process. However, it’s more likely that you want to provide pipelines with prefixPipelines instead, to handle a response before the LINE SDK applies the default behavior. The resulting pipelines would be (prefixPipelines ?? []) + pipelines.

    Default Implementation

    Declaration

    Swift

    var pipelines: [ResponsePipeline] { get }
  • prefixPipelines Default implementation

    Additional pipelines to be added before pipelines. The default value is nil.

    Default Implementation

    Declaration

    Swift

    var prefixPipelines: [ResponsePipeline]? { get }
  • dataParser Default implementation

    The final data parser that parses the response data into a Response object at the end of pipelines. By default, a JSONParsePipeline object with the standard JSONDecoder object will be used.

    Default Implementation

    Declaration

    Swift

    var dataParser: ResponsePipelineTerminator { get }
  • timeout Default implementation

    The timeout in seconds for the current request before receiving a response. The default value is 30 seconds.

    Default Implementation

    Declaration

    Swift

    var timeout: TimeInterval { get }
  • cachePolicy Default implementation

    The cache policy of the request. The default value is .reloadIgnoringLocalCacheData for general API requests.

    Default Implementation

    Declaration

    Swift

    var cachePolicy: NSURLRequest.CachePolicy { get }