Esempio n. 1
0
        /// <summary>
        /// Get ducats price which from Warframe Market.
        /// </summary>
        /// <returns></returns>
        public async Task <DucatPricePayload> GetWarframeMarketDucatsPriceAsync()
        {
            string route   = Statics.WM_DUCAT_TOOL + $"?platform={Platform}";
            var    profile = await NetworkTools.GetEntityAsync <DucatPricePayload>(route, Token, ExceptionAction);

            return(profile);
        }
Esempio n. 2
0
        /// <summary>
        /// Get user profile which from Warframe Market and include the orders.
        /// </summary>
        /// <param name="name">User game name</param>
        /// <returns></returns>
        public async Task <ProfileWithOrders> GetWarframeMarketUserProfileAsync(string name)
        {
            string route   = Statics.WM_USER_URL + $"{name}?platform={Platform}";
            var    profile = await NetworkTools.GetEntityAsync <ProfileWithOrders>(route, Token, ExceptionAction);

            return(profile);
        }
Esempio n. 3
0
        /// <summary>
        /// Get order history statistics data from Warframe Market.
        /// </summary>
        /// <param name="code">Item code</param>
        /// <param name="type">Chart data are from live or closed</param>
        /// <returns></returns>
        public async Task <Statistics> GetWarframeMarketStatisticsAsync(string code, StatisticsType type)
        {
            string route = Statics.WM_STATISTICS_URL + $"{code}?platform={Platform}&type={type.ToString().ToLower()}";
            var    data  = await NetworkTools.GetEntityAsync <Statistics>(route, Token, ExceptionAction);

            return(data);
        }
Esempio n. 4
0
        /// <summary>
        /// Request bounty data online
        /// </summary>
        /// <param name="region">Cetus or Fortuna</param>
        /// <param name="language">Reward display with Chinese or English</param>
        /// <returns></returns>
        public async Task <List <Bounty> > GetBountyAsync(BountyRegionType region, LanguageType language)
        {
            string re = "";

            switch (region)
            {
            case BountyRegionType.Cetus:
                re = "cetus";
                break;

            case BountyRegionType.Fortuna:
                re = "solaris";
                break;

            case BountyRegionType.Necralisk:
                re = "cambion";
                break;

            default:
                break;
            }
            string route = InitRoute(Statics.BOUNTY_URL) + $"&region={re}&language={language.ToString().ToLower()}";
            var    data  = await NetworkTools.GetEntityAsync <List <Bounty> >(route, Token, ExceptionAction);

            return(data);
        }
Esempio n. 5
0
        private async Task <T> GetLibData <T>(string id, string type, LanguageType lan) where T : class
        {
            string route = Statics.LIB_QUERY_URL + $"?language={lan.ToString().ToLower()}&item={WebUtility.UrlEncode(id)}&category={type}";
            var    data  = await NetworkTools.GetEntityAsync <T>(route, Token, ExceptionAction);

            return(data);
        }
Esempio n. 6
0
        /// <summary>
        /// Get Related items from Warframe Market. the query code can get from Sale Dictionary.
        /// </summary>
        /// <param name="code">Item code</param>
        /// <returns></returns>
        public async Task <List <Item> > GetWarframeMarketItemsSetAsync(string code)
        {
            if (string.IsNullOrEmpty(code))
            {
                throw new ArgumentNullException("The item code must be valid.");
            }
            string route = Statics.WM_ORDER_QUERY_URL + $"{code}?platform={Platform}";
            var    items = await NetworkTools.GetEntityAsync <List <Item> >(route, Token, ExceptionAction);

            return(items);
        }
Esempio n. 7
0
        /// <summary>
        /// Get the latest orders
        /// </summary>
        /// <param name="option">Request parameter</param>
        /// <returns></returns>
        public async Task <List <Order> > GetLastestRivenOrdersAsync(LastestRivenOrdersOption option)
        {
            if (option.OrderType.ToLower() != "sell" && option.OrderType.ToLower() != "buy")
            {
                throw new ArgumentException("order type not valid");
            }
            string route  = Statics.RIVEMMARKET_LASTEST_ORDERS_URL + $"?orderType={option.OrderType}&pageSize={option.PageSize}&page={option.Page}";
            var    orders = await NetworkTools.GetEntityAsync <List <Order> >(route, Token, ExceptionAction);

            return(orders);
        }
