omgdotlol
Advanced tools
Comparing version 0.1.2 to 0.1.3-rev1
40
index.js
@@ -5,3 +5,3 @@ | ||
class Account { | ||
constructor(email, name, created, settings) { | ||
constructor(email, name, created, settings, addresses, sessions) { | ||
this.email = email; | ||
@@ -11,4 +11,15 @@ this.name = name; | ||
this.settings = settings; | ||
this.addresses = addresses; | ||
this.sessions = sessions; | ||
} | ||
} | ||
class Address { | ||
constructor(address, registration, expiration) { | ||
this.address = address; | ||
this.registration = registration; | ||
this.expiration = expiration; | ||
} | ||
} | ||
class Client { | ||
@@ -32,5 +43,28 @@ constructor(token, email, url="https://api.omg.lol") { | ||
var response = await this.get(`/account/${this.email}/info`); | ||
response = response.response; // the API returns the response under the "response" key for some reason. | ||
return new Account(response.email, response.name, response.created, response.settings); | ||
return response.response; // the API returns the response under the "response" key for some reason. | ||
} | ||
async getAccountName() { | ||
var response = await this.get(`/account/${this.email}/name`); | ||
return response.response; | ||
} | ||
async getAccountSessions() { | ||
var response = await this.get(`/account/${this.email}/sessions`); | ||
return response.response; | ||
} | ||
async getAccountAddreses() { | ||
var response = await this.get(`/account/${this.email}/addresses`); | ||
return response.response; | ||
} | ||
async getAccount() { | ||
var info = await this.getAccountInfo(); | ||
var sessions = await this.getAccountSessions(); | ||
var addresses = await this.getAccountAddreses(); | ||
var account = new Account(info.email, info.name, info.created, info.settings, addresses, sessions); | ||
return account; | ||
} | ||
} | ||
@@ -37,0 +71,0 @@ |
{ | ||
"name": "omgdotlol", | ||
"version": "0.1.2", | ||
"version": "0.1.3-rev1", | ||
"description": "API wrapper for omg.lol", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
2365
59