LASAPlatform/Infrastructure/CloudSdk/CommonTopicRequest.cs

81 lines
1.6 KiB
C#
Raw Permalink Normal View History

2025-06-10 16:51:31 +08:00
namespace OpenAuth.WebApi;
public class CommonTopicRequest<T>
{
/**
* The command is sent and the response is matched by the tid and bid fields in the message,
* and the reply should keep the tid and bid the same.
*/
2025-06-13 08:56:22 +08:00
public string tid { get; set; }
2025-06-10 16:51:31 +08:00
2025-06-13 08:56:22 +08:00
public string bid { get; set; }
2025-06-10 16:51:31 +08:00
2025-06-13 08:56:22 +08:00
public long? timestamp { get; set; }
2025-06-10 16:51:31 +08:00
2025-06-13 08:56:22 +08:00
public T data { get; set; }
2025-06-10 16:51:31 +08:00
public override string ToString()
{
2025-06-13 08:56:22 +08:00
return $"CommonTopicRequest{{tid='{tid}', bid='{bid}', timestamp={timestamp}, data={data}}}";
2025-06-10 16:51:31 +08:00
}
public CommonTopicRequest<T> SetTid(string tid)
{
2025-06-13 08:56:22 +08:00
this.tid = tid;
2025-06-10 16:51:31 +08:00
return this;
}
public CommonTopicRequest<T> SetBid(string bid)
{
2025-06-13 08:56:22 +08:00
this.bid = bid;
2025-06-10 16:51:31 +08:00
return this;
}
public CommonTopicRequest<T> SetTimestamp(long? timestamp)
{
2025-06-13 08:56:22 +08:00
this.timestamp = timestamp;
2025-06-10 16:51:31 +08:00
return this;
}
public CommonTopicRequest<T> SetData(T data)
{
2025-06-13 08:56:22 +08:00
this.data = data;
2025-06-10 16:51:31 +08:00
return this;
}
}
public class OsdTopicRequest<T> : CommonTopicRequest<T>
{
public string method { get; set; }
public OsdTopicRequest<T> SetTid(string tid)
{
2025-06-13 08:56:22 +08:00
base.tid = tid;
2025-06-10 16:51:31 +08:00
return this;
}
public OsdTopicRequest<T> SetBid(string bid)
{
2025-06-13 08:56:22 +08:00
base.bid = bid;
2025-06-10 16:51:31 +08:00
return this;
}
public OsdTopicRequest<T> SetTimestamp(long? timestamp)
{
2025-06-13 08:56:22 +08:00
base.timestamp = timestamp;
2025-06-10 16:51:31 +08:00
return this;
}
public OsdTopicRequest<T> SetData(T data)
{
2025-06-13 08:56:22 +08:00
base.data = data;
2025-06-10 16:51:31 +08:00
return this;
}
public OsdTopicRequest<T> SetMethod(string method)
{
this.method = method;
return this;
}
}