Skip to content

Commit cc5d735

Browse files
committed
Added TOC and section on GitLab server support (#400).
1 parent 39209a5 commit cc5d735

File tree

1 file changed

+59
-31
lines changed

1 file changed

+59
-31
lines changed

README.md

Lines changed: 59 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,45 @@
66
GitLab4J™ API (gitlab4j-api) provides a full featured and easy to consume Java library for working with GitLab repositories via the GitLab REST API. Additionally, full support for working with GitLab webhooks and system hooks is also provided.
77

88
---
9+
## Table of Contents
10+
* [GitLab Server Version Support](#gitLab%20server%20version%20support)<br/>
11+
* [Using GitLab4J-API](#using%20gitlab4j-api)<br/>
12+
* [Java 8 Requirement](#java%208%20requirement)<br/>
13+
* [Javadocs](#javadocs)<br/>
14+
* [Project Set Up](#project%20set%20up)<br/>
15+
* [Usage Examples](#usage%20examples)<br/>
16+
* [Connecting Through a Proxy Server](#connecting%20through%20a%20proxy%20server)<br/>
17+
* [GitLab API V3 and V4 Support](#gitLab%20api%20v3%20and%20v4%20support)<br/>
18+
* [Logging of API Requests and Responses](#logging%20of%20api%20requests%20and%20responses)<br/>
19+
* [Results Paging](#results%20paging)<br/>
20+
* [Java 8 Stream Support](#java%208%20stream%20support)<br/>
21+
* [Eager evaluation example usage](#eager%20evaluation%20example%20usage)<br/>
22+
* [Lazy evaluation example usage](#lazy%20evaluation%20example%20usage)<br/>
23+
* [Java 8 Optional&lt;T&gt; Support](#java%208%20optional&lt;T&gt;%20support)<br/>
24+
* [Issue Time Estimates](#issue%20time%20estimates)<br/>
25+
* [Making API Calls](#making%20api%20calls)<br/>
26+
* [Available Sub APIs](#available%20sub%20apis)
927

28+
---
29+
## GitLab Server Version Support
30+
31+
GitLab4J-API supports version 11.0+ of GitLab Community Edition [(gitlab-ce)](https://gitlab.com/gitlab-org/gitlab-ce/) and GitLab Enterprise Edition [(gitlab-ee)](https://gitlab.com/gitlab-org/gitlab-ee/).
32+
33+
GitLab released GitLab Version 11.0 in June of 2018 which included many major changes to GitLab. If you are using GitLab server earlier than version 11.0, it is highly recommended that you either update your GitLab install or use a version of this library that was released around the same time as the version of GitLab you are using.
34+
35+
**NOTICE**:
36+
As of GitLab 11.0 support for the GitLab API v3 has been removed from the GitLab server (see https://about.gitlab.com/2018/06/01/api-v3-removal-impending/). Support for GitLab API v3 will be removed from this library sometime in 2019. If you are utilizing the v3 support, please update your code as soon as possible to use GitLab API v4.
37+
38+
---
39+
## Using GitLab4J-API
40+
41+
### **Java 8 Requirement**
42+
As of GitLab4J-API 4.8.0, Java 8+ is now required to use GitLab4J-API.
43+
44+
### **Javadocs**
45+
Javadocs are available here: <a href="http://www.messners.com/gitlab4j-api/javadocs/index.html?overview-summary.html" target="_top">Javadocs</a>
46+
47+
### **Project Set Up**
1048
To utilize GitLab4J&trade; API in your Java project, simply add the following dependency to your project's build file:<br />
1149
**Gradle: build.gradle**
1250
```java
@@ -34,22 +72,12 @@ There have been reports of problems resolving some dependencies when using Ivy o
3472

3573
---
3674

37-
## Javadocs
38-
Javadocs are available here: <a href="http://www.messners.com/gitlab4j-api/javadocs/index.html?overview-summary.html" target="_top">Javadocs</a>
75+
### **Usage Examples**
3976

40-
---
41-
42-
## Java 8 Requirement
43-
As of GitLab4J-API 4.8.0, Java 8+ is now required to use GitLab4J-API.
44-
45-
---
46-
47-
## Using GitLab4J
48-
49-
GitLab4J-API is quite simple to use, all you need is the URL to your GitLab server and the Private Token from your GitLab Account Settings page. Once you have that info it is as simple as:
77+
GitLab4J-API is quite simple to use, all you need is the URL to your GitLab server and the Personal Access Token from your GitLab Account Settings page. Once you have that info it is as simple as:
5078
```java
5179
// Create a GitLabApi instance to communicate with your GitLab server
52-
GitLabApi gitLabApi = new GitLabApi("http://your.gitlab.server.com", "YOUR_PRIVATE_TOKEN");
80+
GitLabApi gitLabApi = new GitLabApi("http://your.gitlab.server.com", "YOUR_ACCESS_TOKEN");
5381

5482
// Get the list of projects your account has access to
5583
List<Project> projects = gitLabApi.getProjectApi().getProjects();
@@ -63,7 +91,7 @@ GitLabApi gitLabApi = GitLabApi.login("http://your.gitlab.server.com", "your-use
6391
As of GitLab4J-API 4.6.6, all API requests support performing the API call as if you were another user, provided you are authenticated as an administrator:
6492
```java
6593
// Create a GitLabApi instance to communicate with your GitLab server (must be an administrator)
66-
GitLabApi gitLabApi = new GitLabApi("http://your.gitlab.server.com", "YOUR_PRIVATE_TOKEN");
94+
GitLabApi gitLabApi = new GitLabApi("http://your.gitlab.server.com", "YOUR_ACCESS_TOKEN");
6795

6896
// sudo as as a different user, in this case the user named "johndoe", all future calls will be done as "johndoe"
6997
gitLabApi.sudo("johndoe")
@@ -73,40 +101,39 @@ gitLabApi.unsudo();
73101
```
74102

75103
---
76-
## Connecting Through a Proxy Server
104+
### **Connecting Through a Proxy Server**
77105
As of GitLab4J-API 4.8.2 support has been added for connecting to the GitLab server using an HTTP proxy server:
78106
```java
79107
// Log in to the GitLab server using a proxy server (with basic auth on proxy)
80108
Map<String, Object> proxyConfig = ProxyClientConfig.createProxyClientConfig(
81109
"http://your-proxy-server", "proxy-username", "proxy-password");
82-
GitLabApi gitLabApi = new GitLabApi("http://your.gitlab.com", "YOUR_PRIVATE_TOKEN", null, proxyConfig);
110+
GitLabApi gitLabApi = new GitLabApi("http://your.gitlab.com", "YOUR_ACCESS_TOKEN", null, proxyConfig);
83111

84112
// Log in to the GitLab server using a proxy server (no auth on proxy)
85113
Map<String, Object> proxyConfig = ProxyClientConfig.createProxyClientConfig("http://your-proxy-server");
86-
GitLabApi gitLabApi = new GitLabApi("http://your.gitlab.com", "YOUR_PRIVATE_TOKEN", null, proxyConfig);
114+
GitLabApi gitLabApi = new GitLabApi("http://your.gitlab.com", "YOUR_ACCESS_TOKEN", null, proxyConfig);
87115

88116
// Log in to the GitLab server using an NTLM (Windows DC) proxy
89117
Map<String, Object> ntlmProxyConfig = ProxyClientConfig.createNtlmProxyClientConfig(
90118
"http://your-proxy-server", "windows-username", "windows-password", "windows-workstation", "windows-domain");
91-
GitLabApi gitLabApi = new GitLabApi("http://your.gitlab.com", "YOUR_PRIVATE_TOKEN", null, ntlmProxyConfig);
119+
GitLabApi gitLabApi = new GitLabApi("http://your.gitlab.com", "YOUR_ACCESS_TOKEN", null, ntlmProxyConfig);
92120
```
93121
See the Javadoc on the GitLabApi class for a complete list of methods accepting the proxy configuration (clientConfiguration parameter)
94122

95123
---
96-
## GitLab API V3 and V4 Support
124+
### **GitLab API V3 and V4 Support**
97125
As of GitLab4J-API 4.2.0 support has been added for GitLab API V4. If your application requires GitLab API V3,
98126
you can still use GitLab4J-API by creating your GitLabApi instance as follows:
99127
```java
100128
// Create a GitLabApi instance to communicate with your GitLab server using GitLab API V3
101-
GitLabApi gitLabApi = new GitLabApi(ApiVersion.V3, "http://your.gitlab.server.com", "YOUR_PRIVATE_TOKEN");
129+
GitLabApi gitLabApi = new GitLabApi(ApiVersion.V3, "http://your.gitlab.server.com", "YOUR_ACCESS_TOKEN");
102130
```
103131

104132
**NOTICE**:
105-
As of GitLab 11.0 support for the GitLab API v3 has been removed (see https://about.gitlab.com/2018/06/01/api-v3-removal-impending/). Support for GitLab API v3 will be removed from this library in January 2019. If you are utilizing the v3 support, please update your code before January 2019.
106-
133+
As of GitLab 11.0 support for the GitLab API v3 has been removed from the GitLab server (see https://about.gitlab.com/2018/06/01/api-v3-removal-impending/). Support for GitLab API v3 will be removed from this library sometime in 2019. If you are utilizing the v3 support, please update your code as soon as possible to use GitLab API v4.
107134

108135
---
109-
## Logging of API Requests and Responses
136+
### **Logging of API Requests and Responses**
110137
As of GitLab4J-API 4.8.39 support has been added to log the requests to and the responses from the
111138
GitLab API. Enable logging using one of the following methods on the GitLabApi instance:
112139
```java
@@ -129,7 +156,7 @@ gitLabApi.enableRequestResponseLogging(youtLoggerInstance, java.util.logging.Lev
129156
```
130157

131158
---
132-
## Results Paging
159+
### **Results Paging**
133160
GitLab4J-API provides an easy to use paging mechanism to page through lists of results from the GitLab API.
134161
Here are a couple of examples on how to use the Pager:
135162
```java
@@ -152,7 +179,7 @@ List<Project> allProjects = projectPager.all();
152179
```
153180

154181
---
155-
## Java 8 Stream Support
182+
### **Java 8 Stream Support**
156183
As of GitLab4J-API 4.9.2, all GitLabJ-API methods that return a List result have a similarlly named method that returns a Java 8 Stream. The Stream returning methods use the following naming convention: ```getXxxxxStream()```.
157184

158185

@@ -162,7 +189,7 @@ The built-in methods that return a Stream do so using ___eager evaluation___, me
162189
To stream using ___lazy evaluation___, use the GitLab4J-API methods that return a ```Pager``` instance, and then call the ```lazyStream()``` method on the ```Pager``` instance to create a lazy evaluation Stream. The Stream utilizes the ```Pager``` instance to page through the available items. **A lazy Stream does NOT support parallel operations or skipping.**
163190

164191

165-
**Eager evaluation example usage:**
192+
#### **Eager evaluation example usage:**
166193

167194
```java
168195
// Stream the visible projects printing out the project name.
@@ -176,7 +203,7 @@ Stream<User> stream = gitlabApi.getUserApi().getUsersStream();
176203
List<User> users = stream.parallel().sorted(comparing(User::getUsername)).collect(toList());
177204
```
178205

179-
**Lazy evaluation example usage:**
206+
#### **Lazy evaluation example usage:**
180207

181208
```java
182209
// Get a Pager instance to that will be used to lazily stream Project instances.
@@ -189,7 +216,7 @@ projectPager.lazyStream().limit(5).map(Project::getName).forEach(name -> System.
189216

190217

191218
---
192-
## Java 8 Optional&lt;T&gt; Support
219+
### **Java 8 Optional&lt;T&gt; Support**
193220
GitLab4J-API supports Java 8 Optional&lt;T&gt; for API calls that result in the return of a single item. Here is an example on how to use the Java 8 Optional&lt;T&gt; API calls:
194221
```java
195222
Optional<Group> optionalGroup = gitlabApi.getGroupApi().getGroup("my-group-path");
@@ -200,7 +227,7 @@ return gitlabApi.getGroupApi().addGroup("my-group-name", "my-group-path");
200227
```
201228

202229
---
203-
## Issue Time Estimates
230+
### **Issue Time Estimates**
204231
GitLab issues allow for time tracking. The following time units are currently available:
205232

206233
* months (mo)
@@ -220,10 +247,11 @@ The API has been broken up into sub API classes to make it easier to consume and
220247
```org.gitlab4j.api.ProjectApi``` -> https://docs.gitlab.com/ce/api/projects.html<br/>
221248
```org.gitlab4j.api.UserApi``` -> https://docs.gitlab.com/ce/api/users.html<br/>
222249

250+
### **Available Sub APIs**
251+
223252
The following is a list of the available sub APIs along with a sample use of each API. See the <a href="http://www.messners.com/gitlab4j-api/javadocs/index.html?org/gitlab4j/api/package-summary.html" target="_top">Javadocs</a> for a complete list of available methods for each sub API.
224253

225-
### Available Sub APIs
226-
------------------
254+
---
227255
&nbsp;&nbsp;[ApplicationsApi](#applicationsapi)<br/>
228256
&nbsp;&nbsp;[ApplicationSettingsApi](#applicationsettingsapi)<br/>
229257
&nbsp;&nbsp;[AwardEmojiApi](#awardemojiapi)<br/>

0 commit comments

Comments
 (0)