コード例 #1
0
ファイル: NuGet.cs プロジェクト: JetBrains/profiler-self-api
        public static Task <HttpContent> GetNupkgContentAsync(
            this HttpClient http,
            Uri nugetUrl,
            NuGetApi nugetApi,
            string packageId,
            SemanticVersion packageVersion,
            CancellationToken cancellationToken)
        {
            if (http == null)
            {
                throw new ArgumentNullException(nameof(http));
            }
            if (nugetUrl == null)
            {
                throw new ArgumentNullException(nameof(nugetUrl));
            }
            if (packageId == null)
            {
                throw new ArgumentNullException(nameof(packageId));
            }
            if (packageVersion == null)
            {
                throw new ArgumentNullException(nameof(packageVersion));
            }

            switch (nugetApi)
            {
            case NuGetApi.V2:
                return(V2.GetNupkgContentAsync(http, nugetUrl, packageId, packageVersion, cancellationToken));

            case NuGetApi.V3:
                return(V3.GetNupkgContentAsync(http, nugetUrl, packageId, packageVersion, cancellationToken));

            default:
                throw new NotSupportedException($"The NuGet API {nugetApi} is not supported.");
            }
        }