All Downloads are FREE. Search and download functionalities are using the official Maven repository.

dev.openfga.sdk.api.client.ApiResponse Maven / Gradle / Ivy

/*
 * OpenFGA
 * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar.
 *
 * The version of the OpenAPI document: 1.x
 * Contact: [email protected]
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */

package dev.openfga.sdk.api.client;

import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.TreeMap;

/**
 * API response returned by API call.
 *
 * @param  The type of data that is deserialized from response body
 */
public class ApiResponse {
    private final int statusCode;
    private final Map> headers;
    private final String rawResponse;
    private final T data;

    /**
     * @param statusCode The status code of HTTP response
     * @param headers The headers of HTTP response
     * @param data The object deserialized from response bod
     */
    public ApiResponse(int statusCode, Map> headers, String rawResponse, T data) {
        this.statusCode = statusCode;
        Map> responseHeaders = new TreeMap>(String.CASE_INSENSITIVE_ORDER);
        for (Entry> entry : headers.entrySet()) {
            responseHeaders.put(entry.getKey().toLowerCase(), entry.getValue());
        }
        this.headers = responseHeaders;
        this.rawResponse = rawResponse;
        this.data = data;
    }

    public int getStatusCode() {
        return statusCode;
    }

    public Map> getHeaders() {
        return headers;
    }

    public String getRawResponse() {
        return rawResponse;
    }

    public T getData() {
        return data;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy