Socket
Socket
Sign inDemoInstall

@gitbeaker/requester-utils

Package Overview
Dependencies
23
Maintainers
1
Versions
246
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @gitbeaker/requester-utils

Utility functions for requester implementatons used in @gitbeaker


Version published
Maintainers
1
Created

Package description

What is @gitbeaker/requester-utils?

@gitbeaker/requester-utils is a utility package designed to facilitate HTTP requests, particularly in the context of interacting with GitLab's API. It provides a set of tools to simplify the process of making authenticated requests, handling responses, and managing configurations.

What are @gitbeaker/requester-utils's main functionalities?

Authenticated Requests

This feature allows you to create a requester function that automatically includes authentication headers in your HTTP requests. The code sample demonstrates how to create a requester and make a GET request to fetch projects.

const { createRequesterFn } = require('@gitbeaker/requester-utils');

const requester = createRequesterFn({
  host: 'https://gitlab.example.com',
  token: 'your_access_token',
});

requester.get('/projects')
  .then(response => console.log(response))
  .catch(error => console.error(error));

Custom Request Configurations

This feature allows you to customize various request configurations such as timeout settings. The code sample shows how to set a custom request timeout.

const { createRequesterFn } = require('@gitbeaker/requester-utils');

const requester = createRequesterFn({
  host: 'https://gitlab.example.com',
  token: 'your_access_token',
  requestTimeout: 5000,
});

requester.get('/projects')
  .then(response => console.log(response))
  .catch(error => console.error(error));

Handling Responses

This feature provides a way to handle responses and errors effectively. The code sample demonstrates how to check the response status and handle errors.

const { createRequesterFn } = require('@gitbeaker/requester-utils');

const requester = createRequesterFn({
  host: 'https://gitlab.example.com',
  token: 'your_access_token',
});

requester.get('/projects')
  .then(response => {
    if (response.status === 200) {
      console.log('Projects:', response.data);
    } else {
      console.error('Error:', response.statusText);
    }
  })
  .catch(error => console.error('Request failed:', error));

Other packages similar to @gitbeaker/requester-utils

Changelog

Source

39.28.0 (Sun Dec 31 2023)

🐛 Bug Fix
  • @gitbeaker/core
    • Fixing Users.edit HTTP Method #3503 (@jdalrymple)
    • Add back isForm when setting position within the create Discussions API #3497 (@jdalrymple)
🔨 Technical Debt
  • @gitbeaker/cli, @gitbeaker/core, @gitbeaker/rest
  • @gitbeaker/core
↕️ Dependencies
📚 Documentation
Authors: 3

Readme

Source


gitbeaker


pipeline status coverage report Code Climate maintainability Auto All Contributors Prettier Licence: MIT Install Size: Requester Utils

Utility for creating custom wrappers around the @gitbeaker/core GitLab SDK.

Table of Contents

Usage

Browsers Load @gitbeaker/requester-utils directly from esm.sh
<script type="module">
  import { RequesterUtils, BaseResource } from 'https://esm.sh/@gitbeaker/requester-utils';
</script>
Deno Load @gitbeaker/requester-utils directly from esm.sh
import { RequesterUtils, BaseResource } from 'https://esm.sh/@gitbeaker/requester-utils?dts';
Node 18+

Install with npm install @gitbeaker/requester-utils, or yarn add @gitbeaker/requester-utils

import { RequesterUtils, BaseResource } from '@gitbeaker/requester-utils';

Contributors

Justin Dalrymple Dylan DesRosier Mike Wyatt Cory Zibeill Martin Bour akira345 Pavel Birukov Joseph Petersen Louis Cherel Adam Dehnel Ev Haus Loïc Mahieu Giuseppe Angri jennparise Oscar Daniel Ruf schindld Alvaro Daniel Moore Dylan M. Taylor Corentin Mors xatavian Yevgeny Petukhov Mickaël Tricot Andrea Flavien Bridault
s-kazuki Kipras Melnikovas xieyu st1gok Max Wittig Niklas Lochschmidt Ilya Dus Omar Awamry Hennadii Varava xiezht Martin Helmich Sean McGivern Clemens Lieb Vojtěch Sajdl divido Vincent Boulaye Aliyss Snow Mahmoud Saada Feng Yu Roy Jacobs Paul Lemke Ian Jenkins nilennoct Laffargue Michael Martin Howarth Christoph Lehmann
Frank V Salim Benabbou Tamás Török-Vistai Martin Benninger fewieden Jeff Pelton Claude Abounegm Stefan Hall Jordan Wallet zhao0 Joshua Grosso Isaac Ouellet Therrien Rajat Sharma Cesar B. Igor Katsuba Michael Townsend bodtx Artem Munif Tanjim Quentin Dreyer Norm MacLennan jnovick Fabian Aussems Michael Matzka CraigAllardyce Bruno Guimarães
Lukas Eipert Maximilian Krauß Evolution Engineering WEBER Logan Anton Zhukov Nicholas Loomans Carl Kittelberger Patrik Votoček Kyrylo Fedorov Claudio Vellage Seb0uil Rafael Mello Théis Bazin Spencer Salisbury Simone Corsi Bambii Will ArnaudTA Benjamin Beret Alessandro Diez artlist-scottambrose Martin Dreher Elan Ruusamäe artemoire Pieter Willekens David Claybourne
Dom Harrington Kohei Seino JounQin

This started as a fork from node-gitlab-legacy but I ended up rewriting much of the code. Here are the original work's contributors.

Keywords

FAQs

Last updated on 31 Dec 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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