Skip to content

Commit bea541e

Browse files
authored
Merge pull request #39 from engagepeople/feature/travel
Adding Travel token retrieval
2 parents 9268bc2 + be9da04 commit bea541e

File tree

5 files changed

+35
-6
lines changed

5 files changed

+35
-6
lines changed

dist/index.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Api/Accounts.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import {IAccountTravel, IPodiumPromise} from '../../types'
2+
import {Resource} from '../Podium/Resource'
3+
import {Token} from '../Podium/Token'
4+
import {Settings} from '../Podium/Settings'
5+
6+
export class Accounts extends Resource {
7+
8+
constructor(settings: Settings) {
9+
super(settings)
10+
this.SetResource('member/account')
11+
}
12+
13+
/**
14+
* Based on the user's token, retrieve the JWT token to be used when calling the Travel URL
15+
* @param {number} AccountID
16+
* @returns {IPodiumPromise<IAccountTravel>}
17+
*/
18+
public GetTravelUrl(AccountID: number): IPodiumPromise<IAccountTravel> {
19+
const payload = {
20+
token: Token.getInstance().GetToken(),
21+
}
22+
return this.GetRequest<IAccountTravel>(AccountID, payload, 'jwt')
23+
}
24+
}

src/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// tslint:disable:max-classes-per-file
2+
import {Accounts} from './Api/Accounts'
23
import {Auth} from './Api/Auth'
34
import {Ecards} from './Api/Ecards/Ecards'
45
import {ShopCart} from './Api/Shop/Cart'
@@ -15,7 +16,7 @@ export {Filter as PodiumFilter} from './Podium/Filter'
1516
export {Paginator as PodiumPaginator} from './Podium/Paginator'
1617

1718
export class Podium {
18-
public Account: Resource
19+
public Accounts: Accounts
1920
public Auth: Auth
2021
public Ecards: {
2122
Categories: Resource
@@ -47,7 +48,7 @@ export class Podium {
4748
public Utils: Utils
4849

4950
constructor(settings: Settings) {
50-
this.Account = new Resource(settings).SetResource('member/account')
51+
this.Accounts = new Accounts(settings)
5152
this.Auth = new Auth(settings)
5253
this.Discretionary = {
5354
DirectReports: new Resource(settings).SetResource('user/reports'),

types/index.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,10 @@ export interface ILRGRedirect extends IPodiumModel {
154154
}
155155
}
156156

157+
export interface IAccountTravel extends IPodiumModel {
158+
token: string
159+
}
160+
157161
export interface IImage extends IPodiumModel {
158162
height: number
159163
url: string

0 commit comments

Comments
 (0)