octokit / dotnet-sdk Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
Hi,
With Octokit, I could do:
var ghc = new GitHubClient(...);
ghc.SetRequestTimeout(TimeSpan.FromHours(1)); // Uploading fairly large release assets...
What's the equivalent in Octokit.NET.SDK? ๐ค
Fetching check runs for a commit results in a FormatException
.
var cli = new GitHubClient(RequestAdapter.Create(new AnonymousAuthentificationProvider()));
var runs = await cli.Repos["discord-net"]["Discord.Net"].Commits["ef9b79672bbe4edd8bf68a809b947bb3cc501935"].CheckRuns.GetAsync();
System.FormatException: "One of the identified items was in an invalid format."
in System.Text.Json.ThrowHelper.ThrowFormatException()
in System.Text.Json.JsonElement.GetInt32()
in Microsoft.Kiota.Serialization.Json.JsonParseNode.GetIntValue()
in GitHub.Models.CheckRun.<GetFieldDeserializers>b__74_9(IParseNode n)
in Microsoft.Kiota.Serialization.Json.JsonParseNode.AssignFieldValues[T](T item)
in Microsoft.Kiota.Serialization.Json.JsonParseNode.GetObjectValue[T](ParsableFactory`1 factory)
in Microsoft.Kiota.Serialization.Json.JsonParseNode.<GetCollectionOfObjectValues>d__17`1.MoveNext()
in System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
in System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
in GitHub.Repos.Item.Item.Commits.Item.CheckRuns.CheckRunsGetResponse.<GetFieldDeserializers>b__14_0(IParseNode n)
in Microsoft.Kiota.Serialization.Json.JsonParseNode.AssignFieldValues[T](T item)
in Microsoft.Kiota.Serialization.Json.JsonParseNode.GetObjectValue[T](ParsableFactory`1 factory)
in Microsoft.Kiota.Http.HttpClientLibrary.HttpClientRequestAdapter.<SendAsync>d__20`1.MoveNext()
in Microsoft.Kiota.Http.HttpClientLibrary.HttpClientRequestAdapter.<SendAsync>d__20`1.MoveNext()
in GitHub.Repos.Item.Item.Commits.Item.CheckRuns.CheckRunsRequestBuilder.<GetAsync>d__2.MoveNext()
octokit/dotnet-sdk v0.0.6
.NET 8
I might have missed it, but there doesn't appear to be a friendly API for uploading release assets. In Octokit, this was done like so:
var releaseApi = ghc.Repository.Release;
var release = await releaseApi.Get(...);
await releaseApi.UploadAsset(release, new ReleaseAssetUpload(zipFileName, MediaTypeNames.Application.Zip, stream, timeout));
It would be nice if Octokit.NET.SDK had something similar rather than requiring me to make a manual request using the Release.UploadUrl
.
v0.0.3
No response
Take for example the GitHub.Models.Release.Assets
property. AFAICT from the API, this property can be an empty array, but never null.
v0.0.3
Hey folks,
I just took a quick look at pulling this into an existing application of mine and I thought I'd just give you some initial feedback. I didn't get very far as it was hundreds of compiler warnings, so just tweaked a small part of it to get a feel for things.
I realise it's very early and some of it might be things you already know about, so no worries if I'm not telling you anything new.
Also this is intended to be neutral feedback on first impressions, don't take it as positive or negative, just "huh, that's different" observations.
ALLCAPS
or have underscores in them. Maybe for a native .NET experience they match the API too closely and look out-of-place for the typical .NET library API surface and need some pre-processing being being emitted as code?Foo.Item.Item.Bar
)Dictionary<K, V>
type, rather than it just being deferred execution collecting values until you get to making the actual request.position
. Intellisense when using the API would be easier to reason about if they had the appropriate names (owner
, repo
, number
) etc.RepositoryVisbility
which in Octokit encapsulates the possible public, internal and private values.Here's an example of some of the above in a single snippet of code using the generated API instead of Octokit.net:
using GitHub.Octokit;
// Really really long and repetitive namespace
using GitHub.Octokit.Repos.Item.Item.Pulls.Item.Reviews;
OctokitClient client = CreateClient(...);
var review = new ReviewsPostRequestBody()
{
Event = ReviewsPostRequestBody_event.APPROVE, // Underscore and all caps type and member name
};
// Lots of indexers
await client.Repos[owner][name].Pulls[number].Reviews.PostAsync(review);
The Octokit equivalent of the above was:
using Octokit;
IGitHubClient client = CreateClient(...);
var review = new PullRequestReviewCreate()
{
Event = PullRequestReviewEvent.Approve
};
await client.PullRequest.Review.Create(owner, name, number, review);
I hope the observations are useful.
I'm assuming this might require changes in Kiota, so I don't know if this is even the correct place to file this feature request. The API specifies that tag_name
is a required parameter for creating a release. Yet, this is not apparent from the ReleasesRequestBuilder.PostAsync(ReleasesPostRequestBody, [...])
method since ReleasesPostRequestBody.TagName
is marked as nullable when it should probably be non-nullable and maybe even required
. Alternatively, it could be promoted to a required parameter of the PostAsync()
method.
v0.0.3
No response
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.