Skip to content

MenuDocs/paste-client-java

Repository files navigation

MenuDocs paste client

Installation

You can install the wrapper with the following dependency managers.

The repo can be downloaded from jcenter.

The docs are available here

The current latest version is: version

Gradle

repositories {
    mavenCentral()
    maven {
        name 'duncte123-jfrog'
        url 'https://duncte123.jfrog.io/artifactory/maven'
    }
}
dependencies {
    implementation group: 'org.menudocs', name: 'paste-client-java', version: '[VERSION]'
}

Maven

<repository>
    <id>jfrog-duncte123</id>
    <name>jfrog-duncte123</name>
    <url>https://duncte123.jfrog.io/artifactory/maven</url>
</repository>

<dependency>
	<groupId>org.menudocs</groupId>
	<artifactId>paste-client-java</artifactId>
	<version>[VERSION]</version>
</dependency>

Examples

Creating the client

import org.menudocs.paste.PasteClient;
import org.menudocs.paste.PasteClientBuilder;
import org.menudocs.paste.PasteHost;


PasteClient client = new PasteClientBuilder()
                .setUserAgent("Example paste client")
                .setDefaultExpiry("10m")
                .setPasteHost(PasteHost.MENUDOCS) // Optional
                .build();

Creating a paste

// Sync operation
String pasteID = client.createPaste("html", "<h1>testing</h1>").execute();

// Async operation
client.createPaste("html", "<h1>testing</h1>").async((pasteID) -> {
    // Use pasteID here
});

Getting the paste url

String pasteUrl = client.getPasteUrl(pasteID);

Retrieving a paste

// Sync operation
Paste paste = client.getPaste(pasteID).execute();
System.out.println(paste.getPasteUrl());
System.out.println(paste.getBody());

// Async operation
client.getPaste(pasteID).async((paste) -> {
    System.out.println(paste.getPasteUrl());
    System.out.println(paste.getBody());
});

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published