Rest Client Generator

Java annotation processor for the implementation of rest calls.

Лицензия

Лицензия

Категории

Категории

Spring Boot Контейнер Микросервисы CLI Взаимодействие с пользователем Auto Библиотеки уровня приложения Code Generators config Configuration
Группа

Группа

io.github.raphasil.rest-client-generator
Идентификатор

Идентификатор

webclient-generator-spring-boot-autoconfigure
Последняя версия

Последняя версия

0.0.1
Дата

Дата

Тип

Тип

jar
Описание

Описание

Rest Client Generator
Java annotation processor for the implementation of rest calls.
Ссылка на сайт

Ссылка на сайт

https://raphasil.github.io/rest-client-generator
Система контроля версий

Система контроля версий

https://github.com/raphasil/rest-client-generator

Скачать webclient-generator-spring-boot-autoconfigure

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/io.github.raphasil.rest-client-generator/webclient-generator-spring-boot-autoconfigure/ -->
<dependency>
    <groupId>io.github.raphasil.rest-client-generator</groupId>
    <artifactId>webclient-generator-spring-boot-autoconfigure</artifactId>
    <version>0.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/io.github.raphasil.rest-client-generator/webclient-generator-spring-boot-autoconfigure/
implementation 'io.github.raphasil.rest-client-generator:webclient-generator-spring-boot-autoconfigure:0.0.1'
// https://jarcasting.com/artifacts/io.github.raphasil.rest-client-generator/webclient-generator-spring-boot-autoconfigure/
implementation ("io.github.raphasil.rest-client-generator:webclient-generator-spring-boot-autoconfigure:0.0.1")
'io.github.raphasil.rest-client-generator:webclient-generator-spring-boot-autoconfigure:jar:0.0.1'
<dependency org="io.github.raphasil.rest-client-generator" name="webclient-generator-spring-boot-autoconfigure" rev="0.0.1">
  <artifact name="webclient-generator-spring-boot-autoconfigure" type="jar" />
</dependency>
@Grapes(
@Grab(group='io.github.raphasil.rest-client-generator', module='webclient-generator-spring-boot-autoconfigure', version='0.0.1')
)
libraryDependencies += "io.github.raphasil.rest-client-generator" % "webclient-generator-spring-boot-autoconfigure" % "0.0.1"
[io.github.raphasil.rest-client-generator/webclient-generator-spring-boot-autoconfigure "0.0.1"]

Зависимости

compile (2)

Идентификатор библиотеки Тип Версия
io.github.raphasil.rest-client-generator : api jar 0.0.1
org.springframework.boot : spring-boot-starter-webflux jar

runtime (2)

Идентификатор библиотеки Тип Версия
org.springframework.boot : spring-boot-starter-validation jar
org.springframework.boot : spring-boot-autoconfigure jar

Модули Проекта

Данный проект не имеет модулей.

Rest Client Generator

Maven Central License

Build Status codecov Code Quality: Java Total Alerts

Introduction

RestClientGenerator is a Java annotation processor for the implementation of rest calls

Getting Started

Take a look here.

API Declaration

Annotations on the interface methods and its parameters indicate how a request will be handled.

Request Method

Every method must have an HTTP annotation that provides the request method and relative path. There are eight built-in annotations: HTTP, GET, POST, PUT, PATCH, DELETE, OPTIONS and HEAD. The relative path of the resource can be defined in the annotation.

@RestClient("client-one")
interface UserService {
    @GET("api/v1/users")
    List getUsers();
}

URL Manipulation

A request URL can be updated dynamically using replacement blocks and parameters on the method. A replacement block is an alphanumeric string surrounded by { and }. A corresponding parameter must be annotated with @Path using the same string or variable name.

@RestClient(value = "client-one", path = "api/v1/users")
interface UserService {
    
    @GET("{id}")
    User getUserById(@Path UUID id);
    
    @GET("api/v1/users/{id}/profiles/{profile-id}")
    User getUserProfile(@Path UUID id, @Path("profile-id") String profileId);

}

A query parameter can also be added:

@RestClient("client-one")
interface UserService {
    
    // result: api/v1/users?sort=""&nickname=""
    @GET("api/v1/users")
    List<User> getAll(@Query String sort, @Query("nickname") String name);

}

Request Body

An object can be specified for use as an HTTP request body with the @Body annotation.

@RestClient("client-one")
interface UserService {
        
    @POST("api/v1/users")
    User create(@Body User user);

}

Header Manipulation

You can set static headers for a method using the @Headers annotation.

@RestClient("client-one")
interface UserService {
    
    @Headers("x-ping: pong")    
    @POST("api/v1/users")
    User create(@Body User user);
    
    @Headers({
                 "Accept: application/txt",
                 "x-api-key: secret"
             })    
    @PUT("api/v1/users")
    User create(@Body User user);
    
    @GET("api/v1/users")
    User getUser(@Header("Authorization") String admin);

}

Версии библиотеки

Версия
0.0.1