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

localhost.controllers.MetadataController Maven / Gradle / Ivy

/*
 * RESTAPISDKLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */

package localhost.controllers;

import com.fasterxml.jackson.core.JsonProcessingException;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import localhost.ApiHelper;
import localhost.AuthManager;
import localhost.Configuration;
import localhost.exceptions.ApiException;
import localhost.exceptions.ErrorResponseException;
import localhost.http.Headers;
import localhost.http.client.HttpCallback;
import localhost.http.client.HttpClient;
import localhost.http.client.HttpContext;
import localhost.http.request.HttpRequest;
import localhost.http.response.HttpResponse;
import localhost.http.response.HttpStringResponse;
import localhost.models.HomeLiveboardResponse;
import localhost.models.MetadataTagResponse;
import localhost.models.TspublicRestV2MetadataDependencyRequest;
import localhost.models.TspublicRestV2MetadataDetailSearchRequest;
import localhost.models.TspublicRestV2MetadataFavoriteAssignRequest;
import localhost.models.TspublicRestV2MetadataFavoriteUnassignRequest;
import localhost.models.TspublicRestV2MetadataHeaderSearchRequest;
import localhost.models.TspublicRestV2MetadataHomeliveboardAssignRequest;
import localhost.models.TspublicRestV2MetadataHomeliveboardUnassignRequest;
import localhost.models.TspublicRestV2MetadataTagAssignRequest;
import localhost.models.TspublicRestV2MetadataTagCreateRequest;
import localhost.models.TspublicRestV2MetadataTagUnassignRequest;
import localhost.models.TspublicRestV2MetadataTagUpdateRequest;
import localhost.models.TspublicRestV2MetadataTmlExportRequest;
import localhost.models.TspublicRestV2MetadataTmlImportRequest;
import localhost.models.Type8Enum;
import localhost.models.Type9Enum;

/**
 * This class lists all the endpoints of the groups.
 */
public final class MetadataController extends BaseController {

    /**
     * Initializes the controller.
     * @param config    Configurations added in client.
     * @param httpClient    Send HTTP requests and read the responses.
     * @param authManagers    Apply authorization to requests.
     */
    public MetadataController(Configuration config, HttpClient httpClient,
            Map authManagers) {
        super(config, httpClient, authManagers);
    }

    /**
     * Initializes the controller with HTTPCallback.
     * @param config    Configurations added in client.
     * @param httpClient    Send HTTP requests and read the responses.
     * @param authManagers    Apply authorization to requests.
     * @param httpCallback    Callback to be called before and after the HTTP call.
     */
    public MetadataController(Configuration config, HttpClient httpClient,
            Map authManagers, HttpCallback httpCallback) {
        super(config, httpClient, authManagers, httpCallback);
    }

    /**
     * To get details of a specific tag, use this endpoint. At least one of id or name of tag is
     * required. When both are given, then id will be considered.
     * @param  name  Optional parameter: Name of the tag
     * @param  id  Optional parameter: The GUID of the tag
     * @return    Returns the MetadataTagResponse response from the API call
     * @throws    ApiException    Represents error response from the server.
     * @throws    IOException    Signals that an I/O exception of some sort has occurred.
     */
    public MetadataTagResponse getTag(
            final String name,
            final String id) throws ApiException, IOException {
        HttpRequest request = buildGetTagRequest(name, id);
        authManagers.get("global").apply(request);

        HttpResponse response = getClientInstance().execute(request, false);
        HttpContext context = new HttpContext(request, response);

        return handleGetTagResponse(context);
    }

    /**
     * To get details of a specific tag, use this endpoint. At least one of id or name of tag is
     * required. When both are given, then id will be considered.
     * @param  name  Optional parameter: Name of the tag
     * @param  id  Optional parameter: The GUID of the tag
     * @return    Returns the MetadataTagResponse response from the API call
     */
    public CompletableFuture getTagAsync(
            final String name,
            final String id) {
        return makeHttpCallAsync(() -> buildGetTagRequest(name, id),
            req -> authManagers.get("global").applyAsync(req)
                .thenCompose(request -> getClientInstance()
                        .executeAsync(request, false)),
            context -> handleGetTagResponse(context));
    }

    /**
     * Builds the HttpRequest object for getTag.
     */
    private HttpRequest buildGetTagRequest(
            final String name,
            final String id) {
        //the base uri for api requests
        String baseUri = config.getBaseUri();

        //prepare query string for API call
        final StringBuilder queryBuilder = new StringBuilder(baseUri
                + "/tspublic/rest/v2/metadata/tag");

        //load all query parameters
        Map queryParameters = new HashMap<>();
        queryParameters.put("name", name);
        queryParameters.put("id", id);

        //load all headers for the outgoing API request
        Headers headers = new Headers();
        headers.add("X-Requested-By", config.getXRequestedBy());
        headers.add("Accept-Language", config.getAcceptLanguage());
        headers.add("Content-Type", config.getContentType());
        headers.add("user-agent", BaseController.userAgent);
        headers.add("accept", "application/json");

        //prepare and invoke the API call request to fetch the response
        HttpRequest request = getClientInstance().get(queryBuilder, headers, queryParameters,
                null);

        // Invoke the callback before request if its not null
        if (getHttpCallback() != null) {
            getHttpCallback().onBeforeRequest(request);
        }

        return request;
    }

    /**
     * Processes the response for getTag.
     * @return An object of type MetadataTagResponse
     */
    private MetadataTagResponse handleGetTagResponse(
            HttpContext context) throws ApiException, IOException {
        HttpResponse response = context.getResponse();

        //invoke the callback after response if its not null
        if (getHttpCallback() != null) {
            getHttpCallback().onAfterResponse(context);
        }

        //Error handling using HTTP status codes
        int responseCode = response.getStatusCode();

        if (responseCode == 500) {
            throw new ErrorResponseException("Operation failed or unauthorized request", context);
        }
        //handle errors defined at the API level
        validateResponse(response, context);

        //extract result from the http response
        String responseBody = ((HttpStringResponse) response).getBody();
        MetadataTagResponse result = ApiHelper.deserialize(responseBody,
                MetadataTagResponse.class);

        return result;
    }

    /**
     * To programmatically create tags, use this endpoint.
     * @param  body  Required parameter: Example:
     * @return    Returns the MetadataTagResponse response from the API call
     * @throws    ApiException    Represents error response from the server.
     * @throws    IOException    Signals that an I/O exception of some sort has occurred.
     */
    public MetadataTagResponse createTag(
            final TspublicRestV2MetadataTagCreateRequest body) throws ApiException, IOException {
        HttpRequest request = buildCreateTagRequest(body);
        authManagers.get("global").apply(request);

        HttpResponse response = getClientInstance().execute(request, false);
        HttpContext context = new HttpContext(request, response);

        return handleCreateTagResponse(context);
    }

    /**
     * To programmatically create tags, use this endpoint.
     * @param  body  Required parameter: Example:
     * @return    Returns the MetadataTagResponse response from the API call
     */
    public CompletableFuture createTagAsync(
            final TspublicRestV2MetadataTagCreateRequest body) {
        return makeHttpCallAsync(() -> buildCreateTagRequest(body),
            req -> authManagers.get("global").applyAsync(req)
                .thenCompose(request -> getClientInstance()
                        .executeAsync(request, false)),
            context -> handleCreateTagResponse(context));
    }

    /**
     * Builds the HttpRequest object for createTag.
     */
    private HttpRequest buildCreateTagRequest(
            final TspublicRestV2MetadataTagCreateRequest body) throws JsonProcessingException {
        //validating required parameters
        if (null == body) {
            throw new NullPointerException("The parameter \"body\" is a required parameter and cannot be null.");
        }

        //the base uri for api requests
        String baseUri = config.getBaseUri();

        //prepare query string for API call
        final StringBuilder queryBuilder = new StringBuilder(baseUri
                + "/tspublic/rest/v2/metadata/tag/create");

        //load all headers for the outgoing API request
        Headers headers = new Headers();
        headers.add("Content-Type", "application/json");
        headers.add("X-Requested-By", config.getXRequestedBy());
        headers.add("Accept-Language", config.getAcceptLanguage());
        headers.add("user-agent", BaseController.userAgent);
        headers.add("accept", "application/json");

        //prepare and invoke the API call request to fetch the response
        String bodyJson = ApiHelper.serialize(body);
        HttpRequest request = getClientInstance().postBody(queryBuilder, headers, null, bodyJson);

        // Invoke the callback before request if its not null
        if (getHttpCallback() != null) {
            getHttpCallback().onBeforeRequest(request);
        }

        return request;
    }

    /**
     * Processes the response for createTag.
     * @return An object of type MetadataTagResponse
     */
    private MetadataTagResponse handleCreateTagResponse(
            HttpContext context) throws ApiException, IOException {
        HttpResponse response = context.getResponse();

        //invoke the callback after response if its not null
        if (getHttpCallback() != null) {
            getHttpCallback().onAfterResponse(context);
        }

        //Error handling using HTTP status codes
        int responseCode = response.getStatusCode();

        if (responseCode == 500) {
            throw new ErrorResponseException("Operation failed or unauthorized request", context);
        }
        //handle errors defined at the API level
        validateResponse(response, context);

        //extract result from the http response
        String responseBody = ((HttpStringResponse) response).getBody();
        MetadataTagResponse result = ApiHelper.deserialize(responseBody,
                MetadataTagResponse.class);

        return result;
    }

