New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

bitbucket-v2

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bitbucket-v2 - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

bitbucket/user.js

1

bitbucket/index.js

@@ -22,2 +22,3 @@ const Request = require('./request').Request;

this.repositories = new (require('./repositories'))(this);
this.user = new (require('./user'))(this);
}

@@ -24,0 +25,0 @@

@@ -12,2 +12,16 @@ const AbstractApi = require('./abstract_api');

/**
* Get the info for a single repo
*
* @param {String} repo owner
* @param {String} slug (name) of the repo.
*/
get(username, repoSlug, callback) {
this.$api.get(
'repositories/' + encodeURI(username) + '/' + encodeURI(repoSlug),
null, null,
this.$createListener(callback)
);
}
/**
* Get the repositories of a user

@@ -19,5 +33,5 @@ *

this.$api.get(
'repositories/' + encodeURI(username),
null, null,
this.$createListener(callback)
'repositories/' + encodeURI(username),
null, null,
this.$createListener(callback)
);

@@ -33,9 +47,70 @@ }

this.$api.get(
'repositories/' + encodeURI(teamname),
null, null,
this.$createListener(callback)
'repositories/' + encodeURI(teamname),
null, null,
this.$createListener(callback)
);
}
/**
* Get the forks for a repo
*
* @param {String} repo owner
* @param {String} slug (name) of the repo.
*/
getForks(username, repoSlug, callback) {
this.$api.get(
'repositories/' + encodeURI(username) + '/' + encodeURI(repoSlug) + '/forks',
null, null,
this.$createListener(callback)
);
}
/**
* Get the forks for a repo using an API response that has repository links
*
* @param {Object} API response
*/
getForksFromResponse(response, callback) {
const prebuiltURL = response && response.links && response.links.forks && response.links.forks.href;
if (!prebuiltURL) {
throw new Error('getForksFromResponse: argument has no \'forks\' url.');
}
this.$api.request.doPrebuiltSend(
prebuiltURL,
this.$createListener(callback)
);
}
/**
* Get the parent for a repo using an API response that has repository links.
* This should only be called after a check to hasParent().
*
* @param {Object} API response
*/
getParentFromResponse(response, callback) {
const prebuiltURL = response && response.parent && response.parent.links && response.parent.links.self && response.parent.links.self.href;
if (!prebuiltURL) {
throw new Error('getForksFromResponse: argument has no \'parent\' info. Call hasParent first to guard this method call.');
}
this.$api.request.doPrebuiltSend(
prebuiltURL,
this.$createListener(callback)
);
}
/**
* Determines whether or not the given response has an accessible parent.
*
* @param {Object} API response
* @return {boolean} true if the argument has an associated "parent" (i.e. the response is a fork), false otherwise.
*/
hasParent(response) {
return !!response.parent;
}
}
module.exports = RepositoriesApi;

@@ -30,2 +30,3 @@ 'use strict';

this.repositories = new (require('./repositories'))(this);
this.user = new (require('./user'))(this);
}

@@ -32,0 +33,0 @@

@@ -27,8 +27,21 @@ 'use strict';

/**
* Get the repositories of a user
* Get the info for a single repo
*
* @param {String} username
* @param {String} repo owner
* @param {String} slug (name) of the repo.
*/
_createClass(RepositoriesApi, [{
key: 'get',
value: function get(username, repoSlug, callback) {
this.$api.get('repositories/' + encodeURI(username) + '/' + encodeURI(repoSlug), null, null, this.$createListener(callback));
}
/**
* Get the repositories of a user
*
* @param {String} username
*/
}, {
key: 'getByUser',

@@ -50,2 +63,65 @@ value: function getByUser(username, callback) {

}
/**
* Get the forks for a repo
*
* @param {String} repo owner
* @param {String} slug (name) of the repo.
*/
}, {
key: 'getForks',
value: function getForks(username, repoSlug, callback) {
this.$api.get('repositories/' + encodeURI(username) + '/' + encodeURI(repoSlug) + '/forks', null, null, this.$createListener(callback));
}
/**
* Get the forks for a repo using an API response that has repository links
*
* @param {Object} API response
*/
}, {
key: 'getForksFromResponse',
value: function getForksFromResponse(response, callback) {
var prebuiltURL = response && response.links && response.links.forks && response.links.forks.href;
if (!prebuiltURL) {
throw new Error('getForksFromResponse: argument has no \'forks\' url.');
}
this.$api.request.doPrebuiltSend(prebuiltURL, this.$createListener(callback));
}
/**
* Get the parent for a repo using an API response that has repository links.
* This should only be called after a check to hasParent().
*
* @param {Object} API response
*/
}, {
key: 'getParentFromResponse',
value: function getParentFromResponse(response, callback) {
var prebuiltURL = response && response.parent && response.parent.links && response.parent.links.self && response.parent.links.self.href;
if (!prebuiltURL) {
throw new Error('getForksFromResponse: argument has no \'parent\' info. Call hasParent first to guard this method call.');
}
this.$api.request.doPrebuiltSend(prebuiltURL, this.$createListener(callback));
}
/**
* Determines whether or not the given response has an accessible parent.
*
* @param {Object} API response
* @return {boolean} true if the argument has an associated "parent" (i.e. the response is a fork), false otherwise.
*/
}, {
key: 'hasParent',
value: function hasParent(response) {
return !!response.parent;
}
}]);

@@ -52,0 +128,0 @@

2

package.json
{
"name" : "bitbucket-v2",
"version" : "0.1.0",
"version" : "0.1.1",
"description" : "Wrapper for the BitBucket API v2",

@@ -5,0 +5,0 @@ "author": "Jordan Wallet <jjwallet@gmail.com>",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc