diff --git a/packages/foundry-sdk-generator/src/__e2e_tests__/attachements.test.ts b/packages/foundry-sdk-generator/src/__e2e_tests__/attachements.test.ts index b0d63dd92..5242b91aa 100644 --- a/packages/foundry-sdk-generator/src/__e2e_tests__/attachements.test.ts +++ b/packages/foundry-sdk-generator/src/__e2e_tests__/attachements.test.ts @@ -62,7 +62,8 @@ describe("AttachmentsTest", () => { blob, ); const attachment = assertOkOrThrow(result); - const result2: Result = await attachment.read(); + const result2: Result = await attachment + .fetchContents(); const attachmentContent = assertOkOrThrow(result2); const attachmentContentText = await attachmentContent.text(); expect(JSON.parse(attachmentContentText)).toEqual({ @@ -93,7 +94,7 @@ describe("AttachmentsTest", () => { ); const obj = assertOkOrThrow(result); const result2: Result | undefined = - await obj.attachment?.getMetadata(); + await obj.attachment?.fetchMetadata(); const attachmentMetadata = assertOkOrThrow(result2!); expect(attachmentMetadata.filename).toEqual("file1.txt"); @@ -111,7 +112,7 @@ describe("AttachmentsTest", () => { ); const obj = assertOkOrThrow(result); const result2: Result | undefined = - await obj.attachment2?.getMetadata(); + await obj.attachment2?.fetchMetadata(); const attachmentError = assertErrOrThrow(result2!); expect(attachmentError).toBeDefined(); @@ -125,7 +126,7 @@ describe("AttachmentsTest", () => { ); const obj = assertOkOrThrow(result); const result2: Result | undefined = await obj - .attachment?.read(); + .attachment?.fetchContents(); const attachmentContent = assertOkOrThrow(result2!); const attachmentContentText = await attachmentContent.text(); @@ -141,7 +142,7 @@ describe("AttachmentsTest", () => { ); const obj = assertOkOrThrow(result); const result2: Result | undefined = await obj - .attachment2?.read(); + .attachment2?.fetchContents(); const attachmentError = assertErrOrThrow(result2!); expect(attachmentError).toBeDefined(); diff --git a/packages/legacy-client/src/client/baseTypes/attachments/Attachment.ts b/packages/legacy-client/src/client/baseTypes/attachments/Attachment.ts index 5b1357cd2..182aa4bf7 100644 --- a/packages/legacy-client/src/client/baseTypes/attachments/Attachment.ts +++ b/packages/legacy-client/src/client/baseTypes/attachments/Attachment.ts @@ -21,13 +21,23 @@ export interface Attachment { type: "Attachment"; attachmentRid: string | undefined; /** + * @deprecated * Get the metadata of an attachment. */ getMetadata(): Promise>; /** + * @deprecated * Read the content of an attachment. */ read(): Promise>; + /** + * Get the metadata of an attachment. + */ + fetchMetadata(): Promise>; + /** + * Read the content of an attachment. + */ + fetchContents(): Promise>; } export interface AttachmentMetadata { diff --git a/packages/legacy-client/src/client/baseTypes/attachments/AttachmentProperty.ts b/packages/legacy-client/src/client/baseTypes/attachments/AttachmentProperty.ts index 5583c10a4..5402404f9 100644 --- a/packages/legacy-client/src/client/baseTypes/attachments/AttachmentProperty.ts +++ b/packages/legacy-client/src/client/baseTypes/attachments/AttachmentProperty.ts @@ -37,5 +37,11 @@ export const AttachmentProperty = ( read() { return getAttachment(clientCtx, attachmentRid); }, + fetchMetadata() { + return getAttachmentMetadata(clientCtx, attachmentRid); + }, + fetchContents() { + return getAttachment(clientCtx, attachmentRid); + }, }; };