dart_autotrader 2.0.0 copy "dart_autotrader: ^2.0.0" to clipboard
dart_autotrader: ^2.0.0 copied to clipboard

An Autotrader API library for dart and flutter developers

An Autotrader API library for Dart developers

Features #

[x] Authentication [x] Vehicle info with valuations

Usage #

import 'package:chopper/chopper.dart';
import 'package:dart_autotrader/dart_autotrader.dart';

Future<void> main() async {
  final chopper = ChopperClient(
    baseUrl: Uri.parse("https://api-sandbox.autotrader.co.uk"),
    converter: MapperConverter(),
  );

  final at = Autotrader.create(chopper);

  final tokenResponse =
      await at.authenticate(key: 'my-api-key', secret: 'my-secret');

  final token = tokenResponse.body?.accessToken;

  if (!tokenResponse.isSuccessful || token == null) {
    throw Exception('Failed to get token');
  }

  final response = await at.getServiceStockManagementVehicleValuation(
    registration: 'AB12CDE',
    odometerReadingMiles: 8000,
    token: "Bearer $token",
  );

  if (response.isSuccessful) {
    print(response.body?.valuations?.trade?.amountGBP);
  } else {
    print('Error (${response.statusCode}): ${response.error}');
  }
}

Additional information #

Issues and feature requests can be filed here.

API was created according to the official Autotrader API documentation

0
likes
120
pub points
0%
popularity

Publisher

unverified uploader

An Autotrader API library for dart and flutter developers

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (LICENSE)

Dependencies

chopper, dart_mappable, intl

More

Packages that depend on dart_autotrader