/* UNIT_CA5 - Stream management bot Copyright (C) 2024 digimint This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see . */ package twitch.api import java.time.Instant import twitch.api.TokenScope type TwitchUID = String type AccessToken = String type RefreshToken = String case class UserAuthenticationCredential( userId : TwitchUID, accessToken : AccessToken, refreshToken : RefreshToken, expires : Instant, scopes : List[TokenScope] ): def is_expired(now: Instant): Boolean = now.isAfter(expires) def supports(scope: TokenScope): Boolean = scopes.contains(scope) def supportsAll(scopeList: List[TokenScope]): Boolean = scopeList.forall( scopes.contains )