Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
@atno/ts-glpi-client
Advanced tools
TS-GLPI-CLIENT is a TypeScript client library for interacting with the GLPI (Gestionnaire Libre de Parc Informatique) API. This library provides a set of classes to perform various operations such as authentication, retrieval, addition, and updating of resources.
To install the TS-GLPI-CLIENT library, use npm or yarn:
npm install ts-glpi-client
or
yarn add ts-glpi-client
The GLPIClient class is used to manage authentication and create instances of other GLPI API client classes.
import { GLPIClient } from "ts-glpi-client";
const client = new GLPIClient("base_url", "app_token");
// Authenticate with user and password
client.authenticateWithUserAndPassword("user", "password").then((apiClient) => {
// Use apiClient to access other endpoints
});
// Authenticate with a user token
client.authenticateWithToken("user_token").then((apiClient) => {
// Use apiClient to access other endpoints
});
import { GLPIClient } from "ts-glpi-client";
const client = new GLPIClient("base_url", "app_token");
// Authenticate and get the actives endpoint
client.authenticateWithUserAndPassword("user", "password").then((apiClient) => {
// Access the actives endpoint
const actives = apiClient.actives;
// Retrieve a item by id of specified itemtype from endpoint
apiclient.endpoint
.getById("itemtype", itemID)
.then((item) => {
console.log("Item by ID:", item);
})
.catch((error) => {
console.error("Error retrieving item by ID:", error);
});
// Retrieve all items of specified itemtype from endpoint
apiclient.endpoint
.getAll("itemtype")
.then((items) => {
console.log("All items:", items);
})
.catch((error) => {
console.error("Error retrieving all items:", error);
});
// Update an item of specific itemtype from endpoint
apiclient.endpoint
.update("itemtype", itemID, { field: "value" })
.then((response) => {
console.log("Update response:", response);
})
.catch((error) => {
console.error("Error updating item:", error);
});
// Add a new item of specific itemtype from endpoint
actives
.add("itemtype", { field: "value" })
.then((response) => {
console.log("Add response:", response);
})
.catch((error) => {
console.error("Error adding item:", error);
});
});
If you would like to contribute to this project, please submit a pull request or open an issue.
Gilmar Antonio 💻 🖋 📖 🤔 🚇 🚧 📆 🔧 |
This project is licensed under the MIT License - see the LICENSE file for details.
💙 This package was templated with create-typescript-app.
FAQs
A (partial)fulltyped GLPI API client
We found that @atno/ts-glpi-client demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
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.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.