Ejemplo n.º 1
0
        public bool ContainsApiName(LolApiName name, LolApiMethodName method)
        {
            bool q1 = ApiMethods.Contains(method);
            bool q2 = Names.Contains(name);

            return(q1 && q2);
        }
Ejemplo n.º 2
0
 public LolApiUrl PostMethod(LolApiMethodName middleType, Type returnType, Type bodyValueType, bool IsBodyRequired,
                             params LolApiPath[] subApis)
 {
     this.ApiMethods.Add(new LolApiMethod(middleType, subApis, returnType, ApiMethodType.Post, bodyValueType, IsBodyRequired));
     this.LastApiMethodIndex = this.ApiMethods.Count - 1;
     return(this);
 }
Ejemplo n.º 3
0
 public LolApiUrl PutMethod(LolApiMethodName methodName, Type bodyValueType, bool IsBodyRequired,
                            params LolApiPath[] subApis)
 {
     this.ApiMethods.Add(new LolApiMethod(methodName, subApis, typeof(int), ApiMethodType.Put, bodyValueType, IsBodyRequired));
     this.LastApiMethodIndex = this.ApiMethods.Count - 1;
     return(this);
 }
Ejemplo n.º 4
0
 public LolApiMethod(LolApiMethodName md, LolApiPath[] array, Type returnValueType, ApiMethodType requestType)
 {
     this.ApiMethodName     = md;
     this.RiotGamesApiPaths = array ?? new LolApiPath[0];
     ReturnValueType        = returnValueType;
     TypesOfQueryParameter  = new Dictionary <string, Type>();
     RequestType            = requestType;
 }
Ejemplo n.º 5
0
        /// <exception cref="KeyNotFoundException">
        /// The property is retrieved and <paramref name="key" /> does not exist in the collection.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="key" /> is null.
        /// </exception>
        public RLolApiMethodName Find(string region, LolUrlType type, LolApiName name, LolApiMethodName method)
        {
            var rut  = Find(region);
            var rla  = rut?.Find(type);
            var rlan = rla?.Find(name, method);

            return(rlan);
        }
Ejemplo n.º 6
0
 public RLolApiMethodName FindRate(string platform, LolUrlType type, LolApiName apiName, LolApiMethodName method)
 {
     return(Rates.Find(platform, type, apiName, method));
 }
Ejemplo n.º 7
0
        /// <summary>
        /// get data from Retry-After
        /// </summary>
        /// <param name="prop">
        /// </param>
        /// <param name="name">
        /// </param>
        /// <param name="limitType">
        /// </param>
        /// <param name="retryAfterSeconds">
        /// value of Retry-After
        /// </param>
        /// <param name="region">
        /// </param>
        /// <param name="type">
        /// </param>
        /// <exception cref="RiotGamesApiException">
        /// Condition.
        /// </exception>
        public void SetRetryTime(string region, LolUrlType type, LolApiName name, RateLimitType limitType, LolApiMethodName method, int retryAfterSeconds)
        {
            var regionLimit = Rates.Find(region, type, name, method);

            if (regionLimit == null)
            {
                throw new RiotGamesApiException($"Undefined {limitType} limit type for region:{region},type:{type},name:{name}");
            }
            regionLimit.RetryAfter        = DateTime.Now.AddSeconds(retryAfterSeconds);
            regionLimit.UsedRateLimitType = limitType;
        }
Ejemplo n.º 8
0
 public RLolApiMethodName Find(LolApiName name, LolApiMethodName method)
 {
     return(Names.FirstOrDefault <RLolApiMethodName>(p => p.ContainsApiName(name, method)));
 }
Ejemplo n.º 9
0
 public LolApiMethod(LolApiMethodName md, LolApiPath[] array, Type returnValueType, ApiMethodType requestType, Type _bodyValueType, bool _isBodyRequired)
     : this(md, array, returnValueType, requestType)
 {
     BodyValueType  = _bodyValueType;
     IsBodyRequired = _isBodyRequired;
 }
Ejemplo n.º 10
0
 public LolApiUrl GetMethod(LolApiMethodName middleType, Type returnType, params LolApiPath[] subApis)
 {
     this.ApiMethods.Add(new LolApiMethod(middleType, subApis, returnType, ApiMethodType.Get));
     this.LastApiMethodIndex = this.ApiMethods.Count - 1;
     return(this);
 }