@@ -116,6 +116,11 @@ public Organization getOrganizationByParameters(
116116
117117
118118
119+ /**
120+ * @deprecated Method is deprecated
121+ * Use {@link #getOrganizationsByInnListV2(String, Iterable)}
122+ */
123+ @ Deprecated
119124 public OrganizationWithCounteragentStatus [] getOrganizationsByInnList (String myOrgId , Iterable <String > innList ) throws DiadocSdkException {
120125 var request = GetOrganizationsByInnListRequest .newBuilder ();
121126 request .addAllInnList (innList );
@@ -144,12 +149,18 @@ public OrganizationWithCounteragentStatus[] getOrganizationsByInnList(String myO
144149 }
145150 }
146151
152+ /**
153+ * @deprecated Method is deprecated
154+ * Use {@link #getOrganizationsByInnListV2(Iterable)}
155+ */
156+ @ Deprecated
147157 public Organization [] getOrganizationsByInnList (Iterable <String > innList ) throws DiadocSdkException {
148158 var request = GetOrganizationsByInnListRequest .newBuilder ();
149159 request .addAllInnList (innList );
150160 return getOrganizationsByInnList (request .build ());
151161 }
152162
163+
153164 public Organization [] getOrganizationsByInnList (GetOrganizationsByInnListRequest innListRequest ) throws DiadocSdkException {
154165 if (innListRequest == null ) {
155166 throw new IllegalArgumentException ("innListRequest" );
@@ -171,6 +182,61 @@ public Organization[] getOrganizationsByInnList(GetOrganizationsByInnListRequest
171182 }
172183 }
173184
185+ public OrganizationWithCounteragentStatus [] getOrganizationsByInnListV2 (String myBoxId , Iterable <String > innList ) throws DiadocSdkException {
186+ var request = GetOrganizationsByInnListRequest .newBuilder ();
187+ request .addAllInnList (innList );
188+ return getOrganizationsByInnListV2 (myBoxId , request .build ());
189+ }
190+
191+ public OrganizationWithCounteragentStatus [] getOrganizationsByInnListV2 (String myBoxId , GetOrganizationsByInnListRequest innListRequest ) throws DiadocSdkException {
192+ if (myBoxId == null )
193+ throw new IllegalArgumentException ("myBoxId" );
194+ if (innListRequest == null )
195+ throw new IllegalArgumentException ("innListRequest" );
196+ try {
197+ var request = RequestBuilder .post (
198+ new URIBuilder (diadocHttpClient .getBaseUrl ())
199+ .setPath ("/V2/GetOrganizationsByInnList" )
200+ .addParameter ("myBoxId" , myBoxId )
201+ .build ())
202+ .setEntity (new ByteArrayEntity (innListRequest .toByteArray ()));
203+
204+
205+ var response = GetOrganizationsByInnListResponse .parseFrom (diadocHttpClient .performRequest (request ));
206+ return response .getOrganizationsList ().toArray (new OrganizationWithCounteragentStatus [0 ]);
207+
208+ } catch (URISyntaxException | IOException e ) {
209+ throw new DiadocSdkException (e );
210+ }
211+ }
212+
213+ public Organization [] getOrganizationsByInnListV2 (Iterable <String > innList ) throws DiadocSdkException {
214+ var request = GetOrganizationsByInnListRequest .newBuilder ();
215+ request .addAllInnList (innList );
216+ return getOrganizationsByInnListV2 (request .build ());
217+ }
218+
219+ public Organization [] getOrganizationsByInnListV2 (GetOrganizationsByInnListRequest innListRequest ) throws DiadocSdkException {
220+ if (innListRequest == null ) {
221+ throw new IllegalArgumentException ("innListRequest" );
222+ }
223+ try {
224+ var request = RequestBuilder .post (
225+ new URIBuilder (diadocHttpClient .getBaseUrl ())
226+ .setPath ("/V2/GetOrganizationsByInnList" )
227+ .build ())
228+ .setEntity (new ByteArrayEntity (innListRequest .toByteArray ()));
229+ var response = GetOrganizationsByInnListResponse .parseFrom (diadocHttpClient .performRequest (request ));
230+ return response
231+ .getOrganizationsList ()
232+ .stream ()
233+ .map (OrganizationWithCounteragentStatus ::getOrganization )
234+ .toArray (Organization []::new );
235+ } catch (URISyntaxException | IOException e ) {
236+ throw new DiadocSdkException (e );
237+ }
238+ }
239+
174240 public OrganizationList getOrganizationsByInnKpp (String inn , @ Nullable String kpp , boolean includeRelations ) throws DiadocSdkException {
175241 if (inn == null ) {
176242 throw new IllegalArgumentException ("inn" );
0 commit comments