/// <summary>
        /// Create a new instance of the <see cref="LoLManagerConfig"/> Class.
        /// </summary>
        /// <param name="key">The Api key for the application received by Riot</param>
        /// <param name="region">The region of the Api Key</param>
        public LoLManagerConfig(string key, ApiRegions region)
        {
            if (string.IsNullOrEmpty(key))
            {
                throw new ArgumentNullException("key");
            }

            this.Key    = key;
            this.Region = region;

            //TODO: Add a configuration to keep X amount of service calls in memory
        }
Beispiel #2
0
        /// <summary> Construct a new instance of the <see cref="ServiceBase"/> Class. </summary>
        /// <param name="region">The region to use in the web service calls.</param> <param
        /// name="ver"><The version of the particular service.</param> <param name="endPoint">The
        /// end point for the given service.</param>
        public ServiceBase(ApiRegions region, ApiVersions ver, ApiEndPoints endPoint, string key)
        {
            Region   = region;
            Version  = ver;
            EndPoint = endPoint;
            ApiKey   = key;

            BaseUri = new Uri(string.Format(baseURL, Regions.GetRegions[region]));

            CreateMapping();

            RateLimitManager.Instance.Add(ApiKey);
        }
Beispiel #3
0
        /// <summary>
        /// Initialize the singleton instance of the <see cref="LoLManager"/> Class
        /// </summary>
        /// <param name="key">The Api key for the application received by Riot</param>
        /// <param name="region">The region of the Api Key</param>
        public void Initialize(string key, ApiRegions region)
        {
            if (_isInitialized)
            {
                return;
            }

            if (string.IsNullOrEmpty(key))
            {
                throw new ArgumentNullException("key");
            }

            _configuration = new LoLManagerConfig(key, region);

            _isInitialized = true;
        }