createSchema method

Future<CreateSchemaResponse> createSchema({
  1. required String content,
  2. required String registryName,
  3. required String schemaName,
  4. required Type type,
  5. String? description,
  6. Map<String, String>? tags,
})

Creates a schema definition.

May throw BadRequestException. May throw ForbiddenException. May throw InternalServerErrorException. May throw ServiceUnavailableException.

Parameter content : The source of the schema definition.

Parameter registryName : The name of the registry.

Parameter schemaName : The name of the schema.

Parameter type : The type of schema.

Parameter description : A description of the schema.

Parameter tags : Tags associated with the schema.

Implementation

Future<CreateSchemaResponse> createSchema({
  required String content,
  required String registryName,
  required String schemaName,
  required Type type,
  String? description,
  Map<String, String>? tags,
}) async {
  final $payload = <String, dynamic>{
    'Content': content,
    'Type': type.value,
    if (description != null) 'Description': description,
    if (tags != null) 'tags': tags,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri:
        '/v1/registries/name/${Uri.encodeComponent(registryName)}/schemas/name/${Uri.encodeComponent(schemaName)}',
    exceptionFnMap: _exceptionFns,
  );
  return CreateSchemaResponse.fromJson(response);
}