mirror of
https://github.com/jlengrand/github-api.git
synced 2026-03-20 00:11:22 +00:00
Compare commits
32 Commits
github-api
...
github-api
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dbf6d3bf37 | ||
|
|
081a454ec8 | ||
|
|
543b643fdb | ||
|
|
d02f194668 | ||
|
|
9c8c00b77c | ||
|
|
a23de4707b | ||
|
|
301303bd90 | ||
|
|
4689b8f885 | ||
|
|
c4de682493 | ||
|
|
b23934a5a1 | ||
|
|
f2eecc3cc5 | ||
|
|
f5310965dc | ||
|
|
47ffff3407 | ||
|
|
f2a70a46ad | ||
|
|
acd5c6baa6 | ||
|
|
06d02059cb | ||
|
|
603288c361 | ||
|
|
09ee3168f9 | ||
|
|
1559d063c7 | ||
|
|
cfdcb182a4 | ||
|
|
d526b13d7d | ||
|
|
fffe31220e | ||
|
|
ce17396ea6 | ||
|
|
d18e81dc74 | ||
|
|
6ae5acba5d | ||
|
|
0a1c803f69 | ||
|
|
fa0865b208 | ||
|
|
886887913c | ||
|
|
5c64fec032 | ||
|
|
892f60ea16 | ||
|
|
72dc5c5d18 | ||
|
|
e629a23bd4 |
9
.github/workflows/maven-build.yml
vendored
9
.github/workflows/maven-build.yml
vendored
@@ -17,9 +17,10 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up JDK
|
||||
uses: actions/setup-java@v1
|
||||
uses: actions/setup-java@v2
|
||||
with:
|
||||
java-version: ${{ matrix.java }}
|
||||
distribution: 'adopt'
|
||||
- name: Cached .m2
|
||||
uses: actions/cache@v2.1.5
|
||||
with:
|
||||
@@ -41,9 +42,10 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up JDK
|
||||
uses: actions/setup-java@v1
|
||||
uses: actions/setup-java@v2
|
||||
with:
|
||||
java-version: ${{ matrix.java }}
|
||||
distribution: 'adopt'
|
||||
- uses: actions/cache@v2.1.5
|
||||
with:
|
||||
path: ~/.m2/repository
|
||||
@@ -63,9 +65,10 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up JDK
|
||||
uses: actions/setup-java@v1
|
||||
uses: actions/setup-java@v2
|
||||
with:
|
||||
java-version: ${{ matrix.java }}
|
||||
distribution: 'adopt'
|
||||
- uses: actions/cache@v2.1.5
|
||||
with:
|
||||
path: ~/.m2/repository
|
||||
|
||||
11
.github/workflows/release-drafter.yml
vendored
Normal file
11
.github/workflows/release-drafter.yml
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
|
||||
name: Release Drafter
|
||||
|
||||
on: push
|
||||
|
||||
jobs:
|
||||
update_release_draft:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Release Drafter
|
||||
uses: release-drafter/release-drafter@v5.15.0
|
||||
12
pom.xml
12
pom.xml
@@ -2,7 +2,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.kohsuke</groupId>
|
||||
<artifactId>github-api</artifactId>
|
||||
<version>1.128</version>
|
||||
<version>1.129</version>
|
||||
<name>GitHub API for Java</name>
|
||||
<url>https://github-api.kohsuke.org/</url>
|
||||
<description>GitHub API for Java</description>
|
||||
@@ -11,7 +11,7 @@
|
||||
<connection>scm:git:git@github.com/hub4j/${project.artifactId}.git</connection>
|
||||
<developerConnection>scm:git:ssh://git@github.com/hub4j/${project.artifactId}.git</developerConnection>
|
||||
<url>https://github.com/hub4j/github-api/</url>
|
||||
<tag>github-api-1.128</tag>
|
||||
<tag>github-api-1.129</tag>
|
||||
</scm>
|
||||
|
||||
<distributionManagement>
|
||||
@@ -110,6 +110,8 @@
|
||||
</goals>
|
||||
<configuration>
|
||||
<propertyName>jacoco.surefire.argLine</propertyName>
|
||||
<!-- no need to get data about external code. It dramatically reduces performance of JaCoCo for nothing -->
|
||||
<include>org.kohsuke.*</include>
|
||||
</configuration>
|
||||
</execution>
|
||||
<!-- attached to Maven test phase -->
|
||||
@@ -248,7 +250,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-project-info-reports-plugin</artifactId>
|
||||
<version>3.1.1</version>
|
||||
<version>3.1.2</version>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.bcel</groupId>
|
||||
@@ -321,7 +323,7 @@
|
||||
<plugin>
|
||||
<groupId>com.diffplug.spotless</groupId>
|
||||
<artifactId>spotless-maven-plugin</artifactId>
|
||||
<version>2.10.1</version>
|
||||
<version>2.10.3</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>spotless-check</id>
|
||||
@@ -429,7 +431,7 @@
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>2.4</version>
|
||||
<version>2.8.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.infradna.tool</groupId>
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
package org.kohsuke.github;
|
||||
|
||||
import org.kohsuke.github.internal.EnumUtils;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* Hook event type.
|
||||
*
|
||||
@@ -85,4 +89,46 @@ public enum GHEvent {
|
||||
return "*";
|
||||
return name().toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
/**
|
||||
* Representation of GitHub Event Type
|
||||
*
|
||||
* @see <a href="https://docs.github.com/en/developers/webhooks-and-events/github-event-types">GitHub event
|
||||
* types</a>
|
||||
*/
|
||||
enum GitHubEventType {
|
||||
CommitCommentEvent(COMMIT_COMMENT),
|
||||
CreateEvent(CREATE),
|
||||
DeleteEvent(DELETE),
|
||||
ForkEvent(FORK),
|
||||
GollumEvent(GOLLUM),
|
||||
IssueCommentEvent(ISSUE_COMMENT),
|
||||
IssuesEvent(ISSUES),
|
||||
MemberEvent(MEMBER),
|
||||
PublicEvent(PUBLIC),
|
||||
PullRequestEvent(PULL_REQUEST),
|
||||
PullRequestReviewEvent(PULL_REQUEST_REVIEW),
|
||||
PullRequestReviewCommentEvent(PULL_REQUEST_REVIEW_COMMENT),
|
||||
PushEvent(PUSH),
|
||||
ReleaseEvent(RELEASE),
|
||||
WatchEvent(WATCH),
|
||||
UnknownEvent(UNKNOWN);
|
||||
|
||||
private final GHEvent event;
|
||||
GitHubEventType(GHEvent event) {
|
||||
this.event = event;
|
||||
}
|
||||
|
||||
/**
|
||||
* Required due to different naming conventions between different GitHub event names for Webhook events and
|
||||
* GitHub events
|
||||
*
|
||||
* @param event
|
||||
* the github event as a string to convert to Event enum
|
||||
* @return GHEvent
|
||||
*/
|
||||
static GHEvent transformToGHEvent(@Nonnull String event) {
|
||||
return EnumUtils.getEnumOrDefault(GitHubEventType.class, event, UnknownEvent).event;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.kohsuke.github;
|
||||
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||
import org.kohsuke.github.GHEvent.GitHubEventType;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Date;
|
||||
@@ -46,14 +47,7 @@ public class GHEventInfo extends GitHubInteractiveObject {
|
||||
* @return the type
|
||||
*/
|
||||
public GHEvent getType() {
|
||||
String t = type;
|
||||
if (t.endsWith("Event"))
|
||||
t = t.substring(0, t.length() - 5);
|
||||
for (GHEvent e : GHEvent.values()) {
|
||||
if (e.name().replace("_", "").equalsIgnoreCase(t))
|
||||
return e;
|
||||
}
|
||||
return GHEvent.UNKNOWN;
|
||||
return GitHubEventType.transformToGHEvent(type);
|
||||
}
|
||||
|
||||
GHEventInfo wrapUp(GitHub root) {
|
||||
|
||||
@@ -18,6 +18,9 @@ import static org.kohsuke.github.internal.Previews.INERTIA;
|
||||
* @author Kohsuke Kawaguchi
|
||||
*/
|
||||
public class GHOrganization extends GHPerson {
|
||||
|
||||
private boolean has_organization_projects;
|
||||
|
||||
GHOrganization wrapUp(GitHub root) {
|
||||
return (GHOrganization) super.wrapUp(root);
|
||||
}
|
||||
@@ -367,6 +370,35 @@ public class GHOrganization extends GHPerson {
|
||||
root.createRequest().method("DELETE").withUrlPath("/orgs/" + login + "/public_members/" + u.getLogin()).send();
|
||||
}
|
||||
|
||||
/**
|
||||
* Are projects enabled for organization boolean.
|
||||
*
|
||||
* @return the boolean
|
||||
*/
|
||||
public boolean areOrganizationProjectsEnabled() {
|
||||
return has_organization_projects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets organization projects enabled status boolean
|
||||
*
|
||||
* @param newStatus
|
||||
* enable status
|
||||
* @throws IOException
|
||||
* the io exception
|
||||
*/
|
||||
public void enableOrganizationProjects(boolean newStatus) throws IOException {
|
||||
edit("has_organization_projects", newStatus);
|
||||
}
|
||||
|
||||
private void edit(String key, Object value) throws IOException {
|
||||
root.createRequest()
|
||||
.withUrlPath(String.format("/orgs/%s", login))
|
||||
.method("PATCH")
|
||||
.with(key, value)
|
||||
.fetchInto(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the projects for this organization.
|
||||
*
|
||||
|
||||
@@ -12,6 +12,7 @@ import java.time.format.DateTimeFormatter;
|
||||
import java.time.format.DateTimeParseException;
|
||||
import java.util.Date;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.annotation.CheckForNull;
|
||||
@@ -344,7 +345,7 @@ public class GHRateLimit {
|
||||
private static final UnknownLimitRecord DEFAULT = new UnknownLimitRecord(Long.MIN_VALUE);
|
||||
|
||||
// The starting current UnknownLimitRecord is an expired record.
|
||||
private static UnknownLimitRecord current = DEFAULT;
|
||||
private static final AtomicReference<UnknownLimitRecord> current = new AtomicReference<>(DEFAULT);
|
||||
|
||||
/**
|
||||
* Create a new unknown record that resets at the specified time.
|
||||
@@ -356,18 +357,20 @@ public class GHRateLimit {
|
||||
super(unknownLimit, unknownRemaining, resetEpochSeconds);
|
||||
}
|
||||
|
||||
static synchronized Record current() {
|
||||
if (current.isExpired()) {
|
||||
current = new UnknownLimitRecord(System.currentTimeMillis() / 1000L + unknownLimitResetSeconds);
|
||||
static Record current() {
|
||||
Record result = current.get();
|
||||
if (result.isExpired()) {
|
||||
current.set(new UnknownLimitRecord(System.currentTimeMillis() / 1000L + unknownLimitResetSeconds));
|
||||
result = current.get();
|
||||
}
|
||||
return current;
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset the current UnknownLimitRecord. For use during testing only.
|
||||
*/
|
||||
static synchronized void reset() {
|
||||
current = DEFAULT;
|
||||
static void reset() {
|
||||
current.set(DEFAULT);
|
||||
unknownLimitResetSeconds = defaultUnknownLimitResetSeconds;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import java.time.Instant;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@@ -52,10 +53,8 @@ abstract class GitHubClient {
|
||||
|
||||
private HttpConnector connector;
|
||||
|
||||
private final Object rateLimitLock = new Object();
|
||||
|
||||
@Nonnull
|
||||
private GHRateLimit rateLimit = GHRateLimit.DEFAULT;
|
||||
private final AtomicReference<GHRateLimit> rateLimit = new AtomicReference<>(GHRateLimit.DEFAULT);
|
||||
|
||||
private static final Logger LOGGER = Logger.getLogger(GitHubClient.class.getName());
|
||||
|
||||
@@ -255,9 +254,7 @@ abstract class GitHubClient {
|
||||
@Nonnull
|
||||
@Deprecated
|
||||
GHRateLimit lastRateLimit() {
|
||||
synchronized (rateLimitLock) {
|
||||
return rateLimit;
|
||||
}
|
||||
return rateLimit.get();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -277,12 +274,19 @@ abstract class GitHubClient {
|
||||
*/
|
||||
@Nonnull
|
||||
GHRateLimit rateLimit(@Nonnull RateLimitTarget rateLimitTarget) throws IOException {
|
||||
synchronized (rateLimitLock) {
|
||||
if (rateLimit.getRecord(rateLimitTarget).isExpired()) {
|
||||
getRateLimit(rateLimitTarget);
|
||||
GHRateLimit result = rateLimit.get();
|
||||
// Most of the time rate limit is not expired, so try to avoid locking.
|
||||
if (result.getRecord(rateLimitTarget).isExpired()) {
|
||||
// if the rate limit is expired, synchronize to ensure
|
||||
// only one call to getRateLimit() is made to refresh it.
|
||||
synchronized (this) {
|
||||
if (rateLimit.get().getRecord(rateLimitTarget).isExpired()) {
|
||||
getRateLimit(rateLimitTarget);
|
||||
}
|
||||
}
|
||||
return rateLimit;
|
||||
result = rateLimit.get();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -295,15 +299,9 @@ abstract class GitHubClient {
|
||||
* {@link GHRateLimit.Record} constructed from the response header information
|
||||
*/
|
||||
private GHRateLimit updateRateLimit(@Nonnull GHRateLimit observed) {
|
||||
synchronized (rateLimitLock) {
|
||||
observed = rateLimit.getMergedRateLimit(observed);
|
||||
|
||||
if (rateLimit != observed) {
|
||||
rateLimit = observed;
|
||||
LOGGER.log(FINE, "Rate limit now: {0}", rateLimit);
|
||||
}
|
||||
return rateLimit;
|
||||
}
|
||||
GHRateLimit result = rateLimit.accumulateAndGet(observed, (current, x) -> current.getMergedRateLimit(x));
|
||||
LOGGER.log(FINEST, "Rate limit now: {0}", rateLimit.get());
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -30,8 +30,26 @@ public final class EnumUtils {
|
||||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
return getEnumOrDefault(enumClass, value.toUpperCase(Locale.ROOT), defaultEnum);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an enum value matching the value if found, {@code defaultEnum} if the value is null or cannot be matched
|
||||
* to a value of the enum.
|
||||
*
|
||||
* @param <E>
|
||||
* the type of the enum
|
||||
* @param enumClass
|
||||
* the type of the enum
|
||||
* @param value
|
||||
* the value to interpret
|
||||
* @param defaultEnum
|
||||
* the default enum value if the value doesn't match one of the enum value
|
||||
* @return an enum value
|
||||
*/
|
||||
public static <E extends Enum<E>> E getEnumOrDefault(Class<E> enumClass, String value, E defaultEnum) {
|
||||
try {
|
||||
return Enum.valueOf(enumClass, value.toUpperCase(Locale.ROOT));
|
||||
return Enum.valueOf(enumClass, value);
|
||||
} catch (IllegalArgumentException e) {
|
||||
LOGGER.warning("Unknown value " + value + " for enum class " + enumClass.getName() + ", defaulting to "
|
||||
+ defaultEnum.name());
|
||||
|
||||
@@ -1,19 +1,42 @@
|
||||
package org.kohsuke.github;
|
||||
|
||||
import com.tngtech.archunit.base.DescribedPredicate;
|
||||
import com.tngtech.archunit.core.domain.JavaAnnotation;
|
||||
import com.tngtech.archunit.core.domain.JavaClasses;
|
||||
import com.tngtech.archunit.core.domain.*;
|
||||
import com.tngtech.archunit.core.domain.properties.HasName;
|
||||
import com.tngtech.archunit.core.domain.properties.HasOwner;
|
||||
import com.tngtech.archunit.core.importer.ClassFileImporter;
|
||||
import com.tngtech.archunit.core.importer.ImportOption;
|
||||
import com.tngtech.archunit.lang.ArchCondition;
|
||||
import com.tngtech.archunit.lang.ArchRule;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.io.InputStream;
|
||||
import java.io.Reader;
|
||||
import java.lang.reflect.Field;
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static com.tngtech.archunit.core.domain.JavaCall.Predicates.target;
|
||||
import static com.tngtech.archunit.core.domain.JavaClass.Predicates.resideInAPackage;
|
||||
import static com.tngtech.archunit.core.domain.JavaClass.Predicates.type;
|
||||
import static com.tngtech.archunit.core.domain.JavaClass.namesOf;
|
||||
import static com.tngtech.archunit.core.domain.properties.HasName.Predicates.name;
|
||||
import static com.tngtech.archunit.core.domain.properties.HasName.Predicates.nameContaining;
|
||||
import static com.tngtech.archunit.core.domain.properties.HasOwner.Predicates.With.owner;
|
||||
import static com.tngtech.archunit.core.domain.properties.HasParameterTypes.Predicates.rawParameterTypes;
|
||||
import static com.tngtech.archunit.lang.conditions.ArchConditions.*;
|
||||
import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.classes;
|
||||
import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.fields;
|
||||
import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.methods;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.greaterThan;
|
||||
|
||||
public class ArchTests {
|
||||
|
||||
@@ -22,7 +45,9 @@ public class ArchTests {
|
||||
.withImportOption(new ImportOption.DoNotIncludeJars())
|
||||
.importPackages("org.kohsuke.github");
|
||||
|
||||
private static final JavaClasses tesetClassFiles = new ClassFileImporter()
|
||||
private static final JavaClasses apacheCommons = new ClassFileImporter().importPackages("org.apache.commons.lang3");
|
||||
|
||||
private static final JavaClasses testClassFiles = new ClassFileImporter()
|
||||
.withImportOption(new ImportOption.OnlyIncludeTests())
|
||||
.withImportOption(new ImportOption.DoNotIncludeJars())
|
||||
.importPackages("org.kohsuke.github");
|
||||
@@ -40,7 +65,7 @@ public class ArchTests {
|
||||
|
||||
@BeforeClass
|
||||
public static void beforeClass() {
|
||||
assertTrue(classFiles.size() > 0);
|
||||
assertThat(classFiles.size(), greaterThan(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -113,14 +138,103 @@ public class ArchTests {
|
||||
@Test
|
||||
public void testRequireUseOfAssertThat() {
|
||||
|
||||
String reason = "This project uses `assertThat(...)` instead of other assert*() methods.";
|
||||
final String reason = "This project uses `assertThat(...)` instead of other `assert*()` methods.";
|
||||
|
||||
ArchRule onlyAssertThatRule = methods().that()
|
||||
.haveNameContaining("assert")
|
||||
.should()
|
||||
.haveName("assertThat")
|
||||
final DescribedPredicate<HasName> assertMethodOtherThanAssertThat = nameContaining("assert")
|
||||
.and(DescribedPredicate.not(name("assertThat")));
|
||||
|
||||
final ArchRule onlyAssertThatRule = classes()
|
||||
.should(not(callMethodWhere(target(assertMethodOtherThanAssertThat))))
|
||||
.because(reason);
|
||||
|
||||
onlyAssertThatRule.check(tesetClassFiles);
|
||||
onlyAssertThatRule.check(testClassFiles);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRequireUseOfOnlySpecificApacheCommons() {
|
||||
|
||||
final ArchRule onlyApprovedApacheCommonsMethods = classes()
|
||||
.should(notCallMethodsInPackageUnless("org.apache.commons..",
|
||||
// unless it is one of these methods
|
||||
targetMethodIs(StringUtils.class, "capitalize", String.class),
|
||||
targetMethodIs(StringUtils.class, "defaultString", String.class, String.class),
|
||||
targetMethodIs(StringUtils.class, "equals", CharSequence.class, CharSequence.class),
|
||||
targetMethodIs(StringUtils.class, "isBlank", CharSequence.class),
|
||||
targetMethodIs(StringUtils.class, "isEmpty", CharSequence.class),
|
||||
targetMethodIs(StringUtils.class, "join", Iterable.class, String.class),
|
||||
targetMethodIs(StringUtils.class,
|
||||
"prependIfMissing",
|
||||
String.class,
|
||||
CharSequence.class,
|
||||
CharSequence[].class),
|
||||
targetMethodIs(ToStringBuilder.class, "toString"),
|
||||
targetMethodIs(ToStringBuilder.class, "append", String.class, Object.class),
|
||||
targetMethodIs(ToStringBuilder.class, "append", String.class, long.class),
|
||||
targetMethodIs(ToStringBuilder.class, "append", String.class, int.class),
|
||||
targetMethodIs(ToStringBuilder.class, "isEmpty"),
|
||||
targetMethodIs(ToStringBuilder.class, "equals"),
|
||||
targetMethodIs(ToStringBuilder.class, "capitalize"),
|
||||
targetMethodIs(ToStringStyle.class,
|
||||
"append",
|
||||
StringBuffer.class,
|
||||
String.class,
|
||||
Object.class,
|
||||
Boolean.class),
|
||||
targetMethodIs(ReflectionToStringBuilder.class, "accept", Field.class),
|
||||
targetMethodIs(IOUtils.class, "closeQuietly", InputStream.class),
|
||||
targetMethodIs(IOUtils.class, "closeQuietly", Closeable.class),
|
||||
targetMethodIs(IOUtils.class, "toString", InputStream.class, Charset.class),
|
||||
targetMethodIs(IOUtils.class, "toString", Reader.class),
|
||||
targetMethodIs(IOUtils.class, "toByteArray", InputStream.class)))
|
||||
.because(
|
||||
"Commons methods must be manually verified to be compatible with commons-io:2.4 or earlier and commons-lang3:3.9 or earlier.");
|
||||
|
||||
onlyApprovedApacheCommonsMethods.check(classFiles);
|
||||
}
|
||||
|
||||
public static ArchCondition<JavaClass> notCallMethodsInPackageUnless(final String packageIdentifier,
|
||||
final DescribedPredicate<JavaCall<?>>... unlessPredicates) {
|
||||
DescribedPredicate<JavaCall<?>> restrictedPackageCalls = target(
|
||||
HasOwner.Predicates.With.<JavaClass>owner(resideInAPackage(packageIdentifier)));
|
||||
|
||||
if (unlessPredicates.length > 0) {
|
||||
DescribedPredicate<JavaCall<?>> allowed = unlessPredicates[0];
|
||||
for (int x = 1; x < unlessPredicates.length; x++) {
|
||||
allowed = allowed.or(unlessPredicates[x]);
|
||||
}
|
||||
restrictedPackageCalls = unless(restrictedPackageCalls, allowed);
|
||||
}
|
||||
return not(callMethodWhere(restrictedPackageCalls));
|
||||
}
|
||||
|
||||
public static DescribedPredicate<JavaCall<?>> targetMethodIs(Class<?> owner,
|
||||
String methodName,
|
||||
Class<?>... parameterTypes) {
|
||||
return JavaCall.Predicates.target(owner(type(owner)))
|
||||
.and(JavaCall.Predicates.target(name(methodName)))
|
||||
.and(JavaCall.Predicates.target(rawParameterTypes(parameterTypes)))
|
||||
.as("method is %s",
|
||||
Formatters.formatMethodSimple(owner.getSimpleName(), methodName, namesOf(parameterTypes)));
|
||||
}
|
||||
|
||||
public static <T> DescribedPredicate<T> unless(DescribedPredicate<? super T> first,
|
||||
DescribedPredicate<? super T> second) {
|
||||
return new UnlessPredicate(first, second);
|
||||
}
|
||||
|
||||
private static class UnlessPredicate<T> extends DescribedPredicate<T> {
|
||||
private final DescribedPredicate<T> current;
|
||||
private final DescribedPredicate<? super T> other;
|
||||
|
||||
UnlessPredicate(DescribedPredicate<T> current, DescribedPredicate<? super T> other) {
|
||||
super(current.getDescription() + " unless " + other.getDescription());
|
||||
this.current = checkNotNull(current);
|
||||
this.other = checkNotNull(other);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(T input) {
|
||||
return current.apply(input) && !other.apply(input);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
35
src/test/java/org/kohsuke/github/GHEventTest.java
Normal file
35
src/test/java/org/kohsuke/github/GHEventTest.java
Normal file
@@ -0,0 +1,35 @@
|
||||
package org.kohsuke.github;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.kohsuke.github.GHEvent.GitHubEventType;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
|
||||
public class GHEventTest {
|
||||
|
||||
/**
|
||||
* Function from GHEventInfo to transform string event to GHEvent which has been replaced by static mapping due to
|
||||
* complex parsing logic below
|
||||
*/
|
||||
private static GHEvent oldTransformationFunction(String t) {
|
||||
if (t.endsWith("Event")) {
|
||||
t = t.substring(0, t.length() - 5);
|
||||
}
|
||||
for (GHEvent e : GHEvent.values()) {
|
||||
if (e.name().replace("_", "").equalsIgnoreCase(t)) {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
return GHEvent.UNKNOWN;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void regressionTest() {
|
||||
assertThat(GitHubEventType.transformToGHEvent("NewlyAddedOrBogusEvent"), is(GHEvent.UNKNOWN));
|
||||
for (GitHubEventType gitHubEventType : GitHubEventType.values()) {
|
||||
assertThat(GitHubEventType.transformToGHEvent(gitHubEventType.name()),
|
||||
is(oldTransformationFunction(gitHubEventType.name())));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -29,6 +29,8 @@ public class GHOrganizationTest extends AbstractGitHubWireMockTest {
|
||||
if (team != null) {
|
||||
team.delete();
|
||||
}
|
||||
|
||||
getNonRecordingGitHub().getOrganization(GITHUB_API_TEST_ORG).enableOrganizationProjects(true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -231,4 +233,28 @@ public class GHOrganizationTest extends AbstractGitHubWireMockTest {
|
||||
assertThat(team.getDescription(), equalTo("Team description"));
|
||||
assertThat(team.getPrivacy(), equalTo(GHTeam.Privacy.CLOSED));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAreOrganizationProjectsEnabled() throws IOException {
|
||||
// Arrange
|
||||
GHOrganization org = gitHub.getOrganization(GITHUB_API_TEST_ORG);
|
||||
|
||||
// Act
|
||||
boolean result = org.areOrganizationProjectsEnabled();
|
||||
|
||||
// Assert
|
||||
assertThat(result, is(true));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEnableOrganizationProjects() throws IOException {
|
||||
// Arrange
|
||||
GHOrganization org = gitHub.getOrganization(GITHUB_API_TEST_ORG);
|
||||
|
||||
// Act
|
||||
org.enableOrganizationProjects(false);
|
||||
|
||||
// Assert
|
||||
assertThat(org.areOrganizationProjectsEnabled(), is(false));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
@@ -15,7 +15,7 @@ public class GHPullRequestMockTest {
|
||||
GHPullRequest pullRequest = mock(GHPullRequest.class);
|
||||
when(pullRequest.isDraft()).thenReturn(true);
|
||||
|
||||
assertTrue("Mock should return true", pullRequest.isDraft());
|
||||
assertThat("Mock should return true", pullRequest.isDraft());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,19 +2,24 @@ package org.kohsuke.github.internal;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
|
||||
public class EnumUtilsTest {
|
||||
|
||||
@Test
|
||||
public void testGetEnum() {
|
||||
assertNull(EnumUtils.getNullableEnumOrDefault(TestEnum.class, null, TestEnum.UNKNOWN));
|
||||
assertEquals(TestEnum.UNKNOWN, EnumUtils.getNullableEnumOrDefault(TestEnum.class, "foobar", TestEnum.UNKNOWN));
|
||||
assertEquals(TestEnum.VALUE_1, EnumUtils.getNullableEnumOrDefault(TestEnum.class, "VALUE_1", TestEnum.UNKNOWN));
|
||||
assertEquals(TestEnum.VALUE_1, EnumUtils.getNullableEnumOrDefault(TestEnum.class, "value_1", TestEnum.UNKNOWN));
|
||||
assertEquals(TestEnum.VALUE_2, EnumUtils.getNullableEnumOrDefault(TestEnum.class, "VALUE_2", TestEnum.UNKNOWN));
|
||||
assertEquals(TestEnum.VALUE_2, EnumUtils.getNullableEnumOrDefault(TestEnum.class, "value_2", TestEnum.UNKNOWN));
|
||||
assertThat(EnumUtils.getNullableEnumOrDefault(TestEnum.class, null, TestEnum.UNKNOWN), nullValue());
|
||||
assertThat(EnumUtils.getNullableEnumOrDefault(TestEnum.class, "foobar", TestEnum.UNKNOWN),
|
||||
equalTo(TestEnum.UNKNOWN));
|
||||
assertThat(EnumUtils.getNullableEnumOrDefault(TestEnum.class, "VALUE_1", TestEnum.UNKNOWN),
|
||||
equalTo(TestEnum.VALUE_1));
|
||||
assertThat(EnumUtils.getNullableEnumOrDefault(TestEnum.class, "value_1", TestEnum.UNKNOWN),
|
||||
equalTo(TestEnum.VALUE_1));
|
||||
assertThat(EnumUtils.getNullableEnumOrDefault(TestEnum.class, "VALUE_2", TestEnum.UNKNOWN),
|
||||
equalTo(TestEnum.VALUE_2));
|
||||
assertThat(EnumUtils.getNullableEnumOrDefault(TestEnum.class, "vAlUe_2", TestEnum.UNKNOWN),
|
||||
equalTo(TestEnum.VALUE_2));
|
||||
}
|
||||
|
||||
private enum TestEnum {
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
{
|
||||
"login": "hub4j-test-org",
|
||||
"id": 7544739,
|
||||
"node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=",
|
||||
"url": "https://api.github.com/orgs/hub4j-test-org",
|
||||
"repos_url": "https://api.github.com/orgs/hub4j-test-org/repos",
|
||||
"events_url": "https://api.github.com/orgs/hub4j-test-org/events",
|
||||
"hooks_url": "https://api.github.com/orgs/hub4j-test-org/hooks",
|
||||
"issues_url": "https://api.github.com/orgs/hub4j-test-org/issues",
|
||||
"members_url": "https://api.github.com/orgs/hub4j-test-org/members{/member}",
|
||||
"public_members_url": "https://api.github.com/orgs/hub4j-test-org/public_members{/member}",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/7544739?v=4",
|
||||
"description": "Hub4j Test Org Description (this could be null or blank too)",
|
||||
"name": "Hub4j Test Org Name (this could be null or blank too)",
|
||||
"company": null,
|
||||
"blog": "https://hub4j.url.io/could/be/null",
|
||||
"location": "Hub4j Test Org Location (this could be null or blank too)",
|
||||
"email": "hub4jtestorgemail@could.be.null.com",
|
||||
"twitter_username": null,
|
||||
"is_verified": false,
|
||||
"has_organization_projects": true,
|
||||
"has_repository_projects": true,
|
||||
"public_repos": 17,
|
||||
"public_gists": 0,
|
||||
"followers": 0,
|
||||
"following": 0,
|
||||
"html_url": "https://github.com/hub4j-test-org",
|
||||
"created_at": "2014-05-10T19:39:11Z",
|
||||
"updated_at": "2020-06-04T05:56:10Z",
|
||||
"type": "Organization",
|
||||
"total_private_repos": 2,
|
||||
"owned_private_repos": 2,
|
||||
"private_gists": 0,
|
||||
"disk_usage": 31,
|
||||
"collaborators": 0,
|
||||
"billing_email": "kk@kohsuke.org",
|
||||
"default_repository_permission": "none",
|
||||
"members_can_create_repositories": false,
|
||||
"two_factor_requirement_enabled": false,
|
||||
"members_can_create_pages": true,
|
||||
"members_can_create_public_pages": true,
|
||||
"members_can_create_private_pages": true,
|
||||
"plan": {
|
||||
"name": "free",
|
||||
"space": 976562499,
|
||||
"private_repos": 10000,
|
||||
"filled_seats": 23,
|
||||
"seats": 3
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"login": "akashRindhe",
|
||||
"id": 14114123,
|
||||
"node_id": "MDQ6VXNlcjE0MTE0MTIz",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/14114123?v=4",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/akashRindhe",
|
||||
"html_url": "https://github.com/akashRindhe",
|
||||
"followers_url": "https://api.github.com/users/akashRindhe/followers",
|
||||
"following_url": "https://api.github.com/users/akashRindhe/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/akashRindhe/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/akashRindhe/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/akashRindhe/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/akashRindhe/orgs",
|
||||
"repos_url": "https://api.github.com/users/akashRindhe/repos",
|
||||
"events_url": "https://api.github.com/users/akashRindhe/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/akashRindhe/received_events",
|
||||
"type": "User",
|
||||
"site_admin": false,
|
||||
"name": "Akash Rindhe",
|
||||
"company": null,
|
||||
"blog": "",
|
||||
"location": "Singapore",
|
||||
"email": null,
|
||||
"hireable": null,
|
||||
"bio": null,
|
||||
"twitter_username": null,
|
||||
"public_repos": 9,
|
||||
"public_gists": 0,
|
||||
"followers": 0,
|
||||
"following": 6,
|
||||
"created_at": "2015-09-03T18:07:43Z",
|
||||
"updated_at": "2021-05-12T08:30:12Z",
|
||||
"private_gists": 0,
|
||||
"total_private_repos": 4,
|
||||
"owned_private_repos": 4,
|
||||
"disk_usage": 24551,
|
||||
"collaborators": 1,
|
||||
"two_factor_authentication": true,
|
||||
"plan": {
|
||||
"name": "free",
|
||||
"space": 976562499,
|
||||
"collaborators": 0,
|
||||
"private_repos": 10000
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
{
|
||||
"id": "d0322427-888c-40d9-a47d-b7c0f1d2fc71",
|
||||
"name": "orgs_hub4j-test-org",
|
||||
"request": {
|
||||
"url": "/orgs/hub4j-test-org",
|
||||
"method": "GET",
|
||||
"headers": {
|
||||
"Accept": {
|
||||
"equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2"
|
||||
}
|
||||
}
|
||||
},
|
||||
"response": {
|
||||
"status": 200,
|
||||
"bodyFileName": "orgs_hub4j-test-org-2.json",
|
||||
"headers": {
|
||||
"Server": "GitHub.com",
|
||||
"Date": "Thu, 13 May 2021 16:11:19 GMT",
|
||||
"Content-Type": "application/json; charset=utf-8",
|
||||
"Cache-Control": "private, max-age=60, s-maxage=60",
|
||||
"Vary": [
|
||||
"Accept, Authorization, Cookie, X-GitHub-OTP",
|
||||
"Accept-Encoding, Accept, X-Requested-With"
|
||||
],
|
||||
"ETag": "W/\"43be1c5d1d3fa4718ddcd58ebd6be4a41f81ddb5c2102d6ddd628548059db30d\"",
|
||||
"Last-Modified": "Thu, 04 Jun 2020 05:56:10 GMT",
|
||||
"X-OAuth-Scopes": "admin:enterprise, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete:packages, delete_repo, gist, notifications, repo, user, workflow, write:discussion, write:packages",
|
||||
"X-Accepted-OAuth-Scopes": "admin:org, read:org, repo, user, write:org",
|
||||
"X-GitHub-Media-Type": "unknown, github.v3",
|
||||
"X-RateLimit-Limit": "5000",
|
||||
"X-RateLimit-Remaining": "4958",
|
||||
"X-RateLimit-Reset": "1620924638",
|
||||
"X-RateLimit-Used": "42",
|
||||
"X-RateLimit-Resource": "core",
|
||||
"Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
|
||||
"X-Frame-Options": "deny",
|
||||
"X-Content-Type-Options": "nosniff",
|
||||
"X-XSS-Protection": "0",
|
||||
"Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
|
||||
"Content-Security-Policy": "default-src 'none'",
|
||||
"X-GitHub-Request-Id": "8358:203B:A245B6:B13792:609D4FA7"
|
||||
}
|
||||
},
|
||||
"uuid": "d0322427-888c-40d9-a47d-b7c0f1d2fc71",
|
||||
"persistent": true,
|
||||
"insertionIndex": 2
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
{
|
||||
"id": "28895477-e3e7-4621-9a69-834956cf26d7",
|
||||
"name": "user",
|
||||
"request": {
|
||||
"url": "/user",
|
||||
"method": "GET",
|
||||
"headers": {
|
||||
"Accept": {
|
||||
"equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2"
|
||||
}
|
||||
}
|
||||
},
|
||||
"response": {
|
||||
"status": 200,
|
||||
"bodyFileName": "user-1.json",
|
||||
"headers": {
|
||||
"Server": "GitHub.com",
|
||||
"Date": "Thu, 13 May 2021 16:11:17 GMT",
|
||||
"Content-Type": "application/json; charset=utf-8",
|
||||
"Cache-Control": "private, max-age=60, s-maxage=60",
|
||||
"Vary": [
|
||||
"Accept, Authorization, Cookie, X-GitHub-OTP",
|
||||
"Accept-Encoding, Accept, X-Requested-With"
|
||||
],
|
||||
"ETag": "W/\"848579fd41f059ee3a1a46f41bea53042fd2303af9d8670074420dc05bcfbd73\"",
|
||||
"Last-Modified": "Wed, 12 May 2021 08:30:12 GMT",
|
||||
"X-OAuth-Scopes": "admin:enterprise, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete:packages, delete_repo, gist, notifications, repo, user, workflow, write:discussion, write:packages",
|
||||
"X-Accepted-OAuth-Scopes": "",
|
||||
"X-GitHub-Media-Type": "unknown, github.v3",
|
||||
"X-RateLimit-Limit": "5000",
|
||||
"X-RateLimit-Remaining": "4963",
|
||||
"X-RateLimit-Reset": "1620924638",
|
||||
"X-RateLimit-Used": "37",
|
||||
"X-RateLimit-Resource": "core",
|
||||
"Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
|
||||
"X-Frame-Options": "deny",
|
||||
"X-Content-Type-Options": "nosniff",
|
||||
"X-XSS-Protection": "0",
|
||||
"Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
|
||||
"Content-Security-Policy": "default-src 'none'",
|
||||
"X-GitHub-Request-Id": "8358:203B:A24554:B13727:609D4FA5"
|
||||
}
|
||||
},
|
||||
"uuid": "28895477-e3e7-4621-9a69-834956cf26d7",
|
||||
"persistent": true,
|
||||
"insertionIndex": 1
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
{
|
||||
"login": "hub4j-test-org",
|
||||
"id": 7544739,
|
||||
"node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=",
|
||||
"url": "https://api.github.com/orgs/hub4j-test-org",
|
||||
"repos_url": "https://api.github.com/orgs/hub4j-test-org/repos",
|
||||
"events_url": "https://api.github.com/orgs/hub4j-test-org/events",
|
||||
"hooks_url": "https://api.github.com/orgs/hub4j-test-org/hooks",
|
||||
"issues_url": "https://api.github.com/orgs/hub4j-test-org/issues",
|
||||
"members_url": "https://api.github.com/orgs/hub4j-test-org/members{/member}",
|
||||
"public_members_url": "https://api.github.com/orgs/hub4j-test-org/public_members{/member}",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/7544739?v=4",
|
||||
"description": "Hub4j Test Org Description (this could be null or blank too)",
|
||||
"name": "Hub4j Test Org Name (this could be null or blank too)",
|
||||
"company": null,
|
||||
"blog": "https://hub4j.url.io/could/be/null",
|
||||
"location": "Hub4j Test Org Location (this could be null or blank too)",
|
||||
"email": "hub4jtestorgemail@could.be.null.com",
|
||||
"twitter_username": null,
|
||||
"is_verified": false,
|
||||
"has_organization_projects": true,
|
||||
"has_repository_projects": true,
|
||||
"public_repos": 17,
|
||||
"public_gists": 0,
|
||||
"followers": 0,
|
||||
"following": 0,
|
||||
"html_url": "https://github.com/hub4j-test-org",
|
||||
"created_at": "2014-05-10T19:39:11Z",
|
||||
"updated_at": "2020-06-04T05:56:10Z",
|
||||
"type": "Organization",
|
||||
"total_private_repos": 2,
|
||||
"owned_private_repos": 2,
|
||||
"private_gists": 0,
|
||||
"disk_usage": 31,
|
||||
"collaborators": 0,
|
||||
"billing_email": "kk@kohsuke.org",
|
||||
"default_repository_permission": "none",
|
||||
"members_can_create_repositories": false,
|
||||
"two_factor_requirement_enabled": false,
|
||||
"members_can_create_pages": true,
|
||||
"members_can_create_public_pages": true,
|
||||
"members_can_create_private_pages": true,
|
||||
"plan": {
|
||||
"name": "free",
|
||||
"space": 976562499,
|
||||
"private_repos": 10000,
|
||||
"filled_seats": 23,
|
||||
"seats": 3
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
{
|
||||
"login": "hub4j-test-org",
|
||||
"id": 7544739,
|
||||
"node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=",
|
||||
"url": "https://api.github.com/orgs/hub4j-test-org",
|
||||
"repos_url": "https://api.github.com/orgs/hub4j-test-org/repos",
|
||||
"events_url": "https://api.github.com/orgs/hub4j-test-org/events",
|
||||
"hooks_url": "https://api.github.com/orgs/hub4j-test-org/hooks",
|
||||
"issues_url": "https://api.github.com/orgs/hub4j-test-org/issues",
|
||||
"members_url": "https://api.github.com/orgs/hub4j-test-org/members{/member}",
|
||||
"public_members_url": "https://api.github.com/orgs/hub4j-test-org/public_members{/member}",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/7544739?v=4",
|
||||
"description": "Hub4j Test Org Description (this could be null or blank too)",
|
||||
"name": "Hub4j Test Org Name (this could be null or blank too)",
|
||||
"company": null,
|
||||
"blog": "https://hub4j.url.io/could/be/null",
|
||||
"location": "Hub4j Test Org Location (this could be null or blank too)",
|
||||
"email": "hub4jtestorgemail@could.be.null.com",
|
||||
"twitter_username": null,
|
||||
"is_verified": false,
|
||||
"has_organization_projects": false,
|
||||
"has_repository_projects": true,
|
||||
"public_repos": 17,
|
||||
"public_gists": 0,
|
||||
"followers": 0,
|
||||
"following": 0,
|
||||
"html_url": "https://github.com/hub4j-test-org",
|
||||
"created_at": "2014-05-10T19:39:11Z",
|
||||
"updated_at": "2020-06-04T05:56:10Z",
|
||||
"type": "Organization",
|
||||
"total_private_repos": 2,
|
||||
"owned_private_repos": 2,
|
||||
"private_gists": 0,
|
||||
"disk_usage": 31,
|
||||
"collaborators": 0,
|
||||
"billing_email": "kk@kohsuke.org",
|
||||
"default_repository_permission": "none",
|
||||
"members_can_create_repositories": false,
|
||||
"two_factor_requirement_enabled": false,
|
||||
"members_can_create_pages": true,
|
||||
"members_can_create_public_pages": true,
|
||||
"members_can_create_private_pages": true,
|
||||
"plan": {
|
||||
"name": "free",
|
||||
"space": 976562499,
|
||||
"private_repos": 10000,
|
||||
"filled_seats": 23,
|
||||
"seats": 3
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"login": "akashRindhe",
|
||||
"id": 14114123,
|
||||
"node_id": "MDQ6VXNlcjE0MTE0MTIz",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/14114123?v=4",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/akashRindhe",
|
||||
"html_url": "https://github.com/akashRindhe",
|
||||
"followers_url": "https://api.github.com/users/akashRindhe/followers",
|
||||
"following_url": "https://api.github.com/users/akashRindhe/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/akashRindhe/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/akashRindhe/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/akashRindhe/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/akashRindhe/orgs",
|
||||
"repos_url": "https://api.github.com/users/akashRindhe/repos",
|
||||
"events_url": "https://api.github.com/users/akashRindhe/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/akashRindhe/received_events",
|
||||
"type": "User",
|
||||
"site_admin": false,
|
||||
"name": "Akash Rindhe",
|
||||
"company": null,
|
||||
"blog": "",
|
||||
"location": "Singapore",
|
||||
"email": null,
|
||||
"hireable": null,
|
||||
"bio": null,
|
||||
"twitter_username": null,
|
||||
"public_repos": 9,
|
||||
"public_gists": 0,
|
||||
"followers": 0,
|
||||
"following": 6,
|
||||
"created_at": "2015-09-03T18:07:43Z",
|
||||
"updated_at": "2021-05-12T08:30:12Z",
|
||||
"private_gists": 0,
|
||||
"total_private_repos": 4,
|
||||
"owned_private_repos": 4,
|
||||
"disk_usage": 24551,
|
||||
"collaborators": 1,
|
||||
"two_factor_authentication": true,
|
||||
"plan": {
|
||||
"name": "free",
|
||||
"space": 976562499,
|
||||
"collaborators": 0,
|
||||
"private_repos": 10000
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
{
|
||||
"id": "47c14d2c-d8d5-4f11-8208-fb790e6fccca",
|
||||
"name": "orgs_hub4j-test-org",
|
||||
"request": {
|
||||
"url": "/orgs/hub4j-test-org",
|
||||
"method": "GET",
|
||||
"headers": {
|
||||
"Accept": {
|
||||
"equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2"
|
||||
}
|
||||
}
|
||||
},
|
||||
"response": {
|
||||
"status": 200,
|
||||
"bodyFileName": "orgs_hub4j-test-org-2.json",
|
||||
"headers": {
|
||||
"Server": "GitHub.com",
|
||||
"Date": "Thu, 13 May 2021 16:07:24 GMT",
|
||||
"Content-Type": "application/json; charset=utf-8",
|
||||
"Cache-Control": "private, max-age=60, s-maxage=60",
|
||||
"Vary": [
|
||||
"Accept, Authorization, Cookie, X-GitHub-OTP",
|
||||
"Accept-Encoding, Accept, X-Requested-With"
|
||||
],
|
||||
"ETag": "W/\"43be1c5d1d3fa4718ddcd58ebd6be4a41f81ddb5c2102d6ddd628548059db30d\"",
|
||||
"Last-Modified": "Thu, 04 Jun 2020 05:56:10 GMT",
|
||||
"X-OAuth-Scopes": "admin:enterprise, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete:packages, delete_repo, gist, notifications, repo, user, workflow, write:discussion, write:packages",
|
||||
"X-Accepted-OAuth-Scopes": "admin:org, read:org, repo, user, write:org",
|
||||
"X-GitHub-Media-Type": "unknown, github.v3",
|
||||
"X-RateLimit-Limit": "5000",
|
||||
"X-RateLimit-Remaining": "4966",
|
||||
"X-RateLimit-Reset": "1620924638",
|
||||
"X-RateLimit-Used": "34",
|
||||
"X-RateLimit-Resource": "core",
|
||||
"Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
|
||||
"X-Frame-Options": "deny",
|
||||
"X-Content-Type-Options": "nosniff",
|
||||
"X-XSS-Protection": "0",
|
||||
"Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
|
||||
"Content-Security-Policy": "default-src 'none'",
|
||||
"X-GitHub-Request-Id": "834A:6C69:7FCEDB:8CA6DB:609D4EBC"
|
||||
}
|
||||
},
|
||||
"uuid": "47c14d2c-d8d5-4f11-8208-fb790e6fccca",
|
||||
"persistent": true,
|
||||
"insertionIndex": 2
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
{
|
||||
"id": "eb95bb02-84c4-4e04-bfd4-851985556513",
|
||||
"name": "orgs_hub4j-test-org",
|
||||
"request": {
|
||||
"url": "/orgs/hub4j-test-org",
|
||||
"method": "POST",
|
||||
"headers": {
|
||||
"X-HTTP-Method-Override": {
|
||||
"equalTo": "PATCH"
|
||||
},
|
||||
"Accept": {
|
||||
"equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2"
|
||||
}
|
||||
},
|
||||
"bodyPatterns": [
|
||||
{
|
||||
"equalToJson": "{\"has_organization_projects\":false}",
|
||||
"ignoreArrayOrder": true,
|
||||
"ignoreExtraElements": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"response": {
|
||||
"status": 200,
|
||||
"bodyFileName": "orgs_hub4j-test-org-3.json",
|
||||
"headers": {
|
||||
"Server": "GitHub.com",
|
||||
"Date": "Thu, 13 May 2021 16:07:25 GMT",
|
||||
"Content-Type": "application/json; charset=utf-8",
|
||||
"Cache-Control": "private, max-age=60, s-maxage=60",
|
||||
"Vary": [
|
||||
"Accept, Authorization, Cookie, X-GitHub-OTP",
|
||||
"Accept-Encoding, Accept, X-Requested-With"
|
||||
],
|
||||
"ETag": "W/\"5ec2678c3553042c50562ea4033d38b2719d9a5b624a7d95dfcef66108c719f5\"",
|
||||
"X-OAuth-Scopes": "admin:enterprise, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete:packages, delete_repo, gist, notifications, repo, user, workflow, write:discussion, write:packages",
|
||||
"X-Accepted-OAuth-Scopes": "admin:org, repo",
|
||||
"X-GitHub-Media-Type": "unknown, github.v3",
|
||||
"X-RateLimit-Limit": "5000",
|
||||
"X-RateLimit-Remaining": "4965",
|
||||
"X-RateLimit-Reset": "1620924638",
|
||||
"X-RateLimit-Used": "35",
|
||||
"X-RateLimit-Resource": "core",
|
||||
"Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
|
||||
"X-Frame-Options": "deny",
|
||||
"X-Content-Type-Options": "nosniff",
|
||||
"X-XSS-Protection": "0",
|
||||
"Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
|
||||
"Content-Security-Policy": "default-src 'none'",
|
||||
"X-GitHub-Request-Id": "834A:6C69:7FCEED:8CA6EE:609D4EBC"
|
||||
}
|
||||
},
|
||||
"uuid": "eb95bb02-84c4-4e04-bfd4-851985556513",
|
||||
"persistent": true,
|
||||
"insertionIndex": 3
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
{
|
||||
"id": "b9ae2ae4-ec5c-425c-9144-5863690aabf5",
|
||||
"name": "user",
|
||||
"request": {
|
||||
"url": "/user",
|
||||
"method": "GET",
|
||||
"headers": {
|
||||
"Accept": {
|
||||
"equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2"
|
||||
}
|
||||
}
|
||||
},
|
||||
"response": {
|
||||
"status": 200,
|
||||
"bodyFileName": "user-1.json",
|
||||
"headers": {
|
||||
"Server": "GitHub.com",
|
||||
"Date": "Thu, 13 May 2021 16:07:22 GMT",
|
||||
"Content-Type": "application/json; charset=utf-8",
|
||||
"Cache-Control": "private, max-age=60, s-maxage=60",
|
||||
"Vary": [
|
||||
"Accept, Authorization, Cookie, X-GitHub-OTP",
|
||||
"Accept-Encoding, Accept, X-Requested-With"
|
||||
],
|
||||
"ETag": "W/\"848579fd41f059ee3a1a46f41bea53042fd2303af9d8670074420dc05bcfbd73\"",
|
||||
"Last-Modified": "Wed, 12 May 2021 08:30:12 GMT",
|
||||
"X-OAuth-Scopes": "admin:enterprise, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete:packages, delete_repo, gist, notifications, repo, user, workflow, write:discussion, write:packages",
|
||||
"X-Accepted-OAuth-Scopes": "",
|
||||
"X-GitHub-Media-Type": "unknown, github.v3",
|
||||
"X-RateLimit-Limit": "5000",
|
||||
"X-RateLimit-Remaining": "4971",
|
||||
"X-RateLimit-Reset": "1620924638",
|
||||
"X-RateLimit-Used": "29",
|
||||
"X-RateLimit-Resource": "core",
|
||||
"Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
|
||||
"X-Frame-Options": "deny",
|
||||
"X-Content-Type-Options": "nosniff",
|
||||
"X-XSS-Protection": "0",
|
||||
"Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
|
||||
"Content-Security-Policy": "default-src 'none'",
|
||||
"X-GitHub-Request-Id": "834A:6C69:7FCE81:8CA67D:609D4EB9"
|
||||
}
|
||||
},
|
||||
"uuid": "b9ae2ae4-ec5c-425c-9144-5863690aabf5",
|
||||
"persistent": true,
|
||||
"insertionIndex": 1
|
||||
}
|
||||
Reference in New Issue
Block a user