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
b404e8a7
Unverified
Commit
b404e8a7
authored
Apr 12, 2023
by
Gautier de Saint Martin Lacaze
Committed by
GitHub
Apr 12, 2023
Browse files
Merge pull request #947 from jmini/move-to-jakarta
Replace javax package by jakarta package
parents
4289c1f9
1995a3f2
Changes
92
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/gitlab4j/api/ProjectApi.java
View file @
b404e8a7
...
...
@@ -33,10 +33,10 @@ import java.util.Map;
import
java.util.Objects
;
import
java.util.Optional
;
import
java.util.stream.Stream
;
import
ja
vax
.ws.rs.core.Form
;
import
ja
vax
.ws.rs.core.GenericType
;
import
ja
vax
.ws.rs.core.MultivaluedMap
;
import
ja
vax
.ws.rs.core.Response
;
import
ja
karta
.ws.rs.core.Form
;
import
ja
karta
.ws.rs.core.GenericType
;
import
ja
karta
.ws.rs.core.MultivaluedMap
;
import
ja
karta
.ws.rs.core.Response
;
import
org.gitlab4j.api.GitLabApi.ApiVersion
;
import
org.gitlab4j.api.models.AccessLevel
;
import
org.gitlab4j.api.models.AccessRequest
;
...
...
src/main/java/org/gitlab4j/api/ProtectedBranchesApi.java
View file @
b404e8a7
...
...
@@ -4,8 +4,8 @@ import java.util.List;
import
java.util.Optional
;
import
java.util.stream.Stream
;
import
ja
vax
.ws.rs.core.Form
;
import
ja
vax
.ws.rs.core.Response
;
import
ja
karta
.ws.rs.core.Form
;
import
ja
karta
.ws.rs.core.Response
;
import
org.gitlab4j.api.models.AccessLevel
;
import
org.gitlab4j.api.models.AllowedTo
;
...
...
src/main/java/org/gitlab4j/api/ReleaseLinksApi.java
0 → 100644
View file @
b404e8a7
package
org.gitlab4j.api
;
import
org.gitlab4j.api.models.Link
;
import
org.gitlab4j.api.models.ReleaseLinkParams
;
import
jakarta.ws.rs.core.Response
;
import
java.util.List
;
import
java.util.Optional
;
import
java.util.stream.Stream
;
/**
* This class provides an entry point to all the GitLab ReleaseLinks API calls.
* @see <a href="https://docs.gitlab.com/ce/api/releases/links.html">ReleaseLinks API at GitLab</a>
*/
public
class
ReleaseLinksApi
extends
AbstractApi
{
public
ReleaseLinksApi
(
GitLabApi
gitLabApi
)
{
super
(
gitLabApi
);
}
/**
* Get assets as Links from a Release.
*
* <pre><code>GitLab Endpoint: GET /projects/:id/releases/:tagName/assets/links</code></pre>
*
* @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path
* @param tagName the tag name that the release was created from
* @return the list of assets for the specified release
* @throws GitLabApiException if any exception occurs
*/
public
List
<
Link
>
getLinks
(
Object
projectIdOrPath
,
String
tagName
)
throws
GitLabApiException
{
return
(
getLinks
(
projectIdOrPath
,
tagName
,
getDefaultPerPage
()).
all
());
}
/**
* Get assets as Links from a Release.
*
* <pre><code>GitLab Endpoint: GET /projects/:id/releases/:tagName/assets/links</code></pre>
*
* @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path
* @param tagName the tag name that the release was created from
* @param itemsPerPage the number of Link instances that will be fetched per page
* @return the Pager of Link instances for the specified project ID
* @throws GitLabApiException if any exception occurs
*/
public
Pager
<
Link
>
getLinks
(
Object
projectIdOrPath
,
String
tagName
,
int
itemsPerPage
)
throws
GitLabApiException
{
return
(
new
Pager
<
Link
>(
this
,
Link
.
class
,
itemsPerPage
,
null
,
"projects"
,
getProjectIdOrPath
(
projectIdOrPath
),
"releases"
,
urlEncode
(
tagName
),
"assets"
,
"links"
));
}
/**
* Get a Stream of assets as Links from a Release.
*
* <pre><code>GitLab Endpoint: GET /projects/:id/releases/:tagName/assets/links</code></pre>
*
* @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path
* @param tagName the tag name that the release was created from
* @return a Stream of Link instances for the specified project ID
* @throws GitLabApiException if any exception occurs
*/
public
Stream
<
Link
>
getLinksStream
(
Object
projectIdOrPath
,
String
tagName
)
throws
GitLabApiException
{
return
(
getLinks
(
projectIdOrPath
,
tagName
,
getDefaultPerPage
()).
stream
());
}
/**
* Get a Link for the given tag name and link id.
*
* <pre><code>GitLab Endpoint: GET /projects/:id/releases/:tagName/assets/links/:linkId</code></pre>
*
* @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path
* @param tagName the name of the tag to fetch the Link for
* @param linkId the id of the Link to fetch for
* @return a Link instance with info on the specified tag and id
* @throws GitLabApiException if any exception occurs
*/
public
Link
getLink
(
Object
projectIdOrPath
,
String
tagName
,
Integer
linkId
)
throws
GitLabApiException
{
Response
response
=
get
(
Response
.
Status
.
OK
,
null
,
"projects"
,
getProjectIdOrPath
(
projectIdOrPath
),
"releases"
,
urlEncode
(
tagName
),
"assets"
,
"links"
,
linkId
);
return
(
response
.
readEntity
(
Link
.
class
));
}
/**
* Get an Optional instance holding a Link instance for the specific tag name and link id.
*
* <pre><code>GitLab Endpoint: GET /projects/:id/releases/:tagName/assets/links/:linkId</code></pre>
*
* @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path
* @param tagName the name of the tag to fetch the Link for
* @param linkId the id of the Link to fetch for
* @return an Optional instance with the specified Link as the value
* @throws GitLabApiException if any exception occurs
*/
public
Optional
<
Link
>
getOptionalLink
(
Object
projectIdOrPath
,
String
tagName
,
Integer
linkId
)
throws
GitLabApiException
{
try
{
return
(
Optional
.
ofNullable
(
getLink
(
projectIdOrPath
,
tagName
,
linkId
)));
}
catch
(
GitLabApiException
glae
)
{
return
(
GitLabApi
.
createOptionalFromException
(
glae
));
}
}
/**
* Create a Link. You need push access to the repository to create a Link.
*
* <pre><code>GitLab Endpoint: POST /projects/:id/releases/:tagName/assets/links</code></pre>
*
* @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path
* @param params a ReleaseLinksParams instance holding the parameters for the link
* @return a Link instance containing the newly created Link info
* @throws GitLabApiException if any exception occurs
*/
public
Link
createLink
(
Object
projectIdOrPath
,
ReleaseLinkParams
params
)
throws
GitLabApiException
{
String
tagName
=
params
.
getTagName
();
if
(
tagName
==
null
||
tagName
.
trim
().
isEmpty
())
{
throw
new
RuntimeException
(
"params.tagName cannot be null or empty"
);
}
String
name
=
params
.
getName
();
if
(
name
==
null
||
name
.
trim
().
isEmpty
())
{
throw
new
RuntimeException
(
"params.name cannot be null or empty"
);
}
String
url
=
params
.
getUrl
();
if
(
url
==
null
||
url
.
trim
().
isEmpty
())
{
throw
new
RuntimeException
(
"params.url cannot be null or empty"
);
}
Response
response
=
post
(
Response
.
Status
.
CREATED
,
params
,
"projects"
,
getProjectIdOrPath
(
projectIdOrPath
),
"releases"
,
urlEncode
(
tagName
),
"assets"
,
"links"
);
return
(
response
.
readEntity
(
Link
.
class
));
}
/**
* Updates the attributes of a given Link.
*
* <pre><code>GitLab Endpoint: PUT /projects/:id/releases/:tagName/assets/links/:linkId</code></pre>
*
* @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path
* @param linkId the id of the Link to fetch for
* @param params a ReleaseLinksParams instance holding the parameters for the Link
* @return a Link instance containing info on the updated Link
* @throws GitLabApiException if any exception occurs
*/
public
Link
updateLink
(
Object
projectIdOrPath
,
Integer
linkId
,
ReleaseLinkParams
params
)
throws
GitLabApiException
{
String
tagName
=
params
.
getTagName
();
if
(
tagName
==
null
||
tagName
.
trim
().
isEmpty
())
{
throw
new
RuntimeException
(
"params.tagName cannot be null or empty"
);
}
if
(
linkId
==
null
)
{
throw
new
RuntimeException
(
"linkId cannot be null"
);
}
Response
response
=
put
(
Response
.
Status
.
OK
,
params
,
"projects"
,
getProjectIdOrPath
(
projectIdOrPath
),
"releases"
,
urlEncode
(
tagName
),
"assets"
,
"links"
,
linkId
);
return
(
response
.
readEntity
(
Link
.
class
));
}
/**
* Delete a Link.
*
* <pre><code>GitLab Endpoint: DELETE /projects/:id/releases/:tagName/assets/links/:linkId</code></pre>
*
* @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
* @param tagName the tag name that the link was created from
* @param linkId the id of the Link to delete
* @throws GitLabApiException if any exception occurs
*/
public
void
deleteLink
(
Object
projectIdOrPath
,
String
tagName
,
Integer
linkId
)
throws
GitLabApiException
{
delete
(
Response
.
Status
.
OK
,
null
,
"projects"
,
getProjectIdOrPath
(
projectIdOrPath
),
"releases"
,
urlEncode
(
tagName
),
"assets"
,
"links"
,
linkId
);
}
}
src/main/java/org/gitlab4j/api/ReleasesApi.java
View file @
b404e8a7
...
...
@@ -4,7 +4,7 @@ import java.util.List;
import
java.util.Optional
;
import
java.util.stream.Stream
;
import
ja
vax
.ws.rs.core.Response
;
import
ja
karta
.ws.rs.core.Response
;
import
org.gitlab4j.api.models.Release
;
import
org.gitlab4j.api.models.ReleaseParams
;
...
...
src/main/java/org/gitlab4j/api/RepositoryApi.java
View file @
b404e8a7
...
...
@@ -10,11 +10,11 @@ import java.util.List;
import
java.util.Optional
;
import
java.util.stream.Stream
;
import
ja
vax
.ws.rs.core.Form
;
import
ja
vax
.ws.rs.core.GenericType
;
import
ja
vax
.ws.rs.core.MediaType
;
import
ja
vax
.ws.rs.core.MultivaluedMap
;
import
ja
vax
.ws.rs.core.Response
;
import
ja
karta
.ws.rs.core.Form
;
import
ja
karta
.ws.rs.core.GenericType
;
import
ja
karta
.ws.rs.core.MediaType
;
import
ja
karta
.ws.rs.core.MultivaluedMap
;
import
ja
karta
.ws.rs.core.Response
;
import
org.gitlab4j.api.GitLabApi.ApiVersion
;
import
org.gitlab4j.api.models.Branch
;
...
...
src/main/java/org/gitlab4j/api/RepositoryFileApi.java
View file @
b404e8a7
...
...
@@ -9,9 +9,9 @@ import java.util.List;
import
java.util.Optional
;
import
java.util.stream.Stream
;
import
ja
vax
.ws.rs.core.Form
;
import
ja
vax
.ws.rs.core.MediaType
;
import
ja
vax
.ws.rs.core.Response
;
import
ja
karta
.ws.rs.core.Form
;
import
ja
karta
.ws.rs.core.MediaType
;
import
ja
karta
.ws.rs.core.Response
;
import
org.gitlab4j.api.GitLabApi.ApiVersion
;
import
org.gitlab4j.api.models.Blame
;
...
...
src/main/java/org/gitlab4j/api/ResourceLabelEventsApi.java
View file @
b404e8a7
...
...
@@ -4,7 +4,7 @@ import java.util.List;
import
java.util.Optional
;
import
java.util.stream.Stream
;
import
ja
vax
.ws.rs.core.Response
;
import
ja
karta
.ws.rs.core.Response
;
import
org.gitlab4j.api.models.LabelEvent
;
...
...
src/main/java/org/gitlab4j/api/RunnersApi.java
View file @
b404e8a7
...
...
@@ -3,8 +3,8 @@ package org.gitlab4j.api;
import
java.util.List
;
import
java.util.stream.Stream
;
import
ja
vax
.ws.rs.core.GenericType
;
import
ja
vax
.ws.rs.core.Response
;
import
ja
karta
.ws.rs.core.GenericType
;
import
ja
karta
.ws.rs.core.Response
;
import
org.gitlab4j.api.models.Job
;
import
org.gitlab4j.api.models.JobStatus
;
...
...
src/main/java/org/gitlab4j/api/ServicesApi.java
View file @
b404e8a7
...
...
@@ -10,8 +10,8 @@ import org.gitlab4j.api.services.JiraService;
import
org.gitlab4j.api.services.MattermostService
;
import
org.gitlab4j.api.services.SlackService
;
import
ja
vax
.ws.rs.core.Form
;
import
ja
vax
.ws.rs.core.Response
;
import
ja
karta
.ws.rs.core.Form
;
import
ja
karta
.ws.rs.core.Response
;
/**
* Access for the services API. Currently only the gitlab-ci, HipChatService, Slack, and JIRA service are supported.
...
...
src/main/java/org/gitlab4j/api/SnippetsApi.java
View file @
b404e8a7
...
...
@@ -4,8 +4,8 @@ import java.util.List;
import
java.util.Optional
;
import
java.util.stream.Stream
;
import
ja
vax
.ws.rs.core.GenericType
;
import
ja
vax
.ws.rs.core.Response
;
import
ja
karta
.ws.rs.core.GenericType
;
import
ja
karta
.ws.rs.core.Response
;
import
org.gitlab4j.api.models.Snippet
;
import
org.gitlab4j.api.models.Visibility
;
...
...
src/main/java/org/gitlab4j/api/SystemHooksApi.java
View file @
b404e8a7
...
...
@@ -3,8 +3,8 @@ package org.gitlab4j.api;
import
java.util.List
;
import
java.util.stream.Stream
;
import
ja
vax
.ws.rs.core.GenericType
;
import
ja
vax
.ws.rs.core.Response
;
import
ja
karta
.ws.rs.core.GenericType
;
import
ja
karta
.ws.rs.core.Response
;
import
org.gitlab4j.api.GitLabApi.ApiVersion
;
import
org.gitlab4j.api.models.SystemHook
;
...
...
src/main/java/org/gitlab4j/api/TagsApi.java
View file @
b404e8a7
...
...
@@ -6,9 +6,9 @@ import java.util.List;
import
java.util.Optional
;
import
java.util.stream.Stream
;
import
ja
vax
.ws.rs.core.Form
;
import
ja
vax
.ws.rs.core.GenericType
;
import
ja
vax
.ws.rs.core.Response
;
import
ja
karta
.ws.rs.core.Form
;
import
ja
karta
.ws.rs.core.GenericType
;
import
ja
karta
.ws.rs.core.Response
;
import
org.gitlab4j.api.GitLabApi.ApiVersion
;
import
org.gitlab4j.api.models.AccessLevel
;
...
...
src/main/java/org/gitlab4j/api/TodosApi.java
View file @
b404e8a7
...
...
@@ -3,7 +3,7 @@ package org.gitlab4j.api;
import
java.util.List
;
import
java.util.stream.Stream
;
import
ja
vax
.ws.rs.core.Response
;
import
ja
karta
.ws.rs.core.Response
;
import
org.gitlab4j.api.models.Todo
;
...
...
src/main/java/org/gitlab4j/api/UserApi.java
View file @
b404e8a7
...
...
@@ -7,9 +7,9 @@ import java.util.Objects;
import
java.util.Optional
;
import
java.util.stream.Stream
;
import
ja
vax
.ws.rs.core.Form
;
import
ja
vax
.ws.rs.core.GenericType
;
import
ja
vax
.ws.rs.core.Response
;
import
ja
karta
.ws.rs.core.Form
;
import
ja
karta
.ws.rs.core.GenericType
;
import
ja
karta
.ws.rs.core.Response
;
import
org.gitlab4j.api.GitLabApi.ApiVersion
;
import
org.gitlab4j.api.models.CustomAttribute
;
...
...
src/main/java/org/gitlab4j/api/WikisApi.java
View file @
b404e8a7
...
...
@@ -30,8 +30,8 @@ import java.util.List;
import
java.util.Optional
;
import
java.util.stream.Stream
;
import
ja
vax
.ws.rs.core.GenericType
;
import
ja
vax
.ws.rs.core.Response
;
import
ja
karta
.ws.rs.core.GenericType
;
import
ja
karta
.ws.rs.core.Response
;
import
org.gitlab4j.api.models.WikiAttachment
;
import
org.gitlab4j.api.models.WikiPage
;
...
...
src/main/java/org/gitlab4j/api/models/Job.java
View file @
b404e8a7
...
...
@@ -29,6 +29,7 @@ public class Job {
private
Boolean
manual
;
private
Boolean
allowFailure
;
private
Float
duration
;
private
Float
queuedDuration
;
private
Project
project
;
public
Long
getId
()
{
...
...
@@ -206,11 +207,18 @@ public class Job {
public
void
setDuration
(
Float
duration
)
{
this
.
duration
=
duration
;
}
public
Float
getQueuedDuration
()
{
return
queuedDuration
;
}
public
void
setQueuedDuration
(
Float
queuedDuration
)
{
this
.
queuedDuration
=
queuedDuration
;
}
public
Project
getProject
()
{
return
project
;
}
public
void
setProject
(
Project
project
)
{
this
.
project
=
project
;
}
...
...
@@ -304,12 +312,16 @@ public class Job {
this
.
allowFailure
=
allowFailure
;
return
this
;
}
public
Job
withDuration
(
Float
duration
)
{
this
.
duration
=
duration
;
return
this
;
}
public
Job
withQueuedDuration
(
Float
queuedDuration
)
{
this
.
queuedDuration
=
queuedDuration
;
return
this
;
}
public
Job
withProject
(
Project
project
)
{
this
.
project
=
project
;
return
this
;
...
...
src/main/java/org/gitlab4j/api/models/Link.java
0 → 100644
View file @
b404e8a7
package
org.gitlab4j.api.models
;
import
org.gitlab4j.api.utils.JacksonJson
;
import
java.util.Date
;
import
java.util.List
;
public
class
Link
{
private
Integer
id
;
private
String
name
;
private
String
url
;
/**
* @deprecated deprecated in GitLab 15.9, will be removed in GitLab 16.0.
*/
@Deprecated
private
Boolean
external
;
private
String
linkType
;
public
Integer
getId
()
{
return
id
;
}
public
void
setId
(
Integer
id
)
{
this
.
id
=
id
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getUrl
()
{
return
url
;
}
public
void
setUrl
(
String
url
)
{
this
.
url
=
url
;
}
/**
* @deprecated deprecated in GitLab 15.9, will be removed in GitLab 16.0.
*/
@Deprecated
public
Boolean
getExternal
()
{
return
external
;
}
/**
* @deprecated deprecated in GitLab 15.9, will be removed in GitLab 16.0.
*/
@Deprecated
public
void
setExternal
(
Boolean
external
)
{
this
.
external
=
external
;
}
public
String
getLinkType
()
{
return
linkType
;
}
public
void
setLinkType
(
String
linkType
)
{
this
.
linkType
=
linkType
;
}
@Override
public
String
toString
()
{
return
(
JacksonJson
.
toJsonString
(
this
));
}
}
src/main/java/org/gitlab4j/api/models/Pipeline.java
View file @
b404e8a7
...
...
@@ -22,6 +22,7 @@ public class Pipeline {
private
Date
committedAt
;
private
String
coverage
;
private
Integer
duration
;
private
Float
queuedDuration
;
private
String
webUrl
;
private
DetailedStatus
detailedStatus
;
...
...
@@ -225,6 +226,14 @@ public class Pipeline {
this
.
duration
=
duration
;
}
public
Float
getQueuedDuration
()
{
return
queuedDuration
;
}
public
void
setQueuedDuration
(
Float
queuedDuration
)
{
this
.
queuedDuration
=
queuedDuration
;
}
public
String
getWebUrl
()
{
return
webUrl
;
}
...
...
src/main/java/org/gitlab4j/api/models/ReleaseLinkParams.java
0 → 100644
View file @
b404e8a7
package
org.gitlab4j.api.models
;
import
org.gitlab4j.api.utils.JacksonJson
;
import
java.util.Date
;
import
java.util.List
;
public
class
ReleaseLinkParams
{
private
String
name
;
private
String
tagName
;
private
String
url
;
private
String
filepath
;
private
String
linkType
;
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
ReleaseLinkParams
withName
(
String
name
)
{
this
.
name
=
name
;
return
(
this
);
}
public
String
getTagName
()
{
return
tagName
;
}
public
void
setTagName
(
String
tagName
)
{
this
.
tagName
=
tagName
;
}
public
ReleaseLinkParams
withTagName
(
String
tagName
)
{
this
.
tagName
=
tagName
;
return
(
this
);
}
public
String
getUrl
()
{
return
url
;
}
public
void
setUrl
(
String
url
)
{
this
.
url
=
url
;
}
public
ReleaseLinkParams
withUrl
(
String
url
)
{
this
.
url
=
url
;
return
(
this
);
}
public
String
getFilepath
()
{
return
filepath
;
}
public
void
setFilepath
(
String
filepath
)
{
this
.
filepath
=
filepath
;
}
public
ReleaseLinkParams
withFilepath
(
String
filepath
)
{
this
.
filepath
=
filepath
;
return
(
this
);
}
public
String
getLinkType
()
{
return
linkType
;
}
public
void
setLinkType
(
String
linkType
)
{
this
.
linkType
=
linkType
;
}
public
ReleaseLinkParams
withLinkType
(
String
linkType
)
{
this
.
linkType
=
linkType
;
return
(
this
);
}
@Override
public
String
toString
()
{
return
(
JacksonJson
.
toJsonString
(
this
));
}
}
src/main/java/org/gitlab4j/api/systemhooks/SystemHookManager.java
View file @
b404e8a7
...
...
@@ -7,7 +7,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
ja
vax
.servlet.http.HttpServletRequest
;
import
ja
karta
.servlet.http.HttpServletRequest
;
import
org.gitlab4j.api.GitLabApiException
;
import
org.gitlab4j.api.HookManager
;
...
...
Prev
1
2
3
4
5
Next
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