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 ¶
StringToDateTimeHook is used with mapstructure package to correctly unmarshal time fields https://github.com/mitchellh/mapstructure/issues/41
Types ¶
type CustomError ¶
type CustomError struct { Code ErrorCode Response *PlayFabResponse // contains filtered or unexported fields }
CustomError contains data about an error during HTTP operation
func NewCustomError ¶
func NewCustomError(msg string, code ErrorCode) *CustomError
NewCustomError returns a new CustomError with a message and an error code
func NewCustomErrorWithResponse ¶
func NewCustomErrorWithResponse(msg string, code ErrorCode, response *PlayFabResponse) *CustomError
NewCustomErrorWithResponse returns a new CustomError with a message, error code, and PlayFab response
func (*CustomError) Error ¶
func (p *CustomError) 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 )
type PlayFabResponse ¶
type PlayFabResponse struct { Code int `json:"code"` Status string `json:"status"` Data map[string]interface{} `json:"data"` Error string `json:"error"` ErrorCode int `json:"errorCode"` ErrorMessage string `json:"errorMessage"` ErrorDetails map[string][]string `json:"errorDetails"` }
PlayFabResponse contains all fields returned from a PlayFab request
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 ¶
NewSettingsWithDefaultOptions returns a pointer to a Settings struct that carries default values Requires a valid titleId