/*
Daytona Toolbox API

Daytona Toolbox API

API version: v0.0.0-dev
*/

// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.

package toolbox

import (
	"bytes"
	"context"
	"io"
	"net/http"
	"net/url"
)


type LspAPI interface {

	/*
	Completions Get code completions

	Get code completion suggestions from the LSP server

	@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
	@return LspAPICompletionsRequest
	*/
	Completions(ctx context.Context) LspAPICompletionsRequest

	// CompletionsExecute executes the request
	//  @return CompletionList
	CompletionsExecute(r LspAPICompletionsRequest) (*CompletionList, *http.Response, error)

	/*
	DidClose Notify document closed

	Notify the LSP server that a document has been closed

	@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
	@return LspAPIDidCloseRequest
	*/
	DidClose(ctx context.Context) LspAPIDidCloseRequest

	// DidCloseExecute executes the request
	DidCloseExecute(r LspAPIDidCloseRequest) (*http.Response, error)

	/*
	DidOpen Notify document opened

	Notify the LSP server that a document has been opened

	@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
	@return LspAPIDidOpenRequest
	*/
	DidOpen(ctx context.Context) LspAPIDidOpenRequest

	// DidOpenExecute executes the request
	DidOpenExecute(r LspAPIDidOpenRequest) (*http.Response, error)

	/*
	DocumentSymbols Get document symbols

	Get symbols (functions, classes, etc.) from a document

	@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
	@return LspAPIDocumentSymbolsRequest
	*/
	DocumentSymbols(ctx context.Context) LspAPIDocumentSymbolsRequest

	// DocumentSymbolsExecute executes the request
	//  @return []LspSymbol
	DocumentSymbolsExecute(r LspAPIDocumentSymbolsRequest) ([]LspSymbol, *http.Response, error)

	/*
	Start Start LSP server

	Start a Language Server Protocol server for the specified language

	@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
	@return LspAPIStartRequest
	*/
	Start(ctx context.Context) LspAPIStartRequest

	// StartExecute executes the request
	StartExecute(r LspAPIStartRequest) (*http.Response, error)

	/*
	Stop Stop LSP server

	Stop a Language Server Protocol server

	@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
	@return LspAPIStopRequest
	*/
	Stop(ctx context.Context) LspAPIStopRequest

	// StopExecute executes the request
	StopExecute(r LspAPIStopRequest) (*http.Response, error)

	/*
	WorkspaceSymbols Get workspace symbols

	Search for symbols across the entire workspace

	@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
	@return LspAPIWorkspaceSymbolsRequest
	*/
	WorkspaceSymbols(ctx context.Context) LspAPIWorkspaceSymbolsRequest

	// WorkspaceSymbolsExecute executes the request
	//  @return []LspSymbol
	WorkspaceSymbolsExecute(r LspAPIWorkspaceSymbolsRequest) ([]LspSymbol, *http.Response, error)
}

// LspAPIService LspAPI service
type LspAPIService service

type LspAPICompletionsRequest struct {
	ctx context.Context
	ApiService LspAPI
	request *LspCompletionParams
}

// Completion request
func (r LspAPICompletionsRequest) Request(request LspCompletionParams) LspAPICompletionsRequest {
	r.request = &request
	return r
}

func (r LspAPICompletionsRequest) Execute() (*CompletionList, *http.Response, error) {
	return r.ApiService.CompletionsExecute(r)
}

/*
Completions Get code completions

Get code completion suggestions from the LSP server

 @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
 @return LspAPICompletionsRequest
*/
func (a *LspAPIService) Completions(ctx context.Context) LspAPICompletionsRequest {
	return LspAPICompletionsRequest{
		ApiService: a,
		ctx: ctx,
	}
}

// Execute executes the request
//  @return CompletionList
func (a *LspAPIService) CompletionsExecute(r LspAPICompletionsRequest) (*CompletionList, *http.Response, error) {
	var (
		localVarHTTPMethod   = http.MethodPost
		localVarPostBody     interface{}
		formFiles            []formFile
		localVarReturnValue  *CompletionList
	)

	localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LspAPIService.Completions")
	if err != nil {
		return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
	}

	localVarPath := localBasePath + "/lsp/completions"

	localVarHeaderParams := make(map[string]string)
	localVarQueryParams := url.Values{}
	localVarFormParams := url.Values{}
	if r.request == nil {
		return localVarReturnValue, nil, reportError("request is required and must be specified")
	}

	// to determine the Content-Type header
	localVarHTTPContentTypes := []string{"application/json"}

	// set Content-Type header
	localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
	if localVarHTTPContentType != "" {
		localVarHeaderParams["Content-Type"] = localVarHTTPContentType
	}

	// to determine the Accept header
	localVarHTTPHeaderAccepts := []string{"application/json"}

	// set Accept header
	localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
	if localVarHTTPHeaderAccept != "" {
		localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
	}
	// body params
	localVarPostBody = r.request
	req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
	if err != nil {
		return localVarReturnValue, nil, err
	}

	localVarHTTPResponse, err := a.client.callAPI(req)
	if err != nil || localVarHTTPResponse == nil {
		return localVarReturnValue, localVarHTTPResponse, err
	}

	localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
	localVarHTTPResponse.Body.Close()
	localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
	if err != nil {
		return localVarReturnValue, localVarHTTPResponse, err
	}

	if localVarHTTPResponse.StatusCode >= 300 {
		newErr := &GenericOpenAPIError{
			body:  localVarBody,
			error: localVarHTTPResponse.Status,
		}
		return localVarReturnValue, localVarHTTPResponse, newErr
	}

	err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
	if err != nil {
		newErr := &GenericOpenAPIError{
			body:  localVarBody,
			error: err.Error(),
		}
		return localVarReturnValue, localVarHTTPResponse, newErr
	}

	return localVarReturnValue, localVarHTTPResponse, nil
}

type LspAPIDidCloseRequest struct {
	ctx context.Context
	ApiService LspAPI
	request *LspDocumentRequest
}

// Document request
func (r LspAPIDidCloseRequest) Request(request LspDocumentRequest) LspAPIDidCloseRequest {
	r.request = &request
	return r
}

func (r LspAPIDidCloseRequest) Execute() (*http.Response, error) {
	return r.ApiService.DidCloseExecute(r)
}

/*
DidClose Notify document closed

Notify the LSP server that a document has been closed

 @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
 @return LspAPIDidCloseRequest
*/
func (a *LspAPIService) DidClose(ctx context.Context) LspAPIDidCloseRequest {
	return LspAPIDidCloseRequest{
		ApiService: a,
		ctx: ctx,
	}
}

// Execute executes the request
func (a *LspAPIService) DidCloseExecute(r LspAPIDidCloseRequest) (*http.Response, error) {
	var (
		localVarHTTPMethod   = http.MethodPost
		localVarPostBody     interface{}
		formFiles            []formFile
	)

	localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LspAPIService.DidClose")
	if err != nil {
		return nil, &GenericOpenAPIError{error: err.Error()}
	}

	localVarPath := localBasePath + "/lsp/did-close"

	localVarHeaderParams := make(map[string]string)
	localVarQueryParams := url.Values{}
	localVarFormParams := url.Values{}
	if r.request == nil {
		return nil, reportError("request is required and must be specified")
	}

	// to determine the Content-Type header
	localVarHTTPContentTypes := []string{"application/json"}

	// set Content-Type header
	localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
	if localVarHTTPContentType != "" {
		localVarHeaderParams["Content-Type"] = localVarHTTPContentType
	}

	// to determine the Accept header
	localVarHTTPHeaderAccepts := []string{}

	// set Accept header
	localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
	if localVarHTTPHeaderAccept != "" {
		localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
	}
	// body params
	localVarPostBody = r.request
	req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
	if err != nil {
		return nil, err
	}

	localVarHTTPResponse, err := a.client.callAPI(req)
	if err != nil || localVarHTTPResponse == nil {
		return localVarHTTPResponse, err
	}

	localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
	localVarHTTPResponse.Body.Close()
	localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
	if err != nil {
		return localVarHTTPResponse, err
	}

	if localVarHTTPResponse.StatusCode >= 300 {
		newErr := &GenericOpenAPIError{
			body:  localVarBody,
			error: localVarHTTPResponse.Status,
		}
		return localVarHTTPResponse, newErr
	}

	return localVarHTTPResponse, nil
}

type LspAPIDidOpenRequest struct {
	ctx context.Context
	ApiService LspAPI
	request *LspDocumentRequest
}

// Document request
func (r LspAPIDidOpenRequest) Request(request LspDocumentRequest) LspAPIDidOpenRequest {
	r.request = &request
	return r
}

func (r LspAPIDidOpenRequest) Execute() (*http.Response, error) {
	return r.ApiService.DidOpenExecute(r)
}

/*
DidOpen Notify document opened

Notify the LSP server that a document has been opened

 @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
 @return LspAPIDidOpenRequest
*/
func (a *LspAPIService) DidOpen(ctx context.Context) LspAPIDidOpenRequest {
	return LspAPIDidOpenRequest{
		ApiService: a,
		ctx: ctx,
	}
}

// Execute executes the request
func (a *LspAPIService) DidOpenExecute(r LspAPIDidOpenRequest) (*http.Response, error) {
	var (
		localVarHTTPMethod   = http.MethodPost
		localVarPostBody     interface{}
		formFiles            []formFile
	)

	localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LspAPIService.DidOpen")
	if err != nil {
		return nil, &GenericOpenAPIError{error: err.Error()}
	}

	localVarPath := localBasePath + "/lsp/did-open"

	localVarHeaderParams := make(map[string]string)
	localVarQueryParams := url.Values{}
	localVarFormParams := url.Values{}
	if r.request == nil {
		return nil, reportError("request is required and must be specified")
	}

	// to determine the Content-Type header
	localVarHTTPContentTypes := []string{"application/json"}

	// set Content-Type header
	localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
	if localVarHTTPContentType != "" {
		localVarHeaderParams["Content-Type"] = localVarHTTPContentType
	}

	// to determine the Accept header
	localVarHTTPHeaderAccepts := []string{}

	// set Accept header
	localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
	if localVarHTTPHeaderAccept != "" {
		localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
	}
	// body params
	localVarPostBody = r.request
	req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
	if err != nil {
		return nil, err
	}

	localVarHTTPResponse, err := a.client.callAPI(req)
	if err != nil || localVarHTTPResponse == nil {
		return localVarHTTPResponse, err
	}

	localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
	localVarHTTPResponse.Body.Close()
	localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
	if err != nil {
		return localVarHTTPResponse, err
	}

	if localVarHTTPResponse.StatusCode >= 300 {
		newErr := &GenericOpenAPIError{
			body:  localVarBody,
			error: localVarHTTPResponse.Status,
		}
		return localVarHTTPResponse, newErr
	}

	return localVarHTTPResponse, nil
}

type LspAPIDocumentSymbolsRequest struct {
	ctx context.Context
	ApiService LspAPI
	languageId *string
	pathToProject *string
	uri *string
}

// Language ID (e.g., python, typescript)
func (r LspAPIDocumentSymbolsRequest) LanguageId(languageId string) LspAPIDocumentSymbolsRequest {
	r.languageId = &languageId
	return r
}

// Path to project
func (r LspAPIDocumentSymbolsRequest) PathToProject(pathToProject string) LspAPIDocumentSymbolsRequest {
	r.pathToProject = &pathToProject
	return r
}

// Document URI
func (r LspAPIDocumentSymbolsRequest) Uri(uri string) LspAPIDocumentSymbolsRequest {
	r.uri = &uri
	return r
}

func (r LspAPIDocumentSymbolsRequest) Execute() ([]LspSymbol, *http.Response, error) {
	return r.ApiService.DocumentSymbolsExecute(r)
}

