Skip to content

Releases: lindar-open/well-rested-client

Well Rested Client 1.1.1 Release

06 Jul 17:04
Compare
Choose a tag to compare
  • Add orElseProcessResult method to the Result.class - this allows you process the actual Result got and return a new one with similar values (eg: empty data but same message and status code):
return sendVerification(phoneNumber)
                .flatMap(phoneVerification -> {
                // do something here with the phone verification
                return ResultFactory.successful(phoneVerification);
       }).orElseProcessResult(ResultFactory::<SmsVerificationState>failed))
  • Update commons-lang and gson dependencies

Well Rested Client 1.1.0 Release

05 Jul 10:05
Compare
Choose a tag to compare

Major release that improves considerably the Result, ResultFactory and WellRestedRequest classes:

  • remove Result constructors and add a Builder instead
  • add the visible attribute to Result
  • the ResultFactory api has been rewritten to be easier to read and more concise:
    • getSuccessfulResult becomes successful
    • getFailResult becomes failed
    • getSuccessfulResultMsg becomes successfulMsg
  • two copy methods have been added to ResultFactory which can be used to quickly create a generic result from another result (by keeping the message and status code):
    • public static <T, U> Result<T> failed(Result<U> anotherResult)
    • public static <T, U> Result<T> copyWithoutData(Result<U> anotherResult)
  • add fields and classes exclusion strategy to WellRestedRequest class:
    • you can simply call the excludeFields(List<String> fieldNames) or excludeClasses(Set<String> classNames) methods or add your own exclusion strategy: setExclusionStrategy(ExclusionStrategy exclusionStrategy)
    • NOTE: the exclusion strategy works only for json requests and responses. The actual strategy class is Gson implementation.
  • update lombok version to 1.16.16

Well Rested Client 1.0.4 Release

05 Jul 09:52
Compare
Choose a tag to compare

Quick release that updates some pom dependencies

Well Rested Client 1.0.3 Release

05 Jul 09:50
Compare
Choose a tag to compare

Major refactor and improvements for the Result class:

  • refactor existing methods to check if the response is successful and the returned data is not null
  • add public void ifSuccessAndNotNull(Consumer<? super T> consumer)
  • add public T orElseDoAndReturnDefault(Runnable function, T defaultVal)
  • add public T orElseDoAndReturnDefault(Consumer<Result<T>> consumer, T defaultVal)
  • add public void execute(Consumer<Result<T>> consumer)
  • add public T execute(Consumer<Result<T>> consumer, T defaultVal)

The Result class is now much more flexible and helpful in processing the http response

Well Rested Client 1.0.2 Release

18 Apr 15:33
Compare
Choose a tag to compare
  • Added empty PUT method (no request object)
  • Added response code attribute to Result class

Well Rested Client 1.0.1 Release

17 Mar 11:30
Compare
Choose a tag to compare

Release 1.0.1 comes with:

  • support for custom date serializers and deserializers and date formats:

Set date format (please note, the date format overrides any set serializers and deserializers):

ResponseVO serverResponse = WellRestedRequest.build(url).setDateFormat("yyyy-MM-dd").post(myObj);

Set provided String date serializer with custom format, Long date serializer or your own serializer:

ResponseVO serverResponse = WellRestedRequest.build(url).setDateSerializer(new StringDateSerializer("yyyy/MM/dd")).post(myObj); 
ResponseVO serverResponse = WellRestedRequest.build(url).setDateSerializer(new LongDateSerializer()).post(myObj); 
ResponseVO serverResponse = WellRestedRequest.build(url).setDateSerializer(new MyCustomDateSerializer()).post(myObj); 

Set provided date Deserializer with custom formats or your own deserializer:

ResponseVO serverResponse = WellRestedRequest.build(url).setDateDeserializer(new DateDeserializer("yyyy/MM/dd")).post(myObj); 
ResponseVO serverResponse = WellRestedRequest.build(url).setDateDeserializer(new DateDeserializer(Arrays.asList("yyyy/MM/dd", "dd/MM/yyyy"))).post(myObj); 
ResponseVO serverResponse = WellRestedRequest.build(url).setDateDeserializer(new MyCustomDateDeserializer()).post(myObj); 
  • the Result class has also been improved to support filter, map, flatMap, ifSuccess and orElse methods. Now something like this is possible:
this.myService.getResultResponseFromServer()
                .filter(resp -> NumberUtils.isParsable(resp))
                .map(resp -> new BigDecimal(resp))
                .orElse(BigDecimal.ZERO);

Well Rested Client 1.0.0 Release

17 Mar 11:18
Compare
Choose a tag to compare

Initial public release