updateType method

Future<UpdateTypeResponse> updateType({
  1. required String apiId,
  2. required TypeDefinitionFormat format,
  3. required String typeName,
  4. String? definition,
})

Updates a Type object.

May throw BadRequestException. May throw ConcurrentModificationException. May throw NotFoundException. May throw UnauthorizedException. May throw InternalFailureException.

Parameter apiId : The API ID.

Parameter format : The new type format: SDL or JSON.

Parameter typeName : The new type name.

Parameter definition : The new definition.

Implementation

Future<UpdateTypeResponse> updateType({
  required String apiId,
  required TypeDefinitionFormat format,
  required String typeName,
  String? definition,
}) async {
  ArgumentError.checkNotNull(apiId, 'apiId');
  ArgumentError.checkNotNull(format, 'format');
  ArgumentError.checkNotNull(typeName, 'typeName');
  _s.validateStringLength(
    'typeName',
    typeName,
    1,
    65536,
    isRequired: true,
  );
  final $payload = <String, dynamic>{
    'format': format.toValue(),
    if (definition != null) 'definition': definition,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri:
        '/v1/apis/${Uri.encodeComponent(apiId)}/types/${Uri.encodeComponent(typeName)}',
    exceptionFnMap: _exceptionFns,
  );
  return UpdateTypeResponse.fromJson(response);
}