/*
DocumentSymbols Get document symbols

Get symbols (functions, classes, etc.) from a document

 @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
 @return LspAPIDocumentSymbolsRequest
*/
func (a *LspAPIService) DocumentSymbols(ctx context.Context) LspAPIDocumentSymbolsRequest {
	return LspAPIDocumentSymbolsRequest{
		ApiService: a,
		ctx: ctx,
	}
}

// Execute executes the request
//  @return []LspSymbol
func (a *LspAPIService) DocumentSymbolsExecute(r LspAPIDocumentSymbolsRequest) ([]LspSymbol, *http.Response, error) {
	var (
		localVarHTTPMethod   = http.MethodGet
		localVarPostBody     interface{}
		formFiles            []formFile
		localVarReturnValue  []LspSymbol
	)

	localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LspAPIService.DocumentSymbols")
	if err != nil {
		return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
	}

	localVarPath := localBasePath + "/lsp/document-symbols"

	localVarHeaderParams := make(map[string]string)
	localVarQueryParams := url.Values{}
	localVarFormParams := url.Values{}
	if r.languageId == nil {
		return localVarReturnValue, nil, reportError("languageId is required and must be specified")
	}
	if r.pathToProject == nil {
		return localVarReturnValue, nil, reportError("pathToProject is required and must be specified")
	}
	if r.uri == nil {
		return localVarReturnValue, nil, reportError("uri is required and must be specified")
	}

	parameterAddToHeaderOrQuery(localVarQueryParams, "languageId", r.languageId, "", "")
	parameterAddToHeaderOrQuery(localVarQueryParams, "pathToProject", r.pathToProject, "", "")
	parameterAddToHeaderOrQuery(localVarQueryParams, "uri", r.uri, "", "")
	// to determine the Content-Type header
	localVarHTTPContentTypes := []string{}

	// set Content-Type header
	localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
	if localVarHTTPContentType != "" {
		localVarHeaderParams["Content-Type"] = localVarHTTPContentType
	}

	// to determine the Accept header
	localVarHTTPHeaderAccepts := []string{"application/json"}

	// set Accept header
	localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
	if localVarHTTPHeaderAccept != "" {
		localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
	}
	req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
	if err != nil {
		return localVarReturnValue, nil, err
	}

	localVarHTTPResponse, err := a.client.callAPI(req)
	if err != nil || localVarHTTPResponse == nil {
		return localVarReturnValue, localVarHTTPResponse, err
	}

	localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
	localVarHTTPResponse.Body.Close()
	localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
	if err != nil {
		return localVarReturnValue, localVarHTTPResponse, err
	}

	if localVarHTTPResponse.StatusCode >= 300 {
		newErr := &GenericOpenAPIError{
			body:  localVarBody,
			error: localVarHTTPResponse.Status,
		}
		return localVarReturnValue, localVarHTTPResponse, newErr
	}

	err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
	if err != nil {
		newErr := &GenericOpenAPIError{
			body:  localVarBody,
			error: err.Error(),
		}
		return localVarReturnValue, localVarHTTPResponse, newErr
	}

	return localVarReturnValue, localVarHTTPResponse, nil
}

type LspAPIStartRequest struct {
	ctx context.Context
	ApiService LspAPI
	request *LspServerRequest
}

// LSP server request
func (r LspAPIStartRequest) Request(request LspServerRequest) LspAPIStartRequest {
	r.request = &request
	return r
}

func (r LspAPIStartRequest) Execute() (*http.Response, error) {
	return r.ApiService.StartExecute(r)
}

/*
Start Start LSP server

Start a Language Server Protocol server for the specified language

 @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
 @return LspAPIStartRequest
*/
func (a *LspAPIService) Start(ctx context.Context) LspAPIStartRequest {
	return LspAPIStartRequest{
		ApiService: a,
		ctx: ctx,
	}
}

// Execute executes the request
func (a *LspAPIService) StartExecute(r LspAPIStartRequest) (*http.Response, error) {
	var (
		localVarHTTPMethod   = http.MethodPost
		localVarPostBody     interface{}
		formFiles            []formFile
	)

	localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LspAPIService.Start")
	if err != nil {
		return nil, &GenericOpenAPIError{error: err.Error()}
	}

	localVarPath := localBasePath + "/lsp/start"

	localVarHeaderParams := make(map[string]string)
	localVarQueryParams := url.Values{}
	localVarFormParams := url.Values{}
	if r.request == nil {
		return nil, reportError("request is required and must be specified")
	}

	// to determine the Content-Type header
	localVarHTTPContentTypes := []string{"application/json"}

	// set Content-Type header
	localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
	if localVarHTTPContentType != "" {
		localVarHeaderParams["Content-Type"] = localVarHTTPContentType
	}

	// to determine the Accept header
	localVarHTTPHeaderAccepts := []string{}

	// set Accept header
	localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
	if localVarHTTPHeaderAccept != "" {
		localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
	}
	// body params
	localVarPostBody = r.request
	req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
	if err != nil {
		return nil, err
	}

	localVarHTTPResponse, err := a.client.callAPI(req)
	if err != nil || localVarHTTPResponse == nil {
		return localVarHTTPResponse, err
	}

	localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
	localVarHTTPResponse.Body.Close()
	localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
	if err != nil {
		return localVarHTTPResponse, err
	}

	if localVarHTTPResponse.StatusCode >= 300 {
		newErr := &GenericOpenAPIError{
			body:  localVarBody,
			error: localVarHTTPResponse.Status,
		}
		return localVarHTTPResponse, newErr
	}

	return localVarHTTPResponse, nil
}

type LspAPIStopRequest struct {
	ctx context.Context
	ApiService LspAPI
	request *LspServerRequest
}

// LSP server request
func (r LspAPIStopRequest) Request(request LspServerRequest) LspAPIStopRequest {
	r.request = &request
	return r
}

func (r LspAPIStopRequest) Execute() (*http.Response, error) {
	return r.ApiService.StopExecute(r)
}

/*
Stop Stop LSP server

Stop a Language Server Protocol server

 @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
 @return LspAPIStopRequest
*/
func (a *LspAPIService) Stop(ctx context.Context) LspAPIStopRequest {
	return LspAPIStopRequest{
		ApiService: a,
		ctx: ctx,
	}
}

// Execute executes the request
func (a *LspAPIService) StopExecute(r LspAPIStopRequest) (*http.Response, error) {
	var (
		localVarHTTPMethod   = http.MethodPost
		localVarPostBody     interface{}
		formFiles            []formFile
	)

	localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LspAPIService.Stop")
	if err != nil {
		return nil, &GenericOpenAPIError{error: err.Error()}
	}

	localVarPath := localBasePath + "/lsp/stop"

	localVarHeaderParams := make(map[string]string)
	localVarQueryParams := url.Values{}
	localVarFormParams := url.Values{}
	if r.request == nil {
		return nil, reportError("request is required and must be specified")
	}

	// to determine the Content-Type header
	localVarHTTPContentTypes := []string{"application/json"}

	// set Content-Type header
	localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
	if localVarHTTPContentType != "" {
		localVarHeaderParams["Content-Type"] = localVarHTTPContentType
	}

	// to determine the Accept header
	localVarHTTPHeaderAccepts := []string{}

	// set Accept header
	localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
	if localVarHTTPHeaderAccept != "" {
		localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
	}
	// body params
	localVarPostBody = r.request
	req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
	if err != nil {
		return nil, err
	}

	localVarHTTPResponse, err := a.client.callAPI(req)
	if err != nil || localVarHTTPResponse == nil {
		return localVarHTTPResponse, err
	}

	localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
	localVarHTTPResponse.Body.Close()
	localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
	if err != nil {
		return localVarHTTPResponse, err
	}

	if localVarHTTPResponse.StatusCode >= 300 {
		newErr := &GenericOpenAPIError{
			body:  localVarBody,
			error: localVarHTTPResponse.Status,
		}
		return localVarHTTPResponse, newErr
	}

	return localVarHTTPResponse, nil
}

type LspAPIWorkspaceSymbolsRequest struct {
	ctx context.Context
	ApiService LspAPI
	query *string
	languageId *string
	pathToProject *string
}

