playfab

package
v0.0.0-...-4f1356e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 23, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Request

func Request(p *Settings, b []byte, apiPath string, authKey string, authValue string) (map[string]interface{}, error)

Request executes the actual HTTP call

func StringToDateTimeHook

func StringToDateTimeHook(f reflect.Type, t reflect.Type, data interface{}) (interface{}, error)

StringToDateTimeHook is used with mapstructure package to correctly unmarshal time fields https://github.com/mitchellh/mapstructure/issues/41

Types

type AdType

type AdType string

AdType

const (
	AdTypeIdfa                AdType = "Idfa"
	AdTypeAndroidId           AdType = "Adid"
	AdTypeIdfaSuccessful      AdType = "Idfa_Successful"
	AdTypeAndroidIdSuccessful AdType = "Adid_Successful"
)

type CustomError

type CustomError struct {
	ErrCode ErrorCode // local ErrorCode for the error
	ErrMsg  string    // local text error message
}

CustomError contains data about an local error during HTTP operation

func NewCustomError

func NewCustomError(msg string, errCode ErrorCode) *CustomError

NewCustomError returns a new CustomError with a message and an error code

func (*CustomError) Error

func (p *CustomError) Error() string

type CustomRemoteError

type CustomRemoteError struct {
	ErrCode           ErrorCode // local ErrorCode for the error
	RemoteStatus      string    // String HTTP code
	RemoteErrCode     int       // Numerical PlayFab error code
	RemoteErrCodeText string    // Text Playfab error code
	RemoteErrMsg      string    // Description for the PlayFab errorCode
	RemoteErrDetails  map[string][]string
}

CustomRemoteError contains data about an remote error from the HTTP operation

func NewCustomRemoteError

func NewCustomRemoteError(res *playFabResponse, errCode ErrorCode) *CustomRemoteError

NewCustomRemoteError returns a new CustomError with a message and an error code

func (*CustomRemoteError) Error

func (p *CustomRemoteError) Error() string

type ErrorCode

type ErrorCode int

ErrorCode is a custom error code

const (
	// ErrorUnmarshal is an error during response unmarshaling
	ErrorUnmarshal ErrorCode = iota
	// ErrorGZIP is an error during GZIPing
	ErrorGZIP
	// ErrorCreateRequest is an error during request creation
	ErrorCreateRequest
	// ErrorDoRequest is an error during request execution
	ErrorDoRequest
	// ErrorMarshal is an error during POST data marshaling
	ErrorMarshal
	// ErrorDecoding is an error that occurs during map[string]interface{} -> struct creation
	ErrorDecoding
	// ErrorGeneric represents a generic error
	ErrorGeneric
	// ErrorRemote represents remote error
	ErrorRemote
)

type Settings

type Settings struct {
	VersionString            string
	RequestGetParams         map[string]string
	ProductionEnvironmentURL string
	EnableCompression        bool
	VerticalName             string
	TitleId                  string
	DisableSsl               bool
	APIPath                  string
	AdvertisingIdType        AdType
	AdvertisingIdValue       string
	DisableAdvertising       bool
}

Settings includes various conf options for PlayFab HTTP call

func NewSettingsWithDefaultOptions

func NewSettingsWithDefaultOptions(titleId string) *Settings

NewSettingsWithDefaultOptions returns a pointer to a Settings struct that carries default values Requires a valid titleId

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL