import com.google.gson.annotations.SerializedName;
import java.util.List;
+import javax.annotation.CheckForNull;
+import javax.annotation.Nullable;
import static org.sonar.alm.client.github.GithubApplicationClient.Repository;
public class GithubBinding {
private GithubBinding() {
- //nothing to do
+ // nothing to do
+ }
+
+ public static class GsonApp {
+
+ @SerializedName("installations_count")
+ private long installationsCount;
+
+ @SerializedName("permissions")
+ Permissions permissions;
+
+ public GsonApp(long installationsCount, Permissions permissions) {
+ this.installationsCount = installationsCount;
+ this.permissions = permissions;
+ }
+
+ public GsonApp() {
+ // http://stackoverflow.com/a/18645370/229031
+ }
+
+ public Permissions getPermissions() {
+ return permissions;
+ }
+
+ public long getInstallationsCount() {
+ return installationsCount;
+ }
}
public static class GsonInstallations {
return account;
}
- public static class Permissions {
- @SerializedName("checks")
- String checks;
- @SerializedName("members")
- String members;
-
- public Permissions(String checks, String members) {
- this.checks = checks;
- this.members = members;
- }
-
- public Permissions() {
- // even if empty constructor is not required for Gson, it is strongly
- // recommended:
- // http://stackoverflow.com/a/18645370/229031
- }
-
- public String getMembers() {
- return members;
- }
-
- public String getChecks() {
- return checks;
- }
- }
-
public static class GsonAccount {
@SerializedName("id")
long id;
}
}
+ public static class Permissions {
+ @SerializedName("checks")
+ String checks;
+ @SerializedName("members")
+ String members;
+ @SerializedName("emails")
+ String emails;
+
+ public Permissions(@Nullable String checks, @Nullable String members, @Nullable String emails) {
+ this.checks = checks;
+ this.members = members;
+ this.emails = emails;
+ }
+
+ public Permissions() {
+ // even if empty constructor is not required for Gson, it is strongly
+ // recommended:
+ // http://stackoverflow.com/a/18645370/229031
+ }
+
+ @CheckForNull
+ public String getMembers() {
+ return members;
+ }
+
+ @CheckForNull
+ public String getChecks() {
+ return checks;
+ }
+
+ @CheckForNull
+ public String getEmails() {
+ return emails;
+ }
+ }
+
public static class GsonRepositorySearch {
@SerializedName("total_count")
int totalCount;
private static final String CATEGORY = "authentication";
private static final String SUBCATEGORY = "github";
+
private final Configuration configuration;
private final InternalProperties internalProperties;
return urlWithEndingSlash(configuration.get(API_URL).orElse(""));
}
+ public String apiURLOrDefault() {
+ return configuration.get(API_URL).map(GitHubSettings::urlWithEndingSlash).orElse(DEFAULT_API_URL);
+ }
+
public Set<String> getOrganizations() {
return Set.of(configuration.getStringArray(ORGANIZATIONS));
}