Skip to content

Commit

Permalink
Merge pull request #13 from spring-media/userinfo
Browse files Browse the repository at this point in the history
SPR-4700: add userinfo a new function
  • Loading branch information
fgerardwltn24 authored Oct 23, 2019
2 parents bbf0ce0 + 18a12db commit d30e07f
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 41 deletions.
34 changes: 18 additions & 16 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,20 @@ jobs:
- name: Checkout branch
if: github.event.action == 'opened' || github.event.action == 'edited' || github.event.action == 'synchronize'
uses: actions/checkout@master

- name: Set Node.js 10.x
if: github.event.action == 'opened' || github.event.action == 'edited' || github.event.action == 'synchronize'
uses: actions/setup-node@v1
with:
node-version: '10.x'

- name: Install npm
if: github.event.action == 'opened' || github.event.action == 'edited' || github.event.action == 'synchronize'
uses: actions/npm@master
with:
args: install
run: npm install

- name: Npm check
- name: Npm format-check
if: github.event.action == 'opened' || github.event.action == 'edited' || github.event.action == 'synchronize'
uses: actions/npm@master
with:
args: run check --if-present
run: npm run check

build:
name: Build
Expand All @@ -52,20 +54,20 @@ jobs:
git config --global user.email "[email protected]"
git merge ${{ github.event.pull_request.head.sha }} -m"prchecker" --stat
- name: Install npm
- name: Set Node.js 10.x
if: github.event.action == 'opened' || github.event.action == 'edited' || github.event.action == 'synchronize'
uses: actions/npm@master
uses: actions/setup-node@v1
with:
args: install
node-version: '10.x'

- name: Install npm
if: github.event.action == 'opened' || github.event.action == 'edited' || github.event.action == 'synchronize'
run: npm install

- name: Test npm
if: github.event.action == 'opened' || github.event.action == 'edited' || github.event.action == 'synchronize'
uses: actions/npm@master
with:
args: run test
run: npm run test

- name: Build npm
if: github.event.action == 'opened' || github.event.action == 'edited' || github.event.action == 'synchronize'
uses: actions/npm@master
with:
args: run build
run: npm run build
31 changes: 15 additions & 16 deletions .github/workflows/push_master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,16 @@ jobs:
- name: Checkout branch
uses: actions/checkout@master

- name: Install npm
uses: actions/npm@master
- name: Set Node.js 10.x
uses: actions/setup-node@v1
with:
args: install
node-version: '10.x'

- name: Npm check
uses: actions/npm@master
with:
args: run check --if-present
- name: Install npm
run: npm install

- name: Npm format-check
run: npm run check --if-present

build:
name: Build
Expand All @@ -29,18 +30,16 @@ jobs:
- name: Checkout branch
uses: actions/checkout@master

- name: Set Node.js 10.x
uses: actions/setup-node@v1
with:
node-version: '10.x'

- name: Install npm
uses: actions/npm@master
with:
args: install
run: npm install

- name: Test npm
uses: actions/npm@master
with:
args: run test
run: npm run test

- name: Build npm
uses: actions/npm@master
with:
args: run build
run: npm run build
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ps-web-apis is a client side library to interface with ps services on ps support

# Installation

`npm install --save github:spring-media/ps-web-apis#v1.4.0`
`npm install --save github:spring-media/ps-web-apis#v1.6.0`

# Usage

Expand Down
10 changes: 10 additions & 0 deletions dist/ps-web-apis.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
export interface WhoamiUserInfo {
user_id: string;
first_name?: string;
last_name?: string;
}
export interface WhoamiV1 {
/**
* will assert valid not outdated session before fetch will be done. backend credentials will be added automatically
Expand Down Expand Up @@ -33,5 +38,10 @@ export interface WhoamiV1 {
* will update access token and therefore content entitlements to current state
*/
forceAccessTokenRefresh(): Promise<void>;
/**
* will request userinfo from whoami backend
* @return {WhoamiUserInfo} some relevant userdata
*/
getUserInfo(): Promise<WhoamiUserInfo>;
}
export declare function whoamiV1(): Promise<WhoamiV1>;
8 changes: 1 addition & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ps-web-apis",
"version": "1.0.0",
"version": "1.6.0",
"description": "",
"main": "dist/ps-web-apis.cjs.js",
"module": "dist/ps-web-apis.esm.js",
Expand Down
11 changes: 11 additions & 0 deletions src/ps-web-apis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ function requireApi<T>(name: string): Promise<T> {
});
}

export interface WhoamiUserInfo {
user_id: string;
first_name?: string;
last_name?: string;
}

export interface WhoamiV1 {
/**
* will assert valid not outdated session before fetch will be done. backend credentials will be added automatically
Expand Down Expand Up @@ -72,6 +78,11 @@ export interface WhoamiV1 {
* will update access token and therefore content entitlements to current state
*/
forceAccessTokenRefresh(): Promise<void>;
/**
* will request userinfo from whoami backend
* @return {WhoamiUserInfo} some relevant userdata
*/
getUserInfo(): Promise<WhoamiUserInfo>;
}

export function whoamiV1(): Promise<WhoamiV1> {
Expand Down

0 comments on commit d30e07f

Please sign in to comment.