generated from NdoleStudio/go-http-client
-
Notifications
You must be signed in to change notification settings - Fork 17
/
discount.go
45 lines (39 loc) · 1.92 KB
/
discount.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package lemonsqueezy
import "time"
// DiscountAttributes contains information about a percentage or amount discount that can be applied to an order at checkout via a code.
type DiscountAttributes struct {
StoreID int `json:"store_id"`
Name string `json:"name"`
Code string `json:"code"`
Amount int `json:"amount"`
AmountType string `json:"amount_type"`
IsLimitedToProducts bool `json:"is_limited_to_products"`
IsLimitedRedemptions bool `json:"is_limited_redemptions"`
MaxRedemptions int `json:"max_redemptions"`
StartsAt *time.Time `json:"starts_at"`
ExpiresAt *time.Time `json:"expires_at"`
Duration string `json:"duration"`
DurationInMonths int `json:"duration_in_months"`
Status string `json:"status"`
StatusFormatted string `json:"status_formatted"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
// APIResponseRelationshipsDiscount relationships of a discount
type APIResponseRelationshipsDiscount struct {
Store ApiResponseLinks `json:"store"`
DiscountRedemptions ApiResponseLinks `json:"discount-redemptions"`
Variants ApiResponseLinks `json:"variants"`
}
// DiscountAPIResponse is the api response for one discount
type DiscountAPIResponse = ApiResponse[DiscountAttributes, APIResponseRelationshipsDiscount]
// DiscountsAPIResponse is the api response for a list of discounts.
type DiscountsAPIResponse = ApiResponseList[DiscountAttributes, APIResponseRelationshipsDiscount]
// DiscountCreateParams are parameters for creating a discount
type DiscountCreateParams struct {
Name string `json:"name"`
Code string `json:"code"`
Amount int `json:"amount"`
AmountType string `json:"amountType"`
StoreID int `json:"storeID"`
}