1.2.6 • Published 4 years ago

facepunch-api v1.2.6

Weekly downloads
-
License
MIT
Repository
gitlab
Last release
4 years ago

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!');
})

1.2.6

4 years ago

1.2.5

4 years ago

1.2.4

4 years ago

1.2.3

4 years ago

1.2.2

4 years ago

1.2.1

4 years ago

1.2.0

4 years ago

1.1.9

4 years ago

1.1.8

4 years ago

1.1.7

4 years ago

1.1.6

4 years ago

1.1.5

4 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago