dartactyl 1.3.8 copy "dartactyl: ^1.3.8" to clipboard
dartactyl: ^1.3.8 copied to clipboard

outdated

An API client for Pterodactyl Panel

example/dartactyl_example.dart

import 'package:dartactyl/dartactyl.dart';

final panelUrl = 'https://panel.example.com';
String apiKey = '<API-Key>';

void main(List<String> args) async {
  print('Starting!');

  PteroClient client = PteroClient.generate(url: panelUrl, key: apiKey);

  print('Getting Data!');

  await client.listServers().then((response) {
    Server server = response.data[0].attributes;
    print('${server.name} : ${server.description}');
  });

  await client.getAccountInfo().then((response) {
    User accountInfo = response.attributes;
    print('${accountInfo.username} : ${accountInfo.email}');
  });

  print('Done!');
}