forked from FeroxRev/Pokemon-Go-Rocket-API
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathClient.cs
63 lines (55 loc) · 2.12 KB
/
Client.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
using System;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using Google.Protobuf;
using PokemonGo.RocketAPI.Enums;
using PokemonGo.RocketAPI.Exceptions;
using PokemonGo.RocketAPI.Extensions;
using PokemonGo.RocketAPI.Helpers;
using PokemonGo.RocketAPI.HttpClient;
using PokemonGo.RocketAPI.Login;
using POGOProtos.Inventory;
using POGOProtos.Inventory.Item;
using POGOProtos.Networking.Envelopes;
using POGOProtos.Networking.Requests;
using POGOProtos.Networking.Requests.Messages;
using POGOProtos.Networking.Responses;
namespace PokemonGo.RocketAPI
{
public class Client
{
public Rpc.Login Login;
public Rpc.Player Player;
public Rpc.Download Download;
public Rpc.Inventory Inventory;
public Rpc.Map Map;
public Rpc.Fort Fort;
public Rpc.Encounter Encounter;
public Rpc.Misc Misc;
public IApiFailureStrategy ApiFailure { get; set; }
public ISettings Settings { get; }
public string AuthToken { get; set; }
public double CurrentLatitude { get; internal set; }
public double CurrentLongitude { get; internal set; }
public double CurrentAltitude { get; internal set; }
public AuthType AuthType => Settings.AuthType;
internal readonly PokemonHttpClient PokemonHttpClient = new PokemonHttpClient();
internal string ApiUrl { get; set; }
internal AuthTicket AuthTicket { get; set; }
public Client(ISettings settings, IApiFailureStrategy apiFailureStrategy)
{
Settings = settings;
ApiFailure = apiFailureStrategy;
Login = new Rpc.Login(this);
Player = new Rpc.Player(this);
Download = new Rpc.Download(this);
Inventory = new Rpc.Inventory(this);
Map = new Rpc.Map(this);
Fort = new Rpc.Fort(this);
Encounter = new Rpc.Encounter(this);
Misc = new Rpc.Misc(this);
Player.SetCoordinates(Settings.DefaultLatitude, Settings.DefaultLongitude, Settings.DefaultAltitude);
}
}
}