Skip to content
This repository has been archived by the owner on Aug 27, 2019. It is now read-only.

Latest commit

 

History

History
236 lines (174 loc) · 9.43 KB

documentation.md

File metadata and controls

236 lines (174 loc) · 9.43 KB

Classes

MyTrello

Class that encapsulates Trello configuration and calls.

StageManager

The StageManager class handles the initial setup of a board for use as an ADS BPA tracker, based on the configuration YAML file.

MyTrello Class that encapsulates Trello configuration and calls.

Kind: global class

new MyTrello(yamlFile, board) Create a MyTrello instance.

Param Type Description
yamlFile string The path to the YAML config file.
board string Trello board ID of the board to use.

myTrello.readYaml() ⇒ object Attempt to read the YAML file at the path passed into the constructor.

Kind: instance method of MyTrello
Returns: object - An object of the YAML or null if there is any error.

myTrello.getPreAward() ⇒ Array Get the pre-award stages from the YAML file.

Kind: instance method of MyTrello
Returns: Array - An array of the pre-award stages defined in the YAML config file, or an empty array if anything goes wrong.

myTrello.getListIDbyName(name) ⇒ Promise.<(string|Error)> Get a list ID from its name.

Kind: instance method of MyTrello
Returns: Promise.<(string|Error)> - A promise that resolves with the list ID or rejects with an error.

Param Type Description
name string The list name.

myTrello.getListNameByID(id) ⇒ Promise.<(string|Error)> Get a list name from its ID.

Kind: instance method of MyTrello
Returns: Promise.<(string|Error)> - A promise that resolves with the list name or rejects with an error.

Param Type Description
id string The list ID.

myTrello.getMember(usernameOrID) ⇒ Promise.<(object|Error)> Get a member object from either their ID or username.

Kind: instance method of MyTrello
Returns: Promise.<(object|Error)> - A promise that resolves with the member object or rejects with an error.

Param Type Description
usernameOrID string The username or ID of the member to get.

StageManager The StageManager class handles the initial setup of a board for use as an ADS BPA tracker, based on the configuration YAML file.

Kind: global class

new StageManager(yamlFile, board) Create a StageManager instance.

Param Type Description
yamlFile string The path to the YAML config file.
board string Trello board ID of the board to use.

stageManager.run() ⇒ Promise.<(string|Error)> Run the stage manager

Kind: instance method of StageManager
Returns: Promise.<(string|Error)> - A promise that resolves with the string "complete" or rejects with an error.

stageManager.getStageandBoard() ⇒ Promise.<(Array|Error)> Get the pre-award stages from configuration and the associated lists from Trello.

Kind: instance method of StageManager
Returns: Promise.<(Array|Error)> - A promise that resolves with an array containing the configured stages as its first element and the Trello lists as its second element, or rejects with an error.

stageManager.checkLists(data) ⇒ Array Gets an array of list objects based on the configuration, indicating whether the config list is present in Trello.

Kind: instance method of StageManager
Returns: Array - An array of list objects, each with two properties: stage (the pre-award stage name) and build (a boolean indicating whether a list by the same name exists in Trello).

Param Type Description
data Array The resolved value from getStageandBoard.

stageManager.makeAdditionalLists(checkedList) ⇒ Promise.<undefined, Error> Create any missing Trello lists, based on the results of checkLists.

Kind: instance method of StageManager
Returns: Promise.<undefined, Error> - A promise that resolves with no value if all of the missing lists were created, or rejects with an error.

Param Type Description
checkedList Array The array of list objects return by checkLists.

stageManager.closeUnusedStages(data) ⇒ Promise.<(undefined|Error)> Close Trello lists that do not correspond to a configured pre-award stage.

Kind: instance method of StageManager
Returns: Promise.<(undefined|Error)> - A promise that resolves with no value if all of the extraneous lists are closed, or rejects with an error.

Param Type Description
data Array The resolved value from getStageandBoard.

stageManager.getListCards(trelloID) ⇒ Promise.<(Array|Error)> Get the cards from a Trello list by the list ID.

Kind: instance method of StageManager
Returns: Promise.<(Array|Error)> - A promise that resolves with an array of Trello card objects or rejects with an error.

Param Type Description
trelloID string The ID of the Trello list to get cards from.

stageManager.closeList(listData, trelloListID) ⇒ Promise.<(Object|string|Error)> Close a Trello list by list ID, if it has no cards.

Kind: instance method of StageManager
Returns: Promise.<(Object|string|Error)> - A promise that resolves with the object resulting from closing the list or a string message indicating that the list did not need to be closed (e.g., the list has cards); or rejects with an error.

Param Type Description
listData Array The list of cards contained in the list, from getListCards.
trelloListID string The ID of the list to close.

stageManager.orderLists(data) ⇒ Promise.<(undefined|Error)> Put Trello lists in order according to their order in the configuration file.

Kind: instance method of StageManager
Returns: Promise.<(undefined|Error)> - A promise that resolves with no value if everything goes okay, or rejects with an error.

Param Type Description
data Array The resolved value from getStageandBoard.