199 lines
2.8 KiB
Go
199 lines
2.8 KiB
Go
package twitch
|
|
|
|
import (
|
|
"time"
|
|
|
|
"go.fifitido.net/twitch/api/bits"
|
|
"go.fifitido.net/twitch/api/channelpoints"
|
|
"go.fifitido.net/twitch/api/conduit"
|
|
"go.fifitido.net/twitch/api/entitlements"
|
|
"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
|
|
}
|
|
|
|
func AccentColor(s types.AccentColor) *types.AccentColor {
|
|
return &s
|
|
}
|
|
|
|
func ToAccentColor(s *types.AccentColor) types.AccentColor {
|
|
if s == nil {
|
|
return ""
|
|
}
|
|
return *s
|
|
}
|
|
|
|
func ConduitStatus(s conduit.Status) *conduit.Status {
|
|
return &s
|
|
}
|
|
|
|
func ToConduitStatus(s *conduit.Status) conduit.Status {
|
|
if s == nil {
|
|
return ""
|
|
}
|
|
return *s
|
|
}
|
|
|
|
func Locale(s types.Locale) *types.Locale {
|
|
return &s
|
|
}
|
|
|
|
func ToLocale(s *types.Locale) types.Locale {
|
|
if s == nil {
|
|
return ""
|
|
}
|
|
return *s
|
|
}
|
|
|
|
func FulfillmentStatus(s entitlements.FulfillmentStatus) *entitlements.FulfillmentStatus {
|
|
return &s
|
|
}
|
|
|
|
func ToFulfillmentStatus(s *entitlements.FulfillmentStatus) entitlements.FulfillmentStatus {
|
|
if s == nil {
|
|
return ""
|
|
}
|
|
return *s
|
|
}
|