Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

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.2.0 to 0.2.1

29

index.js

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

/**
* @param {String} token
* @param {String} url
* @param {Object} [payload]
* @param {String} [method]
*
* @return {Promise} Promise resolving to aggregated data as an object
*/
function callGitlab(token, url, payload = undefined, method = "get") {

@@ -13,8 +21,15 @@ const headers = new Headers();

{ method, headers }
).then(response => {
if (!response.ok) {
throw Error(response.statusText);
).then(async (response) => {
if (response.ok) {
return response;
}
return response;
let message = response.statusText;
try {
const json = await response.json();
message = json.message;
} catch (e) {}
throw new Error(message);
});

@@ -26,5 +41,5 @@ }

* @param {String} url
* @param {Object} payload
* @param {Number} page Internal, do not use
* @param {Array} recursiveData Internal, do not use
* @param {Object} [payload]
* @param {Number} [page] Internal, do not use
* @param {Array} [recursiveData] Internal, do not use
*

@@ -31,0 +46,0 @@ * @return {Promise} Promise resolving to aggregated data as an object

{
"name": "gitlab-fetcher",
"version": "0.2.0",
"version": "0.2.1",
"description": "Simple helper to aggregate Gitlab API results across multiple pages",

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

@@ -7,2 +7,4 @@ # gitlab-fetcher

### Fetching a paginated collection
```js

@@ -20,3 +22,3 @@ import { fetchGitlab } from "gitlab-fetcher";

If you need to do a `POST` request, this package can help as well:
### Other requests (single entity, `POST`, etc.)

@@ -30,1 +32,15 @@ ```js

```
### Server-side
This package can be easily used with Node.js and [ESM](https://www.npmjs.com/package/esm):
```js
/* eslint-env node */
global.fetch = require("node-fetch");
global.Headers = require("fetch-headers");
const { callGitlab, fetchGitlab } = require("gitlab-fetcher");
```
Simply run your script with `node -r esm path/to/script.js`.
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