Socket
Socket
Sign inDemoInstall

@vssue/api-bitbucket-v2

Package Overview
Dependencies
2
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.2.1 to 1.4.0

lib/types.d.ts

47

lib/index.d.ts

@@ -20,3 +20,3 @@ import { VssueAPI } from 'vssue';

*/
readonly platform: VssueAPI.Platform;
get platform(): VssueAPI.Platform;
/**

@@ -31,4 +31,2 @@ * Redirect to the authorization page of platform.

*
* @return A string for access token, `null` for no authorization code
*
* @see https://developer.atlassian.com/bitbucket/api/2/reference/meta/authentication#oauth-2

@@ -43,6 +41,2 @@ *

*
* @param options.accessToken - User access token
*
* @return The user
*
* @see https://developer.atlassian.com/bitbucket/api/2/reference/resource/user

@@ -56,8 +50,2 @@ */

*
* @param options.accessToken - User access token
* @param options.issueId - The id of issue
* @param options.issueTitle - The title of issue
*
* @return The raw response of issue
*
* @see https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/issues/%7Bissue_id%7D#get

@@ -75,8 +63,2 @@ * @see https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/issues#get

*
* @param options.accessToken - User access token
* @param options.title - The title of issue
* @param options.content - The content of issue
*
* @return The created issue
*
* @see https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/issues#post

@@ -92,12 +74,6 @@ */

*
* @param options.accessToken - User access token
* @param options.issueId - The id of issue
* @param options.query - The query parameters
*
* @return The comments
*
* @see https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/issues/%7Bissue_id%7D/comments#get
* @see https://developer.atlassian.com/bitbucket/api/2/reference/meta/pagination
*/
getComments({ accessToken, issueId, query: { page, perPage, sort, }, }: {
getComments({ accessToken, issueId, query: { page, perPage, sort }, }: {
accessToken: VssueAPI.AccessToken;

@@ -110,8 +86,2 @@ issueId: string | number;

*
* @param options.accessToken - User access token
* @param options.issueId - The id of issue
* @param options.content - The content of comment
*
* @return The created comment
*
* @see https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/issues/%7Bissue_id%7D/comments#post

@@ -127,9 +97,2 @@ */

*
* @param options.accessToken - User access token
* @param options.issueId - The id of issue
* @param options.commentId - The id of comment
* @param options.content - The content of comment
*
* @return The edited comment
*
* @see https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/issues/%7Bissue_id%7D/comments/%7Bcomment_id%7D#put

@@ -146,8 +109,2 @@ */

*
* @param options.accessToken - User access token
* @param options.issueId - The id of issue
* @param options.commentId - The id of comment
*
* @return `true` if succeed, `false` if failed
*
* @see https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/issues/%7Bissue_id%7D/comments/%7Bcomment_id%7D#delete

@@ -154,0 +111,0 @@ */

import axios from 'axios';
import { buildQuery, buildURL, concatURL, getCleanURL, parseQuery, } from '@vssue/utils';
import { normalizeUser, normalizeIssue, normalizeComment, } from './utils';
import { normalizeUser, normalizeIssue, normalizeComment } from './utils';
/**

@@ -20,3 +20,3 @@ * Bitbucket API V2

headers: {
'Accept': 'application/json',
Accept: 'application/json',
},

@@ -55,4 +55,2 @@ });

*
* @return A string for access token, `null` for no authorization code
*
* @see https://developer.atlassian.com/bitbucket/api/2/reference/meta/authentication#oauth-2

@@ -83,6 +81,2 @@ *

*
* @param options.accessToken - User access token
*
* @return The user
*
* @see https://developer.atlassian.com/bitbucket/api/2/reference/resource/user

@@ -92,3 +86,3 @@ */

const { data } = await this.$http.get('user', {
headers: { 'Authorization': `Bearer ${accessToken}` },
headers: { Authorization: `Bearer ${accessToken}` },
});

@@ -100,8 +94,2 @@ return normalizeUser(data);

*
* @param options.accessToken - User access token
* @param options.issueId - The id of issue
* @param options.issueTitle - The title of issue
*
* @return The raw response of issue
*
* @see https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/issues/%7Bissue_id%7D#get

@@ -115,3 +103,3 @@ * @see https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/issues#get

options.headers = {
'Authorization': `Bearer ${accessToken}`,
Authorization: `Bearer ${accessToken}`,
};

@@ -151,8 +139,2 @@ }

*
* @param options.accessToken - User access token
* @param options.title - The title of issue
* @param options.content - The content of issue
*
* @return The created issue
*
* @see https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/issues#post

@@ -169,3 +151,3 @@ */

}, {
headers: { 'Authorization': `Bearer ${accessToken}` },
headers: { Authorization: `Bearer ${accessToken}` },
});

@@ -180,18 +162,12 @@ data.links.html = {

*
* @param options.accessToken - User access token
* @param options.issueId - The id of issue
* @param options.query - The query parameters
*
* @return The comments
*
* @see https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/issues/%7Bissue_id%7D/comments#get
* @see https://developer.atlassian.com/bitbucket/api/2/reference/meta/pagination
*/
async getComments({ accessToken, issueId, query: { page = 1, perPage = 10, sort = 'desc', } = {}, }) {
async getComments({ accessToken, issueId, query: { page = 1, perPage = 10, sort = 'desc' } = {}, }) {
const options = {
params: {
// pagination
'page': page,
'pagelen': perPage,
'sort': sort === 'desc' ? '-created_on' : 'created_on',
page: page,
pagelen: perPage,
sort: sort === 'desc' ? '-created_on' : 'created_on',
// to avoid caching

@@ -203,3 +179,3 @@ timestamp: Date.now(),

options.headers = {
'Authorization': `Bearer ${accessToken}`,
Authorization: `Bearer ${accessToken}`,
};

@@ -212,3 +188,5 @@ }

perPage: data.pagelen,
data: data.values.filter(item => item.content.raw !== null).map(normalizeComment),
data: data.values
.filter(item => item.content.raw !== null)
.map(normalizeComment),
};

@@ -219,8 +197,2 @@ }

*
* @param options.accessToken - User access token
* @param options.issueId - The id of issue
* @param options.content - The content of comment
*
* @return The created comment
*
* @see https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/issues/%7Bissue_id%7D/comments#post

@@ -234,3 +206,3 @@ */

}, {
headers: { 'Authorization': `Bearer ${accessToken}` },
headers: { Authorization: `Bearer ${accessToken}` },
});

@@ -242,9 +214,2 @@ return normalizeComment(data);

*
* @param options.accessToken - User access token
* @param options.issueId - The id of issue
* @param options.commentId - The id of comment
* @param options.content - The content of comment
*
* @return The edited comment
*
* @see https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/issues/%7Bissue_id%7D/comments/%7Bcomment_id%7D#put

@@ -258,3 +223,3 @@ */

}, {
headers: { 'Authorization': `Bearer ${accessToken}` },
headers: { Authorization: `Bearer ${accessToken}` },
});

