mirror of
https://github.com/stjornleysi/telegram_glpi.git
synced 2025-11-30 09:03:09 +00:00
133 lines
5.7 KiB
HTML
133 lines
5.7 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>Home - Documentation</title>
|
|
|
|
<script src="scripts/prettify/prettify.js"></script>
|
|
<script src="scripts/prettify/lang-css.js"></script>
|
|
<!--[if lt IE 9]>
|
|
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
|
<![endif]-->
|
|
<link type="text/css" rel="stylesheet" href="styles/prettify.css">
|
|
<link type="text/css" rel="stylesheet" href="styles/jsdoc.css">
|
|
</head>
|
|
<body>
|
|
|
|
<input type="checkbox" id="nav-trigger" class="nav-trigger" />
|
|
<label for="nav-trigger" class="navicon-button x">
|
|
<div class="navicon"></div>
|
|
</label>
|
|
|
|
<label for="nav-trigger" class="overlay"></label>
|
|
|
|
<nav>
|
|
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Glpi.html">Glpi</a><ul class='methods'><li data-type='method'><a href="Glpi.html#_getAuth">_getAuth</a></li><li data-type='method'><a href="Glpi.html#_parseContentRange">_parseContentRange</a></li><li data-type='method'><a href="Glpi.html#_request">_request</a></li><li data-type='method'><a href="Glpi.html#_validateItemType">_validateItemType</a></li><li data-type='method'><a href="Glpi.html#addCustomItemTypes">addCustomItemTypes</a></li><li data-type='method'><a href="Glpi.html#addItems">addItems</a></li><li data-type='method'><a href="Glpi.html#changeActiveEntities">changeActiveEntities</a></li><li data-type='method'><a href="Glpi.html#changeActiveProfile">changeActiveProfile</a></li><li data-type='method'><a href="Glpi.html#deleteItems">deleteItems</a></li><li data-type='method'><a href="Glpi.html#download">download</a></li><li data-type='method'><a href="Glpi.html#getActiveEntities">getActiveEntities</a></li><li data-type='method'><a href="Glpi.html#getActiveProfile">getActiveProfile</a></li><li data-type='method'><a href="Glpi.html#getFullSession">getFullSession</a></li><li data-type='method'><a href="Glpi.html#getItem">getItem</a></li><li data-type='method'><a href="Glpi.html#getItems">getItems</a></li><li data-type='method'><a href="Glpi.html#getMultipleItems">getMultipleItems</a></li><li data-type='method'><a href="Glpi.html#getMyEntities">getMyEntities</a></li><li data-type='method'><a href="Glpi.html#getMyProfiles">getMyProfiles</a></li><li data-type='method'><a href="Glpi.html#getSubItems">getSubItems</a></li><li data-type='method'><a href="Glpi.html#initSession">initSession</a></li><li data-type='method'><a href="Glpi.html#killSession">killSession</a></li><li data-type='method'><a href="Glpi.html#listSearchOptions">listSearchOptions</a></li><li data-type='method'><a href="Glpi.html#lostPassword">lostPassword</a></li><li data-type='method'><a href="Glpi.html#search">search</a></li><li data-type='method'><a href="Glpi.html#updateItems">updateItems</a></li><li data-type='method'><a href="Glpi.html#upload">upload</a></li></ul></li></ul>
|
|
</nav>
|
|
|
|
<div id="main">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<section class="readme">
|
|
<article><h1>GLPI-API</h1>
|
|
<p>Node module for <a href="https://glpi-project.org/">GLPI</a> REST API</p>
|
|
<p><a href="https://badge.fury.io/js/glpi-api"><img src="https://badge.fury.io/js/glpi-api.svg" alt="npm version"></a>
|
|
<a href="https://travis-ci.com/MartialSeron/glpi-api"><img src="https://travis-ci.com/MartialSeron/glpi-api.svg?branch=master" alt="Build Status"></a>
|
|
<a href="https://codecov.io/gh/MartialSeron/glpi-api"><img src="https://codecov.io/gh/MartialSeron/glpi-api/branch/master/graph/badge.svg" alt="codecov"></a>
|
|
<img src="https://img.shields.io/badge/license-MIT-orange.svg" alt="license"></p>
|
|
<h2>Installation</h2>
|
|
<pre class="prettyprint source"><code>$ npm install --save glpi-api
|
|
</code></pre>
|
|
<h2>Usage</h2>
|
|
<h3>Configuration</h3>
|
|
<pre class="prettyprint source lang-javascript"><code>const GlpiApi = require('glpi-api');
|
|
|
|
// Config with user_token
|
|
const config = {
|
|
app_token : 'AHBIwc4M21Q8yaOzrluxojHJRvHTF6gteAlDBaFW',
|
|
apiurl : 'https://myglpi.com/apirest.php',
|
|
user_token : 'tt5jyPvv311OzjmrJMNh2Gqgu5ovOOy7saE2fI5ha',
|
|
};
|
|
|
|
// or
|
|
|
|
// Config with basic auth
|
|
const config = {
|
|
app_token : 'AHBIwc4M21Q8yaOzrluxojHJRvHTF6gteAlDBaFW',
|
|
apiurl : 'https://myglpi.com/apirest.php',
|
|
auth : {
|
|
username : 'glpi',
|
|
password : 'secret',
|
|
},
|
|
};
|
|
|
|
const glpi = new GlpiApi(config);
|
|
</code></pre>
|
|
<h3>Examples</h3>
|
|
<h4>Get a ticket</h4>
|
|
<pre class="prettyprint source lang-javascript"><code>glpi.initSession()
|
|
.then(() => glpi.getItem('Ticket', 123456))
|
|
.then((ticket) => {
|
|
// Do what you want with your ticket
|
|
})
|
|
.catch((err) => {
|
|
// Manage error
|
|
})
|
|
.then(() => glpi.killSession());
|
|
</code></pre>
|
|
<h4>Close a ticket</h4>
|
|
<pre class="prettyprint source lang-javascript"><code>glpi.initSession()
|
|
.then(() => glpi.updateItems('Ticket', ticket.id))
|
|
.catch((err) => {
|
|
// Manage error
|
|
})
|
|
.then(() => glpi.killSession());
|
|
</code></pre>
|
|
<h2>Test</h2>
|
|
<p>Tests are only available for cloned repository</p>
|
|
<pre class="prettyprint source"><code>$ npm test
|
|
</code></pre>
|
|
<h2>Versioning</h2>
|
|
<p>I use <a href="http://semver.org/">SemVer</a> for versioning.</p>
|
|
<h2>Authors</h2>
|
|
<ul>
|
|
<li><strong>Martial Séron</strong> - <em>Initial work</em> - <a href="https://github.com/MartialSeron">MartialSeron</a></li>
|
|
</ul>
|
|
<h2>License</h2>
|
|
<p>This project is licensed under the MIT License - see the <a href="LICENSE.md">LICENSE.md</a> file for details</p></article>
|
|
</section>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<br class="clear">
|
|
|
|
<footer>
|
|
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.3</a> on Fri Oct 04 2019 16:24:24 GMT+0200 (GMT+02:00) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
</footer>
|
|
|
|
<script>prettyPrint();</script>
|
|
<script src="scripts/linenumber.js"></script>
|
|
</body>
|
|
</html> |