blob: a0c7e21a0cc02ffac988b2a57c0eaf585a5a1e1b (
plain)
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
|
package github;
import java.nio.charset.StandardCharsets;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.entity.StringEntity;
public class DeploymentStatus
extends RestRequestPerformer<DeploymentStatus.Request, DeploymentStatus.Response> {
public DeploymentStatus(String username, String password) {
super(username, password, Response.class);
}
@Override
protected HttpUriRequest createHttpRequest(Request request, String requestJsonAsString) {
final HttpPost httpPost =
new HttpPost(
"https://api.github.com/repos/AnySoftKeyboard/AnySoftKeyboard/deployments/"
+ request.id
+ "/statuses");
httpPost.setEntity(new StringEntity(requestJsonAsString, StandardCharsets.UTF_8));
httpPost.addHeader("Accept", "application/vnd.github.flash-preview+json");
httpPost.addHeader("Accept", "application/vnd.github.ant-man-preview+json");
return httpPost;
}
public static class Request {
public final String id;
public final String environment;
public final String state;
public final boolean auto_inactive;
public Request(String id, String environment, String state) {
this.id = id;
this.environment = environment;
this.state = state;
this.auto_inactive = "success".equals(state);
}
}
public static class Response {
public final String id;
public final String state;
public final String description;
public final String environment;
public Response(String id, String state, String description, String environment) {
this.id = id;
this.state = state;
this.description = description;
this.environment = environment;
}
}
}
|