Skip to content

Commit 91bd23a

Browse files
committed
New API features added
1 parent cb35cb6 commit 91bd23a

40 files changed

+14023
-14
lines changed

README.md

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,36 @@ This API client provides a type-safe Java interface for WooCommerce REST API v3,
5454
- ✅ Reports
5555
- Retrieve and view orders totals report
5656
- Retrieve and view sales report
57+
- ✅ Product Attributes API
58+
- List all product attributes
59+
- Create a new product attribute
60+
- Get a specific product attribute
61+
- Update a product attribute
62+
- Delete a product attribute
63+
- ✅ Product Attribute Terms API
64+
- List all terms of a product attribute
65+
- Create a new product attribute term
66+
- Get a specific product attribute term
67+
- Update a product attribute term
68+
- Delete a product attribute term
69+
- ✅ Product Shipping Classes API
70+
- List all product shipping classes
71+
- Create a new product shipping class
72+
- Get a specific product shipping class
73+
- Update a product shipping class
74+
- Delete a product shipping class
75+
- ✅ Product Tags API
76+
- List all product tags
77+
- Create a new product tag
78+
- Get a specific product tag
79+
- Update a product tag
80+
- Delete a product tag
81+
- ✅ Product Reviews API
82+
- List all product reviews
83+
- Create a new product review
84+
- Get a specific product review
85+
- Update a product review
86+
- Delete a product review
5787

5888
## 🚨 Project status
5989

@@ -64,7 +94,7 @@ This API client provides a type-safe Java interface for WooCommerce REST API v3,
6494
6595
## 📦 Version information
6696

67-
- **Current version**: `0.9.6`
97+
- **Current version**: `0.9.7`
6898
- **Supported WooCommerce API version**: `v3`
6999
- **Java compatibility**: Java 8+
70100

@@ -81,13 +111,12 @@ The only requirement is to preserve the original author attribution in the sourc
81111
### 1️⃣ Installation
82112

83113
You can add the library to your project by including the dependency from Maven Central:
84-
85114
```xml
86115
<!-- https://mvnrepository.com/artifact/pl.wtx.woocommerce/woocommerce-api-client -->
87116
<dependency>
88117
<groupId>pl.wtx.woocommerce</groupId>
89118
<artifactId>woocommerce-api-client</artifactId>
90-
<version>0.9.6</version>
119+
<version>0.9.7</version>
91120
</dependency>
92121
```
93122

