@@ -33,6 +33,8 @@ public TrueApiProvider(HttpClient httpClient, bool disposeHttpClient, ITrueApiTo
3333 _httpClient = httpClient ;
3434 _disposeHttpClient = disposeHttpClient ;
3535 _tokenProvider = tokenProvider ;
36+
37+ _httpClient . ConfigureHttpClient ( ) ;
3638 }
3739
3840 #region IDisposable
@@ -87,7 +89,6 @@ private async Task<T> InvokeAsync<T>(TrueApiProviderOption settings, Uri uri, Ht
8789 bool isZipResponse = false )
8890 {
8991 var client = _httpClient ;
90- client . ConfigureHttpClient ( ) ;
9192
9293 using var requestMessage = new HttpRequestMessage ( method , uri ) ;
9394 await InitHeaders ( requestMessage , settings ) . ConfigureAwait ( false ) ;
@@ -187,9 +188,15 @@ public async Task<string> CreateDocumentAsync<T>(TrueApiProviderOption settings,
187188 /// <param name="productGroup">Группа документа.</param>
188189 /// <param name="documentId">Идентификатор документа.</param>
189190 /// <returns>Информации о документе.</returns>
190- public async Task < List < DocumentInfoReportModel < T > > > GetDocumentByIdAsync < T > ( TrueApiProviderOption settings , ProductGroup productGroup , string documentId ) where T : ITrueApiDocument
191+ public async Task < List < DocumentInfoReportModel < T > > > GetDocumentByIdAsync < T > ( TrueApiProviderOption settings , ProductGroup ? productGroup , string documentId ) where T : ITrueApiDocument
191192 {
192- var uri = new Uri ( UriHelper . UrlCombine ( "https://markirovka.crpt.ru/api/v4/true-api" , $ "/doc/{ documentId } /info?pg={ productGroup } ") ) ;
193+ var path = $ "/doc/{ documentId } /info";
194+ if ( productGroup != null )
195+ {
196+ path += "?pg={productGroup}" ;
197+ }
198+
199+ var uri = new Uri ( UriHelper . UrlCombine ( "https://markirovka.crpt.ru/api/v4/true-api" , path ) ) ; //todo: hardcode
193200
194201 return await InvokeAsync < List < DocumentInfoReportModel < T > > > ( settings , uri , HttpMethod . Get ) . ConfigureAwait ( false ) ;
195202 }
0 commit comments