Skip to content

API_Documentation

cksriprajittichai edited this page May 27, 2020 · 20 revisions

API Reference

Members

API_TOKEN : string

Signed-in member's API key

WORKSPACE : string

Name of the workspace (workspace URL slug, actually) that the signed-in member is a part of

MEMBER_ID : string

Signed-in member's member ID

MEMBER_MAP : Object.<string, Member>

Object mapping member ID -> member object. Contains all members

STORIES : Array.<Story>

All stories in the workspace

SETUP : Promise.<void>

A promise to all global variables being initialized; promise that fulfills when all global vars are initialized. Once all global vars are initialized (without errors), all methods can execute correctly.

Functions

fetchProjectsAsync()Promise.<Array.<Project>>

Fetch all projects

fetchProjectStoriesAsync(projectId)Promise.<Array.<Story>>

Fetch all stories in a project

fetchStoriesAsync()Promise.<Array.<Story>>

Fetch all stories in all projects

fetchMemberInfoAsync(apiToken)Promise.<MemberInfo>

Fetch info about a member

fetchMembersAsync()Promise.<Array.<BasicMember>>

Fetch all members in the workspace

isComplete(story)boolean

Check if a story is complete

getStories([params])Array.<Story>

Get stories - using optional filters - from the set of all stories in the workspace (STORIES).

getMyIncompleteStories()Array.<Story>

Get incomplete stories that are assigned to the signed-in member

getAllIncompleteStories()Array.<Story>

Get all incomplete stories in the workspace

getTopWarriors()Array.<TopContributor>

Get up to top 3 point contributors. If less than 3 members have completed any stories (and have more than 0 points), only return those that do.

getBattleLog()Array.<Story>

Returns stories in sorted by most recently completed Get stories to show in the battle log - all completed stories sorted by most recently completed.

getMemberName(memberId)string

Get the name of a member

getMemberProfile()MemberDisplay

Get the display info - workspace, name, and display icon - of the signed-in member.

removeApiToken()

Set the value of API_TOKEN to undefined

getProgress()Progress

Get the overall progress of stories, in terms of points completed

onLogin(apiToken, memberId, workspace)

Method to be called during the sign-in process once the member's API token, ID, and workspace are known. Initializes global variables that are known, and triggers the initialization of all other global variables (by calling setup).

setup()Promise.<void>

Get the SETUP promise. If SETUP hasn't been initialized yet, create it. Otherwise, return the existing promise - do not recreate/restart it.

setupTest(apiToken, memberID)

Used for testing only. Does the same thing as setup, but does not use chrome storage

signout()

Signout by removing all items from StorageArea storage.sync

toggleMemberMenu()

Show member profile menu

selectTab(tabIndex)

Apply appropriate styles to selected tab and panel item

completeStory(story)

TODO: Complete story

API_TOKEN : string

Signed-in member's API key

Kind: global variable

WORKSPACE : string

Name of the workspace (workspace URL slug, actually) that the signed-in member is a part of

Kind: global variable

MEMBER_ID : string

Signed-in member's member ID

Kind: global variable

MEMBER_MAP : Object.<string, Member>

Object mapping member ID -> member object. Contains all members

Kind: global variable

STORIES : Array.<Story>

All stories in the workspace

Kind: global variable

SETUP : Promise.<void>

A promise to all global variables being initialized; promise that fulfills when all global vars are initialized. Once all global vars are initialized (without errors), all methods can execute correctly.

Kind: global variable
See: setup

fetchProjectsAsync() ⇒ Promise.<Array.<Project>>

Fetch all projects

Kind: global function
Returns: Promise.<Array.<Project>> - A promise to all projects in the workspace

fetchProjectStoriesAsync(projectId) ⇒ Promise.<Array.<Story>>

Fetch all stories in a project

Kind: global function
Returns: Promise.<Array.<Story>> - A promise to all stories in the project

Param Type Description
projectId string ID of the project

fetchStoriesAsync() ⇒ Promise.<Array.<Story>>

Fetch all stories in all projects

Kind: global function
Returns: Promise.<Array.<Story>> - A promise to all stories in the workspace

fetchMemberInfoAsync(apiToken) ⇒ Promise.<MemberInfo>

Fetch info about a member

Kind: global function
Returns: Promise.<MemberInfo> - A promise to the member info object

Param Type Description
apiToken string Member's API token

fetchMembersAsync() ⇒ Promise.<Array.<BasicMember>>

Fetch all members in the workspace

Kind: global function
Returns: Promise.<Array.<BasicMember>> - A promise to the array of member objects

isComplete(story) ⇒ boolean

Check if a story is complete

Kind: global function
Returns: boolean - True if the story is complete, false otherwise

Param Type Description
story Story Story to check

getStories([params]) ⇒ Array.<Story>

Get stories - using optional filters - from the set of all stories in the workspace (STORIES).

Kind: global function
Returns: Array.<Story> - Stories specified by the filters (if any). If no filters are specified, returns all stories in the workspace (STORIES). If STORIES is null, returns null.

Param Type Default Description
[params] Object.<string, boolean> Optional parameter to specify filter flags.
[params.memberOnly] boolean false Flag to only include stories assigned to the signed-in member.
[params.incompleteOnly] boolean false Flag to only include stories that are incomplete.
[params.completeOnly] boolean false Flag to only include stories that are complete.

getMyIncompleteStories() ⇒ Array.<Story>

Get incomplete stories that are assigned to the signed-in member

Kind: global function
Returns: Array.<Story> - Incomplete stories assigned to the signed-in member. If STORIES is null, returns null.
See: getStories

getAllIncompleteStories() ⇒ Array.<Story>

Get all incomplete stories in the workspace

Kind: global function
Returns: Array.<Story> - All incomplete stories in the workspace. If STORIES is null, returns null.
See: getStories

getTopWarriors() ⇒ Array.<TopContributor>

Get up to top 3 point contributors. If less than 3 members have completed any stories (and have more than 0 points), only return those that do.

Kind: global function
Returns: Array.<TopContributor> - The top contributors (max 3). If less than 3 top contributors exist, only those, the returned array will have length less than 3.

getTopWarriors~removeTopWarrior() ⇒ TopContributor

Finds top warrior by points and removes from map. If a top warrior doesn't exist, return null.

Kind: inner method of getTopWarriors
Returns: TopContributor - Top contributor in map or null if none exists

getBattleLog() ⇒ Array.<Story>

Returns stories in sorted by most recently completed Get stories to show in the battle log - all completed stories sorted by most recently completed.

Kind: global function
Returns: Array.<Story> - Stories for battle log. If STORIES is null, returns null

getMemberName(memberId) ⇒ string

Get the name of a member

Kind: global function
Returns: string - Name of the specified member

Param Type Description
memberId string ID of the member to get the name of

getMemberProfile() ⇒ MemberDisplay

Get the display info - workspace, name, and display icon - of the signed-in member.

Kind: global function
Returns: MemberDisplay - The display info of the signed-in member

removeApiToken()

Set the value of API_TOKEN to undefined

Kind: global function

getProgress() ⇒ Progress

Get the overall progress of stories, in terms of points completed

Kind: global function
Returns: Progress - Completed points and total points

onLogin(apiToken, memberId, workspace)

Method to be called during the sign-in process once the member's API token, ID, and workspace are known. Initializes global variables that are known, and triggers the initialization of all other global variables (by calling setup).

Kind: global function
See: setup

Param Type Description
apiToken string API token of the member signing in
memberId string Member ID of the member signing in
workspace string Workspace of the member signing in

setup() ⇒ Promise.<void>

Get the SETUP promise. If SETUP hasn't been initialized yet, create it. Otherwise, return the existing promise - do not recreate/restart it.

Kind: global function
Returns: Promise.<void> - A promise to all global variables being initialized without error and all methods being ready for execution.
See: SETUP

setupTest(apiToken, memberID)

Used for testing only. Does the same thing as setup, but does not use chrome storage

Kind: global function

Param Description
apiToken the token to set the API_TOKEN var to
memberID the id to set MEMBER_ID var to

signout()

Signout by removing all items from StorageArea storage.sync

Kind: global function

toggleMemberMenu()

Show member profile menu

Kind: global function

selectTab(tabIndex)

Apply appropriate styles to selected tab and panel item

Kind: global function

Param Type Description
tabIndex number index of tab

completeStory(story)

TODO: Complete story

Kind: global function

Param Type
story Story
Clone this wiki locally