Exemplo n.º 1
0
        public User GetProfile(Credential credential)
        {
            serviceClient.BaseUri = baseUrl;
            string userNamePassword = Base64Encode(credential.UserName + ":" + credential.Password);

            serviceClient.AddHeader("Authorization", "Basic " + userNamePassword);

            User currentLoggedinUser = serviceClient.Get <User>(string.Format("{0}{1}", baseUrl, "me"));

            return(currentLoggedinUser);
        }
Exemplo n.º 2
0
        public List <Catalogue> GetCatalogue()
        {
            serviceClient.BaseUri = baseUrl;
            RootObject catalogue = serviceClient.Get <RootObject>(string.Format("{0}{1}", baseUrl, "catalogs"));

            return(catalogue._embedded.catalogs);
        }
Exemplo n.º 3
0
        public List <Cart> GetUserActiveCarts()
        {
            serviceClient.BaseUri = baseUrl;
            string userNamePassword = Base64Encode(serviceClient.UserName + ":" + serviceClient.Password);

            serviceClient.AddHeader("Authorization", "Basic " + userNamePassword);
            RootObject rootObject = serviceClient.Get <RootObject>(string.Format("{0}{1}", baseUrl, "carts/" + "all" + "/status?" + "status=OPEN"));

            if (rootObject._embedded != null)
            {
                return(rootObject._embedded.carts);
            }
            else
            {
                return(null);
            }
        }