Session

public class Session

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 Request object with the underlying session.

    Declaration

    Swift

    @discardableResult
    public func send<T: Request>(
        _ request: T,
        callbackQueue: CallbackQueue = .currentMainOrAsync,
        completionHandler completion: ((Result<T.Response, LineSDKError>) -> Void)? = nil) -> SessionTask?

    Parameters

    request

    A Request object which defines necessary information for the request.

    callbackQueue

    A queue option to be used when completion is invoked. The default value is .currentMainOrAsync.

    completion

    The completion closure to be invoked when the request has been sent.

    Return Value

    The SessionTask object that represents the task.