mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-19 16:31:01 +00:00
40 lines
No EOL
737 B
JavaScript
40 lines
No EOL
737 B
JavaScript
'use strict';
|
|
|
|
(function () {
|
|
|
|
/**
|
|
* The TokenService provides access to user token
|
|
* data using REST API calls.
|
|
*/
|
|
function TokenService($http, $window) {
|
|
|
|
/**
|
|
* Gets a list of all repositories.
|
|
*/
|
|
this.list = function() {
|
|
return $http.get('/api/user/tokens');
|
|
};
|
|
|
|
/**
|
|
* Creates a new token.
|
|
*
|
|
* @param {object} JSON representation of a repository.
|
|
*/
|
|
this.post = function(token) {
|
|
return $http.post('/api/user/tokens', token);
|
|
};
|
|
|
|
/**
|
|
* Deletes a repository.
|
|
*
|
|
* @param {string} Name of the repository.
|
|
*/
|
|
this.delete = function(token) {
|
|
return $http.delete('/api/user/tokens/' + token.label);
|
|
};
|
|
}
|
|
|
|
angular
|
|
.module('drone')
|
|
.service('tokens', TokenService);
|
|
})(); |