using Aspose.Slides.Cloud.Sdk; // Import the Aspose.Slides Cloud SDK to work with PowerPoint presentations.
using Aspose.Slides.Cloud.Sdk.Model; // Import models used by the SDK.
using System; // Import the System namespace for basic functionalities.
using System.IO; // Import System.IO for file input/output operations.

namespace AsposeTestCodes
{
    class Program
    {
        static void Main(string[] args) // Main method - the program's entry point.
        {
            // Instantiate the SlidesApi with the API key and secret for authentication.
            SlidesApi slidesApi = new SlidesApi("Client ID", "Client Secret");

            // Name of the PowerPoint file to work with.
            string fileName = "PresentationWithoutHyperlink.pptx";

            // Read the file into a memory stream and upload it to the Aspose.Slides cloud storage.
            FilesUploadResult uploadedPresResult = slidesApi.UploadFile(fileName, new MemoryStream(File.ReadAllBytes(fileName)));

            // Index of the slide and shape where the target shape is located (1-based index).
            int slideIndex = 2, shapeIndex = 2;

            
            Shape shape = new Shape // Create a shape object with a hyperlink
            {
                HyperlinkClick = new Hyperlink
                {
                    ActionType = Hyperlink.ActionTypeEnum.Hyperlink, // Set the action type as a hyperlink.
                    ExternalUrl = "https://docs.aspose.cloud/slides" // The URL for the hyperlink.
                }
            };

            // Update the shape on the specified slide with the hyperlink.
            ShapeBase updatedShpWithHyperlink = slidesApi.UpdateShape(fileName, slideIndex, shapeIndex, shape);

            // Print the updated hyperlink's URL to the console for verification.
            Console.WriteLine(updatedShpWithHyperlink.HyperlinkClick.ExternalUrl);

            // Download the updated presentation from the cloud as a stream.
            Stream stream = slidesApi.DownloadFile(fileName);

            // Save the downloaded presentation to the local file system with a new name.
            var fs = new FileStream("PresWithHyperlinks.pptx", FileMode.Create, FileAccess.Write);
            stream.CopyTo(fs); // Copy the content from the stream to the file.
        }
    }
}