File tree Expand file tree Collapse file tree 5 files changed +14
-17
lines changed
csharp/getting-started/console-webapiclient Expand file tree Collapse file tree 5 files changed +14
-17
lines changed Original file line number Diff line number Diff line change 1616 steps :
1717 - uses : actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # @v2
1818 - name : Use Node.js
19- uses : actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # @v1
19+ uses : actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # @v1
2020 with :
2121 node-version : 12.x
2222 - name : Run Markdownlint
Original file line number Diff line number Diff line change 6262
6363 # Update build output json file
6464 - name : Upload build results
65- uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # @v4.6.2
65+ uses : actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # @v5.0.0
6666 with :
6767 name : build
6868 path : ./output.json
Original file line number Diff line number Diff line change 11using System . Net . Http . Headers ;
2- using System . Text . Json ;
2+ using System . Net . Http . Json ;
33
44using HttpClient client = new ( ) ;
55client . DefaultRequestHeaders . Accept . Clear ( ) ;
2222
2323static async Task < List < Repository > > ProcessRepositoriesAsync ( HttpClient client )
2424{
25- await using Stream stream =
26- await client . GetStreamAsync ( "https://api.github.com/orgs/dotnet/repos" ) ;
27- var repositories =
28- await JsonSerializer . DeserializeAsync < List < Repository > > ( stream ) ;
29- return repositories ?? new ( ) ;
25+ var repositories = await client . GetFromJsonAsync < List < Repository > > ( "https://api.github.com/orgs/dotnet/repos" ) ;
26+ return repositories ?? new List < Repository > ( ) ;
3027}
Original file line number Diff line number Diff line change 1- using System ;
2- using System . Text . Json . Serialization ;
1+ using System . Text . Json . Serialization ;
32
4- public sealed record class Repository (
5- [ property : JsonPropertyName ( "name" ) ] string Name ,
6- [ property : JsonPropertyName ( "description" ) ] string Description ,
3+ public record class Repository (
4+ string Name ,
5+ string Description ,
76 [ property: JsonPropertyName ( "html_url" ) ] Uri GitHubHomeUrl ,
8- [ property: JsonPropertyName ( "homepage" ) ] Uri Homepage ,
9- [ property: JsonPropertyName ( "watchers" ) ] int Watchers ,
10- [ property: JsonPropertyName ( "pushed_at" ) ] DateTime LastPushUtc )
7+ Uri Homepage ,
8+ int Watchers ,
9+ [ property: JsonPropertyName ( "pushed_at" ) ] DateTime LastPushUtc
10+ )
1111{
1212 public DateTime LastPush => LastPushUtc . ToLocalTime ( ) ;
1313}
Original file line number Diff line number Diff line change 22
33 <PropertyGroup >
44 <OutputType >Exe</OutputType >
5- <TargetFramework >net6 .0</TargetFramework >
5+ <TargetFramework >net9 .0</TargetFramework >
66 <Nullable >enable</Nullable >
77 <ImplicitUsings >enable</ImplicitUsings >
88 </PropertyGroup >
You can’t perform that action at this time.
0 commit comments