Session
final public class Session : Sendable
Represents a session for sending a Request object through a URLSession object for the LINE Platform. This
class respects the adapters and pipelines properties of the Request protocol, to create proper requests
and handle the response in the designed way.
-
The shared instance of
Session. Access this value after you setup the LINE SDK. Otherwise, your app will be trapped.Declaration
Swift
public static var shared: Session { get } -
Sends a
Requestobject with the underlying session.Declaration
Swift
@discardableResult public func send<T: Request>( _ request: T, callbackQueue: CallbackQueue = .currentMainOrAsync, completionHandler completion: (@Sendable (Result<T.Response, LineSDKError>) -> Void)? = nil) -> SessionTask?Parameters
requestA
Requestobject which defines necessary information for the request.callbackQueueA queue option to be used when
completionis invoked. The default value is.currentMainOrAsync.completionThe completion closure to be invoked when the request has been sent.
Return Value
The
SessionTaskobject that represents the task. -
Sends a
Requestobject with the underlying session.Declaration
Swift
public func send<T>(_ request: T) async throws -> T.Response where T : RequestParameters
requestA
Requestobject which defines necessary information for the request.Return Value
The parsed
Responseobject which is received from remote.
View on GitHub
Session Class Reference