Interface HttpRequestInterface
- All Known Implementing Classes:
ClassBase
,EntityBase
,GHActionsCache
,GHAdvisory
,GHAlert
,GHArtifact
,GHBase
,GHBranch
,GHEvent
,GHFile
,GHFileBuilder
,GHGitignoreTemplate
,GHHook
,GHHookBuilder
,GHIssue
,GHIssueBuilder
,GHLabel
,GHLicense
,GHMilestone
,GHOrganisation
,GHPackage
,GHPages
,GHPermission
,GHPlan
,GHProject
,GHProjectBuilder
,GHPublicKey
,GHPublicKeyBuilder
,GHPullRequest
,GHRepository
,GHRepositoryCache
,GHSecret
,GHStep
,GHTeam
,GHTeamBuilder
,GHUser
,GHVariable
,GHVulnerability
,GHWorkflowJob
,GHWorkflowRun
,Github
,HttpsCertificate
,SelfUser
public interface HttpRequestInterface
This interface provides methods for sending HTTP requests.
It uses the HttpRequestHelper class to send the requests.
-
Method Summary
Modifier and TypeMethodDescriptiondefault String
extractNextPageUrl
(String linkHeader) Extracts the URL of the next page from the Link header.default void
sendDeleteRequest
(String url, String githubToken) Sends a DELETE request to the specified URL with the provided GitHub token.default Boolean
sendDeleteRequestWithResponseCode
(String url, String githubToken, int responseCode) Sends a DELETE request to the specified URL with the provided GitHub token and expects a specific response code.default String
sendGetRequest
(String url, String githubToken) Sends a GET request to the specified URL with the provided GitHub token.default String[]
sendGetRequestWithLinkHeader
(String url, String githubToken) Sends a GET request to the specified URL with the provided GitHub token and returns the response body and the Link header.default Boolean
sendGetRequestWithResponseCode
(String url, String githubToken, int responseCode) Sends a GET request to the specified URL with the provided GitHub token and expects a specific response code.default void
sendPatchRequest
(String url, String githubToken, org.json.JSONObject jsonObject) default String
sendPostRequest
(String url, String githubToken, org.json.JSONObject jsonObject) Sends a POST request to the specified URL with the provided GitHub token and JSON object.default void
sendPutRequest
(String url, String githubToken, org.json.JSONObject jsonObject) Sends a PUT request to the specified URL with the provided GitHub token and JSON object.
-
Method Details
-
sendPostRequest
Sends a POST request to the specified URL with the provided GitHub token and JSON object.- Parameters:
url
- the URLgithubToken
- the GitHub tokenjsonObject
- the JSON object
-
sendGetRequest
Sends a GET request to the specified URL with the provided GitHub token.- Parameters:
url
- the URLgithubToken
- the GitHub token- Returns:
- the response body as a string
-
sendDeleteRequest
Sends a DELETE request to the specified URL with the provided GitHub token.- Parameters:
url
- the URLgithubToken
- the GitHub token
-
sendDeleteRequestWithResponseCode
Sends a DELETE request to the specified URL with the provided GitHub token and expects a specific response code.- Parameters:
url
- the URLgithubToken
- the GitHub tokenresponseCode
- the expected response code- Returns:
- true if the response code matches the expected response code, false otherwise
-
sendGetRequestWithLinkHeader
Sends a GET request to the specified URL with the provided GitHub token and returns the response body and the Link header.- Parameters:
url
- the URLgithubToken
- the GitHub token- Returns:
- an array containing the response body and the Link header
-
sendGetRequestWithResponseCode
Sends a GET request to the specified URL with the provided GitHub token and expects a specific response code.- Parameters:
url
- the URLgithubToken
- the GitHub tokenresponseCode
- the expected response code- Returns:
- true if the response code matches the expected response code, false otherwise
-
extractNextPageUrl
Extracts the URL of the next page from the Link header.- Parameters:
linkHeader
- the Link header- Returns:
- the URL of the next page
-
sendPutRequest
Sends a PUT request to the specified URL with the provided GitHub token and JSON object.- Parameters:
url
- the URLgithubToken
- the GitHub tokenjsonObject
- the JSON object to be sent in the request body
-
sendPatchRequest
-