@@ -266,8 +231,2 @@ return normalizeComment(data);

*
* @param options.accessToken - User access token
* @param options.issueId - The id of issue
* @param options.commentId - The id of comment
*
* @return `true` if succeed, `false` if failed
*
* @see https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/issues/%7Bissue_id%7D/comments/%7Bcomment_id%7D#delete

@@ -277,3 +236,3 @@ */

const { status } = await this.$http.delete(`repositories/${this.owner}/${this.repo}/issues/${issueId}/comments/${commentId}`, {
headers: { 'Authorization': `Bearer ${accessToken}` },
headers: { Authorization: `Bearer ${accessToken}` },
});

@@ -285,2 +244,3 @@ return status === 204;

*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
async getCommentReactions(options) {

@@ -292,2 +252,3 @@ throw new Error('501 Not Implemented');

*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
async postCommentReaction(options) {

@@ -294,0 +255,0 @@ throw new Error('501 Not Implemented');

import { VssueAPI } from 'vssue';
export declare function normalizeUser(user: any): VssueAPI.User;
export declare function normalizeIssue(issue: any): VssueAPI.Issue;
export declare function normalizeComment(comment: any): VssueAPI.Comment;
import { ResponseUser, ResponseIssue, ResponseComment } from './types';
export declare function normalizeUser(user: ResponseUser): VssueAPI.User;
export declare function normalizeIssue(issue: ResponseIssue): VssueAPI.Issue;
export declare function normalizeComment(comment: ResponseComment): VssueAPI.Comment;
declare const _default: {

@@ -6,0 +7,0 @@ normalizeUser: typeof normalizeUser;

{
"name": "@vssue/api-bitbucket-v2",
"version": "1.2.1",
"version": "1.4.0",
"description": "Vssue api for bitbucket v2",

@@ -29,3 +29,3 @@ "keywords": [

"dependencies": {
"@vssue/utils": "^1.1.1",
"@vssue/utils": "^1.4.0",
"axios": "^0.18.1"

@@ -36,3 +36,3 @@ },

},
"gitHead": "2e3ae5cd7dea755d78b4b59d13a77d35695a32af"
"gitHead": "c31210f04dcb4f114488e45d5835c89196492026"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc