Skip to content

Commit

Permalink
Showing 6 changed files with 707 additions and 13 deletions.
56 changes: 56 additions & 0 deletions src/main/java/org/kohsuke/github/GHMeta.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package org.kohsuke.github;

import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
* Class that wraps the list of GitHub's IP addresses.
*
* @author Paulo Miguel Almeida
*
* @see GitHub#getMeta()
* @see <a href="https://developer.github.com/v3/meta/#meta">Get Meta</a>
*/

public class GHMeta {

@JsonProperty("verifiable_password_authentication")
private boolean verifiablePasswordAuthentication;
private List<String> hooks;
private List<String> git;
private List<String> web;
private List<String> api;
private List<String> pages;
private List<String> importer = new ArrayList<>();

public boolean isVerifiablePasswordAuthentication() {
return verifiablePasswordAuthentication;
}

public List<String> getHooks() {
return Collections.unmodifiableList(hooks);
}

public List<String> getGit() {
return Collections.unmodifiableList(git);
}

public List<String> getWeb() {
return Collections.unmodifiableList(web);
}

public List<String> getApi() {
return Collections.unmodifiableList(api);
}

public List<String> getPages() {
return Collections.unmodifiableList(pages);
}

public List<String> getImporter() {
return Collections.unmodifiableList(importer);
}
}
26 changes: 19 additions & 7 deletions src/main/java/org/kohsuke/github/GitHub.java
Original file line number Diff line number Diff line change
@@ -26,13 +26,11 @@
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.MapperFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
import com.fasterxml.jackson.databind.introspect.VisibilityChecker.Std;
import com.infradna.tool.bridge_method_injector.WithBridgeMethods;
import org.apache.commons.codec.Charsets;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;

import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;
@@ -266,7 +264,7 @@ public static GitHub offline() {

/**
* Is this an anonymous connection
*
*
* @return {@code true} if operations that require authentication will fail.
*/
public boolean isAnonymous() {
@@ -275,7 +273,7 @@ public boolean isAnonymous() {

/**
* Is this an always offline "connection".
*
*
* @return {@code true} if this is an always offline "connection".
*/
public boolean isOffline() {
@@ -764,7 +762,7 @@ public GHAuthorization resetAuth(@Nonnull String clientId, @Nonnull String acces

/**
* Returns a list of all authorizations.
*
*
* @see <a href="https://developer.github.com/v3/oauth_authorizations/#list-your-authorizations">List your
* authorizations</a>
*/
@@ -802,6 +800,20 @@ public boolean isCredentialValid() {
}
}

/**
* Provides a list of GitHub's IP addresses.
*
* @see <a href="https://developer.github.com/v3/meta/#meta">Get Meta</a>
*
* @return an instance of {@link GHMeta}
* @throws IOException
* if the credentials supplied are invalid or if you're trying to access it as a GitHub App via the JWT
* authentication
*/
public GHMeta getMeta() throws IOException {
return retrieve().to("/meta", GHMeta.class);
}

GHUser intern(GHUser user) throws IOException {
if (user == null)
return user;
@@ -866,7 +878,7 @@ public void checkApiUrlValidity() throws IOException {
* Checks if a GitHub Enterprise server is configured in private mode.
*
* In private mode response looks like:
*
*
* <pre>
* $ curl -i https://github.mycompany.com/api/v3/
* HTTP/1.1 401 Unauthorized
@@ -955,7 +967,7 @@ public GHNotificationStream listNotifications() {

/**
* This provides a dump of every public repository, in the order that they were created.
*
*
* @see <a href="https://developer.github.com/v3/repos/#list-all-public-repositories">documentation</a>
*/
public PagedIterable<GHRepository> listAllPublicRepositories() {
Loading

0 comments on commit 1f619f3

Please sign in to comment.