Ejemplo n.º 1
0
        public void Test()
        {
            string apikey = SmugItConfigurationManager.Instance.Configuration.Credential.ApiKey;

            OAuthCredentials oAuthCredentials = new OAuthCredentials(apikey); // CONSUMER_KEY is the API Key received from SmugMug`
            SmugMugAPI       api = new SmugMugAPI(LoginType.Anonymous, oAuthCredentials);
            //var test = api.GetUser("corleone00");
            //var album = api.GetAlbum("Etna2011").GetAwaiter().GetResult();

            //Get access to the user you want to enumerate albums for
            User user = api.GetUser("alberic").GetAwaiter().GetResult();

            Console.WriteLine(user.Name);

            var rootNode = api.GetRootNode(user).GetAwaiter().GetResult();// .GetFolder(user, "").GetAwaiter().GetResult();
            var nodes    = api.GetChildNodes(rootNode).GetAwaiter().GetResult();
        }
Ejemplo n.º 2
0
        public static async Task WorkingWithNodes(SmugMugAPI api)
        {
            //Get access to the user you want to enumerate albums for
            User user = await api.GetUser("cmac");

            Console.WriteLine(user.Name);

            //Get the root node for the given user
            Node rootNode = await api.GetRootNode(user);

            Console.WriteLine(rootNode);

            //Get the children of the root node
            List <Node> childNodes = await api.GetChildNodes(rootNode);

            Console.WriteLine("The first node '{0}' is a {1}", childNodes[0].Name, childNodes[0].Type);

            //Get a specific node, "XWx8t"
            Node node = await api.GetNode("XWx8t");

            Console.WriteLine("Node '{0}' is a {1}", node.Name, node.Type);
        }