// Code generated by openapi-nexus. DO NOT EDIT.
//
// Response Fallback Test API — 1.0.0
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;
/**
* GetFallbackNoBodyResponse carries the response from getFallbackNoBody.
*/
public class GetFallbackNoBodyResponse {
private final int statusCode;
private final Response raw;
public GetFallbackNoBodyResponse(int statusCode, Response raw) {
this.statusCode = statusCode;
this.raw = raw;
}
public int getStatusCode() {
return this.statusCode;
}
public Response getRaw() {
return this.raw;
}
}
/**
* GetFallbackWithBodyResponse carries the response from getFallbackWithBody.
*/
public class GetFallbackWithBodyResponse {
private final int statusCode;
private final Response raw;
private final GetFallbackWithBodyResponse200 status200;
public GetFallbackWithBodyResponse(int statusCode, Response raw,
GetFallbackWithBodyResponse200 status200) {
this.statusCode = statusCode;
this.raw = raw;
this.status200 = status200;
}
public int getStatusCode() {
return this.statusCode;
}
public Response getRaw() {
return this.raw;
}
public GetFallbackWithBodyResponse200 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;
}
/**
* getFallbackNoBody GET /fallback/no-body.
*/
public GetFallbackNoBodyResponse getFallbackNoBody() throws IOException {
String path = "/fallback/no-body";
Request request = client.newRequest("GET", path, null, 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 GetFallbackNoBodyResponse(response.code(), response);
}
/**
* getFallbackWithBody GET /fallback/with-body.
*/
public GetFallbackWithBodyResponse getFallbackWithBody() throws IOException {
String path = "/fallback/with-body";
Request request = client.newRequest("GET", path, null, 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);
}
String responseBody = response.body() != null ? response.body().string() : "null";
GetFallbackWithBodyResponse200 status200 = null;
if (response.code() == 200) {
status200 = gson.fromJson(responseBody, new TypeToken<GetFallbackWithBodyResponse200>() {}.getType());
}
return new GetFallbackWithBodyResponse(response.code(), response, status200);
}
}