configure grpc

This commit is contained in:
2026-01-17 18:08:16 -05:00
parent fc80e50c26
commit b762139243
27 changed files with 467 additions and 500 deletions

View File

@@ -0,0 +1,41 @@
namespace AZKiServer.RPC;
public static class ConversionExtensions
{
public static Models.MediaType FromRpc(this MediaType type)
{
return type switch
{
MediaType.None => Models.MediaType.None,
MediaType.Image => Models.MediaType.Image,
MediaType.Video => Models.MediaType.Video,
MediaType.All => Models.MediaType.All,
_ => throw new NotSupportedException()
};
}
public static MediaType ToRpc(this Models.MediaType type)
{
return type switch
{
Models.MediaType.None => MediaType.None,
Models.MediaType.Image => MediaType.Image,
Models.MediaType.Video => MediaType.Video,
Models.MediaType.All => MediaType.All,
_ => throw new NotSupportedException()
};
}
public static MediaEntry ToRpc(this Models.MediaEntry entry)
{
return new MediaEntry
{
Version = entry.Version,
CameraId = entry.CameraId,
Date = Google.Protobuf.WellKnownTypes.Timestamp.FromDateTime(entry.Date),
FilePath = entry.Filepath,
Id = entry.Id.ToString(),
Type = entry.Type.ToRpc()
};
}
}