public class FileContentLoader
extends java.lang.Object
It is intended for an application to create a single loader instance for a configuration file, and utilize
loadContents(InstallationAccessToken, String, String, String) for each individual repository lookup desired
If used by a GitHub App, access to the GitHub APIs used requires "contents:read" or "single file:read" permission(s)
| Constructor and Description |
|---|
FileContentLoader(java.lang.String userAgent) |
FileContentLoader(java.lang.String userAgent,
java.lang.String mediaType) |
| Modifier and Type | Method and Description |
|---|---|
java.util.Optional<java.lang.String> |
loadContents(InstallationAccessToken installationToken,
java.lang.String repositoryUrl,
java.lang.String ref,
java.lang.String path)
Reads contents of the configuration file specified at construction as per the
GitHub file content API specification
|
public FileContentLoader(java.lang.String userAgent)
userAgent - The user agent to make web requests as, as
required by GitHubpublic FileContentLoader(java.lang.String userAgent,
java.lang.String mediaType)
userAgent - The user agent to make web requests as, as
required by GitHubmediaType - The media type to request from the server via Accept headerpublic java.util.Optional<java.lang.String> loadContents(InstallationAccessToken installationToken, java.lang.String repositoryUrl, java.lang.String ref, java.lang.String path)
installationToken - Token specific to an application/repository authorizing a GitHub App to take actions on GitHubrepositoryUrl - The URL of the repository to read configuration file contents fromref - The branch/tag to read contents frompath - The repository-root relative path to the configuration file to read when loading contents