48 lines
1.5 KiB
Plaintext
48 lines
1.5 KiB
Plaintext
/**
|
|
* Auto-generated from apibuilder.io service specification.
|
|
* apidoc-version : {{service.apidoc.version}}
|
|
* organisation : {{service.organization.key}}
|
|
* service-version : {{service.version}}
|
|
*
|
|
* Documentation at:
|
|
* <a href="https://app.apibuilder.io/{{service.organization.key}}/{{service.name}}/{{service.version}}">https://app.apibuilder.io/{{service.organization.key}}/{{service.name}}/{{service.version}}</a>
|
|
*
|
|
**/
|
|
package {{namespace}}.client;
|
|
|
|
import lombok.*;
|
|
import org.glassfish.jersey.client.HttpUrlConnectorProvider;
|
|
|
|
import javax.ws.rs.client.Client;
|
|
import javax.ws.rs.client.ClientBuilder;
|
|
import javax.ws.rs.client.ClientRequestFilter;
|
|
import javax.ws.rs.client.ClientRequestContext;
|
|
import java.io.IOException;
|
|
|
|
@Builder(toBuilder = true)
|
|
@With
|
|
@Getter
|
|
@EqualsAndHashCode
|
|
public class {{configName}} implements ClientRequestFilter {
|
|
|
|
@NonNull
|
|
private final String baseUrl;
|
|
@Builder.Default
|
|
private final Client client = ClientBuilder.newClient()
|
|
.register(this)
|
|
.property(HttpUrlConnectorProvider.SET_METHOD_WORKAROUND, true);
|
|
|
|
{{#headers}}/** {{#description}}{{.}}
|
|
{{/description}} **/{{#required}}
|
|
@NonNull{{/required}}
|
|
private {{{type.name}}} {{label}};
|
|
{{/headers}}
|
|
|
|
@Override
|
|
public void filter(ClientRequestContext requestContext) throws IOException {
|
|
{{#headers}}
|
|
requestContext.getHeaders().add("{{name}}", this.{{label}});
|
|
{{/headers}}
|
|
}
|
|
|
|
} |