File tree Expand file tree Collapse file tree 4 files changed +15
-15
lines changed
src/attachments/receiving Expand file tree Collapse file tree 4 files changed +15
-15
lines changed Original file line number Diff line number Diff line change @@ -6,3 +6,13 @@ export interface InboundAttachment {
66 content_id ?: string ;
77 content : string ; // base64
88}
9+
10+ export interface ApiInboundAttachment {
11+ id : string ;
12+ filename ?: string ;
13+ content_type : string ;
14+ content_disposition : 'inline' | 'attachment' ;
15+ content_id ?: string ;
16+ download_url : string ;
17+ expires_at : string ;
18+ }
Original file line number Diff line number Diff line change 11import type { ErrorResponse } from '../../../interfaces' ;
2- import type { InboundAttachment } from './attachment' ;
2+ import type { ApiInboundAttachment , InboundAttachment } from './attachment' ;
33
44export interface GetAttachmentOptions {
55 emailId : string ;
66 id : string ;
77}
88
9- // API response type (snake_case from API)
109export interface GetAttachmentApiResponse {
1110 object : 'attachment' ;
12- data : {
13- id : string ;
14- filename ?: string ;
15- content_type : string ;
16- content_disposition : 'inline' | 'attachment' ;
17- content_id ?: string ;
18- download_url : string ;
19- } ;
11+ data : ApiInboundAttachment ;
2012}
2113
22- // SDK response type (camelCase for users)
2314export interface GetAttachmentResponseSuccess {
2415 object : 'attachment' ;
2516 data : InboundAttachment ;
Original file line number Diff line number Diff line change @@ -6,7 +6,6 @@ export type ListAttachmentsOptions = PaginationOptions & {
66 emailId : string ;
77} ;
88
9- // API response type (with download_url)
109export interface ListAttachmentsApiResponse {
1110 object : 'list' ;
1211 has_more : boolean ;
@@ -17,10 +16,10 @@ export interface ListAttachmentsApiResponse {
1716 content_disposition : 'inline' | 'attachment' ;
1817 content_id ?: string ;
1918 download_url : string ;
19+ expires_at : string ;
2020 } > ;
2121}
2222
23- // SDK response type (with base64 content)
2423export interface ListAttachmentsResponseSuccess {
2524 object : 'list' ;
2625 has_more : boolean ;
Original file line number Diff line number Diff line change @@ -62,7 +62,7 @@ export class Receiving {
6262 return apiResponse ;
6363 }
6464
65- const { download_url, ...otherFields } = apiResponse . data . data ;
65+ const { expires_at , download_url, ...otherFields } = apiResponse . data . data ;
6666 const downloadResult = await this . downloadAttachment ( download_url ) ;
6767 if ( downloadResult . type === 'error' ) {
6868 return {
@@ -106,7 +106,7 @@ export class Receiving {
106106
107107 const attachmentsWithContent = [ ] ;
108108 for ( const attachment of apiResponse . data . data ) {
109- const { download_url, ...otherFields } = attachment ;
109+ const { expires_at , download_url, ...otherFields } = attachment ;
110110 const downloadResult = await this . downloadAttachment ( download_url ) ;
111111 if ( downloadResult . type === 'error' ) {
112112 return {
You can’t perform that action at this time.
0 commit comments