Exemple #1
0
        public static async Task ManagingNodes(SmugMugAPI api)
        {
            //Get access to the logged in user
            User user = await api.GetAuthenticatedUser();

            Console.WriteLine("{0} is currently authenticated", user.Name);

            //Get the root node ID
            string defaultNodeID = api.GetDefaultNodeID(user);

            //Create a new folder node at the root
            Node folderNode = await api.CreateNode(NodeType.Folder, "TestFolderNode", defaultNodeID);

            Console.WriteLine("Created folder node {0}", folderNode.Name);

            //Create a new album node in that folder
            Dictionary <string, string> arguments = new Dictionary <string, string>()
            {
                { "Description", "test description" }
            };
            Node albumNode = await api.CreateNode(NodeType.Album, "TestAlbumNode", folderNode.NodeID, arguments);

            Console.WriteLine("Created album node {0} {1}", albumNode.Name, albumNode.Description);

            Dictionary <string, string> albumUpdates = new Dictionary <string, string>()
            {
                { "Name", "Updated Album Name" }, { "Description", "Updated description" }, { "SortDirection", "Ascending" }
            };
            Node updatedAlbumNode = await api.UpdateNode(albumNode, albumUpdates);

            Console.WriteLine("Updated album node {0}: {1}", updatedAlbumNode.Name, updatedAlbumNode.Description);

            //Delete the newly created nodes
            await api.DeleteNode(folderNode);
        }
Exemple #2
0
        public static async Task ManagingFoldersAndAlbums(SmugMugAPI api)
        {
            //Get access to the logged in user
            User user = await api.GetAuthenticatedUser();

            Console.WriteLine("{0} is currently authenticated", user.Name);

            //Create a new folder at the root
            Folder folder = await api.CreateFolder("TestFolder", user, "");

            Console.WriteLine("Created folder {0}", folder.Name);

            //Create a new album in that folder
            Dictionary <string, string> arguments = new Dictionary <string, string>()
            {
                { "Description", "test description" }
            };
            Album album = await api.CreateAlbum("TestAlbum", folder, arguments);

            Console.WriteLine("Created album {0}: {1}", album.Name, album.Description);

            Dictionary <string, string> albumUpdates = new Dictionary <string, string>()
            {
                { "Name", "Updated Album Name" }, { "Description", "Updated description" }, { "SortDirection", "Ascending" }
            };
            Album updatedAlbum = await api.UpdateAlbum(album, albumUpdates);

            Console.WriteLine("Updated album {0}: {1}", updatedAlbum.Name, updatedAlbum.Description);

            //Delete the newly created album and folder
            await api.DeleteAlbum(album);

            await api.DeleteFolder(folder);
        }