Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ability to download latest preview
- Loading branch information
Joseph Woodward
committed
Sep 1, 2019
1 parent
e322aaf
commit a974314
Showing
7 changed files
with
74 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace DotNet.InstallSdk.Acquirables | ||
{ | ||
public class AcquireResult | ||
{ | ||
public string Version { get; set; } | ||
|
||
public string ChannelJson { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using System.Linq; | ||
using System.Net.Http; | ||
using System.Text.Json; | ||
using System.Threading.Tasks; | ||
|
||
namespace DotNet.InstallSdk.Acquirables | ||
{ | ||
public class LatestPreviewVersion : Acquirable | ||
{ | ||
public LatestPreviewVersion(ITextWriter writer) | ||
{ | ||
} | ||
|
||
public override async Task<AcquireResult> Fetch(HttpClient httpClient) | ||
{ | ||
using var releasesResponse = await JsonDocument.ParseAsync(await httpClient.GetStreamAsync(ReleaseIndex)); | ||
|
||
var channel = releasesResponse.RootElement.GetProperty("releases-index").EnumerateArray() | ||
.First(x => x.GetProperty("support-phase").GetString() == "preview"); | ||
|
||
return new AcquireResult | ||
{ | ||
ChannelJson = channel.GetProperty("releases.json").GetString(), | ||
Version = channel.GetProperty("latest-sdk").GetString() | ||
}; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters