Session

open class Session : TokenRefresherDelegate

intdashとの間に張られたセッションの情報を保存するクラス。

  • OAuth2.0のアクセストークンがリフレッシュされたときの通知。

    Declaration

    Swift

    public static let didRefreshToken: NSNotification.Name
  • REST APIが配置されているURLを表す文字列( 例: https://example.com:443 )。

    Declaration

    Swift

    public var serverURL: String { get set }
  • リアルタイムAPIが配置されているURLを表す文字列( 例: wss://example.com:443 )。

    Declaration

    Swift

    public var webSocketURL: String { get }
  • REST API用エンドポイントを表す文字列( 例: https://example.com:443/api/v1 )。

    Declaration

    Swift

    public var baseEndpoint: String { get }
  • リアルタイムAPI用エンドポイントを表す文字列( 例: wss://example.com:443/api/v1/ws/measurements )。

    Declaration

    Swift

    public var webSocketEndpoint: String { get }
  • OAuth2.0のクライアントID。

    Declaration

    Swift

    public var clientId: String { get set }
  • リクエストがタイムアウトするまでの待ち時間。

    Declaration

    Swift

    public var timeoutInterval: TimeInterval? { get set }
  • OAuth2.0のアクセストークン。

    Declaration

    Swift

    public var accessToken: String?
  • OAuth2.0のリフレッシュトークン。

    Declaration

    Swift

    public var refreshToken: String?
  • OAuth2.0のアクセストークンの有効期限までの残り時間。

    Declaration

    Swift

    public var expiresIn: TimeInterval?
  • OAuth2.0のリフレッシュトークンの有効期限までの残り時間。

    Declaration

    Swift

    public var refreshTokenExpiresIn: TimeInterval?
  • OAuth2.0のアクセストークンの取得日時。

    Declaration

    Swift

    public var acquiredTime: Date?
  • OAuth2.0認証かどうか。

    Declaration

    Swift

    public var isOAuth2: Bool
  • OAuth2.0のアクセストークンをリフレッシュ可能かどうか。

    Declaration

    Swift

    public var isRefreshable: Bool { get }
  • 空のSessionを生成します。

    Declaration

    Swift

    public convenience init()
  • Sessionを生成します。

    Declaration

    Swift

    public init(serverURL: String, clientId: String, timeoutInterval: TimeInterval? = nil)

    Parameters

    serverURL

    intdashのサーバーが配置されているURLを表す文字列
    ( 例: https://example.com:443

    cliendId

    OAuth2.0のクライアントID

    timeoutInterval

    リクエストがタイムアウトするまでの待ち時間
    nilが設定された場合は、デフォルト値の60秒が使用されます。

  • セッション情報を初期化します。

    Declaration

    Swift

    public func clearSession()
  • セッション情報を更新します。

    Declaration

    Swift

    public func update(withResponse response: OAuth2AuthenticateResponse)
  • 公開用ライブラリでは本メソッドの使用は許可されていません。