Socket
Socket
Sign inDemoInstall

gitlab-fetcher

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gitlab-fetcher - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

11

index.js

@@ -5,5 +5,5 @@ import qs from "query-string";

function fetchOnce(url, payload = undefined, method = "get") {
function fetchOnce(token, url, payload = undefined, method = "get") {
const headers = new Headers();
headers.append("Private-Token", config.token);
headers.append("Private-Token", token);

@@ -23,2 +23,3 @@ return fetch(

/**
* @param {String} token
* @param {String} url

@@ -31,6 +32,6 @@ * @param {Object} payload

*/
export default function fetchGitlab(url, payload = undefined, page = 1, recursiveData = []) {
export default function fetchGitlab(token, url, payload = undefined, page = 1, recursiveData = []) {
let totalPages;
return fetchOnce(url, { ...payload, "per_page": pageSize, page })
return fetchOnce(token, url, { ...payload, "per_page": pageSize, page })
.then(response => {

@@ -48,4 +49,4 @@ totalPages = parseInt(response.headers.get("x-total-pages"));

return fetchGitlab(url, payload, page + 1, recursiveData);
return fetchGitlab(token, url, payload, page + 1, recursiveData);
});
}
{
"name": "gitlab-fetcher",
"version": "0.1.0",
"version": "0.1.1",
"description": "Simple helper to aggregate Gitlab API results across multiple pages",

@@ -5,0 +5,0 @@ "author": "neemzy <tom.panier@free.fr>",

@@ -10,5 +10,5 @@ # gitlab-fetcher

const issues = fetchGitlab("/issues", { scope: "all", state: "opened" });
const issues = fetchGitlab("YourToken", "https://gitlab.url/issues", { scope: "all", state: "opened" });
```
`issues` will contain a `Promise` resolving to aggregated results from all result pages. An `Error` will be thrown in case of HTTP error (with `message` containing `response.statusText`).
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