有没有办法关闭 Upsource 中所有打开的评论?

Is there a way to close all open reviews in Upsource?

有很多开放的评论,我不想手动关闭。 我想关闭旧的开放评论。 我如何在 upsource 中批量关闭所有打开的评论?

我用upsource写了一个简单的代码api。 这是关闭所有打开的评论的示例代码。

 public class Rootobject
{
    public Result result { get; set; }
}

public class Result
{
    public Review[] reviews { get; set; }
    public bool hasMore { get; set; }
    public int totalCount { get; set; }
}

public class Review
{
    public Reviewid reviewId { get; set; }
    public string title { get; set; }
    public Participant[] participants { get; set; }
    public int state { get; set; }
    public bool isUnread { get; set; }
    public bool isReadyToClose { get; set; }
    public bool isRemoved { get; set; }
    public long createdAt { get; set; }
    public string createdBy { get; set; }
    public long updatedAt { get; set; }
    public Completionrate completionRate { get; set; }
    public Discussioncounter discussionCounter { get; set; }
    public bool isMuted { get; set; }
    public string description { get; set; }
}

public class Reviewid
{
    public string projectId { get; set; }
    public string reviewId { get; set; }
}

public class Completionrate
{
    public int completedCount { get; set; }
    public int reviewersCount { get; set; }
    public bool hasConcern { get; set; }
}

public class Discussioncounter
{
    public int count { get; set; }
    public bool hasUnresolved { get; set; }
    public int unresolvedCount { get; set; }
    public int resolvedCount { get; set; }
}

public class Participant
{
    public string userId { get; set; }
    public int role { get; set; }
    public int state { get; set; }
}

 class Program
{
    static void Main(string[] args)
    {
        string token="Authorization: Basic username:password";//username:password with base64 encoded
        var s = HttpPOST("http://your-upsource-address/~rpc/getReviews",
             "{\"projectId\":\"projectId\", \"limit\":2000,\"query\":\"state: open\"}", token);
        var reviews = JsonConvert.DeserializeObject<Rootobject>(s);
        foreach (Review resultReview in reviews.result.reviews)
        {
            string review = $"{{\"reviewId\":{{\"projectId\":\"projectId\",\"reviewId\":\"{resultReview.reviewId.reviewId}\"}},\"isFlagged\":true}}";
            HttpPOST("http://your-upsource-addres/~rpc/closeReview", review, token);
        }
    }

    public static string HttpPOST(string url, string querystring, string token)
    {
        HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
        request.Method = "POST";
        request.Headers.Add(token);
        request.ContentType = "application/x-www-form-urlencoded"; 
        StreamWriter requestWriter = new StreamWriter(request.GetRequestStream());

        try
        {
            requestWriter.Write(querystring);
        }
        catch
        {
            throw;
        }
        finally
        {
            requestWriter.Close();
            requestWriter = null;
        }

        HttpWebResponse response = (HttpWebResponse)request.GetResponse();
        using (StreamReader sr = new StreamReader(response.GetResponseStream()))
        {
            return sr.ReadToEnd();
        }
    }
}