Added repository for all products, orders and customer methods
This commit is contained in:
parent
84a4b62bed
commit
23e422bdf8
@ -1,13 +1,9 @@
|
|||||||
package me.gilo.woodroid;
|
package me.gilo.woodroid;
|
||||||
|
|
||||||
import me.gilo.woodroid.dto.CouponData;
|
import me.gilo.woodroid.dto.CouponData;
|
||||||
import me.gilo.woodroid.models.Coupon;
|
|
||||||
import me.gilo.woodroid.models.Product;
|
import me.gilo.woodroid.models.Product;
|
||||||
import me.gilo.woodroid.repo.CouponRepository;
|
|
||||||
import me.gilo.woodroid.repo.ProductRepository;
|
import me.gilo.woodroid.repo.ProductRepository;
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
import retrofit2.Callback;
|
|
||||||
import retrofit2.Response;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
|||||||
@ -1,70 +0,0 @@
|
|||||||
package me.gilo.woodroid.data;
|
|
||||||
|
|
||||||
|
|
||||||
import me.gilo.woodroid.data.callbacks.*;
|
|
||||||
import me.gilo.woodroid.data.callbacks.Data;
|
|
||||||
import me.gilo.woodroid.models.*;
|
|
||||||
import retrofit2.Call;
|
|
||||||
import retrofit2.http.*;
|
|
||||||
import rx.Observable;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public interface ProductAPI {
|
|
||||||
|
|
||||||
|
|
||||||
@GET("products/categories")
|
|
||||||
Call<ArrayList<Category>> getCategories();
|
|
||||||
|
|
||||||
@GET("products")
|
|
||||||
Call<ArrayList<Product>> getProducts();
|
|
||||||
|
|
||||||
@GET("products/{id}")
|
|
||||||
Call<Product> getProduct(@Path("id") int id);
|
|
||||||
|
|
||||||
@GET("products")
|
|
||||||
Call<ArrayList<Product>> getProducts(@Query("filter[category]") String category);
|
|
||||||
|
|
||||||
@GET("products")
|
|
||||||
Call<ArrayList<Product>> search(@Query("search") String search);
|
|
||||||
|
|
||||||
@GET("products")
|
|
||||||
Call<ArrayList<Product>> filter(@QueryMap Map<String, String> filter);
|
|
||||||
|
|
||||||
@GET("products/{id}")
|
|
||||||
Call<ProductCallback> getRelatedProducts(@Path("id") int id);
|
|
||||||
|
|
||||||
|
|
||||||
@GET("products/count")
|
|
||||||
Call<ArrayList<Product>> getProductsCount();
|
|
||||||
|
|
||||||
@GET("products/{id}/reviews")
|
|
||||||
Call<ReviewsCallback> getProductReviews(@Path("id") int id);
|
|
||||||
|
|
||||||
@GET("products/{id}/orders")
|
|
||||||
Call<ReviewsCallback> getProductOrders(@Path("id") int id);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
/products
|
|
||||||
/products/count
|
|
||||||
/products/<id>
|
|
||||||
/products/<id>/reviews
|
|
||||||
/products/<id>/orders
|
|
||||||
/products/categories
|
|
||||||
/products/categories/<id>
|
|
||||||
/products/tags
|
|
||||||
/products/tags/<id>
|
|
||||||
/products/shipping_classes
|
|
||||||
/products/shipping_classes/<id>
|
|
||||||
/products/attributes
|
|
||||||
/products/attributes/<id>
|
|
||||||
/products/attributes/<attribute_id>/terms
|
|
||||||
/products/attributes/<attribute_id>/terms/<id>
|
|
||||||
/products/bulk
|
|
||||||
*/
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,40 +0,0 @@
|
|||||||
package me.gilo.woodroid.data;
|
|
||||||
|
|
||||||
|
|
||||||
import me.gilo.woodroid.models.Coupon;
|
|
||||||
import me.gilo.woodroid.models.OrderNote;
|
|
||||||
import me.gilo.woodroid.models.Product;
|
|
||||||
import retrofit2.Call;
|
|
||||||
import retrofit2.http.*;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public interface ProductVariationAPI {
|
|
||||||
|
|
||||||
@Headers("Content-Type: application/json")
|
|
||||||
@POST("products/{id}/variations")
|
|
||||||
Call<Product> create(@Body Product body);
|
|
||||||
|
|
||||||
@GET("products/{id}/variations/{variation_id}")
|
|
||||||
Call<Product> view(@Path("id") int product_id, @Path("note_id") int note_id);
|
|
||||||
|
|
||||||
@GET("products/{id}/variations")
|
|
||||||
Call<List<Product>> list(@Path("id") int product);
|
|
||||||
|
|
||||||
@Headers("Content-Type: application/json")
|
|
||||||
@PUT("products/{id}/variations/{variation_id}")
|
|
||||||
Call<Product> update(@Path("id") int product_id, @Path("variation_id") int variation_id, @Body Product body);
|
|
||||||
|
|
||||||
@DELETE("products/{id}/variations/{variation_id}")
|
|
||||||
Call<Product> delete(@Path("id") int product_id, @Path("variation_id") int variation_id);
|
|
||||||
|
|
||||||
@DELETE("products/{id}/variations/{variation_id}")
|
|
||||||
Call<Product> delete(@Path("id") int product_id, @Path("variation_id") int variation_id, @Query("force") boolean force);
|
|
||||||
|
|
||||||
@Headers("Content-Type: application/json")
|
|
||||||
@PUT("products/{id}/variations/{variation_id}")
|
|
||||||
Call<Product> batch(@Path("id") int product_id, @Path("variation_id") int variation_id, @Body Product body);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -2,6 +2,7 @@ package me.gilo.woodroid.data;
|
|||||||
|
|
||||||
import android.util.Base64;
|
import android.util.Base64;
|
||||||
|
|
||||||
|
import me.gilo.woodroid.data.api.API;
|
||||||
import okhttp3.HttpUrl;
|
import okhttp3.HttpUrl;
|
||||||
import okhttp3.Interceptor;
|
import okhttp3.Interceptor;
|
||||||
import okhttp3.OkHttpClient;
|
import okhttp3.OkHttpClient;
|
||||||
@ -157,6 +158,8 @@ public class RestAdapter {
|
|||||||
// Define the interceptor, add authentication headers
|
// Define the interceptor, add authentication headers
|
||||||
Interceptor interceptor = chain -> {
|
Interceptor interceptor = chain -> {
|
||||||
|
|
||||||
|
chain.request().method();
|
||||||
|
|
||||||
HttpUrl.Builder builder = chain.request().url().newBuilder();
|
HttpUrl.Builder builder = chain.request().url().newBuilder();
|
||||||
for (NameValuePair entry : params) {
|
for (NameValuePair entry : params) {
|
||||||
builder.addQueryParameter(entry.getName(), entry.getValue());
|
builder.addQueryParameter(entry.getName(), entry.getValue());
|
||||||
|
|||||||
@ -1,35 +0,0 @@
|
|||||||
package me.gilo.woodroid.data;
|
|
||||||
|
|
||||||
|
|
||||||
import me.gilo.woodroid.models.Coupon;
|
|
||||||
import retrofit2.Call;
|
|
||||||
import retrofit2.http.*;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public interface ShippingAPI {
|
|
||||||
|
|
||||||
@Headers("Content-Type: application/json")
|
|
||||||
@POST("coupons")
|
|
||||||
Call<Coupon> create(@Body Coupon body);
|
|
||||||
|
|
||||||
@GET("coupons/{id}")
|
|
||||||
Call<Coupon> view(@Path("id") int id);
|
|
||||||
|
|
||||||
@GET("coupons")
|
|
||||||
Call<List<Coupon>> list();
|
|
||||||
|
|
||||||
@Headers("Content-Type: application/json")
|
|
||||||
@PUT("coupons/{id}")
|
|
||||||
Call<Coupon> update(@Path("id") int id, @Body Coupon body);
|
|
||||||
|
|
||||||
@DELETE("coupons/{id}")
|
|
||||||
Call<Coupon> delete(@Path("id") int id);
|
|
||||||
|
|
||||||
@DELETE("coupons/{id}")
|
|
||||||
Call<Coupon> delete(@Path("id") int id, @Query("force") boolean force);
|
|
||||||
|
|
||||||
@POST("coupons/batch")
|
|
||||||
Call<String> batch(@Body Coupon body);
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,35 +0,0 @@
|
|||||||
package me.gilo.woodroid.data;
|
|
||||||
|
|
||||||
|
|
||||||
import me.gilo.woodroid.models.Coupon;
|
|
||||||
import retrofit2.Call;
|
|
||||||
import retrofit2.http.*;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public interface ShippingZoneAPI {
|
|
||||||
|
|
||||||
@Headers("Content-Type: application/json")
|
|
||||||
@POST("coupons")
|
|
||||||
Call<Coupon> create(@Body Coupon body);
|
|
||||||
|
|
||||||
@GET("coupons/{id}")
|
|
||||||
Call<Coupon> view(@Path("id") int id);
|
|
||||||
|
|
||||||
@GET("coupons")
|
|
||||||
Call<List<Coupon>> list();
|
|
||||||
|
|
||||||
@Headers("Content-Type: application/json")
|
|
||||||
@PUT("coupons/{id}")
|
|
||||||
Call<Coupon> update(@Path("id") int id, @Body Coupon body);
|
|
||||||
|
|
||||||
@DELETE("coupons/{id}")
|
|
||||||
Call<Coupon> delete(@Path("id") int id);
|
|
||||||
|
|
||||||
@DELETE("coupons/{id}")
|
|
||||||
Call<Coupon> delete(@Path("id") int id, @Query("force") boolean force);
|
|
||||||
|
|
||||||
@POST("coupons/batch")
|
|
||||||
Call<String> batch(@Body Coupon body);
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package me.gilo.woodroid.data;
|
package me.gilo.woodroid.data.api;
|
||||||
|
|
||||||
|
|
||||||
import me.gilo.woodroid.data.callbacks.*;
|
import me.gilo.woodroid.data.callbacks.*;
|
||||||
@ -1,11 +1,14 @@
|
|||||||
package me.gilo.woodroid.data;
|
package me.gilo.woodroid.data.api;
|
||||||
|
|
||||||
|
|
||||||
import me.gilo.woodroid.models.Coupon;
|
import me.gilo.woodroid.models.Coupon;
|
||||||
|
import me.gilo.woodroid.models.Product;
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
import retrofit2.http.*;
|
import retrofit2.http.*;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public interface CouponAPI{
|
public interface CouponAPI{
|
||||||
|
|
||||||
@ -19,6 +22,9 @@ public interface CouponAPI{
|
|||||||
@GET("coupons")
|
@GET("coupons")
|
||||||
Call<List<Coupon>> list();
|
Call<List<Coupon>> list();
|
||||||
|
|
||||||
|
@GET("coupons")
|
||||||
|
Call<ArrayList<Coupon>> filter(@QueryMap Map<String, String> filter);
|
||||||
|
|
||||||
@Headers("Content-Type: application/json")
|
@Headers("Content-Type: application/json")
|
||||||
@PUT("coupons/{id}")
|
@PUT("coupons/{id}")
|
||||||
Call<Coupon> update(@Path("id") int id, @Body Coupon body);
|
Call<Coupon> update(@Path("id") int id, @Body Coupon body);
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package me.gilo.woodroid.data;
|
package me.gilo.woodroid.data.api;
|
||||||
|
|
||||||
|
|
||||||
import me.gilo.woodroid.models.Coupon;
|
import me.gilo.woodroid.models.Coupon;
|
||||||
@ -7,7 +7,9 @@ import me.gilo.woodroid.models.Download;
|
|||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
import retrofit2.http.*;
|
import retrofit2.http.*;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public interface CustomerAPI {
|
public interface CustomerAPI {
|
||||||
|
|
||||||
@ -37,4 +39,7 @@ public interface CustomerAPI {
|
|||||||
@POST("customers/{id}/downloads")
|
@POST("customers/{id}/downloads")
|
||||||
Call<List<Download>> downloads(@Path("id") int id);
|
Call<List<Download>> downloads(@Path("id") int id);
|
||||||
|
|
||||||
|
@GET("coupons")
|
||||||
|
Call<ArrayList<Customer>> filter(@QueryMap Map<String, String> filter);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package me.gilo.woodroid.data;
|
package me.gilo.woodroid.data.api;
|
||||||
|
|
||||||
|
|
||||||
import me.gilo.woodroid.models.Coupon;
|
import me.gilo.woodroid.models.Coupon;
|
||||||
@ -6,13 +6,15 @@ import me.gilo.woodroid.models.Order;
|
|||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
import retrofit2.http.*;
|
import retrofit2.http.*;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public interface OrderAPI {
|
public interface OrderAPI {
|
||||||
|
|
||||||
@Headers("Content-Type: application/json")
|
@Headers("Content-Type: application/json")
|
||||||
@POST("orders")
|
@POST("orders")
|
||||||
Call<Order> create(@Body Coupon body);
|
Call<Order> create(@Body Order body);
|
||||||
|
|
||||||
@GET("orders/{id}")
|
@GET("orders/{id}")
|
||||||
Call<Order> view(@Path("id") int id);
|
Call<Order> view(@Path("id") int id);
|
||||||
@ -33,4 +35,7 @@ public interface OrderAPI {
|
|||||||
@POST("orders/batch")
|
@POST("orders/batch")
|
||||||
Call<String> batch(@Body Order body);
|
Call<String> batch(@Body Order body);
|
||||||
|
|
||||||
|
@GET("coupons")
|
||||||
|
Call<ArrayList<Order>> filter(@QueryMap Map<String, String> filter);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package me.gilo.woodroid.data;
|
package me.gilo.woodroid.data.api;
|
||||||
|
|
||||||
|
|
||||||
import me.gilo.woodroid.models.Coupon;
|
import me.gilo.woodroid.models.Coupon;
|
||||||
@ -7,13 +7,15 @@ import me.gilo.woodroid.models.OrderNote;
|
|||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
import retrofit2.http.*;
|
import retrofit2.http.*;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public interface OrderNoteAPI {
|
public interface OrderNoteAPI {
|
||||||
|
|
||||||
@Headers("Content-Type: application/json")
|
@Headers("Content-Type: application/json")
|
||||||
@POST("orders/{id}/notes")
|
@POST("orders/{id}/notes")
|
||||||
Call<OrderNote> create(@Body Coupon body);
|
Call<OrderNote> create(@Path("id") int order_id, @Body OrderNote body);
|
||||||
|
|
||||||
@GET("orders/{id}/notes/{note_id}")
|
@GET("orders/{id}/notes/{note_id}")
|
||||||
Call<OrderNote> view(@Path("id") int order_id, @Path("note_id") int note_id);
|
Call<OrderNote> view(@Path("id") int order_id, @Path("note_id") int note_id);
|
||||||
@ -27,4 +29,7 @@ public interface OrderNoteAPI {
|
|||||||
@DELETE("orders/{id}/notes/{note_id}")
|
@DELETE("orders/{id}/notes/{note_id}")
|
||||||
Call<OrderNote> delete(@Path("id") int order_id, @Path("note_id") int note_id, @Query("force") boolean force);
|
Call<OrderNote> delete(@Path("id") int order_id, @Path("note_id") int note_id, @Query("force") boolean force);
|
||||||
|
|
||||||
|
@GET("coupons")
|
||||||
|
Call<ArrayList<OrderNote>> filter(@QueryMap Map<String, String> filter);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -0,0 +1,35 @@
|
|||||||
|
package me.gilo.woodroid.data.api;
|
||||||
|
|
||||||
|
|
||||||
|
import me.gilo.woodroid.data.callbacks.*;
|
||||||
|
import me.gilo.woodroid.data.callbacks.Data;
|
||||||
|
import me.gilo.woodroid.models.*;
|
||||||
|
import retrofit2.Call;
|
||||||
|
import retrofit2.http.*;
|
||||||
|
import rx.Observable;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public interface ProductAPI {
|
||||||
|
|
||||||
|
|
||||||
|
@GET("products")
|
||||||
|
Call<ArrayList<Product>> getProducts();
|
||||||
|
|
||||||
|
@GET("products/{id}")
|
||||||
|
Call<Product> getProduct(@Path("id") int id);
|
||||||
|
|
||||||
|
@GET("products")
|
||||||
|
Call<ArrayList<Product>> getProducts(@Query("filter[category]") String category);
|
||||||
|
|
||||||
|
@GET("products")
|
||||||
|
Call<ArrayList<Product>> search(@Query("search") String search);
|
||||||
|
|
||||||
|
@GET("products")
|
||||||
|
Call<ArrayList<Product>> filter(@QueryMap Map<String, String> filter);
|
||||||
|
|
||||||
|
@GET("products/count")
|
||||||
|
Call<ArrayList<Product>> getProductsCount();
|
||||||
|
|
||||||
|
}
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package me.gilo.woodroid.data;
|
package me.gilo.woodroid.data.api;
|
||||||
|
|
||||||
|
|
||||||
import me.gilo.woodroid.models.Attribute;
|
import me.gilo.woodroid.models.Attribute;
|
||||||
@ -6,9 +6,11 @@ import me.gilo.woodroid.models.Coupon;
|
|||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
import retrofit2.http.*;
|
import retrofit2.http.*;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public interface AttributeAPI {
|
public interface ProductAttributeAPI {
|
||||||
|
|
||||||
@Headers("Content-Type: application/json")
|
@Headers("Content-Type: application/json")
|
||||||
@POST("products/attributes")
|
@POST("products/attributes")
|
||||||
@ -33,4 +35,7 @@ public interface AttributeAPI {
|
|||||||
@POST("products/attributes/batch")
|
@POST("products/attributes/batch")
|
||||||
Call<String> batch(@Body Attribute body);
|
Call<String> batch(@Body Attribute body);
|
||||||
|
|
||||||
|
@GET("coupons")
|
||||||
|
Call<ArrayList<Attribute>> filter(@QueryMap Map<String, String> filter);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1,14 +1,17 @@
|
|||||||
package me.gilo.woodroid.data;
|
package me.gilo.woodroid.data.api;
|
||||||
|
|
||||||
|
|
||||||
import me.gilo.woodroid.models.Attribute;
|
import me.gilo.woodroid.models.Attribute;
|
||||||
import me.gilo.woodroid.models.AttributeTerm;
|
import me.gilo.woodroid.models.AttributeTerm;
|
||||||
|
import me.gilo.woodroid.models.Coupon;
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
import retrofit2.http.*;
|
import retrofit2.http.*;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public interface AttributeTermAPI {
|
public interface ProductAttributeTermAPI {
|
||||||
|
|
||||||
@Headers("Content-Type: application/json")
|
@Headers("Content-Type: application/json")
|
||||||
@POST("products/attributes/{id}/terms")
|
@POST("products/attributes/{id}/terms")
|
||||||
@ -33,4 +36,7 @@ public interface AttributeTermAPI {
|
|||||||
@POST("products/attributes/batch")
|
@POST("products/attributes/batch")
|
||||||
Call<String> batch(@Body AttributeTerm body);
|
Call<String> batch(@Body AttributeTerm body);
|
||||||
|
|
||||||
|
@GET("coupons")
|
||||||
|
Call<ArrayList<AttributeTerm>> filter(@QueryMap Map<String, String> filter);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package me.gilo.woodroid.data;
|
package me.gilo.woodroid.data.api;
|
||||||
|
|
||||||
|
|
||||||
import me.gilo.woodroid.models.Category;
|
import me.gilo.woodroid.models.Category;
|
||||||
@ -6,9 +6,11 @@ import me.gilo.woodroid.models.Coupon;
|
|||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
import retrofit2.http.*;
|
import retrofit2.http.*;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public interface CategoryAPI {
|
public interface ProductCategoryAPI {
|
||||||
|
|
||||||
@Headers("Content-Type: application/json")
|
@Headers("Content-Type: application/json")
|
||||||
@POST("products/categories")
|
@POST("products/categories")
|
||||||
@ -33,4 +35,7 @@ public interface CategoryAPI {
|
|||||||
@POST("products/categories/batch")
|
@POST("products/categories/batch")
|
||||||
Call<String> batch(@Body Category body);
|
Call<String> batch(@Body Category body);
|
||||||
|
|
||||||
|
@GET("coupons")
|
||||||
|
Call<ArrayList<Category>> filter(@QueryMap Map<String, String> filter);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package me.gilo.woodroid.data;
|
package me.gilo.woodroid.data.api;
|
||||||
|
|
||||||
|
|
||||||
import me.gilo.woodroid.data.callbacks.ReviewsData;
|
import me.gilo.woodroid.data.callbacks.ReviewsData;
|
||||||
@ -7,7 +7,9 @@ import me.gilo.woodroid.models.ProductReview;
|
|||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
import retrofit2.http.*;
|
import retrofit2.http.*;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public interface ProductReviewAPI {
|
public interface ProductReviewAPI {
|
||||||
|
|
||||||
@ -34,4 +36,7 @@ public interface ProductReviewAPI {
|
|||||||
@POST("products/reviews/batch")
|
@POST("products/reviews/batch")
|
||||||
Call<String> batch(@Body ProductReview body);
|
Call<String> batch(@Body ProductReview body);
|
||||||
|
|
||||||
|
@GET("coupons")
|
||||||
|
Call<ArrayList<ProductReview>> filter(@QueryMap Map<String, String> filter);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package me.gilo.woodroid.data;
|
package me.gilo.woodroid.data.api;
|
||||||
|
|
||||||
|
|
||||||
import me.gilo.woodroid.models.Coupon;
|
import me.gilo.woodroid.models.Coupon;
|
||||||
@ -6,9 +6,11 @@ import me.gilo.woodroid.models.Tag;
|
|||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
import retrofit2.http.*;
|
import retrofit2.http.*;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public interface TagAPI {
|
public interface ProductTagAPI {
|
||||||
|
|
||||||
@Headers("Content-Type: application/json")
|
@Headers("Content-Type: application/json")
|
||||||
@POST("products/tags")
|
@POST("products/tags")
|
||||||
@ -33,4 +35,7 @@ public interface TagAPI {
|
|||||||
@POST("products/tags/batch")
|
@POST("products/tags/batch")
|
||||||
Call<String> batch(@Body Tag body);
|
Call<String> batch(@Body Tag body);
|
||||||
|
|
||||||
|
@GET("coupons")
|
||||||
|
Call<ArrayList<Tag>> filter(@QueryMap Map<String, String> filter);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -0,0 +1,46 @@
|
|||||||
|
package me.gilo.woodroid.data.api;
|
||||||
|
|
||||||
|
|
||||||
|
import me.gilo.woodroid.models.Coupon;
|
||||||
|
import me.gilo.woodroid.models.OrderNote;
|
||||||
|
import me.gilo.woodroid.models.Product;
|
||||||
|
import me.gilo.woodroid.models.Variation;
|
||||||
|
import retrofit2.Call;
|
||||||
|
import retrofit2.http.*;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public interface ProductVariationAPI {
|
||||||
|
|
||||||
|
@Headers("Content-Type: application/json")
|
||||||
|
@POST("products/{id}/variations")
|
||||||
|
Call<Variation> create(@Path("id") int product_id, @Body Variation body);
|
||||||
|
|
||||||
|
@GET("products/{id}/variations/{variation_id}")
|
||||||
|
Call<Variation> view(@Path("id") int product_id, @Path("variation_id") int variation_id);
|
||||||
|
|
||||||
|
@GET("products/{id}/variations")
|
||||||
|
Call<List<Variation>> list(@Path("id") int product_id);
|
||||||
|
|
||||||
|
@Headers("Content-Type: application/json")
|
||||||
|
@PUT("products/{id}/variations/{variation_id}")
|
||||||
|
Call<Variation> update(@Path("id") int product_id, @Path("variation_id") int variation_id, @Body Variation body);
|
||||||
|
|
||||||
|
@DELETE("products/{id}/variations/{variation_id}")
|
||||||
|
Call<Variation> delete(@Path("id") int product_id, @Path("variation_id") int variation_id);
|
||||||
|
|
||||||
|
@DELETE("products/{id}/variations/{variation_id}")
|
||||||
|
Call<Variation> delete(@Path("id") int product_id, @Path("variation_id") int variation_id, @Query("force") boolean force);
|
||||||
|
|
||||||
|
@Headers("Content-Type: application/json")
|
||||||
|
@PUT("products/{id}/variations/{variation_id}")
|
||||||
|
Call<Variation> batch(@Path("id") int product_id, @Path("variation_id") int variation_id, @Body Product body);
|
||||||
|
|
||||||
|
@GET("coupons")
|
||||||
|
Call<ArrayList<Variation>> filter(@QueryMap Map<String, String> filter);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package me.gilo.woodroid.data;
|
package me.gilo.woodroid.data.api;
|
||||||
|
|
||||||
|
|
||||||
import me.gilo.woodroid.models.Coupon;
|
import me.gilo.woodroid.models.Coupon;
|
||||||
@ -7,13 +7,15 @@ import me.gilo.woodroid.models.Refund;
|
|||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
import retrofit2.http.*;
|
import retrofit2.http.*;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public interface RefundAPI {
|
public interface RefundAPI {
|
||||||
|
|
||||||
@Headers("Content-Type: application/json")
|
@Headers("Content-Type: application/json")
|
||||||
@POST("orders/{id}/refunds")
|
@POST("orders/{id}/refunds")
|
||||||
Call<Refund> create(@Body Refund body);
|
Call<Refund> create(@Path("id") int order_id, @Body Refund body);
|
||||||
|
|
||||||
@GET("orders/{id}/refunds/{refund_id}")
|
@GET("orders/{id}/refunds/{refund_id}")
|
||||||
Call<Refund> view(@Path("id") int order_id, @Path("refund_id") int refund_id);
|
Call<Refund> view(@Path("id") int order_id, @Path("refund_id") int refund_id);
|
||||||
@ -27,4 +29,7 @@ public interface RefundAPI {
|
|||||||
@DELETE("orders/{id}/refunds/{refund_id}")
|
@DELETE("orders/{id}/refunds/{refund_id}")
|
||||||
Call<Refund> delete(@Path("id") int order_id, @Path("refund_id") int refund_id, @Query("force") boolean force);
|
Call<Refund> delete(@Path("id") int order_id, @Path("refund_id") int refund_id, @Query("force") boolean force);
|
||||||
|
|
||||||
|
@GET("coupons")
|
||||||
|
Call<ArrayList<Refund>> filter(@QueryMap Map<String, String> filter);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package me.gilo.woodroid.data;
|
package me.gilo.woodroid.data.api;
|
||||||
|
|
||||||
|
|
||||||
import me.gilo.woodroid.models.Coupon;
|
import me.gilo.woodroid.models.Coupon;
|
||||||
@ -6,7 +6,9 @@ import me.gilo.woodroid.models.ShippingClass;
|
|||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
import retrofit2.http.*;
|
import retrofit2.http.*;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public interface ShippingClassAPI {
|
public interface ShippingClassAPI {
|
||||||
|
|
||||||
@ -33,4 +35,7 @@ public interface ShippingClassAPI {
|
|||||||
@POST("products/shipping_classes/batch")
|
@POST("products/shipping_classes/batch")
|
||||||
Call<String> batch(@Body ShippingClass body);
|
Call<String> batch(@Body ShippingClass body);
|
||||||
|
|
||||||
|
@GET("coupons")
|
||||||
|
Call<ArrayList<ShippingClass>> filter(@QueryMap Map<String, String> filter);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -0,0 +1,41 @@
|
|||||||
|
package me.gilo.woodroid.data.api;
|
||||||
|
|
||||||
|
|
||||||
|
import me.gilo.woodroid.models.Coupon;
|
||||||
|
import me.gilo.woodroid.models.ShippingZone;
|
||||||
|
import retrofit2.Call;
|
||||||
|
import retrofit2.http.*;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public interface ShippingZoneAPI {
|
||||||
|
|
||||||
|
@Headers("Content-Type: application/json")
|
||||||
|
@POST("shipping/zones")
|
||||||
|
Call<ShippingZone> create(@Body ShippingZone body);
|
||||||
|
|
||||||
|
@GET("shipping/zones/{id}")
|
||||||
|
Call<ShippingZone> view(@Path("id") int id);
|
||||||
|
|
||||||
|
@GET("shipping/zones")
|
||||||
|
Call<List<ShippingZone>> list();
|
||||||
|
|
||||||
|
@Headers("Content-Type: application/json")
|
||||||
|
@PUT("shipping/zones/{id}")
|
||||||
|
Call<ShippingZone> update(@Path("id") int id, @Body ShippingZone body);
|
||||||
|
|
||||||
|
@DELETE("shipping/zones/{id}")
|
||||||
|
Call<ShippingZone> delete(@Path("id") int id);
|
||||||
|
|
||||||
|
@DELETE("shipping/zones/{id}")
|
||||||
|
Call<ShippingZone> delete(@Path("id") int id, @Query("force") boolean force);
|
||||||
|
|
||||||
|
@POST("shipping/zones/batch")
|
||||||
|
Call<String> batch(@Body ShippingZone body);
|
||||||
|
|
||||||
|
@GET("coupons")
|
||||||
|
Call<ArrayList<ShippingZone>> filter(@QueryMap Map<String, String> filter);
|
||||||
|
|
||||||
|
}
|
||||||
@ -1,11 +1,13 @@
|
|||||||
package me.gilo.woodroid.data;
|
package me.gilo.woodroid.data.api;
|
||||||
|
|
||||||
|
|
||||||
import me.gilo.woodroid.models.Coupon;
|
import me.gilo.woodroid.models.Coupon;
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
import retrofit2.http.*;
|
import retrofit2.http.*;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public interface ShippingZoneLocationAPI {
|
public interface ShippingZoneLocationAPI {
|
||||||
|
|
||||||
@ -32,4 +34,7 @@ public interface ShippingZoneLocationAPI {
|
|||||||
@POST("coupons/batch")
|
@POST("coupons/batch")
|
||||||
Call<String> batch(@Body Coupon body);
|
Call<String> batch(@Body Coupon body);
|
||||||
|
|
||||||
|
@GET("coupons")
|
||||||
|
Call<ArrayList<ShippingZoneLocationAPI>> filter(@QueryMap Map<String, String> filter);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package me.gilo.woodroid.data;
|
package me.gilo.woodroid.data.api;
|
||||||
|
|
||||||
|
|
||||||
import me.gilo.woodroid.models.Coupon;
|
import me.gilo.woodroid.models.Coupon;
|
||||||
@ -6,7 +6,9 @@ import me.gilo.woodroid.models.TaxClass;
|
|||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
import retrofit2.http.*;
|
import retrofit2.http.*;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public interface TaxClassAPI {
|
public interface TaxClassAPI {
|
||||||
|
|
||||||
@ -23,4 +25,7 @@ public interface TaxClassAPI {
|
|||||||
@DELETE("taxes/classes/{id}")
|
@DELETE("taxes/classes/{id}")
|
||||||
Call<TaxClass> delete(@Path("id") int id, @Query("force") boolean force);
|
Call<TaxClass> delete(@Path("id") int id, @Query("force") boolean force);
|
||||||
|
|
||||||
|
@GET("coupons")
|
||||||
|
Call<ArrayList<TaxClass>> filter(@QueryMap Map<String, String> filter);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package me.gilo.woodroid.data;
|
package me.gilo.woodroid.data.api;
|
||||||
|
|
||||||
|
|
||||||
import me.gilo.woodroid.models.Coupon;
|
import me.gilo.woodroid.models.Coupon;
|
||||||
@ -6,7 +6,9 @@ import me.gilo.woodroid.models.TaxRate;
|
|||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
import retrofit2.http.*;
|
import retrofit2.http.*;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public interface TaxRateAPI {
|
public interface TaxRateAPI {
|
||||||
|
|
||||||
@ -33,4 +35,7 @@ public interface TaxRateAPI {
|
|||||||
@POST("taxes/batch")
|
@POST("taxes/batch")
|
||||||
Call<String> batch(@Body TaxRate body);
|
Call<String> batch(@Body TaxRate body);
|
||||||
|
|
||||||
|
@GET("coupons")
|
||||||
|
Call<ArrayList<TaxRate>> filter(@QueryMap Map<String, String> filter);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -4,10 +4,8 @@ import android.os.Parcel;
|
|||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by Aron on 11/26/2015.
|
|
||||||
*/
|
|
||||||
public class Attribute implements Serializable {
|
public class Attribute implements Serializable {
|
||||||
|
int id;
|
||||||
private String name;
|
private String name;
|
||||||
private String slug;
|
private String slug;
|
||||||
private int position;
|
private int position;
|
||||||
@ -15,13 +13,13 @@ public class Attribute implements Serializable {
|
|||||||
private boolean variation;
|
private boolean variation;
|
||||||
private String[] options;
|
private String[] options;
|
||||||
|
|
||||||
protected Attribute(Parcel in) {
|
|
||||||
name = in.readString();
|
public int getId() {
|
||||||
slug = in.readString();
|
return id;
|
||||||
position = in.readInt();
|
}
|
||||||
visible = in.readByte() != 0;
|
|
||||||
variation = in.readByte() != 0;
|
public void setId(int id) {
|
||||||
options = in.createStringArray();
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
|
|||||||
@ -0,0 +1,33 @@
|
|||||||
|
package me.gilo.woodroid.models;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
public class ShippingZone {
|
||||||
|
private int id;
|
||||||
|
private String name;
|
||||||
|
private int order;
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getOrder() {
|
||||||
|
return order;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOrder(int order) {
|
||||||
|
this.order = order;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,8 +1,559 @@
|
|||||||
package me.gilo.woodroid.models;
|
package me.gilo.woodroid.models;
|
||||||
|
|
||||||
/**
|
import java.util.ArrayList;
|
||||||
* Created by Aron on 11/26/2015.
|
import java.util.Date;
|
||||||
*/
|
|
||||||
public class Variation {
|
public class Variation {
|
||||||
|
|
||||||
|
int id;
|
||||||
|
String title;
|
||||||
|
String name;
|
||||||
|
String slug;
|
||||||
|
String permalink;
|
||||||
|
String type;
|
||||||
|
String status;
|
||||||
|
boolean featured;
|
||||||
|
String catalog_visibility;
|
||||||
|
String description;
|
||||||
|
String short_description;
|
||||||
|
String sku;
|
||||||
|
String price;
|
||||||
|
String regular_price;
|
||||||
|
String sale_price;
|
||||||
|
Date date_on_sale_from;
|
||||||
|
Date date_on_sale_from_gmt;
|
||||||
|
Date date_on_sale_to;
|
||||||
|
Date date_on_sale_to_gmt;
|
||||||
|
String price_html;
|
||||||
|
boolean on_sale;
|
||||||
|
boolean purchasable;
|
||||||
|
int total_sales;
|
||||||
|
boolean virtual;
|
||||||
|
boolean downloadable;
|
||||||
|
ArrayList<Download> downloads;
|
||||||
|
int download_limit;
|
||||||
|
int download_expiry;
|
||||||
|
String external_url;
|
||||||
|
String button_text;
|
||||||
|
String tax_status;
|
||||||
|
String tax_class;
|
||||||
|
boolean manage_stock;
|
||||||
|
int stock_quantity;
|
||||||
|
boolean in_stock;
|
||||||
|
String backorders;
|
||||||
|
boolean backorders_allowed;
|
||||||
|
boolean backordered;
|
||||||
|
boolean sold_individually;
|
||||||
|
String weight;
|
||||||
|
Object dimensions;
|
||||||
|
boolean shipping_required;
|
||||||
|
boolean shipping_taxable;
|
||||||
|
String shipping_class;
|
||||||
|
int shipping_class_id;
|
||||||
|
boolean reviews_allowed;
|
||||||
|
String average_rating;
|
||||||
|
int rating_count;
|
||||||
|
ArrayList<Integer> related_ids;
|
||||||
|
ArrayList<Integer> upsell_ids;
|
||||||
|
ArrayList<Integer> cross_sell_ids;
|
||||||
|
int parent_id;
|
||||||
|
String purchase_note;
|
||||||
|
ArrayList<Category> categories;
|
||||||
|
ArrayList<Tag> tags;
|
||||||
|
ArrayList<Attribute> attributes;
|
||||||
|
ArrayList<DefaultAttribute> default_attributes;
|
||||||
|
ArrayList<Integer> grouped_products;
|
||||||
|
int menu_order;
|
||||||
|
ArrayList<Metadata> meta_data;
|
||||||
|
ArrayList<Image> images;
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTitle(String title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSlug() {
|
||||||
|
return slug;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSlug(String slug) {
|
||||||
|
this.slug = slug;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPermalink() {
|
||||||
|
return permalink;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPermalink(String permalink) {
|
||||||
|
this.permalink = permalink;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(String type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(String status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isFeatured() {
|
||||||
|
return featured;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFeatured(boolean featured) {
|
||||||
|
this.featured = featured;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCatalog_visibility() {
|
||||||
|
return catalog_visibility;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCatalog_visibility(String catalog_visibility) {
|
||||||
|
this.catalog_visibility = catalog_visibility;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getShort_description() {
|
||||||
|
return short_description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setShort_description(String short_description) {
|
||||||
|
this.short_description = short_description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSku() {
|
||||||
|
return sku;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSku(String sku) {
|
||||||
|
this.sku = sku;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPrice() {
|
||||||
|
return price;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPrice(String price) {
|
||||||
|
this.price = price;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRegular_price() {
|
||||||
|
return regular_price;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRegular_price(String regular_price) {
|
||||||
|
this.regular_price = regular_price;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSale_price() {
|
||||||
|
return sale_price;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSale_price(String sale_price) {
|
||||||
|
this.sale_price = sale_price;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getDate_on_sale_from() {
|
||||||
|
return date_on_sale_from;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDate_on_sale_from(Date date_on_sale_from) {
|
||||||
|
this.date_on_sale_from = date_on_sale_from;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getDate_on_sale_from_gmt() {
|
||||||
|
return date_on_sale_from_gmt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDate_on_sale_from_gmt(Date date_on_sale_from_gmt) {
|
||||||
|
this.date_on_sale_from_gmt = date_on_sale_from_gmt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getDate_on_sale_to() {
|
||||||
|
return date_on_sale_to;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDate_on_sale_to(Date date_on_sale_to) {
|
||||||
|
this.date_on_sale_to = date_on_sale_to;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getDate_on_sale_to_gmt() {
|
||||||
|
return date_on_sale_to_gmt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDate_on_sale_to_gmt(Date date_on_sale_to_gmt) {
|
||||||
|
this.date_on_sale_to_gmt = date_on_sale_to_gmt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPrice_html() {
|
||||||
|
return price_html;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPrice_html(String price_html) {
|
||||||
|
this.price_html = price_html;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isOn_sale() {
|
||||||
|
return on_sale;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOn_sale(boolean on_sale) {
|
||||||
|
this.on_sale = on_sale;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isPurchasable() {
|
||||||
|
return purchasable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPurchasable(boolean purchasable) {
|
||||||
|
this.purchasable = purchasable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getTotal_sales() {
|
||||||
|
return total_sales;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTotal_sales(int total_sales) {
|
||||||
|
this.total_sales = total_sales;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isVirtual() {
|
||||||
|
return virtual;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVirtual(boolean virtual) {
|
||||||
|
this.virtual = virtual;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isDownloadable() {
|
||||||
|
return downloadable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDownloadable(boolean downloadable) {
|
||||||
|
this.downloadable = downloadable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<Download> getDownloads() {
|
||||||
|
return downloads;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDownloads(ArrayList<Download> downloads) {
|
||||||
|
this.downloads = downloads;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getDownload_limit() {
|
||||||
|
return download_limit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDownload_limit(int download_limit) {
|
||||||
|
this.download_limit = download_limit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getDownload_expiry() {
|
||||||
|
return download_expiry;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDownload_expiry(int download_expiry) {
|
||||||
|
this.download_expiry = download_expiry;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getExternal_url() {
|
||||||
|
return external_url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExternal_url(String external_url) {
|
||||||
|
this.external_url = external_url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getButton_text() {
|
||||||
|
return button_text;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setButton_text(String button_text) {
|
||||||
|
this.button_text = button_text;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTax_status() {
|
||||||
|
return tax_status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTax_status(String tax_status) {
|
||||||
|
this.tax_status = tax_status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTax_class() {
|
||||||
|
return tax_class;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTax_class(String tax_class) {
|
||||||
|
this.tax_class = tax_class;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isManage_stock() {
|
||||||
|
return manage_stock;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setManage_stock(boolean manage_stock) {
|
||||||
|
this.manage_stock = manage_stock;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getStock_quantity() {
|
||||||
|
return stock_quantity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStock_quantity(int stock_quantity) {
|
||||||
|
this.stock_quantity = stock_quantity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isIn_stock() {
|
||||||
|
return in_stock;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIn_stock(boolean in_stock) {
|
||||||
|
this.in_stock = in_stock;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBackorders() {
|
||||||
|
return backorders;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBackorders(String backorders) {
|
||||||
|
this.backorders = backorders;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isBackorders_allowed() {
|
||||||
|
return backorders_allowed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBackorders_allowed(boolean backorders_allowed) {
|
||||||
|
this.backorders_allowed = backorders_allowed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isBackordered() {
|
||||||
|
return backordered;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBackordered(boolean backordered) {
|
||||||
|
this.backordered = backordered;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isSold_individually() {
|
||||||
|
return sold_individually;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSold_individually(boolean sold_individually) {
|
||||||
|
this.sold_individually = sold_individually;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getWeight() {
|
||||||
|
return weight;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWeight(String weight) {
|
||||||
|
this.weight = weight;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getDimensions() {
|
||||||
|
return dimensions;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDimensions(Object dimensions) {
|
||||||
|
this.dimensions = dimensions;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isShipping_required() {
|
||||||
|
return shipping_required;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setShipping_required(boolean shipping_required) {
|
||||||
|
this.shipping_required = shipping_required;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isShipping_taxable() {
|
||||||
|
return shipping_taxable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setShipping_taxable(boolean shipping_taxable) {
|
||||||
|
this.shipping_taxable = shipping_taxable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getShipping_class() {
|
||||||
|
return shipping_class;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setShipping_class(String shipping_class) {
|
||||||
|
this.shipping_class = shipping_class;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getShipping_class_id() {
|
||||||
|
return shipping_class_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setShipping_class_id(int shipping_class_id) {
|
||||||
|
this.shipping_class_id = shipping_class_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isReviews_allowed() {
|
||||||
|
return reviews_allowed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReviews_allowed(boolean reviews_allowed) {
|
||||||
|
this.reviews_allowed = reviews_allowed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAverage_rating() {
|
||||||
|
return average_rating;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAverage_rating(String average_rating) {
|
||||||
|
this.average_rating = average_rating;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getRating_count() {
|
||||||
|
return rating_count;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRating_count(int rating_count) {
|
||||||
|
this.rating_count = rating_count;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<Integer> getRelated_ids() {
|
||||||
|
return related_ids;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRelated_ids(ArrayList<Integer> related_ids) {
|
||||||
|
this.related_ids = related_ids;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<Integer> getUpsell_ids() {
|
||||||
|
return upsell_ids;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUpsell_ids(ArrayList<Integer> upsell_ids) {
|
||||||
|
this.upsell_ids = upsell_ids;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<Integer> getCross_sell_ids() {
|
||||||
|
return cross_sell_ids;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCross_sell_ids(ArrayList<Integer> cross_sell_ids) {
|
||||||
|
this.cross_sell_ids = cross_sell_ids;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getParent_id() {
|
||||||
|
return parent_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setParent_id(int parent_id) {
|
||||||
|
this.parent_id = parent_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPurchase_note() {
|
||||||
|
return purchase_note;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPurchase_note(String purchase_note) {
|
||||||
|
this.purchase_note = purchase_note;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<Category> getCategories() {
|
||||||
|
return categories;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCategories(ArrayList<Category> categories) {
|
||||||
|
this.categories = categories;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<Tag> getTags() {
|
||||||
|
return tags;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTags(ArrayList<Tag> tags) {
|
||||||
|
this.tags = tags;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<Attribute> getAttributes() {
|
||||||
|
return attributes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAttributes(ArrayList<Attribute> attributes) {
|
||||||
|
this.attributes = attributes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<DefaultAttribute> getDefault_attributes() {
|
||||||
|
return default_attributes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDefault_attributes(ArrayList<DefaultAttribute> default_attributes) {
|
||||||
|
this.default_attributes = default_attributes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<Integer> getGrouped_products() {
|
||||||
|
return grouped_products;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGrouped_products(ArrayList<Integer> grouped_products) {
|
||||||
|
this.grouped_products = grouped_products;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMenu_order() {
|
||||||
|
return menu_order;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMenu_order(int menu_order) {
|
||||||
|
this.menu_order = menu_order;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<Metadata> getMeta_data() {
|
||||||
|
return meta_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMeta_data(ArrayList<Metadata> meta_data) {
|
||||||
|
this.meta_data = meta_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<Image> getImages() {
|
||||||
|
return images;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setImages(ArrayList<Image> images) {
|
||||||
|
this.images = images;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
16
woodroid/src/main/java/me/gilo/woodroid/repo/APIMethod.java
Normal file
16
woodroid/src/main/java/me/gilo/woodroid/repo/APIMethod.java
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
package me.gilo.woodroid.repo;
|
||||||
|
|
||||||
|
import me.gilo.woodroid.models.Coupon;
|
||||||
|
import retrofit2.Call;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface APIMethod<T> {
|
||||||
|
Call<T> create(T data);
|
||||||
|
Call<T> get(int id);
|
||||||
|
Call<List<T>> all();
|
||||||
|
Call<T> update(int id, T data);
|
||||||
|
Call<T> delete(int id);
|
||||||
|
Call<T> delete(int id, boolean force);
|
||||||
|
|
||||||
|
}
|
||||||
@ -1,22 +1,17 @@
|
|||||||
package me.gilo.woodroid.repo;
|
package me.gilo.woodroid.repo;
|
||||||
|
|
||||||
import me.gilo.woodroid.data.CouponAPI;
|
import me.gilo.woodroid.data.api.CouponAPI;
|
||||||
import me.gilo.woodroid.models.Coupon;
|
import me.gilo.woodroid.models.Coupon;
|
||||||
import okhttp3.OkHttpClient;
|
|
||||||
import okhttp3.logging.HttpLoggingInterceptor;
|
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
import retrofit2.Retrofit;
|
|
||||||
import retrofit2.converter.gson.GsonConverterFactory;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
public class CouponRepository extends WooRepository{
|
public class CouponRepository extends WooRepository{
|
||||||
|
|
||||||
private final CouponAPI apiService;
|
private final CouponAPI apiService;
|
||||||
|
|
||||||
public CouponRepository(String baseUrl, String consumerKey, String consumerSecret) {
|
public CouponRepository(String baseUrl, String consumerKey, String consumerSecret) {
|
||||||
super(baseUrl, consumerKey, consumerSecret);
|
super("coupon", baseUrl, consumerKey, consumerSecret);
|
||||||
apiService = retrofit.create(CouponAPI.class);
|
apiService = retrofit.create(CouponAPI.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,46 @@
|
|||||||
|
package me.gilo.woodroid.repo;
|
||||||
|
|
||||||
|
import me.gilo.woodroid.data.api.CustomerAPI;
|
||||||
|
import me.gilo.woodroid.data.api.OrderAPI;
|
||||||
|
import me.gilo.woodroid.models.Customer;
|
||||||
|
import me.gilo.woodroid.models.Order;
|
||||||
|
import retrofit2.Call;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class CustomerRepository extends WooRepository{
|
||||||
|
|
||||||
|
private final CustomerAPI apiService;
|
||||||
|
|
||||||
|
public CustomerRepository(String baseUrl, String consumerKey, String consumerSecret) {
|
||||||
|
super("customers", baseUrl, consumerKey, consumerSecret);
|
||||||
|
apiService = retrofit.create(CustomerAPI.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Call<Customer> create(Customer customer) {
|
||||||
|
return apiService.create(customer);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Call<Customer> customer(int id) {
|
||||||
|
return apiService.view(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Call<List<Customer>> customers() {
|
||||||
|
return apiService.list();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Call<Customer> update(int id, Customer customer) {
|
||||||
|
return apiService.update(id, customer);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Call<Customer> delete(int id) {
|
||||||
|
return apiService.delete(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Call<Customer> delete(int id, boolean force) {
|
||||||
|
return apiService.delete(id, force);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,73 @@
|
|||||||
|
package me.gilo.woodroid.repo;
|
||||||
|
|
||||||
|
import me.gilo.woodroid.data.api.OrderAPI;
|
||||||
|
import me.gilo.woodroid.models.Order;
|
||||||
|
import me.gilo.woodroid.models.OrderNote;
|
||||||
|
import me.gilo.woodroid.repo.order.OrderNoteRepository;
|
||||||
|
import me.gilo.woodroid.repo.order.RefundRepository;
|
||||||
|
import retrofit2.Call;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class OrderRepository extends WooRepository {
|
||||||
|
|
||||||
|
private final OrderAPI apiService;
|
||||||
|
|
||||||
|
OrderNoteRepository orderNoteRepository;
|
||||||
|
RefundRepository refundRepository;
|
||||||
|
|
||||||
|
public OrderRepository(String baseUrl, String consumerKey, String consumerSecret) {
|
||||||
|
super("orders", baseUrl, consumerKey, consumerSecret);
|
||||||
|
apiService = retrofit.create(OrderAPI.class);
|
||||||
|
|
||||||
|
orderNoteRepository = new OrderNoteRepository(baseUrl, consumerKey, consumerSecret);
|
||||||
|
refundRepository = new RefundRepository(baseUrl, consumerKey, consumerSecret);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Call<Order> create(Order order) {
|
||||||
|
return apiService.create(order);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Call<Order> order(int id) {
|
||||||
|
return apiService.view(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Call<List<Order>> orders() {
|
||||||
|
return apiService.list();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Call<Order> update(int id, Order order) {
|
||||||
|
return apiService.update(id, order);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Call<Order> delete(int id) {
|
||||||
|
return apiService.delete(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Call<Order> delete(int id, boolean force) {
|
||||||
|
return apiService.delete(id, force);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Call<OrderNote> createNote(Order order, OrderNote note) {
|
||||||
|
return orderNoteRepository.create(order, note);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Call<OrderNote> note(Order order, int id) {
|
||||||
|
return orderNoteRepository.note(order, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Call<List<OrderNote>> notes(Order order) {
|
||||||
|
return orderNoteRepository.notes(order);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Call<OrderNote> deleteNote(Order order, int id) {
|
||||||
|
return orderNoteRepository.delete(order, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Call<OrderNote> deleteNote(Order order, int id, boolean force) {
|
||||||
|
return orderNoteRepository.delete(order, id, force);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -1,9 +1,10 @@
|
|||||||
package me.gilo.woodroid.repo;
|
package me.gilo.woodroid.repo;
|
||||||
|
|
||||||
import me.gilo.woodroid.data.API;
|
import me.gilo.woodroid.data.api.API;
|
||||||
import me.gilo.woodroid.data.RestAdapter;
|
import me.gilo.woodroid.data.api.ProductAPI;
|
||||||
import me.gilo.woodroid.models.Category;
|
import me.gilo.woodroid.data.api.ProductCategoryAPI;
|
||||||
import me.gilo.woodroid.models.Product;
|
import me.gilo.woodroid.models.Product;
|
||||||
|
import me.gilo.woodroid.repo.WooRepository;
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -11,9 +12,11 @@ import java.util.HashMap;
|
|||||||
|
|
||||||
public class ProductRepository extends WooRepository {
|
public class ProductRepository extends WooRepository {
|
||||||
|
|
||||||
|
private final ProductAPI apiService;
|
||||||
|
|
||||||
public ProductRepository(String baseUrl, String consumerKey, String consumerSecret) {
|
public ProductRepository(String baseUrl, String consumerKey, String consumerSecret) {
|
||||||
super(baseUrl, consumerKey, consumerSecret);
|
super("products", baseUrl, consumerKey, consumerSecret);
|
||||||
|
apiService = retrofit.create(ProductAPI.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO
|
//TODO
|
||||||
|
|||||||
@ -1,17 +1,15 @@
|
|||||||
package me.gilo.woodroid.repo;
|
package me.gilo.woodroid.repo;
|
||||||
|
|
||||||
import me.gilo.woodroid.data.API;
|
|
||||||
import me.gilo.woodroid.data.RestAdapter;
|
import me.gilo.woodroid.data.RestAdapter;
|
||||||
import me.gilo.woodroid.models.Category;
|
import me.gilo.woodroid.data.api.CouponAPI;
|
||||||
import me.gilo.woodroid.models.Product;
|
import me.gilo.woodroid.models.Coupon;
|
||||||
import okhttp3.OkHttpClient;
|
import okhttp3.OkHttpClient;
|
||||||
import okhttp3.logging.HttpLoggingInterceptor;
|
import okhttp3.logging.HttpLoggingInterceptor;
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
import retrofit2.Retrofit;
|
import retrofit2.Retrofit;
|
||||||
import retrofit2.converter.gson.GsonConverterFactory;
|
import retrofit2.converter.gson.GsonConverterFactory;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.List;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
public class WooRepository {
|
public class WooRepository {
|
||||||
@ -20,10 +18,10 @@ public class WooRepository {
|
|||||||
private String consumerKey;
|
private String consumerKey;
|
||||||
private String consumerSecret;
|
private String consumerSecret;
|
||||||
|
|
||||||
RestAdapter restAdapter;
|
public RestAdapter restAdapter;
|
||||||
Retrofit retrofit;
|
public Retrofit retrofit;
|
||||||
|
|
||||||
public WooRepository(String baseUrl, String consumerKey, String consumerSecret) {
|
public WooRepository(String method, String baseUrl, String consumerKey, String consumerSecret) {
|
||||||
this.baseUrl = baseUrl;
|
this.baseUrl = baseUrl;
|
||||||
this.consumerKey = consumerKey;
|
this.consumerKey = consumerKey;
|
||||||
this.consumerSecret = consumerSecret;
|
this.consumerSecret = consumerSecret;
|
||||||
@ -34,7 +32,7 @@ public class WooRepository {
|
|||||||
restAdapter = new RestAdapter(baseUrl, consumerKey, consumerSecret);
|
restAdapter = new RestAdapter(baseUrl, consumerKey, consumerSecret);
|
||||||
|
|
||||||
OkHttpClient client = new OkHttpClient.Builder()
|
OkHttpClient client = new OkHttpClient.Builder()
|
||||||
.addInterceptor(restAdapter.getInterceptor("coupons", null))
|
.addInterceptor(restAdapter.getInterceptor(method, null))
|
||||||
.addInterceptor(loggingInterceptor)
|
.addInterceptor(loggingInterceptor)
|
||||||
.readTimeout(30, TimeUnit.SECONDS)
|
.readTimeout(30, TimeUnit.SECONDS)
|
||||||
.writeTimeout(30, TimeUnit.SECONDS)
|
.writeTimeout(30, TimeUnit.SECONDS)
|
||||||
@ -46,9 +44,8 @@ public class WooRepository {
|
|||||||
.addConverterFactory(GsonConverterFactory.create())
|
.addConverterFactory(GsonConverterFactory.create())
|
||||||
.client(client)
|
.client(client)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,41 @@
|
|||||||
|
package me.gilo.woodroid.repo.order;
|
||||||
|
|
||||||
|
import me.gilo.woodroid.data.api.OrderNoteAPI;
|
||||||
|
import me.gilo.woodroid.models.Order;
|
||||||
|
import me.gilo.woodroid.models.OrderNote;
|
||||||
|
import me.gilo.woodroid.repo.WooRepository;
|
||||||
|
import retrofit2.Call;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class OrderNoteRepository extends WooRepository {
|
||||||
|
|
||||||
|
private final OrderNoteAPI apiService;
|
||||||
|
|
||||||
|
public OrderNoteRepository(String baseUrl, String consumerKey, String consumerSecret) {
|
||||||
|
super("orders", baseUrl, consumerKey, consumerSecret);
|
||||||
|
apiService = retrofit.create(OrderNoteAPI.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Call<OrderNote> create(Order order, OrderNote note) {
|
||||||
|
return apiService.create(order.getId(), note);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Call<OrderNote> note( Order order, int id) {
|
||||||
|
return apiService.view(order.getId(), id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Call<List<OrderNote>> notes(Order order) {
|
||||||
|
return apiService.list(order.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
public Call<OrderNote> delete(Order order, int id) {
|
||||||
|
return apiService.delete(order.getId(), id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Call<OrderNote> delete(Order order, int id, boolean force) {
|
||||||
|
return apiService.delete(order.getId(), id, force);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,42 @@
|
|||||||
|
package me.gilo.woodroid.repo.order;
|
||||||
|
|
||||||
|
import me.gilo.woodroid.data.api.RefundAPI;
|
||||||
|
import me.gilo.woodroid.models.Order;
|
||||||
|
import me.gilo.woodroid.models.Refund;
|
||||||
|
import me.gilo.woodroid.repo.WooRepository;
|
||||||
|
import retrofit2.Call;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class RefundRepository extends WooRepository {
|
||||||
|
|
||||||
|
private final RefundAPI apiService;
|
||||||
|
|
||||||
|
public RefundRepository(String baseUrl, String consumerKey, String consumerSecret) {
|
||||||
|
super("orders", baseUrl, consumerKey, consumerSecret);
|
||||||
|
apiService = retrofit.create(RefundAPI.class);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public Call<Refund> create(Order order, Refund refund) {
|
||||||
|
return apiService.create(order.getId(), refund);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Call<Refund> refund(Order order, int id) {
|
||||||
|
return apiService.view(order.getId(), id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Call<List<Refund>> refunds(Order order) {
|
||||||
|
return apiService.list(order.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
public Call<Refund> delete(Order order, int id) {
|
||||||
|
return apiService.delete(order.getId(), id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Call<Refund> delete(Order order, int id, boolean force) {
|
||||||
|
return apiService.delete(order.getId(), id, force);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,47 @@
|
|||||||
|
package me.gilo.woodroid.repo.product;
|
||||||
|
|
||||||
|
import me.gilo.woodroid.data.api.ProductAttributeAPI;
|
||||||
|
import me.gilo.woodroid.data.api.ProductCategoryAPI;
|
||||||
|
import me.gilo.woodroid.models.Attribute;
|
||||||
|
import me.gilo.woodroid.models.Category;
|
||||||
|
import me.gilo.woodroid.repo.WooRepository;
|
||||||
|
import retrofit2.Call;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class AttributeRepository extends WooRepository {
|
||||||
|
|
||||||
|
private final ProductAttributeAPI apiService;
|
||||||
|
|
||||||
|
public AttributeRepository(String baseUrl, String consumerKey, String consumerSecret) {
|
||||||
|
super("products/attributes", baseUrl, consumerKey, consumerSecret);
|
||||||
|
apiService = retrofit.create(ProductAttributeAPI.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Call<Attribute> create(Attribute attribute) {
|
||||||
|
return apiService.create(attribute);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Call<Attribute> attribute(int id) {
|
||||||
|
return apiService.view(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Call<List<Attribute>> attributes() {
|
||||||
|
return apiService.list();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Call<Attribute> update(int id, Attribute attribute) {
|
||||||
|
return apiService.update(id, attribute);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Call<Attribute> delete(int id) {
|
||||||
|
return apiService.delete(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Call<Attribute> delete(int id, boolean force) {
|
||||||
|
return apiService.delete(id, force);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,55 @@
|
|||||||
|
package me.gilo.woodroid.repo.product;
|
||||||
|
|
||||||
|
import me.gilo.woodroid.data.api.ProductAttributeTermAPI;
|
||||||
|
import me.gilo.woodroid.data.api.ProductCategoryAPI;
|
||||||
|
import me.gilo.woodroid.models.Attribute;
|
||||||
|
import me.gilo.woodroid.models.AttributeTerm;
|
||||||
|
import me.gilo.woodroid.models.Category;
|
||||||
|
import me.gilo.woodroid.repo.WooRepository;
|
||||||
|
import retrofit2.Call;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class AttributeTermRepository extends WooRepository {
|
||||||
|
|
||||||
|
private final ProductAttributeTermAPI apiService;
|
||||||
|
|
||||||
|
Attribute attribute;
|
||||||
|
|
||||||
|
public AttributeTermRepository(String baseUrl, String consumerKey, String consumerSecret, Attribute attribute) {
|
||||||
|
super("products/categories", baseUrl, consumerKey, consumerSecret);
|
||||||
|
apiService = retrofit.create(ProductAttributeTermAPI.class);
|
||||||
|
|
||||||
|
this.attribute = attribute;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Call<AttributeTerm> create(AttributeTerm term) {
|
||||||
|
return apiService.create(term);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAttribute(Attribute attribute) {
|
||||||
|
this.attribute = attribute;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Call<AttributeTerm> term(int id) {
|
||||||
|
return apiService.view(attribute.getId(), id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Call<List<AttributeTerm>> terms() {
|
||||||
|
return apiService.list(attribute.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
public Call<AttributeTerm> update(int id, AttributeTerm term) {
|
||||||
|
return apiService.update(attribute.getId(), id, term);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Call<AttributeTerm> delete(int id) {
|
||||||
|
return apiService.delete(attribute.getId(), id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Call<AttributeTerm> delete(int id, boolean force) {
|
||||||
|
return apiService.delete(attribute.getId(), id, force);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,47 @@
|
|||||||
|
package me.gilo.woodroid.repo.product;
|
||||||
|
|
||||||
|
import me.gilo.woodroid.data.api.CustomerAPI;
|
||||||
|
import me.gilo.woodroid.data.api.ProductCategoryAPI;
|
||||||
|
import me.gilo.woodroid.models.Category;
|
||||||
|
import me.gilo.woodroid.models.Customer;
|
||||||
|
import me.gilo.woodroid.repo.WooRepository;
|
||||||
|
import retrofit2.Call;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class CategoryRepository extends WooRepository {
|
||||||
|
|
||||||
|
private final ProductCategoryAPI apiService;
|
||||||
|
|
||||||
|
public CategoryRepository(String baseUrl, String consumerKey, String consumerSecret) {
|
||||||
|
super("products/categories", baseUrl, consumerKey, consumerSecret);
|
||||||
|
apiService = retrofit.create(ProductCategoryAPI.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Call<Category> create(Category category) {
|
||||||
|
return apiService.create(category);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Call<Category> category(int id) {
|
||||||
|
return apiService.view(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Call<List<Category>> categories() {
|
||||||
|
return apiService.list();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Call<Category> update(int id, Category category) {
|
||||||
|
return apiService.update(id, category);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Call<Category> delete(int id) {
|
||||||
|
return apiService.delete(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Call<Category> delete(int id, boolean force) {
|
||||||
|
return apiService.delete(id, force);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,47 @@
|
|||||||
|
package me.gilo.woodroid.repo.product;
|
||||||
|
|
||||||
|
import me.gilo.woodroid.data.api.ProductCategoryAPI;
|
||||||
|
import me.gilo.woodroid.data.api.ProductReviewAPI;
|
||||||
|
import me.gilo.woodroid.models.Category;
|
||||||
|
import me.gilo.woodroid.models.ProductReview;
|
||||||
|
import me.gilo.woodroid.repo.WooRepository;
|
||||||
|
import retrofit2.Call;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class ReviewRepository extends WooRepository {
|
||||||
|
|
||||||
|
private final ProductReviewAPI apiService;
|
||||||
|
|
||||||
|
public ReviewRepository(String baseUrl, String consumerKey, String consumerSecret) {
|
||||||
|
super("products/reviews", baseUrl, consumerKey, consumerSecret);
|
||||||
|
apiService = retrofit.create(ProductReviewAPI.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Call<ProductReview> create(ProductReview review) {
|
||||||
|
return apiService.create(review);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Call<ProductReview> review(int id) {
|
||||||
|
return apiService.view(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Call<List<ProductReview>> reviews() {
|
||||||
|
return apiService.list();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Call<ProductReview> update(int id, ProductReview review) {
|
||||||
|
return apiService.update(id, review);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Call<ProductReview> delete(int id) {
|
||||||
|
return apiService.delete(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Call<ProductReview> delete(int id, boolean force) {
|
||||||
|
return apiService.delete(id, force);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,47 @@
|
|||||||
|
package me.gilo.woodroid.repo.product;
|
||||||
|
|
||||||
|
import me.gilo.woodroid.data.api.ProductCategoryAPI;
|
||||||
|
import me.gilo.woodroid.data.api.ShippingClassAPI;
|
||||||
|
import me.gilo.woodroid.models.Category;
|
||||||
|
import me.gilo.woodroid.models.ShippingClass;
|
||||||
|
import me.gilo.woodroid.repo.WooRepository;
|
||||||
|
import retrofit2.Call;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class ShippingClassRepository extends WooRepository {
|
||||||
|
|
||||||
|
private final ShippingClassAPI apiService;
|
||||||
|
|
||||||
|
public ShippingClassRepository(String baseUrl, String consumerKey, String consumerSecret) {
|
||||||
|
super("products/categories", baseUrl, consumerKey, consumerSecret);
|
||||||
|
apiService = retrofit.create(ShippingClassAPI.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Call<ShippingClass> create(ShippingClass shippingClass) {
|
||||||
|
return apiService.create(shippingClass);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Call<ShippingClass> shippingClass(int id) {
|
||||||
|
return apiService.view(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Call<List<ShippingClass>> shippingClasses() {
|
||||||
|
return apiService.list();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Call<ShippingClass> update(int id, ShippingClass shippingClass) {
|
||||||
|
return apiService.update(id, shippingClass);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Call<ShippingClass> delete(int id) {
|
||||||
|
return apiService.delete(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Call<ShippingClass> delete(int id, boolean force) {
|
||||||
|
return apiService.delete(id, force);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,47 @@
|
|||||||
|
package me.gilo.woodroid.repo.product;
|
||||||
|
|
||||||
|
import me.gilo.woodroid.data.api.ProductCategoryAPI;
|
||||||
|
import me.gilo.woodroid.data.api.ProductTagAPI;
|
||||||
|
import me.gilo.woodroid.models.Category;
|
||||||
|
import me.gilo.woodroid.models.Tag;
|
||||||
|
import me.gilo.woodroid.repo.WooRepository;
|
||||||
|
import retrofit2.Call;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class TagRepository extends WooRepository {
|
||||||
|
|
||||||
|
private final ProductTagAPI apiService;
|
||||||
|
|
||||||
|
public TagRepository(String baseUrl, String consumerKey, String consumerSecret) {
|
||||||
|
super("products/categories", baseUrl, consumerKey, consumerSecret);
|
||||||
|
apiService = retrofit.create(ProductTagAPI.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Call<Tag> create(Tag tag) {
|
||||||
|
return apiService.create(tag);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Call<Tag> tag(int id) {
|
||||||
|
return apiService.view(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Call<List<Tag>> tags() {
|
||||||
|
return apiService.list();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Call<Tag> update(int id, Tag tag) {
|
||||||
|
return apiService.update(id, tag);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Call<Tag> delete(int id) {
|
||||||
|
return apiService.delete(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Call<Tag> delete(int id, boolean force) {
|
||||||
|
return apiService.delete(id, force);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,51 @@
|
|||||||
|
package me.gilo.woodroid.repo.product;
|
||||||
|
|
||||||
|
import me.gilo.woodroid.data.api.ProductCategoryAPI;
|
||||||
|
import me.gilo.woodroid.data.api.ProductVariationAPI;
|
||||||
|
import me.gilo.woodroid.models.Category;
|
||||||
|
import me.gilo.woodroid.models.Product;
|
||||||
|
import me.gilo.woodroid.models.Variation;
|
||||||
|
import me.gilo.woodroid.repo.WooRepository;
|
||||||
|
import retrofit2.Call;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class VariationRepository extends WooRepository {
|
||||||
|
|
||||||
|
private final ProductVariationAPI apiService;
|
||||||
|
Product product;
|
||||||
|
|
||||||
|
public VariationRepository(String baseUrl, String consumerKey, String consumerSecret, Product product) {
|
||||||
|
super("products/categories", baseUrl, consumerKey, consumerSecret);
|
||||||
|
apiService = retrofit.create(ProductVariationAPI.class);
|
||||||
|
|
||||||
|
this.product = product;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Call<Variation> create(Variation variation) {
|
||||||
|
return apiService.create(product.getId(), variation);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Call<Variation> variation(int id) {
|
||||||
|
return apiService.view(product.getId(), id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Call<List<Variation>> variations() {
|
||||||
|
return apiService.list(product.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
public Call<Variation> update(int id, Variation variation) {
|
||||||
|
return apiService.update(product.getId(), id, variation);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Call<Variation> delete(int id) {
|
||||||
|
return apiService.delete(product.getId(), id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Call<Variation> delete(int id, boolean force) {
|
||||||
|
return apiService.delete(product.getId(), id, force);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user