Initial Commit
This commit is contained in:
commit
d190beb7bf
13 changed files with 382 additions and 0 deletions
25
src/main/scala/twitch/api/UserAuthenticationCredential.scala
Normal file
25
src/main/scala/twitch/api/UserAuthenticationCredential.scala
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
package unit_ca5.twitch
|
||||
|
||||
import java.time.Instant
|
||||
|
||||
import unit_ca5.twitch.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 =
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue