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

io.github.sinri.AiOnHttpMix.azure.bing.search.v7.BingSearchResponseImpl Maven / Gradle / Ivy

The newest version!
package io.github.sinri.AiOnHttpMix.azure.bing.search.v7;

import io.github.sinri.keel.core.json.UnmodifiableJsonifiableEntityImpl;
import io.vertx.core.json.JsonObject;
import org.jetbrains.annotations.Nullable;

import java.util.Map;

class BingSearchResponseImpl extends UnmodifiableJsonifiableEntityImpl implements BingSearchResponse {
    private final int statusCode;
    private final Map headers;
    private final String rawBody;

    public BingSearchResponseImpl(
            int statusCode,
            Map headers,
            @Nullable String rawBody
    ) {
        super(prepareBody(rawBody));
        this.statusCode = statusCode;
        this.headers = headers;
        this.rawBody = rawBody;
    }

    private static JsonObject prepareBody(String rawBody) {
        try {
            return new JsonObject(rawBody);
        } catch (Throwable t) {
            return new JsonObject();
        }
    }

    @Override
    public int getStatusCode() {
        return statusCode;
    }

    @Override
    public Map getHeaders() {
        return headers;
    }

    @Override
    public String getRawBody() {
        return rawBody;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy