sdk

package module
v0.0.0-...-9535929 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2020 License: Apache-2.0 Imports: 10 Imported by: 2

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 {
	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

func (*CustomError) ErrorCode

func (p *CustomError) ErrorCode() int

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

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