-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathRedmineClient.java
More file actions
31 lines (23 loc) · 758 Bytes
/
RedmineClient.java
File metadata and controls
31 lines (23 loc) · 758 Bytes
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
package com.example.linkedcontainer;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import org.json.JSONObject;
import java.io.IOException;
/**
* A crude, partially implemented Redmine client.
*/
public class RedmineClient {
private String url;
private OkHttpClient client;
public RedmineClient(String url) {
this.url = url;
client = new OkHttpClient();
}
public int getIssueCount() throws IOException {
Request request = new Request.Builder().url(url + "/issues.json").build();
Response response = client.newCall(request).execute();
JSONObject jsonObject = new JSONObject(response.body().string());
return jsonObject.getInt("total_count");
}
}