Closed Hossain2024 closed 3 months ago
👋 Hi! Thank you for this contribution! Just to let you know, our GitHub SDK team does a round of issue and PR reviews twice a week, every Monday and Friday! We have a process in place for prioritizing and responding to your input. Because you are a part of this community please feel free to comment, add to, or pick up any issues/PRs that are labeled with Status: Up for grabs
. You & others like you are the reason all of this works! So thank you & happy coding! 🚀
Hi @Hossain2024, you're simply confusing two endpoints. The GetAllIssuesAsync endpoint (returning multiple issues from the GitHub API) returns a list of label strings. The request to return a single issue returns a more fleshed-out labels object.
If you want to get a single issue that contains all the information about its labels, you can make a request like this:
var labels = await gitHubClient.Repos["microsoft"]["kiota"].Issues[5037].Labels.GetAsync();
foreach (var label in labels)
{
Console.WriteLine("Label: " + label.Name);
Console.WriteLine("Label ID: " + label.Id);
Console.WriteLine("Label Description: " + label.Description);
Console.WriteLine("Label Color: " + label.Color);
}
which, if you've initialized your client correctly, will print something like the following:
Label: type:bug
Label ID: 2603543073
Label Description: A broken experience
Label Color: d73a4a
Label: Python
Label ID: 3016728568
Label Description:
Label Color: 0BBE2D
Label: WIP
Label ID: 3162613472
Label Description:
Label Color: F683F1
I hope that helps!
What happened?
I am encountering an issue while trying to retrieve Label objects for an issue on GitHub.
https://github.dev/octokit/dotnet-sdk/blob/main/src/GitHub/Repos/Item/Item/Issues/IssuesRequestBuilder.cs
The GitHub.Models.Issue class defines the label property as a List. Based on the API response it should be a
List<Label>
Here is the API call I used:
response from the API call (taken from postman)
I want to get the Labels field of this issue which is a
List<Label>
.Here I am trying to get the Labels field of an issue. The type of the label field is a
List<String>
but I expect the labels field to be a Liston line 3 I get the following error message
I am currently receiving a List where the size is 2(for example) and both string [0] and string [1] are null even when [0] has a value and [1] has a value. This is contrary to the actual values in the response. Why is the labels field from the API returning a List instead of a List
Versions
0.0.24
Code of Conduct