Skip to content

Commit 3697df3

Browse files
committed
Added Applications API support (#338).
1 parent eac251a commit 3697df3

File tree

2 files changed

+64
-0
lines changed

2 files changed

+64
-0
lines changed

src/main/java/org/gitlab4j/api/Constants.java

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -526,4 +526,48 @@ public String toString() {
526526
return (enumHelper.toString(this));
527527
}
528528
}
529+
530+
/**
531+
* Enum for the various Application scope values.
532+
*/
533+
public enum ApplicationScope {
534+
535+
/** Access the authenticated user's API */
536+
API,
537+
538+
/** Read the authenticated user's personal information */
539+
READ_USER,
540+
541+
/** Perform API actions as any user in the system */
542+
SUDO,
543+
544+
/** Allows read-access to the repository */
545+
READ_REPOSITORY,
546+
547+
/** Authenticate using OpenID Connect */
548+
OPENID,
549+
550+
/** Allows read-only access to the user's personal information using OpenID Connect */
551+
PROFILE,
552+
553+
/** Allows read-only access to the user's primary email address using OpenID Connect */
554+
EMAIL;
555+
556+
private static JacksonJsonEnumHelper<ApplicationScope> enumHelper = new JacksonJsonEnumHelper<>(ApplicationScope.class);
557+
558+
@JsonCreator
559+
public static ApplicationScope forValue(String value) {
560+
return enumHelper.forValue(value);
561+
}
562+
563+
@JsonValue
564+
public String toValue() {
565+
return (enumHelper.toString(this));
566+
}
567+
568+
@Override
569+
public String toString() {
570+
return (enumHelper.toString(this));
571+
}
572+
}
529573
}

src/main/java/org/gitlab4j/api/GitLabApi.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ public String getApiNamespace() {
5151
private int defaultPerPage = DEFAULT_PER_PAGE;
5252
private Session session;
5353

54+
private ApplicationsApi applicationsApi;
5455
private AwardEmojiApi awardEmojiApi;
5556
private BoardsApi boardsApi;
5657
private CommitsApi commitsApi;
@@ -892,6 +893,25 @@ class VersionApi extends AbstractApi {
892893
return (response.readEntity(Version.class));
893894
}
894895

896+
/**
897+
* Gets the ApplicationsApi instance owned by this GitLabApi instance. The ApplicationsApi is used
898+
* to perform all OAUTH application related API calls.
899+
*
900+
* @return the ApplicationsApi instance owned by this GitLabApi instance
901+
*/
902+
public ApplicationsApi getApplicationsApi() {
903+
904+
if (applicationsApi == null) {
905+
synchronized (this) {
906+
if (applicationsApi == null) {
907+
applicationsApi = new ApplicationsApi(this);
908+
}
909+
}
910+
}
911+
912+
return (applicationsApi);
913+
}
914+
895915
/**
896916
* Gets the AwardEmojiApi instance owned by this GitLabApi instance. The AwardEmojiApi is used
897917
* to perform all award emoji related API calls.

0 commit comments

Comments
 (0)