Skip to content

Commit

Permalink
Merge pull request #39335 from gsmet/rest-client-quickstart
Browse files Browse the repository at this point in the history
Various small tweaks for the REST extensions
  • Loading branch information
geoand authored Mar 12, 2024
2 parents f4ec8a4 + ba3232f commit 217bd98
Show file tree
Hide file tree
Showing 12 changed files with 91 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{#include readme-header /}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: resteasy-client-codestart
ref: resteasy-client
type: code
tags: extension-codestart
metadata:
title: RESTEasy Client
description: Invoke different services through REST with JSON
related-guide-section: https://quarkus.io/guides/resteasy-client
language:
base:
dependencies:
- io.quarkus:quarkus-resteasy-client
- io.quarkus:quarkus-resteasy-client-jackson
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package org.acme;

import org.eclipse.microprofile.rest.client.inject.RegisterRestClient;

import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.QueryParam;
import java.util.List;
import java.util.Set;

/**
* To use it via injection.
*
* {@code
* @Inject
* @RestClient
* MyRemoteService myRemoteService;
*
* public void doSomething() {
* Set<MyRemoteService.Extension> restClientExtensions = myRemoteService.getExtensionsById("io.quarkus:quarkus-hibernate-validator");
* }
* }
*/
@RegisterRestClient(baseUri = "https://stage.code.quarkus.io/api")
public interface MyRemoteService {

@GET
@Path("/extensions")
Set<Extension> getExtensionsById(@QueryParam("id") String id);

class Extension {
public String id;
public String name;
public String shortName;
public List<String> keywords;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package org.acme

import org.eclipse.microprofile.rest.client.inject.RegisterRestClient
import jakarta.ws.rs.GET
import jakarta.ws.rs.Path
import jakarta.ws.rs.QueryParam

/**
* To use it via injection.
*
* ```kotlin
* @Inject
* @RestClient
* lateinit var myRemoteService: MyRemoteService
*
* fun doSomething() {
* val restClientExtensions = myRemoteService.getExtensionsById("io.quarkus:quarkus-rest-client")
* }
* ```
*/
@RegisterRestClient(baseUri = "https://stage.code.quarkus.io/api")
interface MyRemoteService {

@GET
@Path("/extensions")
fun getExtensionsById(@QueryParam("id") id: String): Set<Extension>

data class Extension(val id: String, val name: String, val shortName: String, val keywords: List<String>)
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ metadata:
- "security"
status: "stable"
config:
- "quarkus.resteasy-client-oidc-filter."
- "quarkus.oidc-client."
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ metadata:
- "security"
status: "stable"
config:
- "quarkus.rest-client-oidc-filter."
- "quarkus.oidc-client."
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ metadata:
- "security"
status: "stable"
config:
- "quarkus.rest-client-oidc-token-propagation."
- "quarkus.oidc-token-propagation-reactive."
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ metadata:
- "security"
status: "stable"
config:
- "quarkus.resteasy-client-token-propagation."
- "quarkus.oidc-token-propagation."
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ metadata:
categories:
- "web"
codestart:
name: "rest-client"
name: "resteasy-client"
languages:
- "java"
- "kotlin"
artifact: "io.quarkus:quarkus-project-core-extension-codestarts"
config:
- "quarkus.rest-client."
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,11 @@ metadata:
status: "stable"
guide: "https://quarkus.io/guides/rest-client"
codestart:
name: "rest"
kind: "core"
name: "rest-client"
languages:
- "java"
- "kotlin"
- "scala"
artifact: "io.quarkus:quarkus-project-core-extension-codestarts"
config:
- "quarkus.rest-client."
- "quarkus.rest-client-reactive."
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ metadata:
- "security"
status: "preview"
config:
- "quarkus.rest-csrf."
- "quarkus.csrf-reactive."
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ metadata:
- "scala"
artifact: "io.quarkus:quarkus-project-core-extension-codestarts"
config:
- "quarkus.rest."
- "quarkus.resteasy-reactive."

0 comments on commit 217bd98

Please sign in to comment.