public async Task<Result> Delete(Action<GlobalParameterDeleteAction> action, CancellationToken cancellationToken = default) { cancellationToken.RequestCanceled(); var impl = new GlobalParameterDeleteActionImpl(); action(impl); if (string.IsNullOrWhiteSpace(impl.ParameterName)) return new FaultedResult(new List<Error> {new ErrorImpl("The name of the parameter is missing.")}); string url = $"api/global-parameters/{impl.ParameterName}"; Result result = await Delete(url, cancellationToken); return result; }
public async Task <Result> Delete(Action <GlobalParameterDeleteAction> action, CancellationToken cancellationToken = default) { cancellationToken.RequestCanceled(); var impl = new GlobalParameterDeleteActionImpl(); action(impl); if (string.IsNullOrWhiteSpace(impl.ParameterName)) { return(new FaultedResult(new List <Error> { new ErrorImpl("The name of the parameter is missing.") }, new DebugInfoImpl(@"api/global-parameters/"))); } string url = $"api/global-parameters/{impl.ParameterName}"; return(await Delete(url, cancellationToken).ConfigureAwait(false)); }
public async Task <Result> DeleteAsync(Action <GlobalParameterDeleteAction> action, CancellationToken cancellationToken = new CancellationToken()) { cancellationToken.RequestCanceled(LogInfo); var impl = new GlobalParameterDeleteActionImpl(); action(impl); if (string.IsNullOrWhiteSpace(impl.ParameterName)) { throw new ParameterMissingException("The name of the parameter is missing."); } string url = $"api/global-parameters/{impl.ParameterName}"; HttpResponseMessage response = await HttpDelete(url, cancellationToken); Result result = response.GetResponse(); LogInfo($"Sent request to RabbitMQ server to delete a global parameter '{impl.ParameterName}'."); return(result); }