Class DiversionApiClient
java.lang.Object
io.superstudios.plugins.diversion.DiversionApiClient
Client for interacting with Diversion API.
Based on Diversion API documentation: https://docs.diversion.dev/api-reference/introduction
-
Constructor Summary
ConstructorsConstructorDescriptionDiversionApiClient(String credentialsId) Constructor for use outside of a Run context (e.g., UI dropdowns)DiversionApiClient(String credentialsId, Run<?, ?> run) Constructor for use during a Run (build execution) -
Method Summary
Modifier and TypeMethodDescriptionCreate a new tagvoidDelete a taggetBranchDetails(String repositoryId, String branchIdOrName) Get branch details by ID or namegetCommitDetails(String repositoryId, String commitId) Get detailed commit information including changed filesgetFileContent(String repositoryId, String ref, String filePath) Get file content by path and refgetFileTree(String repositoryId, String ref) Get file tree for a repository Uses the /repos/{repo_id}/trees/{ref_id} endpointgetLatestCommit(String repositoryId, String branchId) Get the latest commit for a specific branch Uses the branch's current commit ID to get the actual commit detailsgetRepository(String repositoryId) Get repository detailsGet a specific tag by IDlistBranches(String repositoryId) List all branches for a repositorylistCommits(String repositoryId, int limit) List commits for a repositoryList all repositories accessible to the user Useful for UI dropdown selectionList all tags for a repositoryresolveBranchId(String repositoryId, String branchNameOrId) Resolve branch name to ID Returns branch ID if already an ID, otherwise looks up by namebooleanTest authentication with Diversion API
-
Constructor Details
-
DiversionApiClient
Constructor for use during a Run (build execution)- Parameters:
credentialsId- The credential ID to userun- The Run context (used to resolve folder-scoped credentials)
-
DiversionApiClient
Constructor for use outside of a Run context (e.g., UI dropdowns)- Parameters:
credentialsId- The credential ID to use
-
-
Method Details
-
testAuthentication
Test authentication with Diversion API- Throws:
IOExceptionInterruptedException
-
getRepository
public DiversionRepository getRepository(String repositoryId) throws IOException, InterruptedException Get repository details- Throws:
IOExceptionInterruptedException
-
getFileTree
public List<DiversionFile> getFileTree(String repositoryId, String ref) throws IOException, InterruptedException Get file tree for a repository Uses the /repos/{repo_id}/trees/{ref_id} endpoint- Throws:
IOExceptionInterruptedException
-
getFileContent
public String getFileContent(String repositoryId, String ref, String filePath) throws IOException, InterruptedException Get file content by path and ref- Throws:
IOExceptionInterruptedException
-
listRepositories
List all repositories accessible to the user Useful for UI dropdown selection- Throws:
IOExceptionInterruptedException
-
listBranches
public List<DiversionBranch> listBranches(String repositoryId) throws IOException, InterruptedException List all branches for a repository- Throws:
IOExceptionInterruptedException
-
getBranchDetails
public DiversionBranch getBranchDetails(String repositoryId, String branchIdOrName) throws IOException, InterruptedException Get branch details by ID or name- Throws:
IOExceptionInterruptedException
-
resolveBranchId
public String resolveBranchId(String repositoryId, String branchNameOrId) throws IOException, InterruptedException Resolve branch name to ID Returns branch ID if already an ID, otherwise looks up by name- Throws:
IOExceptionInterruptedException
-
listCommits
public List<DiversionCommit> listCommits(String repositoryId, int limit) throws IOException, InterruptedException List commits for a repository- Throws:
IOExceptionInterruptedException
-
getLatestCommit
public DiversionCommit getLatestCommit(String repositoryId, String branchId) throws IOException, InterruptedException Get the latest commit for a specific branch Uses the branch's current commit ID to get the actual commit details- Throws:
IOExceptionInterruptedException
-
getCommitDetails
public DiversionCommit getCommitDetails(String repositoryId, String commitId) throws IOException, InterruptedException Get detailed commit information including changed files- Throws:
IOExceptionInterruptedException
-
listTags
List all tags for a repository- Throws:
IOExceptionInterruptedException
-
getTag
public DiversionTag getTag(String repositoryId, String tagId) throws IOException, InterruptedException Get a specific tag by ID- Throws:
IOExceptionInterruptedException
-
createTag
public DiversionTag createTag(String repositoryId, String tagName, String commitId, String description) throws IOException, InterruptedException Create a new tag- Throws:
IOExceptionInterruptedException
-
deleteTag
Delete a tag- Throws:
IOExceptionInterruptedException
-