Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add statistics API. #477

Merged
merged 12 commits into from
Oct 5, 2019
19 changes: 16 additions & 3 deletions src/main/java/org/kohsuke/github/GHRepository.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
package org.kohsuke.github;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.exc.MismatchedInputException;
import com.infradna.tool.bridge_method_injector.WithBridgeMethods;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.apache.commons.lang3.StringUtils;
Expand Down Expand Up @@ -51,10 +54,11 @@
import java.util.Set;
import java.util.TreeMap;
import java.util.WeakHashMap;

import static java.util.Arrays.*;
import java.util.NoSuchElementException;
import java.util.logging.Level;
import java.util.logging.Logger;

import static java.util.Arrays.*;
import static org.kohsuke.github.Previews.*;

/**
Expand Down Expand Up @@ -1404,7 +1408,7 @@ public Map<String,GHBranch> getBranches() throws IOException {
/**
* Replace special characters (e.g. #) with standard values (e.g. %23) so
* GitHub understands what is being requested.
* @param The string to be encoded.
* @param value string to be encoded.
* @return The encoded string.
*/
private String UrlEncode(String value) {
Expand Down Expand Up @@ -1646,6 +1650,15 @@ public boolean equals(Object obj) {
}
}

/**
* Returns the statistics for this repository.
*/
public GHRepositoryStatistics getStatistics() {
// TODO: Use static object and introduce refresh() method,
// instead of returning new object each time.
return new GHRepositoryStatistics(this);
}

/**
* Create a project for this repository.
*/
Expand Down
Loading