@@ -105,7 +134,7 @@ Then add the locally built artifact to your project:
105134
<dependency>
106135
<groupId>pl.wtx.woocommerce</groupId>
107136
<artifactId>woocommerce-api-client</artifactId>
108-
<version>0.9.6</version>
137+
<version>0.9.7</version>
109138
</dependency>
110139
```
111140

pom.xml

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

77
<groupId>pl.wtx.woocommerce</groupId>
88
<artifactId>woocommerce-api-client</artifactId>
9-
<version>0.9.6</version>
9+
<version>0.9.7</version>
1010
<packaging>jar</packaging>
1111

1212
<name>WooCommerce API Client for Java</name>

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

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828

2929

3030
import pl.wtx.woocommerce.api.client.model.ApiError;
31+
import pl.wtx.woocommerce.api.client.model.BatchCustomers200Response;
32+
import pl.wtx.woocommerce.api.client.model.BatchCustomersRequest;
3133
import pl.wtx.woocommerce.api.client.model.Customer;
3234

3335
import java.lang.reflect.Type;
@@ -73,6 +75,128 @@ public void setCustomBaseUrl(String customBaseUrl) {
7375
this.localCustomBaseUrl = customBaseUrl;
7476
}
7577

78+
/**
79+
* Build call for batchCustomers
80+
* @param batchCustomersRequest Batch create, update, and delete customers (optional)
81+
* @param _callback Callback for upload/download progress
82+
* @return Call to execute
83+
* @throws ApiException If fail to serialize the request body object
84+
* @http.response.details
85+
<table border="1">
86+
<caption>Response Details</caption>
87+
<tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
88+
<tr><td> 200 </td><td> Batch operation results </td><td> - </td></tr>
89+
</table>
90+
*/
91+
public okhttp3.Call batchCustomersCall(@javax.annotation.Nullable BatchCustomersRequest batchCustomersRequest, final ApiCallback _callback) throws ApiException {
92+
String basePath = null;
93+
// Operation Servers
94+
String[] localBasePaths = new String[] { };
95+
96+
// Determine Base Path to Use
97+
if (localCustomBaseUrl != null){
98+
basePath = localCustomBaseUrl;
99+
} else if ( localBasePaths.length > 0 ) {
100+
basePath = localBasePaths[localHostIndex];
101+
} else {
102+
basePath = null;
103+
}
104+
105+
Object localVarPostBody = batchCustomersRequest;
106+
107+
// create path and map variables
108+
String localVarPath = "/customers/batch";
109+
110+
List<Pair> localVarQueryParams = new ArrayList<Pair>();
111+
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
112+
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
113+
Map<String, String> localVarCookieParams = new HashMap<String, String>();
114+
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
115+
116+
final String[] localVarAccepts = {
117+
"application/json"
118+
};
119+
final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
120+
if (localVarAccept != null) {
121+
localVarHeaderParams.put("Accept", localVarAccept);
122+
}
123+
124+
final String[] localVarContentTypes = {
125+
"application/json"
126+
};
127+
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
128+
if (localVarContentType != null) {
129+
localVarHeaderParams.put("Content-Type", localVarContentType);
130+
}
131+
132+
String[] localVarAuthNames = new String[] { "basicAuth" };
133+
return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
134+
}
135+
136+
@SuppressWarnings("rawtypes")
137+
private okhttp3.Call batchCustomersValidateBeforeCall(@javax.annotation.Nullable BatchCustomersRequest batchCustomersRequest, final ApiCallback _callback) throws ApiException {
138+
return batchCustomersCall(batchCustomersRequest, _callback);
139+
140+
}
141+
142+
/**
143+
* Batch create, update, and delete customers
144+
*
145+
* @param batchCustomersRequest Batch create, update, and delete customers (optional)
146+
* @return BatchCustomers200Response
147+
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
148+
* @http.response.details
149+
<table border="1">
150+
<caption>Response Details</caption>
151+
<tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
152+
<tr><td> 200 </td><td> Batch operation results </td><td> - </td></tr>
153+
</table>
154+
*/
155+
public BatchCustomers200Response batchCustomers(@javax.annotation.Nullable BatchCustomersRequest batchCustomersRequest) throws ApiException {
156+
ApiResponse<BatchCustomers200Response> localVarResp = batchCustomersWithHttpInfo(batchCustomersRequest);
157+
return localVarResp.getData();
158+
}
159+
160+
/**
161+
* Batch create, update, and delete customers
162+
*
163+
* @param batchCustomersRequest Batch create, update, and delete customers (optional)
164+
* @return ApiResponse&lt;BatchCustomers200Response&gt;
165+
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
166+
* @http.response.details
167+
<table border="1">
168+
<caption>Response Details</caption>
169+
<tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
170+
<tr><td> 200 </td><td> Batch operation results </td><td> - </td></tr>
171+
</table>
172+
*/
173+
public ApiResponse<BatchCustomers200Response> batchCustomersWithHttpInfo(@javax.annotation.Nullable BatchCustomersRequest batchCustomersRequest) throws ApiException {
174+
okhttp3.Call localVarCall = batchCustomersValidateBeforeCall(batchCustomersRequest, null);
175+
Type localVarReturnType = new TypeToken<BatchCustomers200Response>(){}.getType();
176+
return localVarApiClient.execute(localVarCall, localVarReturnType);
177+
}
178+
179+
/**
180+
* Batch create, update, and delete customers (asynchronously)
181+
*
182+
* @param batchCustomersRequest Batch create, update, and delete customers (optional)
183+
* @param _callback The callback to be executed when the API call finishes
184+
* @return The request call
185+
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
186+
* @http.response.details
187+
<table border="1">
188+
<caption>Response Details</caption>
189+
<tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
190+
<tr><td> 200 </td><td> Batch operation results </td><td> - </td></tr>
191+
</table>
192+
*/
193+
public okhttp3.Call batchCustomersAsync(@javax.annotation.Nullable BatchCustomersRequest batchCustomersRequest, final ApiCallback<BatchCustomers200Response> _callback) throws ApiException {
194+
195+
okhttp3.Call localVarCall = batchCustomersValidateBeforeCall(batchCustomersRequest, _callback);
196+
Type localVarReturnType = new TypeToken<BatchCustomers200Response>(){}.getType();
197+
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
198+
return localVarCall;
199+
}
76200
/**
77201
* Build call for createCustomer
78202
* @param customer Customer object with data to create. (required)

src/main/java/pl/wtx/woocommerce/api/client/OrdersApi.java

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828

2929

3030
import pl.wtx.woocommerce.api.client.model.ApiError;
31+
import pl.wtx.woocommerce.api.client.model.BatchOrders200Response;
32+
import pl.wtx.woocommerce.api.client.model.BatchOrdersRequest;
3133
import java.time.OffsetDateTime;
3234
import pl.wtx.woocommerce.api.client.model.Order;
3335

@@ -74,6 +76,128 @@ public void setCustomBaseUrl(String customBaseUrl) {
7476
this.localCustomBaseUrl = customBaseUrl;
7577
}
7678

79+
/**
80+
* Build call for batchOrders
81+
* @param batchOrdersRequest Batch create, update, and delete orders (optional)
82+
* @param _callback Callback for upload/download progress
83+
* @return Call to execute
84+
* @throws ApiException If fail to serialize the request body object
85+
* @http.response.details
86+
<table border="1">
87+
<caption>Response Details</caption>
88+
<tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
89+
<tr><td> 200 </td><td> Batch operation results </td><td> - </td></tr>
90+
</table>
91+
*/
92+
public okhttp3.Call batchOrdersCall(@javax.annotation.Nullable BatchOrdersRequest batchOrdersRequest, final ApiCallback _callback) throws ApiException {
93+
String basePath = null;
94+
// Operation Servers
95+
String[] localBasePaths = new String[] { };
96+
97+
// Determine Base Path to Use
98+
if (localCustomBaseUrl != null){
99+
basePath = localCustomBaseUrl;
100+
} else if ( localBasePaths.length > 0 ) {
101+
basePath = localBasePaths[localHostIndex];
102+
} else {
103+
basePath = null;
104+
}
105+
106+
Object localVarPostBody = batchOrdersRequest;
107+
108+
// create path and map variables
109+
String localVarPath = "/orders/batch";
110+
111+
List<Pair> localVarQueryParams = new ArrayList<Pair>();
112+
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
113+
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
114+
Map<String, String> localVarCookieParams = new HashMap<String, String>();
115+
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
116+
117+
final String[] localVarAccepts = {
118+
"application/json"
119+
};
120+
final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
121+
if (localVarAccept != null) {
122+
localVarHeaderParams.put("Accept", localVarAccept);
123+
}
124+
125+
final String[] localVarContentTypes = {
126+
"application/json"
127+
};
128+
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
129+
if (localVarContentType != null) {
130+
localVarHeaderParams.put("Content-Type", localVarContentType);
131+
}
132+
133+
String[] localVarAuthNames = new String[] { "basicAuth" };
134+
return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
135+
}
136+
137+
@SuppressWarnings("rawtypes")
138+
private okhttp3.Call batchOrdersValidateBeforeCall(@javax.annotation.Nullable BatchOrdersRequest batchOrdersRequest, final ApiCallback _callback) throws ApiException {
139+
return batchOrdersCall(batchOrdersRequest, _callback);
140+
141+
}
142+
143+
/**
144+
* Batch create, update, and delete orders
145+
*
146+
* @param batchOrdersRequest Batch create, update, and delete orders (optional)
147+
* @return BatchOrders200Response
148+
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
149+
* @http.response.details
150+
<table border="1">
151+
<caption>Response Details</caption>
152+
<tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
153+
<tr><td> 200 </td><td> Batch operation results </td><td> - </td></tr>
154+
</table>
155+
*/
156+
public BatchOrders200Response batchOrders(@javax.annotation.Nullable BatchOrdersRequest batchOrdersRequest) throws ApiException {
157+
ApiResponse<BatchOrders200Response> localVarResp = batchOrdersWithHttpInfo(batchOrdersRequest);
158+
return localVarResp.getData();
159+
}
160+
161+
/**
162+
* Batch create, update, and delete orders
163+
*
164+
* @param batchOrdersRequest Batch create, update, and delete orders (optional)
165+
* @return ApiResponse&lt;BatchOrders200Response&gt;
166+
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
167+
* @http.response.details
168+
<table border="1">
169+
<caption>Response Details</caption>
170+
<tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
171+
<tr><td> 200 </td><td> Batch operation results </td><td> - </td></tr>
172+
</table>
173+
*/
174+
public ApiResponse<BatchOrders200Response> batchOrdersWithHttpInfo(@javax.annotation.Nullable BatchOrdersRequest batchOrdersRequest) throws ApiException {
175+
okhttp3.Call localVarCall = batchOrdersValidateBeforeCall(batchOrdersRequest, null);
176+
Type localVarReturnType = new TypeToken<BatchOrders200Response>(){}.getType();
177+
return localVarApiClient.execute(localVarCall, localVarReturnType);
178+
}
179+
180+
/**
181+
* Batch create, update, and delete orders (asynchronously)
182+
*
183+
* @param batchOrdersRequest Batch create, update, and delete orders (optional)
184+
* @param _callback The callback to be executed when the API call finishes
185+
* @return The request call
186+
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
187+
* @http.response.details
188+
<table border="1">
189+
<caption>Response Details</caption>
190+
<tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
191+
<tr><td> 200 </td><td> Batch operation results </td><td> - </td></tr>
192+
</table>
193+
*/
194+
public okhttp3.Call batchOrdersAsync(@javax.annotation.Nullable BatchOrdersRequest batchOrdersRequest, final ApiCallback<BatchOrders200Response> _callback) throws ApiException {
195+
196+
okhttp3.Call localVarCall = batchOrdersValidateBeforeCall(batchOrdersRequest, _callback);
197+
Type localVarReturnType = new TypeToken<BatchOrders200Response>(){}.getType();
198+
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
199+
return localVarCall;
200+
}
77201
/**
78202
* Build call for createOrder
79203
* @param order Order object with data to create. (required)

0 commit comments

Comments
 (0)