@cutls/megalodon
Version:
Mastodon, Pleroma, Misskey API client for node.js and browser
76 lines (75 loc) • 2.23 kB
JavaScript
var MisskeyOAuth;
(function (MisskeyOAuth) {
class AppData {
id;
name;
website;
redirect_uri;
client_id;
client_secret;
url;
session_token;
constructor(id, name, website, redirect_uri, client_id, client_secret) {
this.id = id;
this.name = name;
this.website = website;
this.redirect_uri = redirect_uri;
this.client_id = client_id;
this.client_secret = client_secret;
this.url = null;
this.session_token = null;
}
static from(raw) {
return new this(raw.id, raw.name, raw.website, raw.redirect_uri, raw.client_id, raw.client_secret);
}
get redirectUri() {
return this.redirect_uri;
}
get clientId() {
return this.client_id;
}
get clientSecret() {
return this.client_secret;
}
}
MisskeyOAuth.AppData = AppData;
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;
}
static from(raw) {
return new this(raw.access_token, raw.token_type, raw.scope, raw.created_at, raw.expires_in, raw.refresh_token);
}
get accessToken() {
return this.access_token;
}
get tokenType() {
return this.token_type;
}
get scope() {
return this._scope;
}
get createdAt() {
return this.created_at;
}
get expiresIn() {
return this.expires_in;
}
get refreshToken() {
return this.refresh_token;
}
}
MisskeyOAuth.TokenData = TokenData;
})(MisskeyOAuth || (MisskeyOAuth = {}));
export default MisskeyOAuth;