Skip to content

Commit 43ed22f

Browse files
committed
add downloadAttachmentById
1 parent 58cce6e commit 43ed22f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

kotlin-insight-client/kotlin-insight-client-sdk/src/main/kotlin/com/linkedplanet/kotlininsightclient/sdk/SdkInsightAttachmentOperator.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,12 @@ object SdkInsightAttachmentOperator : InsightAttachmentOperator {
6868
fileManager.getObjectAttachmentContent(attachmentBean.objectId, attachmentBean.nameInFileSystem)
6969
}
7070

71+
suspend fun downloadAttachmentById(attachmentId: AttachmentId): Either<InsightClientError, InputStream> =
72+
catchAsInsightClientError {
73+
val attachmentBean = objectFacade.loadAttachmentBeanById(attachmentId.raw)
74+
fileManager.getObjectAttachmentContent(attachmentBean.objectId, attachmentBean.nameInFileSystem)
75+
}
76+
7177
override suspend fun downloadAttachmentZip(objectId: InsightObjectId): Either<InsightClientError, InputStream> =
7278
either {
7379
val fileMap = allAttachmentStreamsForInsightObject(objectId).bind()

0 commit comments

Comments
 (0)