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 implementationThe 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 implementationThe 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 implementationParameters 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 implementationThe
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 implementationThe request adapters for synthesizing the request. Use the
RequestAdapter
protocol to set up adapters. The items inadapters
will be applied to and modify the underlyingURLRequest
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 withsuffixAdapters
instead, to modify the request according to the default result provided by the LINE SDK. The resulting adapters would beadapters + (suffixAdapters ?? [])
.Default Implementation
Declaration
Swift
var adapters: [RequestAdapter] { get }
-
suffixAdapters
Default implementationAdditional adapters to be appended to
adapters
. The default value isnil
.Default Implementation
Declaration
Swift
var suffixAdapters: [RequestAdapter]? { get }
-
pipelines
Default implementationThe pipelines to intercept or parse the response. Use
ResponsePipeline
enumeration members to set up pipelines. The items inpipelines
will be applied to the underlyingURLResponse
object and the receivedData
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 aResponse
object.You can provide your own
pipelines
to change the response handling process. However, it’s more likely that you want to provide pipelines withprefixPipelines
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 implementationAdditional pipelines to be added before
pipelines
. The default value isnil
.Default Implementation
Declaration
Swift
var prefixPipelines: [ResponsePipeline]? { get }
-
dataParser
Default implementationThe final data parser that parses the response data into a
Response
object at the end ofpipelines
. By default, aJSONParsePipeline
object with the standardJSONDecoder
object will be used.Default Implementation
Declaration
Swift
var dataParser: ResponsePipelineTerminator { get }
-
timeout
Default implementationThe 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 implementationThe cache policy of the request. The default value is
.reloadIgnoringLocalCacheData
for general API requests.Default Implementation
Declaration
Swift
var cachePolicy: NSURLRequest.CachePolicy { get }