2024-02-27 22:13:57 -05:00
|
|
|
package twitch
|
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"go.fifitido.net/twitch/api/bits"
|
|
|
|
"go.fifitido.net/twitch/api/channelpoints"
|
2024-02-28 13:50:07 -05:00
|
|
|
"go.fifitido.net/twitch/api/conduit"
|
2024-02-28 14:25:19 -05:00
|
|
|
"go.fifitido.net/twitch/api/entitlements"
|
2024-02-27 22:13:57 -05:00
|
|
|
"go.fifitido.net/twitch/api/types"
|
|
|
|
)
|
|
|
|
|
|
|
|
func String(s string) *string {
|
|
|
|
return &s
|
|
|
|
}
|
|
|
|
|
|
|
|
func ToString(s *string) string {
|
|
|
|
if s == nil {
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
return *s
|
|
|
|
}
|
|
|
|
|
|
|
|
func StringSlice(s []string) *[]string {
|
|
|
|
return &s
|
|
|
|
}
|
|
|
|
|
|
|
|
func ToStringSlice(s *[]string) []string {
|
|
|
|
if s == nil {
|
|
|
|
return []string{}
|
|
|
|
}
|
|
|
|
return *s
|
|
|
|
}
|
|
|
|
|
|
|
|
func Bool(b bool) *bool {
|
|
|
|
return &b
|
|
|
|
}
|
|
|
|
|
|
|
|
func ToBool(b *bool) bool {
|
|
|
|
if b == nil {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
return *b
|
|
|
|
}
|
|
|
|
|
|
|
|
func Int(i int) *int {
|
|
|
|
return &i
|
|
|
|
}
|
|
|
|
|
|
|
|
func ToInt(i *int) int {
|
|
|
|
if i == nil {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
return *i
|
|
|
|
}
|
|
|
|
|
|
|
|
func Int64(i int64) *int64 {
|
|
|
|
return &i
|
|
|
|
}
|
|
|
|
|
|
|
|
func ToInt64(i *int64) int64 {
|
|
|
|
if i == nil {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
return *i
|
|
|
|
}
|
|
|
|
|
|
|
|
func Int32(i int32) *int32 {
|
|
|
|
return &i
|
|
|
|
}
|
|
|
|
|
|
|
|
func ToInt32(i *int32) int32 {
|
|
|
|
if i == nil {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
return *i
|
|
|
|
}
|
|
|
|
|
|
|
|
func Float32(f float32) *float32 {
|
|
|
|
return &f
|
|
|
|
}
|
|
|
|
|
|
|
|
func ToFloat32(f *float32) float32 {
|
|
|
|
if f == nil {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
return *f
|
|
|
|
}
|
|
|
|
|
|
|
|
func Float64(f float64) *float64 {
|
|
|
|
return &f
|
|
|
|
}
|
|
|
|
|
|
|
|
func ToFloat64(f *float64) float64 {
|
|
|
|
if f == nil {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
return *f
|
|
|
|
}
|
|
|
|
|
|
|
|
func Time(t time.Time) *time.Time {
|
|
|
|
return &t
|
|
|
|
}
|
|
|
|
|
|
|
|
func ToTime(t *time.Time) time.Time {
|
|
|
|
if t == nil {
|
|
|
|
return time.Time{}
|
|
|
|
}
|
|
|
|
return *t
|
|
|
|
}
|
|
|
|
|
|
|
|
func Cursor(c types.Cursor) *types.Cursor {
|
|
|
|
return &c
|
|
|
|
}
|
|
|
|
|
|
|
|
func ToCursor(c *types.Cursor) types.Cursor {
|
|
|
|
if c == nil {
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
return *c
|
|
|
|
}
|
|
|
|
|
|
|
|
func BitsPeriod(p bits.Period) *bits.Period {
|
|
|
|
return &p
|
|
|
|
}
|
|
|
|
|
|
|
|
func ToBitsPeriod(p *bits.Period) bits.Period {
|
|
|
|
if p == nil {
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
return *p
|
|
|
|
}
|
|
|
|
|
|
|
|
func RewardRedemptionStatus(s channelpoints.RewardRedemptionStatus) *channelpoints.RewardRedemptionStatus {
|
|
|
|
return &s
|
|
|
|
}
|
|
|
|
|
|
|
|
func ToRewardRedemptionStatus(s *channelpoints.RewardRedemptionStatus) channelpoints.RewardRedemptionStatus {
|
|
|
|
if s == nil {
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
return *s
|
|
|
|
}
|
|
|
|
|
|
|
|
func SortOrder(s types.SortOrder) *types.SortOrder {
|
|
|
|
return &s
|
|
|
|
}
|
|
|
|
|
|
|
|
func ToSortOrder(s *types.SortOrder) types.SortOrder {
|
|
|
|
if s == nil {
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
return *s
|
|
|
|
}
|
2024-02-28 10:30:20 -05:00
|
|
|
|
|
|
|
func AccentColor(s types.AccentColor) *types.AccentColor {
|
|
|
|
return &s
|
|
|
|
}
|
|
|
|
|
|
|
|
func ToAccentColor(s *types.AccentColor) types.AccentColor {
|
|
|
|
if s == nil {
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
return *s
|
|
|
|
}
|
2024-02-28 13:50:07 -05:00
|
|
|
|
|
|
|
func ConduitStatus(s conduit.Status) *conduit.Status {
|
|
|
|
return &s
|
|
|
|
}
|
|
|
|
|
|
|
|
func ToConduitStatus(s *conduit.Status) conduit.Status {
|
|
|
|
if s == nil {
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
return *s
|
|
|
|
}
|
2024-02-28 14:03:24 -05:00
|
|
|
|
|
|
|
func Locale(s types.Locale) *types.Locale {
|
|
|
|
return &s
|
|
|
|
}
|
|
|
|
|
|
|
|
func ToLocale(s *types.Locale) types.Locale {
|
|
|
|
if s == nil {
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
return *s
|
|
|
|
}
|
2024-02-28 14:25:19 -05:00
|
|
|
|
|
|
|
func FulfillmentStatus(s entitlements.FulfillmentStatus) *entitlements.FulfillmentStatus {
|
|
|
|
return &s
|
|
|
|
}
|
|
|
|
|
|
|
|
func ToFulfillmentStatus(s *entitlements.FulfillmentStatus) entitlements.FulfillmentStatus {
|
|
|
|
if s == nil {
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
return *s
|
|
|
|
}
|