Skip to content

Commit

Permalink
feat: typings for Token resource and Account#me()
Browse files Browse the repository at this point in the history
  • Loading branch information
simon-scherzinger committed Feb 13, 2017
1 parent a294cf3 commit de5b937
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Accounts.js
Expand Up @@ -102,6 +102,11 @@ export default class Accounts extends Core {
.then(([res, traversal]) => new AccountResource(res, this.environment, traversal));
}

/**
* Get the {@link AccountResource} which is currently logged in.
*
* @returns {Promise<AccountResource>} resolves to the Account which is logged in.
*/
me() {
return Promise.resolve()
.then(() => {
Expand Down
2 changes: 2 additions & 0 deletions typings/Accounts.d.ts
Expand Up @@ -13,6 +13,8 @@ export declare class Accounts extends Core {

get(accountID: string): Promise<AccountResource>;

me(): Promise<AccountResource>;

createApiToken(): tokenResponse;

login(email: string, password: string): Promise<string>;
Expand Down
3 changes: 3 additions & 0 deletions typings/resources/AccountResource.d.ts
@@ -1,4 +1,5 @@
import { Resource } from './Resource';
import { TokenList } from './TokenList';

export declare class AccountResource extends Resource {
constructor(resource: any, environment: string, traversal?: any);
Expand Down Expand Up @@ -34,4 +35,6 @@ export declare class AccountResource extends Resource {
hasPassword(): boolean;

hasPendingEmail(): boolean

tokenList(): Promise<TokenList>;
}
5 changes: 5 additions & 0 deletions typings/resources/TokenList.d.ts
@@ -0,0 +1,5 @@
import { ListResource } from './ListResource';

export declare class TokenList extends ListResource {
constructor(resource: any, environment: string, traversal?: any);
}
19 changes: 19 additions & 0 deletions typings/resources/TokenResource.d.ts
@@ -0,0 +1,19 @@
import { Resource } from './Resource';

export declare class TokenResource extends Resource {
constructor(resource: any, environment: string, traversal?: any);

isCurrent(): boolean;

issued(): Date;

validUntil(): Date;

getIpAddress(): string;

getIpAddressLocation(): string;

getAccessTokenID(): string;

getDevce(): any;
}

0 comments on commit de5b937

Please sign in to comment.