dart_autotrader

Creator: coderz1093

Last updated:

0 purchases

dart_autotrader Image
dart_autotrader Images

Languages

Categories

Add to Cart

Description:

dart autotrader

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}');
}
}

copied to clipboard
Additional information #
Issues and feature requests can be filed here.
API was created according to the official Autotrader API documentation

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.