-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathMyServices.cs
55 lines (47 loc) · 1.22 KB
/
MyServices.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
using ServiceStack;
using AiServer.ServiceModel;
using AiServer.ServiceModel.Types;
using ServiceStack.DataAnnotations;
namespace AiServer.ServiceInterface;
public class MyServices : Service
{
public object Any(Hello request)
{
return new HelloResponse { Result = $"Hello, {request.Name}!" };
}
}
public class DummyReplyToService : Service
{
public static List<string> RefIds = new();
public object Any(DummyReplyTo request)
{
if(RefIds.Count > 100)
RefIds.Clear();
RefIds.Add(request.RefId);
return new DummyReplyToResponse { RefId = request.RefId };
}
public void Any(HasDummyReplyTo request)
{
if (RefIds.Contains(request.RefId))
RefIds.Remove(request.RefId);
else
{
throw HttpError.NotFound("RefId not found.");
}
}
}
[Route("/dummyreplyto")]
[ExcludeMetadata(Feature = Feature.All)]
public class DummyReplyTo : IReturn<DummyReplyToResponse>
{
public string? RefId { get; set; }
}
public class DummyReplyToResponse
{
public string? RefId { get; set; }
}
[ExcludeMetadata(Feature = Feature.All)]
public class HasDummyReplyTo : IReturnVoid
{
public string? RefId { get; set; }
}