/*
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 GitAPI interface {

	/*
	AddFiles Add files to Git staging

	Add files to the Git staging area

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

	// AddFilesExecute executes the request
	AddFilesExecute(r GitAPIAddFilesRequest) (*http.Response, error)

	/*
	CheckoutBranch Checkout branch or commit

	Switch to a different branch or commit in the Git repository

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

	// CheckoutBranchExecute executes the request
	CheckoutBranchExecute(r GitAPICheckoutBranchRequest) (*http.Response, error)

	/*
	CloneRepository Clone a Git repository

	Clone a Git repository to the specified path

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

	// CloneRepositoryExecute executes the request
	CloneRepositoryExecute(r GitAPICloneRepositoryRequest) (*http.Response, error)

	/*
	CommitChanges Commit changes

	Commit staged changes to the Git repository

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

	// CommitChangesExecute executes the request
	//  @return GitCommitResponse
	CommitChangesExecute(r GitAPICommitChangesRequest) (*GitCommitResponse, *http.Response, error)

	/*
	CreateBranch Create a new branch

	Create a new branch in the Git repository

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

	// CreateBranchExecute executes the request
	CreateBranchExecute(r GitAPICreateBranchRequest) (*http.Response, error)

	/*
	DeleteBranch Delete a branch

	Delete a branch from the Git repository

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

	// DeleteBranchExecute executes the request
	DeleteBranchExecute(r GitAPIDeleteBranchRequest) (*http.Response, error)

	/*
	GetCommitHistory Get commit history

	Get the commit history of the Git repository

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

	// GetCommitHistoryExecute executes the request
	//  @return []GitCommitInfo
	GetCommitHistoryExecute(r GitAPIGetCommitHistoryRequest) ([]GitCommitInfo, *http.Response, error)

	/*
	GetStatus Get Git status

	Get the Git status of the repository at the specified path

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

	// GetStatusExecute executes the request
	//  @return GitStatus
	GetStatusExecute(r GitAPIGetStatusRequest) (*GitStatus, *http.Response, error)

	/*
	ListBranches List branches

	Get a list of all branches in the Git repository

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

	// ListBranchesExecute executes the request
	//  @return ListBranchResponse
	ListBranchesExecute(r GitAPIListBranchesRequest) (*ListBranchResponse, *http.Response, error)

	/*
	PullChanges Pull changes from remote

	Pull changes from the remote Git repository

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

	// PullChangesExecute executes the request
	PullChangesExecute(r GitAPIPullChangesRequest) (*http.Response, error)

	/*
	PushChanges Push changes to remote

	Push local changes to the remote Git repository

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

	// PushChangesExecute executes the request
	PushChangesExecute(r GitAPIPushChangesRequest) (*http.Response, error)
}

// GitAPIService GitAPI service
type GitAPIService service

type GitAPIAddFilesRequest struct {
	ctx context.Context
	ApiService GitAPI
	request *GitAddRequest
}

// Add files request
func (r GitAPIAddFilesRequest) Request(request GitAddRequest) GitAPIAddFilesRequest {
	r.request = &request
	return r
}

func (r GitAPIAddFilesRequest) Execute() (*http.Response, error) {
	return r.ApiService.AddFilesExecute(r)
}

/*
AddFiles Add files to Git staging

Add files to the Git staging area

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

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

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

	localVarPath := localBasePath + "/git/add"

	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 GitAPICheckoutBranchRequest struct {
	ctx context.Context
	ApiService GitAPI
	request *GitCheckoutRequest
}

// Checkout request
func (r GitAPICheckoutBranchRequest) Request(request GitCheckoutRequest) GitAPICheckoutBranchRequest {
	r.request = &request
	return r
}

func (r GitAPICheckoutBranchRequest) Execute() (*http.Response, error) {
	return r.ApiService.CheckoutBranchExecute(r)
}

/*
CheckoutBranch Checkout branch or commit

Switch to a different branch or commit in the Git repository

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

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

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

	localVarPath := localBasePath + "/git/checkout"

	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 GitAPICloneRepositoryRequest struct {
	ctx context.Context
	ApiService GitAPI
	request *GitCloneRequest
}

// Clone repository request
func (r GitAPICloneRepositoryRequest) Request(request GitCloneRequest) GitAPICloneRepositoryRequest {
	r.request = &request
	return r
}

func (r GitAPICloneRepositoryRequest) Execute() (*http.Response, error) {
	return r.ApiService.CloneRepositoryExecute(r)
}

/*
CloneRepository Clone a Git repository

Clone a Git repository to the specified path

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

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

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

	localVarPath := localBasePath + "/git/clone"

	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 GitAPICommitChangesRequest struct {
	ctx context.Context
	ApiService GitAPI
	request *GitCommitRequest
}

// Commit request
func (r GitAPICommitChangesRequest) Request(request GitCommitRequest) GitAPICommitChangesRequest {
	r.request = &request
	return r
}

func (r GitAPICommitChangesRequest) Execute() (*GitCommitResponse, *http.Response, error) {
	return r.ApiService.CommitChangesExecute(r)
}

/*
CommitChanges Commit changes

Commit staged changes to the Git repository

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

// Execute executes the request
//  @return GitCommitResponse
func (a *GitAPIService) CommitChangesExecute(r GitAPICommitChangesRequest) (*GitCommitResponse, *http.Response, error) {
	var (
		localVarHTTPMethod   = http.MethodPost
		localVarPostBody     interface{}
		formFiles            []formFile
		localVarReturnValue  *GitCommitResponse
	)

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

	localVarPath := localBasePath + "/git/commit"

	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 GitAPICreateBranchRequest struct {
	ctx context.Context
	ApiService GitAPI
	request *GitBranchRequest
}

// Create branch request
func (r GitAPICreateBranchRequest) Request(request GitBranchRequest) GitAPICreateBranchRequest {
	r.request = &request
	return r
}

func (r GitAPICreateBranchRequest) Execute() (*http.Response, error) {
	return r.ApiService.CreateBranchExecute(r)
}

/*
CreateBranch Create a new branch

Create a new branch in the Git repository

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

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

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

	localVarPath := localBasePath + "/git/branches"

	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 GitAPIDeleteBranchRequest struct {
	ctx context.Context
	ApiService GitAPI
	request *GitDeleteBranchRequest
}

// Delete branch request
func (r GitAPIDeleteBranchRequest) Request(request GitDeleteBranchRequest) GitAPIDeleteBranchRequest {
	r.request = &request
	return r
}

func (r GitAPIDeleteBranchRequest) Execute() (*http.Response, error) {
	return r.ApiService.DeleteBranchExecute(r)
}

/*
DeleteBranch Delete a branch

Delete a branch from the Git repository

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

// Execute executes the request
func (a *GitAPIService) DeleteBranchExecute(r GitAPIDeleteBranchRequest) (*http.Response, error) {
	var (
		localVarHTTPMethod   = http.MethodDelete
		localVarPostBody     interface{}
		formFiles            []formFile
	)

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

	localVarPath := localBasePath + "/git/branches"

	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 GitAPIGetCommitHistoryRequest struct {
	ctx context.Context
	ApiService GitAPI
	path *string
}

// Repository path
func (r GitAPIGetCommitHistoryRequest) Path(path string) GitAPIGetCommitHistoryRequest {
	r.path = &path
	return r
}

func (r GitAPIGetCommitHistoryRequest) Execute() ([]GitCommitInfo, *http.Response, error) {
	return r.ApiService.GetCommitHistoryExecute(r)
}

/*
GetCommitHistory Get commit history

Get the commit history of the Git repository

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

// Execute executes the request
//  @return []GitCommitInfo
func (a *GitAPIService) GetCommitHistoryExecute(r GitAPIGetCommitHistoryRequest) ([]GitCommitInfo, *http.Response, error) {
	var (
		localVarHTTPMethod   = http.MethodGet
		localVarPostBody     interface{}
		formFiles            []formFile
		localVarReturnValue  []GitCommitInfo
	)

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

	localVarPath := localBasePath + "/git/history"

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

	parameterAddToHeaderOrQuery(localVarQueryParams, "path", r.path, "", "")
	// 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 GitAPIGetStatusRequest struct {
	ctx context.Context
	ApiService GitAPI
	path *string
}

// Repository path
func (r GitAPIGetStatusRequest) Path(path string) GitAPIGetStatusRequest {
	r.path = &path
	return r
}

func (r GitAPIGetStatusRequest) Execute() (*GitStatus, *http.Response, error) {
	return r.ApiService.GetStatusExecute(r)
}

/*
GetStatus Get Git status

Get the Git status of the repository at the specified path

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

// Execute executes the request
//  @return GitStatus
func (a *GitAPIService) GetStatusExecute(r GitAPIGetStatusRequest) (*GitStatus, *http.Response, error) {
	var (
		localVarHTTPMethod   = http.MethodGet
		localVarPostBody     interface{}
		formFiles            []formFile
		localVarReturnValue  *GitStatus
	)

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

	localVarPath := localBasePath + "/git/status"

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

	parameterAddToHeaderOrQuery(localVarQueryParams, "path", r.path, "", "")
	// 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 GitAPIListBranchesRequest struct {
	ctx context.Context
	ApiService GitAPI
	path *string
}

// Repository path
func (r GitAPIListBranchesRequest) Path(path string) GitAPIListBranchesRequest {
	r.path = &path
	return r
}

func (r GitAPIListBranchesRequest) Execute() (*ListBranchResponse, *http.Response, error) {
	return r.ApiService.ListBranchesExecute(r)
}

/*
ListBranches List branches

Get a list of all branches in the Git repository

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

// Execute executes the request
//  @return ListBranchResponse
func (a *GitAPIService) ListBranchesExecute(r GitAPIListBranchesRequest) (*ListBranchResponse, *http.Response, error) {
	var (
		localVarHTTPMethod   = http.MethodGet
		localVarPostBody     interface{}
		formFiles            []formFile
		localVarReturnValue  *ListBranchResponse
	)

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

	localVarPath := localBasePath + "/git/branches"

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

	parameterAddToHeaderOrQuery(localVarQueryParams, "path", r.path, "", "")
	// 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 GitAPIPullChangesRequest struct {
	ctx context.Context
	ApiService GitAPI
	request *GitRepoRequest
}

// Pull request
func (r GitAPIPullChangesRequest) Request(request GitRepoRequest) GitAPIPullChangesRequest {
	r.request = &request
	return r
}

func (r GitAPIPullChangesRequest) Execute() (*http.Response, error) {
	return r.ApiService.PullChangesExecute(r)
}

/*
PullChanges Pull changes from remote

Pull changes from the remote Git repository

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

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

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

	localVarPath := localBasePath + "/git/pull"

	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 GitAPIPushChangesRequest struct {
	ctx context.Context
	ApiService GitAPI
	request *GitRepoRequest
}

// Push request
func (r GitAPIPushChangesRequest) Request(request GitRepoRequest) GitAPIPushChangesRequest {
	r.request = &request
	return r
}

func (r GitAPIPushChangesRequest) Execute() (*http.Response, error) {
	return r.ApiService.PushChangesExecute(r)
}

/*
PushChanges Push changes to remote

Push local changes to the remote Git repository

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

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

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

	localVarPath := localBasePath + "/git/push"

	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
}
