{"id":353897,"date":"2024-05-20T22:37:32","date_gmt":"2024-05-20T22:37:32","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=353897"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=353897","title":{"rendered":"<span>\u0418\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f API \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0434\u043b\u044f .NET<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/379\/af4\/0c2\/379af40c2c2104909b18b07b69c6cb81.png\" width=\"1000\" height=\"300\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/379\/af4\/0c2\/379af40c2c2104909b18b07b69c6cb81.png\"\/><\/figure>\n<p>\u0412 \u043d\u0430\u0447\u0430\u043b\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0443 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0432\u0441\u0435\u0433\u0434\u0430 \u043f\u043e\u044f\u0432\u043b\u044f\u043b\u0441\u044f \u0432\u043e\u043f\u0440\u043e\u0441, \u043a\u0430\u043a\u0443\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0434\u043b\u044f \u043c\u0435\u0436\u0441\u0435\u0440\u0432\u0438\u0441\u043d\u043e\u0433\u043e \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f? \u0410 \u043a\u0430\u043a\u0443\u044e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u043f\u043e\u0445\u043e\u0434\u043e\u0432 \u0432 \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u044b? \u0410 \u0447\u0442\u043e \u0442\u0430\u043c \u0441 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c? \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u043b\u0441\u044f \u0432\u043a\u0440\u0430\u0442\u0446\u0435 \u043e\u0441\u0432\u0435\u0442\u0438\u0442\u044c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u043e\u0431\u0451\u0440\u0442\u043a\u0438 \u043d\u0430\u0434 HttpClient.<\/p>\n<h2>Flurl<\/h2>\n<p>\u041d\u0430\u0447\u043d\u0451\u043c \u0441 <a href=\"https:\/\/flurl.dev\/\" rel=\"noopener noreferrer nofollow\">Flurl<\/a>, \u0434\u0430\u043d\u043d\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0445\u043e\u0440\u043e\u0448\u0435\u0435 \u0441\u043e\u0447\u0435\u0442\u0430\u043d\u0438\u0435 URL \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430 \u0438 API \u043a\u043b\u0438\u0435\u043d\u0442\u0430, \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c Fluent Interface \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430.<\/p>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 POST \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438, \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u0438 \u0442\u0435\u043b\u043e\u043c, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0434\u0435\u0441\u0435\u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u0432 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u0442\u0438\u043f \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a:<\/p>\n<pre><code class=\"cs\">var person = await \"https:\/\/api.com\" \u00a0\u00a0\u00a0 .AppendPathSegment(\"person\") \u00a0\u00a0\u00a0 .SetQueryParams(new { a = 1, b = 2 }) \u00a0\u00a0\u00a0 .WithOAuthBearerToken(\"my_oauth_token\") \u00a0\u00a0\u00a0 .PostJsonAsync(new \u00a0\u00a0\u00a0 { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 first_name = \"Claire\", \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 last_name = \"Underwood\" \u00a0\u00a0\u00a0 }) \u00a0\u00a0\u00a0 .ReceiveJson&lt;Person>();<\/code><\/pre>\n<p>\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0443\u0434\u043e\u0431\u043d\u0430 \u043f\u0440\u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u043e\u0436\u043d\u043e \u0443\u0434\u043e\u0431\u043d\u043e \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c URL \u043d\u0430 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0435:<\/p>\n<pre><code class=\"cs\">var url = new Url(\"https:\/\/user:pass@www.mysite.com:1234\/with\/path?x=1&amp;y=2#foo\"); Assert.AreEqual(\"https\", url.Scheme); Assert.AreEqual(\"user:pass\", url.UserInfo); Assert.AreEqual(\"www.mysite.com\", url.Host); Assert.AreEqual(1234, url.Port); Assert.AreEqual(\"user:pass@www.mysite.com:1234\", url.Authority); Assert.AreEqual(\"https:\/\/user:pass@www.mysite.com:1234\", url.Root); Assert.AreEqual(\"\/with\/path\", url.Path); Assert.AreEqual(\"x=1&amp;y=2\", url.Query); Assert.AreEqual(\"foo\", url.Fragment);<\/code><\/pre>\n<p> \u0418\u043b\u0438 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0435\u0441\u0442 \u0432 \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u044b\u043c AAA \u0441\u0442\u0438\u043b\u0435:<\/p>\n<pre><code class=\"cs\">using (var httpTest = new HttpTest()) { \u00a0\u00a0\u00a0 \/\/ arrange \u00a0\u00a0\u00a0 httpTest.RespondWith(\"OK\", 200); \u00a0\u00a0\u00a0 \/\/ act \u00a0\u00a0\u00a0 await sut.CreatePersonAsync(); \u00a0\u00a0\u00a0 \/\/ assert \u00a0\u00a0\u00a0 httpTest.ShouldHaveCalled(\"https:\/\/api.com\/*\") \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 .WithVerb(HttpMethod.Post) \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 .WithContentType(\"application\/json\"); }<\/code><\/pre>\n<p>\u041c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0442\u0435\u0441\u0442 \u043f\u043e\u0434 \u043d\u0443\u0436\u043d\u044b\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432:<\/p>\n<pre><code class=\"cs\">using var httpTest = new HttpTest();  httpTest \u00a0\u00a0\u00a0 .ForCallsTo(\"*.api.com*\", \"*.test-api.com*\") \/\/ multiple allowed, wildcard supported \u00a0\u00a0\u00a0 .WithVerb(\"put\", \"PATCH\") \/\/ or HttpMethod.Put, HttpMethod.Patch \u00a0\u00a0\u00a0 .WithQueryParam(\"x\", \"a*\") \/\/ value optional, wildcard supported \u00a0\u00a0\u00a0 .WithQueryParams(new { y = 2, z = 3 }) \u00a0\u00a0\u00a0 .WithAnyQueryParam(\"a\", \"b\", \"c\") \u00a0\u00a0\u00a0 .WithoutQueryParam(\"d\") \u00a0\u00a0\u00a0 .WithHeader(\"h1\", \"f*o\") \/\/ value optional, wildcard supported \u00a0\u00a0\u00a0 .WithoutHeader(\"h2\") \u00a0\u00a0\u00a0 .WithRequestBody(\"*something*\") \/\/ wildcard supported \u00a0\u00a0\u00a0 .WithRequestJson(new { a = \"*\", b = \"hi\" }) \/\/ wildcard supported in sting values \u00a0\u00a0\u00a0 .With(call => true) \/\/ check anything on the FlurlCall \u00a0\u00a0\u00a0 .Without(call => false) \/\/ check anything on the FlurlCall \u00a0\u00a0\u00a0 .RespondWith(\"all conditions met!\", 200);<\/code><\/pre>\n<p>\u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0438\u0437 \u0441\u0435\u0431\u044f \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u044e \u0443\u0440\u043e\u0432\u043d\u0435\u0439, \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u043e\u0442 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u043e\u0439, \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u043c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u0430. \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043a\u0430\u0436\u0434\u044b\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0438 \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f.<\/p>\n<p>\u0412\u0441\u0435\u0433\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u043d\u0435 \u0442\u0430\u043a \u043c\u043d\u043e\u0433\u043e, \u043d\u043e \u0432 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0432\u0441\u0435 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435: Timeout, AllowedHttpStatusRange, JsonSerializer, UrlEncodedSerializer, Redirects, BeforeCall, AfterCall, OnError, OnRedirect.<\/p>\n<p>\u00a0<\/p>\n<p>\u0414\u0430\u043d\u043d\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0430\u0441\u044c \u043c\u043d\u0435 \u0443\u0434\u043e\u0431\u043d\u043e\u0439 \u043a\u0430\u043a \u0438 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430 \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u0442\u0430\u043a \u0438 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043e\u0441\u043d\u043e\u0432\u044b \u0434\u043b\u044f API \u043a\u043b\u0438\u0435\u043d\u0442\u0430.<\/p>\n<p><strong>\u00a0<\/strong><\/p>\n<h2>NSwagStudio <\/h2>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/c4b\/3ef\/e56\/c4b3efe56f65d844a1907891c85d3aa0.png\" width=\"676\" height=\"554\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c4b\/3ef\/e56\/c4b3efe56f65d844a1907891c85d3aa0.png\"\/><\/figure>\n<p>\u0414\u0443\u043c\u0430\u044e, \u043c\u043d\u043e\u0433\u043e \u043a\u0442\u043e \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u043b\u0441\u044f \u0441 <a href=\"https:\/\/github.com\/RicoSuter\/NSwag\/wiki\/NSwagStudio\" rel=\"noopener noreferrer nofollow\">NSwagStudio<\/a>. \u041d\u0430 \u044d\u0442\u043e\u0442 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043c\u043d\u043e\u0433\u043e \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0431\u0443\u0434\u0443 \u043a\u0440\u0430\u0442\u043e\u043a. <\/p>\n<p>\u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e NSwagStudio \u043c\u043e\u0436\u043d\u043e:<\/p>\n<ul>\n<li>\n<p>\u0413\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c C# \u043a\u043b\u0438\u0435\u043d\u0442\/\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440.<\/p>\n<\/li>\n<li>\n<p>\u0413\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c TS \u043a\u043b\u0438\u0435\u043d\u0442.<\/p>\n<\/li>\n<li>\n<p>\u041d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430.<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/blog.sanderaernouts.com\/autogenerate-csharp-api-client-with-nswag\" rel=\"noopener noreferrer nofollow\">\u0420\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044e \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u043f\u0440\u0438 \u0441\u0431\u043e\u0440\u043a\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0435.<\/a><\/p>\n<\/li>\n<\/ul>\n<p>\u0412\u0441\u0451 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u043e\u0435 \u0434\u0435\u043b\u0430\u0435\u0442 \u0438\u0437 NSwagStudio \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f API \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432, \u043d\u043e \u0435\u0441\u0442\u044c \u0438 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043c\u0438\u043d\u0443\u0441, \u043e\u043d \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u043e, \u0447\u0442\u043e \u0443\u043c\u0435\u0435\u0442. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0445\u0438\u0442\u0440\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043e\u0448\u0438\u0431\u043e\u043a, \u0442\u043e \u0441\u043a\u043e\u0440\u0435\u0439 \u0432\u0441\u0435\u0433\u043e \u044d\u0442\u043e\u0442 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0432\u0430\u043c \u043d\u0435 \u043f\u043e\u0434\u043e\u0439\u0434\u0451\u0442.<\/p>\n<h2>RestSharp<\/h2>\n<p><a href=\"https:\/\/restsharp.dev\/\" rel=\"noopener noreferrer nofollow\">RestSharp <\/a>\u043f\u043e\u0437\u0438\u0446\u0438\u043e\u043d\u0438\u0440\u0443\u0435\u0442 \u0441\u0435\u0431\u044f \u043a\u0430\u043a \u043b\u0435\u0433\u043a\u043e\u0432\u0435\u0441\u043d\u0430\u044f REST API Client \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u0430\u044f AWS.<\/p>\n<p>\u0422\u0438\u043f\u0438\u0447\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0438\u0441 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c RestSharp \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a:<\/p>\n<pre><code class=\"cs\">public class TwitterClient : ITwitterClient, IDisposable { \u00a0\u00a0\u00a0 readonly RestClient _client;  \u00a0\u00a0\u00a0 public TwitterClient(string apiKey, string apiKeySecret) { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 var options = new RestClientOptions(\"https:\/\/api.twitter.com\/2\");  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 _client = new RestClient(options) { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Authenticator = new TwitterAuthenticator(\"https:\/\/api.twitter.com\", apiKey, apiKeySecret) \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }; \u00a0\u00a0\u00a0 }  \u00a0\u00a0\u00a0 public async Task&lt;TwitterUser> GetUser(string user) { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 var response = await _client.GetJsonAsync&lt;TwitterSingleObject&lt;TwitterUser>>( \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \"users\/by\/username\/{user}\", \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 new { user } \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 return response!.Data; \u00a0\u00a0\u00a0 }  \u00a0\u00a0\u00a0 record TwitterSingleObject&lt;T>(T Data);  \u00a0\u00a0\u00a0 public void Dispose() { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 _client?.Dispose(); \u00a0\u00a0\u00a0 } }<\/code><\/pre>\n<p>\u00a0\u0417\u0430\u043f\u0440\u043e\u0441 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0431\u043e\u0433\u0430\u0442\u0438\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438, \u0442\u0435\u043b\u043e\u043c, Cookie, \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0430\u043c\u0438 \u0438 \u0442.\u0434.<\/p>\n<pre><code class=\"cs\">var request = new RestRequest(\"beavers\"); request.AddParameter(\"status\", 1); request.AddHeader(\"name\", \"value\");<\/code><\/pre>\n<p>\u00a0\u0422\u0430\u043a \u0436\u0435 \u0434\u043b\u044f \u0432\u0441\u0435\u0433\u043e RestClient \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b, \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0438 \u0438 \u0442. \u0434. \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e.<\/p>\n<pre><code class=\"cs\">RestClient client = new(\"https:\/\/localhost:44376\/\"); client.AddDefaultHeader(\"MyHeader\", \"default\");<\/code><\/pre>\n<p>\u0412\u044b\u0437\u043e\u0432 \u043c\u0435\u0442\u043e\u0434\u0430 \u043c\u043e\u0436\u043d\u043e \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0438\u0442\u044c \u0434\u0432\u0443\u043c\u044f \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u043c\u0438:<\/p>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u044b\u0437\u0432\u0430\u0432 ExecuteGetAsync \u0438\u043b\u0438 GetAsync. \u0412 \u043f\u0435\u0440\u0432\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 RestResponse, \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0442\u0430\u0449\u0438\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u0443\u044e \u0432 \u043e\u0442\u0432\u0435\u0442\u0435 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0438). \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0432\u044b\u0437\u043e\u0432\u044b \u0441 \u043f\u0440\u0435\u0444\u0438\u043a\u0441\u043e\u043c Execute \u043d\u0435 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u044e\u0442 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f, \u0435\u0433\u043e \u0432\u0430\u043c \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0438\u0437 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e \u043f\u043e\u043b\u044f.<\/p>\n<p>\u00a0<\/p>\n<p>RestSharp \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f REST API \u043a\u043b\u0438\u0435\u043d\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441 \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u044b\u0439 \u043e\u0442\u0432\u0435\u0442. \u0418\u0437 \u043c\u0438\u043d\u0443\u0441\u043e\u0432 \u044f \u043c\u043e\u0433\u0443 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043e\u0448\u0438\u0431\u043e\u043a \u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438, \u0432\u0430\u043c \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0435\u0451 \u0441\u0430\u043c\u043e\u043c\u0443.<\/p>\n<p>\u00a0<\/p>\n<h2>Refit <\/h2>\n<p><a href=\"https:\/\/github.com\/reactiveui\/refit\" rel=\"noopener noreferrer nofollow\">Refit <\/a>\u2013 REST \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f Api \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0434\u043e \u043c\u0438\u043d\u0438\u043c\u0443\u043c\u0430, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044f \u043e\u0431\u0448\u0438\u0440\u043d\u044b\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u043a\u0430\u0441\u0442\u043e\u043c\u0438\u0437\u0430\u0446\u0438\u0438.<\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u043e \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430:<\/p>\n<pre><code class=\"cs\">public interface IGitHubApi { \u00a0\u00a0\u00a0 [Get(\"\/users\/{user}\")] \u00a0\u00a0\u00a0 Task&lt;User> GetUser(string user); }<\/code><\/pre>\n<p>\u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c API \u043a\u043b\u0438\u0435\u043d\u0442 \u043c\u043e\u0436\u043d\u043e \u0447\u0435\u0440\u0435\u0437 \u043c\u0435\u0442\u043e\u0434 RestService.For&lt;T>:<\/p>\n<pre><code class=\"cs\">var gitHubApi = RestService.For&lt;IGitHubApi>(\"https:\/\/api.github.com\"); var octocat = await gitHubApi.GetUser(\"octocat\");<\/code><\/pre>\n<p>\u0418\u043b\u0438 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0432 IoC, \u0447\u0435\u0440\u0435\u0437 <a href=\"https:\/\/www.nuget.org\/packages\/Refit.HttpClientFactory\/\" rel=\"noopener noreferrer nofollow\">Refit.HttpClientFactory<\/a>:<\/p>\n<pre><code class=\"cs\">services \u00a0\u00a0\u00a0 .AddRefitClient&lt;IGitHubApi>() \u00a0\u00a0\u00a0 .ConfigureHttpClient(c => c.BaseAddress = new Uri(\"https:\/\/api.github.com\"));<\/code><\/pre>\n<p>\u00a0\u0424\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435.<\/p>\n<pre><code class=\"cs\">var gitHubApi = RestService.For&lt;IGitHubApi>(\"https:\/\/api.github.com\", \u00a0\u00a0\u00a0 new RefitSettings { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ContentSerializer = new NewtonsoftJsonContentSerializer( \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 new JsonSerializerSettings { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ContractResolver = new SnakeCasePropertyNamesContractResolver() \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 } \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 )});  var otherApi = RestService.For&lt;IOtherApi>(\"https:\/\/api.example.com\", \u00a0\u00a0\u00a0 new RefitSettings { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ContentSerializer = new NewtonsoftJsonContentSerializer( \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 new JsonSerializerSettings { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ContractResolver = new CamelCasePropertyNamesContractResolver() \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 } \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 )});<\/code><\/pre>\n<p>\u00a0<\/p>\n<p>\u0412 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439. \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u043a\u043b\u0430\u0441\u0441\u044b \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439 ValidationApiException \u0438 ApiException. \u0421\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u0432\u043e\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0434\u043b\u044f \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439 \u0438 \u043f\u043e\u043c\u0435\u043d\u044f\u0442\u044c \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u043d\u043e \u0447\u0435\u0440\u0435\u0437 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 ExceptionFactory.<\/p>\n<p>\u00a0<\/p>\n<p>\u0421\u0442\u043e\u0438\u0442 \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 <a href=\"https:\/\/github.com\/christianhelle\/refitter\" rel=\"noopener noreferrer nofollow\"><strong>Refitter<\/strong><\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439<strong> <\/strong>\u0430\u043a\u0442\u0438\u0432\u043d\u043e<strong> <\/strong>\u0440\u0430\u0437\u0432\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442\u0441\u044f. Refitter \u2014 \u044d\u0442\u043e \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0443\u0442\u0438\u043b\u0438\u0442\u0430 \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 Refit \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0438\u0437 OpenApi \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438. \u042d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u043e, \u0435\u0441\u043b\u0438 \u0432\u0430\u043c \u0437\u0430\u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u043c\u0438\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430 Refit, \u043d\u043e \u043d\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 \u043d\u0435 \u0445\u0432\u0430\u0442\u0430\u0435\u0442 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432.<\/p>\n<p>\u0415\u0449\u0451 \u043e\u0434\u043d\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043f\u043e\u0434 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c <a href=\"https:\/\/github.com\/Dreamescaper\/GenerateAspNetCoreClient\" rel=\"noopener noreferrer nofollow\">Generate AspNetCore Client<\/a> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c Refit \u043a\u043b\u0438\u0435\u043d\u0442\u044b \u0438\u0437 \u0433\u043e\u0442\u043e\u0432\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0431\u0435\u0437 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 OpenApi \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438. \u0414\u043e\u0441\u0442\u0438\u0433\u0430\u0435\u0442\u0441\u044f \u044d\u0442\u043e \u043f\u0443\u0442\u0451\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438 \u0432\u044b\u0442\u044f\u0433\u0438\u0432\u0430\u043d\u0438\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430\u0445. \u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043f\u043e\u0434\u043e\u0439\u0434\u0451\u0442 \u043d\u0435 \u0432\u0441\u0435\u043c, \u0442\u0430\u043a \u043a\u0430\u043a \u0441\u0434\u0435\u043b\u0430\u043d\u0430 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043a\u0440\u0438\u0432\u043e, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0435\u0441\u043b\u0438 \u0432\u0430\u0448 \u043f\u0440\u043e\u0435\u043a\u0442 \u043d\u0435 \u0442\u0430\u043a \u043f\u0440\u043e\u0441\u0442\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0431\u0435\u0437 \u0442\u0430\u043d\u0446\u0435\u0432 \u0441 \u0431\u0443\u0431\u043d\u043e\u043c.<\/p>\n<p>\u00a0<\/p>\n<h2>RestEase<\/h2>\n<p>\u041d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u0437\u0433\u043b\u044f\u0434 <a href=\"https:\/\/github.com\/canton7\/RestEase\" rel=\"noopener noreferrer nofollow\">RestEase<\/a> \u043c\u0430\u043b\u043e \u0447\u0435\u043c \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 Refit, \u0438, \u0431\u043e\u043b\u0435\u0435 \u0442\u043e\u0433\u043e, \u043f\u043e\u0447\u0442\u0438 \u0432\u0441\u0435 API \u043a\u043b\u0438\u0435\u043d\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b \u043d\u0430\u043f\u0438\u0448\u0435\u0442\u0435 \u043d\u0430 Refit, \u0437\u0430\u043f\u0443\u0441\u0442\u044f\u0442\u0441\u044f \u0438 \u043d\u0430 RestEase<strong>.<\/strong> \u041d\u043e \u043f\u043e \u043c\u0438\u043c\u043e \u0441\u0445\u043e\u0436\u0435\u0433\u043e \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430, \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u0432\u043e\u0438 \u0444\u0438\u0447\u0438. <\/p>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u043d\u0435 \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u043b\u0430\u0441\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 [QueryMap] \u0441\u043b\u043e\u0432\u0430\u0440\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432, \u044d\u0442\u043e \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u043d\u0435 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b \u0438\u043b\u0438 \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438. <\/p>\n<p>\u0414\u0440\u0443\u0433\u0430\u044f \u043d\u0435 \u043c\u0435\u043d\u0435\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0430\u044f \u0444\u0438\u0447\u0430 \u044d\u0442\u043e Query Properties. \u0412\u0441\u0451 \u043f\u0440\u043e\u0441\u0442\u043e, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u0438 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c \u0435\u0433\u043e \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u043c [Query].<\/p>\n<pre><code class=\"cs\">public interface ISomeApi { \u00a0\u00a0\u00a0 [Query(\"foo\")] \u00a0\u00a0\u00a0 string Foo { get; set; }  \u00a0\u00a0\u00a0 [Get(\"thing\")] \u00a0\u00a0\u00a0 Task ThingAsync([Query] string foo); }  var api = RestClient.For&lt;ISomeApi>(\"https:\/\/api.example.com\"); api.Foo = \"bar\";  \/\/ Requests https:\/\/api.example.com?foo=baz&amp;foo=bar await api.ThingAsync(\"baz\");<\/code><\/pre>\n<p>\u00a0<\/p>\n<p>\u0415\u0449\u0451 \u043e\u0434\u043d\u0438\u043c \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u043c \u0434\u0430\u043d\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f Source Generator, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0438 \u043d\u0430 \u044d\u0442\u0430\u043f\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u0438 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0443\u0441\u043a\u043e\u0440\u0438\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435.<\/p>\n<p>\u0421\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043b\u0438\u0435\u043d\u0442 \u0438\u0437 OpenApi \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u0434\u043b\u044f Visual Studio &#8212; <a href=\"https:\/\/github.com\/StefH\/RestEase-Client-Generator\" rel=\"noopener noreferrer nofollow\">RestEase Client Generator<\/a>. \u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043d\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u043b\u0430\u0441\u044c \u0441 \u043a\u043e\u043d\u0446\u0430 2019 \u0433\u043e\u0434\u0430<\/p>\n<p>\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0438\u043c\u0435\u0435\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439, \u0435\u0441\u043b\u0438 \u0432\u044b \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043d\u0430\u0438\u0433\u0440\u0430\u043b\u0438\u0441\u044c \u0441 Refit, \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u043f\u0440\u0438\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c\u0441\u044f \u043a \u0434\u0430\u043d\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435.<\/p>\n<p>\u00a0\u00a0<\/p>\n<h2>Kiota<\/h2>\n<p><a href=\"https:\/\/github.com\/microsoft\/kiota\" rel=\"noopener noreferrer nofollow\">Kiota <\/a>\u2013 \u044d\u0442\u043e \u043d\u0430\u0431\u043e\u0440 \u0438\u0437 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0438 \u0443\u0442\u0438\u043b\u0438\u0442\u044b \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 Api \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 OpenApi \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438. \u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0430\u043a\u0442\u0438\u0432\u043d\u043e \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u0434 \u043a\u0440\u044b\u043b\u043e\u043c Microsoft.<\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b<\/p>\n<pre><code class=\"bash\">kiota generate -l CSharp -c PostsClient -n KiotaPosts.Client -d .\/posts-api.yml -o .\/Client<\/code><\/pre>\n<p>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 API \u043a\u043b\u0438\u0435\u043d\u0442\u0430.<\/p>\n<p>\u0412\u044b\u0437\u043e\u0432 \u043c\u0435\u0442\u043e\u0434\u044b \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a:<\/p>\n<pre><code class=\"cs\">var authProvider = new AnonymousAuthenticationProvider(); var adapter = new HttpClientRequestAdapter(authProvider); adapter.BaseUrl = \"https:\/\/localhost:44376\";  var client = new BeaversServer_Kiota(adapter);  var bernarId = await client.Beavers.PostAsync( \u00a0\u00a0\u00a0 new RefClient.ApiClients.Kiota.Models.CreateBeaver \u00a0\u00a0\u00a0 { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Eat = 10, \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Name = \"Bernar\" \u00a0\u00a0\u00a0 });<\/code><\/pre>\n<p>\u00a0<\/p>\n<p>\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0431\u043e\u0433\u0430\u0442\u0443\u044e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 \u0437\u0430\u043f\u0440\u043e\u0441\u0430, \u043d\u043e \u0432\u043e\u0442 \u0438\u0437 \u043e\u0442\u0432\u0435\u0442\u0430 \u0432\u044b\u0442\u0430\u0449\u0438\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0442\u0430\u043a \u043f\u0440\u043e\u0441\u0442\u043e \u0443 \u0432\u0430\u0441 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f.<\/p>\n<p>Kiota \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043f\u0435\u0440\u0441\u043f\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439, \u0442\u0435\u043c \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e C#, \u043d\u043e \u0438 Go, Java, PHP, Python, Ruby, Swift, TypeScript\/JavaScript, \u043d\u043e \u043d\u0430 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043c\u0430\u043b\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439.<\/p>\n<p>\u00a0<\/p>\n<h2>REST API Client Code Generator<\/h2>\n<p>\u0421\u0442\u043e\u0438\u0442\u044c \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u044c<a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=ChristianResmaHelle.ApiClientCodeGenerator2022\" rel=\"noopener noreferrer nofollow\"> \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u043f\u043b\u0430\u0433\u0438\u043d<\/a> \u0434\u043b\u044f Visual Studio, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u044b \u0447\u0435\u0440\u0435\u0437 \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/4dd\/dd2\/183\/4dddd218326598feaf74b57e9d70999d.png\" width=\"988\" height=\"800\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/4dd\/dd2\/183\/4dddd218326598feaf74b57e9d70999d.png\"\/><\/figure>\n<h2>\u0421\u0432\u043e\u0434\u043d\u0430\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0430<\/h2>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"124\" width=\"124\">\n<p align=\"left\">\n<\/td>\n<td>\n<p align=\"left\"><strong>Flurl<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>NSwag<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>RestSharp<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>Refit <\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>RestEase<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>Kiota<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"124\" width=\"124\">\n<p align=\"left\">HttpClient<\/p>\n<\/td>\n<td>\n<p align=\"left\">+<\/p>\n<\/td>\n<td>\n<p align=\"left\">+<\/p>\n<\/td>\n<td>\n<p align=\"left\">v107+<\/p>\n<\/td>\n<td>\n<p align=\"left\">+<\/p>\n<\/td>\n<td>\n<p align=\"left\">+<\/p>\n<\/td>\n<td>\n<p align=\"left\">+<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"124\" width=\"124\">\n<p align=\"left\">\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f Api \u043a\u043b\u0438\u0435\u043d\u0442\u0430<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u042f\u0432\u043d\u0430\u044f <\/p>\n<\/td>\n<td>\n<p align=\"left\">\u042f\u0432\u043d\u0430\u044f<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u042f\u0432\u043d\u0430\u044f<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041d\u0435\u044f\u0432\u043d\u0430\u044f<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041d\u0435\u044f\u0432\u043d\u0430\u044f<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u042f\u0432\u043d\u0430\u044f<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"124\" width=\"124\">\n<p align=\"left\">\u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u0438\u0437 OpenApi \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438<\/p>\n<\/td>\n<td>\n<p align=\"left\">&#8212;<\/p>\n<\/td>\n<td>\n<p align=\"left\">+<\/p>\n<\/td>\n<td>\n<p align=\"left\">+<\/p>\n<\/td>\n<td>\n<p align=\"left\">+<\/p>\n<\/td>\n<td>\n<p align=\"left\">+<\/p>\n<\/td>\n<td>\n<p align=\"left\">+<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"124\" width=\"124\">\n<p align=\"left\">\u2b50\u2b50\u2b50<\/p>\n<\/td>\n<td>\n<p align=\"left\">3.6k<\/p>\n<\/td>\n<td>\n<p align=\"left\">5.9k<\/p>\n<\/td>\n<td>\n<p align=\"left\">9.1k<\/p>\n<\/td>\n<td>\n<p align=\"left\">7.3k<\/p>\n<\/td>\n<td>\n<p align=\"left\">~1k<\/p>\n<\/td>\n<td>\n<p align=\"left\">~800<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0412 \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u0441\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0441 \u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435\u0439. \u0423 \u043c\u0435\u043d\u044f \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0432\u044b\u044f\u0432\u0438\u0442\u044c \u044f\u0432\u043d\u043e\u0433\u043e \u043b\u0438\u0434\u0435\u0440\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u044b\u0431\u0438\u0440\u0430\u0442\u044c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0438\u0437 \u043f\u043e\u0442\u0440\u0435\u0431\u043d\u043e\u0441\u0442\u0435\u0439 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0438 \u043b\u0438\u0447\u043d\u043e\u0433\u043e \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0442\u0435\u043d\u0438\u044f. \u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u043d\u0443\u0436\u0435\u043d \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c \u043d\u0430\u0434 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439, \u0442\u043e \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 Flurl, NSwag, RestSharp, \u0435\u0441\u043b\u0438 \u0432\u044b \u043f\u0440\u0438\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0435\u0441\u044c \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u0438\u0437\u043c\u0430 \u0438 \u043d\u0435 \u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u043a\u043e\u0434 \u0434\u0435\u0442\u0430\u043b\u044f\u043c\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0432\u0430\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u043e\u0434\u043e\u0439\u0434\u0451\u0442 Refit \u0438\u043b\u0438 RestEase.<\/p>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u0443 \u043c\u0435\u043d\u044f \u0432\u0441\u0451, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0432\u044b \u0437\u043d\u0430\u0435\u0442\u0435 \u0435\u0449\u0451 \u043f\u0430\u0440\u043e\u0447\u043a\u0443 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f \u043d\u0435 \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u043b, \u0441 \u0440\u0430\u0434\u043e\u0441\u0442\u044c\u044e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u044e \u043e \u043d\u0438\u0445 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><\/p>\n<div class=\"tm-article-poll-container\"><!--[--><\/p>\n<div class=\"tm-article-poll tm-article-poll_variant-bordered\">\n<div class=\"tm-notice tm-notice_positive tm-article-poll__notice\"><!----><\/p>\n<div class=\"tm-notice__inner\"><!----><\/p>\n<div class=\"tm-notice__content\" data-test-id=\"notice-content\"><!--[--><span>\u0422\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u043c\u043e\u0433\u0443\u0442 \u0443\u0447\u0430\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0432 \u043e\u043f\u0440\u043e\u0441\u0435. <a rel=\"nofollow\" href=\"\/kek\/v1\/auth\/habrahabr\/?back=\/ru\/articles\/758670\/&#038;hl=ru\">\u0412\u043e\u0439\u0434\u0438\u0442\u0435<\/a>, \u043f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430.<\/span><!--]--><\/div>\n<\/div>\n<\/div>\n<p><!--[--><\/p>\n<div class=\"tm-article-poll__header\">\u0427\u0442\u043e \u0412\u044b \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0438\u0442\u0430\u0435\u0442\u0435?<\/div>\n<div class=\"tm-article-poll__answers\"><!--[--><\/p>\n<div class=\"tm-article-poll__answer\">\n<div class=\"tm-article-poll__answer-data\"><span class=\"tm-article-poll__answer-percent\">2.54% <\/span><span class=\"tm-article-poll__answer-label\">Flurl<\/span><span class=\"tm-article-poll__answer-votes\">3<\/span><\/div>\n<div class=\"tm-article-poll__answer-bar\">\n<div class=\"tm-article-poll__answer-progress\" style=\"width: 2.54%\"><\/div>\n<\/div>\n<\/div>\n<div class=\"tm-article-poll__answer\">\n<div class=\"tm-article-poll__answer-data\"><span class=\"tm-article-poll__answer-percent\">9.32% <\/span><span class=\"tm-article-poll__answer-label\">NSwag<\/span><span class=\"tm-article-poll__answer-votes\">11<\/span><\/div>\n<div class=\"tm-article-poll__answer-bar\">\n<div class=\"tm-article-poll__answer-progress\" style=\"width: 9.32%\"><\/div>\n<\/div>\n<\/div>\n<div class=\"tm-article-poll__answer\">\n<div class=\"tm-article-poll__answer-data\"><span class=\"tm-article-poll__answer-percent\">14.41% <\/span><span class=\"tm-article-poll__answer-label\">RestSharp<\/span><span class=\"tm-article-poll__answer-votes\">17<\/span><\/div>\n<div class=\"tm-article-poll__answer-bar\">\n<div class=\"tm-article-poll__answer-progress\" style=\"width: 14.41%\"><\/div>\n<\/div>\n<\/div>\n<div class=\"tm-article-poll__answer\">\n<div class=\"tm-article-poll__answer-data\"><span class=\"tm-article-poll__answer-percent\">13.56% <\/span><span class=\"tm-article-poll__answer-label\">Refit<\/span><span class=\"tm-article-poll__answer-votes\">16<\/span><\/div>\n<div class=\"tm-article-poll__answer-bar\">\n<div class=\"tm-article-poll__answer-progress\" style=\"width: 13.56%\"><\/div>\n<\/div>\n<\/div>\n<div class=\"tm-article-poll__answer\">\n<div class=\"tm-article-poll__answer-data\"><span class=\"tm-article-poll__answer-percent\">0% <\/span><span class=\"tm-article-poll__answer-label\">RestEase<\/span><span class=\"tm-article-poll__answer-votes\">0<\/span><\/div>\n<div class=\"tm-article-poll__answer-bar\">\n<div class=\"tm-article-poll__answer-progress\" style=\"width: 0%\"><\/div>\n<\/div>\n<\/div>\n<div class=\"tm-article-poll__answer\">\n<div class=\"tm-article-poll__answer-data\"><span class=\"tm-article-poll__answer-percent\">0% <\/span><span class=\"tm-article-poll__answer-label\">Kiota<\/span><span class=\"tm-article-poll__answer-votes\">0<\/span><\/div>\n<div class=\"tm-article-poll__answer-bar\">\n<div class=\"tm-article-poll__answer-progress\" style=\"width: 0%\"><\/div>\n<\/div>\n<\/div>\n<div class=\"tm-article-poll__answer\">\n<div class=\"tm-article-poll__answer-data\"><span class=\"tm-article-poll__answer-percent tm-article-poll__answer-percent_winning\">50% <\/span><span class=\"tm-article-poll__answer-label\">\u0427\u0438\u0441\u0442\u044b\u0439 HttpClient<\/span><span class=\"tm-article-poll__answer-votes\">59<\/span><\/div>\n<div class=\"tm-article-poll__answer-bar\">\n<div class=\"tm-article-poll__answer-progress tm-article-poll__answer-progress_winning\" style=\"width: 50%\"><\/div>\n<\/div>\n<\/div>\n<div class=\"tm-article-poll__answer\">\n<div class=\"tm-article-poll__answer-data\"><span class=\"tm-article-poll__answer-percent\">10.17% <\/span><span class=\"tm-article-poll__answer-label\">\u0414\u0440\u0443\u0433\u043e\u0435<\/span><span class=\"tm-article-poll__answer-votes\">12<\/span><\/div>\n<div class=\"tm-article-poll__answer-bar\">\n<div class=\"tm-article-poll__answer-progress\" style=\"width: 10.17%\"><\/div>\n<\/div>\n<\/div>\n<p><!--]--><\/div>\n<div class=\"tm-article-poll__stats\"> \u041f\u0440\u043e\u0433\u043e\u043b\u043e\u0441\u043e\u0432\u0430\u043b\u0438 118 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439.   \u0412\u043e\u0437\u0434\u0435\u0440\u0436\u0430\u043b\u0441\u044f 31 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c. <\/div>\n<p><!--]--><\/div>\n<p><!--]--><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/758670\/\"> https:\/\/habr.com\/ru\/articles\/758670\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><\/figure>\n<p>\u0412 \u043d\u0430\u0447\u0430\u043b\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0443 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0432\u0441\u0435\u0433\u0434\u0430 \u043f\u043e\u044f\u0432\u043b\u044f\u043b\u0441\u044f \u0432\u043e\u043f\u0440\u043e\u0441, \u043a\u0430\u043a\u0443\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0434\u043b\u044f \u043c\u0435\u0436\u0441\u0435\u0440\u0432\u0438\u0441\u043d\u043e\u0433\u043e \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f? \u0410 \u043a\u0430\u043a\u0443\u044e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u043f\u043e\u0445\u043e\u0434\u043e\u0432 \u0432 \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u044b? \u0410 \u0447\u0442\u043e \u0442\u0430\u043c \u0441 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c? \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u043b\u0441\u044f \u0432\u043a\u0440\u0430\u0442\u0446\u0435 \u043e\u0441\u0432\u0435\u0442\u0438\u0442\u044c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u043e\u0431\u0451\u0440\u0442\u043a\u0438 \u043d\u0430\u0434 HttpClient.<\/p>\n<h2>Flurl<\/h2>\n<p>\u041d\u0430\u0447\u043d\u0451\u043c \u0441 <a href=\"https:\/\/flurl.dev\/\" rel=\"noopener noreferrer nofollow\">Flurl<\/a>, \u0434\u0430\u043d\u043d\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0445\u043e\u0440\u043e\u0448\u0435\u0435 \u0441\u043e\u0447\u0435\u0442\u0430\u043d\u0438\u0435 URL \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430 \u0438 API \u043a\u043b\u0438\u0435\u043d\u0442\u0430, \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c Fluent Interface \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430.<\/p>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 POST \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438, \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u0438 \u0442\u0435\u043b\u043e\u043c, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0434\u0435\u0441\u0435\u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u0432 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u0442\u0438\u043f \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a:<\/p>\n<pre><code class=\"cs\">var person = await \"https:\/\/api.com\" \u00a0\u00a0\u00a0 .AppendPathSegment(\"person\") \u00a0\u00a0\u00a0 .SetQueryParams(new { a = 1, b = 2 }) \u00a0\u00a0\u00a0 .WithOAuthBearerToken(\"my_oauth_token\") \u00a0\u00a0\u00a0 .PostJsonAsync(new \u00a0\u00a0\u00a0 { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 first_name = \"Claire\", \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 last_name = \"Underwood\" \u00a0\u00a0\u00a0 }) \u00a0\u00a0\u00a0 .ReceiveJson&lt;Person>();<\/code><\/pre>\n<p>\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0443\u0434\u043e\u0431\u043d\u0430 \u043f\u0440\u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u043e\u0436\u043d\u043e \u0443\u0434\u043e\u0431\u043d\u043e \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c URL \u043d\u0430 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0435:<\/p>\n<pre><code class=\"cs\">var url = new Url(\"https:\/\/user:pass@www.mysite.com:1234\/with\/path?x=1&amp;y=2#foo\"); Assert.AreEqual(\"https\", url.Scheme); Assert.AreEqual(\"user:pass\", url.UserInfo); Assert.AreEqual(\"www.mysite.com\", url.Host); Assert.AreEqual(1234, url.Port); Assert.AreEqual(\"user:pass@www.mysite.com:1234\", url.Authority); Assert.AreEqual(\"https:\/\/user:pass@www.mysite.com:1234\", url.Root); Assert.AreEqual(\"\/with\/path\", url.Path); Assert.AreEqual(\"x=1&amp;y=2\", url.Query); Assert.AreEqual(\"foo\", url.Fragment);<\/code><\/pre>\n<p> \u0418\u043b\u0438 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0435\u0441\u0442 \u0432 \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u044b\u043c AAA \u0441\u0442\u0438\u043b\u0435:<\/p>\n<pre><code class=\"cs\">using (var httpTest = new HttpTest()) { \u00a0\u00a0\u00a0 \/\/ arrange \u00a0\u00a0\u00a0 httpTest.RespondWith(\"OK\", 200); \u00a0\u00a0\u00a0 \/\/ act \u00a0\u00a0\u00a0 await sut.CreatePersonAsync(); \u00a0\u00a0\u00a0 \/\/ assert \u00a0\u00a0\u00a0 httpTest.ShouldHaveCalled(\"https:\/\/api.com\/*\") \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 .WithVerb(HttpMethod.Post) \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 .WithContentType(\"application\/json\"); }<\/code><\/pre>\n<p>\u041c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0442\u0435\u0441\u0442 \u043f\u043e\u0434 \u043d\u0443\u0436\u043d\u044b\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432:<\/p>\n<pre><code class=\"cs\">using var httpTest = new HttpTest();  httpTest \u00a0\u00a0\u00a0 .ForCallsTo(\"*.api.com*\", \"*.test-api.com*\") \/\/ multiple allowed, wildcard supported \u00a0\u00a0\u00a0 .WithVerb(\"put\", \"PATCH\") \/\/ or HttpMethod.Put, HttpMethod.Patch \u00a0\u00a0\u00a0 .WithQueryParam(\"x\", \"a*\") \/\/ value optional, wildcard supported \u00a0\u00a0\u00a0 .WithQueryParams(new { y = 2, z = 3 }) \u00a0\u00a0\u00a0 .WithAnyQueryParam(\"a\", \"b\", \"c\") \u00a0\u00a0\u00a0 .WithoutQueryParam(\"d\") \u00a0\u00a0\u00a0 .WithHeader(\"h1\", \"f*o\") \/\/ value optional, wildcard supported \u00a0\u00a0\u00a0 .WithoutHeader(\"h2\") \u00a0\u00a0\u00a0 .WithRequestBody(\"*something*\") \/\/ wildcard supported \u00a0\u00a0\u00a0 .WithRequestJson(new { a = \"*\", b = \"hi\" }) \/\/ wildcard supported in sting values \u00a0\u00a0\u00a0 .With(call => true) \/\/ check anything on the FlurlCall \u00a0\u00a0\u00a0 .Without(call => false) \/\/ check anything on the FlurlCall \u00a0\u00a0\u00a0 .RespondWith(\"all conditions met!\", 200);<\/code><\/pre>\n<p>\u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0438\u0437 \u0441\u0435\u0431\u044f \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u044e \u0443\u0440\u043e\u0432\u043d\u0435\u0439, \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u043e\u0442 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u043e\u0439, \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u043c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u0430. \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043a\u0430\u0436\u0434\u044b\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0438 \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f.<\/p>\n<p>\u0412\u0441\u0435\u0433\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u043d\u0435 \u0442\u0430\u043a \u043c\u043d\u043e\u0433\u043e, \u043d\u043e \u0432 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0432\u0441\u0435 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435: Timeout, AllowedHttpStatusRange, JsonSerializer, UrlEncodedSerializer, Redirects, BeforeCall, AfterCall, OnError, OnRedirect.<\/p>\n<p>\u00a0<\/p>\n<p>\u0414\u0430\u043d\u043d\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0430\u0441\u044c \u043c\u043d\u0435 \u0443\u0434\u043e\u0431\u043d\u043e\u0439 \u043a\u0430\u043a \u0438 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430 \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u0442\u0430\u043a \u0438 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043e\u0441\u043d\u043e\u0432\u044b \u0434\u043b\u044f API \u043a\u043b\u0438\u0435\u043d\u0442\u0430.<\/p>\n<p><strong>\u00a0<\/strong><\/p>\n<h2>NSwagStudio <\/h2>\n<figure class=\"full-width\"><\/figure>\n<p>\u0414\u0443\u043c\u0430\u044e, \u043c\u043d\u043e\u0433\u043e \u043a\u0442\u043e \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u043b\u0441\u044f \u0441 <a href=\"https:\/\/github.com\/RicoSuter\/NSwag\/wiki\/NSwagStudio\" rel=\"noopener noreferrer nofollow\">NSwagStudio<\/a>. \u041d\u0430 \u044d\u0442\u043e\u0442 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043c\u043d\u043e\u0433\u043e \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0431\u0443\u0434\u0443 \u043a\u0440\u0430\u0442\u043e\u043a. <\/p>\n<p>\u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e NSwagStudio \u043c\u043e\u0436\u043d\u043e:<\/p>\n<ul>\n<li>\n<p>\u0413\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c C# \u043a\u043b\u0438\u0435\u043d\u0442\/\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440.<\/p>\n<\/li>\n<li>\n<p>\u0413\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c TS \u043a\u043b\u0438\u0435\u043d\u0442.<\/p>\n<\/li>\n<li>\n<p>\u041d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430.<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/blog.sanderaernouts.com\/autogenerate-csharp-api-client-with-nswag\" rel=\"noopener noreferrer nofollow\">\u0420\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044e \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u043f\u0440\u0438 \u0441\u0431\u043e\u0440\u043a\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0435.<\/a><\/p>\n<\/li>\n<\/ul>\n<p>\u0412\u0441\u0451 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u043e\u0435 \u0434\u0435\u043b\u0430\u0435\u0442 \u0438\u0437 NSwagStudio \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f API \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432, \u043d\u043e \u0435\u0441\u0442\u044c \u0438 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043c\u0438\u043d\u0443\u0441, \u043e\u043d \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u043e, \u0447\u0442\u043e \u0443\u043c\u0435\u0435\u0442. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0445\u0438\u0442\u0440\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043e\u0448\u0438\u0431\u043e\u043a, \u0442\u043e \u0441\u043a\u043e\u0440\u0435\u0439 \u0432\u0441\u0435\u0433\u043e \u044d\u0442\u043e\u0442 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0432\u0430\u043c \u043d\u0435 \u043f\u043e\u0434\u043e\u0439\u0434\u0451\u0442.<\/p>\n<h2>RestSharp<\/h2>\n<p><a href=\"https:\/\/restsharp.dev\/\" rel=\"noopener noreferrer nofollow\">RestSharp <\/a>\u043f\u043e\u0437\u0438\u0446\u0438\u043e\u043d\u0438\u0440\u0443\u0435\u0442 \u0441\u0435\u0431\u044f \u043a\u0430\u043a \u043b\u0435\u0433\u043a\u043e\u0432\u0435\u0441\u043d\u0430\u044f REST API Client \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u0430\u044f AWS.<\/p>\n<p>\u0422\u0438\u043f\u0438\u0447\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0438\u0441 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c RestSharp \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a:<\/p>\n<pre><code class=\"cs\">public class TwitterClient : ITwitterClient, IDisposable { \u00a0\u00a0\u00a0 readonly RestClient _client;  \u00a0\u00a0\u00a0 public TwitterClient(string apiKey, string apiKeySecret) { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 var options = new RestClientOptions(\"https:\/\/api.twitter.com\/2\");  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 _client = new RestClient(options) { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Authenticator = new TwitterAuthenticator(\"https:\/\/api.twitter.com\", apiKey, apiKeySecret) \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }; \u00a0\u00a0\u00a0 }  \u00a0\u00a0\u00a0 public async Task&lt;TwitterUser> GetUser(string user) { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 var response = await _client.GetJsonAsync&lt;TwitterSingleObject&lt;TwitterUser>>( \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \"users\/by\/username\/{user}\", \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 new { user } \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 return response!.Data; \u00a0\u00a0\u00a0 }  \u00a0\u00a0\u00a0 record TwitterSingleObject&lt;T>(T Data);  \u00a0\u00a0\u00a0 public void Dispose() { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 _client?.Dispose(); \u00a0\u00a0\u00a0 } }<\/code><\/pre>\n<p>\u00a0\u0417\u0430\u043f\u0440\u043e\u0441 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0431\u043e\u0433\u0430\u0442\u0438\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438, \u0442\u0435\u043b\u043e\u043c, Cookie, \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0430\u043c\u0438 \u0438 \u0442.\u0434.<\/p>\n<pre><code class=\"cs\">var request = new RestRequest(\"beavers\"); request.AddParameter(\"status\", 1); request.AddHeader(\"name\", \"value\");<\/code><\/pre>\n<p>\u00a0\u0422\u0430\u043a \u0436\u0435 \u0434\u043b\u044f \u0432\u0441\u0435\u0433\u043e RestClient \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b, \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0438 \u0438 \u0442. \u0434. \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e.<\/p>\n<pre><code class=\"cs\">RestClient client = new(\"https:\/\/localhost:44376\/\"); client.AddDefaultHeader(\"MyHeader\", \"default\");<\/code><\/pre>\n<p>\u0412\u044b\u0437\u043e\u0432 \u043c\u0435\u0442\u043e\u0434\u0430 \u043c\u043e\u0436\u043d\u043e \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0438\u0442\u044c \u0434\u0432\u0443\u043c\u044f \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u043c\u0438:<\/p>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u044b\u0437\u0432\u0430\u0432 ExecuteGetAsync \u0438\u043b\u0438 GetAsync. \u0412 \u043f\u0435\u0440\u0432\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 RestResponse, \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0442\u0430\u0449\u0438\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u0443\u044e \u0432 \u043e\u0442\u0432\u0435\u0442\u0435 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0438). \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0432\u044b\u0437\u043e\u0432\u044b \u0441 \u043f\u0440\u0435\u0444\u0438\u043a\u0441\u043e\u043c Execute \u043d\u0435 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u044e\u0442 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f, \u0435\u0433\u043e \u0432\u0430\u043c \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0438\u0437 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e \u043f\u043e\u043b\u044f.<\/p>\n<p>\u00a0<\/p>\n<p>RestSharp \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f REST API \u043a\u043b\u0438\u0435\u043d\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441 \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u044b\u0439 \u043e\u0442\u0432\u0435\u0442. \u0418\u0437 \u043c\u0438\u043d\u0443\u0441\u043e\u0432 \u044f \u043c\u043e\u0433\u0443 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043e\u0448\u0438\u0431\u043e\u043a \u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438, \u0432\u0430\u043c \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0435\u0451 \u0441\u0430\u043c\u043e\u043c\u0443.<\/p>\n<p>\u00a0<\/p>\n<h2>Refit <\/h2>\n<p><a href=\"https:\/\/github.com\/reactiveui\/refit\" rel=\"noopener noreferrer nofollow\">Refit <\/a>\u2013 REST \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f Api \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0434\u043e \u043c\u0438\u043d\u0438\u043c\u0443\u043c\u0430, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044f \u043e\u0431\u0448\u0438\u0440\u043d\u044b\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u043a\u0430\u0441\u0442\u043e\u043c\u0438\u0437\u0430\u0446\u0438\u0438.<\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u043e \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430:<\/p>\n<pre><code class=\"cs\">public interface IGitHubApi { \u00a0\u00a0\u00a0 [Get(\"\/users\/{user}\")] \u00a0\u00a0\u00a0 Task&lt;User> GetUser(string user); }<\/code><\/pre>\n<p>\u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c API \u043a\u043b\u0438\u0435\u043d\u0442 \u043c\u043e\u0436\u043d\u043e \u0447\u0435\u0440\u0435\u0437 \u043c\u0435\u0442\u043e\u0434 RestService.For&lt;T>:<\/p>\n<pre><code class=\"cs\">var gitHubApi = RestService.For&lt;IGitHubApi>(\"https:\/\/api.github.com\"); var octocat = await gitHubApi.GetUser(\"octocat\");<\/code><\/pre>\n<p>\u0418\u043b\u0438 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0432 IoC, \u0447\u0435\u0440\u0435\u0437 <a href=\"https:\/\/www.nuget.org\/packages\/Refit.HttpClientFactory\/\" rel=\"noopener noreferrer nofollow\">Refit.HttpClientFactory<\/a>:<\/p>\n<pre><code class=\"cs\">services \u00a0\u00a0\u00a0 .AddRefitClient&lt;IGitHubApi>() \u00a0\u00a0\u00a0 .ConfigureHttpClient(c => c.BaseAddress = new Uri(\"https:\/\/api.github.com\"));<\/code><\/pre>\n<p>\u00a0\u0424\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435.<\/p>\n<pre><code class=\"cs\">var gitHubApi = RestService.For&lt;IGitHubApi>(\"https:\/\/api.github.com\", \u00a0\u00a0\u00a0 new RefitSettings { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ContentSerializer = new NewtonsoftJsonContentSerializer( \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 new JsonSerializerSettings { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ContractResolver = new SnakeCasePropertyNamesContractResolver() \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 } \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 )});  var otherApi = RestService.For&lt;IOtherApi>(\"https:\/\/api.example.com\", \u00a0\u00a0\u00a0 new RefitSettings { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ContentSerializer = new NewtonsoftJsonContentSerializer( \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 new JsonSerializerSettings { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ContractResolver = new CamelCasePropertyNamesContractResolver() \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 } \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 )});<\/code><\/pre>\n<p>\u00a0<\/p>\n<p>\u0412 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439. \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u043a\u043b\u0430\u0441\u0441\u044b \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439 ValidationApiException \u0438 ApiException. \u0421\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u0432\u043e\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0434\u043b\u044f \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439 \u0438 \u043f\u043e\u043c\u0435\u043d\u044f\u0442\u044c \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u043d\u043e \u0447\u0435\u0440\u0435\u0437 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 ExceptionFactory.<\/p>\n<p>\u00a0<\/p>\n<p>\u0421\u0442\u043e\u0438\u0442 \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 <a href=\"https:\/\/github.com\/christianhelle\/refitter\" rel=\"noopener noreferrer nofollow\"><strong>Refitter<\/strong><\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439<strong> <\/strong>\u0430\u043a\u0442\u0438\u0432\u043d\u043e<strong> <\/strong>\u0440\u0430\u0437\u0432\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442\u0441\u044f. Refitter \u2014 \u044d\u0442\u043e \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0443\u0442\u0438\u043b\u0438\u0442\u0430 \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 Refit \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0438\u0437 OpenApi \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438. \u042d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u043e, \u0435\u0441\u043b\u0438 \u0432\u0430\u043c \u0437\u0430\u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u043c\u0438\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430 Refit, \u043d\u043e \u043d\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 \u043d\u0435 \u0445\u0432\u0430\u0442\u0430\u0435\u0442 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432.<\/p>\n<p>\u0415\u0449\u0451 \u043e\u0434\u043d\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043f\u043e\u0434 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c <a href=\"https:\/\/github.com\/Dreamescaper\/GenerateAspNetCoreClient\" rel=\"noopener noreferrer nofollow\">Generate AspNetCore Client<\/a> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c Refit \u043a\u043b\u0438\u0435\u043d\u0442\u044b \u0438\u0437 \u0433\u043e\u0442\u043e\u0432\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0431\u0435\u0437 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 OpenApi \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438. \u0414\u043e\u0441\u0442\u0438\u0433\u0430\u0435\u0442\u0441\u044f \u044d\u0442\u043e \u043f\u0443\u0442\u0451\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438 \u0432\u044b\u0442\u044f\u0433\u0438\u0432\u0430\u043d\u0438\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430\u0445. \u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043f\u043e\u0434\u043e\u0439\u0434\u0451\u0442 \u043d\u0435 \u0432\u0441\u0435\u043c, \u0442\u0430\u043a \u043a\u0430\u043a \u0441\u0434\u0435\u043b\u0430\u043d\u0430 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043a\u0440\u0438\u0432\u043e, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0435\u0441\u043b\u0438 \u0432\u0430\u0448 \u043f\u0440\u043e\u0435\u043a\u0442 \u043d\u0435 \u0442\u0430\u043a \u043f\u0440\u043e\u0441\u0442\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0431\u0435\u0437 \u0442\u0430\u043d\u0446\u0435\u0432 \u0441 \u0431\u0443\u0431\u043d\u043e\u043c.<\/p>\n<p>\u00a0<\/p>\n<h2>RestEase<\/h2>\n<p>\u041d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u0437\u0433\u043b\u044f\u0434 <a href=\"https:\/\/github.com\/canton7\/RestEase\" rel=\"noopener noreferrer nofollow\">RestEase<\/a> \u043c\u0430\u043b\u043e \u0447\u0435\u043c \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 Refit, \u0438, \u0431\u043e\u043b\u0435\u0435 \u0442\u043e\u0433\u043e, \u043f\u043e\u0447\u0442\u0438 \u0432\u0441\u0435 API \u043a\u043b\u0438\u0435\u043d\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b \u043d\u0430\u043f\u0438\u0448\u0435\u0442\u0435 \u043d\u0430 Refit, \u0437\u0430\u043f\u0443\u0441\u0442\u044f\u0442\u0441\u044f \u0438 \u043d\u0430 RestEase<strong>.<\/strong> \u041d\u043e \u043f\u043e \u043c\u0438\u043c\u043e \u0441\u0445\u043e\u0436\u0435\u0433\u043e \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430, \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u0432\u043e\u0438 \u0444\u0438\u0447\u0438. <\/p>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u043d\u0435 \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u043b\u0430\u0441\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 [QueryMap] \u0441\u043b\u043e\u0432\u0430\u0440\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432, \u044d\u0442\u043e \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u043d\u0435 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b \u0438\u043b\u0438 \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438. <\/p>\n<p>\u0414\u0440\u0443\u0433\u0430\u044f \u043d\u0435 \u043c\u0435\u043d\u0435\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0430\u044f \u0444\u0438\u0447\u0430 \u044d\u0442\u043e Query Properties. \u0412\u0441\u0451 \u043f\u0440\u043e\u0441\u0442\u043e, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u0438 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c \u0435\u0433\u043e \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u043c [Query].<\/p>\n<pre><code class=\"cs\">public interface ISomeApi { \u00a0\u00a0\u00a0 [Query(\"foo\")] \u00a0\u00a0\u00a0 string Foo { get; set; }  \u00a0\u00a0\u00a0 [Get(\"thing\")] \u00a0\u00a0\u00a0 Task ThingAsync([Query] string foo); }  var api = RestClient.For&lt;ISomeApi>(\"https:\/\/api.example.com\"); api.Foo = \"bar\";  \/\/ Requests https:\/\/api.example.com?foo=baz&amp;foo=bar await api.ThingAsync(\"baz\");<\/code><\/pre>\n<p>\u00a0<\/p>\n<p>\u0415\u0449\u0451 \u043e\u0434\u043d\u0438\u043c \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u043c \u0434\u0430\u043d\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f Source Generator, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0438 \u043d\u0430 \u044d\u0442\u0430\u043f\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u0438 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0443\u0441\u043a\u043e\u0440\u0438\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435.<\/p>\n<p>\u0421\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043b\u0438\u0435\u043d\u0442 \u0438\u0437 OpenApi \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u0434\u043b\u044f Visual Studio &#8212; <a href=\"https:\/\/github.com\/StefH\/RestEase-Client-Generator\" rel=\"noopener noreferrer nofollow\">RestEase Client Generator<\/a>. \u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043d\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u043b\u0430\u0441\u044c \u0441 \u043a\u043e\u043d\u0446\u0430 2019 \u0433\u043e\u0434\u0430<\/p>\n<p>\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0438\u043c\u0435\u0435\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439, \u0435\u0441\u043b\u0438 \u0432\u044b \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043d\u0430\u0438\u0433\u0440\u0430\u043b\u0438\u0441\u044c \u0441 Refit, \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u043f\u0440\u0438\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c\u0441\u044f \u043a \u0434\u0430\u043d\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435.<\/p>\n<p>\u00a0\u00a0<\/p>\n<h2>Kiota<\/h2>\n<p><a href=\"https:\/\/github.com\/microsoft\/kiota\" rel=\"noopener noreferrer nofollow\">Kiota <\/a>\u2013 \u044d\u0442\u043e \u043d\u0430\u0431\u043e\u0440 \u0438\u0437 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0438 \u0443\u0442\u0438\u043b\u0438\u0442\u044b \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 Api \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 OpenApi \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438. \u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0430\u043a\u0442\u0438\u0432\u043d\u043e \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u0434 \u043a\u0440\u044b\u043b\u043e\u043c Microsoft.<\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b<\/p>\n<pre><code class=\"bash\">kiota generate -l CSharp -c PostsClient -n KiotaPosts.Client -d .\/posts-api.yml -o .\/Client<\/code><\/pre>\n<p>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 API \u043a\u043b\u0438\u0435\u043d\u0442\u0430.<\/p>\n<p>\u0412\u044b\u0437\u043e\u0432 \u043c\u0435\u0442\u043e\u0434\u044b \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a:<\/p>\n<pre><code class=\"cs\">var authProvider = new AnonymousAuthenticationProvider(); var adapter = new HttpClientRequestAdapter(authProvider); adapter.BaseUrl = \"https:\/\/localhost:44376\";  var client = new BeaversServer_Kiota(adapter);  var bernarId = await client.Beavers.PostAsync( \u00a0\u00a0\u00a0 new RefClient.ApiClients.Kiota.Models.CreateBeaver \u00a0\u00a0\u00a0 { \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Eat = 10, \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Name = \"Bernar\" \u00a0\u00a0\u00a0 });<\/code><\/pre>\n<p>\u00a0<\/p>\n<p>\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0431\u043e\u0433\u0430\u0442\u0443\u044e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-353897","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/353897","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=353897"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/353897\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=353897"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=353897"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=353897"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}