Commit 69df54a4 authored by gandharyanto's avatar gandharyanto

Fix response push product

parent c24f5ca6
package com.example.yourcashiertest.models;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class PushProductResponse {
@SerializedName("status")
@Expose
private Boolean status;
@SerializedName("messages")
@Expose
private String messages;
@SerializedName("data")
@Expose
private Data data;
public Boolean getStatus() {
return status;
}
public void setStatus(Boolean status) {
this.status = status;
}
public String getMessages() {
return messages;
}
public void setMessages(String messages) {
this.messages = messages;
}
public Data getData() {
return data;
}
public void setData(Data data) {
this.data = data;
}
public class Data {
@SerializedName("name")
@Expose
private String name;
@SerializedName("price")
@Expose
private Integer price;
@SerializedName("description")
@Expose
private String description;
@SerializedName("category")
@Expose
private String category;
@SerializedName("stock")
@Expose
private Integer stock;
@SerializedName("images")
@Expose
private String images;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getPrice() {
return price;
}
public void setPrice(Integer price) {
this.price = price;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
public Integer getStock() {
return stock;
}
public void setStock(Integer stock) {
this.stock = stock;
}
public String getImages() {
return images;
}
public void setImages(String images) {
this.images = images;
}
}
}
package com.example.yourcashiertest.services; package com.example.yourcashiertest.services;
import com.example.yourcashiertest.models.PushProduct; import com.example.yourcashiertest.models.PushProduct;
import com.example.yourcashiertest.models.PushProductResponse;
import com.example.yourcashiertest.models.ResponseLogin; import com.example.yourcashiertest.models.ResponseLogin;
import com.example.yourcashiertest.models.ResponseUser; import com.example.yourcashiertest.models.ResponseUser;
import com.example.yourcashiertest.models.User; import com.example.yourcashiertest.models.User;
...@@ -14,14 +15,14 @@ import retrofit2.http.PUT; ...@@ -14,14 +15,14 @@ import retrofit2.http.PUT;
public interface ProductService { public interface ProductService {
@GET("v1/customer") @GET("v1/product")
Call<ResponseUser> getProduct(); Call<String> getProduct();
@Headers("Content-Type: application/json") @Headers("Content-Type: application/json")
@POST("v1/product") @POST("v1/product")
Call<User> createProduct(@Body PushProduct pushProduct); Call<PushProductResponse> createProduct(@Body PushProduct pushProduct);
@Headers("Content-Type: application/json") @Headers("Content-Type: application/json")
@PUT("v1/product/{id}") @PUT("v1/product/{id}")
Call<ResponseLogin> updateProduct(@Body PushProduct pushProduct); Call<PushProductResponse> updateProduct(@Body PushProduct pushProduct);
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment