Skip to content
/ TULIP Public

☑️📦 Teaching Utilities for Learning Individual Practices

License

Notifications You must be signed in to change notification settings

javiergs/TULIP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

64 Commits
 
 
 
 
 
 
 
 
 
 

Static Badge GitHub repo size Java

Build and deploy JavaDoc

Features

  • GitHub API helpers for reading remote repository contents
  • URL parsing utilities for GitHub paths
  • Optional GitHub token support via tulip.properties
  • Simple integration with Maven

Installation

Include TULIP in your Java project using JitPack.

1. Add the JitPack repository

<repositories>
  <repository>
    <id>jitpack.io</id>
    <url>https://jitpack.io</url>
  </repository>
</repositories>

2. Add the dependency

<dependency>
  <groupId>com.github.javiergs</groupId>
  <artifactId>TULIP</artifactId>
  <version>v3.0</version>
</dependency>

What TULIP Provides

URL Parsing Utilities

  • URLFactory
    Parses GitHub URLs (root, tree, blob) and normalizes missing parts (e.g., default branch = main)

  • URLObject
    Represents a structured GitHub resource with:

    • owner
    • repository
    • revision (branch/tag/commit)
    • path
    • kind (ROOT, TREE, BLOB)
    • convenience helpers isBlob(), isDirectory()

GitHub API Tools

GitHubHandler

  • List files and folders in any repo
  • Fetch file contents
  • Recursive traversal of remote repositories
  • Automatic fallback to main branch
  • Supports authentication via a local properties file

Using a GitHub Token (optional but recommended)

Create a file:

src/main/resources/tulip.properties

Add:

GITHUB_TOKEN=ghp_your_token_here

This avoids API rate limits for unauthenticated users.

Basic Usage Examples

Parse a GitHub URL

URLObject u = URLFactory.parseGitHubUrl(
    "https://github.com/javiergs/ADASIM/tree/main/src"
);

List files in a repository

GitHubHandler gh = new GitHubHandler();
List<String> files = gh.listFiles("https://github.com/javiergs/ADASIM");

Fetch contents of a remote file

String text = gh.getFileContentFromUrl(
    "https://github.com/javiergs/ADASIM/blob/main/pom.xml"
);

API Reference

Full JavaDoc available at:

➡️ https://javiergs.github.io/TULIP/