glpi_dart 0.1.4 copy "glpi_dart: ^0.1.4" to clipboard
glpi_dart: ^0.1.4 copied to clipboard

outdated

This library is a wrapper around the GLPI API, it provides a simple way to access he API. It is based on the Dart http library so it can be used ont dartvm and dartweb.

example/lib/main.dart

import 'package:glpi_dart/glpi_dart.dart';

void main() async {
  // We recommend to use a secret management library like dotenv
  // to store your credentials in a file
  String username = 'admin';
  String password = 'admin';
  String baseUrl = 'http://example.com/apirest.php';

  // Create the client BUT doesn't get the session token
  GlpiClient client = GlpiClient.withLogin(baseUrl, username, password);

  // Get the session token
  try {
    await client.initSession();
  } on GlpiException catch (e) {
    // In case of will get the http status code (e.code) and the message (e.reason['error'])
    print('${e.code} - ${e.error} - ${e.message}');
  }

  print(client.sessionToken);
}


import 'package:glpi_dart/glpi_dart.dart';

void main() async {
  // We recommend to use a secret management library like dotenv
  // to store your credentials in a file
  String userToken = 'abcedfghijklmnopqrstuvwxyz123467890';
  String appToken = '0987654321zyxwvutsrqponmlkjihgfedcba';
  String baseUrl = 'http://example.com/apirest.php';

  // Create the client BUT doesn't get the session token
  GlpiClient client = GlpiClient.withToken(baseUrl, userToken, appToken);

  // Get the session token
  try {
    await client.initSession();
  } on GlpiException catch (e) {
    // In case of will get the http status code (e.code) and the message (e.reason['error'])
    print('${e.code} - ${e.error} - ${e.message}');
  }

  print(client.sessionToken);
}
1
likes
0
pub points
0%
popularity

Publisher

verified publisherprojetretro.io

This library is a wrapper around the GLPI API, it provides a simple way to access he API. It is based on the Dart http library so it can be used ont dartvm and dartweb.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

http

More

Packages that depend on glpi_dart