Bot controller has keys endpoints

This commit is contained in:
2025-08-23 19:52:05 +08:00
parent d9620fd6a4
commit 953bf5d4de
5 changed files with 370 additions and 16 deletions

View File

@@ -308,4 +308,39 @@ public static class Leveling
512000, // Level 13
1024000
];
}
public class ApiKeyReference : ModelBase
{
public Guid Id { get; set; } = Guid.NewGuid();
public string Label { get; set; } = null!;
public Guid AccountId { get; set; }
public Guid SessionId { get; set; }
public string? Key { get; set; }
public ApiKey ToProtoValue()
{
return new ApiKey
{
Id = Id.ToString(),
Label = Label,
AccountId = AccountId.ToString(),
SessionId = SessionId.ToString(),
Key = Key
};
}
public static ApiKeyReference FromProtoValue(ApiKey proto)
{
return new ApiKeyReference
{
Id = Guid.Parse(proto.Id),
AccountId = Guid.Parse(proto.AccountId),
SessionId = Guid.Parse(proto.SessionId),
Label = proto.Label,
Key = proto.Key
};
}
}