Skip to content

Commit 5b1efce

Browse files
author
sangeet-joy_xero
committed
fix response schema for manualjournalAttachmentById
1 parent eab9f50 commit 5b1efce

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

docs/v4/accounting/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31191,7 +31191,7 @@ <h3>Usage and SDK Samples</h3>
3119131191
String contentType = 'image/jpg';
3119231192

3119331193
try {
31194-
byte[] result = apiInstance.getManualJournalAttachmentById(accessToken, xeroTenantId, manualJournalID, attachmentID, contentType);
31194+
ByteArrayInputStream result = apiInstance.getManualJournalAttachmentById(accessToken, xeroTenantId, manualJournalID, attachmentID, contentType);
3119531195
System.out.println(result);
3119631196
} catch (XeroException e) {
3119731197
System.err.println("Exception when calling AccountingApi#getManualJournalAttachmentById");

src/main/java/com/xero/api/client/AccountingApi.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18884,22 +18884,24 @@ public HttpResponse getManualJournalAttachmentByFileNameForHttpResponse(
1888418884
* @param contentType The mime type of the attachment file you are retrieving i.e image/jpg,
1888518885
* application/pdf
1888618886
* @param accessToken Authorization token for user set in header of each request
18887-
* @return byte[]
18887+
* @return ByteArrayInputStream
1888818888
* @throws IOException if an error occurs while attempting to invoke the API *
1888918889
*/
18890-
public byte[] getManualJournalAttachmentById(
18890+
public ByteArrayInputStream getManualJournalAttachmentById(
1889118891
String accessToken,
1889218892
String xeroTenantId,
1889318893
UUID manualJournalID,
1889418894
UUID attachmentID,
1889518895
String contentType)
1889618896
throws IOException {
1889718897
try {
18898-
TypeReference<byte[]> typeRef = new TypeReference<byte[]>() {};
18898+
TypeReference<File> typeRef = new TypeReference<File>() {};
1889918899
HttpResponse response =
1890018900
getManualJournalAttachmentByIdForHttpResponse(
1890118901
accessToken, xeroTenantId, manualJournalID, attachmentID, contentType);
18902-
return apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
18902+
InputStream is = response.getContent();
18903+
return convertInputToByteArray(is);
18904+
1890318905
} catch (HttpResponseException e) {
1890418906
if (logger.isDebugEnabled()) {
1890518907
logger.debug(

0 commit comments

Comments
 (0)