예제 #1
0
        public void OneTimeSetUp()
        {
            var retryPolicy           = new RetryPolicy <HiRezApiRetryStrategy>(new ExponentialBackoffRetryStrategy());
            var timestampProvider     = new DateTimeUtcTimeStampProvider();
            var fileSessionRepository = new JsonFileSessionRepository(Environment.CurrentDirectory, timestampProvider); // Session storage is optional
            var credentials           = new HiRezApiCredentials("YourDeveloperId", "YourAuthKey", timestampProvider,
                                                                new DefaultSessionProvider(timestampProvider, fileSessionRepository));

            this._client = new PaladinsApiClient(this._platform, credentials);
            this._client.SetRetryPolicy(retryPolicy);
        }
예제 #2
0
        private PaladinsApiClient CreatePaladinsApiClient(IServiceProvider p)
        {
            var clientSettings       = p.GetRequiredService <IOptions <HiRezSettings> >().Value;
            var externalServiceTimer = p.GetRequiredService <IExternalServiceTimer>();
            var logger                = p.GetRequiredService <ILogger <PaladinsApiClient> >();
            var retryPolicy           = new RetryPolicy <HiRezApiRetryStrategy>(new ExponentialBackoffRetryStrategy());
            var timestampProvider     = new DateTimeUtcTimeStampProvider();
            var fileSessionRepository = new JsonFileSessionRepository(Environment.CurrentDirectory, timestampProvider);
            var credentials           = new HiRezApiCredentials(clientSettings.DevKey, clientSettings.AuthKey, timestampProvider,
                                                                new DefaultSessionProvider(timestampProvider, fileSessionRepository));

            var client = new PaladinsApiClient(Platform.Pc, credentials, new LoggingHandler <PaladinsApiClient>(logger, externalServiceTimer));

            client.SetRetryPolicy(retryPolicy);
            return(client);
        }
예제 #3
0
        public static void Execute()
        {
            Console.WriteLine("Executing Paladins...");

            var retryPolicy           = new RetryPolicy <HiRezApiRetryStrategy>(new ExponentialBackoffRetryStrategy());
            var timestampProvider     = new DateTimeUtcTimeStampProvider();
            var fileSessionRepository = new JsonFileSessionRepository(Environment.CurrentDirectory, timestampProvider); // Session storage is optional
            var credentials           = new HiRezApiCredentials("YourDeveloperId", "YourAuthKey", timestampProvider,
                                                                new DefaultSessionProvider(timestampProvider, fileSessionRepository));

            var client = new PaladinsApiClient(Platform.Pc, credentials);

            client.SetRetryPolicy(retryPolicy);

            ExecuteDataStats(client).GetAwaiter().GetResult();
            ExecuteQueuedMatches(client).GetAwaiter().GetResult();
            ExecutePlayerStats(client).GetAwaiter().GetResult();

            Console.WriteLine("Finished");
        }