Esempio n. 8
0
        /// <summary>
        /// Get user information via UserId, This method can get the user's detailed information
        /// </summary>
        /// <param name="userId">User's unique identification</param>
        /// <returns></returns>
        public async Task <Account> GetUserFromIdAsync(string userId)
        {
            if (string.IsNullOrEmpty(userId))
            {
                throw new ArgumentNullException("userId", "Must provide a valid UserId");
            }
            string route   = Statics.USER_DETAIL_URL + $"?userId={userId}";
            var    account = await NetworkTools.GetEntityAsync <Account>(route, Token, ExceptionAction);

            return(account);
        }
Esempio n. 9
0
        /// <summary>
        /// Fuzzy query for users by keywords.
        /// Keywords will match both diaplay name and game name, up to 10 people
        /// </summary>
        /// <param name="queryText">Query keywords</param>
        /// <returns></returns>
        public async Task <List <SlimAccount> > QueryUserByNameAsync(string queryText)
        {
            if (string.IsNullOrEmpty(queryText))
            {
                throw new ArgumentNullException("queryText", "Must provide a valid query text");
            }
            string route    = Statics.USER_QUERY_URL + $"?user={WebUtility.UrlEncode(queryText)}";
            var    accounts = await NetworkTools.GetEntityAsync <List <SlimAccount> >(route, Token, ExceptionAction);

            return(accounts);
        }
Esempio n. 10
0
        /// <summary>
        /// Get user listings and personal data in Riven Market by game name
        /// </summary>
        /// <param name="gameName">Game name</param>
        /// <returns></returns>
        public async Task <Profile> GetRivenProfileByGameNameAsync(string gameName)
        {
            if (string.IsNullOrEmpty(gameName))
            {
                throw new ArgumentNullException("gameName", "Must provide a valid game name");
            }
            string route   = Statics.RIVENMARKET_PROFILE_URL + $"?user={WebUtility.UrlEncode(gameName)}";
            var    profile = await NetworkTools.GetEntityAsync <Profile>(route, Token, ExceptionAction);

            return(profile);
        }
Esempio n. 11
0
        /// <summary>
        /// Get user listings and personal data in Riven Market by user id
        /// </summary>
        /// <param name="userId">User ID</param>
        /// <returns></returns>
        public async Task <Profile> GetRivenProfileByUserIdAsync(string userId)
        {
            if (string.IsNullOrEmpty(userId))
            {
                throw new ArgumentNullException("userId", "Must provide a valid UserId");
            }
            string route   = Statics.RIVENMARKET_PROFILE_URL + $"?userId={userId}";
            var    profile = await NetworkTools.GetEntityAsync <Profile>(route, Token, ExceptionAction);

            return(profile);
        }
Esempio n. 12
0
        /// <summary>
        /// Get the recommended price of the weapon or category, the price is divided into rolled and unrolled, and can be limited
        /// </summary>
        /// <param name="option"></param>
        /// <returns></returns>
        public async Task <List <Weekly> > GetRivenAdvicePricesAsync(RivenAdvicePriceOption option)
        {
            string route = Statics.RIVEMMARKET_ADVICE_PRICE_URL + $"?weapon={option.Weapon}&category={option.Category}";

            if (option.IsRerolled != null)
            {
                route += $"&rerolled={option.IsRerolled.ToString().ToLower()}";
            }
            var advices = await NetworkTools.GetEntityAsync <List <Weekly> >(route, Token, ExceptionAction);

            return(advices);
        }
Esempio n. 13
0
        /// <summary>
        /// Query Riven Market Order
        /// </summary>
        /// <param name="option">Request parameter</param>
        /// <returns></returns>
        public async Task <OrderPackage> QueryRivenOrdersAsync(SearchRivenOrderOption option)
        {
            if (string.IsNullOrEmpty(option.Weapon) && string.IsNullOrEmpty(option.Category))
            {
                throw new ArgumentException("must have valid weapon or category");
            }
            string route = Statics.RIVEMMARKET_ORDER_QUERY_URL +
                           $"?orderType={option.OrderType}&pageSize={option.PageSize}&page={option.Page}" +
                           $"&category={option.Category}&weapon={option.Weapon}&isVeiled={option.IsVeiled}";
            var orders = await NetworkTools.GetEntityAsync <OrderPackage>(route, Token, ExceptionAction);

            return(orders);
        }
