Created
This commit is contained in:
29
entity/billing.go
Normal file
29
entity/billing.go
Normal file
@@ -0,0 +1,29 @@
|
||||
package entity
|
||||
|
||||
import (
|
||||
validation "github.com/go-ozzo/ozzo-validation/v4"
|
||||
"github.com/go-ozzo/ozzo-validation/v4/is"
|
||||
)
|
||||
|
||||
// Billing order billing properties
|
||||
type Billing struct {
|
||||
FirstName string `json:"first_name,omitempty"`
|
||||
LastName string `json:"last_name,omitempty"`
|
||||
Company string `json:"company,omitempty"`
|
||||
Address1 string `json:"address_1,omitempty"`
|
||||
Address2 string `json:"address_2,omitempty"`
|
||||
City string `json:"city,omitempty"`
|
||||
State string `json:"state,omitempty"`
|
||||
Postcode string `json:"postcode,omitempty"`
|
||||
Country string `json:"country,omitempty"`
|
||||
Email string `json:"email,omitempty"`
|
||||
Phone string `json:"phone,omitempty"`
|
||||
}
|
||||
|
||||
func (m Billing) Validate() error {
|
||||
return validation.ValidateStruct(&m,
|
||||
validation.Field(&m.Email, validation.When(m.Email != "", is.EmailFormat.Error("无效的邮箱"))),
|
||||
validation.Field(&m.FirstName, validation.Required.Error("姓不能为空")),
|
||||
validation.Field(&m.LastName, validation.Required.Error("名不能为空")),
|
||||
)
|
||||
}
|
||||
32
entity/coupon.go
Normal file
32
entity/coupon.go
Normal file
@@ -0,0 +1,32 @@
|
||||
package entity
|
||||
|
||||
// Coupon coupon properties
|
||||
type Coupon struct {
|
||||
ID int `json:"id"`
|
||||
Code string `json:"code"`
|
||||
Amount float64 `json:"amount"`
|
||||
DateCreated string `json:"date_created"`
|
||||
DateCreatedGMT string `json:"date_created_gmt"`
|
||||
DateModified string `json:"date_modified"`
|
||||
DateModifiedGMT string `json:"date_modified_gmt"`
|
||||
DiscountType string `json:"discount_type"`
|
||||
Description string `json:"description"`
|
||||
DateExpires string `json:"date_expires"`
|
||||
DateExpiresGMT string `json:"date_expires_gmt"`
|
||||
UsageCount int `json:"usage_count"`
|
||||
IndividualUse bool `json:"individual_use"`
|
||||
ProductIDs []int `json:"product_ids"`
|
||||
ExcludedProductIDs []int `json:"excluded_product_ids"`
|
||||
UsageLimit int `json:"usage_limit"`
|
||||
UsageLimitPerUser int `json:"usage_limit_per_user"`
|
||||
LimitUsageToXItems int `json:"limit_usage_to_x_items"`
|
||||
FreeShipping bool `json:"free_shipping"`
|
||||
ProductCategories []int `json:"product_categories"`
|
||||
ExcludedProductCategories []int `json:"excluded_product_categories"`
|
||||
ExcludeSaleItems bool `json:"exclude_sale_items"`
|
||||
MinimumAmount float64 `json:"minimum_amount"`
|
||||
MaximumAmount float64 `json:"maximum_amount"`
|
||||
EmailRestrictions []string `json:"email_restrictions"`
|
||||
UsedBy []int `json:"used_by"`
|
||||
MetaData []Meta `json:"meta_data"`
|
||||
}
|
||||
21
entity/customer.go
Normal file
21
entity/customer.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package entity
|
||||
|
||||
// Customer customer properties
|
||||
type Customer struct {
|
||||
ID int `json:"id"`
|
||||
DateCreated string `json:"date_created"`
|
||||
DateCreatedGMT string `json:"date_created_gmt"`
|
||||
DateModified string `json:"date_modified"`
|
||||
DateModifiedGMT string `json:"date_modified_gmt"`
|
||||
Email string `json:"email"`
|
||||
FirstName string `json:"first_name"`
|
||||
LastName string `json:"last_name"`
|
||||
Role string `json:"role"`
|
||||
Username string `json:"username"`
|
||||
Password string `json:"password"`
|
||||
Billing Billing `json:"billing"`
|
||||
Shipping Shipping `json:"shipping"`
|
||||
IsPayingCustomer bool `json:"is_paying_customer"`
|
||||
AvatarURL string `json:"avatar_url"`
|
||||
MetaData []Meta `json:"meta_data"`
|
||||
}
|
||||
18
entity/customer_download.go
Normal file
18
entity/customer_download.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package entity
|
||||
|
||||
// https://woocommerce.github.io/woocommerce-rest-api-docs/?php#retrieve-customer-downloads
|
||||
|
||||
// CustomerDownload customer download properties
|
||||
type CustomerDownload struct {
|
||||
DownloadId string `json:"download_id"`
|
||||
DownloadURL string `json:"download_url"`
|
||||
ProductId string `json:"product_id"`
|
||||
ProductName string `json:"product_name"`
|
||||
DownloadName string `json:"download_name"`
|
||||
OrderId int `json:"order_id"`
|
||||
OrderKey string `json:"order_key"`
|
||||
DownloadRemaining string `json:"download_remaining"`
|
||||
AccessExpires string `json:"access_expires"`
|
||||
AccessExpiresGMT string `json:"access_expires_gmt"`
|
||||
File CustomerDownloadFile `json:"file"`
|
||||
}
|
||||
8
entity/customer_download_file.go
Normal file
8
entity/customer_download_file.go
Normal file
@@ -0,0 +1,8 @@
|
||||
package entity
|
||||
|
||||
// https://woocommerce.github.io/woocommerce-rest-api-docs/?php#retrieve-customer-downloads
|
||||
|
||||
type CustomerDownloadFile struct {
|
||||
Name string `json:"name"`
|
||||
File string `json:"file"`
|
||||
}
|
||||
48
entity/data.go
Normal file
48
entity/data.go
Normal file
@@ -0,0 +1,48 @@
|
||||
package entity
|
||||
|
||||
// Data data properties
|
||||
type Data struct {
|
||||
Slug string `json:"slug"`
|
||||
Description string `json:"description"`
|
||||
}
|
||||
|
||||
// Continent continent properties
|
||||
type Continent struct {
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
Countries []ContinentCountry `json:"countries"` // Only code, name, []state?
|
||||
}
|
||||
|
||||
// ContinentCountry continent country properties
|
||||
type ContinentCountry struct {
|
||||
Code string `json:"code"`
|
||||
CurrencyCode string `json:"currency_code"`
|
||||
CurrencyPos string `json:"currency_pos"`
|
||||
DecimalSep string `json:"decimal_sep"`
|
||||
DimensionUnit string `json:"dimension_unit"`
|
||||
Name string `json:"name"`
|
||||
NumDecimals int `json:"num_decimals"`
|
||||
States []State `json:"states"`
|
||||
ThousandSep string `json:"thousand_sep"`
|
||||
WeightUnit string `json:"weight_unit"`
|
||||
}
|
||||
|
||||
// State state properties
|
||||
type State struct {
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
// Country country properties
|
||||
type Country struct {
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
States []State `json:"states"`
|
||||
}
|
||||
|
||||
// Currency currency properties
|
||||
type Currency struct {
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
Symbol string `json:"symbol"`
|
||||
}
|
||||
13
entity/image.go
Normal file
13
entity/image.go
Normal file
@@ -0,0 +1,13 @@
|
||||
package entity
|
||||
|
||||
// ProductImage product iamge properties
|
||||
type ProductImage struct {
|
||||
ID int `json:"id"`
|
||||
DateCreated string `json:"date_created"`
|
||||
DateCreatedGMT string `json:"date_created_gmt"`
|
||||
DateModified string `json:"date_modified"`
|
||||
DateModifiedGMT string `json:"date_modified_gmt"`
|
||||
Src string `json:"src"`
|
||||
Name string `json:"name"`
|
||||
Alt string `json:"alt"`
|
||||
}
|
||||
7
entity/meta.go
Normal file
7
entity/meta.go
Normal file
@@ -0,0 +1,7 @@
|
||||
package entity
|
||||
|
||||
type Meta struct {
|
||||
ID int `json:"id"`
|
||||
Key string `json:"key"`
|
||||
Value string `json:"value"`
|
||||
}
|
||||
91
entity/order.go
Normal file
91
entity/order.go
Normal file
@@ -0,0 +1,91 @@
|
||||
package entity
|
||||
|
||||
type LineItem struct {
|
||||
ID int `json:"id"`
|
||||
Name string `json:"name"`
|
||||
ProductId int `json:"product_id"`
|
||||
VariationId int `json:"variation_id"`
|
||||
Quantity int `json:"quantity"`
|
||||
TaxClass string `json:"tax_class"`
|
||||
SubTotal float64 `json:"subtotal"`
|
||||
SubTotalTax float64 `json:"subtotal_tax"`
|
||||
Total float64 `json:"total"`
|
||||
TotalTax float64 `json:"total_tax"`
|
||||
Taxes []Tax `json:"taxes"`
|
||||
MetaData []Meta `json:"meta_data"`
|
||||
SKU string `json:"sku"`
|
||||
Price float64 `json:"price"`
|
||||
ParentName string `json:"parent_name"`
|
||||
}
|
||||
|
||||
type FeeLine struct {
|
||||
ID int `json:"id"`
|
||||
Name string `json:"name"`
|
||||
TaxClass string `json:"tax_class"`
|
||||
TaxStatus string `json:"tax_status"`
|
||||
Total float64 `json:"total"`
|
||||
TotalTax float64 `json:"total_tax"`
|
||||
Taxes []Tax `json:"taxes"`
|
||||
MetaData []Meta `json:"meta_data"`
|
||||
}
|
||||
|
||||
type CouponLine struct {
|
||||
ID int `json:"id"`
|
||||
Code string `json:"code"`
|
||||
Discount float64 `json:"discount"`
|
||||
DiscountTax float64 `json:"discount_tax"`
|
||||
MetaData []Meta `json:"meta_data"`
|
||||
}
|
||||
|
||||
type Refund struct {
|
||||
ID int `json:"id"`
|
||||
Reason string `json:"reason"`
|
||||
Total float64 `json:"total"`
|
||||
}
|
||||
|
||||
// Order order properties
|
||||
type Order struct {
|
||||
ID int `json:"id"`
|
||||
ParentId int `json:"parent_id"`
|
||||
Number string `json:"number"`
|
||||
OrderKey string `json:"order_key"`
|
||||
CreatedVia string `json:"created_via"`
|
||||
Version string `json:"version"`
|
||||
Status string `json:"status"`
|
||||
Currency string `json:"currency"`
|
||||
CurrencySymbol string `json:"currency_symbol"`
|
||||
DateCreated string `json:"date_created"`
|
||||
DateCreatedGMT string `json:"date_created_gmt"`
|
||||
DateModified string `json:"date_modified"`
|
||||
DateModifiedGMT string `json:"date_modified_gmt"`
|
||||
DiscountTotal float64 `json:"discount_total"`
|
||||
DiscountTax float64 `json:"discount_tax"`
|
||||
ShippingTotal float64 `json:"shipping_total"`
|
||||
ShippingTax float64 `json:"shipping_tax"`
|
||||
CartTax float64 `json:"cart_tax"`
|
||||
Total float64 `json:"total"`
|
||||
TotalTax float64 `json:"total_tax"`
|
||||
PricesIncludeTax bool `json:"prices_include_tax"`
|
||||
CustomerId int `json:"customer_id"`
|
||||
CustomerIpAddress string `json:"customer_ip_address"`
|
||||
CustomerUserAgent string `json:"customer_user_agent"`
|
||||
CustomerNote string `json:"customer_note"`
|
||||
Billing Billing `json:"billing"`
|
||||
Shipping Shipping `json:"shipping"`
|
||||
PaymentMethod string `json:"payment_method"`
|
||||
PaymentMethodTitle string `json:"payment_method_title"`
|
||||
TransactionId string `json:"transaction_id"`
|
||||
DatePaid string `json:"date_paid"`
|
||||
DatePaidGMT string `json:"date_paid_gmt"`
|
||||
DateCompleted string `json:"date_completed"`
|
||||
DateCompletedGMT string `json:"date_completed_gmt"`
|
||||
CartHash string `json:"cart_hash"`
|
||||
MetaData []Meta `json:"meta_data"`
|
||||
LineItems []LineItem `json:"line_items"`
|
||||
TaxLines []TaxLine `json:"tax_lines"`
|
||||
ShippingLines []ShippingLine `json:"shipping_lines"`
|
||||
FeeLines []FeeLine `json:"fee_lines"`
|
||||
CouponLines []CouponLine `json:"coupon_lines"`
|
||||
Refunds []Refund `json:"refunds"`
|
||||
SetPaid bool `json:"set_paid"`
|
||||
}
|
||||
12
entity/order_note.go
Normal file
12
entity/order_note.go
Normal file
@@ -0,0 +1,12 @@
|
||||
package entity
|
||||
|
||||
// OrderNote order note properties
|
||||
type OrderNote struct {
|
||||
ID int `json:"id"`
|
||||
Author string `json:"author"`
|
||||
DateCreated string `json:"date_created"`
|
||||
DateCreatedGMT string `json:"date_created_gmt"`
|
||||
Note string `json:"note"`
|
||||
CustomerNote bool `json:"customer_note"`
|
||||
AddedByUser bool `json:"added_by_user"`
|
||||
}
|
||||
34
entity/order_refund.go
Normal file
34
entity/order_refund.go
Normal file
@@ -0,0 +1,34 @@
|
||||
package entity
|
||||
|
||||
// OrderRefund order refund properties
|
||||
type OrderRefund struct {
|
||||
ID int `json:"id"`
|
||||
DateCreated string `json:"date_created"`
|
||||
DateCreatedGMT string `json:"date_created_gmt"`
|
||||
Amount float64 `json:"amount"`
|
||||
Reason string `json:"reason"`
|
||||
RefundedBy int `json:"refunded_by"`
|
||||
RefundedPayment bool `json:"refunded_payment"`
|
||||
MetaData []Meta `json:"meta_data"`
|
||||
LineItems []OrderRefundLineItem `json:"line_items"`
|
||||
APIRefund bool `json:"api_refund"`
|
||||
}
|
||||
|
||||
// OrderRefundLineItem order refund line item properties
|
||||
type OrderRefundLineItem struct {
|
||||
ID int `json:"id"`
|
||||
Name string `json:"name"`
|
||||
ProductId int `json:"product_id"`
|
||||
VariationId int `json:"variation_id"`
|
||||
Quantity int `json:"quantity"`
|
||||
TaxClass int `json:"tax_class"`
|
||||
SubTotal float64 `json:"subtotal"`
|
||||
SubTotalTax float64 `json:"subtotal_tax"`
|
||||
Total float64 `json:"total"`
|
||||
TotalTax float64 `json:"total_tax"`
|
||||
Taxes []Tax `json:"taxes"`
|
||||
MetaData []Meta `json:"meta_data"`
|
||||
SKU string `json:"sku"`
|
||||
Price float64 `json:"price"`
|
||||
RefundTotal float64 `json:"refund_total"`
|
||||
}
|
||||
25
entity/payment_gateway.go
Normal file
25
entity/payment_gateway.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package entity
|
||||
|
||||
// PaymentGateway payment gateway properties
|
||||
type PaymentGateway struct {
|
||||
ID string `json:"id"`
|
||||
Title string `json:"title"`
|
||||
Description string `json:"description"`
|
||||
Order int `json:"order"`
|
||||
Enabled bool `json:"enabled"`
|
||||
MethodTitle string `json:"method_title"`
|
||||
MethodDescription string `json:"method_description"`
|
||||
MethodSupports []string `json:"method_supports"`
|
||||
Settings map[string]PaymentGatewaySetting `json:"settings"`
|
||||
}
|
||||
|
||||
type PaymentGatewaySetting struct {
|
||||
ID string `json:"id"`
|
||||
Label string `json:"label"`
|
||||
Description string `json:"description"`
|
||||
Type string `json:"type"`
|
||||
Value string `json:"value"`
|
||||
Default string `json:"default"`
|
||||
Tip string `json:"tip"`
|
||||
Placeholder string `json:"placeholder"`
|
||||
}
|
||||
8
entity/porduct_default_attribute.go
Normal file
8
entity/porduct_default_attribute.go
Normal file
@@ -0,0 +1,8 @@
|
||||
package entity
|
||||
|
||||
// ProductDefaultAttribute product default attribute properties
|
||||
type ProductDefaultAttribute struct {
|
||||
ID int `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Option string `json:"option"`
|
||||
}
|
||||
86
entity/product.go
Normal file
86
entity/product.go
Normal file
@@ -0,0 +1,86 @@
|
||||
package entity
|
||||
|
||||
type ProductDimension struct {
|
||||
Length float64 `json:"length"`
|
||||
Width float64 `json:"width"`
|
||||
Height float64 `json:"height"`
|
||||
}
|
||||
|
||||
// Product product properties
|
||||
type Product struct {
|
||||
ID int `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Slug string `json:"slug"`
|
||||
Permalink string `json:"permalink"`
|
||||
DateCreated string `json:"date_created"`
|
||||
DateCreatedGMT string `json:"date_created_gmt"`
|
||||
DateModified string `json:"date_modified"`
|
||||
DateModifiedGMT string `json:"date_modified_gmt"`
|
||||
Type string `json:"type"`
|
||||
Status string `json:"status"`
|
||||
Featured bool `json:"featured"`
|
||||
CatalogVisibility string `json:"catalog_visibility"`
|
||||
Description string `json:"description"`
|
||||
ShortDescription string `json:"short_description"`
|
||||
SKU string `json:"sku"`
|
||||
Price float64 `json:"price"`
|
||||
RegularPrice float64 `json:"regular_price"`
|
||||
SalePrice float64 `json:"sale_price"`
|
||||
DateOnSaleFrom string `json:"date_on_sale_from"`
|
||||
DateOnSaleFromGMT string `json:"date_on_sale_from_gmt"`
|
||||
DateOnSaleTo string `json:"date_on_sale_to"`
|
||||
DateOnSaleToGMT string `json:"date_on_sale_to_gmt"`
|
||||
PriceHtml string `json:"price_html"`
|
||||
OnSale bool `json:"on_sale"`
|
||||
Purchasable bool `json:"purchasable"`
|
||||
TotalSales int `json:"total_sales"`
|
||||
Virtual bool `json:"virtual"`
|
||||
Downloadable bool `json:"downloadable"`
|
||||
Downloads []ProductDownload `json:"downloads"`
|
||||
DownloadLimit int `json:"download_limit"`
|
||||
DownloadExpiry int `json:"download_expiry"`
|
||||
ExternalUrl string `json:"external_url"`
|
||||
ButtonText string `json:"button_text"`
|
||||
TaxStatus string `json:"tax_status"`
|
||||
TaxClass string `json:"tax_class"`
|
||||
ManageStock bool `json:"manage_stock"`
|
||||
StockQuantity int `json:"stock_quantity"`
|
||||
StockStatus string `json:"stock_status"`
|
||||
Backorders string `json:"backorders"`
|
||||
BackordersAllowed bool `json:"backorders_allowed"`
|
||||
Backordered bool `json:"backordered"`
|
||||
SoldIndividually bool `json:"sold_individually"`
|
||||
Weight float64 `json:"weight"`
|
||||
Dimensions *ProductDimension `json:"dimensions"`
|
||||
ShippingRequired bool `json:"shipping_required"`
|
||||
ShippingTaxable bool `json:"shipping_taxable"`
|
||||
ShippingClass string `json:"shipping_class"`
|
||||
ShippingClassId int `json:"shipping_class_id"`
|
||||
ReviewsAllowed bool `json:"reviews_allowed"`
|
||||
AverageRating float64 `json:"average_rating"`
|
||||
RatingCount int `json:"rating_count"`
|
||||
RelatedIds []int `json:"related_ids"`
|
||||
UpsellIds []int `json:"upsell_ids"`
|
||||
CrossSellIds []int `json:"cross_sell_ids"`
|
||||
ParentId int `json:"parent_id"`
|
||||
PurchaseNote string `json:"purchase_note"`
|
||||
Categories []ProductCategory `json:"categories"`
|
||||
Tags []ProductTag `json:"tags"`
|
||||
Images []ProductImage `json:"images"`
|
||||
Attributes []ProductAttributeItem `json:"attributes"`
|
||||
DefaultAttributes []ProductDefaultAttribute `json:"default_attributes"`
|
||||
Variations []int `json:"variations"`
|
||||
GroupedProducts []int `json:"grouped_products"`
|
||||
MenuOrder int `json:"menu_order"`
|
||||
MetaData []Meta `json:"meta_data"`
|
||||
}
|
||||
|
||||
// ProductAttributeItem product attribute properties
|
||||
type ProductAttributeItem struct {
|
||||
ID int `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Position int `json:"position"`
|
||||
Visible bool `json:"visible"`
|
||||
Variation bool `json:"variation"`
|
||||
Options []string `json:"options"`
|
||||
}
|
||||
11
entity/product_attribute.go
Normal file
11
entity/product_attribute.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package entity
|
||||
|
||||
// ProductAttribute product attribute properties
|
||||
type ProductAttribute struct {
|
||||
ID int `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Slug string `json:"slug"`
|
||||
Type string `json:"type"`
|
||||
OrderBy string `json:"order_by"`
|
||||
HasArchives bool `json:"has_archives"`
|
||||
}
|
||||
11
entity/product_attribute_term.go
Normal file
11
entity/product_attribute_term.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package entity
|
||||
|
||||
// ProductAttributeTerm product attribute term properties
|
||||
type ProductAttributeTerm struct {
|
||||
ID int `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Slug string `json:"slug"`
|
||||
Description string `json:"description"`
|
||||
MenuOrder int `json:"menu_order"`
|
||||
Count int `json:"count"`
|
||||
}
|
||||
14
entity/product_category.go
Normal file
14
entity/product_category.go
Normal file
@@ -0,0 +1,14 @@
|
||||
package entity
|
||||
|
||||
// ProductCategory product category properties
|
||||
type ProductCategory struct {
|
||||
ID int `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Slug string `json:"slug"`
|
||||
Parent int `json:"parent"`
|
||||
Description string `json:"description"`
|
||||
Display string `json:"display"`
|
||||
Image *ProductImage `json:"image,omitempty"`
|
||||
MenuOrder int `json:"menu_order"`
|
||||
Count int `json:"count"`
|
||||
}
|
||||
8
entity/product_download.go
Normal file
8
entity/product_download.go
Normal file
@@ -0,0 +1,8 @@
|
||||
package entity
|
||||
|
||||
// ProductDownload product download properties
|
||||
type ProductDownload struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
File string `json:"file"`
|
||||
}
|
||||
15
entity/product_review.go
Normal file
15
entity/product_review.go
Normal file
@@ -0,0 +1,15 @@
|
||||
package entity
|
||||
|
||||
// ProductReview product review properties
|
||||
type ProductReview struct {
|
||||
ID int `json:"id"`
|
||||
DateCreated string `json:"date_created"`
|
||||
DateCreatedGMT string `json:"date_created_gmt"`
|
||||
ProductId int `json:"product_id"`
|
||||
Status string `json:"status"`
|
||||
Reviewer string `json:"reviewer"`
|
||||
ReviewerEmail string `json:"reviewer_email"`
|
||||
Review string `json:"review"`
|
||||
Rating int `json:"rating"`
|
||||
Verified bool `json:"verified"`
|
||||
}
|
||||
10
entity/product_shipping_class.go
Normal file
10
entity/product_shipping_class.go
Normal file
@@ -0,0 +1,10 @@
|
||||
package entity
|
||||
|
||||
// ProductShippingClass product shipping class properties
|
||||
type ProductShippingClass struct {
|
||||
ID int `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Slug string `json:"slug"`
|
||||
Description string `json:"description"`
|
||||
Count int `json:"count"`
|
||||
}
|
||||
10
entity/product_tag.go
Normal file
10
entity/product_tag.go
Normal file
@@ -0,0 +1,10 @@
|
||||
package entity
|
||||
|
||||
// ProductTag product tag properties
|
||||
type ProductTag struct {
|
||||
ID int `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Slug string `json:"slug"`
|
||||
Description string `json:"description"`
|
||||
Count int `json:"count"`
|
||||
}
|
||||
55
entity/product_variation.go
Normal file
55
entity/product_variation.go
Normal file
@@ -0,0 +1,55 @@
|
||||
package entity
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// ProductVariationAttribute product variation attribute properties
|
||||
type ProductVariationAttribute struct {
|
||||
ID int `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Option string `json:"option"`
|
||||
}
|
||||
|
||||
// ProductVariation product variation properties
|
||||
type ProductVariation struct {
|
||||
ID int `json:"id"`
|
||||
DateCreate time.Time `json:"date_create,omitempty"`
|
||||
DateCreateGMT time.Time `json:"date_create_gmt,omitempty"`
|
||||
DateModified time.Time `json:"date_modified,omitempty"`
|
||||
DateModifiedGMT time.Time `json:"date_modified_gmt,omitempty"`
|
||||
Description string `json:"description"`
|
||||
Permalink string `json:"permalink"`
|
||||
SKU string `json:"sku"`
|
||||
Price float64 `json:"price"`
|
||||
RegularPrice float64 `json:"regular_price"`
|
||||
SalePrice float64 `json:"sale_price"`
|
||||
DateOnSaleFrom time.Time `json:"date_on_sale_from"`
|
||||
DateOnSaleFromGMT time.Time `json:"date_on_sale_from_gmt"`
|
||||
DateOnSaleTo time.Time `json:"date_on_sale_to"`
|
||||
DateOnSaleToGMT time.Time `json:"date_on_sale_to_gmt"`
|
||||
OnSale bool `json:"on_sale"`
|
||||
Status string `json:"status"`
|
||||
Purchasable bool `json:"purchasable"`
|
||||
Virtual bool `json:"virtual"`
|
||||
Downloadable bool `json:"downloadable"`
|
||||
Downloads []ProductDownload `json:"downloads"`
|
||||
DownloadLimit int `json:"download_limit"`
|
||||
DownloadExpiry int `json:"download_expiry"`
|
||||
TaxStatus string `json:"tax_status"`
|
||||
TaxClass string `json:"tax_class"`
|
||||
ManageStock bool `json:"manage_stock"`
|
||||
StockQuantity int `json:"stock_quantity"`
|
||||
StockStatus string `json:"stock_status"`
|
||||
Backorders string `json:"backorders"`
|
||||
BackordersAllowed bool `json:"backorders_allowed"`
|
||||
Backordered bool `json:"backordered"`
|
||||
Weight float64 `json:"weight"`
|
||||
// ProductDimension *request.VariationDimensionsRequest `json:"dimensions"`
|
||||
ShippingClass string `json:"shipping_class"`
|
||||
ShippingClassId int `json:"shipping_class_id"`
|
||||
Image *ProductImage `json:"image"`
|
||||
Attributes []ProductVariationAttribute `json:"attributes"`
|
||||
MenuOrder int `json:"menu_order"`
|
||||
MetaData []Meta `json:"meta_data"`
|
||||
}
|
||||
57
entity/report.go
Normal file
57
entity/report.go
Normal file
@@ -0,0 +1,57 @@
|
||||
package entity
|
||||
|
||||
// Report report properties
|
||||
type Report struct {
|
||||
Slug string `json:"slug"`
|
||||
Description string `json:"description"`
|
||||
}
|
||||
|
||||
type SaleReport struct {
|
||||
TotalSales float64 `json:"total_sales"`
|
||||
NetSales float64 `json:"net_sales"`
|
||||
AverageSales string `json:"average_sales"`
|
||||
TotalOrders int `json:"total_orders"`
|
||||
TotalItems int `json:"total_items"`
|
||||
TotalTax float64 `json:"total_tax"`
|
||||
TotalShipping float64 `json:"total_shipping"`
|
||||
TotalRefunds int `json:"total_refunds"`
|
||||
TotalDiscount int `json:"total_discount"`
|
||||
TotalGroupedBy string `json:"total_grouped_by"`
|
||||
Totals map[string]struct {
|
||||
Sales float64 `json:"sales"`
|
||||
Orders int `json:"orders"`
|
||||
Items int `json:"items"`
|
||||
Tax float64 `json:"tax"`
|
||||
Shipping float64 `json:"shipping"`
|
||||
Discount float64 `json:"discount"`
|
||||
Customers int `json:"customers"`
|
||||
} `json:"totals"`
|
||||
}
|
||||
|
||||
// TopSellerReport top sellers report properties
|
||||
type TopSellerReport struct {
|
||||
Title string `json:"title"`
|
||||
ProductId int `json:"product_id"`
|
||||
Quantity int `json:"quantity"`
|
||||
}
|
||||
|
||||
type TotalReport struct {
|
||||
Slug string `json:"slug"`
|
||||
Name string `json:"name"`
|
||||
Total float64 `json:"total"`
|
||||
}
|
||||
|
||||
// CouponTotal coupon total properties
|
||||
type CouponTotal TotalReport
|
||||
|
||||
// CustomerTotal customer total properties
|
||||
type CustomerTotal TotalReport
|
||||
|
||||
// OrderTotal order total properties
|
||||
type OrderTotal TotalReport
|
||||
|
||||
// ProductTotal product total properties
|
||||
type ProductTotal TotalReport
|
||||
|
||||
// ReviewTotal review total properties
|
||||
type ReviewTotal TotalReport
|
||||
10
entity/setting_group.go
Normal file
10
entity/setting_group.go
Normal file
@@ -0,0 +1,10 @@
|
||||
package entity
|
||||
|
||||
// SettingGroup setting group properties
|
||||
type SettingGroup struct {
|
||||
ID string `json:"id"`
|
||||
Label string `json:"label"`
|
||||
Description string `json:"description"`
|
||||
ParentId string `json:"parent_id"`
|
||||
SubGroups []string `json:"sub_groups"`
|
||||
}
|
||||
15
entity/setting_option.go
Normal file
15
entity/setting_option.go
Normal file
@@ -0,0 +1,15 @@
|
||||
package entity
|
||||
|
||||
// SettingOption setting option properties
|
||||
type SettingOption struct {
|
||||
ID string `json:"id"`
|
||||
Label string `json:"label"`
|
||||
Description string `json:"description"`
|
||||
Value string `json:"value"`
|
||||
Default string `json:"default"`
|
||||
Tip string `json:"tip"`
|
||||
PlaceHolder string `json:"place_holder"`
|
||||
Type string `json:"type"`
|
||||
Options map[string]string `json:"options"`
|
||||
GroupId string `json:"group_id"`
|
||||
}
|
||||
23
entity/shipping.go
Normal file
23
entity/shipping.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package entity
|
||||
|
||||
type Shipping struct {
|
||||
FirstName string `json:"first_name,omitempty"`
|
||||
LastName string `json:"last_name,omitempty"`
|
||||
Company string `json:"company,omitempty"`
|
||||
Address1 string `json:"address_1,omitempty"`
|
||||
Address2 string `json:"address_2,omitempty"`
|
||||
City string `json:"city,omitempty"`
|
||||
State string `json:"state,omitempty"`
|
||||
Postcode string `json:"postcode,omitempty"`
|
||||
Country string `json:"country,omitempty"`
|
||||
}
|
||||
|
||||
type ShippingLine struct {
|
||||
ID int `json:"id"`
|
||||
MethodTitle string `json:"method_title"`
|
||||
MethodId string `json:"method_id"`
|
||||
Total float64 `json:"total"`
|
||||
TotalTax float64 `json:"total_tax"`
|
||||
Taxes []Tax `json:"taxes"`
|
||||
MetaData []Meta `json:"meta_data"`
|
||||
}
|
||||
12
entity/shipping_method.go
Normal file
12
entity/shipping_method.go
Normal file
@@ -0,0 +1,12 @@
|
||||
package entity
|
||||
|
||||
type ShippingMethod struct {
|
||||
InstanceId int `json:"instance_id"`
|
||||
Title string `json:"title"`
|
||||
Order int `json:"order"`
|
||||
Enabled bool `json:"enabled"`
|
||||
MethodId string `json:"method_id"`
|
||||
MethodTitle string `json:"method_title"`
|
||||
MethodDescription string `json:"method_description"`
|
||||
Settings []ShippingZoneMethodSetting `json:"settings"`
|
||||
}
|
||||
8
entity/shipping_zone.go
Normal file
8
entity/shipping_zone.go
Normal file
@@ -0,0 +1,8 @@
|
||||
package entity
|
||||
|
||||
// ShippingZone shipping zone properties
|
||||
type ShippingZone struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Order int `json:"order"`
|
||||
}
|
||||
7
entity/shipping_zone_location.go
Normal file
7
entity/shipping_zone_location.go
Normal file
@@ -0,0 +1,7 @@
|
||||
package entity
|
||||
|
||||
// ShippingZoneLocation shipping zone location
|
||||
type ShippingZoneLocation struct {
|
||||
Code string `json:"code"`
|
||||
Type string `json:"type"`
|
||||
}
|
||||
16
entity/shipping_zone_method.go
Normal file
16
entity/shipping_zone_method.go
Normal file
@@ -0,0 +1,16 @@
|
||||
package entity
|
||||
|
||||
// ShippingZoneMethod shipping zone method properties
|
||||
type ShippingZoneMethod = ShippingMethod
|
||||
|
||||
// ShippingZoneMethodSetting shipping zone method setting properties
|
||||
type ShippingZoneMethodSetting struct {
|
||||
ID int `json:"id"`
|
||||
Label string `json:"label"`
|
||||
Description string `json:"description"`
|
||||
Type string `json:"type"`
|
||||
Value string `json:"value"`
|
||||
Default string `json:"default"`
|
||||
Tip string `json:"tip"`
|
||||
PlaceHolder string `json:"place_holder"`
|
||||
}
|
||||
11
entity/system_status.go
Normal file
11
entity/system_status.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package entity
|
||||
|
||||
type SystemStatus struct {
|
||||
Environment SystemStatusEnvironment `json:"environment"`
|
||||
Database SystemStatusDatabase `json:"database"`
|
||||
ActivePlugins []string `json:"active_plugins"`
|
||||
Theme SystemStatusTheme `json:"theme"`
|
||||
Settings SystemStatusSetting `json:"settings"`
|
||||
Security SystemStatusSecurity `json:"security"`
|
||||
Pages []string `json:"pages"`
|
||||
}
|
||||
9
entity/system_status_database.go
Normal file
9
entity/system_status_database.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package entity
|
||||
|
||||
// SystemStatusDatabase System status database properties
|
||||
type SystemStatusDatabase struct {
|
||||
WCDatabaseVersion string `json:"wc_database_version"`
|
||||
DatabasePrefix string `json:"database_prefix"`
|
||||
MaxmindGEOIPDatabase string `json:"maxmind_geoip_database"`
|
||||
DatabaseTables []string `json:"database_tables"`
|
||||
}
|
||||
34
entity/system_status_environment.go
Normal file
34
entity/system_status_environment.go
Normal file
@@ -0,0 +1,34 @@
|
||||
package entity
|
||||
|
||||
// SystemStatusEnvironment System status environment properties
|
||||
type SystemStatusEnvironment struct {
|
||||
HomeURL string `json:"home_url"`
|
||||
SiteURL string `json:"site_url"`
|
||||
WCVersion string `json:"wc_version"`
|
||||
LogDirectory string `json:"log_directory"`
|
||||
LogDirectoryWritable bool `json:"log_directory_writable"`
|
||||
WPVersion string `json:"wp_version"`
|
||||
WPMultisite bool `json:"wp_multisite"`
|
||||
WPMemoryLimit int `json:"wp_memory_limit"`
|
||||
WPDebugMode bool `json:"wp_debug_mode"`
|
||||
WPCron bool `json:"wp_cron"`
|
||||
Language string `json:"language"`
|
||||
ServerInfo string `json:"server_info"`
|
||||
PHPVersion string `json:"php_version"`
|
||||
PHPPostMaxSize int `json:"php_post_max_size"`
|
||||
PHPMaxExecutionTime int `json:"php_max_execution_time"`
|
||||
PHPMaxInputVars int `json:"php_max_input_vars"`
|
||||
CURLVersion string `json:"curl_version"`
|
||||
SuhosinInstalled bool `json:"suhosin_installed"`
|
||||
MaxUploadSize int `json:"max_upload_size"`
|
||||
MySQLVersion string `json:"my_sql_version"`
|
||||
DefaultTimezone string `json:"default_timezone"`
|
||||
FSockOpenOrCurlEnabled bool `json:"fsockopen_or_curl_enabled"`
|
||||
SOAPClientEnabled bool `json:"soap_client_enabled"`
|
||||
GzipEnabled bool `json:"gzip_enabled"`
|
||||
MbStringEnabled bool `json:"mbstring_enabled"`
|
||||
RemotePostSuccessful bool `json:"remote_post_successful"`
|
||||
RemotePostResponse string `json:"remote_post_response"`
|
||||
RemoteGetSuccessful bool `json:"remote_get_successful"`
|
||||
RemoteGetResponse string `json:"remote_get_response"`
|
||||
}
|
||||
7
entity/system_status_security.go
Normal file
7
entity/system_status_security.go
Normal file
@@ -0,0 +1,7 @@
|
||||
package entity
|
||||
|
||||
// SystemStatusSecurity System status security properties
|
||||
type SystemStatusSecurity struct {
|
||||
SecureConnection bool `json:"secure_connection"`
|
||||
HideErrors bool `json:"hide_errors"`
|
||||
}
|
||||
15
entity/system_status_setting.go
Normal file
15
entity/system_status_setting.go
Normal file
@@ -0,0 +1,15 @@
|
||||
package entity
|
||||
|
||||
// SystemStatusSetting System status setting properties
|
||||
type SystemStatusSetting struct {
|
||||
APIEnabled bool `json:"api_enabled"`
|
||||
ForceSSL bool `json:"force_ssl"`
|
||||
Currency string `json:"currency"`
|
||||
CurrencySymbol string `json:"currency_symbol"`
|
||||
CurrencyPosition string `json:"currency_position"`
|
||||
ThousandSeparator string `json:"thousand_separator"`
|
||||
DecimalSeparator string `json:"decimal_separator"`
|
||||
NumberOfDecimals int `json:"number_of_decimals"`
|
||||
GeolocationEnabled bool `json:"geolocation_enabled"`
|
||||
Taxonomies []string `json:"taxonomies"`
|
||||
}
|
||||
17
entity/system_status_theme.go
Normal file
17
entity/system_status_theme.go
Normal file
@@ -0,0 +1,17 @@
|
||||
package entity
|
||||
|
||||
// SystemStatusTheme System status theme properties
|
||||
type SystemStatusTheme struct {
|
||||
Name string `json:"name"`
|
||||
Version string `json:"version"`
|
||||
VersionLatest string `json:"version_latest"`
|
||||
AuthorURL string `json:"author_url"`
|
||||
IsChildTheme bool `json:"is_child_theme"`
|
||||
HasWooCommerceSupport bool `json:"has_woo_commerce_support"`
|
||||
HasWooCommerceFile bool `json:"has_woo_commerce_file"`
|
||||
HasOutdatedTemplates bool `json:"has_outdated_templates"`
|
||||
Overrides []string `json:"overrides"`
|
||||
ParentName string `json:"parent_name"`
|
||||
ParentVersion string `json:"parent_version"`
|
||||
ParentAuthorURL string `json:"parent_author_url"`
|
||||
}
|
||||
12
entity/system_status_tool.go
Normal file
12
entity/system_status_tool.go
Normal file
@@ -0,0 +1,12 @@
|
||||
package entity
|
||||
|
||||
// SystemStatusTool system status tool properties
|
||||
type SystemStatusTool struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Action string `json:"action"`
|
||||
Description string `json:"description"`
|
||||
Success bool `json:"success"`
|
||||
Message string `json:"message"`
|
||||
Confirm bool `json:"confirm"`
|
||||
}
|
||||
7
entity/tax_class.go
Normal file
7
entity/tax_class.go
Normal file
@@ -0,0 +1,7 @@
|
||||
package entity
|
||||
|
||||
// TaxClass tax class properties
|
||||
type TaxClass struct {
|
||||
Slug string `json:"slug"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
19
entity/tax_rate.go
Normal file
19
entity/tax_rate.go
Normal file
@@ -0,0 +1,19 @@
|
||||
package entity
|
||||
|
||||
// TaxRate tax rate properties
|
||||
type TaxRate struct {
|
||||
ID int `json:"id"`
|
||||
Country string `json:"country"`
|
||||
State string `json:"state"`
|
||||
Postcode string `json:"postcode"`
|
||||
City string `json:"city"`
|
||||
Postcodes []string `json:"postcodes"`
|
||||
Cities []string `json:"cities"`
|
||||
Rate string `json:"rate"`
|
||||
Name string `json:"name"`
|
||||
Priority int `json:"priority"`
|
||||
Compound bool `json:"compound"`
|
||||
Shipping bool `json:"shipping"`
|
||||
Order int `json:"order"`
|
||||
Class string `json:"class"`
|
||||
}
|
||||
23
entity/taxes.go
Normal file
23
entity/taxes.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package entity
|
||||
|
||||
type Tax struct {
|
||||
ID int `json:"id"`
|
||||
RateCode string `json:"rate_code"`
|
||||
RateId string `json:"rate_id"`
|
||||
Label string `json:"label"`
|
||||
Compound bool `json:"compound"`
|
||||
TaxTotal float64 `json:"tax_total"`
|
||||
ShippingTaxTotal float64 `json:"shipping_tax_total"`
|
||||
MetaData []Meta `json:"meta_data"`
|
||||
}
|
||||
|
||||
type TaxLine struct {
|
||||
ID int `json:"id"`
|
||||
RateCode string `json:"rate_code"`
|
||||
RateId string `json:"rate_id"`
|
||||
Label string `json:"label"`
|
||||
Compound bool `json:"compound"`
|
||||
TaxTotal float64 `json:"tax_total"`
|
||||
ShippingTaxTotal float64 `json:"shipping_tax_total"`
|
||||
MetaData []Meta `json:"meta_data"`
|
||||
}
|
||||
18
entity/webhook.go
Normal file
18
entity/webhook.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package entity
|
||||
|
||||
// Webhook webhook properties
|
||||
type Webhook struct {
|
||||
ID int `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Status string `json:"status"`
|
||||
Topic string `json:"topic"`
|
||||
Resource string `json:"resource"`
|
||||
Event string `json:"event"`
|
||||
Hooks []string `json:"hooks"`
|
||||
DeliveryURL string `json:"delivery_url"`
|
||||
Secret string `json:"secret"`
|
||||
DateCreated string `json:"date_created"`
|
||||
DateCreatedGMT string `json:"date_created_gmt"`
|
||||
DateModified string `json:"date_modified"`
|
||||
DateModifiedGMT string `json:"date_modified_gmt"`
|
||||
}
|
||||
Reference in New Issue
Block a user