Class SwaggerHubClient
java.lang.Object
io.github.ludy87.swagger.swaggerhub.v2.client.SwaggerHubClient
Client for interacting with SwaggerHub API. This class provides methods to download and upload
API definitions.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic SwaggerHubClientCreates a SwaggerHubClient for public SwaggerHub instances.static SwaggerHubClientcreateOnPremise(String host, Integer port, String protocol, String token, Boolean onPremise, String onPremiseAPISuffix) Creates a SwaggerHubClient for on-premise SwaggerHub instances.getDefinition(SwaggerHubRequest swaggerHubRequest) Downloads the API definition from SwaggerHub.voidsaveDefinition(SwaggerHubRequest swaggerHubRequest) Saves the API definition to SwaggerHub.voidsaveDefinitionPUT(SwaggerHubRequest swaggerHubRequest) Sets the default version for the API in SwaggerHub.
-
Constructor Details
-
SwaggerHubClient
public SwaggerHubClient()
-
-
Method Details
-
create
Creates a SwaggerHubClient for public SwaggerHub instances.- Parameters:
host- the host of the SwaggerHub instanceport- the port of the SwaggerHub instanceprotocol- the protocol (http or https)token- the authentication token- Returns:
- a configured SwaggerHubClient instance
-
createOnPremise
public static SwaggerHubClient createOnPremise(String host, Integer port, String protocol, String token, Boolean onPremise, String onPremiseAPISuffix) Creates a SwaggerHubClient for on-premise SwaggerHub instances.- Parameters:
host- the host of the SwaggerHub instanceport- the port of the SwaggerHub instanceprotocol- the protocol (http or https)token- the authentication tokenonPremise- whether this is an on-premise instanceonPremiseAPISuffix- the API suffix for on-premise instances- Returns:
- a configured SwaggerHubClient instance
-
getDefinition
public String getDefinition(SwaggerHubRequest swaggerHubRequest) throws org.gradle.api.GradleException Downloads the API definition from SwaggerHub.- Parameters:
swaggerHubRequest- the request containing API details- Returns:
- the API definition as a string
- Throws:
org.gradle.api.GradleException- if there is an error during the GET request
-
saveDefinition
public void saveDefinition(SwaggerHubRequest swaggerHubRequest) throws org.gradle.api.GradleException Saves the API definition to SwaggerHub.- Parameters:
swaggerHubRequest- the request containing API details- Throws:
org.gradle.api.GradleException- if there is an error during the POST request
-
saveDefinitionPUT
public void saveDefinitionPUT(SwaggerHubRequest swaggerHubRequest) throws org.gradle.api.GradleException Sets the default version for the API in SwaggerHub.- Parameters:
swaggerHubRequest- the request containing API details- Throws:
org.gradle.api.GradleException- if there is an error during the PUT request
-