Mam kolejny problem z API GitLAba. Napisałem funkcję która tworzy nowe ISSUE:
static async Task<bool> new_issue(string repository, int appId, string issueTitle, string issueDescription) //New ISSUE
{
string issue_path = which_repo(repository)[0] + "projects/" + appId + "/issues?title=" + issueTitle;// + "&description=" + issueDescription;
issueDescription = issueDescription.Replace("\n","\\n");
issueDescription = "{\"description\":\"" + issueDescription + "\"}";
using (var request = new HttpRequestMessage(new HttpMethod("POST"), issue_path))
{
request.Headers.TryAddWithoutValidation("PRIVATE-TOKEN", "XoXU_eZa4e6DF74MKvAa");
request.Content = new StringContent(issueDescription, System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
Console.WriteLine("Utworzono issue.");
return response.IsSuccessStatusCode;
}
}
Mam problem z przypisaniem od razu do tego ISSUE konkretnego ASSIGNEE.
W jeśli do ISSUE dodaje się assignee za pomocą web wypełniają się od razu dwa pola:
w assignees i assignee mniej więcej w taki sposób:
"assignees": [{
"name": "Jarret O'Keefe",
"username": "francisca",
"id": 14,
"state": "active",
"avatar_url": "http://www.gravatar.com/avatar/a7fa515d53450023c83d62986d0658a8?s=80&d=identicon",
"web_url": "https://gitlab.example.com/francisca"
}],
"assignee": {
"name": "Jarret O'Keefe",
"username": "francisca",
"id": 14,
"state": "active",
"avatar_url": "http://www.gravatar.com/avatar/a7fa515d53450023c83d62986d0658a8?s=80&d=identicon",
"web_url": "https://gitlab.example.com/francisca"
},
Może trzeba takie coś przekazać jako request.content?