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.
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.
---
---
## Table of Contents
*[GitLab Server Version Support](#gitLab%20server%20version%20support)<br/>
*[Issue Time Estimates](#issue%20time%20estimates)<br/>
*[Making API Calls](#making%20api%20calls)<br/>
*[Available Sub APIs](#available%20sub%20apis)
---
## GitLab Server Version Support
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/).
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.
**NOTICE**:
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.
---
## Using GitLab4J-API
### **Java 8 Requirement**
As of GitLab4J-API 4.8.0, Java 8+ is now required to use GitLab4J-API.
### **Javadocs**
Javadocs are available here: <ahref="http://www.messners.com/gitlab4j-api/javadocs/index.html?overview-summary.html"target="_top">Javadocs</a>
### **Project Set Up**
To utilize GitLab4J™ API in your Java project, simply add the following dependency to your project's build file:<br/>
To utilize GitLab4J™ API in your Java project, simply add the following dependency to your project's build file:<br/>
**Gradle: build.gradle**
**Gradle: build.gradle**
```java
```java
...
@@ -34,22 +72,12 @@ There have been reports of problems resolving some dependencies when using Ivy o
...
@@ -34,22 +72,12 @@ There have been reports of problems resolving some dependencies when using Ivy o
---
---
## Javadocs
### **Usage Examples**
Javadocs are available here: <ahref="http://www.messners.com/gitlab4j-api/javadocs/index.html?overview-summary.html"target="_top">Javadocs</a>
---
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:
## Java 8 Requirement
As of GitLab4J-API 4.8.0, Java 8+ is now required to use GitLab4J-API.
---
## Using GitLab4J
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:
```java
```java
// Create a GitLabApi instance to communicate with your GitLab server
// Create a GitLabApi instance to communicate with your GitLab server
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:
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:
```java
```java
// Create a GitLabApi instance to communicate with your GitLab server (must be an administrator)
// Create a GitLabApi instance to communicate with your GitLab server (must be an administrator)
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.
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.
---
---
##Logging of API Requests and Responses
### **Logging of API Requests and Responses**
As of GitLab4J-API 4.8.39 support has been added to log the requests to and the responses from the
As of GitLab4J-API 4.8.39 support has been added to log the requests to and the responses from the
GitLab API. Enable logging using one of the following methods on the GitLabApi instance:
GitLab API. Enable logging using one of the following methods on the GitLabApi instance:
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()```.
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()```.
...
@@ -162,7 +189,7 @@ The built-in methods that return a Stream do so using ___eager evaluation___, me
...
@@ -162,7 +189,7 @@ The built-in methods that return a Stream do so using ___eager evaluation___, me
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.**
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.**
**Eager evaluation example usage:**
#### **Eager evaluation example usage:**
```java
```java
// Stream the visible projects printing out the project name.
// Stream the visible projects printing out the project name.
GitLab4J-API supports Java 8 Optional<T> for API calls that result in the return of a single item. Here is an example on how to use the Java 8 Optional<T> API calls:
GitLab4J-API supports Java 8 Optional<T> for API calls that result in the return of a single item. Here is an example on how to use the Java 8 Optional<T> API calls:
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.
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.