forked from ServiceStack/ServiceStack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIssueServices.cs
More file actions
120 lines (103 loc) · 2.99 KB
/
IssueServices.cs
File metadata and controls
120 lines (103 loc) · 2.99 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using ServiceStack;
namespace Check.ServiceInterface
{
public class NoRepeat : IReturn<NoRepeatResponse>
{
public Guid Id { get; set; }
}
public class NoRepeatResponse
{
public Guid Id { get; set; }
}
public class BatchThrows : IReturn<BatchThrowsResponse>
{
public int Id { get; set; }
public string Name { get; set; }
}
public class BatchThrowsAsync : IReturn<BatchThrowsResponse>
{
public int Id { get; set; }
public string Name { get; set; }
}
public class BatchThrowsResponse
{
public string Result { get; set; }
public ResponseStatus ResponseStatus { get; set; }
}
public class AutoBatchServices : IService
{
private static readonly HashSet<Guid> ReceivedGuids = new HashSet<Guid>();
public NoRepeatResponse Any(NoRepeat request)
{
if (ReceivedGuids.Contains(request.Id))
throw new ArgumentException("Id {0} already received".Fmt(request.Id));
ReceivedGuids.Add(request.Id);
return new NoRepeatResponse
{
Id = request.Id
};
}
public object Any(BatchThrows request)
{
throw new Exception("Batch Throws");
}
public async Task Any(BatchThrowsAsync request)
{
await Task.Delay(0);
throw new Exception("Batch Throws");
}
}
[Route("/code", "post", Summary = @"Intellisense desteği sunar",
Notes = "")]
public class AutoComplete : IReturn<StringListResponse>
{
public int objectId { get; set; }
public int line { get; set; }
public int col { get; set; }
public string code { get; set; }
}
[Route("/code/object", "GET", Summary = @"Objenin adından objeyi döner",
Notes = "")]
public class ObjectId : IReturn<ObjectDesignResponse>
{
public string objectName { get; set; }
}
[Route("/code/execute", "get", Summary = @"Objeyi çalıştırır",
Notes = "")]
public class Execute : IReturn<StringListResponse>
{
public string objectName { get; set; }
public string args { get; set; }
}
public class StringListResponse
{
public List<string> data { get; set; }
}
public class StringResponse
{
public string data { get; set; }
}
public class ObjectDesignResponse
{
public ObjectDesign data { get; set; }
}
public class ObjectDesign
{
public int Id { get; set; }
}
public class IntegerResponse
{
public int data { get; set; }
}
public class CodeServices : Service
{
public object Get(ObjectId request)
{
int.TryParse(request.objectName ?? "-1", out var data);
return new IntegerResponse { data = data };
}
}
}