VoidResponse

Namespace: Elasticsearch.Net
We found 10 examples in language CSharp for this search. You will see 36 fragments of code.
	
	    public static VoidResponse GetInstance() {
		    return VoidResponse.VOID_RESPONSE_INSTANCE;
	    }


		private static VoidResponse ValidVoidSaleResponse()
		{
			return new VoidResponse
			{
				HttpStatus = HttpStatusCode.OK,
				Links = new List<Link>()
				{
					new Link
					{
						Href = "self",
						Method = "GET",
						Rel = "https://apisandbox.braspag.com.br/v2/sales/" + Guid.NewGuid()
					}
				},
				ReasonCode = 0,
				Status = 10,
				ReasonMessage = "Successful",
				ErrorDataCollection = null
			};
		}

namespace holonsoft.NoQBus.Abstractions.Models
{
	public record VoidResponse : ResponseBase
	{
		private record VoidMessage : MessageBase
		{
		}

		public static readonly VoidResponse Instance = new();
		public VoidResponse() : base(new VoidMessage()) { }
	}
}

        public static VoidResponse ComAlerta(string mensagem, params string[] outrasMensagens)
        {
            var mensagens = (new [] { mensagem }).Concat(outrasMensagens).ToList();

            var response = new VoidResponse();
            mensagens.ForEach(msg => response.AddAlerta(msg));
            return response;
        }

        public static VoidResponse Vazio()
        {
            return new VoidResponse();
        }

        public static VoidResponse Erro(string mensagem, params string[] outrasMensagens)
        {
            var mensagens = (new[] { mensagem }).Concat(outrasMensagens).ToList();
            var response = new VoidResponse();
            mensagens.ForEach(msg => response.AddErro(msg));
            return response;
        }

        public static VoidResponse Ok()
        {
            return new VoidResponse();
        }

        public static VoidResponse Ok(params string[] mensagens)
        {
            var response = new VoidResponse();
            Array.ForEach(mensagens, msg => response.AddSucesso(msg));
            return response;
        }


        public Response GetRawResponse()
        {
            return DoesWrapOperation ? Operation!.RawResponse : VoidResponse!;
        }

        public Response UpdateStatus(CancellationToken cancellationToken = default)
        {
            return DoesWrapOperation ? Operation!.UpdateStatus(cancellationToken) : VoidResponse!;
        }

        public ValueTask<Response> UpdateStatusAsync(CancellationToken cancellationToken = default)
        {
            return DoesWrapOperation
                ? Operation!.UpdateStatusAsync(cancellationToken)
                : new ValueTask<Response>(VoidResponse!);
        }

        public async ValueTask<Response> WaitForCompletionResponseAsync(
            TimeSpan pollingInterval,
            CancellationToken cancellationToken)
        {
            return DoesWrapOperation
                ? await Operation!.WaitForCompletionResponseAsync(pollingInterval, cancellationToken).ConfigureAwait(false)
                : VoidResponse!;
        }


        public VoidResponse AddMensagem(TipoMensagem tipo, string texto)
        {
            if (texto == null) throw new ArgumentNullException("texto");
            _mensagens.Add(new Mensagem(texto, tipo));
            return this;
        }


        public VoidResponse Delete(SchoolDeleteRequest request)
        {
            return Execute<SchoolDeleteRequest, VoidResponse>(
                request,
                response => SchoolFacade.Delete(request.SchoolId));

        }


        public VoidResponse CreateUser(SchoolUserRequest request)
        {
            return Execute<SchoolUserRequest, VoidResponse>(
                request,
                response => SchoolFacade.CreateUser(request.SchoolId, request.UserId));
        }

        public VoidResponse DeleteUser(SchoolUserRequest request)
        {
            return Execute<SchoolUserRequest, VoidResponse>(
                request,
                response => SchoolFacade.DeleteUser(request.SchoolId, request.UserId));
        }

        public VoidResponse UpdateSchoolAnnualAgreement(SchoolAnnualAgreementRequest request)
        {
            return Execute<SchoolAnnualAgreementRequest, VoidResponse>(
                request,
                response => SchoolFacade.UpdateAnnualAgreement(request.SchoolId, request.SchoolAnnualAgreement));
        }

        public VoidResponse DeleteSchoolAnnualAgreement(SchoolAnnualAgreementRequest request)
        {
            return Execute<SchoolAnnualAgreementRequest, VoidResponse>(
                request,
                response => SchoolFacade.DeleteAnnualAgreement(request.SchoolId, request.SchoolAnnualAgreement));
        }

        public VoidResponse CreateContactInfo(CreateContactInfoRequest request)
        {
            return Execute<CreateContactInfoRequest, VoidResponse>(
                request,
                response => SchoolFacade.CreateContactInfo(request.ContactInfo));
        }

        public static TResponse AddAlerta<TResponse>(this TResponse response, string texto) where TResponse : VoidResponse
        {
            if (response == null) throw new ArgumentNullException("response");
            if (texto == null) throw new ArgumentNullException("texto");

            response.AddMensagem(TipoMensagem.Alerta, texto);

            return response;
        }

        public static TResponse AddInfo<TResponse>(this TResponse response, string texto) where TResponse : VoidResponse
        {
            if (response == null) throw new ArgumentNullException("response");
            if (texto == null) throw new ArgumentNullException("texto");

            response.AddMensagem(TipoMensagem.Info, texto);
            return response;
        }

        public static TResponse AddSucesso<TResponse>(this TResponse response, string texto) where TResponse : VoidResponse
        {
            if (response == null) throw new ArgumentNullException("response");
            if (texto == null) throw new ArgumentNullException("texto");

            response.AddMensagem(TipoMensagem.Sucesso, texto);
            return response;

        }

        public static TResponse AddErro<TResponse>(this TResponse response, string texto) where TResponse : VoidResponse
        {
            if (response == null) throw new ArgumentNullException("response");
            if (texto == null) throw new ArgumentNullException("texto");

            response.AddMensagem(TipoMensagem.Erro, texto);
            return response;

        }

        public static TResponse AddErroCritico<TResponse>(this TResponse response, string texto) where TResponse : VoidResponse
        {
            if (response == null) throw new ArgumentNullException("response");
            if (texto == null) throw new ArgumentNullException("texto");

            response.AddMensagem(TipoMensagem.ErroCritico, texto);

            return response;
        }

        

        [OperationContract]
        VoidResponse Delete(SchoolDeleteRequest request);
        

        [OperationContract]
        VoidResponse CreateUser(SchoolUserRequest request);

        [OperationContract]
        VoidResponse DeleteUser(SchoolUserRequest request);

        [OperationContract]
        VoidResponse CreateSchoolAnnualAgreement(SchoolAnnualAgreementRequest request);
        
        [OperationContract]
        VoidResponse UpdateSchoolAnnualAgreement(SchoolAnnualAgreementRequest request);
        
        [OperationContract]
        VoidResponse DeleteSchoolAnnualAgreement(SchoolAnnualAgreementRequest request);

        [TestMethod]
        public void RefundRequestOkTest()
        {
            var headers = new Dictionary<String, String>();
            string authorization = "TODOPAGO ABCDEF1234567890";
            headers.Add("Authorization", authorization);
            
            TodoPagoMockConnector restConnector = new TodoPagoMockConnector("https://developers.todopago.com.ar/t/1.1/api/", headers);
            restConnector.SetRequestResponse(RefundDataProvider.ReturnRequestOkResponse());
            TPConnectorMock connector = new TPConnectorMock(TPConnector.developerEndpoint, headers, restConnector);

            Dictionary<string, string> gbrdt = new Dictionary<string, string>();

            gbrdt.Add(ElementNames.MERCHANT, "2669");
            gbrdt.Add(ElementNames.SECURITY, "108fc2b7c8a640f2bdd3ed505817ffde");
            gbrdt.Add(ElementNames.REQUESTKEY, "0d801e1c-e6b1-672c-b717-5ddbe5ab97d6");
            gbrdt.Add(ElementNames.AMOUNT, "1");

            Dictionary<string, object> response = connector.ReturnRequest(gbrdt);

            Assert.AreNotEqual(null, response);

            Assert.AreEqual(true, response.Count > 0);

            Assert.AreEqual(true, response.ContainsKey("ReturnResponse"));

            Dictionary<string, object> returnResponse = (Dictionary<string, object>)response["ReturnResponse"];

            Assert.AreEqual(true, returnResponse.Count > 0);

            Assert.AreEqual(true, returnResponse.ContainsKey("StatusCode"));
            Assert.AreEqual(true, returnResponse.ContainsKey("StatusMessage"));

            Assert.AreEqual(2011, (long)returnResponse["StatusCode"]);
        }

        [TestMethod]
        public void RefundRequestFailTest()
        {
            var headers = new Dictionary<String, String>();
            string authorization = "TODOPAGO ABCDEF1234567890";
            headers.Add("Authorization", authorization);
            
            TodoPagoMockConnector restConnector = new TodoPagoMockConnector("https://developers.todopago.com.ar/t/1.1/api/", headers);
            restConnector.SetRequestResponse(RefundDataProvider.ReturnRequestFailResponse());
            TPConnectorMock connector = new TPConnectorMock(TPConnector.developerEndpoint, headers, restConnector);

            Dictionary<string, string> gbrdt = new Dictionary<string, string>();

            gbrdt.Add(ElementNames.MERCHANT, "2669");
            gbrdt.Add(ElementNames.SECURITY, "108fc2b7c8a640f2bdd3ed505817ffde");
            gbrdt.Add(ElementNames.REQUESTKEY, "0d801e1c-e6b1-672c-b717-5ddbe5ab97d6");
            gbrdt.Add(ElementNames.AMOUNT, "1");

            Dictionary<string, object> response = connector.ReturnRequest(gbrdt);

            Assert.AreNotEqual(null, response);

            Assert.AreEqual(true, response.Count > 0);

            Assert.AreEqual(true, response.ContainsKey("ReturnResponse"));

            Dictionary<string, object> returnResponse = (Dictionary<string, object>)response["ReturnResponse"];

            Assert.AreEqual(true, returnResponse.Count > 0);

            Assert.AreEqual(true, returnResponse.ContainsKey("StatusCode"));
            Assert.AreEqual(true, returnResponse.ContainsKey("StatusMessage"));

            Assert.AreNotEqual(2011, (long)returnResponse["StatusCode"]);
        }

        [TestMethod]
        public void RefundRequest702Test()
        {
            var headers = new Dictionary<String, String>();
            string authorization = "TODOPAGO ABCDEF1234567890";
            headers.Add("Authorization", authorization);
            
            TodoPagoMockConnector restConnector = new TodoPagoMockConnector("https://developers.todopago.com.ar/t/1.1/api/", headers);
            restConnector.SetRequestResponse(RefundDataProvider.ReturnRequest702Response());
            TPConnectorMock connector = new TPConnectorMock(TPConnector.developerEndpoint, headers, restConnector);

            Dictionary<string, string> gbrdt = new Dictionary<string, string>();

            gbrdt.Add(ElementNames.MERCHANT, "2669");
            gbrdt.Add(ElementNames.SECURITY, "108fc2b7c8a640f2bdd3ed505817ffde");
            gbrdt.Add(ElementNames.REQUESTKEY, "0d801e1c-e6b1-672c-b717-5ddbe5ab97d6");
            gbrdt.Add(ElementNames.AMOUNT, "1");

            Dictionary<string, object> response = connector.ReturnRequest(gbrdt);

            Assert.AreNotEqual(null, response);

            Assert.AreEqual(true, response.Count > 0);

            Assert.AreEqual(true, response.ContainsKey("ReturnResponse"));

            Dictionary<string, object> returnResponse = (Dictionary<string, object>)response["ReturnResponse"];

            Assert.AreEqual(true, returnResponse.Count > 0);

            Assert.AreEqual(true, returnResponse.ContainsKey("StatusCode"));
            Assert.AreEqual(true, returnResponse.ContainsKey("StatusMessage"));

            Assert.AreNotEqual(2011, (long)returnResponse["StatusCode"]);
            Assert.AreEqual(702, (long)returnResponse["StatusCode"]);
        }

        [TestMethod]
        public void VoidRequestOkTest()
        {
            var headers = new Dictionary<String, String>();
            string authorization = "TODOPAGO ABCDEF1234567890";
            headers.Add("Authorization", authorization);
            
            TodoPagoMockConnector restConnector = new TodoPagoMockConnector("https://developers.todopago.com.ar/t/1.1/api/", headers);
            restConnector.SetRequestResponse(RefundDataProvider.VoidRequestOkResponse());
            TPConnectorMock connector = new TPConnectorMock(TPConnector.developerEndpoint, headers, restConnector);

            Dictionary<string, string> gbrdt = new Dictionary<string, string>();

            gbrdt.Add(ElementNames.MERCHANT, "2669");
            gbrdt.Add(ElementNames.SECURITY, "108fc2b7c8a640f2bdd3ed505817ffde");
            gbrdt.Add(ElementNames.REQUESTKEY, "0d801e1c-e6b1-672c-b717-5ddbe5ab97d6");

            Dictionary<string, object> response = connector.VoidRequest(gbrdt);

            Assert.AreNotEqual(null, response);

            Assert.AreEqual(true, response.Count > 0);

            Assert.AreEqual(true, response.ContainsKey("VoidResponse"));

            Dictionary<string, object> voidResponse = (Dictionary<string, object>)response["VoidResponse"];

            Assert.AreEqual(true, voidResponse.Count > 0);

            Assert.AreEqual(true, voidResponse.ContainsKey("StatusCode"));
            Assert.AreEqual(true, voidResponse.ContainsKey("StatusMessage"));

            Assert.AreEqual(2011, (long)voidResponse["StatusCode"]);
        }

        [TestMethod]
        public void VoidRequestFailTest()
        {
            var headers = new Dictionary<String, String>();
            string authorization = "TODOPAGO ABCDEF1234567890";
            headers.Add("Authorization", authorization);
            
            TodoPagoMockConnector restConnector = new TodoPagoMockConnector("https://developers.todopago.com.ar/t/1.1/api/", headers);
            restConnector.SetRequestResponse(RefundDataProvider.VoidRequestFailResponse());
            TPConnectorMock connector = new TPConnectorMock(TPConnector.developerEndpoint, headers, restConnector);

            Dictionary<string, string> gbrdt = new Dictionary<string, string>();

            gbrdt.Add(ElementNames.MERCHANT, "2669");
            gbrdt.Add(ElementNames.SECURITY, "108fc2b7c8a640f2bdd3ed505817ffde");
            gbrdt.Add(ElementNames.REQUESTKEY, "0d801e1c-e6b1-672c-b717-5ddbe5ab97d6");

            Dictionary<string, object> response = connector.VoidRequest(gbrdt);

            Assert.AreNotEqual(null, response);

            Assert.AreEqual(true, response.Count > 0);

            Assert.AreEqual(true, response.ContainsKey("VoidResponse"));

            Dictionary<string, object> voidResponse = (Dictionary<string, object>)response["VoidResponse"];

            Assert.AreEqual(true, voidResponse.Count > 0);

            Assert.AreEqual(true, voidResponse.ContainsKey("StatusCode"));
            Assert.AreEqual(true, voidResponse.ContainsKey("StatusMessage"));

            Assert.AreNotEqual(2011, (long)voidResponse["StatusCode"]);
        }

        [TestMethod]
        public void VoidRequest702Test()
        {
            var headers = new Dictionary<String, String>();
            string authorization = "TODOPAGO ABCDEF1234567890";
            headers.Add("Authorization", authorization);
            
            TodoPagoMockConnector restConnector = new TodoPagoMockConnector("https://developers.todopago.com.ar/t/1.1/api/", headers);
            restConnector.SetRequestResponse(RefundDataProvider.VoidRequest702Response());
            TPConnectorMock connector = new TPConnectorMock(TPConnector.developerEndpoint, headers, restConnector);

            Dictionary<string, string> gbrdt = new Dictionary<string, string>();

            gbrdt.Add(ElementNames.MERCHANT, "2669");
            gbrdt.Add(ElementNames.SECURITY, "108fc2b7c8a640f2bdd3ed505817ffde");
            gbrdt.Add(ElementNames.REQUESTKEY, "0d801e1c-e6b1-672c-b717-5ddbe5ab97d6");

            Dictionary<string, object> response = connector.VoidRequest(gbrdt);

            Assert.AreNotEqual(null, response);

            Assert.AreEqual(true, response.Count > 0);

            Assert.AreEqual(true, response.ContainsKey("VoidResponse"));

            Dictionary<string, object> voidResponse = (Dictionary<string, object>)response["VoidResponse"];

            Assert.AreEqual(true, voidResponse.Count > 0);

            Assert.AreEqual(true, voidResponse.ContainsKey("StatusCode"));
            Assert.AreEqual(true, voidResponse.ContainsKey("StatusMessage"));

            Assert.AreNotEqual(2011, (long)voidResponse["StatusCode"]);
            Assert.AreEqual(702, (long)voidResponse["StatusCode"]);
        }

Elasticsearch.Net.VoidResponse : IApiCallDetails, IElasticsearchResponse

Constructors :

public VoidResponse()

Methods :

public VoidBody get_Body()
public IApiCallDetails get_ApiCall()
public Void set_ApiCall(IApiCallDetails value = )
public ReadOnlyDictionary<TcpState, Int32> get_TcpStats()
public Void set_TcpStats(ReadOnlyDictionary<TcpState, Int32> value = )
public String get_DebugInformation()
public HttpMethod get_HttpMethod()
public List<Audit> get_AuditTrail()
public Void set_AuditTrail(List<Audit> value = )
public ReadOnlyDictionary<String, ThreadPoolStatistics> get_ThreadPoolStats()
public Void set_ThreadPoolStats(ReadOnlyDictionary<String, ThreadPoolStatistics> value = )
public IEnumerable<String> get_DeprecationWarnings()
public String get_ProductName()
public Boolean get_SuccessOrKnownError()
public Nullable<Int32> get_HttpStatusCode()
public Boolean get_Success()
public Exception get_OriginalException()
public String get_ResponseMimeType()
public Uri get_Uri()
public Action<StringBuilder> get_BuildDebugInformationPrefix()
public IConnectionConfigurationValues get_ConnectionConfiguration()
public Byte[] get_ResponseBodyInBytes()
public Byte[] get_RequestBodyInBytes()
public Boolean TryGetServerError(ServerError& serverError = )
public String ToString()
public Type GetType()
public Boolean Equals(Object obj = )
public Int32 GetHashCode()