Commit eb328cb4 authored by BertTowne's avatar BertTowne

Update for templates, shop assets, and the four-day release streak

parent 6a7e4658
......@@ -5,7 +5,7 @@
<parent>
<groupId>co.melondev</groupId>
<artifactId>CubedPay</artifactId>
<version>0.5</version>
<version>0.6</version>
</parent>
<artifactId>CubedPay-bukkit</artifactId>
......@@ -21,7 +21,7 @@
<dependency>
<groupId>co.melondev</groupId>
<artifactId>CubedPay-common</artifactId>
<version>0.5</version>
<version>0.6</version>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>co.melondev</groupId>
<artifactId>CubedPay</artifactId>
<version>0.5</version>
<version>0.6</version>
</parent>
<artifactId>CubedPay-bungeecord</artifactId>
......@@ -21,7 +21,7 @@
<dependency>
<groupId>co.melondev</groupId>
<artifactId>CubedPay-common</artifactId>
<version>0.5</version>
<version>0.6</version>
</dependency>
<dependency>
<groupId>net.md-5</groupId>
......
......@@ -6,7 +6,7 @@
<parent>
<groupId>co.melondev</groupId>
<artifactId>CubedPay</artifactId>
<version>0.5</version>
<version>0.6</version>
</parent>
<artifactId>CubedPay-common</artifactId>
......
......@@ -2,6 +2,9 @@ package co.melondev.cubedpay.api;
import co.melondev.cubedpay.data.*;
import co.melondev.cubedpay.data.common.Cursor;
import co.melondev.cubedpay.data.statistics.PopularPackage;
import co.melondev.cubedpay.data.statistics.RecentPurchase;
import co.melondev.cubedpay.data.statistics.TopPurchaser;
import retrofit2.http.*;
import java.io.File;
......@@ -63,6 +66,20 @@ public interface CubedPayShopAPI {
CompletableFuture<DeleteConfirmation> deletePackage(@Path("sid") String shopId, @Path("pid") String packageId);
//endregion
//region Package Conditions
@POST("/shop/{sid}/package/{pid}/condition")
CompletableFuture<ShopPackageCondition> createShopPackageCondition(@Path("sid") String shopId, @Path("pid") String packageId, @Query("type") ShopPackageCondition.Type type, @Query("data") String queryPackageId);
@DELETE("/shop/{sid}/package/{pid}/condition/{cid}")
CompletableFuture<DeleteConfirmation> deleteShopPackageCondition(@Path("sid") String shopId, @Path("pid") String packageId, @Path("cid") String conditionId);
@GET("/shop/{sid}/package/{pid}/condition")
CompletableFuture<List<ShopPackageCondition>> getShopPackageConditions(@Path("sid") String shopId, @Path("pid") String packageId);
@PATCH("/shop/{sid}/package/{pid}/condition/{cid}")
CompletableFuture<ShopPackageCondition> updateShopPackageCondition(@Path("sid") String shopId, @Path("pid") String packageId, @Path("cid") String conditionId, @Query("type") ShopPackageCondition.Type type, @Query("data") String queryPackageId);
//endregion
//region Transactions
@GET("/shop/{sid}/transaction")
CompletableFuture<Cursor<Transaction>> getTransactions(@Path("sid") String shopId, @Query("page") int page, @Query("perpage") int perPage);
......@@ -106,10 +123,10 @@ public interface CubedPayShopAPI {
CompletableFuture<ShopPage> getPage(@Path("sid") String shopId, @Path("pid") String pageId);
@POST("/shop/{sid}/page")
CompletableFuture<ShopPage> createPage(@Path("sid") String shopId, @Query("name") String name, @Query("description") String description, @Query("public") boolean isPublic, @Query("type") ShopPage.Type type, @Query("display") ShopPage.Display display, @Query("order") int order);
CompletableFuture<ShopPage> createPage(@Path("sid") String shopId, @Query("name") String name, @Query("description") String description, @Query("public") boolean isPublic, @Query("type") ShopPage.Type type, @Query("display") ShopPage.Display display, @Query("order") int order, @Query("meta") ShopPage.Meta pageMeta);
@PATCH("/shop/{sid}/page/{pid}")
CompletableFuture<ShopPage> updatePage(@Path("sid") String shopId, @Path("pid") String pageId, @Query("name") String name, @Query("description") String description, @Query("public") boolean isPublic, @Query("type") ShopPage.Type type, @Query("display") ShopPage.Display display, @Query("order") int order);
CompletableFuture<ShopPage> updatePage(@Path("sid") String shopId, @Path("pid") String pageId, @Query("name") String name, @Query("description") String description, @Query("public") boolean isPublic, @Query("type") ShopPage.Type type, @Query("display") ShopPage.Display display, @Query("order") int order, @Query("meta") ShopPage.Meta pageMeta);
@DELETE("/shop/{sid}/page/{pid}")
CompletableFuture<DeleteConfirmation> deletePage(@Path("sid") String shopId, @Path("pid") String pageId);
......@@ -155,6 +172,18 @@ public interface CubedPayShopAPI {
CompletableFuture<ShopTheme> setShopTheme(@Path("sid") String shopId, @Query("theme") String themeId);
//endregion
//region Assets
@DELETE("/shop/{sid}/asset/{aid}")
CompletableFuture<DeleteConfirmation> deleteShopMedia(@Path("sid") String shopId, @Path("aid") String mediaId);
@POST("/shop/{sid}/asset/{aid}")
CompletableFuture<ShopMedia> getShopMedia(@Path("sid") String shopId, @Path("aid") String mediaId);
@GET("/shop/{sid}/asset")
CompletableFuture<Cursor<ShopMedia>> listShopMedia(@Path("sid") String shopId, @Query("page") int page, @Query("perpage") int perPage);
//endregion
//region Colors
@GET("/shop/{sid}/colors")
CompletableFuture<Cursor<ShopColors>> getShopColors(@Path("sid") String shopId, @Query("page") int page, @Query("perpage") int perPage);
......@@ -221,6 +250,17 @@ public interface CubedPayShopAPI {
CompletableFuture<DeleteConfirmation> removePackageRefFromDiscount(@Path("sid") String shopId, @Path("discount") String discountId, @Path("prid") String packageRefId);
//endregion
//region Statistics
@GET("/shop/{sid}/statistics/recent_purchase")
CompletableFuture<List<RecentPurchase>> getRecentPurchases(@Path("sid") String shopId, @Query("limit") int amount);
@GET("/shop/{sid}/statistics/top_purchaser")
CompletableFuture<List<TopPurchaser>> getTopPurchasers(@Path("sid") String shopId, @Query("limit") int amount);
@GET("/shop/{sid}/statistics/most_popular")
CompletableFuture<List<PopularPackage>> getMostPopularPackages(@Path("sid") String shopId, @Query("limit") int amount);
//endregion
//region Support
@GET("/shop/{sid}/ticket")
CompletableFuture<Cursor<SupportTicket>> getSupportTickets(@Path("sid") String shopId, @Query("page") int page, @Query("perpage") int perpage);
......
......@@ -31,9 +31,11 @@ public class PublicShop {
private ShopTheme theme;
private String template;
private String homeText;
private ShopTemplateMeta template_meta;
private ShopPlan plan;
private List<PublicGateway> activeGateways;
private List<ShopSale> activeSales;
private List<ShopMedia> assets;
private ShopColors colors;
private Currency currency;
......@@ -73,6 +75,10 @@ public class PublicShop {
return homeText;
}
public ShopTemplateMeta getTemplateMeta() {
return template_meta;
}
public ShopPlan getPlan() {
return plan;
}
......@@ -85,6 +91,10 @@ public class PublicShop {
return activeSales;
}
public List<ShopMedia> getAssets() {
return assets;
}
public Currency getCurrency() {
return currency;
}
......
......@@ -20,6 +20,8 @@ public class Shop {
private String home_text = "";
private List<User> members = new ArrayList<>();
private List<Gateway> gateways = new ArrayList<>();
private List<ShopMedia> assets = new ArrayList<>();
private ShopTemplateMeta template_meta;
private ShopTheme theme;
private ShopColors colors;
private ShopPlan plan;
......@@ -81,6 +83,14 @@ public class Shop {
return members;
}
public ShopTemplateMeta getTemplateMeta() {
return template_meta;
}
public List<ShopMedia> getAssets() {
return assets;
}
public ShopTheme getTheme() {
return theme;
}
......
package co.melondev.cubedpay.data;
import com.google.gson.annotations.SerializedName;
public class ShopMedia {
public class Meta {
private String name;
private String type;
private long size;
private long created;
public String getName() {
return name;
}
public String getType() {
return type;
}
public long getSize() {
return size;
}
public long getCreated() {
return created;
}
}
private String id;
private String url;
private Meta meta;
@SerializedName("private")
private boolean isPrivate;
public String getId() {
return id;
}
public String getUrl() {
return url;
}
public Meta getMeta() {
return meta;
}
public boolean isPrivate() {
return isPrivate;
}
}
\ No newline at end of file
......@@ -29,6 +29,7 @@ public class ShopPackage {
private String price;
@SerializedName("is_public")
private boolean isPublic;
private boolean has_conditions;
private Sale sale;
public String getId() {
......@@ -55,6 +56,10 @@ public class ShopPackage {
return isPublic;
}
public boolean hasConditions() {
return has_conditions;
}
public Sale getSale() {
return sale;
}
......
package co.melondev.cubedpay.data;
public class ShopPackageCondition {
public enum Type {
BROUGHT_ANY, BROUGHT
}
private String id;
private Type type;
private String data;
public String getId() {
return id;
}
public Type getType() {
return type;
}
public String getData() {
return data;
}
}
\ No newline at end of file
......@@ -6,9 +6,40 @@ import java.util.Arrays;
public class ShopPage {
public class Meta {
private String parent; // returns "false" if it does not have a parent page and the page id if it does
private boolean label;
private boolean external;
private String url;
public Meta(String parent, boolean label, boolean external, String url) {
this.parent = parent == null || parent.isEmpty() ? "false" : parent;
this.label = label;
this.external = external;
this.url = url;
}
public String getParent() {
return parent;
}
public boolean hasLabel() {
return label;
}
public boolean isExternal() {
return external;
}
public String getUrl() {
return url;
}
}
public enum Type {
BASIC,
SMART;
BASIC;
public static Type findById(String id) {
return Arrays.stream(values()).filter(status -> status.name().equalsIgnoreCase(id))
......@@ -34,6 +65,8 @@ public class ShopPage {
private Type type;
private Display display;
private int order;
private String icon;
private Meta meta;
public String getId() {
return id;
......@@ -62,4 +95,13 @@ public class ShopPage {
public int getOrder() {
return order;
}
public String getIcon() {
return icon;
}
public Meta getMeta() {
return meta;
}
}
package co.melondev.cubedpay.data;
public class ShopTemplateMeta {
public class Data {
private String header;
public String getHeaderAssetId() {
return header;
}
}
private String id;
private Data data;
private String template;
public String getId() {
return id;
}
public Data getData() {
return data;
}
public String getTemplate() {
return template;
}
}
\ No newline at end of file
package co.melondev.cubedpay.data.statistics;
import co.melondev.cubedpay.data.ShopPackage;
public class PopularPackage {
private ShopPackage item;
private int quantity;
public ShopPackage getItem() {
return item;
}
public int getQuantity() {
return quantity;
}
}
\ No newline at end of file
package co.melondev.cubedpay.data.statistics;
import co.melondev.cubedpay.data.PublicUser;
import co.melondev.cubedpay.data.ShopPackage;
import java.util.List;
public class RecentPurchase {
private PublicUser user;
private List<ShopPackage> items;
private String date;
public PublicUser getUser() {
return user;
}
public List<ShopPackage> getItems() {
return items;
}
public String getDate() {
return date;
}
}
package co.melondev.cubedpay.data.statistics;
public class TopPurchaser {
private String user;
private double amount;
public String getUser() {
return user;
}
public double getAmount() {
return amount;
}
}
\ No newline at end of file
......@@ -4,7 +4,7 @@
<groupId>co.melondev</groupId>
<artifactId>CubedPay</artifactId>
<version>0.5</version>
<version>0.6</version>
<packaging>pom</packaging>
<properties>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>co.melondev</groupId>
<artifactId>CubedPay</artifactId>
<version>0.5</version>
<version>0.6</version>
</parent>
<artifactId>CubedPay-sponge</artifactId>
......@@ -21,7 +21,7 @@
<dependency>
<groupId>co.melondev</groupId>
<artifactId>CubedPay-common</artifactId>
<version>0.5</version>
<version>0.6</version>
</dependency>
<dependency>
<groupId>org.spongepowered</groupId>
......
......@@ -19,7 +19,7 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
@Plugin(id = "cubedpayplugin", name = "CubedPayPlugin", version = "0.5", authors = {"Melon Development"}, url = "https://cubedpay.com/")
@Plugin(id = "cubedpayplugin", name = "CubedPayPlugin", version = "0.6", authors = {"Melon Development"}, url = "https://cubedpay.com/")
public class CubedPayPlugin {
private static CubedPayAPI api;
......
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