I tried to call the api to create a thumbnail from the original image using the api but it didn't work

public class GoogleGenerativeAI
{
private readonly string _apiKey;
private readonly RestClient _client;
private readonly List _fileUris = new List();

    public GoogleGenerativeAI(string apiKey)
    {
        _apiKey = apiKey;
        _client = new RestClient("https://generativelanguage.googleapis.com");
    }

    public string UploadFile(string filePath, string mimeType)
    {
        if (string.IsNullOrEmpty(filePath)) return string.Empty;

        var request = new RestRequest($"/upload/v1beta/files?key={_apiKey}", Method.POST);
        request.AddHeader("X-Goog-Upload-Command", "start, upload, finalize");
        request.AddHeader("X-Goog-Upload-Header-Content-Length", new FileInfo(filePath).Length.ToString());
        request.AddHeader("X-Goog-Upload-Header-Content-Type", mimeType);
        request.AddHeader("Content-Type", "application/json");
        byte[] fileBytes = File.ReadAllBytes(filePath);
        request.AddParameter(mimeType, fileBytes, ParameterType.RequestBody);


        var response = _client.Execute(request);
        dynamic jsonResponse = JsonConvert.DeserializeObject(response.Content);
        string fileUri = jsonResponse?.file?.uri;
        if (!string.IsNullOrEmpty(fileUri)) _fileUris.Add(fileUri);
        return fileUri;
    }

    public string GenerateContent()
    {
        var request = new RestRequest($"/v1beta/models/gemini-2.0-flash-exp-image-generation:generateContent?key={_apiKey}", Method.POST);
        request.AddHeader("Content-Type", "application/json");

        var requestBody = new
        {
            contents = new[]
            {
            new { role = "user", parts = new object[] { new { fileData = new { fileUri = _fileUris[0], mimeType = "image/jpeg" } }, new { text = "Tôi sẽ upload ảnh gốc lên và bạn bôi trắng các nhân vật chính trong ảnh với viền trắng 20 pixel được không?" } } },
            new { role = "model", parts = new object[] { new { fileData = new { fileUri = _fileUris[1], mimeType = "image/png" } } } },
            new { role = "user", parts = new object[] { new { text = "Thêm tôi đoạn text: \"Rien à faire\" : Nagui complètement snobé par un candidat de \"N’oubliez pas les paroles\"" } } },
            new { role = "model", parts = new object[] { new { fileData = new { fileUri = _fileUris[2], mimeType = "image/png" } } } },
            new { role = "user", parts = new object[] { new { text = "INSERT_INPUT_HERE" } } }
        },
            generationConfig = new { temperature = 1, topK = 40, topP = 0.95, maxOutputTokens = 8192, responseMimeType = "text/plain" }
        };

        request.AddJsonBody(requestBody);
        var response = _client.Execute(request);
        return response.Content;
    }
}

and call : string apiKey = “…”;
GoogleGenerativeAI aiClient = new GoogleGenerativeAI(apiKey);

        // Danh sách tệp cần upload
        string[] files = {
            @"D:/a.jpg",
            @"D:/a.jpg",
            @"D:/a.jpg"
        };
        string[] mimeTypes = { "image/jpeg", "image/png", "image/png" };

        for (int i = 0; i < files.Length; i++)
        {
            if (!string.IsNullOrEmpty(files[i]))
            {
                aiClient.UploadFile(files[i], mimeTypes[i]);
            }
        }

        // Gọi API tạo nội dung
        string result = aiClient.GenerateContent();
        Console.WriteLine(result);