squint 0.1.0 copy "squint: ^0.1.0" to clipboard
squint: ^0.1.0 copied to clipboard

discontinued
outdatedDart 1 only

Issue labels for hackers.

example/example.dart

import 'dart:math';
import 'dart:io';

import 'package:squint/squint.dart' as squint;
import 'package:pico_log/pico_log.dart';
import 'package:logging/logging.dart';

final log = new Logger('squint.example');

squint.Client _client;

/// The environment must contain certain variables. See README.
void main() {
  LogInit.setup(level: Level.FINE);
  _client = squint.init();
  _checkEnv();
  run();
}

void run() async {
  var labels = await _client.fetch();
  log.info('run: got ${labels.length} labels');
  labels.forEach((ob) => log.fine('\t-> $ob'));

  var _gateway = _client.gateway;
  log.fine('GET-> ${await _gateway.get('bug')}');
  log.fine('PATCH-> ${await _gateway.set('bug', _randomHexRgb)}');

  log.fine('POST-> ${await _gateway.create('tmp', _randomHexRgb)}');
  log.fine('DELETE-> ${(await _gateway.delete('tmp') as String).isEmpty}\n');

  log.info('Have a look!  ${_client.browserUrl}');
}

void _checkEnv() {
  if (!squint.hasEnv) {
    log.severe(
        'Cannot get repository url from the environment; aborting.  See README.');
    exit(2);
  }
}

String get _randomHexRgb => '$_randomHexValue$_randomHexValue$_randomHexValue';
String get _randomHexValue =>
    new Random().nextInt(256).toRadixString(16).padLeft(2, '0');
0
likes
0
points
2
downloads

Publisher

unverified uploader

Weekly Downloads

Issue labels for hackers.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

dotenv, logging, pico_log

More

Packages that depend on squint