forked from mmazi/rescu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExampleService.java
177 lines (147 loc) · 5.72 KB
/
ExampleService.java
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
/**
* Copyright (C) 2013 Matija Mazi
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package si.mazi.rescu;
import si.mazi.rescu.dto.DummyAccountInfo;
import si.mazi.rescu.dto.DummyTicker;
import si.mazi.rescu.dto.GenericResult;
import si.mazi.rescu.dto.Order;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/**
* @author Matija Mazi
*/
@Path("api/{version}")
public interface ExampleService {
@POST
@Path("buy/")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
Order buy(@FormParam("user") String user, @FormParam("password") String password, @FormParam("amount") BigDecimal amount, @FormParam("price") BigDecimal price);
@POST
@Path("bitcoin_withdrawal/{user}")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
Object withdrawBitcoin(@PathParam("user") String user, @FormParam("password") String password, @QueryParam("amount") BigDecimal amount, @QueryParam("address") String address);
@GET
@Path("{ident: [a-Z]+}_{currency}/ticker")
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
DummyTicker getTicker(@PathParam("ident") String tradeableIdentifier, @PathParam("currency") String currency);
@POST
@FormParam("method")
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
DummyTicker getInfo(Long from, Long count) throws ExampleException;
@GET
@Path("auth")
Object testBasicAuth(@HeaderParam("Authorization") BasicAuthCredentials credentials, @QueryParam("param") Integer value);
@POST
@Path("json")
@Consumes(MediaType.APPLICATION_JSON)
Object testJsonBody(DummyAccountInfo ticker);
@POST
@Path("error")
@Consumes(MediaType.APPLICATION_JSON)
Object io() throws IOException;
@GET
@Path("generic")
@Produces(MediaType.APPLICATION_JSON)
GenericResult<DummyTicker[]> getGeneric();
@GET
@Path("string")
@Produces(MediaType.TEXT_PLAIN)
String getString() throws MessageException;
@PUT
@Path("number")
@Consumes(MediaType.TEXT_PLAIN)
@Produces(MediaType.TEXT_PLAIN)
String putNumber(int number);
@PATCH
@Path("number")
@Consumes(MediaType.TEXT_PLAIN)
@Produces(MediaType.TEXT_PLAIN)
String updateNumber(int number);
@GET
@Path("nonce")
@Consumes(MediaType.TEXT_PLAIN)
@Produces(MediaType.TEXT_PLAIN)
String getNonce(@FormParam("nonce") SynchronizedValueFactory nonce);
@GET
@Path("testSmallNumbers")
@Consumes(MediaType.TEXT_PLAIN)
@Produces(MediaType.TEXT_PLAIN)
String testSmallNumbersQuery(@QueryParam("value") BigDecimal value);
@GET
@Path("testSmallNumbers")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.TEXT_PLAIN)
String testSmallNumbersJson(BigDecimal value);
@GET
@Path("testExceptionOnArrayMethod")
@Produces(MediaType.APPLICATION_JSON)
DummyTicker[] testExceptionOnArrayMethod(String param) throws ExampleException;
@GET
@Path("ioexception")
@Consumes(MediaType.APPLICATION_JSON)
Object testIOExceptionDeclared(DummyAccountInfo ticker) throws IOException;
@GET
@Path("ioexception")
@Consumes(MediaType.APPLICATION_JSON)
DummyTicker testIOExceptionDeclared() throws IOException;
@GET
@Path("getWithBody")
@Consumes(MediaType.APPLICATION_JSON)
DummyTicker testGetMethodWithBody(DummyAccountInfo ticker) throws IOException;
@POST
@Path("formPostCollection")
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
Object testFromPostCollection(@FormParam("data") List<String> data);
@POST
@Path("formPostCollection")
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
Object testFromPostCollectionAsArray(@FormParam("data[]") List<String> data);
@POST
@Path("dateQueryParam")
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
Object testDateQueryParam(@QueryParam("startDate") Date date);
@GET
@Path("500")
Object test500() throws IOException;
@GET
@Path("invocationAwareException")
Object invocationAwareException() throws ExampleInvocationAwareException;
@GET
@Path("responseHeadersAwareException")
Object responseHeadersAwareException() throws ExampleResponseHeadersAwareException;
@DELETE
@Path("entity/{name}/remove")
Object removeEntity(@PathParam("name") String name);
@POST
@Path(value = "future_orders_info.do")
Object getFuturesOrders(@FormParam("order_id") String orderId, @HeaderParam("sign") ParamsDigest signer)
throws IOException;
@POST
@Path("resultWithResponseHeaders")
ExampleResponseHeadersAwareResult getResultWithResponseHeaders();
}