Skip to content

RasepiHQ/rasepi-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rasepi Java SDK

Official Java client library for the Rasepi API — a multilingual-first collaborative documentation platform with forced expiry and plugin architecture.

Maven Central License: MIT Java 17+

Installation

Maven

<dependency>
    <groupId>com.rasepi</groupId>
    <artifactId>rasepi-java</artifactId>
    <version>1.0.0</version>
</dependency>

Gradle

implementation 'com.rasepi:rasepi-java:1.0.0'

Quick Start

import com.rasepi.RasepiClient;
import com.rasepi.RasepiClientOptions;

var client = RasepiClient.create(RasepiClientOptions.builder()
    .baseUrl("https://your-instance.rasepi.com")
    .accessToken("your-access-token")
    .build());

// List hubs
var hubs = client.hubs().list();
hubs.forEach(hub -> System.out.println(hub.name() + " (" + hub.key() + ")"));

// Get an entry
var entry = client.entries().get(entryId);
System.out.println(entry.title());

// Create a new entry
var newEntry = client.entries().create(Map.of(
    "hubKey", "engineering",
    "key", "getting-started",
    "title", "Getting Started Guide",
    "content", "<p>Hello world</p>",
    "originalLanguage", "en",
    "expiryDays", 90
));

Authentication

OAuth 2.0 Flow

var client = RasepiClient.create(RasepiClientOptions.builder()
    .baseUrl("https://your-instance.rasepi.com")
    .build());

// Step 1: Get the OAuth login URL
String loginUrl = client.auth().getLoginUrl("google", "https://your-app.com/callback");

// Step 2: Exchange the code
var tokens = client.auth().exchangeCode(authCode);
// Client automatically stores and uses the tokens

// Tokens are refreshed automatically when expired

Token Refresh

var tokens = client.auth().refreshToken(refreshToken);

Development Token

var client = RasepiClient.create(RasepiClientOptions.builder()
    .baseUrl("http://localhost:5000")
    .devToken(tenantId, userId)
    .build());

API Reference

Hubs

client.hubs().list();
client.hubs().get("engineering");
client.hubs().create(Map.of("key", "eng", "name", "Engineering", "defaultExpiryDays", 90));
client.hubs().update("engineering", Map.of("name", "Engineering Docs"));
client.hubs().delete("engineering");
client.hubs().transferOwnership("engineering", newOwnerId);

Entries

client.entries().listByHub("engineering");
client.entries().get(entryId);
client.entries().create(Map.of(...));
client.entries().update(entryId, Map.of("title", "Updated"));
client.entries().publish(entryId);
client.entries().renew(entryId);
client.entries().delete(entryId);

Translations

client.translations().list(entryId);
client.translations().get(entryId, "de");
client.translations().create(entryId, "de", Map.of("title", "Titel", "content", "<p>Inhalt</p>"));
client.translations().getStatus(entryId, "de");
client.translations().getStaleBlocks(entryId, "de");
client.translations().markUpToDate(entryId, "de");

Analytics

client.analytics().getSummary(entryId);
client.analytics().getEvents(entryId, 0, 50);
client.analytics().reportTimeSpent(entryId, 120);

AI & Search

var results = client.ai().search(Map.of("query", "how to deploy", "mode", "hybrid"));
var conversation = client.ai().createConversation("My Question");
var response = client.ai().sendMessage(conversationId, Map.of("content", "How to set up CI/CD?"));

Knowledge Portal

client.portal().getFeed();
client.portal().getTopics();
client.portal().getContent("engineering", "getting-started", "en");
client.portal().search("deployment guide");

Sharing

var link = client.sharing().create("getting-started", Map.of("expiresAt", "2026-04-14T00:00:00Z"));
var links = client.sharing().list("getting-started");
client.sharing().revoke("getting-started", linkId);

Error Handling

import com.rasepi.RasepiApiException;

try {
    var hub = client.hubs().get("non-existent");
} catch (RasepiApiException e) {
    System.out.println("Error " + e.getStatusCode() + ": " + e.getMessage());
}

Requirements

  • Java 17+
  • java.net.http.HttpClient (built-in)
  • Jackson for JSON serialization

License

MIT — see LICENSE for details.

About

Official Java client library for the Rasepi API

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages