Fixed 267U.pre2
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
/**
|
||||
* OAuth
|
||||
* Response data when oauth request.
|
||||
**/ var OAuth;
|
||||
(function(OAuth) {
|
||||
class TokenData {
|
||||
access_token;
|
||||
token_type;
|
||||
created_at;
|
||||
expires_in;
|
||||
refresh_token;
|
||||
_scope;
|
||||
constructor(access_token, token_type, scope, created_at, expires_in = null, refresh_token = null){
|
||||
this.access_token = access_token;
|
||||
this.token_type = token_type;
|
||||
this.created_at = created_at;
|
||||
this.expires_in = expires_in;
|
||||
this.refresh_token = refresh_token;
|
||||
this._scope = scope;
|
||||
}
|
||||
/**
|
||||
* Serialize raw token data from server
|
||||
* @param raw from server
|
||||
*/ static from(raw) {
|
||||
return new this(raw.access_token, raw.token_type, raw.scope, raw.created_at, raw.expires_in, raw.refresh_token);
|
||||
}
|
||||
/**
|
||||
* OAuth Aceess Token
|
||||
*/ get accessToken() {
|
||||
return this.access_token;
|
||||
}
|
||||
get tokenType() {
|
||||
return this.token_type;
|
||||
}
|
||||
get scope() {
|
||||
return this._scope;
|
||||
}
|
||||
/**
|
||||
* Application ID
|
||||
*/ get createdAt() {
|
||||
return this.created_at;
|
||||
}
|
||||
get expiresIn() {
|
||||
return this.expires_in;
|
||||
}
|
||||
/**
|
||||
* OAuth Refresh Token
|
||||
*/ get refreshToken() {
|
||||
return this.refresh_token;
|
||||
}
|
||||
}
|
||||
OAuth.TokenData = TokenData;
|
||||
})(OAuth || (OAuth = {}));
|
||||
export default OAuth;
|
||||
Reference in New Issue
Block a user