コード例 #1
0
        public async Task <List <Deal> > GetDeals(List <string> storeID = null, int pageNumber = 0, int pageSize = 60, string sortBy = "Deal Rating", bool desc = false, int lowerPrice = 0, int upperPrice = 50, int metacritic = 0, string title = "", bool exact = false, bool tripleA = false, bool steamworks = false, bool onSale = false)
        {
            if (pageSize > 60)
            {
                throw new ArgumentOutOfRangeException("pageSize", "Page size cannot be greater than 60.");
            }

            var queryParams = new Dictionary <string, string> ();

            if (storeID != null && storeID.Any())
            {
                queryParams.Add("storeID", string.Join(",", storeID));
            }
            if (!string.IsNullOrEmpty(title))
            {
                queryParams.Add("title", title);
            }
            queryParams.Add("lowerPrice", lowerPrice.ToString());
            queryParams.Add("upperPrice", upperPrice.ToString());
            queryParams.Add("metacritic", metacritic.ToString());
            queryParams.Add("AAA", tripleA.ToString());
            queryParams.Add("steamworks", steamworks.ToString());
            queryParams.Add("onSale", onSale.ToString());
            var url = DealsApi.SetQueryParams(queryParams);

            Debug.WriteLine(url.ToString());
            var json = await DealsApi.SetQueryParams(queryParams).GetStringAsync();

            return(JsonConvert.DeserializeObject <List <Deal> > (json));
        }
コード例 #2
0
        public async Task <DealInformation> GetDeal(string id)
        {
            Debug.WriteLine("GetDeal: " + id);
            id = System.Net.WebUtility.UrlDecode(id);              // for some reason the url comes in encoded alread, unfortunatly FLURL also encodes it before it is sent.
            var result = await DealsApi.SetQueryParam("id", id).GetStringAsync();

            Debug.WriteLine("GetDeal: " + result);

            return(JsonConvert.DeserializeObject <DealInformation> (result));
        }
コード例 #3
0
ファイル: HubSpot.cs プロジェクト: microknights/hubspot-api
        /// <summary>
        /// creates a new <see cref="HubSpot"/>
        /// </summary>
        /// <param name="restclient">rest client used to access hubspot</param>
        /// <param name="options">options for hubspot api</param>
        public HubSpot(HubSpotRestClient restclient, HubSpotOptions options = null)
        {
            options = options ?? new HubSpotOptions();
            ModelRegistry registry = new ModelRegistry();

            Contacts     = new ContactApi(options, restclient, registry);
            Companies    = new CompanyApi(restclient, registry);
            Associations = new AssociationApi(restclient);
            Deals        = new DealsApi(restclient, registry);
            Tickets      = new TicketsApi(restclient, registry);
            BlogPosts    = new BlogPostApi(restclient, registry);
            Engagements  = new EngagementsApi(options, restclient, registry);
        }
コード例 #4
0
        public async Task <IActionResult> Me()
        {
            var accessToken = await HttpContext.GetTokenAsync("access_token");

            var config = new Configuration
            {
                AccessToken = accessToken
            };

            var usersApi = new UsersApi(config);
            var dealsApi = new DealsApi(config);

            var user = await usersApi.GetUsersMeAsync(companies : true);

            var deals = await dealsApi.GetDealsAsync(user.User.Companies[0].Id, limit : 5);

            ViewBag.Deals = deals.Deals;

            return(View(user.User));
        }