An open API service indexing awesome lists of open source software.

https://github.com/menudocs/paste-client-java


https://github.com/menudocs/paste-client-java

Last synced: 11 months ago
JSON representation

Awesome Lists containing this project

README

          

# 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][] ][download]

#### Gradle
```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
```xml

jfrog-duncte123
jfrog-duncte123
https://duncte123.jfrog.io/artifactory/maven

org.menudocs
paste-client-java
[VERSION]

```

### Examples

#### Creating the client
```java
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
```java
// Sync operation
String pasteID = client.createPaste("html", "

testing

").execute();

// Async operation
client.createPaste("html", "

testing

").async((pasteID) -> {
// Use pasteID here
});
```

#### Getting the paste url
```java
String pasteUrl = client.getPasteUrl(pasteID);
```

#### Retrieving a paste
```java
// 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());
});
```

[version]: https://img.shields.io/maven-metadata/v?metadataUrl=https%3A%2F%2Fduncte123.jfrog.io%2Fartifactory%2Fmaven%2Forg%2Fmenudocs%2Fpaste-client-java%2Fmaven-metadata.xml
[download]: https://duncte123.jfrog.io/ui/packages/gav:%2F%2Forg.menudocs:paste-client-java