Documentation
¶
Index ¶
- Constants
- type AdCampaignAttribution
- type Character
- type CharacterInventory
- type ContactEmailAddress
- type EmailVerificationStatus
- type Error
- type Identity
- type IdentityProvider
- type ItemInstance
- type LinkedPlatformAccount
- type Location
- type LoginConfig
- type Membership
- type PlayerProfile
- type ProfileConstraints
- type PushNotificationRegistration
- type RequestParameters
- type ResponseParameters
- type Result
- type Statistic
- type StatisticValue
- type Subscription
- type Tag
- type TreatmentAssignment
- type UserAccount
- type UserAndroidDevice
- type UserAppleAccount
- type UserCustomID
- type UserDataRecord
- type UserFacebook
- type UserFacebookInstantGamesID
- type UserGameCenter
- type UserGoogle
- type UserGooglePlayGames
- type UserIOSDevice
- type UserKongregate
- type UserNintendoSwitchAccount
- type UserNintendoSwitchDeviceID
- type UserOpenID
- type UserPSN
- type UserPrivate
- type UserSettings
- type UserSteam
- type UserTitle
- type UserTwitch
- type UserXbox
- type ValuesToDate
- type Variable
- type VirtualCurrencyRechargeTime
- type XBLIdentityProvider
Constants ¶
const ( TitleActivationStatusActivatedSteam = "ActivatedSteam" TitleActivationStatusActivatedTitleKey = "ActivatedTitleKey" TitleActivationStatusNone = "None" TitleActivationStatusPendingSteam = "PendingSteam" TitleActivationStatusRevokedSteam = "RevokedSteam" )
const ( UserOriginationAmazon = "Amazon" UserOriginationAndroid = "Android" UserOriginationApple = "Apple" UserOriginationCustomID = "CustomId" UserOriginationFacebook = "Facebook" UserOriginationFacebookInstantGamesID = "FacebookInstantGamesId" UserOriginationGameCenter = "GameCenter" UserOriginationGamersFirst = "GamersFirst" UserOriginationGoogle = "Google" UserOriginationGooglePlayGames = "GooglePlayGames" UserOriginationIOS = "IOS" UserOriginationKongregate = "Kongregate" UserOriginationLoadTest = "LoadTest" UserOriginationNintendoSwitchAccount = "NintendoSwitchAccount" UserOriginationNintendoSwitchDeviceID = "NintendoSwitchDeviceID" UserOriginationOpenIDConnect = "OpenIdConnect" UserOriginationOrganic = "Organic" UserOriginationPSN = "PSN" UserOriginationParse = "Parse" UserOriginationServerCustomID = "ServerCustomId" UserOriginationSteam = "Steam" UserOriginationTwitch = "Twitch" UserOriginationUnknown = "Unknown" UserOriginationXboxLive = "XboxLive" )
const ( IdentityProviderAndroidDevice = "AndroidDevice" IdentityProviderApple = "Apple" IdentityProviderCustom = "Custom" IdentityProviderCustomServer = "CustomServer" IdentityProviderFacebook = "Facebook" IdentityProviderFacebookInstantGames = "FacebookInstantGames" IdentityProviderGameCenter = "GameCenter" IdentityProviderGameServer = "GameServer" IdentityProviderGooglePlay = "GooglePlay" IdentityProviderGooglePlayGames = "GooglePlayerGames" IdentityProviderIOSDevice = "IOSDevice" IdentityProviderKongregate = "Kongregate" IdentityProviderNintendoSwitch = "NintendoSwitch" IdentityProviderNintendoSwitchAccount = "NintendoSwitchAccount" IdentityProviderOpenIDConnect = "OpenIdConnect" IdentityProviderPSN = "PSN" IdentityProviderPlayFab = "PlayFab" IdentityProviderSteam = "Steam" IdentityProviderTwitch = "Twitch" IdentityProviderUnknown = "Unknown" IdentityProviderWindowsHello = "WindowsHello" IdentityProviderXboxLive = "XBoxLive" )
const ( SubscriptionStatusBillingError = "BillingError" SubscriptionStatusCancelled = "Cancelled" SubscriptionStatusCustomerDidNotAcceptPriceChange = "CustomerDidNotAcceptPriceChange" SubscriptionStatusFreeTrial = "FreeTrial" SubscriptionStatusNoError = "NoError" SubscriptionStatusPaymentPending = "PaymentPending" SubscriptionStatusUnknownError = "UnknownError" )
const ( PushNotificationPlatformApplePushNotificationService = "ApplePushNotificationService" PushNotificationPlatformGoogleCloudMessaging = "GoogleCloudMessaging" )
const ( UserDataPermissionPrivate = "Private" UserDataPermissionPublic = "Public" )
const ( ErrorCodeEncryptionKeyMissing = 1290 ErrorCodeEvaluationModePlayerCountExceeded = 1490 ErrorCodeExpiredXboxLiveToken = 1189 ErrorCodeInvalidXboxLiveToken = 1188 ErrorCodeRequestViewConstraintParamsNotAllowed = 1303 ErrorCodeSignedRequestNotAllowed = 1302 ErrorCodeXboxInaccessible = 1339 ErrorCodeXboxRejectedXSTSExchangeRequest = 1343 ErrorCodeXboxXASSExchangeFailure = 1306 )
const ( ErrorCodeDatabaseThroughputExceeded = 1113 ErrorCodeItemNotFound = 1047 ErrorCodeNotImplemented = 1515 )
const RelyingParty = "http://playfab.xboxlive.com/"
RelyingParty is the party that a xsapi.Token obtained from [XBLIdentityProvider.TokenSource] should rely on. Using a xsapi.Token that relies on other party may cause an error related to "decrypting token body".
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AdCampaignAttribution ¶
type CharacterInventory ¶
type CharacterInventory struct {
ID string `json:"CharacterId,omitempty"`
Inventory []ItemInstance `json:"Inventory,omitempty"`
}
type ContactEmailAddress ¶
type ContactEmailAddress struct {
Address string `json:"EmailAddress,omitempty"`
Name string `json:"Name,omitempty"`
VerificationStatus EmailVerificationStatus `json:"VerificationStatus,omitempty"`
}
type EmailVerificationStatus ¶
type EmailVerificationStatus string
const ( EmailVerificationStatusConfirmed EmailVerificationStatus = "Confirmed" EmailVerificationStatusPending EmailVerificationStatus = "Pending" EmailVerificationStatusUnverified EmailVerificationStatus = "Unverified" )
type Identity ¶
type Identity struct {
// EntityToken is an [entity.Token] of [entity.TypeTitlePlayerAccount].
// API requests will mostly require an [entity.Token] of [entity.TypeMasterPlayerAccount]
// so you may exchange it with [entity.Token.Exchange] with PlayFabID.
EntityToken *entity.Token `json:"EntityToken,omitempty"`
ResponseParameters ResponseParameters `json:"InfoResultPayload,omitempty"`
// LastLoginTime is the time of previous login. If there was no previous login, it is zero [time.Time].
LastLoginTime time.Time `json:"LastLoginTime,omitempty"`
// NewlyCreated is true if the account was newly created on login.
NewlyCreated bool `json:"NewlyCreated,omitempty"`
// PlayFabID is the unique ID of player. It can be used for exchanging an [entity.Token]
// of [entity.TypeMasterPlayerAccount] with [entity.Token.Exchange].
PlayFabID string `json:"PlayFabId,omitempty"`
// SessionTicket is a unique token authorizing the user and game at server level, for the
// current session. In Minecraft, it is used for authorizing with franchise API using a PlayFab token.
SessionTicket string `json:"SessionTicket,omitempty"`
// SettingsForUser is the settings specific to the user.
SettingsForUser UserSettings `json:"SettingsForUser,omitempty"`
TreatmentAssignment TreatmentAssignment `json:"TreatmentAssignment,omitempty"`
}
Identity a session identity that can subsequently be used for API which requires an authentication. It is generally returned as a result of [IdentityProvider.Login] or LoginConfig.Login.
type IdentityProvider ¶
type IdentityProvider interface {
Login(config LoginConfig) (*Identity, error)
}
IdentityProvider implements a Login method, which signs in to the PlayFab using LoginConfig.Login with a LoginConfig with additional fields required to fill in, through the path '/Client/LoginWithXXX', where X is normally the method to sign in. IdentityProvider is implemented by several platforms which supports signing in to the PlayFab with their identity.
type ItemInstance ¶
type ItemInstance struct {
Annotation string `json:"Annotation,omitempty"`
BundleContents []string `json:"BundleContents,omitempty"`
BundleParent string `json:"BundleParent,omitempty"`
CatalogVersion string `json:"CatalogVersion,omitempty"`
CustomData map[string]json.RawMessage `json:"CustomData,omitempty"`
DisplayName string `json:"DisplayName,omitempty"`
Expiration time.Time `json:"Expiration,omitempty"`
Class string `json:"ItemClass,omitempty"`
ID string `json:"ItemId,omitempty"`
InstanceID string `json:"ItemInstanceId,omitempty"`
PurchaseDate time.Time `json:"PurchaseDate,omitempty"`
RemainingUses int `json:"RemainingUses,omitempty"`
UnitCurrency string `json:"UnitCurrency,omitempty"`
UnitPrice int `json:"UnitPrice,omitempty"`
UsesIncrementedBy int `json:"UsesIncrementedBy,omitempty"`
}
type LinkedPlatformAccount ¶
type LoginConfig ¶
type LoginConfig struct {
Title title.Title `json:"TitleId,omitempty"`
// CreateAccount specifies to automatically create a PlayFab account if
// one is not currently linked to the ID.
CreateAccount bool `json:"CreateAccount,omitempty"`
// CustomTags is the optional custom tags associated with the request.
CustomTags map[string]any `json:"CustomTags,omitempty"`
// EncryptedRequest is a base64-encoded body that is encrypted with the
// Title's public RSA key (Enterprise Only).
EncryptedRequest []byte `json:"EncryptedRequest,omitempty"`
RequestParameters *RequestParameters `json:"InfoRequestParameters,omitempty"`
// PlayerSecret that is used to verify API request signatures (Enterprise Only).
PlayerSecret string `json:"PlayerSecret,omitempty"`
}
LoginConfig represents a base structure used for signing in to the PlayFab through a method. An implementation of IdentityProvider may embed LoginConfig with additional fields required to fill in.
func (LoginConfig) Login ¶
func (l LoginConfig) Login(path string, body any) (*Identity, error)
Login signs in to PlayFab using the request body and the path. The path normally follows the format 'Client/LoginWithXXX' where X typically is the method for signing in. The request body is generally a structure that may embed LoginConfig with additional fields required for the specific path, such as a token of IdentityProvider.
type Membership ¶
type Membership struct {
Active bool `json:"IsActive,omitempty"`
Expiration time.Time `json:"MembershipExpiration,omitempty"`
ID string `json:"MembershipId,omitempty"`
OverrideExpiration time.Time `json:"OverrideExpiration,omitempty"`
OverrideSet bool `json:"OverrideIsSet,omitempty"`
Subscriptions []Subscription `json:"Subscriptions,omitempty"`
}
type PlayerProfile ¶
type PlayerProfile struct {
AdCampaignAttributions []AdCampaignAttribution `json:"AdCampaignAttributions,omitempty"`
AvatarURL string `json:"AvatarUrl,omitempty"`
BannedUntil time.Time `json:"BannedUntil,omitempty"`
ContactEmailAddresses []ContactEmailAddress `json:"ContactEmailAddresses,omitempty"`
Created time.Time `json:"Created,omitempty"`
DisplayName string `json:"DisplayName,omitempty"`
ExperimentVariants []string `json:"ExperimentVariants,omitempty"`
LastLogin time.Time `json:"LastLogin,omitempty"`
LinkedAccounts []LinkedPlatformAccount `json:"LinkedAccounts,omitempty"`
Locations []Location `json:"Locations,omitempty"`
Memberships []Membership `json:"Memberships,omitempty"`
Origination string `json:"Origination,omitempty"`
PlayerID string `json:"PlayerId,omitempty"`
PublisherID string `json:"PublisherId,omitempty"`
PushNotificationRegistrations []PushNotificationRegistration `json:"PushNotificationRegistrations,omitempty"`
Statistics []Statistic `json:"Statistics,omitempty"`
Tags []Tag `json:"Tags,omitempty"`
Title title.Title `json:"TitleId,omitempty"`
TotalValueToDateInUSD int `json:"TotalValueToDateInUSD,omitempty"`
ValuesToDates []ValuesToDate `json:"ValuesToDate,omitempty"`
}
type ProfileConstraints ¶
type ProfileConstraints struct {
ShowAvatarURL bool `json:"ShowAvatarUrl,omitempty"`
ShowBannedUntil bool `json:"ShowBannedUntil,omitempty"`
ShowCampaignAttributions bool `json:"ShowCampaignAttributions,omitempty"`
ShowContactEmailAddresses bool `json:"ShowContactEmailAddresses,omitempty"`
ShowCreated bool `json:"ShowCreated,omitempty"`
ShowDisplayName bool `json:"ShowDisplayName,omitempty"`
ShowExperimentVariants bool `json:"ShowExperimentVariants,omitempty"`
ShowLastLogin bool `json:"ShowLastLogin,omitempty"`
ShowLinkedAccounts bool `json:"ShowLinkedAccounts,omitempty"`
ShowLocations bool `json:"ShowLocations,omitempty"`
ShowMemberships bool `json:"ShowMemberships,omitempty"`
ShowOrigination bool `json:"ShowOrigination,omitempty"`
ShowPushNotificationRegistrations bool `json:"ShowPushNotificationRegistrations,omitempty"`
ShowStatistics bool `json:"ShowStatistics,omitempty"`
ShowTags bool `json:"ShowTags,omitempty"`
ShowTotalValueToDateInUSD bool `json:"ShowTotalValueToDateInUsd,omitempty"`
ShowValuesToDate bool `json:"ShowValuesToDate,omitempty"`
}
ProfileConstraints specifies the properties to return from the player profile, it is included as [RequestParameters.ProfileConstraints] to request some of the properties specified on the fields as [ResponseParameters.PlayerProfile].
type RequestParameters ¶
type RequestParameters struct {
CharacterInventories bool `json:"GetCharacterInventories,omitempty"`
CharacterList bool `json:"GetCharacterList,omitempty"`
PlayerProfile bool `json:"GetPlayerProfile,omitempty"`
PlayerStatistics bool `json:"GetPlayerStatistics,omitempty"`
TitleData bool `json:"GetTitleData,omitempty"`
UserAccountInfo bool `json:"GetUserAccountInfo,omitempty"`
UserData bool `json:"GetUserData,omitempty"`
UserInventory bool `json:"GetUserInventory,omitempty"`
UserReadOnlyData bool `json:"GetUserReadOnlyData,omitempty"`
UserVirtualCurrency bool `json:"GetUserVirtualCurrency,omitempty"`
PlayerStatisticNames []string `json:"PlayerStatisticNames,omitempty"`
ProfileConstraints ProfileConstraints `json:"ProfileConstraints,omitempty"`
TitleDataKeys []string `json:"TitleDataKeys,omitempty"`
UserDataKeys []string `json:"UserDataKeys,omitempty"`
UserReadOnlyDataKeys []string `json:"UserReadOnlyDataKeys,omitempty"`
}
RequestParameters is a set of requested parameters included in ResponseParameters, which can be retrieved through [Identity.ResponseParameters]. Users may set RequestParameters as a part of LoginConfig to include additional parameters while signing in to PlayFab.
type ResponseParameters ¶
type ResponseParameters struct {
Account UserAccount `json:"AccountInfo,omitempty"`
CharacterInventories []CharacterInventory `json:"CharacterInventories,omitempty"`
CharacterList []Character `json:"CharacterList,omitempty"`
PlayerProfile PlayerProfile `json:"PlayerProfile,omitempty"`
PlayerStatistics []StatisticValue `json:"PlayerStatistics,omitempty"`
TitleData map[string]json.RawMessage `json:"TitleData,omitempty"`
UserData UserDataRecord `json:"UserData,omitempty"`
UserDataVersion int `json:"UserDataVersion,omitempty"`
UserInventory []ItemInstance `json:"UserInventory,omitempty"`
UserReadOnlyData UserDataRecord `json:"UserReadOnlyData,omitempty"`
UserReadOnlyDataVersion int `json:"UserReadOnlyDataVersion,omitempty"`
UserVirtualCurrency map[string]json.RawMessage `json:"UserVirtualCurrency,omitempty"`
UserVirtualCurrencyRechargeTime VirtualCurrencyRechargeTime `json:"UserVirtualCurrencyRechargeTimes"`
}
ResponseParameters is a set of parameters requested to be included in RequestParameters, which is a part of LoginConfig as [LoginConfig.RequestParameters]. It includes an information of player/entity signed in at Identity.
type StatisticValue ¶
type Subscription ¶
type Subscription struct {
Expiration time.Time `json:"Expiration,omitempty"`
InitialSubscriptionTime time.Time `json:"InitialSubscriptionTime,omitempty"`
Active bool `json:"IsActive,omitempty"`
Status string `json:"Status,omitempty"`
ID string `json:"SubscriptionId,omitempty"`
ItemID string `json:"SubscriptionItemId,omitempty"`
Provider string `json:"SubscriptionProvider,omitempty"`
}
type TreatmentAssignment ¶
type UserAccount ¶
type UserAccount struct {
AndroidDevice UserAndroidDevice `json:"AndroidDeviceInfo,omitempty"`
AppleAccount UserAppleAccount `json:"AppleAccountInfo,omitempty"`
Created time.Time `json:"Created,omitempty"`
CustomID UserCustomID `json:"CustomIdInfo,omitempty"`
Facebook UserFacebook `json:"FacebookInfo,omitempty"`
FacebookInstantGamesID UserFacebookInstantGamesID `json:"FacebookInstantGamesIdInfo,omitempty"`
GameCenter UserGameCenter `json:"GameCenterInfo,omitempty"`
Google UserGoogle `json:"GoogleInfo,omitempty"`
GooglePlayGames UserGooglePlayGames `json:"GooglePlayGamesInfo,omitempty"`
IOSDevice UserIOSDevice `json:"IosDeviceInfo,omitempty"`
Kongregate UserKongregate `json:"KongregateInfo,omitempty"`
NintendoSwitchAccount UserNintendoSwitchAccount `json:"NintendoSwitchAccountInfo,omitempty"`
NintendoSwitchDeviceID UserNintendoSwitchDeviceID `json:"NintendoSwitchDeviceIdInfo,omitempty"`
OpenID UserOpenID `json:"OpenIdInfo,omitempty"`
PlayFabID string `json:"PlayFabId,omitempty"`
Private UserPrivate `json:"PrivateInfo,omitempty"`
PSN UserPSN `json:"PsnInfo,omitempty"`
Steam UserSteam `json:"SteamInfo,omitempty"`
Title UserTitle `json:"TitleInfo,omitempty"`
Twitch UserTwitch `json:"TwitchInfo,omitempty"`
Username string `json:"Username,omitempty"`
Xbox UserXbox `json:"Xbox,omitempty"`
}
UserAccount specifies an account information for several platforms that supports PlayFab as an identity provider.
type UserAndroidDevice ¶
type UserAndroidDevice struct {
DeviceID string `json:"AndroidDeviceId,omitempty"`
}
type UserAppleAccount ¶
type UserAppleAccount struct {
SubjectID string `json:"AppleSubjectId,omitempty"`
}
type UserCustomID ¶
type UserCustomID struct {
ID string `json:"CustomId,omitempty"`
}
type UserDataRecord ¶
type UserFacebook ¶
type UserFacebookInstantGamesID ¶
type UserFacebookInstantGamesID struct {
ID string `json:"FacebookInstantGamesId,omitempty"`
}
type UserGameCenter ¶
type UserGameCenter struct {
ID string `json:"GameCenterId,omitempty"`
}
type UserGoogle ¶
type UserGooglePlayGames ¶
type UserIOSDevice ¶
type UserIOSDevice struct {
ID string `json:"IosDeviceId,omitempty"`
}
type UserKongregate ¶
type UserNintendoSwitchAccount ¶
type UserNintendoSwitchAccount struct {
SubjectID string `json:"NintendoSwitchAccountSubjectId,omitempty"`
}
type UserNintendoSwitchDeviceID ¶
type UserNintendoSwitchDeviceID struct {
ID string `json:"NintendoSwitchDeviceId,omitempty"`
}
type UserOpenID ¶
type UserPrivate ¶
type UserPrivate struct {
Email string `json:"Email,omitempty"`
}
type UserSettings ¶
type UserTitle ¶
type UserTitle struct {
AvatarURL string `json:"AvatarUrl,omitempty"`
Created time.Time `json:"Created,omitempty"`
DisplayName string `json:"DisplayName,omitempty"`
FirstLogin time.Time `json:"FirstLogin,omitempty"`
LastLogin time.Time `json:"LastLogin,omitempty"`
Origination string `json:"Origination,omitempty"`
TitlePlayerAccount entity.Key `json:"TitlePlayerAccount,omitempty"`
Banned bool `json:"isBanned,omitempty"`
}
type UserTwitch ¶
type ValuesToDate ¶
type XBLIdentityProvider ¶
type XBLIdentityProvider struct {
// TokenSource is used for obtaining a [xsapi.Token] that relies on the party defined in
// the constant below (see RelyingParty).
TokenSource xsapi.TokenSource
}
XBLIdentityProvider implements IdentityProvider for signing in to PlayFab using the path '/Client/LoginWithXbox' with a xsapi.Token that relies on the party 'http://playfab.xboxlive.com/'.
func (XBLIdentityProvider) Login ¶
func (prov XBLIdentityProvider) Login(config LoginConfig) (*Identity, error)
Login signs in to PlayFab using a xsapi.Token obtained from the TokenSource that relies on the party 'http://playfab.xboxlive.com/'. It returns an Identity by calling the LoginConfig.Login method with an additional field named 'XboxToken' that specifies a string obtained from xsapi.Token.String and the path '/Client/LoginWithXbox'.