// Copyright © WireMock.Net using System; using System.Collections.Generic; using System.Text; using System.Threading.Tasks; using JsonConverter.Abstractions; namespace WireMock.ResponseBuilders; /// /// The BodyResponseBuilder interface. /// public interface IBodyResponseBuilder : IFaultResponseBuilder { /// /// WithBody : Create a ... response based on a string. /// /// The body. /// The Body Destination format (SameAsSource, String or Bytes). /// The body encoding. /// A . IResponseBuilder WithBody(string body, string? destination = BodyDestinationFormat.SameAsSource, Encoding? encoding = null); /// /// WithBody : Create a ... response based on a callback function. /// /// The delegate to build the body. /// The Body Destination format (SameAsSource, String or Bytes). /// The body encoding. /// A . IResponseBuilder WithBody(Func bodyFactory, string? destination = BodyDestinationFormat.SameAsSource, Encoding? encoding = null); /// /// WithBody : Create a ... response based on a async callback function. /// /// The async delegate to build the body. /// The Body Destination format (SameAsSource, String or Bytes). /// The body encoding. /// A . IResponseBuilder WithBody(Func> bodyFactory, string? destination = BodyDestinationFormat.SameAsSource, Encoding? encoding = null); /// /// WithBody : Create a ... response based on a bytearray. /// /// The body. /// The Body Destination format (SameAsSource, String or Bytes). /// The body encoding. /// A . IResponseBuilder WithBody(byte[] body, string? destination = BodyDestinationFormat.SameAsSource, Encoding? encoding = null); /// /// WithBody : Create a string response based on a object (which will be converted to a JSON string). /// /// The body. /// The body encoding. /// Define whether child objects to be indented according to the Newtonsoft.Json.JsonTextWriter.Indentation and Newtonsoft.Json.JsonTextWriter.IndentChar settings. /// A . IResponseBuilder WithBodyAsJson(object body, Encoding? encoding = null, bool? indented = null); /// /// WithBody : Create a string response based on a object (which will be converted to a JSON string). /// /// The body. /// Define whether child objects to be indented according to the Newtonsoft.Json.JsonTextWriter.Indentation and Newtonsoft.Json.JsonTextWriter.IndentChar settings. /// A . IResponseBuilder WithBodyAsJson(object body, bool indented); /// /// WithBodyAsJson : Create a ... response based on a callback function. /// /// The delegate to build the body. /// The body encoding. /// A . IResponseBuilder WithBodyAsJson(Func bodyFactory, Encoding? encoding = null); /// /// WithBodyAsJson : Create a ... response based on a async callback function. /// /// The async delegate to build the body. /// The body encoding. /// A . IResponseBuilder WithBodyAsJson(Func> bodyFactory, Encoding? encoding = null); /// /// WithBodyFromFile : Create a ... response based on a File. /// /// The filename. /// Defines if this file is cached in memory or retrieved from disk every time the response is created. /// A . IResponseBuilder WithBodyFromFile(string filename, bool cache = true); /// /// WithBody : Create a string response based on a object (which will be converted to a JSON string using the ). /// /// The body. /// The . /// The [optional]. /// A . IResponseBuilder WithBody(object body, IJsonConverter jsonConverter, JsonConverterOptions? options = null); /// /// WithBody : Create a string response based on a object (which will be converted to a JSON string using the ). /// /// The body. /// The body encoding, can be null. /// The . /// The [optional]. /// A . IResponseBuilder WithBody(object body, Encoding? encoding, IJsonConverter jsonConverter, JsonConverterOptions? options = null); /// /// WithBodyAsProtoBuf : Create a ProtoBuf byte[] response based on a proto definition, message type and the value. /// /// The proto definition as text. /// The full type of the protobuf (request/response) message object. Format is "{package-name}.{type-name}". /// The object to convert to protobuf byte[]. /// The [optional]. Default value is NewtonsoftJsonConverter. /// The [optional]. /// A . IResponseBuilder WithBodyAsProtoBuf( string protoDefinition, string messageType, object value, IJsonConverter? jsonConverter = null, JsonConverterOptions? options = null ); /// /// WithBodyAsProtoBuf : Create a ProtoBuf byte[] response based on proto definitions, message type and the value. /// /// The proto definition as text. /// The full type of the protobuf (request/response) message object. Format is "{package-name}.{type-name}". /// The object to convert to protobuf byte[]. /// The [optional]. Default value is NewtonsoftJsonConverter. /// The [optional]. /// A . IResponseBuilder WithBodyAsProtoBuf( IReadOnlyList protoDefinitions, string messageType, object value, IJsonConverter? jsonConverter = null, JsonConverterOptions? options = null ); /// /// WithBodyAsProtoBuf : Create a ProtoBuf byte[] response based on a proto definition, message type and the value. /// /// The full type of the protobuf (request/response) message object. Format is "{package-name}.{type-name}". /// The object to convert to protobuf byte[]. /// The [optional]. Default value is NewtonsoftJsonConverter. /// The [optional]. /// A . IResponseBuilder WithBodyAsProtoBuf( string messageType, object value, IJsonConverter? jsonConverter = null, JsonConverterOptions? options = null ); }