createAccount method

Future<SuccessResponse> createAccount(
  1. Create create
)

WARNING: This endpoint is only available to partner organisations.

Implementation

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

  OctopusEnergyApiClientException.checkIsSuccessStatusCode(response);

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