Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

32 Commits

Repository files navigation

Made with Java


Made with Java

ConnectionAPI is a library, where you can perform rest request or do a socket connection for example

It will get bigger over time, but slowly, because it is just a side project

Installation

Maven

Repository

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

Dependency

<dependency>
<groupId>com.github.Asedem</groupId>
<artifactId>ConnectionAPI</artifactId>
<version>5ffcfef027</version>
</dependency>

Gradle

Repository

repositories {
maven { url 'https://jitpack.io' }
}

Dependency

dependencies {
implementation 'com.github.Asedem:ConnectionAPI:5ffcfef027'
}

Rest

Http Methods

The most important Http Methods are Supported:

GET, PUT, HEAD, POST, TRACE, PATCH, DELETE, CONNECT, OPTIONS

General Request

Requesting a sync raw JSON

finalJSONObjectjsonObject = Rest.requestSync(newURL("<Your URL>"), HttpMethode.<YourMethode>)
.asRawValue();
...

Requesting an async raw JSON

Rest.request(newURL("<Your URL>"), HttpMethode.<YourMethode>)
.whenComplete((restRequest, throwable) -> ...);

Get JSON as a predefined Java Object

Java Object example class

publicrecordData(
Integerid,
Stringname,
Stringemail
) {
}

Requesting the JSON as the Data object sync

finalDatadata = Rest.requestSync(newURL("<Your URL>"), HttpMethode.<YourMethode>)
.asJavaObject(Data.class)
.get();
...

Requesting the JSON as the Data object async

Rest.request(newURL("<Your URL>"), HttpMethode.<YourMethode>)
.whenComplete((restRequest, throwable) -> {
try {
finalDatadata = restRequest.asJavaObject(Data.class).get();
...
} catch (JsonProcessingExceptionexception) {
exception.printStackTrace();
}
});

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages