getLabels method

Future<GetLabelsResult> getLabels({
  1. int? maxResults,
  2. String? name,
  3. String? nextToken,
})

Gets all labels or a specific label if name is provided. This is a paginated API. If you provide a null maxResults, this action retrieves a maximum of 50 records per page. If you provide a maxResults, the value must be between 10 and 50. To get the next page results, provide the pagination token from the GetGetLabelsResponse as part of your request. A null pagination token fetches the records from the beginning.

May throw ValidationException. May throw ResourceNotFoundException. May throw InternalServerException. May throw AccessDeniedException.

Parameter maxResults : The maximum number of objects to return for the request.

Parameter name : The name of the label or labels to get.

Parameter nextToken : The next token for the subsequent request.

Implementation

Future<GetLabelsResult> getLabels({
  int? maxResults,
  String? name,
  String? nextToken,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    10,
    50,
  );
  _s.validateStringLength(
    'name',
    name,
    1,
    64,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSHawksNestServiceFacade.GetLabels'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      if (maxResults != null) 'maxResults': maxResults,
      if (name != null) 'name': name,
      if (nextToken != null) 'nextToken': nextToken,
    },
  );

  return GetLabelsResult.fromJson(jsonResponse.body);
}