createQuote method

Future<QuoteCreated> createQuote(
  1. Create create
)

At least one electricity or gas meter-point must be included. A maximum of one electricity and one gas meter-point can be included at this time. For all meter-points, at least one of gsp or postcode must be included. All meter-points must be based in the UK, excluding Northern Ireland. All meter-points must belong to the same gsp or postcode. WARNING: This endpoint is only available to partner organisations.

Implementation

Future<QuoteCreated> createQuote(
  Create create,
) async {
  final response = await _client.post(
    Uri.https(
      authority,
      '/v1/quotes/',
    ),
    headers: {
      'content-type': 'application/json',
    },
    body: json.encode(create.toJson()),
  );

  OctopusEnergyApiClientException.checkIsSuccessStatusCode(response);

  return QuoteCreated.fromJson(json.decode(response.body));
}