/// <summary> /// Creates a new <see cref="Gw2Client"/>. /// </summary> /// <param name="connection">The connection used to make requests, see <see cref="IConnection"/>.</param> /// <exception cref="ArgumentNullException"><paramref name="connection"/> is <see langword="null"/>.</exception> public Gw2Client(IConnection connection) { if (connection == null) { throw new ArgumentNullException(nameof(connection)); } this.mumble = new Gw2MumbleClient(connection.MumbleClientReaderFactory); this.webApi = new Gw2WebApiClient(connection, this); }
/// <summary> /// Creates a new <see cref="Gw2Client"/>. /// </summary> /// <param name="connection">The connection used to make requests, see <see cref="IConnection"/>.</param> /// <exception cref="ArgumentNullException"><paramref name="connection"/> is <c>null</c>.</exception> public Gw2Client(IConnection connection) : base(connection, null) { if (connection == null) { throw new ArgumentNullException(nameof(connection)); } this.Gw2Client = this; this.mumble = new Gw2MumbleClient(connection, this.Gw2Client); this.webApi = new Gw2WebApiClient(connection, this.Gw2Client); }
public ManagedConnection(string accessToken, ICacheMethod webApiCache, ICacheMethod renderCache = null, TimeSpan?renderCacheDuration = null) { string ua = $"BlishHUD/{Program.OverlayVersion}"; _internalConnection = new Connection(accessToken, GameService.Overlay.UserLocale.Value, webApiCache, renderCache, renderCacheDuration ?? TimeSpan.MaxValue, ua); _internalClient = new Gw2Client(_internalConnection).WebApi; Logger.Debug("Created managed Gw2Sharp connection {useragent}.", ua); SetupListeners(); }