    /**
     * To programmatically update tags, use this endpoint. At least one of id or name of tag is
     * required. When both are given, then id will be considered.
     * @param  body  Required parameter: Example:
     * @return    Returns the Boolean response from the API call
     * @throws    ApiException    Represents error response from the server.
     * @throws    IOException    Signals that an I/O exception of some sort has occurred.
     */
    public Boolean updateTag(
            final TspublicRestV2MetadataTagUpdateRequest body) throws ApiException, IOException {
        HttpRequest request = buildUpdateTagRequest(body);
        authManagers.get("global").apply(request);

        HttpResponse response = getClientInstance().execute(request, false);
        HttpContext context = new HttpContext(request, response);

        return handleUpdateTagResponse(context);
    }

    /**
     * To programmatically update tags, use this endpoint. At least one of id or name of tag is
     * required. When both are given, then id will be considered.
     * @param  body  Required parameter: Example:
     * @return    Returns the Boolean response from the API call
     */
    public CompletableFuture updateTagAsync(
            final TspublicRestV2MetadataTagUpdateRequest body) {
        return makeHttpCallAsync(() -> buildUpdateTagRequest(body),
            req -> authManagers.get("global").applyAsync(req)
                .thenCompose(request -> getClientInstance()
                        .executeAsync(request, false)),
            context -> handleUpdateTagResponse(context));
    }

    /**
     * Builds the HttpRequest object for updateTag.
     */
    private HttpRequest buildUpdateTagRequest(
            final TspublicRestV2MetadataTagUpdateRequest body) throws JsonProcessingException {
        //validating required parameters
        if (null == body) {
            throw new NullPointerException("The parameter \"body\" is a required parameter and cannot be null.");
        }

        //the base uri for api requests
        String baseUri = config.getBaseUri();

        //prepare query string for API call
        final StringBuilder queryBuilder = new StringBuilder(baseUri
                + "/tspublic/rest/v2/metadata/tag/update");

        //load all headers for the outgoing API request
        Headers headers = new Headers();
        headers.add("Content-Type", "application/json");
        headers.add("X-Requested-By", config.getXRequestedBy());
        headers.add("Accept-Language", config.getAcceptLanguage());
        headers.add("user-agent", BaseController.userAgent);

        //prepare and invoke the API call request to fetch the response
        String bodyJson = ApiHelper.serialize(body);
        HttpRequest request = getClientInstance().putBody(queryBuilder, headers, null, bodyJson);

        // Invoke the callback before request if its not null
        if (getHttpCallback() != null) {
            getHttpCallback().onBeforeRequest(request);
        }

        return request;
    }

    /**
     * Processes the response for updateTag.
     * @return An object of type boolean
     */
    private Boolean handleUpdateTagResponse(
            HttpContext context) throws ApiException, IOException {
        HttpResponse response = context.getResponse();

        //invoke the callback after response if its not null
        if (getHttpCallback() != null) {
            getHttpCallback().onAfterResponse(context);
        }

        //Error handling using HTTP status codes
        int responseCode = response.getStatusCode();

        if (responseCode == 500) {
            throw new ErrorResponseException("Operation failed or unauthorized request", context);
        }
        //handle errors defined at the API level
        validateResponse(response, context);

        //extract result from the http response
        String responseBody = ((HttpStringResponse) response).getBody();
        boolean result = Boolean.parseBoolean(responseBody);

        return result;
    }

    /**
     * To programmatically delete tags, use this endpoint. At least one of id or name of tag is
     * required. When both are given, then id will be considered.
     * @param  name  Optional parameter: Name of the tag
     * @param  id  Optional parameter: The GUID of the tag
     * @return    Returns the Boolean response from the API call
     * @throws    ApiException    Represents error response from the server.
     * @throws    IOException    Signals that an I/O exception of some sort has occurred.
     */
    public Boolean deleteTag(
            final String name,
            final String id) throws ApiException, IOException {
        HttpRequest request = buildDeleteTagRequest(name, id);
        authManagers.get("global").apply(request);

        HttpResponse response = getClientInstance().execute(request, false);
        HttpContext context = new HttpContext(request, response);

        return handleDeleteTagResponse(context);
    }

    /**
     * To programmatically delete tags, use this endpoint. At least one of id or name of tag is
     * required. When both are given, then id will be considered.
     * @param  name  Optional parameter: Name of the tag
     * @param  id  Optional parameter: The GUID of the tag
     * @return    Returns the Boolean response from the API call
     */
    public CompletableFuture deleteTagAsync(
            final String name,
            final String id) {
        return makeHttpCallAsync(() -> buildDeleteTagRequest(name, id),
            req -> authManagers.get("global").applyAsync(req)
                .thenCompose(request -> getClientInstance()
                        .executeAsync(request, false)),
            context -> handleDeleteTagResponse(context));
    }

    /**
     * Builds the HttpRequest object for deleteTag.
     */
    private HttpRequest buildDeleteTagRequest(
            final String name,
            final String id) {
        //the base uri for api requests
        String baseUri = config.getBaseUri();

        //prepare query string for API call
        final StringBuilder queryBuilder = new StringBuilder(baseUri
                + "/tspublic/rest/v2/metadata/tag/delete");

        //load all query parameters
        Map queryParameters = new HashMap<>();
        queryParameters.put("name", name);
        queryParameters.put("id", id);

        //load all headers for the outgoing API request
        Headers headers = new Headers();
        headers.add("X-Requested-By", config.getXRequestedBy());
        headers.add("Accept-Language", config.getAcceptLanguage());
        headers.add("Content-Type", config.getContentType());
        headers.add("user-agent", BaseController.userAgent);

        //prepare and invoke the API call request to fetch the response
        HttpRequest request = getClientInstance().delete(queryBuilder, headers, queryParameters,
                null);

        // Invoke the callback before request if its not null
        if (getHttpCallback() != null) {
            getHttpCallback().onBeforeRequest(request);
        }

        return request;
    }

    /**
     * Processes the response for deleteTag.
     * @return An object of type boolean
     */
    private Boolean handleDeleteTagResponse(
            HttpContext context) throws ApiException, IOException {
        HttpResponse response = context.getResponse();

        //invoke the callback after response if its not null
        if (getHttpCallback() != null) {
            getHttpCallback().onAfterResponse(context);
        }

        //Error handling using HTTP status codes
        int responseCode = response.getStatusCode();

        if (responseCode == 500) {
            throw new ErrorResponseException("Operation failed or unauthorized request", context);
        }
        //handle errors defined at the API level
        validateResponse(response, context);

        //extract result from the http response
        String responseBody = ((HttpStringResponse) response).getBody();
        boolean result = Boolean.parseBoolean(responseBody);

        return result;
    }

    /**
     * To programmatically assign tags to a metadata object, such as a liveboard, search answer,
     * table, worksheet, or view, use this endpoint. At least one of id or name of tag is required.
     * When both are given, then id will be considered.
     * @param  body  Required parameter: Example:
     * @return    Returns the Boolean response from the API call
     * @throws    ApiException    Represents error response from the server.
     * @throws    IOException    Signals that an I/O exception of some sort has occurred.
     */
    public Boolean assignTag(
            final TspublicRestV2MetadataTagAssignRequest body) throws ApiException, IOException {
        HttpRequest request = buildAssignTagRequest(body);
        authManagers.get("global").apply(request);

        HttpResponse response = getClientInstance().execute(request, false);
        HttpContext context = new HttpContext(request, response);

        return handleAssignTagResponse(context);
    }

    /**
     * To programmatically assign tags to a metadata object, such as a liveboard, search answer,
     * table, worksheet, or view, use this endpoint. At least one of id or name of tag is required.
     * When both are given, then id will be considered.
     * @param  body  Required parameter: Example:
     * @return    Returns the Boolean response from the API call
     */
    public CompletableFuture assignTagAsync(
            final TspublicRestV2MetadataTagAssignRequest body) {
        return makeHttpCallAsync(() -> buildAssignTagRequest(body),
            req -> authManagers.get("global").applyAsync(req)
                .thenCompose(request -> getClientInstance()
                        .executeAsync(request, false)),
            context -> handleAssignTagResponse(context));
    }

    /**
     * Builds the HttpRequest object for assignTag.
     */
    private HttpRequest buildAssignTagRequest(
            final TspublicRestV2MetadataTagAssignRequest body) throws JsonProcessingException {
        //validating required parameters
        if (null == body) {
            throw new NullPointerException("The parameter \"body\" is a required parameter and cannot be null.");
        }

        //the base uri for api requests
        String baseUri = config.getBaseUri();

        //prepare query string for API call
        final StringBuilder queryBuilder = new StringBuilder(baseUri
                + "/tspublic/rest/v2/metadata/tag/assign");

        //load all headers for the outgoing API request
        Headers headers = new Headers();
        headers.add("Content-Type", "application/json");
        headers.add("X-Requested-By", config.getXRequestedBy());
        headers.add("Accept-Language", config.getAcceptLanguage());
        headers.add("user-agent", BaseController.userAgent);

        //prepare and invoke the API call request to fetch the response
        String bodyJson = ApiHelper.serialize(body);
        HttpRequest request = getClientInstance().putBody(queryBuilder, headers, null, bodyJson);

        // Invoke the callback before request if its not null
        if (getHttpCallback() != null) {
            getHttpCallback().onBeforeRequest(request);
        }

        return request;
    }

    /**
     * Processes the response for assignTag.
     * @return An object of type boolean
     */
    private Boolean handleAssignTagResponse(
            HttpContext context) throws ApiException, IOException {
        HttpResponse response = context.getResponse();

        //invoke the callback after response if its not null
        if (getHttpCallback() != null) {
            getHttpCallback().onAfterResponse(context);
        }

        //Error handling using HTTP status codes
        int responseCode = response.getStatusCode();

        if (responseCode == 500) {
            throw new ErrorResponseException("Operation failed or unauthorized request", context);
        }
        //handle errors defined at the API level
        validateResponse(response, context);

        //extract result from the http response
        String responseBody = ((HttpStringResponse) response).getBody();
        boolean result = Boolean.parseBoolean(responseBody);

        return result;
    }

    /**
     * To programmatically unassign tags to a metadata object, such as a liveboard, search answer,
     * table, worksheet, or view, use this endpoint. At least one of id or name of tag is required.
     * When both are given, then id will be considered.
     * @param  body  Required parameter: Example:
     * @return    Returns the Boolean response from the API call
     * @throws    ApiException    Represents error response from the server.
     * @throws    IOException    Signals that an I/O exception of some sort has occurred.
     */
    public Boolean unassignTag(
            final TspublicRestV2MetadataTagUnassignRequest body) throws ApiException, IOException {
        HttpRequest request = buildUnassignTagRequest(body);
        authManagers.get("global").apply(request);

        HttpResponse response = getClientInstance().execute(request, false);
        HttpContext context = new HttpContext(request, response);

        return handleUnassignTagResponse(context);
    }

    /**
     * To programmatically unassign tags to a metadata object, such as a liveboard, search answer,
     * table, worksheet, or view, use this endpoint. At least one of id or name of tag is required.
     * When both are given, then id will be considered.
     * @param  body  Required parameter: Example:
     * @return    Returns the Boolean response from the API call
     */
    public CompletableFuture unassignTagAsync(
            final TspublicRestV2MetadataTagUnassignRequest body) {
        return makeHttpCallAsync(() -> buildUnassignTagRequest(body),
            req -> authManagers.get("global").applyAsync(req)
                .thenCompose(request -> getClientInstance()
                        .executeAsync(request, false)),
            context -> handleUnassignTagResponse(context));
    }

    /**
     * Builds the HttpRequest object for unassignTag.
     */
    private HttpRequest buildUnassignTagRequest(
            final TspublicRestV2MetadataTagUnassignRequest body) throws JsonProcessingException {
        //validating required parameters
        if (null == body) {
            throw new NullPointerException("The parameter \"body\" is a required parameter and cannot be null.");
        }

        //the base uri for api requests
        String baseUri = config.getBaseUri();

        //prepare query string for API call
        final StringBuilder queryBuilder = new StringBuilder(baseUri
                + "/tspublic/rest/v2/metadata/tag/unassign");

        //load all headers for the outgoing API request
        Headers headers = new Headers();
        headers.add("Content-Type", "application/json");
        headers.add("X-Requested-By", config.getXRequestedBy());
        headers.add("Accept-Language", config.getAcceptLanguage());
        headers.add("user-agent", BaseController.userAgent);

        //prepare and invoke the API call request to fetch the response
        String bodyJson = ApiHelper.serialize(body);
        HttpRequest request = getClientInstance().putBody(queryBuilder, headers, null, bodyJson);

        // Invoke the callback before request if its not null
        if (getHttpCallback() != null) {
            getHttpCallback().onBeforeRequest(request);
        }

        return request;
    }

    /**
     * Processes the response for unassignTag.
     * @return An object of type boolean
     */
    private Boolean handleUnassignTagResponse(
            HttpContext context) throws ApiException, IOException {
        HttpResponse response = context.getResponse();

        //invoke the callback after response if its not null
        if (getHttpCallback() != null) {
            getHttpCallback().onAfterResponse(context);
        }

        //Error handling using HTTP status codes
        int responseCode = response.getStatusCode();

        if (responseCode == 500) {
            throw new ErrorResponseException("Operation failed or unauthorized request", context);
        }
        //handle errors defined at the API level
        validateResponse(response, context);

        //extract result from the http response
        String responseBody = ((HttpStringResponse) response).getBody();
        boolean result = Boolean.parseBoolean(responseBody);

        return result;
    }

    /**
     * To programmatically assign objects to favorites for a given user account, use this endpoint.
     * At least one of user id or username is required. When both are given, then id will be
     * considered.
     * @param  body  Required parameter: Example:
     * @return    Returns the Boolean response from the API call
     * @throws    ApiException    Represents error response from the server.
     * @throws    IOException    Signals that an I/O exception of some sort has occurred.
     */
    public Boolean assignFavorite(
            final TspublicRestV2MetadataFavoriteAssignRequest body) throws ApiException, IOException {
        HttpRequest request = buildAssignFavoriteRequest(body);
        authManagers.get("global").apply(request);

        HttpResponse response = getClientInstance().execute(request, false);
        HttpContext context = new HttpContext(request, response);

        return handleAssignFavoriteResponse(context);
    }

    /**
     * To programmatically assign objects to favorites for a given user account, use this endpoint.
     * At least one of user id or username is required. When both are given, then id will be
     * considered.
     * @param  body  Required parameter: Example:
     * @return    Returns the Boolean response from the API call
     */
    public CompletableFuture assignFavoriteAsync(
            final TspublicRestV2MetadataFavoriteAssignRequest body) {
        return makeHttpCallAsync(() -> buildAssignFavoriteRequest(body),
            req -> authManagers.get("global").applyAsync(req)
                .thenCompose(request -> getClientInstance()
                        .executeAsync(request, false)),
            context -> handleAssignFavoriteResponse(context));
    }

    /**
     * Builds the HttpRequest object for assignFavorite.
     */
    private HttpRequest buildAssignFavoriteRequest(
            final TspublicRestV2MetadataFavoriteAssignRequest body) throws JsonProcessingException {
        //validating required parameters
        if (null == body) {
            throw new NullPointerException("The parameter \"body\" is a required parameter and cannot be null.");
        }

        //the base uri for api requests
        String baseUri = config.getBaseUri();

        //prepare query string for API call
        final StringBuilder queryBuilder = new StringBuilder(baseUri
                + "/tspublic/rest/v2/metadata/favorite/assign");

        //load all headers for the outgoing API request
        Headers headers = new Headers();
        headers.add("Content-Type", "application/json");
        headers.add("X-Requested-By", config.getXRequestedBy());
        headers.add("Accept-Language", config.getAcceptLanguage());
        headers.add("user-agent", BaseController.userAgent);

        //prepare and invoke the API call request to fetch the response
        String bodyJson = ApiHelper.serialize(body);
        HttpRequest request = getClientInstance().putBody(queryBuilder, headers, null, bodyJson);

        // Invoke the callback before request if its not null
        if (getHttpCallback() != null) {
            getHttpCallback().onBeforeRequest(request);
        }

        return request;
    }

    /**
     * Processes the response for assignFavorite.
     * @return An object of type boolean
     */
    private Boolean handleAssignFavoriteResponse(
            HttpContext context) throws ApiException, IOException {
        HttpResponse response = context.getResponse();

        //invoke the callback after response if its not null
        if (getHttpCallback() != null) {
            getHttpCallback().onAfterResponse(context);
        }

        //Error handling using HTTP status codes
        int responseCode = response.getStatusCode();

        if (responseCode == 500) {
            throw new ErrorResponseException("Operation failed or unauthorized request", context);
        }
        //handle errors defined at the API level
        validateResponse(response, context);

        //extract result from the http response
        String responseBody = ((HttpStringResponse) response).getBody();
        boolean result = Boolean.parseBoolean(responseBody);

        return result;
    }

    /**
     * To programmatically unassign objects to favorites for a given user account, use this
     * endpoint. At least one of user id or username is required. When both are given, then id will
     * be considered. Screen reader support enabled.
     * @param  body  Required parameter: Example:
     * @return    Returns the Boolean response from the API call
     * @throws    ApiException    Represents error response from the server.
     * @throws    IOException    Signals that an I/O exception of some sort has occurred.
     */
    public Boolean unassignFavorite(
            final TspublicRestV2MetadataFavoriteUnassignRequest body) throws ApiException, IOException {
        HttpRequest request = buildUnassignFavoriteRequest(body);
        authManagers.get("global").apply(request);

        HttpResponse response = getClientInstance().execute(request, false);
        HttpContext context = new HttpContext(request, response);

        return handleUnassignFavoriteResponse(context);
    }

    /**
     * To programmatically unassign objects to favorites for a given user account, use this
     * endpoint. At least one of user id or username is required. When both are given, then id will
     * be considered. Screen reader support enabled.
     * @param  body  Required parameter: Example:
     * @return    Returns the Boolean response from the API call
     */
    public CompletableFuture unassignFavoriteAsync(
            final TspublicRestV2MetadataFavoriteUnassignRequest body) {
        return makeHttpCallAsync(() -> buildUnassignFavoriteRequest(body),
            req -> authManagers.get("global").applyAsync(req)
                .thenCompose(request -> getClientInstance()
                        .executeAsync(request, false)),
            context -> handleUnassignFavoriteResponse(context));
    }

    /**
     * Builds the HttpRequest object for unassignFavorite.
     */
    private HttpRequest buildUnassignFavoriteRequest(
            final TspublicRestV2MetadataFavoriteUnassignRequest body) throws JsonProcessingException {
        //validating required parameters
        if (null == body) {
            throw new NullPointerException("The parameter \"body\" is a required parameter and cannot be null.");
        }

        //the base uri for api requests
        String baseUri = config.getBaseUri();

        //prepare query string for API call
        final StringBuilder queryBuilder = new StringBuilder(baseUri
                + "/tspublic/rest/v2/metadata/favorite/unassign");

        //load all headers for the outgoing API request
        Headers headers = new Headers();
        headers.add("Content-Type", "application/json");
        headers.add("X-Requested-By", config.getXRequestedBy());
        headers.add("Accept-Language", config.getAcceptLanguage());
        headers.add("user-agent", BaseController.userAgent);

        //prepare and invoke the API call request to fetch the response
        String bodyJson = ApiHelper.serialize(body);
        HttpRequest request = getClientInstance().putBody(queryBuilder, headers, null, bodyJson);

        // Invoke the callback before request if its not null
        if (getHttpCallback() != null) {
            getHttpCallback().onBeforeRequest(request);
        }

        return request;
    }

    /**
     * Processes the response for unassignFavorite.
     * @return An object of type boolean
     */
    private Boolean handleUnassignFavoriteResponse(
            HttpContext context) throws ApiException, IOException {
        HttpResponse response = context.getResponse();

        //invoke the callback after response if its not null
        if (getHttpCallback() != null) {
            getHttpCallback().onAfterResponse(context);
        }

        //Error handling using HTTP status codes
        int responseCode = response.getStatusCode();

        if (responseCode == 500) {
            throw new ErrorResponseException("Operation failed or unauthorized request", context);
        }
        //handle errors defined at the API level
        validateResponse(response, context);

        //extract result from the http response
        String responseBody = ((HttpStringResponse) response).getBody();
        boolean result = Boolean.parseBoolean(responseBody);

        return result;
    }

    /**
     * To get the name and id of liveboard that is set as a home liveboard for a user, use this
     * endpoint. At least one of user id or username is required. When both are given, then id will
     * be considered.
     * @param  userName  Optional parameter: Example:
     * @param  userId  Optional parameter: The GUID of the user
     * @return    Returns the HomeLiveboardResponse response from the API call
     * @throws    ApiException    Represents error response from the server.
     * @throws    IOException    Signals that an I/O exception of some sort has occurred.
     */
    public HomeLiveboardResponse getHomeLiveboard(
            final String userName,
            final String userId) throws ApiException, IOException {
        HttpRequest request = buildGetHomeLiveboardRequest(userName, userId);
        authManagers.get("global").apply(request);

        HttpResponse response = getClientInstance().execute(request, false);
        HttpContext context = new HttpContext(request, response);

        return handleGetHomeLiveboardResponse(context);
    }

    /**
     * To get the name and id of liveboard that is set as a home liveboard for a user, use this
     * endpoint. At least one of user id or username is required. When both are given, then id will
     * be considered.
     * @param  userName  Optional parameter: Example:
     * @param  userId  Optional parameter: The GUID of the user
     * @return    Returns the HomeLiveboardResponse response from the API call
     */
    public CompletableFuture getHomeLiveboardAsync(
            final String userName,
            final String userId) {
        return makeHttpCallAsync(() -> buildGetHomeLiveboardRequest(userName, userId),
            req -> authManagers.get("global").applyAsync(req)
                .thenCompose(request -> getClientInstance()
                        .executeAsync(request, false)),
            context -> handleGetHomeLiveboardResponse(context));
    }

    /**
     * Builds the HttpRequest object for getHomeLiveboard.
     */
    private HttpRequest buildGetHomeLiveboardRequest(
            final String userName,
            final String userId) {
        //the base uri for api requests
        String baseUri = config.getBaseUri();

        //prepare query string for API call
        final StringBuilder queryBuilder = new StringBuilder(baseUri
                + "/tspublic/rest/v2/metadata/homeliveboard");

        //load all query parameters
        Map queryParameters = new HashMap<>();
        queryParameters.put("userName", userName);
        queryParameters.put("userId", userId);

        //load all headers for the outgoing API request
        Headers headers = new Headers();
        headers.add("X-Requested-By", config.getXRequestedBy());
        headers.add("Accept-Language", config.getAcceptLanguage());
        headers.add("Content-Type", config.getContentType());
        headers.add("user-agent", BaseController.userAgent);
        headers.add("accept", "application/json");

        //prepare and invoke the API call request to fetch the response
        HttpRequest request = getClientInstance().get(queryBuilder, headers, queryParameters,
                null);

        // Invoke the callback before request if its not null
        if (getHttpCallback() != null) {
            getHttpCallback().onBeforeRequest(request);
        }

        return request;
    }

    /**
     * Processes the response for getHomeLiveboard.
     * @return An object of type HomeLiveboardResponse
     */
    private HomeLiveboardResponse handleGetHomeLiveboardResponse(
            HttpContext context) throws ApiException, IOException {
        HttpResponse response = context.getResponse();

        //invoke the callback after response if its not null
        if (getHttpCallback() != null) {
            getHttpCallback().onAfterResponse(context);
        }

        //Error handling using HTTP status codes
        int responseCode = response.getStatusCode();

        if (responseCode == 500) {
            throw new ErrorResponseException("Operation failed or unauthorized request", context);
        }
        //handle errors defined at the API level
        validateResponse(response, context);

        //extract result from the http response
        String responseBody = ((HttpStringResponse) response).getBody();
        HomeLiveboardResponse result = ApiHelper.deserialize(responseBody,
                HomeLiveboardResponse.class);

        return result;
    }

    /**
     * To assign a specific liveboard as a home liveboard for a user, use this endpoint. At least
     * one of user id or username is required. When both are given, then id will be considered.
     * @param  body  Required parameter: Example:
     * @return    Returns the Boolean response from the API call
     * @throws    ApiException    Represents error response from the server.
     * @throws    IOException    Signals that an I/O exception of some sort has occurred.
     */
    public Boolean assignHomeLiveboard(
            final TspublicRestV2MetadataHomeliveboardAssignRequest body) throws ApiException, IOException {
        HttpRequest request = buildAssignHomeLiveboardRequest(body);
        authManagers.get("global").apply(request);

        HttpResponse response = getClientInstance().execute(request, false);
        HttpContext context = new HttpContext(request, response);

        return handleAssignHomeLiveboardResponse(context);
    }

    /**
     * To assign a specific liveboard as a home liveboard for a user, use this endpoint. At least
     * one of user id or username is required. When both are given, then id will be considered.
     * @param  body  Required parameter: Example:
     * @return    Returns the Boolean response from the API call
     */
    public CompletableFuture assignHomeLiveboardAsync(
            final TspublicRestV2MetadataHomeliveboardAssignRequest body) {
        return makeHttpCallAsync(() -> buildAssignHomeLiveboardRequest(body),
            req -> authManagers.get("global").applyAsync(req)
                .thenCompose(request -> getClientInstance()
                        .executeAsync(request, false)),
            context -> handleAssignHomeLiveboardResponse(context));
    }

    /**
     * Builds the HttpRequest object for assignHomeLiveboard.
     */
    private HttpRequest buildAssignHomeLiveboardRequest(
            final TspublicRestV2MetadataHomeliveboardAssignRequest body) throws JsonProcessingException {
        //validating required parameters
        if (null == body) {
            throw new NullPointerException("The parameter \"body\" is a required parameter and cannot be null.");
        }

        //the base uri for api requests
        String baseUri = config.getBaseUri();

        //prepare query string for API call
        final StringBuilder queryBuilder = new StringBuilder(baseUri
                + "/tspublic/rest/v2/metadata/homeliveboard/assign");

        //load all headers for the outgoing API request
        Headers headers = new Headers();
        headers.add("Content-Type", "application/json");
        headers.add("X-Requested-By", config.getXRequestedBy());
        headers.add("Accept-Language", config.getAcceptLanguage());
        headers.add("user-agent", BaseController.userAgent);

        //prepare and invoke the API call request to fetch the response
        String bodyJson = ApiHelper.serialize(body);
        HttpRequest request = getClientInstance().putBody(queryBuilder, headers, null, bodyJson);

        // Invoke the callback before request if its not null
        if (getHttpCallback() != null) {
            getHttpCallback().onBeforeRequest(request);
        }

        return request;
    }

    /**
     * Processes the response for assignHomeLiveboard.
     * @return An object of type boolean
     */
    private Boolean handleAssignHomeLiveboardResponse(
            HttpContext context) throws ApiException, IOException {
        HttpResponse response = context.getResponse();

        //invoke the callback after response if its not null
        if (getHttpCallback() != null) {
            getHttpCallback().onAfterResponse(context);
        }

        //Error handling using HTTP status codes
        int responseCode = response.getStatusCode();

        if (responseCode == 500) {
            throw new ErrorResponseException("Operation failed or unauthorized request", context);
        }
        //handle errors defined at the API level
        validateResponse(response, context);

        //extract result from the http response
        String responseBody = ((HttpStringResponse) response).getBody();
        boolean result = Boolean.parseBoolean(responseBody);

        return result;
    }

    /**
     * To unassign the home liveboard set for a user, use this endpoint. At least one of user id or
     * username is required. When both are given, then id will be considered.
     * @param  body  Required parameter: Example:
     * @return    Returns the Boolean response from the API call
     * @throws    ApiException    Represents error response from the server.
     * @throws    IOException    Signals that an I/O exception of some sort has occurred.
     */
    public Boolean unassignHomeLiveboard(
            final TspublicRestV2MetadataHomeliveboardUnassignRequest body) throws ApiException, IOException {
        HttpRequest request = buildUnassignHomeLiveboardRequest(body);
        authManagers.get("global").apply(request);

        HttpResponse response = getClientInstance().execute(request, false);
        HttpContext context = new HttpContext(request, response);

        return handleUnassignHomeLiveboardResponse(context);
    }

    /**
     * To unassign the home liveboard set for a user, use this endpoint. At least one of user id or
     * username is required. When both are given, then id will be considered.
     * @param  body  Required parameter: Example:
     * @return    Returns the Boolean response from the API call
     */
    public CompletableFuture unassignHomeLiveboardAsync(
            final TspublicRestV2MetadataHomeliveboardUnassignRequest body) {
        return makeHttpCallAsync(() -> buildUnassignHomeLiveboardRequest(body),
            req -> authManagers.get("global").applyAsync(req)
                .thenCompose(request -> getClientInstance()
                        .executeAsync(request, false)),
            context -> handleUnassignHomeLiveboardResponse(context));
    }

    /**
     * Builds the HttpRequest object for unassignHomeLiveboard.
     */
    private HttpRequest buildUnassignHomeLiveboardRequest(
            final TspublicRestV2MetadataHomeliveboardUnassignRequest body) throws JsonProcessingException {
        //validating required parameters
        if (null == body) {
            throw new NullPointerException("The parameter \"body\" is a required parameter and cannot be null.");
        }

        //the base uri for api requests
        String baseUri = config.getBaseUri();

        //prepare query string for API call
        final StringBuilder queryBuilder = new StringBuilder(baseUri
                + "/tspublic/rest/v2/metadata/homeliveboard/unassign");

        //load all headers for the outgoing API request
        Headers headers = new Headers();
        headers.add("Content-Type", "application/json");
        headers.add("X-Requested-By", config.getXRequestedBy());
        headers.add("Accept-Language", config.getAcceptLanguage());
        headers.add("user-agent", BaseController.userAgent);

        //prepare and invoke the API call request to fetch the response
        String bodyJson = ApiHelper.serialize(body);
        HttpRequest request = getClientInstance().putBody(queryBuilder, headers, null, bodyJson);

        // Invoke the callback before request if its not null
        if (getHttpCallback() != null) {
            getHttpCallback().onBeforeRequest(request);
        }

        return request;
    }

    /**
     * Processes the response for unassignHomeLiveboard.
     * @return An object of type boolean
     */
    private Boolean handleUnassignHomeLiveboardResponse(
            HttpContext context) throws ApiException, IOException {
        HttpResponse response = context.getResponse();

        //invoke the callback after response if its not null
        if (getHttpCallback() != null) {
            getHttpCallback().onAfterResponse(context);
        }

        //Error handling using HTTP status codes
        int responseCode = response.getStatusCode();

        if (responseCode == 500) {
            throw new ErrorResponseException("Operation failed or unauthorized request", context);
        }
        //handle errors defined at the API level
        validateResponse(response, context);

        //extract result from the http response
        String responseBody = ((HttpStringResponse) response).getBody();
        boolean result = Boolean.parseBoolean(responseBody);

        return result;
    }

    /**
     * To get a list of objects with incomplete metadata, use this endpoint.
     * @return    Returns the Object response from the API call
     * @throws    ApiException    Represents error response from the server.
     * @throws    IOException    Signals that an I/O exception of some sort has occurred.
     */
    public Object getIncompleteObjects() throws ApiException, IOException {
        HttpRequest request = buildGetIncompleteObjectsRequest();
        authManagers.get("global").apply(request);

        HttpResponse response = getClientInstance().execute(request, false);
        HttpContext context = new HttpContext(request, response);

        return handleGetIncompleteObjectsResponse(context);
    }

    /**
     * To get a list of objects with incomplete metadata, use this endpoint.
     * @return    Returns the Object response from the API call
     */
    public CompletableFuture getIncompleteObjectsAsync() {
        return makeHttpCallAsync(() -> buildGetIncompleteObjectsRequest(),
            req -> authManagers.get("global").applyAsync(req)
                .thenCompose(request -> getClientInstance()
                        .executeAsync(request, false)),
            context -> handleGetIncompleteObjectsResponse(context));
    }

    /**
     * Builds the HttpRequest object for getIncompleteObjects.
     */
    private HttpRequest buildGetIncompleteObjectsRequest() {
        //the base uri for api requests
        String baseUri = config.getBaseUri();

        //prepare query string for API call
        final StringBuilder queryBuilder = new StringBuilder(baseUri
                + "/tspublic/rest/v2/metadata/incomplete");

        //load all headers for the outgoing API request
        Headers headers = new Headers();
        headers.add("X-Requested-By", config.getXRequestedBy());
        headers.add("Accept-Language", config.getAcceptLanguage());
        headers.add("Content-Type", config.getContentType());
        headers.add("user-agent", BaseController.userAgent);

        //prepare and invoke the API call request to fetch the response
        HttpRequest request = getClientInstance().get(queryBuilder, headers, null, null);

        // Invoke the callback before request if its not null
        if (getHttpCallback() != null) {
            getHttpCallback().onBeforeRequest(request);
        }

        return request;
    }

    /**
     * Processes the response for getIncompleteObjects.
     * @return An object of type Object
     */
    private Object handleGetIncompleteObjectsResponse(
            HttpContext context) throws ApiException, IOException {
        HttpResponse response = context.getResponse();

        //invoke the callback after response if its not null
        if (getHttpCallback() != null) {
            getHttpCallback().onAfterResponse(context);
        }

        //Error handling using HTTP status codes
        int responseCode = response.getStatusCode();

        if (responseCode == 500) {
            throw new ErrorResponseException("Operation failed or unauthorized request", context);
        }
        //handle errors defined at the API level
        validateResponse(response, context);

        //extract result from the http response
        String responseBody = ((HttpStringResponse) response).getBody();
        Object result = responseBody;

        return result;
    }

    /**
     * To get header detail of a metadata object, use this endpoint. You can provide as input
     * selective fields to get the data for.
     * @param  type  Required parameter: Type of the metadata object being searched.
     * @param  id  Required parameter: GUID of the metadata object
     * @param  outputFields  Optional parameter: Array of header field names that need to be
     *         included in the header response
     * @return    Returns the Object response from the API call
     * @throws    ApiException    Represents error response from the server.
     * @throws    IOException    Signals that an I/O exception of some sort has occurred.
     */
    public Object getObjectHeader(
            final Type8Enum type,
            final String id,
            final List outputFields) throws ApiException, IOException {
        HttpRequest request = buildGetObjectHeaderRequest(type, id, outputFields);
        authManagers.get("global").apply(request);

        HttpResponse response = getClientInstance().execute(request, false);
        HttpContext context = new HttpContext(request, response);

        return handleGetObjectHeaderResponse(context);
    }

    /**
     * To get header detail of a metadata object, use this endpoint. You can provide as input
     * selective fields to get the data for.
     * @param  type  Required parameter: Type of the metadata object being searched.
     * @param  id  Required parameter: GUID of the metadata object
     * @param  outputFields  Optional parameter: Array of header field names that need to be
     *         included in the header response
     * @return    Returns the Object response from the API call
     */
    public CompletableFuture getObjectHeaderAsync(
            final Type8Enum type,
            final String id,
            final List outputFields) {
        return makeHttpCallAsync(() -> buildGetObjectHeaderRequest(type, id, outputFields),
            req -> authManagers.get("global").applyAsync(req)
                .thenCompose(request -> getClientInstance()
                        .executeAsync(request, false)),
            context -> handleGetObjectHeaderResponse(context));
    }

    /**
     * Builds the HttpRequest object for getObjectHeader.
     */
    private HttpRequest buildGetObjectHeaderRequest(
            final Type8Enum type,
            final String id,
            final List outputFields) {
        //validating required parameters
        if (null == type) {
            throw new NullPointerException("The parameter \"type\" is a required parameter and cannot be null.");
        }

        if (null == id) {
            throw new NullPointerException("The parameter \"id\" is a required parameter and cannot be null.");
        }

        //the base uri for api requests
        String baseUri = config.getBaseUri();

        //prepare query string for API call
        final StringBuilder queryBuilder = new StringBuilder(baseUri
                + "/tspublic/rest/v2/metadata/header");

        //load all query parameters
        Map queryParameters = new HashMap<>();
        queryParameters.put("type",
                (type != null) ? type.value() : null);
        queryParameters.put("id", id);
        queryParameters.put("outputFields", outputFields);

        //load all headers for the outgoing API request
        Headers headers = new Headers();
        headers.add("X-Requested-By", config.getXRequestedBy());
        headers.add("Accept-Language", config.getAcceptLanguage());
        headers.add("Content-Type", config.getContentType());
        headers.add("user-agent", BaseController.userAgent);

        //prepare and invoke the API call request to fetch the response
        HttpRequest request = getClientInstance().get(queryBuilder, headers, queryParameters,
                null);

        // Invoke the callback before request if its not null
        if (getHttpCallback() != null) {
            getHttpCallback().onBeforeRequest(request);
        }

        return request;
    }

    /**
     * Processes the response for getObjectHeader.
     * @return An object of type Object
     */
    private Object handleGetObjectHeaderResponse(
            HttpContext context) throws ApiException, IOException {
        HttpResponse response = context.getResponse();

        //invoke the callback after response if its not null
        if (getHttpCallback() != null) {
            getHttpCallback().onAfterResponse(context);
        }

        //Error handling using HTTP status codes
        int responseCode = response.getStatusCode();

        if (responseCode == 500) {
            throw new ErrorResponseException("Operation failed or unauthorized request", context);
        }
        //handle errors defined at the API level
        validateResponse(response, context);

        //extract result from the http response
        String responseBody = ((HttpStringResponse) response).getBody();
        Object result = responseBody;

        return result;
    }

    /**
     * Use this endpoint to get full details of metadata objects.
     * @param  type  Required parameter: Type of the metadata object being searched. Valid values
     * @param  id  Required parameter: A JSON array of GUIDs of the objects.
     * @return    Returns the Object response from the API call
     * @throws    ApiException    Represents error response from the server.
     * @throws    IOException    Signals that an I/O exception of some sort has occurred.
     */
    public Object getObjectDetail(
            final Type9Enum type,
            final List id) throws ApiException, IOException {
        HttpRequest request = buildGetObjectDetailRequest(type, id);
        authManagers.get("global").apply(request);

        HttpResponse response = getClientInstance().execute(request, false);
        HttpContext context = new HttpContext(request, response);

        return handleGetObjectDetailResponse(context);
    }

    /**
     * Use this endpoint to get full details of metadata objects.
     * @param  type  Required parameter: Type of the metadata object being searched. Valid values
     * @param  id  Required parameter: A JSON array of GUIDs of the objects.
     * @return    Returns the Object response from the API call
     */
    public CompletableFuture getObjectDetailAsync(
            final Type9Enum type,
            final List id) {
        return makeHttpCallAsync(() -> buildGetObjectDetailRequest(type, id),
            req -> authManagers.get("global").applyAsync(req)
                .thenCompose(request -> getClientInstance()
                        .executeAsync(request, false)),
            context -> handleGetObjectDetailResponse(context));
    }

    /**
     * Builds the HttpRequest object for getObjectDetail.
     */
    private HttpRequest buildGetObjectDetailRequest(
            final Type9Enum type,
            final List id) {
        //validating required parameters
        if (null == type) {
            throw new NullPointerException("The parameter \"type\" is a required parameter and cannot be null.");
        }

        if (null == id) {
            throw new NullPointerException("The parameter \"id\" is a required parameter and cannot be null.");
        }

        //the base uri for api requests
        String baseUri = config.getBaseUri();

        //prepare query string for API call
        final StringBuilder queryBuilder = new StringBuilder(baseUri
                + "/tspublic/rest/v2/metadata/detail");

        //load all query parameters
        Map queryParameters = new HashMap<>();
        queryParameters.put("type",
                (type != null) ? type.value() : null);
        queryParameters.put("id", id);

        //load all headers for the outgoing API request
        Headers headers = new Headers();
        headers.add("X-Requested-By", config.getXRequestedBy());
        headers.add("Accept-Language", config.getAcceptLanguage());
        headers.add("Content-Type", config.getContentType());
        headers.add("user-agent", BaseController.userAgent);

        //prepare and invoke the API call request to fetch the response
        HttpRequest request = getClientInstance().get(queryBuilder, headers, queryParameters,
                null);

        // Invoke the callback before request if its not null
        if (getHttpCallback() != null) {
            getHttpCallback().onBeforeRequest(request);
        }

        return request;
    }

    /**
     * Processes the response for getObjectDetail.
     * @return An object of type Object
     */
    private Object handleGetObjectDetailResponse(
            HttpContext context) throws ApiException, IOException {
        HttpResponse response = context.getResponse();

        //invoke the callback after response if its not null
        if (getHttpCallback() != null) {
            getHttpCallback().onAfterResponse(context);
        }

        //Error handling using HTTP status codes
        int responseCode = response.getStatusCode();

        if (responseCode == 500) {
            throw new ErrorResponseException("Operation failed or unauthorized request", context);
        }
        //handle errors defined at the API level
        validateResponse(response, context);

        //extract result from the http response
        String responseBody = ((HttpStringResponse) response).getBody();
        Object result = responseBody;

        return result;
    }

    /**
     * Use this endpoint to get header details of visualization charts for a given liveboard or
     * answer. At least one of id or name of liveboard or answer is required. When both are given,
     * then id will be considered.
     * @param  id  Required parameter: The GUID of the liveboard or answer
     * @return    Returns the List of Object response from the API call
     * @throws    ApiException    Represents error response from the server.
     * @throws    IOException    Signals that an I/O exception of some sort has occurred.
     */
    public List getObjectVisualizationHeader(
            final String id) throws ApiException, IOException {
        HttpRequest request = buildGetObjectVisualizationHeaderRequest(id);
        authManagers.get("global").apply(request);

        HttpResponse response = getClientInstance().execute(request, false);
        HttpContext context = new HttpContext(request, response);

        return handleGetObjectVisualizationHeaderResponse(context);
    }

    /**
     * Use this endpoint to get header details of visualization charts for a given liveboard or
     * answer. At least one of id or name of liveboard or answer is required. When both are given,
     * then id will be considered.
     * @param  id  Required parameter: The GUID of the liveboard or answer
     * @return    Returns the List of Object response from the API call
     */
    public CompletableFuture> getObjectVisualizationHeaderAsync(
            final String id) {
        return makeHttpCallAsync(() -> buildGetObjectVisualizationHeaderRequest(id),
            req -> authManagers.get("global").applyAsync(req)
                .thenCompose(request -> getClientInstance()
                        .executeAsync(request, false)),
            context -> handleGetObjectVisualizationHeaderResponse(context));
    }

    /**
     * Builds the HttpRequest object for getObjectVisualizationHeader.
     */
    private HttpRequest buildGetObjectVisualizationHeaderRequest(
            final String id) {
        //validating required parameters
        if (null == id) {
            throw new NullPointerException("The parameter \"id\" is a required parameter and cannot be null.");
        }

        //the base uri for api requests
        String baseUri = config.getBaseUri();

        //prepare query string for API call
        final StringBuilder queryBuilder = new StringBuilder(baseUri
                + "/tspublic/rest/v2/metadata/vizheader");

        //load all query parameters
        Map queryParameters = new HashMap<>();
        queryParameters.put("id", id);

        //load all headers for the outgoing API request
        Headers headers = new Headers();
        headers.add("X-Requested-By", config.getXRequestedBy());
        headers.add("Accept-Language", config.getAcceptLanguage());
        headers.add("Content-Type", config.getContentType());
        headers.add("user-agent", BaseController.userAgent);
        headers.add("accept", "application/json");

        //prepare and invoke the API call request to fetch the response
        HttpRequest request = getClientInstance().get(queryBuilder, headers, queryParameters,
                null);

        // Invoke the callback before request if its not null
        if (getHttpCallback() != null) {
            getHttpCallback().onBeforeRequest(request);
        }

        return request;
    }

    /**
     * Processes the response for getObjectVisualizationHeader.
     * @return An object of type List of Object
     */
    private List handleGetObjectVisualizationHeaderResponse(
            HttpContext context) throws ApiException, IOException {
        HttpResponse response = context.getResponse();

        //invoke the callback after response if its not null
        if (getHttpCallback() != null) {
            getHttpCallback().onAfterResponse(context);
        }

        //Error handling using HTTP status codes
        int responseCode = response.getStatusCode();

        if (responseCode == 500) {
            throw new ErrorResponseException("Operation failed or unauthorized request", context);
        }
        //handle errors defined at the API level
        validateResponse(response, context);

        //extract result from the http response
        String responseBody = ((HttpStringResponse) response).getBody();
        List result = ApiHelper.deserializeArray(responseBody,
                Object[].class);

        return result;
    }

    /**
     * To get header details for metadata objects, use this endpoint. You can provide as input
     * selective fields to get the data for.
     * @param  body  Required parameter: Example:
     * @return    Returns the Object response from the API call
     * @throws    ApiException    Represents error response from the server.
     * @throws    IOException    Signals that an I/O exception of some sort has occurred.
     */
    public Object searchObjectHeader(
            final TspublicRestV2MetadataHeaderSearchRequest body) throws ApiException, IOException {
        HttpRequest request = buildSearchObjectHeaderRequest(body);
        authManagers.get("global").apply(request);

        HttpResponse response = getClientInstance().execute(request, false);
        HttpContext context = new HttpContext(request, response);

        return handleSearchObjectHeaderResponse(context);
    }

    /**
     * To get header details for metadata objects, use this endpoint. You can provide as input
     * selective fields to get the data for.
     * @param  body  Required parameter: Example:
     * @return    Returns the Object response from the API call
     */
    public CompletableFuture searchObjectHeaderAsync(
            final TspublicRestV2MetadataHeaderSearchRequest body) {
        return makeHttpCallAsync(() -> buildSearchObjectHeaderRequest(body),
            req -> authManagers.get("global").applyAsync(req)
                .thenCompose(request -> getClientInstance()
                        .executeAsync(request, false)),
            context -> handleSearchObjectHeaderResponse(context));
    }

    /**
     * Builds the HttpRequest object for searchObjectHeader.
     */
    private HttpRequest buildSearchObjectHeaderRequest(
            final TspublicRestV2MetadataHeaderSearchRequest body) throws JsonProcessingException {
        //validating required parameters
        if (null == body) {
            throw new NullPointerException("The parameter \"body\" is a required parameter and cannot be null.");
        }

        //the base uri for api requests
        String baseUri = config.getBaseUri();

        //prepare query string for API call
        final StringBuilder queryBuilder = new StringBuilder(baseUri
                + "/tspublic/rest/v2/metadata/header/search");

        //load all headers for the outgoing API request
        Headers headers = new Headers();
        headers.add("Content-Type", "application/json");
        headers.add("X-Requested-By", config.getXRequestedBy());
        headers.add("Accept-Language", config.getAcceptLanguage());
        headers.add("user-agent", BaseController.userAgent);

        //prepare and invoke the API call request to fetch the response
        String bodyJson = ApiHelper.serialize(body);
        HttpRequest request = getClientInstance().postBody(queryBuilder, headers, null, bodyJson);

        // Invoke the callback before request if its not null
        if (getHttpCallback() != null) {
            getHttpCallback().onBeforeRequest(request);
        }

        return request;
    }