Esempio n. 14
0
        /// <summary>
        /// Used to generate tokens or verify the validity of tokens
        /// </summary>
        /// <returns>Validation results</returns>
        public async Task <InitResultType> InitAsync()
        {
            InitResultType result = InitResultType.Success;

            if (string.IsNullOrEmpty(Token))
            {
                var token = await NetworkTools.GetClientCredentialsToken(_clientId, _clientSecret, _permissions, (msg) =>
                {
                    var args = new ExceptionEventArgs(msg);
                    OnException?.Invoke(this, args);
                });

                if (token.IsError)
                {
                    if (token.ErrorType == IdentityModel.Client.ResponseErrorType.Http)
                    {
                        result = InitResultType.HttpError;
                    }
                    else
                    {
                        result = InitResultType.InvalidParameters;
                    }
                }
                else
                {
                    Token  = token.AccessToken;
                    result = InitResultType.Success;
                }
            }
            else
            {
                string testRoute = "basic/earthStatus";
                await NetworkTools.GetEntityAsync <EarthStatus>(testRoute, Token, (msg) =>
                {
                    if (msg.Code == 601)
                    {
                        result = InitResultType.HttpError;
                    }
                    else
                    {
                        result = InitResultType.TokenExpiry;
                    }
                });
            }
            return(result);
        }
Esempio n. 15
0
        /// <summary>
        /// Get orders from Warframe Market. the query code can get from Sale Dictionary.
        /// </summary>
        /// <param name="option">Query paramters</param>
        /// <returns></returns>
        public async Task <OrderQueryResult> GetWarframeMarketOrdersAsync(WarframeMarketOrderQueryOption option)
        {
            if (string.IsNullOrEmpty(option.Code))
            {
                throw new ArgumentNullException("The item code must be valid.");
            }
            string route = Statics.WM_ORDER_QUERY_URL + $"{option.Code}?platform={Platform}&pageSize={option.PageSize}" +
                           $"&page={option.Page}&type={option.Type.ToString().ToLower()}&status={string.Join("&status=", option.OrderStatus.Select(p => p.ToString().ToLower()))}" +
                           $"&minPrice={option.MinPrice}&maxPrice={option.MaxPrice}";

            if (option.ModRank > 0)
            {
                route += $"&rank={option.ModRank}";
            }
            var orders = await NetworkTools.GetEntityAsync <OrderQueryResult>(route, Token, ExceptionAction);

            return(orders);
        }
Esempio n. 16
0
        /// <summary>
        /// Get lastest orders from Warframe Market. If you need special order type, please set the orderType paramter
        /// </summary>
        /// <param name="orderType">Order type</param>
        /// <returns></returns>
        public async Task <List <Order> > GetWarframeMarketLastestOrdersAsync(OrderType?orderType = null)
        {
            string route  = Statics.WM_LASTEST_ORDERS_URL + $"?platform={Platform}";
            var    orders = new List <Order>();

            if (orderType != null)
            {
                route += $"&type={orderType.ToString().ToLower()}";
                orders = await NetworkTools.GetEntityAsync <List <Order> >(route, Token, ExceptionAction);
            }
            else
            {
                var data = await NetworkTools.GetEntityAsync <RecentOrders>(route, Token, ExceptionAction);

                orders = orders.Union(data.Sell).Union(data.Buy).ToList();
            }
            return(orders);
        }
Esempio n. 17
0
        /// <summary>
        /// Request Invasion data online
        /// </summary>
        /// <returns></returns>
        public async Task <List <Invasion> > GetInvasionsAsync()
        {
            var data = await NetworkTools.GetEntityAsync <List <Invasion> >(InitRoute(Statics.INVASIONS_URL), Token, ExceptionAction);

            return(data);
        }
Esempio n. 18
0
        /// <summary>
        /// Request Nightwave data online
        /// </summary>
        /// <returns></returns>
        public async Task <Nightwave> GetNightwavesAsync()
        {
            var data = await NetworkTools.GetEntityAsync <Nightwave>(InitRoute(Statics.NIGHTWAVE_URL), Token, ExceptionAction);

            return(data);
        }
Esempio n. 19
0
        /// <summary>
        /// Request Cetus day and night data online
        /// </summary>
        /// <returns></returns>
        public async Task <CetusStatus> GetCetusStatusAsync()
        {
            var cetus = await NetworkTools.GetEntityAsync <CetusStatus>(InitRoute(Statics.CETUS_URL), Token, ExceptionAction);

            return(cetus);
        }
