Skip to content

Commit

Permalink
Merge pull request #17 from PoGo-Devs/rwm-dev
Browse files Browse the repository at this point in the history
API Client refactor
  • Loading branch information
ST-Apps authored Aug 28, 2016
2 parents fed77ac + 8416e20 commit 8eadaea
Show file tree
Hide file tree
Showing 95 changed files with 7,100 additions and 3,461 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ obj/
*.suo
*.user
*.tss
src/PoGo.Tests.ApiClient/project.fragment.lock.json
src/PoGo.Tests.GameServices/project.fragment.lock.json
57 changes: 0 additions & 57 deletions src/PoGo.ApiClient/Client.cs

This file was deleted.

9 changes: 3 additions & 6 deletions src/PoGo.ApiClient/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,12 @@
internal static class Constants
{
public const string ApiUrl = "https://pgorelease.nianticlabs.com/plfe/rpc";
public const string LoginUrl = "https://sso.pokemon.com/sso/login?service=https%3A%2F%2Fsso.pokemon.com%2Fsso%2Foauth2.0%2FcallbackAuthorize";

public const string LoginUrl =
"https://sso.pokemon.com/sso/login?service=https%3A%2F%2Fsso.pokemon.com%2Fsso%2Foauth2.0%2FcallbackAuthorize";

public const string LoginUserAgent = "Niantic App";
public const string LoginUserAgent = "niantic";
public const string LoginOauthUrl = "https://sso.pokemon.com/sso/oauth2.0/accessToken";

public const string GoogleAuthService =
"audience:server:client_id:848232511240-7so421jotr2609rmqakceuu1luuq0ptb.apps.googleusercontent.com";
public const string GoogleAuthService = "audience:server:client_id:848232511240-7so421jotr2609rmqakceuu1luuq0ptb.apps.googleusercontent.com";

public const string GoogleAuthApp = "com.nianticlabs.pokemongo";
public const string GoogleAuthClientSig = "321187995bc7cdc2b5fc91b11a96e2baa8602c62";
Expand Down
8 changes: 8 additions & 0 deletions src/PoGo.ApiClient/Enums/ApiOperation.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace PoGo.ApiClient.Enums
{
public enum ApiOperation
{
Retry,
Abort
}
}
18 changes: 18 additions & 0 deletions src/PoGo.ApiClient/Enums/StatusCode.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PoGo.ApiClient.Enums
{
public enum StatusCode : int
{
Unknown = 0,
Success = 1,
AccessDenied = 3,
ServerOverloaded = 52,
Redirect = 53,
InvalidToken = 102,
}
}
12 changes: 12 additions & 0 deletions src/PoGo.ApiClient/Exceptions/AccountLockedException.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System;


namespace PoGo.ApiClient.Exceptions
{
public class AccountLockedException : Exception
{
public AccountLockedException() : base("Your account has been locked/banned.")
{
}
}
}
11 changes: 11 additions & 0 deletions src/PoGo.ApiClient/Exceptions/ApiNonRecoverableException.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using System;

namespace PoGo.ApiClient.Exceptions
{
public class ApiNonRecoverableException : Exception
{
public ApiNonRecoverableException(string reason) : base(reason)
{
}
}
}
4 changes: 4 additions & 0 deletions src/PoGo.ApiClient/Exceptions/LoginFailedException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ namespace PoGo.ApiClient.Exceptions
{
public class LoginFailedException : Exception
{
public LoginFailedException()
{
}

public LoginFailedException(HttpResponseMessage loginResponse)
{
LoginResponse = loginResponse;
Expand Down
10 changes: 7 additions & 3 deletions src/PoGo.ApiClient/Extensions/DateTimeExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
using System;

namespace PoGo.ApiClient.Extensions

namespace System
{

/// <summary>
///
/// </summary>
/// <remarks>Extensions methods should ALWAYS be in the namespace they extend.</remarks>
public static class DateTimeExtensions
{
public static long ToUnixTime(this DateTime date)
Expand Down
114 changes: 0 additions & 114 deletions src/PoGo.ApiClient/Extensions/HttpClientExtensions.cs

This file was deleted.

26 changes: 0 additions & 26 deletions src/PoGo.ApiClient/Helpers/HttpClientHelper.cs

This file was deleted.

50 changes: 45 additions & 5 deletions src/PoGo.ApiClient/Helpers/IDeviceInfos.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,28 @@ public interface ILocationFix
uint Floor { get; }
ulong LocationType { get; }
ulong ProviderStatus { get; }
ulong Timestamp { get; }
long TimeSnapshot { get; }
float HorizontalAccuracy { get; }
float VerticalAccuracy { get; }

float Course { get; }
float Speed { get; }
}

public interface IDeviceInfo
public interface IGpsSattelitesInfo
{
int SattelitesPrn { get; }
float Azimuth { get; }
float Elevation { get; }
float Snr { get; }
bool Almanac { get; }
bool Emphasis { get; }
bool UsedInFix { get; }
}
public interface ISensorInfo
{
TimeSpan TimeSnapshot { get; }
ulong AccelerometerAxes { get;}

long TimeSnapshot { get; }
ulong AccelerometerAxes { get; }
double AccelRawX { get; }
double AccelRawY { get; }
double AccelRawZ { get; }
Expand All @@ -33,9 +45,37 @@ public interface IDeviceInfo
double GyroscopeRawX { get; }
double GyroscopeRawY { get; }
double GyroscopeRawZ { get; }
}

public interface IActivityStatus
{
bool Walking { get; }
bool Automotive { get; }
bool Cycling { get; }
bool Running { get; }
bool Stationary { get; }
bool Tilting { get; }
}

public interface IDeviceInfo
{
string DeviceID { get; }
string AndroidBoardName { get; }
string AndroidBootloader { get; }
string DeviceBrand { get; }
string DeviceModel { get; }
string DeviceModelIdentifier { get; }
string DeviceModelBoot { get; }
string HardwareManufacturer { get; }
string HardwareModel { get; }
string FirmwareBrand { get; }
string FirmwareTags { get; }
string FirmwareType { get; }
string FirmwareFingerprint { get; }
long TimeSnapshot { get; }
ILocationFix[] LocationFixes { get; }
IGpsSattelitesInfo[] GpsSattelitesInfo { get; }
ISensorInfo Sensors { get; }
IActivityStatus ActivityStatus { get; }
}
}
Loading

0 comments on commit 8eadaea

Please sign in to comment.