getPublisherModel method

Future<PublisherModel> getPublisherModel(
  1. GetPublisherModelRequest request
)

Gets a Model Garden publisher model.

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<PublisherModel> getPublisherModel(
  GetPublisherModelRequest request,
) async {
  final url = Uri.https(_host, '/v1beta1/${request.name}', {
    if (request.languageCode case final $1 when $1.isNotDefault)
      'languageCode': $1,
    if (request.view case final $1 when $1.isNotDefault) 'view': $1.value,
    if (request.isHuggingFaceModel case final $1 when $1.isNotDefault)
      'isHuggingFaceModel': '${$1}',
    if (request.huggingFaceToken case final $1 when $1.isNotDefault)
      'huggingFaceToken': $1,
    if (request.includeEquivalentModelGardenModelDeploymentConfigs
        case final $1 when $1.isNotDefault)
      'includeEquivalentModelGardenModelDeploymentConfigs': '${$1}',
  });
  final response = await _client.get(url);
  return PublisherModel.fromJson(response);
}