    /**
     * Processes the response for searchObjectHeader.
     * @return An object of type Object
     */
    private Object handleSearchObjectHeaderResponse(
            HttpContext context) throws ApiException, IOException {
        HttpResponse response = context.getResponse();

        //invoke the callback after response if its not null
        if (getHttpCallback() != null) {
            getHttpCallback().onAfterResponse(context);
        }

        //Error handling using HTTP status codes
        int responseCode = response.getStatusCode();

        if (responseCode == 500) {
            throw new ErrorResponseException("Operation failed or unauthorized request", context);
        }
        //handle errors defined at the API level
        validateResponse(response, context);

        //extract result from the http response
        String responseBody = ((HttpStringResponse) response).getBody();
        Object result = responseBody;

        return result;
    }

    /**
     * Use this endpoint to get full details of metadata objects.
     * @param  body  Required parameter: Example:
     * @return    Returns the Object response from the API call
     * @throws    ApiException    Represents error response from the server.
     * @throws    IOException    Signals that an I/O exception of some sort has occurred.
     */
    public Object searchObjectDetail(
            final TspublicRestV2MetadataDetailSearchRequest body) throws ApiException, IOException {
        HttpRequest request = buildSearchObjectDetailRequest(body);
        authManagers.get("global").apply(request);

        HttpResponse response = getClientInstance().execute(request, false);
        HttpContext context = new HttpContext(request, response);

        return handleSearchObjectDetailResponse(context);
    }

    /**
     * Use this endpoint to get full details of metadata objects.
     * @param  body  Required parameter: Example:
     * @return    Returns the Object response from the API call
     */
    public CompletableFuture searchObjectDetailAsync(
            final TspublicRestV2MetadataDetailSearchRequest body) {
        return makeHttpCallAsync(() -> buildSearchObjectDetailRequest(body),
            req -> authManagers.get("global").applyAsync(req)
                .thenCompose(request -> getClientInstance()
                        .executeAsync(request, false)),
            context -> handleSearchObjectDetailResponse(context));
    }

    /**
     * Builds the HttpRequest object for searchObjectDetail.
     */
    private HttpRequest buildSearchObjectDetailRequest(
            final TspublicRestV2MetadataDetailSearchRequest body) throws JsonProcessingException {
        //validating required parameters
        if (null == body) {
            throw new NullPointerException("The parameter \"body\" is a required parameter and cannot be null.");
        }

        //the base uri for api requests
        String baseUri = config.getBaseUri();

        //prepare query string for API call
        final StringBuilder queryBuilder = new StringBuilder(baseUri
                + "/tspublic/rest/v2/metadata/detail/search");

        //load all headers for the outgoing API request
        Headers headers = new Headers();
        headers.add("Content-Type", "application/json");
        headers.add("X-Requested-By", config.getXRequestedBy());
        headers.add("Accept-Language", config.getAcceptLanguage());
        headers.add("user-agent", BaseController.userAgent);

        //prepare and invoke the API call request to fetch the response
        String bodyJson = ApiHelper.serialize(body);
        HttpRequest request = getClientInstance().postBody(queryBuilder, headers, null, bodyJson);

        // Invoke the callback before request if its not null
        if (getHttpCallback() != null) {
            getHttpCallback().onBeforeRequest(request);
        }

        return request;
    }

    /**
     * Processes the response for searchObjectDetail.
     * @return An object of type Object
     */
    private Object handleSearchObjectDetailResponse(
            HttpContext context) throws ApiException, IOException {
        HttpResponse response = context.getResponse();

        //invoke the callback after response if its not null
        if (getHttpCallback() != null) {
            getHttpCallback().onAfterResponse(context);
        }

        //Error handling using HTTP status codes
        int responseCode = response.getStatusCode();

        if (responseCode == 500) {
            throw new ErrorResponseException("Operation failed or unauthorized request", context);
        }
        //handle errors defined at the API level
        validateResponse(response, context);

        //extract result from the http response
        String responseBody = ((HttpStringResponse) response).getBody();
        Object result = responseBody;

        return result;
    }

    /**
     * Use this endpoint to delete the metadata objects.
     * @param  type  Required parameter: Type of the metadata object being searched.
     * @param  id  Required parameter: A JSON array of GUIDs of the objects.
     * @return    Returns the Boolean response from the API call
     * @throws    ApiException    Represents error response from the server.
     * @throws    IOException    Signals that an I/O exception of some sort has occurred.
     */
    public Boolean deleteObject(
            final Type9Enum type,
            final List id) throws ApiException, IOException {
        HttpRequest request = buildDeleteObjectRequest(type, id);
        authManagers.get("global").apply(request);

        HttpResponse response = getClientInstance().execute(request, false);
        HttpContext context = new HttpContext(request, response);

        return handleDeleteObjectResponse(context);
    }

    /**
     * Use this endpoint to delete the metadata objects.
     * @param  type  Required parameter: Type of the metadata object being searched.
     * @param  id  Required parameter: A JSON array of GUIDs of the objects.
     * @return    Returns the Boolean response from the API call
     */
    public CompletableFuture deleteObjectAsync(
            final Type9Enum type,
            final List id) {
        return makeHttpCallAsync(() -> buildDeleteObjectRequest(type, id),
            req -> authManagers.get("global").applyAsync(req)
                .thenCompose(request -> getClientInstance()
                        .executeAsync(request, false)),
            context -> handleDeleteObjectResponse(context));
    }

    /**
     * Builds the HttpRequest object for deleteObject.
     */
    private HttpRequest buildDeleteObjectRequest(
            final Type9Enum type,
            final List id) {
        //validating required parameters
        if (null == type) {
            throw new NullPointerException("The parameter \"type\" is a required parameter and cannot be null.");
        }

        if (null == id) {
            throw new NullPointerException("The parameter \"id\" is a required parameter and cannot be null.");
        }

        //the base uri for api requests
        String baseUri = config.getBaseUri();

        //prepare query string for API call
        final StringBuilder queryBuilder = new StringBuilder(baseUri
                + "/tspublic/rest/v2/metadata/delete");

        //load all query parameters
        Map queryParameters = new HashMap<>();
        queryParameters.put("type",
                (type != null) ? type.value() : null);
        queryParameters.put("id", id);

        //load all headers for the outgoing API request
        Headers headers = new Headers();
        headers.add("X-Requested-By", config.getXRequestedBy());
        headers.add("Accept-Language", config.getAcceptLanguage());
        headers.add("Content-Type", config.getContentType());
        headers.add("user-agent", BaseController.userAgent);

        //prepare and invoke the API call request to fetch the response
        HttpRequest request = getClientInstance().delete(queryBuilder, headers, queryParameters,
                null);

        // Invoke the callback before request if its not null
        if (getHttpCallback() != null) {
            getHttpCallback().onBeforeRequest(request);
        }

        return request;
    }

    /**
     * Processes the response for deleteObject.
     * @return An object of type boolean
     */
    private Boolean handleDeleteObjectResponse(
            HttpContext context) throws ApiException, IOException {
        HttpResponse response = context.getResponse();

        //invoke the callback after response if its not null
        if (getHttpCallback() != null) {
            getHttpCallback().onAfterResponse(context);
        }

        //Error handling using HTTP status codes
        int responseCode = response.getStatusCode();

        if (responseCode == 500) {
            throw new ErrorResponseException("Operation failed or unauthorized request", context);
        }
        //handle errors defined at the API level
        validateResponse(response, context);

        //extract result from the http response
        String responseBody = ((HttpStringResponse) response).getBody();
        boolean result = Boolean.parseBoolean(responseBody);

        return result;
    }

    /**
     * To query the details of dependent objects and associate objects as dependents, you can use
     * this API. Dependency is defined as relation between referenced and referencing objects. A
     * referencing object is said to have a dependency on a referenced object, if the referenced
     * object cannot be deleted without first deleting the referencing object. Example: Consider a
     * worksheet W1 that has a derived logical column C1 that has a reference to a base logical
     * column C2. This can be shown diagramatically as: W1-->C1-->C2. W1 has a dependency on C2 i.e.
     * W1 is a referencing object and C2 is a referenced object. It is not possible to delete C2
     * without first deleting W1 because deletion of C2 will be prevented by the relationship
     * between W1s column C1 and C2. Similarly C1 is said to have a dependency on C2 i.e. C1 is a
     * referencing object and C2 is a referenced object. It is not possible to delete C2 without
     * first deleting C1.
     * @param  body  Required parameter: Example:
     * @return    Returns the Object response from the API call
     * @throws    ApiException    Represents error response from the server.
     * @throws    IOException    Signals that an I/O exception of some sort has occurred.
     */
    public Object getObjectDependency(
            final TspublicRestV2MetadataDependencyRequest body) throws ApiException, IOException {
        HttpRequest request = buildGetObjectDependencyRequest(body);
        authManagers.get("global").apply(request);

        HttpResponse response = getClientInstance().execute(request, false);
        HttpContext context = new HttpContext(request, response);

        return handleGetObjectDependencyResponse(context);
    }

