Skip to content
This repository was archived by the owner on Feb 12, 2025. It is now read-only.

Commit 8d8e4f7

Browse files
committed
Added Mapper for FileManager
1 parent 3ee7117 commit 8d8e4f7

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
using ManagedCode.OpenAI.Files.Abstractions;
2+
using ManagedCode.OpenAI.Files.Models;
3+
4+
namespace ManagedCode.OpenAI.Files.Extensions;
5+
6+
internal static class MapperFileEx
7+
{
8+
public static IFileInfo ToFileInfo(this FileInfoDto dto)
9+
{
10+
return new FileInfo()
11+
{
12+
Bytes = dto.Bytes,
13+
CreatedAt = DateTimeOffset.FromUnixTimeSeconds(dto.CreatedAt).DateTime,
14+
Filename = dto.Filename,
15+
Id = dto.Id,
16+
Purpose = dto.Purpose
17+
};
18+
}
19+
20+
public static IFileInfo[] ToFileInfoArray(this IDataArrayResponseDto<FileInfoDto> dto)
21+
{
22+
return dto.Data
23+
.Select(e => e.ToFileInfo())
24+
.ToArray();
25+
}
26+
27+
public static bool GetDeleteResult(this FileDeleteResponseDto dto)
28+
{
29+
return dto.Deleted;
30+
}
31+
32+
}

0 commit comments

Comments
 (0)