getFeature method

Future<Feature> getFeature(
  1. GetFeatureRequest request
)

Gets details of a single Feature.

Throws a http.ClientException if there were problems communicating with the API service. Throws a StatusException if the API failed with a Status message. Throws a ServiceException for any other failure.

Implementation

Future<Feature> getFeature(GetFeatureRequest request) async {
  final url = Uri.https(_host, '/v1beta1/${request.name}', {
    if (request.featureStatsAndAnomalySpec!.latestStatsCount != null)
      'featureStatsAndAnomalySpec.latestStatsCount':
          '${request.featureStatsAndAnomalySpec!.latestStatsCount}',
    if (request.featureStatsAndAnomalySpec!.statsTimeRange!.startTime != null)
      'featureStatsAndAnomalySpec.statsTimeRange.startTime': request
          .featureStatsAndAnomalySpec!
          .statsTimeRange!
          .startTime!
          .toJson(),
    if (request.featureStatsAndAnomalySpec!.statsTimeRange!.endTime != null)
      'featureStatsAndAnomalySpec.statsTimeRange.endTime': request
          .featureStatsAndAnomalySpec!
          .statsTimeRange!
          .endTime!
          .toJson(),
  });
  final response = await _client.get(url);
  return Feature.fromJson(response);
}