// Search query
func (r LspAPIWorkspaceSymbolsRequest) Query(query string) LspAPIWorkspaceSymbolsRequest {
	r.query = &query
	return r
}

// Language ID (e.g., python, typescript)
func (r LspAPIWorkspaceSymbolsRequest) LanguageId(languageId string) LspAPIWorkspaceSymbolsRequest {
	r.languageId = &languageId
	return r
}

// Path to project
func (r LspAPIWorkspaceSymbolsRequest) PathToProject(pathToProject string) LspAPIWorkspaceSymbolsRequest {
	r.pathToProject = &pathToProject
	return r
}

func (r LspAPIWorkspaceSymbolsRequest) Execute() ([]LspSymbol, *http.Response, error) {
	return r.ApiService.WorkspaceSymbolsExecute(r)
}

/*
WorkspaceSymbols Get workspace symbols

Search for symbols across the entire workspace

 @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
 @return LspAPIWorkspaceSymbolsRequest
*/
func (a *LspAPIService) WorkspaceSymbols(ctx context.Context) LspAPIWorkspaceSymbolsRequest {
	return LspAPIWorkspaceSymbolsRequest{
		ApiService: a,
		ctx: ctx,
	}
}

// Execute executes the request
//  @return []LspSymbol
func (a *LspAPIService) WorkspaceSymbolsExecute(r LspAPIWorkspaceSymbolsRequest) ([]LspSymbol, *http.Response, error) {
	var (
		localVarHTTPMethod   = http.MethodGet
		localVarPostBody     interface{}
		formFiles            []formFile
		localVarReturnValue  []LspSymbol
	)

	localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LspAPIService.WorkspaceSymbols")
	if err != nil {
		return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
	}

	localVarPath := localBasePath + "/lsp/workspacesymbols"

	localVarHeaderParams := make(map[string]string)
	localVarQueryParams := url.Values{}
	localVarFormParams := url.Values{}
	if r.query == nil {
		return localVarReturnValue, nil, reportError("query is required and must be specified")
	}
	if r.languageId == nil {
		return localVarReturnValue, nil, reportError("languageId is required and must be specified")
	}
	if r.pathToProject == nil {
		return localVarReturnValue, nil, reportError("pathToProject is required and must be specified")
	}

	parameterAddToHeaderOrQuery(localVarQueryParams, "query", r.query, "", "")
	parameterAddToHeaderOrQuery(localVarQueryParams, "languageId", r.languageId, "", "")
	parameterAddToHeaderOrQuery(localVarQueryParams, "pathToProject", r.pathToProject, "", "")
	// to determine the Content-Type header
	localVarHTTPContentTypes := []string{}

	// set Content-Type header
	localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
	if localVarHTTPContentType != "" {
		localVarHeaderParams["Content-Type"] = localVarHTTPContentType
	}

	// to determine the Accept header
	localVarHTTPHeaderAccepts := []string{"application/json"}

	// set Accept header
	localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
	if localVarHTTPHeaderAccept != "" {
		localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
	}
	req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
	if err != nil {
		return localVarReturnValue, nil, err
	}

	localVarHTTPResponse, err := a.client.callAPI(req)
	if err != nil || localVarHTTPResponse == nil {
		return localVarReturnValue, localVarHTTPResponse, err
	}

	localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
	localVarHTTPResponse.Body.Close()
	localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
	if err != nil {
		return localVarReturnValue, localVarHTTPResponse, err
	}

	if localVarHTTPResponse.StatusCode >= 300 {
		newErr := &GenericOpenAPIError{
			body:  localVarBody,
			error: localVarHTTPResponse.Status,
		}
		return localVarReturnValue, localVarHTTPResponse, newErr
	}

	err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
	if err != nil {
		newErr := &GenericOpenAPIError{
			body:  localVarBody,
			error: err.Error(),
		}
		return localVarReturnValue, localVarHTTPResponse, newErr
	}

	return localVarReturnValue, localVarHTTPResponse, nil
}
