Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
佳 邓
Gitlab4j Api
Commits
f517be4c
Unverified
Commit
f517be4c
authored
Mar 08, 2022
by
Gautier de Saint Martin Lacaze
Committed by
GitHub
Mar 08, 2022
Browse files
Merge branch 'master' into json_binding
parents
3efc1263
9401aace
Changes
14
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/gitlab4j/api/AbstractApi.java
View file @
f517be4c
package
org.gitlab4j.api
;
package
org.gitlab4j.api
;
import
java.io.File
;
import
java.io.File
;
import
java.io.InputStream
;
import
java.net.URL
;
import
java.net.URL
;
import
javax.ws.rs.NotAuthorizedException
;
import
javax.ws.rs.NotAuthorizedException
;
...
@@ -369,7 +370,7 @@ public abstract class AbstractApi implements Constants {
...
@@ -369,7 +370,7 @@ public abstract class AbstractApi implements Constants {
* @param expectedStatus the HTTP status that should be returned from the server
* @param expectedStatus the HTTP status that should be returned from the server
* @param name the name for the form field that contains the file name
* @param name the name for the form field that contains the file name
* @param fileToUpload a File instance pointing to the file to upload
* @param fileToUpload a File instance pointing to the file to upload
* @param mediaType
the content-type of the uploaded file, if null will be determined from fileToUpload
* @param mediaType
unused; will be removed in the next major version
* @param pathArgs variable list of arguments used to build the URI
* @param pathArgs variable list of arguments used to build the URI
* @return a ClientResponse instance with the data returned from the endpoint
* @return a ClientResponse instance with the data returned from the endpoint
* @throws GitLabApiException if any exception occurs during execution
* @throws GitLabApiException if any exception occurs during execution
...
@@ -382,6 +383,14 @@ public abstract class AbstractApi implements Constants {
...
@@ -382,6 +383,14 @@ public abstract class AbstractApi implements Constants {
}
}
}
}
protected
Response
upload
(
Response
.
Status
expectedStatus
,
String
name
,
InputStream
inputStream
,
String
filename
,
String
mediaType
,
Object
...
pathArgs
)
throws
GitLabApiException
{
try
{
return
validate
(
getApiClient
().
upload
(
name
,
inputStream
,
filename
,
mediaType
,
pathArgs
),
expectedStatus
);
}
catch
(
Exception
e
)
{
throw
handle
(
e
);
}
}
/**
/**
* Perform a file upload with the specified File instance and path objects, returning
* Perform a file upload with the specified File instance and path objects, returning
* a ClientResponse instance with the data returned from the endpoint.
* a ClientResponse instance with the data returned from the endpoint.
...
@@ -389,7 +398,7 @@ public abstract class AbstractApi implements Constants {
...
@@ -389,7 +398,7 @@ public abstract class AbstractApi implements Constants {
* @param expectedStatus the HTTP status that should be returned from the server
* @param expectedStatus the HTTP status that should be returned from the server
* @param name the name for the form field that contains the file name
* @param name the name for the form field that contains the file name
* @param fileToUpload a File instance pointing to the file to upload
* @param fileToUpload a File instance pointing to the file to upload
* @param mediaType
the content-type of the uploaded file, if null will be determined from fileToUpload
* @param mediaType
unused; will be removed in the next major version
* @param url the fully formed path to the GitLab API endpoint
* @param url the fully formed path to the GitLab API endpoint
* @return a ClientResponse instance with the data returned from the endpoint
* @return a ClientResponse instance with the data returned from the endpoint
* @throws GitLabApiException if any exception occurs during execution
* @throws GitLabApiException if any exception occurs during execution
...
@@ -409,7 +418,7 @@ public abstract class AbstractApi implements Constants {
...
@@ -409,7 +418,7 @@ public abstract class AbstractApi implements Constants {
* @param expectedStatus the HTTP status that should be returned from the server
* @param expectedStatus the HTTP status that should be returned from the server
* @param name the name for the form field that contains the file name
* @param name the name for the form field that contains the file name
* @param fileToUpload a File instance pointing to the file to upload
* @param fileToUpload a File instance pointing to the file to upload
* @param mediaType
the content-type of the uploaded file, if null will be determined from fileToUpload
* @param mediaType
unused; will be removed in the next major version
* @param formData the Form containing the name/value pairs
* @param formData the Form containing the name/value pairs
* @param url the fully formed path to the GitLab API endpoint
* @param url the fully formed path to the GitLab API endpoint
* @return a ClientResponse instance with the data returned from the endpoint
* @return a ClientResponse instance with the data returned from the endpoint
...
...
src/main/java/org/gitlab4j/api/Constants.java
View file @
f517be4c
...
@@ -509,7 +509,7 @@ public interface Constants {
...
@@ -509,7 +509,7 @@ public interface Constants {
/** Enum to use for specifying the event action_type. */
/** Enum to use for specifying the event action_type. */
public
enum
ActionType
{
public
enum
ActionType
{
CREATED
,
UPDATED
,
CLOSED
,
REOPENED
,
PUSHED
,
COMMENTED
,
MERGED
,
JOINED
,
LEFT
,
DESTROYED
,
EXPIRED
,
REMOVED
;
CREATED
,
UPDATED
,
OPENED
,
CLOSED
,
REOPENED
,
PUSHED
,
COMMENTED
,
MERGED
,
JOINED
,
LEFT
,
DESTROYED
,
EXPIRED
,
REMOVED
,
DELETED
,
APPROVED
,
ACCEPTED
,
IMPORTED
;
private
static
JacksonJsonEnumHelper
<
ActionType
>
enumHelper
=
new
JacksonJsonEnumHelper
<>(
ActionType
.
class
);
private
static
JacksonJsonEnumHelper
<
ActionType
>
enumHelper
=
new
JacksonJsonEnumHelper
<>(
ActionType
.
class
);
...
@@ -962,5 +962,27 @@ public interface Constants {
...
@@ -962,5 +962,27 @@ public interface Constants {
return
(
enumHelper
.
toString
(
this
));
return
(
enumHelper
.
toString
(
this
));
}
}
}
}
/** Enum to use for specifying the Event scope. */
public
enum
EventScope
{
ALL
;
private
static
JacksonJsonEnumHelper
<
EventScope
>
enumHelper
=
new
JacksonJsonEnumHelper
<>(
EventScope
.
class
);
@JsonCreator
public
static
EventScope
forValue
(
String
value
)
{
return
enumHelper
.
forValue
(
value
);
}
@JsonValue
public
String
toValue
()
{
return
(
enumHelper
.
toString
(
this
));
}
@Override
public
String
toString
()
{
return
(
enumHelper
.
toString
(
this
));
}
}
}
}
src/main/java/org/gitlab4j/api/EventsApi.java
View file @
f517be4c
...
@@ -36,6 +36,24 @@ public class EventsApi extends AbstractApi {
...
@@ -36,6 +36,24 @@ public class EventsApi extends AbstractApi {
return
(
getAuthenticatedUserEvents
(
action
,
targetType
,
before
,
after
,
sortOrder
,
getDefaultPerPage
()).
all
());
return
(
getAuthenticatedUserEvents
(
action
,
targetType
,
before
,
after
,
sortOrder
,
getDefaultPerPage
()).
all
());
}
}
/**
* Get a list of all events for the authenticated user, across all of the user's projects.
*
* <pre><code>GitLab Endpoint: GET /events</code></pre>
*
* @param action include only events of a particular action type, optional
* @param targetType include only events of a particular target type, optional
* @param before include only events created before a particular date, optional
* @param after include only events created after a particular date, optional
* @param sortOrder sort events in ASC or DESC order by created_at. Default is DESC, optional
* @return a list of events for the authenticated user and matching the supplied parameters
* @throws GitLabApiException if any exception occurs
*/
public
List
<
Event
>
getAllAuthenticatedUserEvents
(
ActionType
action
,
TargetType
targetType
,
Date
before
,
Date
after
,
SortOrder
sortOrder
)
throws
GitLabApiException
{
return
(
getAuthenticatedUserEvents
(
action
,
targetType
,
before
,
after
,
sortOrder
,
getDefaultPerPage
(),
EventScope
.
ALL
).
all
());
}
/**
/**
* Get a list of events for the authenticated user and in the specified page range.
* Get a list of events for the authenticated user and in the specified page range.
*
*
...
@@ -53,6 +71,27 @@ public class EventsApi extends AbstractApi {
...
@@ -53,6 +71,27 @@ public class EventsApi extends AbstractApi {
*/
*/
public
List
<
Event
>
getAuthenticatedUserEvents
(
ActionType
action
,
TargetType
targetType
,
public
List
<
Event
>
getAuthenticatedUserEvents
(
ActionType
action
,
TargetType
targetType
,
Date
before
,
Date
after
,
SortOrder
sortOrder
,
int
page
,
int
perPage
)
throws
GitLabApiException
{
Date
before
,
Date
after
,
SortOrder
sortOrder
,
int
page
,
int
perPage
)
throws
GitLabApiException
{
return
(
getAuthenticatedUserEvents
(
action
,
targetType
,
before
,
after
,
sortOrder
,
page
,
perPage
,
null
));
}
/**
* Get a list of events for the authenticated user and in the specified page range.
*
* <pre><code>GitLab Endpoint: GET /events</code></pre>
*
* @param action include only events of a particular action type, optional
* @param targetType include only events of a particular target type, optional
* @param before include only events created before a particular date, optional
* @param after include only events created after a particular date, optional
* @param sortOrder sort events in ASC or DESC order by created_at. Default is DESC, optional
* @param page the page to get
* @param perPage the number of projects per page
* @param scope include all events across a user’s projects, optional
* @return a list of events for the authenticated user and matching the supplied parameters
* @throws GitLabApiException if any exception occurs
*/
public
List
<
Event
>
getAuthenticatedUserEvents
(
ActionType
action
,
TargetType
targetType
,
Date
before
,
Date
after
,
SortOrder
sortOrder
,
int
page
,
int
perPage
,
EventScope
scope
)
throws
GitLabApiException
{
GitLabApiForm
formData
=
new
GitLabApiForm
()
GitLabApiForm
formData
=
new
GitLabApiForm
()
.
withParam
(
"action"
,
action
)
.
withParam
(
"action"
,
action
)
...
@@ -61,7 +100,8 @@ public class EventsApi extends AbstractApi {
...
@@ -61,7 +100,8 @@ public class EventsApi extends AbstractApi {
.
withParam
(
"after"
,
after
)
.
withParam
(
"after"
,
after
)
.
withParam
(
"sort"
,
sortOrder
)
.
withParam
(
"sort"
,
sortOrder
)
.
withParam
(
PAGE_PARAM
,
page
)
.
withParam
(
PAGE_PARAM
,
page
)
.
withParam
(
PER_PAGE_PARAM
,
perPage
);
.
withParam
(
PER_PAGE_PARAM
,
perPage
)
.
withParam
(
"scope"
,
scope
!=
null
?
scope
.
toValue
().
toLowerCase
()
:
null
);
Response
response
=
get
(
Response
.
Status
.
OK
,
formData
.
asMap
(),
"events"
);
Response
response
=
get
(
Response
.
Status
.
OK
,
formData
.
asMap
(),
"events"
);
return
(
response
.
readEntity
(
new
GenericType
<
List
<
Event
>>()
{}));
return
(
response
.
readEntity
(
new
GenericType
<
List
<
Event
>>()
{}));
...
@@ -83,13 +123,34 @@ public class EventsApi extends AbstractApi {
...
@@ -83,13 +123,34 @@ public class EventsApi extends AbstractApi {
*/
*/
public
Pager
<
Event
>
getAuthenticatedUserEvents
(
ActionType
action
,
TargetType
targetType
,
Date
before
,
Date
after
,
public
Pager
<
Event
>
getAuthenticatedUserEvents
(
ActionType
action
,
TargetType
targetType
,
Date
before
,
Date
after
,
SortOrder
sortOrder
,
int
itemsPerPage
)
throws
GitLabApiException
{
SortOrder
sortOrder
,
int
itemsPerPage
)
throws
GitLabApiException
{
return
(
getAuthenticatedUserEvents
(
action
,
targetType
,
before
,
after
,
sortOrder
,
itemsPerPage
,
null
));
}
/**
* Get a list of events for the authenticated user and in the specified page range.
*
* <pre><code>GitLab Endpoint: GET /events</code></pre>
*
* @param action include only events of a particular action type, optional
* @param targetType include only events of a particular target type, optional
* @param before include only events created before a particular date, optional
* @param after include only events created after a particular date, optional
* @param sortOrder sort events in ASC or DESC order by created_at. Default is DESC, optional
* @param itemsPerPage the number of Event instances that will be fetched per page
* @param scope include all events across a user’s projects, optional
* @return a Pager of events for the authenticated user and matching the supplied parameters
* @throws GitLabApiException if any exception occurs
*/
public
Pager
<
Event
>
getAuthenticatedUserEvents
(
ActionType
action
,
TargetType
targetType
,
Date
before
,
Date
after
,
SortOrder
sortOrder
,
int
itemsPerPage
,
EventScope
scope
)
throws
GitLabApiException
{
GitLabApiForm
formData
=
new
GitLabApiForm
()
GitLabApiForm
formData
=
new
GitLabApiForm
()
.
withParam
(
"action"
,
action
)
.
withParam
(
"action"
,
action
)
.
withParam
(
"target_type"
,
targetType
!=
null
?
targetType
.
toValue
().
toLowerCase
()
:
null
)
.
withParam
(
"target_type"
,
targetType
!=
null
?
targetType
.
toValue
().
toLowerCase
()
:
null
)
.
withParam
(
"before"
,
before
)
.
withParam
(
"before"
,
before
)
.
withParam
(
"after"
,
after
)
.
withParam
(
"after"
,
after
)
.
withParam
(
"sort"
,
sortOrder
);
.
withParam
(
"sort"
,
sortOrder
)
.
withParam
(
"scope"
,
scope
!=
null
?
scope
.
toValue
().
toLowerCase
()
:
null
);
return
(
new
Pager
<
Event
>(
this
,
Event
.
class
,
itemsPerPage
,
formData
.
asMap
(),
"events"
));
return
(
new
Pager
<
Event
>(
this
,
Event
.
class
,
itemsPerPage
,
formData
.
asMap
(),
"events"
));
}
}
...
@@ -109,7 +170,25 @@ public class EventsApi extends AbstractApi {
...
@@ -109,7 +170,25 @@ public class EventsApi extends AbstractApi {
*/
*/
public
Stream
<
Event
>
getAuthenticatedUserEventsStream
(
ActionType
action
,
TargetType
targetType
,
public
Stream
<
Event
>
getAuthenticatedUserEventsStream
(
ActionType
action
,
TargetType
targetType
,
Date
before
,
Date
after
,
SortOrder
sortOrder
)
throws
GitLabApiException
{
Date
before
,
Date
after
,
SortOrder
sortOrder
)
throws
GitLabApiException
{
return
(
getAuthenticatedUserEvents
(
action
,
targetType
,
before
,
after
,
sortOrder
,
getDefaultPerPage
()).
stream
());
return
(
getAuthenticatedUserEvents
(
action
,
targetType
,
before
,
after
,
sortOrder
,
getDefaultPerPage
(),
null
).
stream
());
}
/**
* Get a Stream of all events for the authenticated user, across all of the user's projects.
*
* <pre><code>GitLab Endpoint: GET /events</code></pre>
*
* @param action include only events of a particular action type, optional
* @param targetType include only events of a particular target type, optional
* @param before include only events created before a particular date, optional
* @param after include only events created after a particular date, optional
* @param sortOrder sort events in ASC or DESC order by created_at. Default is DESC, optional
* @return a Stream of events for the authenticated user and matching the supplied parameters
* @throws GitLabApiException if any exception occurs
*/
public
Stream
<
Event
>
getAllAuthenticatedUserEventsStream
(
ActionType
action
,
TargetType
targetType
,
Date
before
,
Date
after
,
SortOrder
sortOrder
)
throws
GitLabApiException
{
return
(
getAuthenticatedUserEvents
(
action
,
targetType
,
before
,
after
,
sortOrder
,
getDefaultPerPage
(),
EventScope
.
ALL
).
stream
());
}
}
/**
/**
...
...
src/main/java/org/gitlab4j/api/GitLabApi.java
View file @
f517be4c
...
@@ -5,6 +5,7 @@ import java.util.List;
...
@@ -5,6 +5,7 @@ import java.util.List;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Optional
;
import
java.util.Optional
;
import
java.util.WeakHashMap
;
import
java.util.WeakHashMap
;
import
java.util.function.Supplier
;
import
java.util.logging.Level
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
java.util.logging.Logger
;
...
@@ -711,6 +712,14 @@ public class GitLabApi implements AutoCloseable {
...
@@ -711,6 +712,14 @@ public class GitLabApi implements AutoCloseable {
return
(
apiClient
.
getAuthToken
());
return
(
apiClient
.
getAuthToken
());
}
}
/**
* Set auth token supplier for gitlab api client.
* @param authTokenSupplier - supplier which provide actual auth token
*/
public
void
setAuthTokenSupplier
(
Supplier
<
String
>
authTokenSupplier
)
{
apiClient
.
setAuthTokenSupplier
(
authTokenSupplier
);
}
/**
/**
* Get the secret token.
* Get the secret token.
*
*
...
...
src/main/java/org/gitlab4j/api/GitLabApiClient.java
View file @
f517be4c
...
@@ -2,6 +2,7 @@ package org.gitlab4j.api;
...
@@ -2,6 +2,7 @@ package org.gitlab4j.api;
import
java.io.File
;
import
java.io.File
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.net.Socket
;
import
java.net.Socket
;
import
java.net.URL
;
import
java.net.URL
;
import
java.security.GeneralSecurityException
;
import
java.security.GeneralSecurityException
;
...
@@ -10,9 +11,9 @@ import java.security.cert.CertificateException;
...
@@ -10,9 +11,9 @@ import java.security.cert.CertificateException;
import
java.security.cert.X509Certificate
;
import
java.security.cert.X509Certificate
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.function.Supplier
;
import
java.util.logging.Level
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
java.util.logging.Logger
;
import
javax.net.ssl.HostnameVerifier
;
import
javax.net.ssl.HostnameVerifier
;
import
javax.net.ssl.SSLContext
;
import
javax.net.ssl.SSLContext
;
import
javax.net.ssl.SSLEngine
;
import
javax.net.ssl.SSLEngine
;
...
@@ -29,7 +30,6 @@ import javax.ws.rs.core.MediaType;
...
@@ -29,7 +30,6 @@ import javax.ws.rs.core.MediaType;
import
javax.ws.rs.core.MultivaluedMap
;
import
javax.ws.rs.core.MultivaluedMap
;
import
javax.ws.rs.core.Response
;
import
javax.ws.rs.core.Response
;
import
javax.ws.rs.core.StreamingOutput
;
import
javax.ws.rs.core.StreamingOutput
;
import
org.gitlab4j.api.Constants.TokenType
;
import
org.gitlab4j.api.Constants.TokenType
;
import
org.gitlab4j.api.GitLabApi.ApiVersion
;
import
org.gitlab4j.api.GitLabApi.ApiVersion
;
import
org.gitlab4j.api.utils.JacksonJson
;
import
org.gitlab4j.api.utils.JacksonJson
;
...
@@ -39,11 +39,13 @@ import org.glassfish.jersey.client.ClientConfig;
...
@@ -39,11 +39,13 @@ import org.glassfish.jersey.client.ClientConfig;
import
org.glassfish.jersey.client.ClientProperties
;
import
org.glassfish.jersey.client.ClientProperties
;
import
org.glassfish.jersey.client.JerseyClientBuilder
;
import
org.glassfish.jersey.client.JerseyClientBuilder
;
import
org.glassfish.jersey.jackson.JacksonFeature
;
import
org.glassfish.jersey.jackson.JacksonFeature
;
import
org.glassfish.jersey.media.multipart.BodyPart
;
import
org.glassfish.jersey.media.multipart.Boundary
;
import
org.glassfish.jersey.media.multipart.Boundary
;
import
org.glassfish.jersey.media.multipart.FormDataMultiPart
;
import
org.glassfish.jersey.media.multipart.FormDataMultiPart
;
import
org.glassfish.jersey.media.multipart.MultiPart
;
import
org.glassfish.jersey.media.multipart.MultiPart
;
import
org.glassfish.jersey.media.multipart.MultiPartFeature
;
import
org.glassfish.jersey.media.multipart.MultiPartFeature
;
import
org.glassfish.jersey.media.multipart.file.FileDataBodyPart
;
import
org.glassfish.jersey.media.multipart.file.FileDataBodyPart
;
import
org.glassfish.jersey.media.multipart.file.StreamDataBodyPart
;
/**
/**
...
@@ -61,7 +63,7 @@ public class GitLabApiClient implements AutoCloseable {
...
@@ -61,7 +63,7 @@ public class GitLabApiClient implements AutoCloseable {
private
String
baseUrl
;
private
String
baseUrl
;
private
String
hostUrl
;
private
String
hostUrl
;
private
TokenType
tokenType
=
TokenType
.
PRIVATE
;
private
TokenType
tokenType
=
TokenType
.
PRIVATE
;
private
String
authToken
;
private
Supplier
<
String
>
authToken
;
private
String
secretToken
;
private
String
secretToken
;
private
boolean
ignoreCertificateErrors
;
private
boolean
ignoreCertificateErrors
;
private
SSLContext
openSslContext
;
private
SSLContext
openSslContext
;
...
@@ -216,7 +218,7 @@ public class GitLabApiClient implements AutoCloseable {
...
@@ -216,7 +218,7 @@ public class GitLabApiClient implements AutoCloseable {
this
.
hostUrl
+=
apiVersion
.
getApiNamespace
();
this
.
hostUrl
+=
apiVersion
.
getApiNamespace
();
this
.
tokenType
=
tokenType
;
this
.
tokenType
=
tokenType
;
this
.
authToken
=
authToken
;
this
.
authToken
=
()
->
authToken
;
if
(
secretToken
!=
null
)
{
if
(
secretToken
!=
null
)
{
secretToken
=
secretToken
.
trim
();
secretToken
=
secretToken
.
trim
();
...
@@ -295,7 +297,7 @@ public class GitLabApiClient implements AutoCloseable {
...
@@ -295,7 +297,7 @@ public class GitLabApiClient implements AutoCloseable {
* @return the auth token being used by this client
* @return the auth token being used by this client
*/
*/
String
getAuthToken
()
{
String
getAuthToken
()
{
return
(
authToken
);
return
(
authToken
.
get
()
);
}
}
/**
/**
...
@@ -562,14 +564,13 @@ public class GitLabApiClient implements AutoCloseable {
...
@@ -562,14 +564,13 @@ public class GitLabApiClient implements AutoCloseable {
*
*
* @param name the name for the form field that contains the file name
* @param name the name for the form field that contains the file name
* @param fileToUpload a File instance pointing to the file to upload
* @param fileToUpload a File instance pointing to the file to upload
* @param mediaTypeString
the content-type of the uploaded file, if null will be determined from fileToUpload
* @param mediaTypeString
unused; will be removed in the next major version
* @param pathArgs variable list of arguments used to build the URI
* @param pathArgs variable list of arguments used to build the URI
* @return a ClientResponse instance with the data returned from the endpoint
* @return a ClientResponse instance with the data returned from the endpoint
* @throws IOException if an error occurs while constructing the URL
* @throws IOException if an error occurs while constructing the URL
*/
*/
protected
Response
upload
(
String
name
,
File
fileToUpload
,
String
mediaTypeString
,
Object
...
pathArgs
)
throws
IOException
{
protected
Response
upload
(
String
name
,
File
fileToUpload
,
String
mediaTypeString
,
Object
...
pathArgs
)
throws
IOException
{
URL
url
=
getApiUrl
(
pathArgs
);
return
upload
(
name
,
fileToUpload
,
mediaTypeString
,
null
,
pathArgs
);
return
(
upload
(
name
,
fileToUpload
,
mediaTypeString
,
null
,
url
));
}
}
/**
/**
...
@@ -578,7 +579,7 @@ public class GitLabApiClient implements AutoCloseable {
...
@@ -578,7 +579,7 @@ public class GitLabApiClient implements AutoCloseable {
*
*
* @param name the name for the form field that contains the file name
* @param name the name for the form field that contains the file name
* @param fileToUpload a File instance pointing to the file to upload
* @param fileToUpload a File instance pointing to the file to upload
* @param mediaTypeString
the content-type of the uploaded file, if null will be determined from fileToUpload
* @param mediaTypeString
unused; will be removed in the next major version
* @param formData the Form containing the name/value pairs
* @param formData the Form containing the name/value pairs
* @param pathArgs variable list of arguments used to build the URI
* @param pathArgs variable list of arguments used to build the URI
* @return a ClientResponse instance with the data returned from the endpoint
* @return a ClientResponse instance with the data returned from the endpoint
...
@@ -595,30 +596,38 @@ public class GitLabApiClient implements AutoCloseable {
...
@@ -595,30 +596,38 @@ public class GitLabApiClient implements AutoCloseable {
*
*
* @param name the name for the form field that contains the file name
* @param name the name for the form field that contains the file name
* @param fileToUpload a File instance pointing to the file to upload
* @param fileToUpload a File instance pointing to the file to upload
* @param mediaTypeString
the content-type of the uploaded file, if null will be determined from fileToUpload
* @param mediaTypeString
unused; will be removed in the next major version
* @param formData the Form containing the name/value pairs
* @param formData the Form containing the name/value pairs
* @param url the fully formed path to the GitLab API endpoint
* @param url the fully formed path to the GitLab API endpoint
* @return a ClientResponse instance with the data returned from the endpoint
* @return a ClientResponse instance with the data returned from the endpoint
* @throws IOException if an error occurs while constructing the URL
* @throws IOException if an error occurs while constructing the URL
*/
*/
protected
Response
upload
(
String
name
,
File
fileToUpload
,
String
mediaTypeString
,
Form
formData
,
URL
url
)
throws
IOException
{
protected
Response
upload
(
String
name
,
File
fileToUpload
,
String
mediaTypeString
,
Form
formData
,
URL
url
)
throws
IOException
{
FileDataBodyPart
filePart
=
new
FileDataBodyPart
(
name
,
fileToUpload
);
return
upload
(
filePart
,
formData
,
url
);
}
MediaType
mediaType
=
(
mediaTypeString
!=
null
?
MediaType
.
valueOf
(
mediaTypeString
)
:
null
);
protected
Response
upload
(
String
name
,
InputStream
inputStream
,
String
filename
,
String
mediaTypeString
,
Object
...
pathArgs
)
throws
IOException
{
try
(
FormDataMultiPart
multiPart
=
new
FormDataMultiPart
())
{
URL
url
=
getApiUrl
(
pathArgs
);
return
(
upload
(
name
,
inputStream
,
filename
,
mediaTypeString
,
null
,
url
));
}
protected
Response
upload
(
String
name
,
InputStream
inputStream
,
String
filename
,
String
mediaTypeString
,
Form
formData
,
URL
url
)
throws
IOException
{
StreamDataBodyPart
streamDataBodyPart
=
new
StreamDataBodyPart
(
name
,
inputStream
,
filename
);
return
upload
(
streamDataBodyPart
,
formData
,
url
);
}
protected
Response
upload
(
BodyPart
bodyPart
,
Form
formData
,
URL
url
)
throws
IOException
{
try
(
FormDataMultiPart
multiPart
=
new
FormDataMultiPart
())
{
if
(
formData
!=
null
)
{
if
(
formData
!=
null
)
{
MultivaluedMap
<
String
,
String
>
formParams
=
formData
.
asMap
();
formData
.
asMap
().
forEach
((
key
,
values
)
->
{
formParams
.
forEach
((
key
,
values
)
->
{
if
(
values
!=
null
)
{
if
(
values
!=
null
)
{
values
.
forEach
(
value
->
multiPart
.
field
(
key
,
value
));
values
.
forEach
(
value
->
multiPart
.
field
(
key
,
value
));
}
}
});
});
}
}
FileDataBodyPart
filePart
=
mediaType
!=
null
?
multiPart
.
bodyPart
(
bodyPart
);
new
FileDataBodyPart
(
name
,
fileToUpload
,
mediaType
)
:
new
FileDataBodyPart
(
name
,
fileToUpload
);
multiPart
.
bodyPart
(
filePart
);
final
Entity
<?>
entity
=
Entity
.
entity
(
multiPart
,
Boundary
.
addBoundary
(
multiPart
.
getMediaType
()));
final
Entity
<?>
entity
=
Entity
.
entity
(
multiPart
,
Boundary
.
addBoundary
(
multiPart
.
getMediaType
()));
return
(
invocation
(
url
,
null
).
post
(
entity
));
return
(
invocation
(
url
,
null
).
post
(
entity
));
}
}
...
@@ -795,7 +804,7 @@ public class GitLabApiClient implements AutoCloseable {
...
@@ -795,7 +804,7 @@ public class GitLabApiClient implements AutoCloseable {
}
}
String
authHeader
=
(
tokenType
==
TokenType
.
OAUTH2_ACCESS
?
AUTHORIZATION_HEADER
:
PRIVATE_TOKEN_HEADER
);
String
authHeader
=
(
tokenType
==
TokenType
.
OAUTH2_ACCESS
?
AUTHORIZATION_HEADER
:
PRIVATE_TOKEN_HEADER
);
String
authValue
=
(
tokenType
==
TokenType
.
OAUTH2_ACCESS
?
"Bearer "
+
authToken
:
authToken
);
String
authValue
=
(
tokenType
==
TokenType
.
OAUTH2_ACCESS
?
"Bearer "
+
authToken
.
get
()
:
authToken
.
get
()
);
Invocation
.
Builder
builder
=
target
.
request
();
Invocation
.
Builder
builder
=
target
.
request
();
if
(
accept
==
null
||
accept
.
trim
().
length
()
==
0
)
{
if
(
accept
==
null
||
accept
.
trim
().
length
()
==
0
)
{
builder
=
builder
.
header
(
authHeader
,
authValue
);
builder
=
builder
.
header
(
authHeader
,
authValue
);
...
@@ -926,4 +935,12 @@ public class GitLabApiClient implements AutoCloseable {
...
@@ -926,4 +935,12 @@ public class GitLabApiClient implements AutoCloseable {
return
(
true
);
return
(
true
);
}
}
/**
* Set auth token supplier for gitlab api client.
* @param authTokenSupplier - supplier which provide actual auth token
*/
public
void
setAuthTokenSupplier
(
Supplier
<
String
>
authTokenSupplier
)
{
this
.
authToken
=
authTokenSupplier
;
}
}
}
src/main/java/org/gitlab4j/api/ProjectApi.java
View file @
f517be4c
...
@@ -24,6 +24,7 @@
...
@@ -24,6 +24,7 @@
package
org.gitlab4j.api
;
package
org.gitlab4j.api
;
import
java.io.File
;
import
java.io.File
;
import
java.io.InputStream
;
import
java.io.UnsupportedEncodingException
;
import
java.io.UnsupportedEncodingException
;
import
java.net.URLEncoder
;
import
java.net.URLEncoder
;
import
java.util.Date
;
import
java.util.Date
;
...
@@ -32,12 +33,10 @@ import java.util.Map;
...
@@ -32,12 +33,10 @@ import java.util.Map;
import
java.util.Objects
;
import
java.util.Objects
;
import
java.util.Optional
;
import
java.util.Optional
;
import
java.util.stream.Stream
;
import
java.util.stream.Stream
;
import
javax.ws.rs.core.Form
;
import
javax.ws.rs.core.Form
;
import
javax.ws.rs.core.GenericType
;
import
javax.ws.rs.core.GenericType
;
import
javax.ws.rs.core.MultivaluedMap
;
import
javax.ws.rs.core.MultivaluedMap
;
import
javax.ws.rs.core.Response
;
import
javax.ws.rs.core.Response
;
import
org.gitlab4j.api.GitLabApi.ApiVersion
;
import
org.gitlab4j.api.GitLabApi.ApiVersion
;
import
org.gitlab4j.api.models.AccessLevel
;
import
org.gitlab4j.api.models.AccessLevel
;
import
org.gitlab4j.api.models.AccessRequest
;
import
org.gitlab4j.api.models.AccessRequest
;
...
@@ -2565,7 +2564,7 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -2565,7 +2564,7 @@ public class ProjectApi extends AbstractApi implements Constants {
*
*
* @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required
* @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required
* @param fileToUpload the File instance of the file to upload, required
* @param fileToUpload the File instance of the file to upload, required
* @param mediaType
the media type of the file to upload, opt
ion
al
* @param mediaType
unused; will be removed in the next major vers
ion
* @return a FileUpload instance with information on the just uploaded file
* @return a FileUpload instance with information on the just uploaded file
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
*/
*/
...
@@ -2574,6 +2573,22 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -2574,6 +2573,22 @@ public class ProjectApi extends AbstractApi implements Constants {
return
(
response
.
readEntity
(
FileUpload
.
class
));
return
(
response
.
readEntity
(
FileUpload
.
class
));
}
}
/**
* Uploads some data in an {@link InputStream} to the specified project,
* to be used in an issue or merge request description, or a comment.
*
* <pre><code>GitLab Endpoint: POST /projects/:id/uploads</code></pre>
*
* @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required
* @param inputStream the data to upload, required
* @return a FileUpload instance with information on the just uploaded file
* @throws GitLabApiException if any exception occurs
*/
public
FileUpload
uploadFile
(
Object
projectIdOrPath
,
InputStream
inputStream
,
String
filename
,
String
mediaType
)
throws
GitLabApiException
{
Response
response
=
upload
(
Response
.
Status
.
CREATED
,
"file"
,
inputStream
,
filename
,
mediaType
,
"projects"
,
getProjectIdOrPath
(
projectIdOrPath
),
"uploads"
);
return
(
response
.
readEntity
(
FileUpload
.
class
));
}
/**
/**
* Get the project's push rules.
* Get the project's push rules.
*
*
...
...
src/main/java/org/gitlab4j/api/models/Artifact.java
View file @
f517be4c
...
@@ -30,7 +30,7 @@ public class Artifact {
...
@@ -30,7 +30,7 @@ public class Artifact {
}
}
private
FileType
fileType
;
private
FileType
fileType
;
private
Integer
size
;
private
Long
size
;
private
String
filename
;
private
String
filename
;
private
String
fileFormat
;
private
String
fileFormat
;
...
@@ -42,11 +42,11 @@ public class Artifact {
...
@@ -42,11 +42,11 @@ public class Artifact {
this
.
fileType
=
fileType
;
this
.
fileType
=
fileType
;
}
}
public
Integer
getSize
()
{
public
Long
getSize
()
{
return
size
;
return
size
;
}
}
public
void
setSize
(
Integer
size
)
{
public
void
setSize
(
Long
size
)
{
this
.
size
=
size
;
this
.
size
=
size
;
}
}
...
...
src/main/java/org/gitlab4j/api/models/CommitStatus.java
View file @
f517be4c
...
@@ -13,7 +13,7 @@ public class CommitStatus {
...
@@ -13,7 +13,7 @@ public class CommitStatus {
private
Date
createdAt
;
private
Date
createdAt
;
private
String
description
;
private
String
description
;
private
Date
finishedAt
;
private
Date
finishedAt
;
private
Integer
id
;
private
Long
id
;
private
String
name
;
private
String
name
;
private
String
ref
;
private
String
ref
;
private
String
sha
;
private
String
sha
;
...
@@ -69,11 +69,11 @@ public class CommitStatus {
...
@@ -69,11 +69,11 @@ public class CommitStatus {
this
.
finishedAt
=
finishedAt
;
this
.
finishedAt
=
finishedAt
;
}
}
public
Integer
getId
()
{
public
Long
getId
()
{
return
id
;
return
id
;
}
}
public
void
setId
(
Integer
id
)
{
public
void
setId
(
Long
id
)
{
this
.
id
=
id
;
this
.
id
=
id
;
}
}
...
...
src/main/java/org/gitlab4j/api/models/GroupFilter.java
View file @
f517be4c
...
@@ -20,6 +20,7 @@ public class GroupFilter {
...
@@ -20,6 +20,7 @@ public class GroupFilter {
private
Boolean
withCustomAttributes
;
private
Boolean
withCustomAttributes
;
private
Boolean
owned
;
private
Boolean
owned
;
private
AccessLevel
accessLevel
;
private
AccessLevel
accessLevel
;
private
Boolean
topLevelOnly
;
/**
/**
* Do not include the provided groups IDs.
* Do not include the provided groups IDs.
...
@@ -29,7 +30,7 @@ public class GroupFilter {
...
@@ -29,7 +30,7 @@ public class GroupFilter {
*/
*/
public
GroupFilter
withSkipGroups
(
List
<
Integer
>
skipGroups
)
{
public
GroupFilter
withSkipGroups
(
List
<
Integer
>
skipGroups
)
{
this
.
skipGroups
=
skipGroups
;
this
.
skipGroups
=
skipGroups
;
return
(
this
);
return
(
this
);
}
}
/**
/**
...
@@ -41,7 +42,7 @@ public class GroupFilter {
...
@@ -41,7 +42,7 @@ public class GroupFilter {
*/
*/
public
GroupFilter
withAllAvailabley
(
Boolean
allAvailable
)
{
public
GroupFilter
withAllAvailabley
(
Boolean
allAvailable
)
{
this
.
allAvailable
=
allAvailable
;
this
.
allAvailable
=
allAvailable
;
return
(
this
);
return
(
this
);
}
}
/**
/**
...
@@ -90,7 +91,7 @@ public class GroupFilter {
...
@@ -90,7 +91,7 @@ public class GroupFilter {
/**
/**
* Include custom attributes in response (admins only).
* Include custom attributes in response (admins only).
*
*
* @param withCustomAttributes if true, include custom attributes in the response
* @param withCustomAttributes if true, include custom attributes in the response
* @return the reference to this GroupFilter instance
* @return the reference to this GroupFilter instance
*/
*/
...
@@ -121,6 +122,17 @@ public class GroupFilter {
...
@@ -121,6 +122,17 @@ public class GroupFilter {
return
(
this
);
return
(
this
);
}
}
/**
* Limit by groups which are top level groups
*
* @param topLevelOnly if true, limit to groups which are top level groups
* @return the reference to this GroupFilter instance
*/
public
GroupFilter
withTopLevelOnly
(
Boolean
topLevelOnly
)
{
this
.
topLevelOnly
=
topLevelOnly
;
return
(
this
);
}
/**
/**
* Get the query params specified by this filter.
* Get the query params specified by this filter.
*
*
...
@@ -135,8 +147,9 @@ public class GroupFilter {
...
@@ -135,8 +147,9 @@ public class GroupFilter {
.
withParam
(
"sort"
,
sort
)
.
withParam
(
"sort"
,
sort
)
.
withParam
(
"statistics"
,
statistics
)
.
withParam
(
"statistics"
,
statistics
)
.
withParam
(
"with_custom_attributes"
,
withCustomAttributes
)
.
withParam
(
"with_custom_attributes"
,
withCustomAttributes
)
.
withParam
(
"owned"
,
owned
)
.
withParam
(
"owned"
,
owned
)
.
withParam
(
"min_access_level"
,
accessLevel
)
.
withParam
(
"min_access_level"
,
accessLevel
)
.
withParam
(
"top_level_only"
,
topLevelOnly
)
);
);
}
}
}
}
src/main/java/org/gitlab4j/api/models/MergeRequest.java
View file @
f517be4c
...
@@ -41,6 +41,7 @@ public class MergeRequest {
...
@@ -41,6 +41,7 @@ public class MergeRequest {
private
Boolean
mergeWhenPipelineSucceeds
;
private
Boolean
mergeWhenPipelineSucceeds
;
private
String
mergeError
;
private
String
mergeError
;
private
Milestone
milestone
;
private
Milestone
milestone
;
private
Pipeline
pipeline
;
private
Integer
projectId
;
private
Integer
projectId
;
private
String
sha
;
private
String
sha
;
private
Boolean
shouldRemoveSourceBranch
;
private
Boolean
shouldRemoveSourceBranch
;
...
@@ -311,6 +312,14 @@ public class MergeRequest {
...
@@ -311,6 +312,14 @@ public class MergeRequest {
this
.
milestone
=
milestone
;
this
.
milestone
=
milestone
;
}
}
public
Pipeline
getPipeline
()
{
return
pipeline
;
}
public
void
setPipeline
(
Pipeline
pipeline
)
{
this
.
pipeline
=
pipeline
;
}
public
Integer
getProjectId
()
{
public
Integer
getProjectId
()
{
return
projectId
;
return
projectId
;
}
}
...
...
src/test/java/org/gitlab4j/api/TestEventsApi.java
View file @
f517be4c
...
@@ -65,6 +65,18 @@ public class TestEventsApi extends AbstractIntegrationTest {
...
@@ -65,6 +65,18 @@ public class TestEventsApi extends AbstractIntegrationTest {
assertNotNull
(
events
);
assertNotNull
(
events
);
}
}
@Test
public
void
testGetAuthenticatedUserEventsWithScope
()
throws
GitLabApiException
{
List
<
Event
>
events
=
gitLabApi
.
getEventsApi
().
getAuthenticatedUserEvents
(
null
,
null
,
null
,
null
,
null
,
1
,
10
,
Constants
.
EventScope
.
ALL
);
assertNotNull
(
events
);
}
@Test
public
void
testGetAllAuthenticatedUserEvents
()
throws
GitLabApiException
{
List
<
Event
>
events
=
gitLabApi
.
getEventsApi
().
getAllAuthenticatedUserEvents
(
null
,
null
,
null
,
null
,
null
);
assertNotNull
(
events
);
}
@Test
@Test
public
void
testGetAuthenticatedUserEventsWithDates
()
throws
GitLabApiException
{
public
void
testGetAuthenticatedUserEventsWithDates
()
throws
GitLabApiException
{
Date
after
=
new
Date
(
0
);
Date
after
=
new
Date
(
0
);
...
@@ -77,6 +89,18 @@ public class TestEventsApi extends AbstractIntegrationTest {
...
@@ -77,6 +89,18 @@ public class TestEventsApi extends AbstractIntegrationTest {
assertEquals
(
0
,
events
.
size
());
assertEquals
(
0
,
events
.
size
());
}
}
@Test
public
void
testGetAuthenticatedUserEventsWithDatesAndScope
()
throws
GitLabApiException
{
Date
after
=
new
Date
(
0
);
Date
now
=
new
Date
();
List
<
Event
>
events
=
gitLabApi
.
getEventsApi
().
getAuthenticatedUserEvents
(
null
,
null
,
now
,
after
,
null
,
1
,
10
,
Constants
.
EventScope
.
ALL
);
assertNotNull
(
events
);
events
=
gitLabApi
.
getEventsApi
().
getAuthenticatedUserEvents
(
null
,
null
,
after
,
null
,
null
,
1
,
10
,
Constants
.
EventScope
.
ALL
);
assertNotNull
(
events
);
assertEquals
(
0
,
events
.
size
());
}
@Test
@Test
public
void
testGetUserEvents
()
throws
GitLabApiException
{
public
void
testGetUserEvents
()
throws
GitLabApiException
{
assertNotNull
(
testUser
);
assertNotNull
(
testUser
);
...
@@ -107,6 +131,12 @@ public class TestEventsApi extends AbstractIntegrationTest {
...
@@ -107,6 +131,12 @@ public class TestEventsApi extends AbstractIntegrationTest {
assertNotNull
(
events
);
assertNotNull
(
events
);
}
}
@Test
public
void
testPagedGetAuthenticatedUserEventsWithScope
()
throws
GitLabApiException
{
Pager
<
Event
>
events
=
gitLabApi
.
getEventsApi
().
getAuthenticatedUserEvents
(
null
,
null
,
null
,
null
,
null
,
10
,
Constants
.
EventScope
.
ALL
);
assertNotNull
(
events
);
}
@Test
@Test
public
void
testPagedGetUserEvents
()
throws
GitLabApiException
{
public
void
testPagedGetUserEvents
()
throws
GitLabApiException
{
assertNotNull
(
testUser
);
assertNotNull
(
testUser
);
...
...
src/test/java/org/gitlab4j/api/Test
File
Upload.java
→
src/test/java/org/gitlab4j/api/TestUpload.java
View file @
f517be4c
package
org.gitlab4j.api
;
package
org.gitlab4j.api
;
import
static
org
.
hamcrest
.
MatcherAssert
.
assertThat
;
import
static
org
.
hamcrest
.
Matchers
.
endsWith
;
import
static
org
.
hamcrest
.
Matchers
.
equalTo
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
static
org
.
junit
.
Assume
.
assumeNotNull
;
import
static
org
.
junit
.
Assume
.
assumeNotNull
;
import
static
org
.
junit
.
Assume
.
assumeTrue
;
import
static
org
.
junit
.
Assume
.
assumeTrue
;
import
java.io.File
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.FileNotFoundException
;
import
java.util.Map
;
import
java.util.Map
;
import
org.gitlab4j.api.models.FileUpload
;
import
org.gitlab4j.api.models.FileUpload
;
import
org.gitlab4j.api.models.Project
;
import
org.gitlab4j.api.models.Project
;
import
org.junit.Before
;
import
org.junit.Before
;
...
@@ -18,17 +22,17 @@ import org.junit.runners.MethodSorters;
...
@@ -18,17 +22,17 @@ import org.junit.runners.MethodSorters;
/**
/**
* In order for these tests to run you must set the following properties in test-gitlab4j.properties
* In order for these tests to run you must set the following properties in test-gitlab4j.properties
*
*
* TEST_NAMESPACE
* TEST_NAMESPACE
* TEST_PROJECT_NAME
* TEST_PROJECT_NAME
* TEST_HOST_URL
* TEST_HOST_URL
* TEST_PRIVATE_TOKEN
* TEST_PRIVATE_TOKEN
*
*
* If any of the above are NULL, all tests in this class will be skipped.
* If any of the above are NULL, all tests in this class will be skipped.
*/
*/
@Category
(
IntegrationTest
.
class
)
@Category
(
IntegrationTest
.
class
)
@FixMethodOrder
(
MethodSorters
.
NAME_ASCENDING
)
@FixMethodOrder
(
MethodSorters
.
NAME_ASCENDING
)
public
class
Test
File
Upload
extends
AbstractIntegrationTest
{
public
class
TestUpload
extends
AbstractIntegrationTest
{
// The following needs to be set to your test repository
// The following needs to be set to your test repository
private
static
final
String
TEST_PROXY_URI
=
HelperUtils
.
getProperty
(
"TEST_PROXY_URI"
);
private
static
final
String
TEST_PROXY_URI
=
HelperUtils
.
getProperty
(
"TEST_PROXY_URI"
);
...
@@ -37,7 +41,7 @@ public class TestFileUpload extends AbstractIntegrationTest {
...
@@ -37,7 +41,7 @@ public class TestFileUpload extends AbstractIntegrationTest {
private
static
GitLabApi
gitLabApi
;
private
static
GitLabApi
gitLabApi
;
public
Test
File
Upload
()
{
public
TestUpload
()
{
super
();
super
();
}
}
...
@@ -93,4 +97,21 @@ public class TestFileUpload extends AbstractIntegrationTest {
...
@@ -93,4 +97,21 @@ public class TestFileUpload extends AbstractIntegrationTest {
gitLabApi
.
close
();
gitLabApi
.
close
();
}
}
@Test
public
void
testInputStreamUpload
()
throws
GitLabApiException
,
FileNotFoundException
{
Project
project
=
gitLabApi
.
getProjectApi
().
getProject
(
TEST_NAMESPACE
,
TEST_PROJECT_NAME
);
assertNotNull
(
project
);
String
filename
=
"README.md"
;
File
fileToUpload
=
new
File
(
filename
);
FileUpload
fileUpload
=
gitLabApi
.
getProjectApi
().
uploadFile
(
project
.
getId
(),
new
FileInputStream
(
fileToUpload
),
filename
,
null
);
assertNotNull
(
fileUpload
);
assertThat
(
fileUpload
.
getUrl
(),
endsWith
(
filename
));
assertThat
(
fileUpload
.
getAlt
(),
equalTo
(
filename
));
}
}
}
src/test/resources/org/gitlab4j/api/commit-status.json
View file @
f517be4c
...
@@ -16,6 +16,6 @@
...
@@ -16,6 +16,6 @@
"sha"
:
"18f3e63d05582537db6d183d9d557be09e1f90c8"
,
"sha"
:
"18f3e63d05582537db6d183d9d557be09e1f90c8"
,
"target_url"
:
"https://gitlab.example.com/thedude/gitlab-ce/builds/91"
,
"target_url"
:
"https://gitlab.example.com/thedude/gitlab-ce/builds/91"
,
"finished_at"
:
"2016-01-19T08:40:25.934Z"
,
"finished_at"
:
"2016-01-19T08:40:25.934Z"
,
"id"
:
91
,
"id"
:
2148826854
,
"ref"
:
"master"
"ref"
:
"master"
}
}
\ No newline at end of file
src/test/resources/org/gitlab4j/api/job.json
View file @
f517be4c
...
@@ -15,6 +15,7 @@
...
@@ -15,6 +15,7 @@
},
},
"artifacts"
:
[
"artifacts"
:
[
{
"file_type"
:
"archive"
,
"size"
:
1000
,
"filename"
:
"artifacts.zip"
,
"file_format"
:
"zip"
},
{
"file_type"
:
"archive"
,
"size"
:
1000
,
"filename"
:
"artifacts.zip"
,
"file_format"
:
"zip"
},
{
"file_type"
:
"archive"
,
"size"
:
9223372036854775807
,
"filename"
:
"long.max_value.sized.zip"
,
"file_format"
:
"zip"
},
{
"file_type"
:
"metadata"
,
"size"
:
186
,
"filename"
:
"metadata.gz"
,
"file_format"
:
"gzip"
},
{
"file_type"
:
"metadata"
,
"size"
:
186
,
"filename"
:
"metadata.gz"
,
"file_format"
:
"gzip"
},
{
"file_type"
:
"trace"
,
"size"
:
1500
,
"filename"
:
"job.log"
,
"file_format"
:
"raw"
},
{
"file_type"
:
"trace"
,
"size"
:
1500
,
"filename"
:
"job.log"
,
"file_format"
:
"raw"
},
{
"file_type"
:
"junit"
,
"size"
:
750
,
"filename"
:
"junit.xml.gz"
,
"file_format"
:
"gzip"
}
{
"file_type"
:
"junit"
,
"size"
:
750
,
"filename"
:
"junit.xml.gz"
,
"file_format"
:
"gzip"
}
...
@@ -61,4 +62,4 @@
...
@@ -61,4 +62,4 @@
"created_at"
:
"2013-09-30T13:46:02Z"
"created_at"
:
"2013-09-30T13:46:02Z"
}
}
}
}
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment