Skip to content

Documentation

PokemonGoSucks edited this page Sep 8, 2016 · 6 revisions

Welcome to the pgoapi-swift docs!

This wiki documents all the methods available in the api.

Public classes/protocols/structs/enums

Name Type Purpose
PGoAuth Protocol Defines protocol for login methods
PGoEncrypt Class Signature encryption
PGoSession Struct Contains all session related variables/constants
PGoLocation Struct Contains all location variables, can be modified via setLocation
PGoApiIntent Enum All possible api intents, see implemented API requests for list
PGoApiException Enum Contains all session exceptions (e.g. banned accounts, invalid sessions)
PGoApiResponse Struct Contains responses as generated messages and PGoResponseObject (if useResponseObjects is set to true in setSettings)
PGoResponseObject Struct Object that contains all parsed messages, used in PGoApiResponse
PGoApiRequest Class Class that stores session, location and api requests
PGoApiDelegate Protocol All delegates must have didReceiveApiError, didReceiveApiResponse, didReceiveApiException
PGoLocationUtils Class Contains location tools to assist in building scrappers/bots

PGoApiRequest Settings

Method Variables Notes
setLocation latitude: Double, longitude: Double, altitude: Double? = 6.0, horizontalAccuracy: Double? = 3.9, floor: UInt32?, speed: Double?, course: Double? Latitude/longitude are the bare minimum
setSettings refreshAuthTokens: Bool, checkChallenge: Bool, useResponseObjects: Bool, showRequests: Bool refreshAuthTokens (default: true): Refreshes auth tokens when they expire (after 30 minutes); checkChallenge (default: true): The real client sends a checkChallenge message in every request; useResponseObjects (default: false): Enable if you want an object returned to store all generated messages as their appropriate proto response object; showRequests (default: true): Shows the parsing and building of requests.
setPlatformRequestSettings useActivityStatus: Bool, useDeviceInfo: Bool, useSensorInfo: Bool, useLocationFix: Bool, locationFixCount: Int? Customize the unknown6 message to include/exclude certain info. Default is true for all bools. Location fix count specifies how many location fixes should be included in the signature.
setDevice deviceId: String?, androidBoardName: String?, androidBootloader: String?, deviceModel: String?, deviceBrand: String?, deviceModelIdentifier: String?, deviceModelBoot: String?, hardwareManufacturer: String?, hardwareModel: String?, firmwareBrand: String?, firmwareTags: String?, firmwareType: String?, firmwareFingerprint: String?, devicePlatform: Pogoprotos.Enums.Platform? Default is iPhone 6s Plus

Implemented API requests

API methods from protos

Method names are the same as their PGoApiIntent name.

Optional variables are not required to make a valid request.

The response proto corresponds to parser in Pogoprotos.Networking.Responses.

