Package de.coho04.githubapi.bases
Klasse GHBase
java.lang.Object
de.coho04.githubapi.bases.GHBase
- Alle implementierten Schnittstellen:
HttpRequestInterface,JSONHelper
- Bekannte direkte Unterklassen:
ClassBase,GHActionsCache,GHAdvisory,GHAlert,GHBranch,GHEvent,GHFile,GHFileBuilder,GHGitignoreTemplate,GHHook,GHIssueBuilder,GHLabel,GHLicense,GHPages,GHPermission,GHPlan,GHProjectBuilder,GHPublicKey,GHPublicKeyBuilder,GHRepositoryCache,GHSecret,GHStep,GHTeamBuilder,GHVariable,GHVulnerability,GHWorkflowRun,Github,HttpsCertificate
GHBase is a class that implements JSONHelper and HttpRequestInterface. It represents a base class for GitHub objects.
It contains several methods such as toJSONObject, getBaseUrl, and fetchPaginatedData.
This class serves as a foundation for other GitHub-related classes, providing common functionality for HTTP requests and JSON handling.
- Seit:
- 2024-1.2
- Version:
- 1.0
- Autor:
- Coho04
-
Verschachtelte Klassen - Übersicht
Von Schnittstelle geerbte verschachtelte Klassen/Schnittstellen de.coho04.githubapi.interfaces.JSONHelper
JSONHelper.JSONToObject<T> -
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungprotected <T> List<T> fetchArrayData(String url, String endpoint, Function<org.json.JSONObject, T> mapper, String token, String entryPoint) Fetches array data from a given URL and maps the data to a list of objects of type T.protected <T> List<T> fetchArrayData(String endpoint, Function<org.json.JSONObject, T> mapper, String token, String entryPoint) Fetches array data from a given endpoint and maps the data to a list of objects of type T.protected <T> List<T> fetchPaginatedData(String url, String endpoint, Function<org.json.JSONObject, T> mapper, String token) Fetches paginated data from a given URL and maps the data to a list of objects of type T.protected <T> List<T> fetchPaginatedData(String endpoint, Function<org.json.JSONObject, T> mapper, String token) Fetches paginated data from a given endpoint and maps the data to a list of objects of type T.protected <T> List<T> fetchPaginatedData(String endpoint, Function<org.json.JSONObject, T> mapper, String token, String params) Fetches paginated data from a given endpoint and maps the data to a list of objects of type T.static StringReturns the base URL for the GitHub API.org.json.JSONObjectReturns a new JSONObject.Von Klasse geerbte Methoden java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitVon Schnittstelle geerbte Methoden de.coho04.githubapi.interfaces.HttpRequestInterface
extractNextPageUrl, sendDeleteRequest, sendDeleteRequestWithResponseCode, sendGetRequest, sendGetRequestWithLinkHeader, sendGetRequestWithResponseCode, sendPatchRequest, sendPostRequest, sendPutRequestVon Schnittstelle geerbte Methoden de.coho04.githubapi.interfaces.JSONHelper
getArrayOrNull, getBooleanOrNull, getIntOrNull, getJSONArrayToStringList, getJSONObjectOrNull, getLocalDateOrNull, getLongOrNull, getStringOrNull
-
Konstruktordetails
-
GHBase
public GHBase()
-
-
Methodendetails
-
toJSONObject
public org.json.JSONObject toJSONObject()Returns a new JSONObject.- Gibt zurück:
- a new JSONObject
-
getBaseUrl
Returns the base URL for the GitHub API.- Gibt zurück:
- the base URL for the GitHub API
-
fetchPaginatedData
protected <T> List<T> fetchPaginatedData(String endpoint, Function<org.json.JSONObject, T> mapper, String token, String params) Fetches paginated data from a given endpoint and maps the data to a list of objects of type T.- Typparameter:
T- the type of objects in the returned list- Parameter:
endpoint- the endpoint to fetch data frommapper- a function that maps a JSONObject to an object of type Ttoken- the authentication token to use for the requestparams- additional parameters to include in the request URL- Gibt zurück:
- a list of objects of type T representing the fetched data
-
fetchPaginatedData
protected <T> List<T> fetchPaginatedData(String endpoint, Function<org.json.JSONObject, T> mapper, String token) Fetches paginated data from a given endpoint and maps the data to a list of objects of type T.- Typparameter:
T- the type of objects in the returned list- Parameter:
endpoint- the endpoint to fetch data frommapper- a function that maps a JSONObject to an object of type Ttoken- the authentication token to use for the request- Gibt zurück:
- a list of objects of type T representing the fetched data
-
fetchPaginatedData
protected <T> List<T> fetchPaginatedData(String url, String endpoint, Function<org.json.JSONObject, T> mapper, String token) Fetches paginated data from a given URL and maps the data to a list of objects of type T.- Typparameter:
T- the type of objects in the returned list- Parameter:
url- the URL to fetch data fromendpoint- the endpoint to fetch data from if the URL is nullmapper- a function that maps a JSONObject to an object of type Ttoken- the authentication token to use for the request- Gibt zurück:
- a list of objects of type T representing the fetched data
-
fetchArrayData
protected <T> List<T> fetchArrayData(String endpoint, Function<org.json.JSONObject, T> mapper, String token, String entryPoint) Fetches array data from a given endpoint and maps the data to a list of objects of type T.- Typparameter:
T- the type of objects in the returned list- Parameter:
endpoint- the endpoint to fetch data frommapper- a function that maps a JSONObject to an object of type Ttoken- the authentication token to use for the requestentryPoint- the entry point in the JSON response to extract the array data from- Gibt zurück:
- a list of objects of type T representing the fetched data
-
fetchArrayData
protected <T> List<T> fetchArrayData(String url, String endpoint, Function<org.json.JSONObject, T> mapper, String token, String entryPoint) Fetches array data from a given URL and maps the data to a list of objects of type T.- Typparameter:
T- the type of objects in the returned list- Parameter:
url- the URL to fetch data fromendpoint- the endpoint to fetch data from if the URL is nullmapper- a function that maps a JSONObject to an object of type Ttoken- the authentication token to use for the requestentryPoint- the entry point in the JSON response to extract the array data from- Gibt zurück:
- a list of objects of type T representing the fetched data
-