// Code generated by openapi-nexus. DO NOT EDIT.
//
// Naming Conventions Test — 1.0.0
// Test fixture to verify language property naming conventions
package com.example.sdk.apis;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.example.sdk.models.*;
import com.example.sdk.runtime.ApiClient;
import com.example.sdk.runtime.ApiException;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import okhttp3.Request;
import okhttp3.Response;
/**
* GetWithQueryParamsResponse carries the response from getWithQueryParams.
*/
public class GetWithQueryParamsResponse {
private final int statusCode;
private final Response raw;
public GetWithQueryParamsResponse(int statusCode, Response raw) {
this.statusCode = statusCode;
this.raw = raw;
}
public int getStatusCode() {
return this.statusCode;
}
public Response getRaw() {
return this.raw;
}
}
/**
* TestNamingConventionsResponse carries the response from testNamingConventions.
*/
public class TestNamingConventionsResponse {
private final int statusCode;
private final Response raw;
private final NamingConventionTest status200;
public TestNamingConventionsResponse(int statusCode, Response raw,
NamingConventionTest status200) {
this.statusCode = statusCode;
this.raw = raw;
this.status200 = status200;
}
public int getStatusCode() {
return this.statusCode;
}
public Response getRaw() {
return this.raw;
}
public NamingConventionTest getStatus200() {
return this.status200;
}
}
/**
* DefaultApi groups operations under the default tag.
*/
public class DefaultApi {
private final ApiClient client;
private final Gson gson = new Gson();
public DefaultApi(ApiClient client) {
this.client = client;
}
/**
* Get with query parameters
*/
public GetWithQueryParamsResponse getWithQueryParams(String snakeCaseParam,
Integer snakeCaseNumber,
String kebabCaseParam,
List<String> kebabCaseArray,
String pascalCaseParam,
Integer pascalCaseNumber,
String screamingSnakeCase,
Integer screamingNumber,
String camelCaseParam,
Integer camelCaseNumber, String singleword,
Integer id) throws IOException {
String path = "/test";
Map<String, String> query = new HashMap<>();
query.put("snake_case_param", snakeCaseParam);
if (snakeCaseNumber != null) {
query.put("snake_case_number", String.valueOf(snakeCaseNumber));
}
if (kebabCaseParam != null) {
query.put("kebab-case-param", kebabCaseParam);
}
if (kebabCaseArray != null) {
query.put("kebab-case-array", String.valueOf(kebabCaseArray));
}
if (pascalCaseParam != null) {
query.put("PascalCaseParam", pascalCaseParam);
}
if (pascalCaseNumber != null) {
query.put("PascalCaseNumber", String.valueOf(pascalCaseNumber));
}
if (screamingSnakeCase != null) {
query.put("SCREAMING_SNAKE_CASE", screamingSnakeCase);
}
if (screamingNumber != null) {
query.put("SCREAMING_NUMBER", String.valueOf(screamingNumber));
}
if (camelCaseParam != null) {
query.put("camelCaseParam", camelCaseParam);
}
if (camelCaseNumber != null) {
query.put("camelCaseNumber", String.valueOf(camelCaseNumber));
}
if (singleword != null) {
query.put("singleword", singleword);
}
if (id != null) {
query.put("id", String.valueOf(id));
}
Request request = client.newRequest("GET", path, query, null);
Response response = client.execute(request);
if (!response.isSuccessful()) {
String errorBody = response.body() != null ? response.body().string() : "";
throw new ApiException(response.code(), response.message(), errorBody);
}
return new GetWithQueryParamsResponse(response.code(), response);
}
/**
* Test endpoint with various parameter naming conventions
*/
public TestNamingConventionsResponse testNamingConventions(NamingConventionTest body) throws IOException {
String path = "/test";
String jsonBody = gson.toJson(body);
Request request = client.newRequest("POST", path, null, jsonBody);
Response response = client.execute(request);
if (!response.isSuccessful()) {
String errorBody = response.body() != null ? response.body().string() : "";
throw new ApiException(response.code(), response.message(), errorBody);
}
String responseBody = response.body() != null ? response.body().string() : "null";
NamingConventionTest status200 = null;
if (response.code() == 200) {
status200 = gson.fromJson(responseBody, new TypeToken<NamingConventionTest>() {}.getType());
}
return new TestNamingConventionsResponse(response.code(), response, status200);
}
}