Exemplo n.º 1
0
        private SensoriaApiResult <ProductDetailsSearchItem> GetShoeDetails(int ProductId)
        {
            ApiResultHttpClientHelper <ProductDetailsSearchItem> client = new ApiResultHttpClientHelper <ProductDetailsSearchItem>();

            client.Url         = String.Format("search/product/details/{0}", ProductId);
            client.AccessToken = accessToken;
            client.BaseAddress = clo.apiUrl;

            return(client.GetSensoriaApiResult());
        }
Exemplo n.º 2
0
        private SensoriaApiResult <IEnumerable <Achievement> > GetRecentBadges(int id)
        {
            ApiResultHttpClientHelper <IEnumerable <Achievement> > client = new ApiResultHttpClientHelper <IEnumerable <Achievement> >();

            client.Url         = String.Format("user/{0}/achievement/recentbadges", id);
            client.AccessToken = accessToken;
            client.BaseAddress = clo.apiUrl;

            return(client.GetSensoriaApiResult());
        }
Exemplo n.º 3
0
        private SensoriaApiResult <IEnumerable <Achievement> > GetPersonalRecords(int id)
        {
            ApiResultHttpClientHelper <IEnumerable <Achievement> > client = new ApiResultHttpClientHelper <IEnumerable <Achievement> >();

            client.Url         = String.Format("user/{0}/achievement?inquiry=PersonalRecord", id);
            client.AccessToken = accessToken;
            client.BaseAddress = clo.apiUrl;

            return(client.GetSensoriaApiResult());
        }
Exemplo n.º 4
0
        void ListSessionForUser(User u)
        {
            // Note: Session is a complex object, only extracting as a dynamic JSON here
            ApiResultHttpClientHelper <IEnumerable <JObject> > client = new ApiResultHttpClientHelper <IEnumerable <JObject> >();

            client.Url         = String.Format("{0}User/{1}/Session", clo.apiUrl, u.UserId);
            client.AccessToken = accessToken;
            client.BaseAddress = clo.apiUrl;

            var result = client.GetSensoriaApiResult().APIResult;

            Console.WriteLine(String.Format("Available {0} sessions.", result.Count()));
        }
Exemplo n.º 5
0
        private SensoriaApiResult <Closet> GetShoeCloset(int shoeClosetItemId = -1)
        {
            ApiResultHttpClientHelper <Closet> client = new ApiResultHttpClientHelper <Closet>();

            if (shoeClosetItemId == -1)
            {
                client.Url = String.Format("closet/shoes");
            }
            else
            {
                client.Url = String.Format("closet/shoes/{0}", shoeClosetItemId);
            }
            client.AccessToken = accessToken;
            client.BaseAddress = clo.apiUrl;

            return(client.GetSensoriaApiResult());
        }
Exemplo n.º 6
0
        public void Run()
        {
            // Enumerating Sessions
            ApiResultHttpClientHelper <IEnumerable <JObject> > client = new ApiResultHttpClientHelper <IEnumerable <JObject> >();

            client.Url         = String.Format("{0}User/me/Session", clo.apiUrl);
            client.AccessToken = accessToken;
            client.BaseAddress = clo.apiUrl;

            var result = client.GetSensoriaApiResult().APIResult;
            var count  = result.Count();

            Console.WriteLine(String.Format("Available {0} sessions, enumerating top 10", count));

            int i = 0;

            foreach (JObject session in result)
            {
                if (i >= 10)
                {
                    break;
                }

                Console.WriteLine("Fetching session {0}", session["SessionId"]);

                ApiResultHttpClientHelper <JObject> sessionClient = new ApiResultHttpClientHelper <JObject>();
                sessionClient.Url         = String.Format("{0}Session/{1}", clo.apiUrl, session["SessionId"]);
                sessionClient.AccessToken = accessToken;
                sessionClient.BaseAddress = clo.apiUrl;

                var sessionData = sessionClient.GetSensoriaApiResult().APIResult;
                Console.WriteLine("Session {0} fetched, recorded on {1}", sessionData["SessionId"], sessionData["RecordedDateTime"]);

                ++i;
            }
        }