https://github.com/menudocs/paste-client-java
https://github.com/menudocs/paste-client-java
Last synced: 11 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/menudocs/paste-client-java
- Owner: MenuDocs
- License: apache-2.0
- Created: 2019-08-07T20:53:45.000Z (over 6 years ago)
- Default Branch: develop
- Last Pushed: 2021-05-25T06:13:26.000Z (almost 5 years ago)
- Last Synced: 2025-02-03T11:49:40.014Z (about 1 year ago)
- Language: Java
- Size: 92.8 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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