From 5a0b2c13c9e6061ccedbf25b1b7362ca71fb7e23 Mon Sep 17 00:00:00 2001 From: Jean-Pierre Portier Date: Tue, 17 Dec 2024 19:45:30 +0100 Subject: [PATCH] refactor (SMS/Batches): Generated files --- .../sms/api/v1/internal/BatchesApi.java | 142 ++++++++---------- 1 file changed, 59 insertions(+), 83 deletions(-) diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/api/v1/internal/BatchesApi.java b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/api/v1/internal/BatchesApi.java index 569ff6c5..dfd0e385 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/sms/api/v1/internal/BatchesApi.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/sms/api/v1/internal/BatchesApi.java @@ -22,6 +22,7 @@ import com.sinch.sdk.core.http.HttpResponse; import com.sinch.sdk.core.http.HttpStatus; import com.sinch.sdk.core.http.URLParameter; +import com.sinch.sdk.core.http.URLParameterUtils; import com.sinch.sdk.core.http.URLPathUtils; import com.sinch.sdk.core.models.ServerConfiguration; import com.sinch.sdk.domains.sms.models.v1.batches.request.BatchRequest; @@ -192,30 +193,24 @@ private HttpRequest dryRunRequestBuilder( URLPathUtils.encodePathSegment(this.servicePlanId.toString())); List localVarQueryParams = new ArrayList<>(); - DryRunQueryParameters guardParameters = - null != queryParameter ? queryParameter : DryRunQueryParameters.builder().build(); - - guardParameters - .getPerRecipient() - .ifPresent( - g -> - localVarQueryParams.add( - new URLParameter( - "per_recipient", - g, - URLParameter.STYLE.valueOf("form".toUpperCase()), - true))); - - guardParameters - .getNumberOfRecipients() - .ifPresent( - g -> - localVarQueryParams.add( - new URLParameter( - "number_of_recipients", - g, - URLParameter.STYLE.valueOf("form".toUpperCase()), - true))); + if (null != queryParameter) { + + URLParameterUtils.addQueryParam( + queryParameter.getPerRecipient(), + "per_recipient", + URLParameter.form, + null, + localVarQueryParams, + true); + + URLParameterUtils.addQueryParam( + queryParameter.getNumberOfRecipients(), + "number_of_recipients", + URLParameter.form, + null, + localVarQueryParams, + true); + } Map localVarHeaderParams = new HashMap<>(); @@ -352,65 +347,46 @@ private HttpRequest listRequestBuilder(ListBatchesQueryParameters queryParameter URLPathUtils.encodePathSegment(this.servicePlanId.toString())); List localVarQueryParams = new ArrayList<>(); - ListBatchesQueryParameters guardParameters = - null != queryParameter ? queryParameter : ListBatchesQueryParameters.builder().build(); - - guardParameters - .getPage() - .ifPresent( - g -> - localVarQueryParams.add( - new URLParameter( - "page", g, URLParameter.STYLE.valueOf("form".toUpperCase()), true))); - - guardParameters - .getPageSize() - .ifPresent( - g -> - localVarQueryParams.add( - new URLParameter( - "page_size", g, URLParameter.STYLE.valueOf("form".toUpperCase()), true))); - - guardParameters - .getFrom() - .ifPresent( - g -> - localVarQueryParams.add( - new URLParameter( - "from", g, URLParameter.STYLE.valueOf("form".toUpperCase()), true))); - - guardParameters - .getStartDate() - .ifPresent( - g -> - localVarQueryParams.add( - new URLParameter( - "start_date", - InstantToIso8601Serializer.getInstance().apply(g), - URLParameter.STYLE.valueOf("form".toUpperCase()), - true))); - - guardParameters - .getEndDate() - .ifPresent( - g -> - localVarQueryParams.add( - new URLParameter( - "end_date", - InstantToIso8601Serializer.getInstance().apply(g), - URLParameter.STYLE.valueOf("form".toUpperCase()), - true))); - - guardParameters - .getClientReference() - .ifPresent( - g -> - localVarQueryParams.add( - new URLParameter( - "client_reference", - g, - URLParameter.STYLE.valueOf("form".toUpperCase()), - true))); + if (null != queryParameter) { + + URLParameterUtils.addQueryParam( + queryParameter.getPage(), "page", URLParameter.form, null, localVarQueryParams, true); + + URLParameterUtils.addQueryParam( + queryParameter.getPageSize(), + "page_size", + URLParameter.form, + null, + localVarQueryParams, + true); + + URLParameterUtils.addQueryParam( + queryParameter.getFrom(), "from", URLParameter.form, null, localVarQueryParams, true); + + URLParameterUtils.addQueryParam( + queryParameter.getStartDate(), + "start_date", + URLParameter.form, + InstantToIso8601Serializer.getInstance(), + localVarQueryParams, + true); + + URLParameterUtils.addQueryParam( + queryParameter.getEndDate(), + "end_date", + URLParameter.form, + InstantToIso8601Serializer.getInstance(), + localVarQueryParams, + true); + + URLParameterUtils.addQueryParam( + queryParameter.getClientReference(), + "client_reference", + URLParameter.form, + null, + localVarQueryParams, + true); + } Map localVarHeaderParams = new HashMap<>();