Skip to content

Commit

Permalink
Added star() method
Browse files Browse the repository at this point in the history
  • Loading branch information
AurelioDeRosa committed Jan 24, 2016
1 parent 15b69aa commit 1fd209d
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,12 @@ Check if a repository is starred.
repo.isStarred(owner, repository, function(err) {});
```

Star a repository.

```js
repo.star(owner, repository, function(err) {});
```

## User API


Expand Down
7 changes: 7 additions & 0 deletions src/github.js
Original file line number Diff line number Diff line change
Expand Up @@ -852,6 +852,13 @@
this.isStarred = function(owner, repository, cb) {
_request('GET', '/user/starred/' + owner + '/' + repository, null, cb);
};

// Star a repository.
// --------

this.star = function(owner, repository, cb) {
_request('PUT', '/user/starred/' + owner + '/' + repository, null, cb)
};
};

// Gists API
Expand Down
11 changes: 11 additions & 0 deletions test/test.repo.js
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,17 @@ describe('Creating new Github.Repository', function() {
});
});
});

it('should star the repo', function(done) {
repo.star(testUser.USERNAME, repoTest, function(err) {
should.not.exist(err);

repo.isStarred(testUser.USERNAME, repoTest, function(err) {
should.not.exist(err);
done();
});
});
});
});

describe('deleting a Github.Repository', function() {
Expand Down

0 comments on commit 1fd209d

Please sign in to comment.