Esempio n. 20
0
        /// <summary>
        /// Request Fissure data online
        /// </summary>
        /// <returns></returns>
        public async Task <List <Fissure> > GetFissuresAsync()
        {
            var data = await NetworkTools.GetEntityAsync <List <Fissure> >(InitRoute(Statics.FISSURES_URL), Token, ExceptionAction);

            return(data);
        }
Esempio n. 21
0
        /// <summary>
        /// Request Cambion Drift fass and vome data online
        /// </summary>
        /// <returns></returns>
        public async Task <CambionStatus> GetCambionStatusAsync()
        {
            var cambion = await NetworkTools.GetEntityAsync <CambionStatus>(InitRoute(Statics.CAMBION_URL), Token, ExceptionAction);

            return(cambion);
        }
Esempio n. 22
0
        /// <summary>
        /// Request Event data online
        /// </summary>
        /// <returns></returns>
        public async Task <List <Event> > GetEventsAsync()
        {
            var data = await NetworkTools.GetEntityAsync <List <Event> >(InitRoute(Statics.EVENTS_URL), Token, ExceptionAction);

            return(data);
        }
Esempio n. 23
0
        /// <summary>
        /// Request ConclaveChallenge data online
        /// </summary>
        /// <returns></returns>
        public async Task <List <ConclaveChallenge> > GetConclaveChallengesAsync()
        {
            var data = await NetworkTools.GetEntityAsync <List <ConclaveChallenge> >(InitRoute(Statics.CONCLAVECHALLENGES_URL), Token, ExceptionAction);

            return(data);
        }
Esempio n. 24
0
        /// <summary>
        /// Request Stalker data online
        /// </summary>
        /// <returns></returns>
        public async Task <List <Stalker> > GetStalkersAsync()
        {
            var data = await NetworkTools.GetEntityAsync <List <Stalker> >(InitRoute(Statics.STALKER_URL), Token, ExceptionAction);

            return(data);
        }
Esempio n. 25
0
        /// <summary>
        /// Request Kuva data online
        /// </summary>
        /// <returns></returns>
        public async Task <List <Kuva> > GetKuvasAsync()
        {
            var data = await NetworkTools.GetEntityAsync <List <Kuva> >(InitRoute(Statics.KUVA_URL), Token, ExceptionAction);

            return(data);
        }
Esempio n. 26
0
        /// <summary>
        /// Request Earth day and night data online
        /// </summary>
        /// <returns></returns>
        public async Task <EarthStatus> GetEarthStatusAsync()
        {
            var data = await NetworkTools.GetEntityAsync <EarthStatus>(InitRoute(Statics.EARTH_URL), Token, ExceptionAction);

            return(data);
        }
Esempio n. 27
0
        /// <summary>
        /// Request darvo daily deals data online
        /// </summary>
        /// <returns></returns>
        public async Task <Darvo> GetDarvoAsync()
        {
            var data = await NetworkTools.GetEntityAsync <Darvo>(InitRoute(Statics.DARVO_URL), Token, ExceptionAction);

            return(data);
        }
Esempio n. 28
0
        /// <summary>
        /// Request Sortie data online
        /// </summary>
        /// <returns></returns>
        public async Task <Sortie> GetSortieAsync()
        {
            var data = await NetworkTools.GetEntityAsync <Sortie>(InitRoute(Statics.SORTIE_URL), Token, ExceptionAction);

            return(data);
        }
Esempio n. 29
0
        /// <summary>
        /// Get version information of WFA thesaurus
        /// </summary>
        /// <returns></returns>
        public async Task <List <Meta.Meta> > GetMetaVersion()
        {
            var metas = await NetworkTools.GetEntityAsync <List <Meta.Meta> >(Statics.APP_META_VERSION_URL, Token, ExceptionAction);

            return(metas);
        }
Esempio n. 30
0
        /// <summary>
        /// Request Sentient Anomaly data online
        /// </summary>
        /// <returns></returns>
        public async Task <SentientAnomaly> GetSentientAnomalyAsync()
        {
            var data = await NetworkTools.GetEntityAsync <SentientAnomaly>(InitRoute(Statics.SENTIENT_URL), Token, ExceptionAction);

            return(data);
        }