94 lines
2.2 KiB
Go
94 lines
2.2 KiB
Go
package types
|
||
|
||
import (
|
||
"encoding/json"
|
||
"time"
|
||
)
|
||
|
||
type Cursor string
|
||
|
||
func (c Cursor) String() string {
|
||
return string(c)
|
||
}
|
||
|
||
func (c *Cursor) UnmarshalText(text []byte) error {
|
||
*c = Cursor(string(text))
|
||
return nil
|
||
}
|
||
|
||
func (c Cursor) MarshalText() ([]byte, error) {
|
||
return []byte(string(c)), nil
|
||
}
|
||
|
||
func (c *Cursor) UnmarshalJSON(data []byte) error {
|
||
var s string
|
||
if err := json.Unmarshal(data, &s); err != nil {
|
||
return err
|
||
}
|
||
|
||
*c = Cursor(s)
|
||
return nil
|
||
}
|
||
|
||
func (c Cursor) MarshalJSON() ([]byte, error) {
|
||
return json.Marshal(string(c))
|
||
}
|
||
|
||
// Contains the information used to page through the list of results.
|
||
// The object is empty if there are no more pages left to page through.
|
||
type Pagination struct {
|
||
// The cursor used to get the next page of results. Use the cursor to set the request’s after query parameter.
|
||
Cursor Cursor `json:"cursor"`
|
||
}
|
||
|
||
type DateRange struct {
|
||
StartedAt time.Time `json:"started_at"`
|
||
EndedAt time.Time `json:"ended_at"`
|
||
}
|
||
|
||
// Content Classification Label
|
||
type CCL string
|
||
|
||
const (
|
||
CCLDrugsIntoxication CCL = "DrugsIntoxication"
|
||
CCLSexualThemes CCL = "SexualThemes"
|
||
CCLViolentGraphic CCL = "ViolentGraphic"
|
||
CCLGambling CCL = "Gambling"
|
||
CCLProfanityVulgarity CCL = "ProfanityVulgarity"
|
||
)
|
||
|
||
// Sort Order
|
||
type SortOrder string
|
||
|
||
const (
|
||
SortOrderOldest SortOrder = "OLDEST"
|
||
SortOrderNewest SortOrder = "NEWEST"
|
||
)
|
||
|
||
// Currency Amount
|
||
type CurrencyAmount struct {
|
||
// The monetary amount.
|
||
// The amount is specified in the currency’s minor unit.
|
||
// For example, the minor units for USD is cents, so if the amount is $5.50 USD, value is set to 550.
|
||
Value int `json:"value"`
|
||
|
||
// The number of decimal places used by the currency. For example, USD uses two decimal places.
|
||
// Use this number to translate value from minor units to major units by using the formula:
|
||
//
|
||
// value / 10^decimal_places
|
||
DecimalPlaces int `json:"decimal_places"`
|
||
|
||
// The ISO-4217 three-letter currency code that identifies the type of currency in value.
|
||
Currency string `json:"currency"`
|
||
}
|
||
|
||
type AccentColor string
|
||
|
||
const (
|
||
AccentColorPrimary AccentColor = "primary"
|
||
AccentColorBlue AccentColor = "blue"
|
||
AccentColorGreen AccentColor = "green"
|
||
AccentColorOrange AccentColor = "orange"
|
||
AccentColorPurple AccentColor = "purple"
|
||
)
|