Skip to content

Commit 835fb82

Browse files
committed
Update Order model according to official WooCommerce REST API
specification
1 parent 0a87474 commit 835fb82

30 files changed

+3891
-290
lines changed

src/main/java/wtx/woocommerce/WooCommerceApiClientUsageDemo.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public static void main(String[] args) {
2424

2525
try {
2626

27-
List<Customer> customers = customersApi.listAllCustomers(null, null, null, null, null, null, null, null, null, null, null, null, null);
27+
List<Customer> customers = customersApi.listAllCustomers(null, null, null, null, null, null, null, null, null, null, null);
2828

2929
// Example list of customer emails:
3030
for (Customer customer : customers) {

src/main/java/wtx/woocommerce/api/client/CustomersApi.java

Lines changed: 13 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929

3030
import wtx.woocommerce.api.client.model.ApiError;
3131
import wtx.woocommerce.api.client.model.Customer;
32-
import java.time.OffsetDateTime;
3332

3433
import java.lang.reflect.Type;
3534
import java.util.ArrayList;
@@ -82,13 +81,11 @@ public void setCustomBaseUrl(String customBaseUrl) {
8281
* @param search Limit results to those matching a string. (optional)
8382
* @param exclude Ensure result set excludes specific IDs. (optional)
8483
* @param include Limit result set to specific IDs. (optional)
85-
* @param after Limit response to resources created after a given ISO8601 compliant date. (optional)
86-
* @param before Limit response to resources created before a given ISO8601 compliant date. (optional)
8784
* @param offset Offset the result set by a specific number of items. (optional)
8885
* @param order Order sort attribute ascending or descending (asc as default). (optional)
8986
* @param orderby Sort collection by object attribute. (optional)
9087
* @param email Limit result set to resources with a specific email address. (optional)
91-
* @param role Limit result set to resources with a specific role. (optional)
88+
* @param role Limit result set to resources with a specific role. Default is customer. (optional)
9289
* @param _callback Callback for upload/download progress
9390
* @return Call to execute
9491
* @throws ApiException If fail to serialize the request body object
@@ -101,7 +98,7 @@ public void setCustomBaseUrl(String customBaseUrl) {
10198
<tr><td> 404 </td><td> Not Found </td><td> - </td></tr>
10299
</table>
103100
*/
104-
public okhttp3.Call listAllCustomersCall(String context, Integer page, Integer perPage, String search, List<Integer> exclude, List<Integer> include, OffsetDateTime after, OffsetDateTime before, Integer offset, String order, String orderby, String email, String role, final ApiCallback _callback) throws ApiException {
101+
public okhttp3.Call listAllCustomersCall(String context, Integer page, Integer perPage, String search, List<Integer> exclude, List<Integer> include, Integer offset, String order, String orderby, String email, String role, final ApiCallback _callback) throws ApiException {
105102
String basePath = null;
106103
// Operation Servers
107104
String[] localBasePaths = new String[] { };
@@ -150,14 +147,6 @@ public okhttp3.Call listAllCustomersCall(String context, Integer page, Integer p
150147
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "include", include));
151148
}
152149

153-
if (after != null) {
154-
localVarQueryParams.addAll(localVarApiClient.parameterToPair("after", after));
155-
}
156-
157-
if (before != null) {
158-
localVarQueryParams.addAll(localVarApiClient.parameterToPair("before", before));
159-
}
160-
161150
if (offset != null) {
162151
localVarQueryParams.addAll(localVarApiClient.parameterToPair("offset", offset));
163152
}
@@ -198,8 +187,8 @@ public okhttp3.Call listAllCustomersCall(String context, Integer page, Integer p
198187
}
199188

200189
@SuppressWarnings("rawtypes")
201-
private okhttp3.Call listAllCustomersValidateBeforeCall(String context, Integer page, Integer perPage, String search, List<Integer> exclude, List<Integer> include, OffsetDateTime after, OffsetDateTime before, Integer offset, String order, String orderby, String email, String role, final ApiCallback _callback) throws ApiException {
202-
return listAllCustomersCall(context, page, perPage, search, exclude, include, after, before, offset, order, orderby, email, role, _callback);
190+
private okhttp3.Call listAllCustomersValidateBeforeCall(String context, Integer page, Integer perPage, String search, List<Integer> exclude, List<Integer> include, Integer offset, String order, String orderby, String email, String role, final ApiCallback _callback) throws ApiException {
191+
return listAllCustomersCall(context, page, perPage, search, exclude, include, offset, order, orderby, email, role, _callback);
203192

204193
}
205194

@@ -212,13 +201,11 @@ private okhttp3.Call listAllCustomersValidateBeforeCall(String context, Integer
212201
* @param search Limit results to those matching a string. (optional)
213202
* @param exclude Ensure result set excludes specific IDs. (optional)
214203
* @param include Limit result set to specific IDs. (optional)
215-
* @param after Limit response to resources created after a given ISO8601 compliant date. (optional)
216-
* @param before Limit response to resources created before a given ISO8601 compliant date. (optional)
217204
* @param offset Offset the result set by a specific number of items. (optional)
218205
* @param order Order sort attribute ascending or descending (asc as default). (optional)
219206
* @param orderby Sort collection by object attribute. (optional)
220207
* @param email Limit result set to resources with a specific email address. (optional)
221-
* @param role Limit result set to resources with a specific role. (optional)
208+
* @param role Limit result set to resources with a specific role. Default is customer. (optional)
222209
* @return List&lt;Customer&gt;
223210
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
224211
* @http.response.details
@@ -230,8 +217,8 @@ private okhttp3.Call listAllCustomersValidateBeforeCall(String context, Integer
230217
<tr><td> 404 </td><td> Not Found </td><td> - </td></tr>
231218
</table>
232219
*/
233-
public List<Customer> listAllCustomers(String context, Integer page, Integer perPage, String search, List<Integer> exclude, List<Integer> include, OffsetDateTime after, OffsetDateTime before, Integer offset, String order, String orderby, String email, String role) throws ApiException {
234-
ApiResponse<List<Customer>> localVarResp = listAllCustomersWithHttpInfo(context, page, perPage, search, exclude, include, after, before, offset, order, orderby, email, role);
220+
public List<Customer> listAllCustomers(String context, Integer page, Integer perPage, String search, List<Integer> exclude, List<Integer> include, Integer offset, String order, String orderby, String email, String role) throws ApiException {
221+
ApiResponse<List<Customer>> localVarResp = listAllCustomersWithHttpInfo(context, page, perPage, search, exclude, include, offset, order, orderby, email, role);
235222
return localVarResp.getData();
236223
}
237224

@@ -244,13 +231,11 @@ public List<Customer> listAllCustomers(String context, Integer page, Integer per
244231
* @param search Limit results to those matching a string. (optional)
245232
* @param exclude Ensure result set excludes specific IDs. (optional)
246233
* @param include Limit result set to specific IDs. (optional)
247-
* @param after Limit response to resources created after a given ISO8601 compliant date. (optional)
248-
* @param before Limit response to resources created before a given ISO8601 compliant date. (optional)
249234
* @param offset Offset the result set by a specific number of items. (optional)
250235
* @param order Order sort attribute ascending or descending (asc as default). (optional)
251236
* @param orderby Sort collection by object attribute. (optional)
252237
* @param email Limit result set to resources with a specific email address. (optional)
253-
* @param role Limit result set to resources with a specific role. (optional)
238+
* @param role Limit result set to resources with a specific role. Default is customer. (optional)
254239
* @return ApiResponse&lt;List&lt;Customer&gt;&gt;
255240
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
256241
* @http.response.details
@@ -262,8 +247,8 @@ public List<Customer> listAllCustomers(String context, Integer page, Integer per
262247
<tr><td> 404 </td><td> Not Found </td><td> - </td></tr>
263248
</table>
264249
*/
265-
public ApiResponse<List<Customer>> listAllCustomersWithHttpInfo(String context, Integer page, Integer perPage, String search, List<Integer> exclude, List<Integer> include, OffsetDateTime after, OffsetDateTime before, Integer offset, String order, String orderby, String email, String role) throws ApiException {
266-
okhttp3.Call localVarCall = listAllCustomersValidateBeforeCall(context, page, perPage, search, exclude, include, after, before, offset, order, orderby, email, role, null);
250+
public ApiResponse<List<Customer>> listAllCustomersWithHttpInfo(String context, Integer page, Integer perPage, String search, List<Integer> exclude, List<Integer> include, Integer offset, String order, String orderby, String email, String role) throws ApiException {
251+
okhttp3.Call localVarCall = listAllCustomersValidateBeforeCall(context, page, perPage, search, exclude, include, offset, order, orderby, email, role, null);
267252
Type localVarReturnType = new TypeToken<List<Customer>>(){}.getType();
268253
return localVarApiClient.execute(localVarCall, localVarReturnType);
269254
}
@@ -277,13 +262,11 @@ public ApiResponse<List<Customer>> listAllCustomersWithHttpInfo(String context,
277262
* @param search Limit results to those matching a string. (optional)
278263
* @param exclude Ensure result set excludes specific IDs. (optional)
279264
* @param include Limit result set to specific IDs. (optional)
280-
* @param after Limit response to resources created after a given ISO8601 compliant date. (optional)
281-
* @param before Limit response to resources created before a given ISO8601 compliant date. (optional)
282265
* @param offset Offset the result set by a specific number of items. (optional)
283266
* @param order Order sort attribute ascending or descending (asc as default). (optional)
284267
* @param orderby Sort collection by object attribute. (optional)
285268
* @param email Limit result set to resources with a specific email address. (optional)
286-
* @param role Limit result set to resources with a specific role. (optional)
269+
* @param role Limit result set to resources with a specific role. Default is customer. (optional)
287270
* @param _callback The callback to be executed when the API call finishes
288271
* @return The request call
289272
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
@@ -296,9 +279,9 @@ public ApiResponse<List<Customer>> listAllCustomersWithHttpInfo(String context,
296279
<tr><td> 404 </td><td> Not Found </td><td> - </td></tr>
297280
</table>
298281
*/
299-
public okhttp3.Call listAllCustomersAsync(String context, Integer page, Integer perPage, String search, List<Integer> exclude, List<Integer> include, OffsetDateTime after, OffsetDateTime before, Integer offset, String order, String orderby, String email, String role, final ApiCallback<List<Customer>> _callback) throws ApiException {
282+
public okhttp3.Call listAllCustomersAsync(String context, Integer page, Integer perPage, String search, List<Integer> exclude, List<Integer> include, Integer offset, String order, String orderby, String email, String role, final ApiCallback<List<Customer>> _callback) throws ApiException {
300283

301-
okhttp3.Call localVarCall = listAllCustomersValidateBeforeCall(context, page, perPage, search, exclude, include, after, before, offset, order, orderby, email, role, _callback);
284+
okhttp3.Call localVarCall = listAllCustomersValidateBeforeCall(context, page, perPage, search, exclude, include, offset, order, orderby, email, role, _callback);
302285
Type localVarReturnType = new TypeToken<List<Customer>>(){}.getType();
303286
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
304287
return localVarCall;

src/main/java/wtx/woocommerce/api/client/invoker/ApiException.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
* <p>ApiException class.</p>
2222
*/
2323
@SuppressWarnings("serial")
24-
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-12-26T19:20:41.898235500+01:00[Europe/Warsaw]", comments = "Generator version: 7.10.0")
24+
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-12-28T00:49:53.851918900+01:00[Europe/Warsaw]", comments = "Generator version: 7.10.0")
2525
public class ApiException extends Exception {
2626
private static final long serialVersionUID = 1L;
2727

src/main/java/wtx/woocommerce/api/client/invoker/Configuration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
package wtx.woocommerce.api.client.invoker;
1515

16-
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-12-26T19:20:41.898235500+01:00[Europe/Warsaw]", comments = "Generator version: 7.10.0")
16+
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-12-28T00:49:53.851918900+01:00[Europe/Warsaw]", comments = "Generator version: 7.10.0")
1717
public class Configuration {
1818
public static final String VERSION = "v3";
1919

src/main/java/wtx/woocommerce/api/client/invoker/JSON.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,12 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri
9999
gsonBuilder.registerTypeAdapterFactory(new wtx.woocommerce.api.client.model.Customer.CustomTypeAdapterFactory());
100100
gsonBuilder.registerTypeAdapterFactory(new wtx.woocommerce.api.client.model.MetaData.CustomTypeAdapterFactory());
101101
gsonBuilder.registerTypeAdapterFactory(new wtx.woocommerce.api.client.model.Order.CustomTypeAdapterFactory());
102+
gsonBuilder.registerTypeAdapterFactory(new wtx.woocommerce.api.client.model.OrderCouponLine.CustomTypeAdapterFactory());
103+
gsonBuilder.registerTypeAdapterFactory(new wtx.woocommerce.api.client.model.OrderFeeLine.CustomTypeAdapterFactory());
102104
gsonBuilder.registerTypeAdapterFactory(new wtx.woocommerce.api.client.model.OrderLineItem.CustomTypeAdapterFactory());
105+
gsonBuilder.registerTypeAdapterFactory(new wtx.woocommerce.api.client.model.OrderRefund.CustomTypeAdapterFactory());
106+
gsonBuilder.registerTypeAdapterFactory(new wtx.woocommerce.api.client.model.OrderShippingLine.CustomTypeAdapterFactory());
107+
gsonBuilder.registerTypeAdapterFactory(new wtx.woocommerce.api.client.model.OrderTaxLine.CustomTypeAdapterFactory());
103108
gsonBuilder.registerTypeAdapterFactory(new wtx.woocommerce.api.client.model.Product.CustomTypeAdapterFactory());
104109
gsonBuilder.registerTypeAdapterFactory(new wtx.woocommerce.api.client.model.ProductAttribute.CustomTypeAdapterFactory());
105110
gsonBuilder.registerTypeAdapterFactory(new wtx.woocommerce.api.client.model.ReportOrderTotalSummary.CustomTypeAdapterFactory());

src/main/java/wtx/woocommerce/api/client/invoker/Pair.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
package wtx.woocommerce.api.client.invoker;
1515

16-
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-12-26T19:20:41.898235500+01:00[Europe/Warsaw]", comments = "Generator version: 7.10.0")
16+
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-12-28T00:49:53.851918900+01:00[Europe/Warsaw]", comments = "Generator version: 7.10.0")
1717
public class Pair {
1818
private String name = "";
1919
private String value = "";

src/main/java/wtx/woocommerce/api/client/invoker/ServerConfiguration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
/**
1919
* Representing a Server configuration.
2020
*/
21-
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-12-26T19:20:41.898235500+01:00[Europe/Warsaw]", comments = "Generator version: 7.10.0")
21+
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-12-28T00:49:53.851918900+01:00[Europe/Warsaw]", comments = "Generator version: 7.10.0")
2222
public class ServerConfiguration {
2323
public String URL;
2424
public String description;

src/main/java/wtx/woocommerce/api/client/invoker/ServerVariable.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
/**
1919
* Representing a Server Variable for server URL template substitution.
2020
*/
21-
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-12-26T19:20:41.898235500+01:00[Europe/Warsaw]", comments = "Generator version: 7.10.0")
21+
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-12-28T00:49:53.851918900+01:00[Europe/Warsaw]", comments = "Generator version: 7.10.0")
2222
public class ServerVariable {
2323
public String description;
2424
public String defaultValue;

src/main/java/wtx/woocommerce/api/client/invoker/StringUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import java.util.Collection;
1717
import java.util.Iterator;
1818

19-
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-12-26T19:20:41.898235500+01:00[Europe/Warsaw]", comments = "Generator version: 7.10.0")
19+
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-12-28T00:49:53.851918900+01:00[Europe/Warsaw]", comments = "Generator version: 7.10.0")
2020
public class StringUtil {
2121
/**
2222
* Check if the given array contains the given value (with case-insensitive comparison).

src/main/java/wtx/woocommerce/api/client/invoker/auth/ApiKeyAuth.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
import java.util.Map;
2121
import java.util.List;
2222

23-
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-12-26T19:20:41.898235500+01:00[Europe/Warsaw]", comments = "Generator version: 7.10.0")
23+
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-12-28T00:49:53.851918900+01:00[Europe/Warsaw]", comments = "Generator version: 7.10.0")
2424
public class ApiKeyAuth implements Authentication {
2525
private final String location;
2626
private final String paramName;

0 commit comments

Comments
 (0)