Beispiel #1
0
        public static Quota ToQuota(UnlimitedQuota q)
        {
            var quota = new Quota
            {
                quotaUsed       = q.quotaUsed,
                quotaLimit      = 0,
                quotaRemaining  = 0,
                hoursUntilReset = q.hoursUntilReset
            };

            return(quota);
        }
        public Quota GetQuota()
        {
            var result = this.Get("quota?cache=false");

            try
            {
                return(JsonConvert.DeserializeObject <Quota>(result));
            }
            catch (Exception e)
            {
                try
                {
                    var unlimitedQuota = JsonConvert.DeserializeObject <UnlimitedQuota>(result);
                    return(UnlimitedQuota.ToQuota(unlimitedQuota));
                }
                catch (Exception ex)
                {
                    UnableToUnmarshal(result);
                }
            }

            return(null);
        }