GlpiClientBase class abstract

Represent the base client for all GLPI API calls.

Implemented types

Constructors

GlpiClientBase(Client _innerClient, String _host, {String? appToken, String? sessionToken})
The constructor used in subclasses

Properties

appToken String?
The appToken used to authenticate the requests. Can be set either a construction or later
getter/setter pairoverride
hashCode int
The hash code for this object.
no setterinherited
host String
The server host should either end with apirest.php or redirect on it.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sessionToken String?
The sessionToken used to authenticate the requests. Can be stored between session and used to construct a new client without calling initSessionUserToken or initSessionUserToken. Can be set either a construction or later
getter/setter pairoverride

Methods

addItems(GlpiItemType itemType, String data) Future<List<Map<String, String>>>
Return the id(s) of the item(s) added using the data as input. Don't use this method to upload a document To correctly format the data, see the examples and the documentation. Reference: https://github.com/glpi-project/glpi/blob/master/apirest.md#add-items
override
applyMassiveActions(GlpiItemType itemType, String massiveActionName, String payload) Future<Map<String, dynamic>>
Run the given massive action payload Must be a json string with the parameters for the action and the ids of the items to apply the action to. Reference: https://github.com/glpi-project/glpi/blob/master/apirest.md#apply-massive-action
override
changeActiveEntities(dynamic entitiesId, {bool recursive = false}) Future<bool>
Allow to change the active entity for the current user. entitiesId can either be the numerical id of the entity or all to load all the entities. recursive can be set to true to load all the sub-entities. Will throw an Exception if the request fails or if the selected id is incorrect. Reference: https://github.com/glpi-project/glpi/blob/master/apirest.md#change-active-entities
override
changeActiveProfile(int profilesId) Future<bool>
Change the active profile for the current user. Will throw an Exception if the request fails or if the selected id is incorrect. Reference: https://github.com/glpi-project/glpi/blob/master/apirest.md#change-active-profile.
override
deleteItem(GlpiItemType itemType, int id, {bool forcePurge = false, bool history = true}) Future<Map<String, String>>
Return the id of the item deleted with true is the deletion is complete. forcePurge will delete the item permanently. history set to false will prevent the deletion from being added to the global history.
override
deleteItems(GlpiItemType itemType, String data) Future<List<Map<String, String>>>
Return the ids of the items deleted with true is the deletion is complete. Reference: https://github.com/glpi-project/glpi/blob/master/apirest.md#delete-items
override
downloadDocument(int id) Future<String>
Allow to download a GlpiItemType.Document. id must be the id of the document to download. Reference: https://github.com/glpi-project/glpi/blob/master/apirest.md#download-a-document-file
override
getActiveEntities() Future<Map<String, dynamic>>
Return the current active entity for the current user as a Map Reference: https://github.com/glpi-project/glpi/blob/master/apirest.md#get-active-entities
override
getActiveProfile() Future<Map<String, dynamic>>
Return the current active profile for the current user as a Map Reference: https://github.com/glpi-project/glpi/blob/master/apirest.md#get-active-profile
override
getAllItem(GlpiItemType itemType, {bool expandDropdowns = false, bool getHateoas = true, bool onlyId = false, int rangeStart = 0, int rangeLimit = 50, String sort = 'id', String order = 'ASC', String searchText = 'NULL', bool isDeleted = false, List? addKeysNames}) Future<List>
Return ALL the items of the given type the current user can see, depending on your server configuration and the number of items proceeded it may have unexpected results. GlpiItemType contains all the available item types according to the latest GLPI documentation. By default, only the 50 firsts item will be returned. This can be changed by setting the rangeStart parameter and rangeLimit parameters. Reference: https://github.com/glpi-project/glpi/blob/master/apirest.md#get-all-items
override
getFullSession() Future<Map<String, dynamic>>
Return the session data include in the php $_SESSION. For the moment it's just a Map of the json response. Reference: https://github.com/glpi-project/glpi/blob/master/apirest.md#get-full-session.
override
getGlpiConfig() Future<Map<String, dynamic>>
Return the Glpi instance configuration data inside a Map. Reference: https://github.com/glpi-project/glpi/blob/master/apirest.md#get-glpi-config
override
getItem(GlpiItemType itemtype, int id, {bool expandDropdowns = false, bool getHateoas = true, bool getSha1 = false, bool withDevices = false, bool withDisks = false, bool withSoftwares = false, bool withConnections = false, bool withNetworkPorts = false, bool withInfoComs = false, bool withContracts = false, bool withDocuments = false, bool withTickets = false, bool withProblems = false, bool withChanges = false, bool withNotes = false, bool withLogs = false, List<String>? addKeysNames}) Future<Map<String, dynamic>>
Return an item identified by the id and of type itemType Will throw an Exception if the request fails or if the selected id is incorrect. withDevices will be ignored if the itemtype isn't GlpiItemType.Computer,GlpiItemType.NetworkEquipment,GlpiItemType.Peripheral,GlpiItemType.Phone or GlpiItemType.Printer. withDisks, withSoftwares, withConnections will be ignored if the itemtype isn't GlpiItemType.Computer. Reference: https://github.com/glpi-project/glpi/blob/master/apirest.md#get-an-item
override
getMassiveActionParameters(GlpiItemType itemType, String massiveActionName) Future<List<Map<String, String>>>
Show the awaitables parameters for a given massive action Warning: experimental endpoint, some required parameters may be missing from the returned content. Reference: https://github.com/glpi-project/glpi/blob/master/apirest.md#get-massive-action-parameters
override
getMassiveActions(GlpiItemType itemType, {bool isDeleted = false}) Future<List<Map<String, String>>>
Return the available massive actions for a given itemtype isDeleted (default false): Show specific actions for items in the trash bin Reference: https://github.com/glpi-project/glpi/blob/master/apirest.md#get-available-massive-actions-for-an-itemtype
override
getMassiveActionsItem(GlpiItemType itemType, int id) Future<List<Map<String, String>>>
Return the awaitables massive actions for a given itemType and id. Reference: https://github.com/glpi-project/glpi/blob/master/apirest.md#get-available-massive-actions-for-an-item
override
getMultipleItems(List<Map<GlpiItemType, int>> items, {bool expandDropdowns = false, bool getHateoas = true, bool getSha1 = false, bool withDevices = false, bool withDisks = false, bool withSoftwares = false, bool withConnections = false, bool withNetworkPorts = false, bool withInfoComs = false, bool withContracts = false, bool withDocuments = false, bool withTickets = false, bool withProblems = false, bool withChanges = false, bool withNotes = false, bool withLogs = false, List<String>? addKeysNames}) Future<List<Map<String, dynamic>>>
Return multiples items from many types. You must pass a List of Map with the following structure a GlpiItemType as the key and the id of the item as the value. Reference: https://github.com/glpi-project/glpi/blob/master/apirest.md#get-multiple-items.
override
getMyEntities({bool isRecursive = false}) Future<Map<String, dynamic>>
Return the entities list for the current user. Setting isRecursive to true will get the list of all the entities and sub-entities. Entities are under the key myentities Reference: https://github.com/glpi-project/glpi/blob/master/apirest.md#get-my-entities
override
getMyProfiles() Future<Map<String, dynamic>>
Return a Map of all the profile for the current user Profiles are under the key myprofiles Reference: https://github.com/glpi-project/glpi/blob/master/apirest.md#get-my-profiles.
override
getSubItems(GlpiItemType mainItemtype, int mainItemId, GlpiItemType subItemType, {bool expandDropdowns = false, bool getHateoas = true, bool onlyId = false, int rangeStart = 0, int rangeLimit = 50, String sort = 'id', String order = 'ASC', List? addKeysNames}) Future<List<Map<String, dynamic>>>
Return the sub-items of subItemType the item identified by the mainItemId and of type mainItemtype Will throw an Exception if the request fails or if the selected id is incorrect. Reference: https://github.com/glpi-project/glpi/blob/master/apirest.md#get-sub-items
override
getUserProfilePicture(int id) Future<String>
Get a user's profile picture. id must be the id of the user to get the picture. Reference: https://github.com/glpi-project/glpi/blob/master/apirest.md#get-a-users-profile-picture
override
initSessionUsernamePassword(String username, String password, {bool getFullSession = false, bool sendInQuery = false}) Future<Map<String, dynamic>>
Request a session token to uses other API endpoints using a username and password. If getFullSession is set to true, will also return the session details in session. If sendInQuery is set to true, will send the credentials in the query string instead of the header. Will throw an Exception if the session can't be initialized. Reference: https://github.com/glpi-project/glpi/blob/master/apirest.md#init-session.
override
initSessionUserToken(String userToken, {bool getFullSession = false, bool sendInQuery = false}) Future<Map<String, dynamic>>
Request a session token to uses other API endpoints using a userToken. If getFullSession is set to true, will also return the session details in session. If sendInQuery is set to true, will send the credentials in the query string instead of the header. Will throw an Exception if the session can't be initialized. Reference: https://github.com/glpi-project/glpi/blob/master/apirest.md#init-session.
override
killSession() Future<bool>
Return true if the client is successfully disconnected from the API. Will throw an Exception if the session can't be disconnected. Reference: https://github.com/glpi-project/glpi/blob/master/apirest.md#kill-session.
override
listSearchOptions(GlpiItemType itemType) Future<Map<String, dynamic>>
Return all the searchOptions usable in search criteria for a given GlpiItemType.
override
lostPassword(String email, {String? passwordForgetToken, String? newPassword}) Future<bool>
Allow to request a password reset for the account using the email address. Return true if the request is successful BUT this doesn't mean that your glpi is configured to send emails. Check the glpi's configuration to see the prerequisites (notifications need to be enabled). If passwordForgetToken AND newPassword are set, the password will be changed with the value of newPassword instead. Sending passwordForgetToken without newPassword and the opposite will throw an ArgumentError. Reference: https://github.com/glpi-project/glpi/blob/master/apirest.md#lost-password.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
** This method is untested for the moment ** Return items found using the GLPI searchEngine Reference: https://github.com/glpi-project/glpi/blob/master/apirest.md#search-items
override
toString() String
A string representation of this object.
inherited
updateItem(GlpiItemType itemType, int id, Map<String, dynamic> data) Future<Map<String, String>>
Return an array with the updated item id and a message. To correctly format the data, see the examples and the documentation. Reference: https://github.com/glpi-project/glpi/blob/master/apirest.md#update-items
override
updateItems(GlpiItemType itemType, String data) Future<List<Map<String, String>>>
Return the id(s) of the item(s) updated using the data as input. To correctly format the data, see the examples and the documentation. Reference: https://github.com/glpi-project/glpi/blob/master/apirest.md#update-items
override
uploadDocument(covariant dynamic file) Future<Map<String, dynamic>>
Allow to upload a GlpiItemType.Document. file must be a File object. Unsupported on the web. Reference: https://github.com/glpi-project/glpi/blob/master/apirest.md#upload-a-document-file
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited