📖 Table of Contents
Motivation
GitHub introduced a new feature that allows you to set your status on your profile!
This library gives you the ability to programmatically update your GitHub profile status. With this, you can do really interesting stuff, like displaying what you're listening to right on GitHub! The possibilities are endless!
Installation
This library is available on the npm registry as a node module and can be installed by running:
# via npm npm install --save github-profile-status # via yarn yarn add github-profile-status
Example
; { const profileStatus = token: processenvGITHUB_ACCESS_TOKEN ; // set your the github profile status await profileStatus; // update your the github profile status await profileStatus; // get your github profile status const status = await profileStatus; // clears your github profile status const success = await profileStatusclear;}
API
Constructor
new GitHubProfileStatus(options: ConstructorOptions)
Creates a new github profile status instance.
Constructor Options
An object with the following keys:
token: string
: a personal access token with the user scope.
Methods
Instances have the following methods:
get(): Promise<UserStatus | null>
Retrieves the status of the authenticated user.
Returns a Promise that resolves with the user status object, or null
if the user does not have a status set.
getForUser(username?: string): Promise<UserStatus | null>
Retrieves the status of the provided user.
Returns a Promise that resolves with the user status object, or null
if the user does not have a status set.
set(status: ChangeUserStatusInput): Promise<UserStatus | null>
Sets the user status using the provided status
.
Note that attributes omitted from status
will be cleared. If you only want to update the specified attributes without affecting any existing ones, consider using the update()
method instead.
Returns a Promise that resolves with the user status object, or null
if the status was cleared (e.g. providing an empty message).
update(status: ChangeUserStatusInput): Promise<UserStatus | null>
Partially updates the status with the provided attributes. All attributes of status
are optional. Attributes omitted from the status
object will remain as they are.
Returns a Promise that resolves with the user status object, or null
if the status was cleared (e.g. providing empty attributes).
clear(): Promise<boolean>
Clears the user profile status.
Returns a Promise that resolves to a boolean indicating a successful operation.
ChangeUserStatusInput
UserStatus
The status object has the following keys:
Licence
MIT