new github()
The github store module handles GitHub login and build status checks.
Members
-
static Getters :Object
-
Name Returns Type Returns State Property Description lastErrorError errorsReturns the most recent error encountered. loginstring user.loginReturns the current user's login name. loginInProgressboolean loginInProgressWhether a login attempt is currently in progress. codestring The current GitHub login code. tokenstring The current GitHub authorisation token. -
static Mutations :Object
-
Name Accepts Type Mutates State Property Description setUserObject userSet the currently logged in user. setLoginFlagboolean loginInProgressSet the login in progress flag. addBuildStatusChecknumber buildStatusChecksSchedule a build status check for a time in the future. removeBuildStatusCheckbuildStatusChecksMark the first scheduled build status check as complete. updateBuildStatusGHBuildStatus buildStatusSet the last build status. addErrorError errorsAdd an error to the error list. -
static State
-
Properties:
Name Type Description usernull | Object The currently logged in user. errorsArray.<Error> List of errors encountered. loginInProgressboolean Whether a login request is in progress. buildStatusChecksArray.<number> When build status checks are scheduled in the future. lastBuildStatusChecknull | number When the last build status check was conducted. buildStatusnull | GHBuildStatus The result of the last build status check.
Methods
-
action getBuildStatus(nsContext) → {Promise.<void>}
-
Execute a build status check.
Vuex Action => Mutates state propertybuildStatus,buildStatusChecksParameters:
Name Type Description nsContextStoreContext Returns:
Promise.<void> -
action getUserDetails(nsContext) → {Promise.<void>}
-
Retrieve the details of the logged in user from GitHub. On success, triggers the workshop module's GitHub search for the user's UKRN workshop repositories.
Vuex Action => Mutates state propertyuser,loginInProgress,workshop.repositoriesParameters:
Name Type Description nsContextStoreContext Throws:
If the user details cannot be retrieved, this function triggers a logout operation.Returns:
Promise.<void> -
action logout()
-
Trigger a logout operation by directing the window to the base page. Login information is controlled by querystring information, so wiping this from the location bar logs the user out. Because this triggers a window redirect, it should never return.
Vuex Action => Mutates state propertynone -
action processToken(nsContext, token)
-
Store a provided token as part of the location querystring. Because this function issues a location redirect, it should not return.
Vuex Action => Mutates state propertynoneParameters:
Name Type Description nsContextStoreContext tokenstring Token to include in the querystring. -
action redeemCode(nsContext)
-
Exchange a GitHub login code for a token that will allow API operations to be authorised by the given user. Because this function issues a location redirect it should not return.
Vuex Action => Mutates state propertynoneParameters:
Name Type Description nsContextStoreContext -
action registerBuildCheck(nsContext, payload) → {void|number}
-
Register a new build status check to take place in the future. If another build status check is scheduled for after the current time, don't add a new check.
Vuex Action => Mutates state propertybuildStatusChecksParameters:
Name Type Description nsContextStoreContext payloadObject Properties
Name Type Attributes Default Description delaynumber <optional>
180000 The delay before the build status check is executed. Defaults to 3 minutes. Returns:
void | number - The reference for the timeout.