Method Variables Response proto
updatePlayer .PlayerUpdateResponse
getPlayer country: String?, language: String? .GetPlayerResponse
getInventory lastTimestampMs: Int64?, itemBeenSeen: Int32? .GetInventoryResponse
downloadSettings .DownloadSettingsResponse
downloadItemTemplates .DownloadItemTemplatesResponse
downloadRemoteConfigVersion .DownloadRemoteConfigVersionResponse
fortSearch fortId: String, fortLatitude: Double, fortLongitude: Double .FortSearchResponse
encounterPokemon encounterId: UInt64, spawnPointId: String .EncounterResponse
catchPokemon encounterId: UInt64, spawnPointId: String, pokeball: Pogoprotos.Inventory.Item.ItemId, hitPokemon: Bool?, normalizedReticleSize: Double?, normalizedHitPosition: Double?, spinModifier: Double? .CatchPokemonResponse
fortDetails fortId: String, fortLatitude: Double, fortLongitude: Double .FortDetailsResponse
getMapObjects cellIds: Array<UInt64>?, sinceTimestampMs: Array<Int64>? .GetMapObjectsResponse
fortDeployPokemon fortId: String, pokemonId:UInt64 .FortDeployPokemonResponse
fortRecallPokemon fortId: String, pokemonId:UInt64 .FortRecallPokemonResponse
releasePokemon pokemonId:UInt64 .ReleasePokemonResponse
useItemPotion itemId: Pogoprotos.Inventory.Item.ItemId, pokemonId:UInt64 .UseItemPotionResponse
useItemCapture itemId: Pogoprotos.Inventory.Item.ItemId, encounterId:UInt64, spawnPointId: String .UseItemCaptureResponse
useItemRevive itemId: Pogoprotos.Inventory.Item.ItemId, pokemonId: UInt64 .UseItemReviveResponse
getPlayerProfile playerName: String .GetPlayerProfileResponse
evolvePokemon pokemonId:UInt64 .EvolvePokemonResponse
getHatchedEggs .GetHatchedEggsResponse
encounterTutorialComplete pokemonId: Pogoprotos.Enums.PokemonId .EncounterTutorialCompleteResponse
levelUpRewards level:Int32 .LevelUpRewardsResponse
checkAwardedBadges .CheckAwardedBadgesResponse
useItemGym itemId: Pogoprotos.Inventory.Item.ItemId, gymId: String .UseItemGymResponse
getGymDetails gymId: String, gymLatitude: Double, gymLongitude: Double .GetGymDetailsResponse
startGymBattle gymId: String, attackingPokemonIds: Array<UInt64>, defendingPokemonId: UInt64 .StartGymBattleResponse
attackGym gymId: String, battleId: String, attackActions: Array<Pogoprotos.Data.Battle.BattleAction>, lastRetrievedAction: Pogoprotos.Data.Battle.BattleAction .AttackGymResponse
recycleInventoryItem itemId: Pogoprotos.Inventory.Item.ItemId, itemCount: Int32 .RecycleInventoryItemResponse
collectDailyBonus .CollectDailyBonusResponse
useItemXPBoost itemId: Pogoprotos.Inventory.Item.ItemId .UseItemXpBoostResponse
useItemEggIncubator itemId: String, pokemonId: UInt64 .UseItemEggIncubatorResponse
useIncense itemId: Pogoprotos.Inventory.Item.ItemId .UseIncenseResponse
getIncensePokemon .GetIncensePokemonResponse
incenseEncounter encounterId: UInt64, encounterLocation: String .IncenseEncounterResponse
addFortModifier itemId: Pogoprotos.Inventory.Item.ItemId, fortId: String .AddFortModifierResponse
diskEncounter encounterId: UInt64, fortId: String .DiskEncounterResponse
collectDailyDefenderBonus encounterId: UInt64, fortId: String .CollectDailyDefenderBonusResponse
upgradePokemon pokemonId: UInt64 .UpgradePokemonResponse
setFavoritePokemon pokemonId: Int64, isFavorite: Bool .SetFavoritePokemonResponse
nicknamePokemon pokemonId: UInt64, nickname: String .NicknamePokemonResponse
equipBadge badgeType: Pogoprotos.Enums.BadgeType .EquipBadgeResponse
setContactSettings sendMarketingEmails: Bool, sendPushNotifications: Bool .SetContactSettingsResponse
getAssetDigest deviceModel: String?, deviceManufacturer: String?, locale: String? .GetAssetDigestResponse
getDownloadURLs assetId: Array<String> .GetDownloadUrlsResponse
getSuggestedCodenames .GetSuggestedCodenamesResponse
checkCodenameAvailable codename: String .ClaimCodenameResponse
setAvatar skin: Int32, hair: Int32, shirt: Int32, pants: Int32, hat: Int32, shoes: Int32, gender: Pogoprotos.Enums.Gender, eyes: Int32, backpack: Int32 .SetAvatarResponse
setPlayerTeam teamColor: Pogoprotos.Enums.TeamColor .SetPlayerTeamResponse
markTutorialComplete tutorialState: Array<Pogoprotos.Enums.TutorialState>, sendMarketingEmails: Bool, sendPushNotifications: Bool .MarkTutorialCompleteResponse
echo .EchoResponse
sfidaActionLog .SfidaActionLogResponse
getBuddyWalked .GetBuddyWalkedResponse
setBuddyPokemon pokemonId: UInt64 .SetBuddyPokemonMessage
checkChallenge debug: Bool? .CheckChallengeResponse
verifyChallenge token: String .VerifyChallengeResponse

Additional methods

Method Requests PGoApiIntent
Login
simulateAppStart getPlayer(), getHatchedEggs(), getInventory(), checkAwardedBadges(), downloadSettings(), downloadRemoteConfigVersion() SimulateAppStart
heartBeat getHatchedEggs(), getInventory(), checkAwardedBadges(), downloadSettings() HeartBeat

PGoLocationUtils methods

Method Variables Returns Note
getAltitudeAndHorizontalAccuracy latitude: Double, longitude: Double altitude: Double?, horizontalAccuracy: Double? Using Google’s elevation API to estimate altitude
reverseGeocode latitude: Double, longitude: Double PGoLocationUtils.PGoCoordinate?.address Returns the address of the location
geocode location: String PGoLocationUtils.PGoCoordinate?.latitude, PGoLocationUtils.PGoCoordinate?.longitude Returns the location of address
getDistanceBetweenPoints startLatitude:Double, startLongitude:Double, endLatitude:Double, endLongitude: Double, unit: PGoLocationUtils.unit? distance: Double Returns the distance between points
moveDistanceToPoint startLatitude:Double, startLongitude:Double, endLatitude:Double, endLongitude: Double, distance: Double, unitOfDistance: PGoLocationUtils.unit? PGoCoordinate Returns a new coordinate that is a distance from the start position towards the end position
moveDistanceWithBearing startLatitude:Double, startLongitude:Double, bearing: Double, distance: Double, bearingUnits: PGoLocationUtils.bearingUnits?, unitOfDistance: PGoLocationUtils.unit? PGoCoordinate Returns a coordinate that is a distance from a point using bearing
getDirectionsFromToLocations startLatitude:Double, startLongitude:Double, endLatitude:Double, endLongitude: Double, transportType: MKDirectionsTransportType? PGoLocationUtils.PGoDirections? Provides an array of coordinates that are real directions from one point to another