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.
Responseobjects are decodable from raw data from an HTTP response.Declaration
Swift
associatedtype Response : Decodable -
The
HTTPMethodenumeration member used for the request.Declaration
Swift
var method: HTTPMethod { get } -
baseURLDefault 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 } -
pathQueriesDefault implementationThe query items which should be appended to the path. Only applies to POST requests. For GET request, use
parametersto specify the path queries.Default Implementation
Declaration
Swift
var pathQueries: [URLQueryItem]? { get } -
parametersDefault implementationParameters to be encoded and sent. The default value is
nil.Default Implementation
Declaration
Swift
var parameters: Parameters? { get } -
The
AuthenticateMethodenumeration member used for the request.Declaration
Swift
var authentication: AuthenticateMethod { get } -
contentTypeDefault implementationThe
ContentTypeenumeration member used for the HTTP body data of the request. The default value is.json.Default Implementation
Declaration
Swift
var contentType: ContentType { get } -
adaptersDefault implementationThe request adapters for synthesizing the request. Use the
RequestAdapterprotocol to set up adapters. The items inadapterswill be applied to and modify the underlyingURLRequestobject. 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
adaptersto change the request properties. However, it’s more likely that you want to provide adapters withsuffixAdaptersinstead, 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 } -
suffixAdaptersDefault implementationAdditional adapters to be appended to
adapters. The default value isnil.Default Implementation
Declaration
Swift
var suffixAdapters: [RequestAdapter]? { get } -
pipelinesDefault implementationThe pipelines to intercept or parse the response. Use
ResponsePipelineenumeration members to set up pipelines. The items inpipelineswill be applied to the underlyingURLResponseobject and the receivedDataobject. 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 aResponseobject.You can provide your own
pipelinesto change the response handling process. However, it’s more likely that you want to provide pipelines withprefixPipelinesinstead, 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 } -
prefixPipelinesDefault implementationAdditional pipelines to be added before
pipelines. The default value isnil.Default Implementation
Declaration
Swift
var prefixPipelines: [ResponsePipeline]? { get } -
dataParserDefault implementationThe final data parser that parses the response data into a
Responseobject at the end ofpipelines. By default, aJSONParsePipelineobject with the standardJSONDecoderobject will be used.Default Implementation
Declaration
Swift
var dataParser: ResponsePipelineTerminator { get } -
timeoutDefault 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 } -
cachePolicyDefault implementationThe cache policy of the request. The default value is
.reloadIgnoringLocalCacheDatafor general API requests.Default Implementation
Declaration
Swift
var cachePolicy: NSURLRequest.CachePolicy { get }
View on GitHub
Request Protocol Reference