成果物
情報源
プロジェクト作成
dotnet new console -o RestClient cd RestClient
パッケージ追加
dotnet add package System.Runtime.Serialization.Json dotnet add package System.Runtime.Serialization.Primitives
30秒かかった。
ログ
$ dotnet add package System.Runtime.Serialization.Json Writing /tmp/tmpGqqBih.tmp info : パッケージ 'System.Runtime.Serialization.Json' の PackageReference をプロジェクト '/tmp/work/RestClient/RestClient.csproj' に追加しています。 info : /tmp/work/RestClient/RestClient.csproj のパッケージを復元しています... info : GET https://api.nuget.org/v3-flatcontainer/system.runtime.serialization.json/index.json info : OK https://api.nuget.org/v3-flatcontainer/system.runtime.serialization.json/index.json 610 ミリ秒 info : GET https://api.nuget.org/v3-flatcontainer/system.runtime.serialization.json/4.3.0/system.runtime.serialization.json.4.3.0.nupkg info : OK https://api.nuget.org/v3-flatcontainer/system.runtime.serialization.json/4.3.0/system.runtime.serialization.json.4.3.0.nupkg 32 ミリ秒 info : GET https://api.nuget.org/v3-flatcontainer/system.io/index.json info : GET https://api.nuget.org/v3-flatcontainer/system.private.datacontractserialization/index.json info : GET https://api.nuget.org/v3-flatcontainer/system.runtime/index.json info : OK https://api.nuget.org/v3-flatcontainer/system.io/index.json 595 ミリ秒 info : GET https://api.nuget.org/v3-flatcontainer/system.io/4.3.0/system.io.4.3.0.nupkg info : OK https://api.nuget.org/v3-flatcontainer/system.io/4.3.0/system.io.4.3.0.nupkg 35 ミリ秒 info : OK https://api.nuget.org/v3-flatcontainer/system.private.datacontractserialization/index.json 738 ミリ秒 info : OK https://api.nuget.org/v3-flatcontainer/system.runtime/index.json 733 ミリ秒 info : GET https://api.nuget.org/v3-flatcontainer/system.private.datacontractserialization/4.3.0/system.private.datacontractserialization.4.3.0.nupkg info : GET https://api.nuget.org/v3-flatcontainer/system.runtime/4.3.0/system.runtime.4.3.0.nupkg info : OK https://api.nuget.org/v3-flatcontainer/system.private.datacontractserialization/4.3.0/system.private.datacontractserialization.4.3.0.nupkg 99 ミリ秒 info : OK https://api.nuget.org/v3-flatcontainer/system.runtime/4.3.0/system.runtime.4.3.0.nupkg 98 ミリ秒 info : GET https://api.nuget.org/v3-flatcontainer/microsoft.netcore.platforms/index.json info : GET https://api.nuget.org/v3-flatcontainer/microsoft.netcore.targets/index.json info : GET https://api.nuget.org/v3-flatcontainer/system.text.encoding/index.json info : GET https://api.nuget.org/v3-flatcontainer/system.threading.tasks/index.json info : GET https://api.nuget.org/v3-flatcontainer/system.collections/index.json info : GET https://api.nuget.org/v3-flatcontainer/system.collections.concurrent/index.json info : GET https://api.nuget.org/v3-flatcontainer/system.diagnostics.debug/index.json info : GET https://api.nuget.org/v3-flatcontainer/system.globalization/index.json info : GET https://api.nuget.org/v3-flatcontainer/system.linq/index.json info : GET https://api.nuget.org/v3-flatcontainer/system.reflection/index.json info : GET https://api.nuget.org/v3-flatcontainer/system.reflection.emit.ilgeneration/index.json info : GET https://api.nuget.org/v3-flatcontainer/system.reflection.emit.lightweight/index.json info : GET https://api.nuget.org/v3-flatcontainer/system.reflection.extensions/index.json info : GET https://api.nuget.org/v3-flatcontainer/system.reflection.primitives/index.json info : GET https://api.nuget.org/v3-flatcontainer/system.reflection.typeextensions/index.json info : GET https://api.nuget.org/v3-flatcontainer/system.resources.resourcemanager/index.json info : GET https://api.nuget.org/v3-flatcontainer/system.runtime.extensions/index.json info : GET https://api.nuget.org/v3-flatcontainer/system.runtime.serialization.primitives/index.json info : GET https://api.nuget.org/v3-flatcontainer/system.text.encoding.extensions/index.json info : GET https://api.nuget.org/v3-flatcontainer/system.text.regularexpressions/index.json info : GET https://api.nuget.org/v3-flatcontainer/system.threading/index.json info : GET https://api.nuget.org/v3-flatcontainer/system.xml.readerwriter/index.json info : GET https://api.nuget.org/v3-flatcontainer/system.xml.xdocument/index.json info : GET https://api.nuget.org/v3-flatcontainer/system.xml.xmldocument/index.json info : GET https://api.nuget.org/v3-flatcontainer/system.xml.xmlserializer/index.json info : OK https://api.nuget.org/v3-flatcontainer/microsoft.netcore.targets/index.json 1778 ミリ秒 info : GET https://api.nuget.org/v3-flatcontainer/microsoft.netcore.targets/1.1.0/microsoft.netcore.targets.1.1.0.nupkg info : OK https://api.nuget.org/v3-flatcontainer/microsoft.netcore.platforms/index.json 1824 ミリ秒 info : GET https://api.nuget.org/v3-flatcontainer/microsoft.netcore.platforms/1.1.0/microsoft.netcore.platforms.1.1.0.nupkg info : OK https://api.nuget.org/v3-flatcontainer/microsoft.netcore.targets/1.1.0/microsoft.netcore.targets.1.1.0.nupkg 116 ミリ秒 info : OK https://api.nuget.org/v3-flatcontainer/microsoft.netcore.platforms/1.1.0/microsoft.netcore.platforms.1.1.0.nupkg 109 ミリ秒 info : OK https://api.nuget.org/v3-flatcontainer/system.threading.tasks/index.json 2497 ミリ秒 info : OK https://api.nuget.org/v3-flatcontainer/system.text.encoding/index.json 2502 ミリ秒 info : OK https://api.nuget.org/v3-flatcontainer/system.collections.concurrent/index.json 2490 ミリ秒 info : GET https://api.nuget.org/v3-flatcontainer/system.collections.concurrent/4.3.0/system.collections.concurrent.4.3.0.nupkg info : GET https://api.nuget.org/v3-flatcontainer/system.threading.tasks/4.3.0/system.threading.tasks.4.3.0.nupkg info : GET https://api.nuget.org/v3-flatcontainer/system.text.encoding/4.3.0/system.text.encoding.4.3.0.nupkg info : OK https://api.nuget.org/v3-flatcontainer/system.collections.concurrent/4.3.0/system.collections.concurrent.4.3.0.nupkg 73 ミリ秒 info : OK https://api.nuget.org/v3-flatcontainer/system.threading.tasks/4.3.0/system.threading.tasks.4.3.0.nupkg 62 ミリ秒 info : OK https://api.nuget.org/v3-flatcontainer/system.text.encoding/4.3.0/system.text.encoding.4.3.0.nupkg 57 ミリ秒 info : OK https://api.nuget.org/v3-flatcontainer/system.collections/index.json 2596 ミリ秒 info : GET https://api.nuget.org/v3-flatcontainer/system.collections/4.3.0/system.collections.4.3.0.nupkg info : OK https://api.nuget.org/v3-flatcontainer/system.globalization/index.json 2583 ミリ秒 info : GET https://api.nuget.org/v3-flatcontainer/system.globalization/4.3.0/system.globalization.4.3.0.nupkg info : OK https://api.nuget.org/v3-flatcontainer/system.globalization/4.3.0/system.globalization.4.3.0.nupkg 226 ミリ秒 info : OK https://api.nuget.org/v3-flatcontainer/system.collections/4.3.0/system.collections.4.3.0.nupkg 246 ミリ秒 info : OK https://api.nuget.org/v3-flatcontainer/system.reflection.emit.lightweight/index.json 2826 ミリ秒 info : OK https://api.nuget.org/v3-flatcontainer/system.diagnostics.debug/index.json 2898 ミリ秒 info : OK https://api.nuget.org/v3-flatcontainer/system.reflection.emit.ilgeneration/index.json 2837 ミリ秒 info : OK https://api.nuget.org/v3-flatcontainer/system.xml.xdocument/index.json 2748 ミリ秒 info : OK https://api.nuget.org/v3-flatcontainer/system.reflection/index.json 2809 ミリ秒 info : OK https://api.nuget.org/v3-flatcontainer/system.reflection.extensions/index.json 2840 ミリ秒 info : OK https://api.nuget.org/v3-flatcontainer/system.linq/index.json 2895 ミリ秒 info : OK https://api.nuget.org/v3-flatcontainer/system.xml.xmldocument/index.json 2839 ミリ秒 info : GET https://api.nuget.org/v3-flatcontainer/system.reflection/4.3.0/system.reflection.4.3.0.nupkg info : OK https://api.nuget.org/v3-flatcontainer/system.reflection.primitives/index.json 2925 ミリ秒 info : GET https://api.nuget.org/v3-flatcontainer/system.reflection.emit.lightweight/4.3.0/system.reflection.emit.lightweight.4.3.0.nupkg info : GET https://api.nuget.org/v3-flatcontainer/system.xml.xdocument/4.3.0/system.xml.xdocument.4.3.0.nupkg info : GET https://api.nuget.org/v3-flatcontainer/system.reflection.emit.ilgeneration/4.3.0/system.reflection.emit.ilgeneration.4.3.0.nupkg info : GET https://api.nuget.org/v3-flatcontainer/system.reflection.extensions/4.3.0/system.reflection.extensions.4.3.0.nupkg info : GET https://api.nuget.org/v3-flatcontainer/system.linq/4.3.0/system.linq.4.3.0.nupkg info : GET https://api.nuget.org/v3-flatcontainer/system.xml.xmldocument/4.3.0/system.xml.xmldocument.4.3.0.nupkg info : GET https://api.nuget.org/v3-flatcontainer/system.diagnostics.debug/4.3.0/system.diagnostics.debug.4.3.0.nupkg info : GET https://api.nuget.org/v3-flatcontainer/system.reflection.primitives/4.3.0/system.reflection.primitives.4.3.0.nupkg info : OK https://api.nuget.org/v3-flatcontainer/system.reflection/4.3.0/system.reflection.4.3.0.nupkg 173 ミリ秒 info : OK https://api.nuget.org/v3-flatcontainer/system.xml.xdocument/4.3.0/system.xml.xdocument.4.3.0.nupkg 125 ミリ秒 info : OK https://api.nuget.org/v3-flatcontainer/system.reflection.extensions/4.3.0/system.reflection.extensions.4.3.0.nupkg 128 ミリ秒 info : OK https://api.nuget.org/v3-flatcontainer/system.reflection.emit.lightweight/4.3.0/system.reflection.emit.lightweight.4.3.0.nupkg 155 ミリ秒 info : OK https://api.nuget.org/v3-flatcontainer/system.xml.xmldocument/4.3.0/system.xml.xmldocument.4.3.0.nupkg 142 ミリ秒 info : OK https://api.nuget.org/v3-flatcontainer/system.linq/4.3.0/system.linq.4.3.0.nupkg 148 ミリ秒 info : OK https://api.nuget.org/v3-flatcontainer/system.reflection.primitives/4.3.0/system.reflection.primitives.4.3.0.nupkg 147 ミリ秒 info : OK https://api.nuget.org/v3-flatcontainer/system.diagnostics.debug/4.3.0/system.diagnostics.debug.4.3.0.nupkg 165 ミリ秒 info : OK https://api.nuget.org/v3-flatcontainer/system.reflection.emit.ilgeneration/4.3.0/system.reflection.emit.ilgeneration.4.3.0.nupkg 464 ミリ秒 info : GET https://api.nuget.org/v3-flatcontainer/system.diagnostics.tracing/index.json info : GET https://api.nuget.org/v3-flatcontainer/system.diagnostics.tools/index.json info : OK https://api.nuget.org/v3-flatcontainer/system.diagnostics.tools/index.json 193 ミリ秒 info : GET https://api.nuget.org/v3-flatcontainer/system.diagnostics.tools/4.3.0/system.diagnostics.tools.4.3.0.nupkg info : OK https://api.nuget.org/v3-flatcontainer/system.diagnostics.tools/4.3.0/system.diagnostics.tools.4.3.0.nupkg 29 ミリ秒 info : OK https://api.nuget.org/v3-flatcontainer/system.diagnostics.tracing/index.json 772 ミリ秒 info : GET https://api.nuget.org/v3-flatcontainer/system.diagnostics.tracing/4.3.0/system.diagnostics.tracing.4.3.0.nupkg info : OK https://api.nuget.org/v3-flatcontainer/system.diagnostics.tracing/4.3.0/system.diagnostics.tracing.4.3.0.nupkg 48 ミリ秒 info : OK https://api.nuget.org/v3-flatcontainer/system.runtime.extensions/index.json 5845 ミリ秒 info : OK https://api.nuget.org/v3-flatcontainer/system.resources.resourcemanager/index.json 5852 ミリ秒 info : GET https://api.nuget.org/v3-flatcontainer/system.runtime.extensions/4.3.0/system.runtime.extensions.4.3.0.nupkg info : GET https://api.nuget.org/v3-flatcontainer/system.resources.resourcemanager/4.3.0/system.resources.resourcemanager.4.3.0.nupkg info : OK https://api.nuget.org/v3-flatcontainer/system.runtime.serialization.primitives/index.json 5875 ミリ秒 info : OK https://api.nuget.org/v3-flatcontainer/system.text.regularexpressions/index.json 5857 ミリ秒 info : OK https://api.nuget.org/v3-flatcontainer/system.runtime.extensions/4.3.0/system.runtime.extensions.4.3.0.nupkg 45 ミリ秒 info : OK https://api.nuget.org/v3-flatcontainer/system.reflection.typeextensions/index.json 5910 ミリ秒 info : OK https://api.nuget.org/v3-flatcontainer/system.threading/index.json 5850 ミリ秒 info : OK https://api.nuget.org/v3-flatcontainer/system.text.encoding.extensions/index.json 5872 ミリ秒 info : OK https://api.nuget.org/v3-flatcontainer/system.xml.xmlserializer/index.json 5843 ミリ秒 info : OK https://api.nuget.org/v3-flatcontainer/system.resources.resourcemanager/4.3.0/system.resources.resourcemanager.4.3.0.nupkg 78 ミリ秒 info : GET https://api.nuget.org/v3-flatcontainer/system.text.encoding.extensions/4.3.0/system.text.encoding.extensions.4.3.0.nupkg info : OK https://api.nuget.org/v3-flatcontainer/system.xml.readerwriter/index.json 5996 ミリ秒 info : GET https://api.nuget.org/v3-flatcontainer/system.threading/4.3.0/system.threading.4.3.0.nupkg info : GET https://api.nuget.org/v3-flatcontainer/system.reflection.typeextensions/4.3.0/system.reflection.typeextensions.4.3.0.nupkg info : GET https://api.nuget.org/v3-flatcontainer/system.runtime.serialization.primitives/4.3.0/system.runtime.serialization.primitives.4.3.0.nupkg info : OK https://api.nuget.org/v3-flatcontainer/system.text.encoding.extensions/4.3.0/system.text.encoding.extensions.4.3.0.nupkg 54 ミリ秒 info : GET https://api.nuget.org/v3-flatcontainer/system.text.regularexpressions/4.3.0/system.text.regularexpressions.4.3.0.nupkg info : GET https://api.nuget.org/v3-flatcontainer/system.xml.xmlserializer/4.3.0/system.xml.xmlserializer.4.3.0.nupkg info : GET https://api.nuget.org/v3-flatcontainer/system.xml.readerwriter/4.3.0/system.xml.readerwriter.4.3.0.nupkg info : OK https://api.nuget.org/v3-flatcontainer/system.threading/4.3.0/system.threading.4.3.0.nupkg 128 ミリ秒 info : OK https://api.nuget.org/v3-flatcontainer/system.reflection.typeextensions/4.3.0/system.reflection.typeextensions.4.3.0.nupkg 120 ミリ秒 info : OK https://api.nuget.org/v3-flatcontainer/system.xml.readerwriter/4.3.0/system.xml.readerwriter.4.3.0.nupkg 106 ミリ秒 info : OK https://api.nuget.org/v3-flatcontainer/system.xml.xmlserializer/4.3.0/system.xml.xmlserializer.4.3.0.nupkg 242 ミリ秒 info : OK https://api.nuget.org/v3-flatcontainer/system.runtime.serialization.primitives/4.3.0/system.runtime.serialization.primitives.4.3.0.nupkg 295 ミリ秒 info : OK https://api.nuget.org/v3-flatcontainer/system.text.regularexpressions/4.3.0/system.text.regularexpressions.4.3.0.nupkg 296 ミリ秒 info : GET https://api.nuget.org/v3-flatcontainer/system.reflection.emit/index.json info : GET https://api.nuget.org/v3-flatcontainer/system.io.filesystem/index.json info : GET https://api.nuget.org/v3-flatcontainer/system.io.filesystem.primitives/index.json info : GET https://api.nuget.org/v3-flatcontainer/system.runtime.interopservices/index.json info : GET https://api.nuget.org/v3-flatcontainer/system.threading.tasks.extensions/index.json info : OK https://api.nuget.org/v3-flatcontainer/system.reflection.emit/index.json 603 ミリ秒 info : GET https://api.nuget.org/v3-flatcontainer/system.reflection.emit/4.3.0/system.reflection.emit.4.3.0.nupkg info : OK https://api.nuget.org/v3-flatcontainer/system.reflection.emit/4.3.0/system.reflection.emit.4.3.0.nupkg 28 ミリ秒 info : OK https://api.nuget.org/v3-flatcontainer/system.io.filesystem/index.json 595 ミリ秒 info : OK https://api.nuget.org/v3-flatcontainer/system.io.filesystem.primitives/index.json 595 ミリ秒 info : OK https://api.nuget.org/v3-flatcontainer/system.runtime.interopservices/index.json 591 ミリ秒 info : GET https://api.nuget.org/v3-flatcontainer/system.io.filesystem/4.3.0/system.io.filesystem.4.3.0.nupkg info : GET https://api.nuget.org/v3-flatcontainer/system.io.filesystem.primitives/4.3.0/system.io.filesystem.primitives.4.3.0.nupkg info : OK https://api.nuget.org/v3-flatcontainer/system.threading.tasks.extensions/index.json 594 ミリ秒 info : GET https://api.nuget.org/v3-flatcontainer/system.runtime.interopservices/4.3.0/system.runtime.interopservices.4.3.0.nupkg info : OK https://api.nuget.org/v3-flatcontainer/system.io.filesystem/4.3.0/system.io.filesystem.4.3.0.nupkg 23 ミリ秒 info : GET https://api.nuget.org/v3-flatcontainer/system.threading.tasks.extensions/4.3.0/system.threading.tasks.extensions.4.3.0.nupkg info : OK https://api.nuget.org/v3-flatcontainer/system.io.filesystem.primitives/4.3.0/system.io.filesystem.primitives.4.3.0.nupkg 33 ミリ秒 info : OK https://api.nuget.org/v3-flatcontainer/system.runtime.interopservices/4.3.0/system.runtime.interopservices.4.3.0.nupkg 65 ミリ秒 info : OK https://api.nuget.org/v3-flatcontainer/system.threading.tasks.extensions/4.3.0/system.threading.tasks.extensions.4.3.0.nupkg 68 ミリ秒 info : GET https://api.nuget.org/v3-flatcontainer/system.runtime.handles/index.json info : OK https://api.nuget.org/v3-flatcontainer/system.runtime.handles/index.json 610 ミリ秒 info : GET https://api.nuget.org/v3-flatcontainer/system.runtime.handles/4.3.0/system.runtime.handles.4.3.0.nupkg info : OK https://api.nuget.org/v3-flatcontainer/system.runtime.handles/4.3.0/system.runtime.handles.4.3.0.nupkg 30 ミリ秒 info : System.Runtime.Handles 4.3.0 をインストールしています。 info : System.Runtime.InteropServices 4.3.0 をインストールしています。 info : System.IO.FileSystem 4.3.0 をインストールしています。 info : System.IO.FileSystem.Primitives 4.3.0 をインストールしています。 info : System.Threading.Tasks.Extensions 4.3.0 をインストールしています。 info : System.Reflection.Emit 4.3.0 をインストールしています。 info : System.Diagnostics.Tracing 4.3.0 をインストールしています。 info : System.Diagnostics.Tools 4.3.0 をインストールしています。 info : System.Xml.ReaderWriter 4.3.0 をインストールしています。 info : System.Xml.XmlSerializer 4.3.0 をインストールしています。 info : System.Text.RegularExpressions 4.3.0 をインストールしています。 info : System.Threading 4.3.0 をインストールしています。 info : System.Runtime.Serialization.Primitives 4.3.0 をインストールしています。 info : System.Text.Encoding.Extensions 4.3.0 をインストールしています。 info : System.Runtime.Extensions 4.3.0 をインストールしています。 info : System.Reflection.TypeExtensions 4.3.0 をインストールしています。 info : System.Runtime 4.3.0 をインストールしています。 info : System.IO 4.3.0 をインストールしています。 info : System.Runtime.Serialization.Json 4.3.0 をインストールしています。 info : System.Private.DataContractSerialization 4.3.0 をインストールしています。 info : Microsoft.NETCore.Platforms 1.1.0 をインストールしています。 info : Microsoft.NETCore.Targets 1.1.0 をインストールしています。 info : System.Text.Encoding 4.3.0 をインストールしています。 info : System.Threading.Tasks 4.3.0 をインストールしています。 info : System.Reflection.Extensions 4.3.0 をインストールしています。 info : System.Reflection.Primitives 4.3.0 をインストールしています。 info : System.Xml.XmlDocument 4.3.0 をインストールしています。 info : System.Resources.ResourceManager 4.3.0 をインストールしています。 info : System.Reflection.Emit.Lightweight 4.3.0 をインストールしています。 info : System.Collections 4.3.0 をインストールしています。 info : System.Reflection.Emit.ILGeneration 4.3.0 をインストールしています。 info : System.Globalization 4.3.0 をインストールしています。 info : System.Reflection 4.3.0 をインストールしています。 info : System.Diagnostics.Debug 4.3.0 をインストールしています。 info : System.Linq 4.3.0 をインストールしています。 info : System.Xml.XDocument 4.3.0 をインストールしています。 info : System.Collections.Concurrent 4.3.0 をインストールしています。 info : パッケージ 'System.Runtime.Serialization.Json' は、プロジェクト '/tmp/work/RestClient/RestClient.csproj' のすべての指定されたフレームワークとの互換性があります。 info : ファイル '/tmp/work/RestClient/RestClient.csproj' に追加されたパッケージ 'System.Runtime.Serialization.Json' バージョン '4.3.0' の PackageReference。 info : 復元をコミットしています... info : アセット ファイルをディスクに書き込んでいます。パス: /tmp/work/RestClient/obj/project.assets.json log : /tmp/work/RestClient/RestClient.csproj の復元が 25.17 sec で完了しました。
$ dotnet add package System.Runtime.Serialization.Primitives Writing /tmp/tmpBPFa2e.tmp info : パッケージ 'System.Runtime.Serialization.Primitives' の PackageReference をプロジェクト '/tmp/work/RestClient/RestClient.csproj' に追加しています。 info : /tmp/work/RestClient/RestClient.csproj のパッケージを復元しています... info : CACHE https://api.nuget.org/v3-flatcontainer/system.runtime.serialization.primitives/index.json info : パッケージ 'System.Runtime.Serialization.Primitives' は、プロジェクト '/tmp/work/RestClient/RestClient.csproj' のすべての指定されたフレームワークとの互換性があります。 info : ファイル '/tmp/work/RestClient/RestClient.csproj' に追加されたパッケージ 'System.Runtime.Serialization.Primitives' バージョン '4.3.0' の PackageReference。 info : 復元をコミットしています... info : アセット ファイルをディスクに書き込んでいます。パス: /tmp/work/RestClient/obj/project.assets.json log : /tmp/work/RestClient/RestClient.csproj の復元が 1.78 sec で完了しました。
コード
Code5.cs
using System; namespace RestClient { class Program { static void Main(string[] args) { new Code5().Run(); } } }
Code5.cs
using System; using System.Threading.Tasks; using System.Net.Http; using System.Net.Http.Headers; using System.Collections.Generic; using System.Runtime.Serialization.Json; using System.Runtime.Serialization; using System.Globalization; namespace RestClient { class Code5 { private static readonly HttpClient client = new HttpClient(); public void Run() { var repositories = ProcessRepositories().Result; foreach (var repo in repositories) { Console.WriteLine(repo.Name); Console.WriteLine(repo.Description); Console.WriteLine(repo.GitHubHomeUrl); Console.WriteLine(repo.Homepage); Console.WriteLine(repo.Watchers); Console.WriteLine(repo.LastPush); Console.WriteLine(); } } private async Task<List<Repository5>> ProcessRepositories() { client.DefaultRequestHeaders.Accept.Clear(); client.DefaultRequestHeaders.Accept.Add( new MediaTypeWithQualityHeaderValue("application/vnd.github.v3+json")); client.DefaultRequestHeaders.Add("User-Agent", ".NET Foundation Repository5 Reporter"); var streamTask = client.GetStreamAsync("https://api.github.com/orgs/dotnet/repos"); var serializer = new DataContractJsonSerializer(typeof(List<Repository5>)); return serializer.ReadObject(await streamTask) as List<Repository5>; } } // JSONの"repo"ノードをマッピングする [DataContract(Name="repo")] public class Repository5 { [DataMember(Name="name")] public string Name { get; set; } [DataMember(Name="description")] public string Description { get; set; } [DataMember(Name="html_url")] public Uri GitHubHomeUrl { get; set; } [DataMember(Name="homepage")] public Uri Homepage { get; set; } [DataMember(Name="watchers")] public int Watchers { get; set; } [DataMember(Name="pushed_at")] private string JsonDate { get; set; } [IgnoreDataMember] public DateTime LastPush { get { return DateTime.ParseExact(JsonDate, "yyyy-MM-ddTHH:mm:ssZ", CultureInfo.InvariantCulture); } } } }
実行結果
$ dotnet run BenchmarkDotNet Powerful .NET library for benchmarking https://github.com/dotnet/BenchmarkDotNet https://benchmarkdotnet.org/ 4566 2019/10/19 7:22:41 reactive The Reactive Extensions for .NET https://github.com/dotnet/reactive http://reactivex.io/ 3909 2019/10/15 6:08:00 foundation This is the hub for all the projects that are part of the .NET Foundation. MD files in the projects folder feed the content on the .NET Foundation website https://github.com/dotnet/foundation http://www.dotnetfoundation.org/ 1018 2019/10/02 5:30:21 corefx CoreFX is the foundational class libraries for .NET Core. It includes types for collections, file systems, console, JSON, XML, async and many others. https://github.com/dotnet/corefx https://docs.microsoft.com/dotnet/core/ 17597 2019/10/19 9:31:08 buildtools Build tools that are necessary for building the .NET Core projects https://github.com/dotnet/buildtools 481 2019/07/31 4:09:26 core Home repository for .NET Core https://github.com/dotnet/core 12101 2019/10/19 4:08:37 orleans Orleans is a cross-platform framework for building distributed applications with .NET https://github.com/dotnet/orleans http://dotnet.github.io/orleans 5582 2019/10/19 9:20:05 codeformatter Tool that uses Roslyn to automatically rewrite the source to follow our coding styles https://github.com/dotnet/codeformatter 1038 2019/02/10 6:29:48 apireviews This repository contains the notes and API differences that we reviewed. https://github.com/dotnet/apireviews 128 2019/10/11 6:25:39 fsharp The F# compiler, FSharp.Core library, and tools for F# https://github.com/dotnet/fsharp https://www.microsoft.com/net/learn/languages/fsharp 1987 2019/10/19 9:06:38 roslyn The Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs. https://github.com/dotnet/roslyn https://docs.microsoft.com/dotnet/csharp/roslyn-sdk/ 12008 2019/10/19 9:20:35 corefxlab This repo is for experimentation and exploring new ideas that may or may not make it into the main corefx repo. https://github.com/dotnet/corefxlab 1319 2019/10/19 8:51:43 dotnet.github.io The source for the dotnet.github.io site https://github.com/dotnet/dotnet.github.io https://dotnet.github.io/ 42 2019/03/26 15:13:16 llilc This repo contains LLILC, an LLVM based compiler for .NET Core. It includes a set of cross-platform .NET code generation tools that enables compilation of MSIL byte code to LLVM supported platforms. https://github.com/dotnet/llilc 1394 2019/06/03 7:42:58 coreclr CoreCLR is the runtime for .NET Core. It includes the garbage collector, JIT compiler, primitive data types and low-level classes. https://github.com/dotnet/coreclr https://docs.microsoft.com/dotnet/core/ 12142 2019/10/19 9:35:01 dotnet-ci Repository containing scripting for the dotnet-ci Jenkins instance. https://github.com/dotnet/dotnet-ci 85 2019/05/15 1:42:04 corefx-testdata Test assets that are required by the corefx repository, and referenced as nuget packages. https://github.com/dotnet/corefx-testdata 9 2019/09/27 3:33:59 port-to-core This repo contains portability analysis reports. https://github.com/dotnet/port-to-core 5 2018/10/26 16:05:42 swag Artwork used to create .NET Foundation swag (T-Shirts, Mugs etc) https://github.com/dotnet/swag 226 2019/06/18 13:40:32 wcf This repo contains the client-oriented WCF libraries that enable applications built on .NET Core to communicate with WCF services. https://github.com/dotnet/wcf 1281 2019/10/19 9:18:45 docs This repository contains .NET Documentation. https://github.com/dotnet/docs https://docs.microsoft.com/dotnet 2013 2019/10/19 8:56:09 roslyn-analyzers https://github.com/dotnet/roslyn-analyzers 665 2019/10/19 9:10:32 docfx Tools for building and publishing API documentation for .NET projects https://github.com/dotnet/docfx https://dotnet.github.io/docfx/ 1907 2019/10/19 6:37:31 corert This repo contains CoreRT, an experimental .NET Core runtime optimized for AOT (ahead of time compilation) scenarios, with the accompanying compiler toolchain. https://github.com/dotnet/corert http://dot.net/ 2391 2019/10/18 3:57:35 corefx-tools Place to include various misc tools for .NET and .NET Core. https://github.com/dotnet/corefx-tools 52 2019/08/23 3:31:16 cli The .NET Core command-line (CLI) tools, used for building .NET Core apps and libraries through your development flow (compiling, NuGet package management, running, testing, ...). https://github.com/dotnet/cli https://github.com/dotnet/core 3408 2019/10/19 9:50:12 symreader Managed definitions for COM interfaces exposed by DiaSymReader APIs https://github.com/dotnet/symreader 32 2019/10/18 21:04:45 roslyn-analyzers-contrib https://github.com/dotnet/roslyn-analyzers-contrib 16 2015/11/22 1:28:29 dotnet-docker Docker images for .NET Core and the .NET Core Tools. https://github.com/dotnet/dotnet-docker https://hub.docker.com/_/microsoft-dotnet-core 1881 2019/10/19 5:41:58 dnx.xunit DNX runner for xUnit.net (please open issues in https://github.com/xunit/xunit) https://github.com/dotnet/dnx.xunit 3 2015/11/26 2:04:28
所感
これはやって良かった。HTTP通信がかなり簡単にできそうなことがわかった。JSONマッピングが少し面倒な気がするが。とくに日付型が残念。
対象環境
- Raspbierry pi 3 Model B+
- Raspbian stretch 9.0 2018-11-13 ※
- bash 4.4.12(1)-release ※
- SQLite 3.29.0 ※
- C# dotnet 3.0.100
$ uname -a Linux raspberrypi 4.19.42-v7+ #1218 SMP Tue May 14 00:48:17 BST 2019 armv7l GNU/Linux