1.2.6 • Published 6 years ago
facepunch-api
Licence
MIT
Version
1.2.6
Deps
1
Size
10 kB
Vulns
0
Weekly
0
DeprecatedThis package is deprecated
Documentation
NPM
npm i facepunch-api
Functions
subscribeToAuthor(author, callback)
- Key:
author- Type: String.
- Description: Name of the author to subscribe to.
- Key:
callback- Type: Function.
- Description: The function that will be called with the new commit.
subscribeToRepository(repository, callback)
- Key:
repository- Type: String.
- Description: Name of the repository to subscribe to.
- Key:
callback- Type: Function.
- Description: The function that will be called with the new commit.
subscribeToAuthorRepository(author, repository, callback)
- Key:
author- Type: String.
- Description: Name of the author to subscribe to.
- Key:
repository- Type: String.
- Description: Name of the repository to subscribe to.
- Key:
callback- Type: Function.
- Description: The function that will be called with the new commit.
subscribeToAll(callback)
- Key:
callback- Type: Function.
- Description: The function that will be called with the new commit.
throwError(callback)
- Key:
callback- Type: Function.
- Description: Where mistakes will arrive
Example return in callback function
{
"id": 372193,
"repo": "rust_reboot",
"branch": "main/ai_test_changes/events",
"changeset": "54530",
"created": "2020-09-12T10:44:02",
"message": "wip AI state events & listener.",
"user": {
"name": "Adam Woolridge",
"avatar": "https://files.facepunch.com/s/b8ec968c721a.jpg"
}
}
Example usage
const _FACEPUNCHAPI = require('facepunch-api');
const facepunchAPI = new _FACEPUNCHAPI(60000); // interval check commits in ms
facepunchAPI.subscribeToAuthor('Garry Newman', (commit) => {
// Here we subscribe to commits from author Garry Newman
console.log('Ohh... New commit from Garry!!!', commit);
})
facepunchAPI.subscribeToRepository('sandbox.source', (commit) => {
// Here we subscribe to the comments on the repository sandbox.source
console.log('O yes. S&Box released', commit);
})
facepunchAPI.subscribeToAuthorRepository('Garry Newman', 'Fad', (commit) => {
console.log('fad?? New commit from Garry in rep Fad', commit);
})
facepunchAPI.subscribeToAll((commit) => {
console.log(`new commit from ${commit.user.name}:`, commit);
})
facepunchAPI.throwError((_err) => {
console.log('Oh... Site down!');
})