/*
 * Daytona Toolbox API
 * Daytona Toolbox API
 *
 * The version of the OpenAPI document: v0.0.0-dev
 * 
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */


package io.daytona.toolbox.client.api;

import io.daytona.toolbox.client.ApiCallback;
import io.daytona.toolbox.client.ApiClient;
import io.daytona.toolbox.client.ApiException;
import io.daytona.toolbox.client.ApiResponse;
import io.daytona.toolbox.client.Configuration;
import io.daytona.toolbox.client.Pair;
import io.daytona.toolbox.client.ProgressRequestBody;
import io.daytona.toolbox.client.ProgressResponseBody;

import com.google.gson.reflect.TypeToken;

import java.io.IOException;


import io.daytona.toolbox.client.model.CompletionList;
import io.daytona.toolbox.client.model.LspCompletionParams;
import io.daytona.toolbox.client.model.LspDocumentRequest;
import io.daytona.toolbox.client.model.LspServerRequest;
import io.daytona.toolbox.client.model.LspSymbol;

import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class LspApi {
    private ApiClient localVarApiClient;
    private int localHostIndex;
    private String localCustomBaseUrl;

    public LspApi() {
        this(Configuration.getDefaultApiClient());
    }

    public LspApi(ApiClient apiClient) {
        this.localVarApiClient = apiClient;
    }

    public ApiClient getApiClient() {
        return localVarApiClient;
    }

    public void setApiClient(ApiClient apiClient) {
        this.localVarApiClient = apiClient;
    }

    public int getHostIndex() {
        return localHostIndex;
    }

    public void setHostIndex(int hostIndex) {
        this.localHostIndex = hostIndex;
    }

    public String getCustomBaseUrl() {
        return localCustomBaseUrl;
    }

    public void setCustomBaseUrl(String customBaseUrl) {
        this.localCustomBaseUrl = customBaseUrl;
    }

    /**
     * Build call for completions
     * @param request Completion request (required)
     * @param _callback Callback for upload/download progress
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     * @http.response.details
     <table border="1">
       <caption>Response Details</caption>
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> OK </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call completionsCall(@javax.annotation.Nonnull LspCompletionParams request, final ApiCallback _callback) throws ApiException {
        String basePath = null;
        // Operation Servers
        String[] localBasePaths = new String[] {  };

        // Determine Base Path to Use
        if (localCustomBaseUrl != null){
            basePath = localCustomBaseUrl;
        } else if ( localBasePaths.length > 0 ) {
            basePath = localBasePaths[localHostIndex];
        } else {
            basePath = null;
        }

        Object localVarPostBody = request;

        // create path and map variables
        String localVarPath = "/lsp/completions";

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
        Map<String, String> localVarHeaderParams = new HashMap<String, String>();
        Map<String, String> localVarCookieParams = new HashMap<String, String>();
        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        final String[] localVarAccepts = {
            "application/json"
        };
        final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) {
            localVarHeaderParams.put("Accept", localVarAccept);
        }

        final String[] localVarContentTypes = {
            "application/json"
        };
        final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
        if (localVarContentType != null) {
            localVarHeaderParams.put("Content-Type", localVarContentType);
        }

        String[] localVarAuthNames = new String[] {  };
        return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call completionsValidateBeforeCall(@javax.annotation.Nonnull LspCompletionParams request, final ApiCallback _callback) throws ApiException {
        // verify the required parameter 'request' is set
        if (request == null) {
            throw new ApiException("Missing the required parameter 'request' when calling completions(Async)");
        }

        return completionsCall(request, _callback);

    }

    /**
     * Get code completions
     * Get code completion suggestions from the LSP server
     * @param request Completion request (required)
     * @return CompletionList
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table border="1">
       <caption>Response Details</caption>
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> OK </td><td>  -  </td></tr>
     </table>
     */
    public CompletionList completions(@javax.annotation.Nonnull LspCompletionParams request) throws ApiException {
        ApiResponse<CompletionList> localVarResp = completionsWithHttpInfo(request);
        return localVarResp.getData();
    }

    /**
     * Get code completions
     * Get code completion suggestions from the LSP server
     * @param request Completion request (required)
     * @return ApiResponse&lt;CompletionList&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table border="1">
       <caption>Response Details</caption>
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> OK </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<CompletionList> completionsWithHttpInfo(@javax.annotation.Nonnull LspCompletionParams request) throws ApiException {
        okhttp3.Call localVarCall = completionsValidateBeforeCall(request, null);
        Type localVarReturnType = new TypeToken<CompletionList>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    /**
     * Get code completions (asynchronously)
     * Get code completion suggestions from the LSP server
     * @param request Completion request (required)
     * @param _callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     * @http.response.details
     <table border="1">
       <caption>Response Details</caption>
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> OK </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call completionsAsync(@javax.annotation.Nonnull LspCompletionParams request, final ApiCallback<CompletionList> _callback) throws ApiException {

        okhttp3.Call localVarCall = completionsValidateBeforeCall(request, _callback);
        Type localVarReturnType = new TypeToken<CompletionList>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }
    /**
     * Build call for didClose
     * @param request Document request (required)
     * @param _callback Callback for upload/download progress
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     * @http.response.details
     <table border="1">
       <caption>Response Details</caption>
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> OK </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call didCloseCall(@javax.annotation.Nonnull LspDocumentRequest request, final ApiCallback _callback) throws ApiException {
        String basePath = null;
        // Operation Servers
        String[] localBasePaths = new String[] {  };

        // Determine Base Path to Use
        if (localCustomBaseUrl != null){
            basePath = localCustomBaseUrl;
        } else if ( localBasePaths.length > 0 ) {
            basePath = localBasePaths[localHostIndex];
        } else {
            basePath = null;
        }

        Object localVarPostBody = request;

        // create path and map variables
        String localVarPath = "/lsp/did-close";

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
        Map<String, String> localVarHeaderParams = new HashMap<String, String>();
        Map<String, String> localVarCookieParams = new HashMap<String, String>();
        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        final String[] localVarAccepts = {
        };
        final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) {
            localVarHeaderParams.put("Accept", localVarAccept);
        }

        final String[] localVarContentTypes = {
            "application/json"
        };
        final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
        if (localVarContentType != null) {
            localVarHeaderParams.put("Content-Type", localVarContentType);
        }

        String[] localVarAuthNames = new String[] {  };
        return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call didCloseValidateBeforeCall(@javax.annotation.Nonnull LspDocumentRequest request, final ApiCallback _callback) throws ApiException {
        // verify the required parameter 'request' is set
        if (request == null) {
            throw new ApiException("Missing the required parameter 'request' when calling didClose(Async)");
        }

        return didCloseCall(request, _callback);

    }

    /**
     * Notify document closed
     * Notify the LSP server that a document has been closed
     * @param request Document request (required)
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table border="1">
       <caption>Response Details</caption>
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> OK </td><td>  -  </td></tr>
     </table>
     */
    public void didClose(@javax.annotation.Nonnull LspDocumentRequest request) throws ApiException {
        didCloseWithHttpInfo(request);
    }

    /**
     * Notify document closed
     * Notify the LSP server that a document has been closed
     * @param request Document request (required)
     * @return ApiResponse&lt;Void&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table border="1">
       <caption>Response Details</caption>
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> OK </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<Void> didCloseWithHttpInfo(@javax.annotation.Nonnull LspDocumentRequest request) throws ApiException {
        okhttp3.Call localVarCall = didCloseValidateBeforeCall(request, null);
        return localVarApiClient.execute(localVarCall);
    }

    /**
     * Notify document closed (asynchronously)
     * Notify the LSP server that a document has been closed
     * @param request Document request (required)
     * @param _callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     * @http.response.details
     <table border="1">
       <caption>Response Details</caption>
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> OK </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call didCloseAsync(@javax.annotation.Nonnull LspDocumentRequest request, final ApiCallback<Void> _callback) throws ApiException {

        okhttp3.Call localVarCall = didCloseValidateBeforeCall(request, _callback);
        localVarApiClient.executeAsync(localVarCall, _callback);
        return localVarCall;
    }
    /**
     * Build call for didOpen
     * @param request Document request (required)
     * @param _callback Callback for upload/download progress
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     * @http.response.details
     <table border="1">
       <caption>Response Details</caption>
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> OK </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call didOpenCall(@javax.annotation.Nonnull LspDocumentRequest request, final ApiCallback _callback) throws ApiException {
        String basePath = null;
        // Operation Servers
        String[] localBasePaths = new String[] {  };

        // Determine Base Path to Use
        if (localCustomBaseUrl != null){
            basePath = localCustomBaseUrl;
        } else if ( localBasePaths.length > 0 ) {
            basePath = localBasePaths[localHostIndex];
        } else {
            basePath = null;
        }

        Object localVarPostBody = request;

        // create path and map variables
        String localVarPath = "/lsp/did-open";

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
        Map<String, String> localVarHeaderParams = new HashMap<String, String>();
        Map<String, String> localVarCookieParams = new HashMap<String, String>();
        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        final String[] localVarAccepts = {
        };
        final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) {
            localVarHeaderParams.put("Accept", localVarAccept);
        }

        final String[] localVarContentTypes = {
            "application/json"
        };
        final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
        if (localVarContentType != null) {
            localVarHeaderParams.put("Content-Type", localVarContentType);
        }

        String[] localVarAuthNames = new String[] {  };
        return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call didOpenValidateBeforeCall(@javax.annotation.Nonnull LspDocumentRequest request, final ApiCallback _callback) throws ApiException {
        // verify the required parameter 'request' is set
        if (request == null) {
            throw new ApiException("Missing the required parameter 'request' when calling didOpen(Async)");
        }

        return didOpenCall(request, _callback);

    }

    /**
     * Notify document opened
     * Notify the LSP server that a document has been opened
     * @param request Document request (required)
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table border="1">
       <caption>Response Details</caption>
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> OK </td><td>  -  </td></tr>
     </table>
     */
    public void didOpen(@javax.annotation.Nonnull LspDocumentRequest request) throws ApiException {
        didOpenWithHttpInfo(request);
    }

    /**
     * Notify document opened
     * Notify the LSP server that a document has been opened
     * @param request Document request (required)
     * @return ApiResponse&lt;Void&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table border="1">
       <caption>Response Details</caption>
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> OK </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<Void> didOpenWithHttpInfo(@javax.annotation.Nonnull LspDocumentRequest request) throws ApiException {
        okhttp3.Call localVarCall = didOpenValidateBeforeCall(request, null);
        return localVarApiClient.execute(localVarCall);
    }

    /**
     * Notify document opened (asynchronously)
     * Notify the LSP server that a document has been opened
     * @param request Document request (required)
     * @param _callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     * @http.response.details
     <table border="1">
       <caption>Response Details</caption>
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> OK </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call didOpenAsync(@javax.annotation.Nonnull LspDocumentRequest request, final ApiCallback<Void> _callback) throws ApiException {

        okhttp3.Call localVarCall = didOpenValidateBeforeCall(request, _callback);
        localVarApiClient.executeAsync(localVarCall, _callback);
        return localVarCall;
    }
    /**
     * Build call for documentSymbols
     * @param languageId Language ID (e.g., python, typescript) (required)
     * @param pathToProject Path to project (required)
     * @param uri Document URI (required)
     * @param _callback Callback for upload/download progress
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     * @http.response.details
     <table border="1">
       <caption>Response Details</caption>
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> OK </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call documentSymbolsCall(@javax.annotation.Nonnull String languageId, @javax.annotation.Nonnull String pathToProject, @javax.annotation.Nonnull String uri, final ApiCallback _callback) throws ApiException {
        String basePath = null;
        // Operation Servers
        String[] localBasePaths = new String[] {  };

        // Determine Base Path to Use
        if (localCustomBaseUrl != null){
            basePath = localCustomBaseUrl;
        } else if ( localBasePaths.length > 0 ) {
            basePath = localBasePaths[localHostIndex];
        } else {
            basePath = null;
        }

        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/lsp/document-symbols";

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
        Map<String, String> localVarHeaderParams = new HashMap<String, String>();
        Map<String, String> localVarCookieParams = new HashMap<String, String>();
        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        if (languageId != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("languageId", languageId));
        }

        if (pathToProject != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("pathToProject", pathToProject));
        }

        if (uri != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("uri", uri));
        }

        final String[] localVarAccepts = {
            "application/json"
        };
        final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) {
            localVarHeaderParams.put("Accept", localVarAccept);
        }

        final String[] localVarContentTypes = {
        };
        final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
        if (localVarContentType != null) {
            localVarHeaderParams.put("Content-Type", localVarContentType);
        }

        String[] localVarAuthNames = new String[] {  };
        return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call documentSymbolsValidateBeforeCall(@javax.annotation.Nonnull String languageId, @javax.annotation.Nonnull String pathToProject, @javax.annotation.Nonnull String uri, final ApiCallback _callback) throws ApiException {
        // verify the required parameter 'languageId' is set
        if (languageId == null) {
            throw new ApiException("Missing the required parameter 'languageId' when calling documentSymbols(Async)");
        }

        // verify the required parameter 'pathToProject' is set
        if (pathToProject == null) {
            throw new ApiException("Missing the required parameter 'pathToProject' when calling documentSymbols(Async)");
        }

        // verify the required parameter 'uri' is set
        if (uri == null) {
            throw new ApiException("Missing the required parameter 'uri' when calling documentSymbols(Async)");
        }

        return documentSymbolsCall(languageId, pathToProject, uri, _callback);

    }

    /**
     * Get document symbols
     * Get symbols (functions, classes, etc.) from a document
     * @param languageId Language ID (e.g., python, typescript) (required)
     * @param pathToProject Path to project (required)
     * @param uri Document URI (required)
     * @return List&lt;LspSymbol&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table border="1">
       <caption>Response Details</caption>
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> OK </td><td>  -  </td></tr>
     </table>
     */
    public List<LspSymbol> documentSymbols(@javax.annotation.Nonnull String languageId, @javax.annotation.Nonnull String pathToProject, @javax.annotation.Nonnull String uri) throws ApiException {
        ApiResponse<List<LspSymbol>> localVarResp = documentSymbolsWithHttpInfo(languageId, pathToProject, uri);
        return localVarResp.getData();
    }

    /**
     * Get document symbols
     * Get symbols (functions, classes, etc.) from a document
     * @param languageId Language ID (e.g., python, typescript) (required)
     * @param pathToProject Path to project (required)
     * @param uri Document URI (required)
     * @return ApiResponse&lt;List&lt;LspSymbol&gt;&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table border="1">
       <caption>Response Details</caption>
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> OK </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<List<LspSymbol>> documentSymbolsWithHttpInfo(@javax.annotation.Nonnull String languageId, @javax.annotation.Nonnull String pathToProject, @javax.annotation.Nonnull String uri) throws ApiException {
        okhttp3.Call localVarCall = documentSymbolsValidateBeforeCall(languageId, pathToProject, uri, null);
        Type localVarReturnType = new TypeToken<List<LspSymbol>>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    /**
     * Get document symbols (asynchronously)
     * Get symbols (functions, classes, etc.) from a document
     * @param languageId Language ID (e.g., python, typescript) (required)
     * @param pathToProject Path to project (required)
     * @param uri Document URI (required)
     * @param _callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     * @http.response.details
     <table border="1">
       <caption>Response Details</caption>
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> OK </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call documentSymbolsAsync(@javax.annotation.Nonnull String languageId, @javax.annotation.Nonnull String pathToProject, @javax.annotation.Nonnull String uri, final ApiCallback<List<LspSymbol>> _callback) throws ApiException {

        okhttp3.Call localVarCall = documentSymbolsValidateBeforeCall(languageId, pathToProject, uri, _callback);
        Type localVarReturnType = new TypeToken<List<LspSymbol>>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }
    /**
     * Build call for start
     * @param request LSP server request (required)
     * @param _callback Callback for upload/download progress
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     * @http.response.details
     <table border="1">
       <caption>Response Details</caption>
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> OK </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call startCall(@javax.annotation.Nonnull LspServerRequest request, final ApiCallback _callback) throws ApiException {
        String basePath = null;
        // Operation Servers
        String[] localBasePaths = new String[] {  };

        // Determine Base Path to Use
        if (localCustomBaseUrl != null){
            basePath = localCustomBaseUrl;
        } else if ( localBasePaths.length > 0 ) {
            basePath = localBasePaths[localHostIndex];
        } else {
            basePath = null;
        }

        Object localVarPostBody = request;

        // create path and map variables
        String localVarPath = "/lsp/start";

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
        Map<String, String> localVarHeaderParams = new HashMap<String, String>();
        Map<String, String> localVarCookieParams = new HashMap<String, String>();
        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        final String[] localVarAccepts = {
        };
        final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) {
            localVarHeaderParams.put("Accept", localVarAccept);
        }

        final String[] localVarContentTypes = {
            "application/json"
        };
        final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
        if (localVarContentType != null) {
            localVarHeaderParams.put("Content-Type", localVarContentType);
        }

        String[] localVarAuthNames = new String[] {  };
        return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call startValidateBeforeCall(@javax.annotation.Nonnull LspServerRequest request, final ApiCallback _callback) throws ApiException {
        // verify the required parameter 'request' is set
        if (request == null) {
            throw new ApiException("Missing the required parameter 'request' when calling start(Async)");
        }

        return startCall(request, _callback);

    }

    /**
     * Start LSP server
     * Start a Language Server Protocol server for the specified language
     * @param request LSP server request (required)
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table border="1">
       <caption>Response Details</caption>
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> OK </td><td>  -  </td></tr>
     </table>
     */
    public void start(@javax.annotation.Nonnull LspServerRequest request) throws ApiException {
        startWithHttpInfo(request);
    }

    /**
     * Start LSP server
     * Start a Language Server Protocol server for the specified language
     * @param request LSP server request (required)
     * @return ApiResponse&lt;Void&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table border="1">
       <caption>Response Details</caption>
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> OK </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<Void> startWithHttpInfo(@javax.annotation.Nonnull LspServerRequest request) throws ApiException {
        okhttp3.Call localVarCall = startValidateBeforeCall(request, null);
        return localVarApiClient.execute(localVarCall);
    }

    /**
     * Start LSP server (asynchronously)
     * Start a Language Server Protocol server for the specified language
     * @param request LSP server request (required)
     * @param _callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     * @http.response.details
     <table border="1">
       <caption>Response Details</caption>
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> OK </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call startAsync(@javax.annotation.Nonnull LspServerRequest request, final ApiCallback<Void> _callback) throws ApiException {

        okhttp3.Call localVarCall = startValidateBeforeCall(request, _callback);
        localVarApiClient.executeAsync(localVarCall, _callback);
        return localVarCall;
    }
    /**
     * Build call for stop
     * @param request LSP server request (required)
     * @param _callback Callback for upload/download progress
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     * @http.response.details
     <table border="1">
       <caption>Response Details</caption>
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> OK </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call stopCall(@javax.annotation.Nonnull LspServerRequest request, final ApiCallback _callback) throws ApiException {
        String basePath = null;
        // Operation Servers
        String[] localBasePaths = new String[] {  };

        // Determine Base Path to Use
        if (localCustomBaseUrl != null){
            basePath = localCustomBaseUrl;
        } else if ( localBasePaths.length > 0 ) {
            basePath = localBasePaths[localHostIndex];
        } else {
            basePath = null;
        }

        Object localVarPostBody = request;

        // create path and map variables
        String localVarPath = "/lsp/stop";

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
        Map<String, String> localVarHeaderParams = new HashMap<String, String>();
        Map<String, String> localVarCookieParams = new HashMap<String, String>();
        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        final String[] localVarAccepts = {
        };
        final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) {
            localVarHeaderParams.put("Accept", localVarAccept);
        }

        final String[] localVarContentTypes = {
            "application/json"
        };
        final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
        if (localVarContentType != null) {
            localVarHeaderParams.put("Content-Type", localVarContentType);
        }

        String[] localVarAuthNames = new String[] {  };
        return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call stopValidateBeforeCall(@javax.annotation.Nonnull LspServerRequest request, final ApiCallback _callback) throws ApiException {
        // verify the required parameter 'request' is set
        if (request == null) {
            throw new ApiException("Missing the required parameter 'request' when calling stop(Async)");
        }

        return stopCall(request, _callback);

    }

    /**
     * Stop LSP server
     * Stop a Language Server Protocol server
     * @param request LSP server request (required)
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table border="1">
       <caption>Response Details</caption>
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> OK </td><td>  -  </td></tr>
     </table>
     */
    public void stop(@javax.annotation.Nonnull LspServerRequest request) throws ApiException {
        stopWithHttpInfo(request);
    }

    /**
     * Stop LSP server
     * Stop a Language Server Protocol server
     * @param request LSP server request (required)
     * @return ApiResponse&lt;Void&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table border="1">
       <caption>Response Details</caption>
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> OK </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<Void> stopWithHttpInfo(@javax.annotation.Nonnull LspServerRequest request) throws ApiException {
        okhttp3.Call localVarCall = stopValidateBeforeCall(request, null);
        return localVarApiClient.execute(localVarCall);
    }

    /**
     * Stop LSP server (asynchronously)
     * Stop a Language Server Protocol server
     * @param request LSP server request (required)
     * @param _callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     * @http.response.details
     <table border="1">
       <caption>Response Details</caption>
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> OK </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call stopAsync(@javax.annotation.Nonnull LspServerRequest request, final ApiCallback<Void> _callback) throws ApiException {

        okhttp3.Call localVarCall = stopValidateBeforeCall(request, _callback);
        localVarApiClient.executeAsync(localVarCall, _callback);
        return localVarCall;
    }
    /**
     * Build call for workspaceSymbols
     * @param query Search query (required)
     * @param languageId Language ID (e.g., python, typescript) (required)
     * @param pathToProject Path to project (required)
     * @param _callback Callback for upload/download progress
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     * @http.response.details
     <table border="1">
       <caption>Response Details</caption>
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> OK </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call workspaceSymbolsCall(@javax.annotation.Nonnull String query, @javax.annotation.Nonnull String languageId, @javax.annotation.Nonnull String pathToProject, final ApiCallback _callback) throws ApiException {
        String basePath = null;
        // Operation Servers
        String[] localBasePaths = new String[] {  };

        // Determine Base Path to Use
        if (localCustomBaseUrl != null){
            basePath = localCustomBaseUrl;
        } else if ( localBasePaths.length > 0 ) {
            basePath = localBasePaths[localHostIndex];
        } else {
            basePath = null;
        }

        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/lsp/workspacesymbols";

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
        Map<String, String> localVarHeaderParams = new HashMap<String, String>();
        Map<String, String> localVarCookieParams = new HashMap<String, String>();
        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        if (query != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("query", query));
        }

        if (languageId != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("languageId", languageId));
        }

        if (pathToProject != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("pathToProject", pathToProject));
        }

        final String[] localVarAccepts = {
            "application/json"
        };
        final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) {
            localVarHeaderParams.put("Accept", localVarAccept);
        }

        final String[] localVarContentTypes = {
        };
        final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
        if (localVarContentType != null) {
            localVarHeaderParams.put("Content-Type", localVarContentType);
        }

        String[] localVarAuthNames = new String[] {  };
        return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call workspaceSymbolsValidateBeforeCall(@javax.annotation.Nonnull String query, @javax.annotation.Nonnull String languageId, @javax.annotation.Nonnull String pathToProject, final ApiCallback _callback) throws ApiException {
        // verify the required parameter 'query' is set
        if (query == null) {
            throw new ApiException("Missing the required parameter 'query' when calling workspaceSymbols(Async)");
        }

        // verify the required parameter 'languageId' is set
        if (languageId == null) {
            throw new ApiException("Missing the required parameter 'languageId' when calling workspaceSymbols(Async)");
        }

        // verify the required parameter 'pathToProject' is set
        if (pathToProject == null) {
            throw new ApiException("Missing the required parameter 'pathToProject' when calling workspaceSymbols(Async)");
        }

        return workspaceSymbolsCall(query, languageId, pathToProject, _callback);

    }

    /**
     * Get workspace symbols
     * Search for symbols across the entire workspace
     * @param query Search query (required)
     * @param languageId Language ID (e.g., python, typescript) (required)
     * @param pathToProject Path to project (required)
     * @return List&lt;LspSymbol&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table border="1">
       <caption>Response Details</caption>
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> OK </td><td>  -  </td></tr>
     </table>
     */
    public List<LspSymbol> workspaceSymbols(@javax.annotation.Nonnull String query, @javax.annotation.Nonnull String languageId, @javax.annotation.Nonnull String pathToProject) throws ApiException {
        ApiResponse<List<LspSymbol>> localVarResp = workspaceSymbolsWithHttpInfo(query, languageId, pathToProject);
        return localVarResp.getData();
    }

    /**
     * Get workspace symbols
     * Search for symbols across the entire workspace
     * @param query Search query (required)
     * @param languageId Language ID (e.g., python, typescript) (required)
     * @param pathToProject Path to project (required)
     * @return ApiResponse&lt;List&lt;LspSymbol&gt;&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table border="1">
       <caption>Response Details</caption>
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> OK </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<List<LspSymbol>> workspaceSymbolsWithHttpInfo(@javax.annotation.Nonnull String query, @javax.annotation.Nonnull String languageId, @javax.annotation.Nonnull String pathToProject) throws ApiException {
        okhttp3.Call localVarCall = workspaceSymbolsValidateBeforeCall(query, languageId, pathToProject, null);
        Type localVarReturnType = new TypeToken<List<LspSymbol>>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    /**
     * Get workspace symbols (asynchronously)
     * Search for symbols across the entire workspace
     * @param query Search query (required)
     * @param languageId Language ID (e.g., python, typescript) (required)
     * @param pathToProject Path to project (required)
     * @param _callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     * @http.response.details
     <table border="1">
       <caption>Response Details</caption>
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> OK </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call workspaceSymbolsAsync(@javax.annotation.Nonnull String query, @javax.annotation.Nonnull String languageId, @javax.annotation.Nonnull String pathToProject, final ApiCallback<List<LspSymbol>> _callback) throws ApiException {

        okhttp3.Call localVarCall = workspaceSymbolsValidateBeforeCall(query, languageId, pathToProject, _callback);
        Type localVarReturnType = new TypeToken<List<LspSymbol>>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }
}