    /**
     * To query the details of dependent objects and associate objects as dependents, you can use
     * this API. Dependency is defined as relation between referenced and referencing objects. A
     * referencing object is said to have a dependency on a referenced object, if the referenced
     * object cannot be deleted without first deleting the referencing object. Example: Consider a
     * worksheet W1 that has a derived logical column C1 that has a reference to a base logical
     * column C2. This can be shown diagramatically as: W1-->C1-->C2. W1 has a dependency on C2 i.e.
     * W1 is a referencing object and C2 is a referenced object. It is not possible to delete C2
     * without first deleting W1 because deletion of C2 will be prevented by the relationship
     * between W1s column C1 and C2. Similarly C1 is said to have a dependency on C2 i.e. C1 is a
     * referencing object and C2 is a referenced object. It is not possible to delete C2 without
     * first deleting C1.
     * @param  body  Required parameter: Example:
     * @return    Returns the Object response from the API call
     */
    public CompletableFuture getObjectDependencyAsync(
            final TspublicRestV2MetadataDependencyRequest body) {
        return makeHttpCallAsync(() -> buildGetObjectDependencyRequest(body),
            req -> authManagers.get("global").applyAsync(req)
                .thenCompose(request -> getClientInstance()
                        .executeAsync(request, false)),
            context -> handleGetObjectDependencyResponse(context));
    }

    /**
     * Builds the HttpRequest object for getObjectDependency.
     */
    private HttpRequest buildGetObjectDependencyRequest(
            final TspublicRestV2MetadataDependencyRequest body) throws JsonProcessingException {
        //validating required parameters
        if (null == body) {
            throw new NullPointerException("The parameter \"body\" is a required parameter and cannot be null.");
        }

        //the base uri for api requests
        String baseUri = config.getBaseUri();

        //prepare query string for API call
        final StringBuilder queryBuilder = new StringBuilder(baseUri
                + "/tspublic/rest/v2/metadata/dependency");

        //load all headers for the outgoing API request
        Headers headers = new Headers();
        headers.add("Content-Type", "application/json");
        headers.add("X-Requested-By", config.getXRequestedBy());
        headers.add("Accept-Language", config.getAcceptLanguage());
        headers.add("user-agent", BaseController.userAgent);

        //prepare and invoke the API call request to fetch the response
        String bodyJson = ApiHelper.serialize(body);
        HttpRequest request = getClientInstance().postBody(queryBuilder, headers, null, bodyJson);

        // Invoke the callback before request if its not null
        if (getHttpCallback() != null) {
            getHttpCallback().onBeforeRequest(request);
        }

        return request;
    }

    /**
     * Processes the response for getObjectDependency.
     * @return An object of type Object
     */
    private Object handleGetObjectDependencyResponse(
            HttpContext context) throws ApiException, IOException {
        HttpResponse response = context.getResponse();

        //invoke the callback after response if its not null
        if (getHttpCallback() != null) {
            getHttpCallback().onAfterResponse(context);
        }

        //Error handling using HTTP status codes
        int responseCode = response.getStatusCode();

        if (responseCode == 500) {
            throw new ErrorResponseException("Operation failed or unauthorized request", context);
        }
        //handle errors defined at the API level
        validateResponse(response, context);

        //extract result from the http response
        String responseBody = ((HttpStringResponse) response).getBody();
        Object result = responseBody;

        return result;
    }

    /**
     * To export ThoughtSpot objects represented in ThoughtSpot Modeling Language (TML), use this
     * endpoint.
     * @param  body  Required parameter: Example:
     * @return    Returns the Object response from the API call
     * @throws    ApiException    Represents error response from the server.
     * @throws    IOException    Signals that an I/O exception of some sort has occurred.
     */
    public Object exportObjectTML(
            final TspublicRestV2MetadataTmlExportRequest body) throws ApiException, IOException {
        HttpRequest request = buildExportObjectTMLRequest(body);
        authManagers.get("global").apply(request);

        HttpResponse response = getClientInstance().execute(request, false);
        HttpContext context = new HttpContext(request, response);

        return handleExportObjectTMLResponse(context);
    }

    /**
     * To export ThoughtSpot objects represented in ThoughtSpot Modeling Language (TML), use this
     * endpoint.
     * @param  body  Required parameter: Example:
     * @return    Returns the Object response from the API call
     */
    public CompletableFuture exportObjectTMLAsync(
            final TspublicRestV2MetadataTmlExportRequest body) {
        return makeHttpCallAsync(() -> buildExportObjectTMLRequest(body),
            req -> authManagers.get("global").applyAsync(req)
                .thenCompose(request -> getClientInstance()
                        .executeAsync(request, false)),
            context -> handleExportObjectTMLResponse(context));
    }

    /**
     * Builds the HttpRequest object for exportObjectTML.
     */
    private HttpRequest buildExportObjectTMLRequest(
            final TspublicRestV2MetadataTmlExportRequest body) throws JsonProcessingException {
        //validating required parameters
        if (null == body) {
            throw new NullPointerException("The parameter \"body\" is a required parameter and cannot be null.");
        }

        //the base uri for api requests
        String baseUri = config.getBaseUri();

        //prepare query string for API call
        final StringBuilder queryBuilder = new StringBuilder(baseUri
                + "/tspublic/rest/v2/metadata/tml/export");

        //load all headers for the outgoing API request
        Headers headers = new Headers();
        headers.add("Content-Type", "application/json");
        headers.add("X-Requested-By", config.getXRequestedBy());
        headers.add("Accept-Language", config.getAcceptLanguage());
        headers.add("user-agent", BaseController.userAgent);

        //prepare and invoke the API call request to fetch the response
        String bodyJson = ApiHelper.serialize(body);
        HttpRequest request = getClientInstance().postBody(queryBuilder, headers, null, bodyJson);

        // Invoke the callback before request if its not null
        if (getHttpCallback() != null) {
            getHttpCallback().onBeforeRequest(request);
        }

        return request;
    }

    /**
     * Processes the response for exportObjectTML.
     * @return An object of type Object
     */
    private Object handleExportObjectTMLResponse(
            HttpContext context) throws ApiException, IOException {
        HttpResponse response = context.getResponse();

        //invoke the callback after response if its not null
        if (getHttpCallback() != null) {
            getHttpCallback().onAfterResponse(context);
        }

        //Error handling using HTTP status codes
        int responseCode = response.getStatusCode();

        if (responseCode == 500) {
            throw new ErrorResponseException("Operation failed or unauthorized request", context);
        }
        //handle errors defined at the API level
        validateResponse(response, context);

        //extract result from the http response
        String responseBody = ((HttpStringResponse) response).getBody();
        Object result = responseBody;

        return result;
    }

    /**
     * To import ThoughtSpot objects represented in ThoughtSpot Modeling Language (TML), use this
     * endpoint.
     * @param  body  Required parameter: Example:
     * @return    Returns the Object response from the API call
     * @throws    ApiException    Represents error response from the server.
     * @throws    IOException    Signals that an I/O exception of some sort has occurred.
     */
    public Object importObjectTML(
            final TspublicRestV2MetadataTmlImportRequest body) throws ApiException, IOException {
        HttpRequest request = buildImportObjectTMLRequest(body);
        authManagers.get("global").apply(request);

        HttpResponse response = getClientInstance().execute(request, false);
        HttpContext context = new HttpContext(request, response);

        return handleImportObjectTMLResponse(context);
    }

    /**
     * To import ThoughtSpot objects represented in ThoughtSpot Modeling Language (TML), use this
     * endpoint.
     * @param  body  Required parameter: Example:
     * @return    Returns the Object response from the API call
     */
    public CompletableFuture importObjectTMLAsync(
            final TspublicRestV2MetadataTmlImportRequest body) {
        return makeHttpCallAsync(() -> buildImportObjectTMLRequest(body),
            req -> authManagers.get("global").applyAsync(req)
                .thenCompose(request -> getClientInstance()
                        .executeAsync(request, false)),
            context -> handleImportObjectTMLResponse(context));
    }

    /**
     * Builds the HttpRequest object for importObjectTML.
     */
    private HttpRequest buildImportObjectTMLRequest(
            final TspublicRestV2MetadataTmlImportRequest body) throws JsonProcessingException {
        //validating required parameters
        if (null == body) {
            throw new NullPointerException("The parameter \"body\" is a required parameter and cannot be null.");
        }

        //the base uri for api requests
        String baseUri = config.getBaseUri();

        //prepare query string for API call
        final StringBuilder queryBuilder = new StringBuilder(baseUri
                + "/tspublic/rest/v2/metadata/tml/import");

        //load all headers for the outgoing API request
        Headers headers = new Headers();
        headers.add("Content-Type", "application/json");
        headers.add("X-Requested-By", config.getXRequestedBy());
        headers.add("Accept-Language", config.getAcceptLanguage());
        headers.add("user-agent", BaseController.userAgent);

        //prepare and invoke the API call request to fetch the response
        String bodyJson = ApiHelper.serialize(body);
        HttpRequest request = getClientInstance().postBody(queryBuilder, headers, null, bodyJson);

        // Invoke the callback before request if its not null
        if (getHttpCallback() != null) {
            getHttpCallback().onBeforeRequest(request);
        }

        return request;
    }

    /**
     * Processes the response for importObjectTML.
     * @return An object of type Object
     */
    private Object handleImportObjectTMLResponse(
            HttpContext context) throws ApiException, IOException {
        HttpResponse response = context.getResponse();

        //invoke the callback after response if its not null
        if (getHttpCallback() != null) {
            getHttpCallback().onAfterResponse(context);
        }

        //Error handling using HTTP status codes
        int responseCode = response.getStatusCode();

        if (responseCode == 500) {
            throw new ErrorResponseException("Operation failed or unauthorized request", context);
        }
        //handle errors defined at the API level
        validateResponse(response, context);

        //extract result from the http response
        String responseBody = ((HttpStringResponse) response).getBody();
        Object result = responseBody;

        return result;
    }

}