retrieve method
Retrieves a billing meter given an ID
Implementation
Future<BillingMeter> retrieve({
required String id,
List<String>? expand,
}) async {
final $queryParameters = <String, Object>{};
if (expand != null) {
$queryParameters['expand'] = expand;
}
final $uri = Uri.parse('$_baseUri/v1/billing/meters/$id')
.replace(queryParameters: $queryParameters);
final $request = _$http.Request(
'GET',
$uri,
);
$request.headers['Content-Type'] = 'application/x-www-form-urlencoded';
$request.headers['Accept'] = 'application/json';
final $response = await _httpClient.send($request);
final $body = await $response.stream.toBytes();
switch ($response.statusCode) {
/// Successful response.
case 200:
final $json = _$convert.jsonDecode(_$convert.utf8.decode($body));
return BillingMeter.fromJson($json);
/// Error response.
case _:
final $json = _$convert.jsonDecode(_$convert.utf8.decode($body));
throw Error.fromJson($json);
}
}