/*
 * Daytona
 * Daytona AI platform API Docs
 *
 * The version of the OpenAPI document: 1.0
 * Contact: support@daytona.com
 *
 * 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.api.client.api;

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

import com.google.gson.reflect.TypeToken;

import java.io.IOException;


import io.daytona.api.client.model.CreateVolume;
import io.daytona.api.client.model.VolumeDto;

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

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

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

    public VolumesApi(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 createVolume
     * @param createVolume  (required)
     * @param xDaytonaOrganizationID Use with JWT to specify the organization ID (optional)
     * @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> The volume has been successfully created. </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call createVolumeCall(@javax.annotation.Nonnull CreateVolume createVolume, @javax.annotation.Nullable String xDaytonaOrganizationID, 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 = createVolume;

        // create path and map variables
        String localVarPath = "/volumes";

        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);
        }

        if (xDaytonaOrganizationID != null) {
            localVarHeaderParams.put("X-Daytona-Organization-ID", localVarApiClient.parameterToString(xDaytonaOrganizationID));
        }


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

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

        return createVolumeCall(createVolume, xDaytonaOrganizationID, _callback);

    }

    /**
     * Create a new volume
     * 
     * @param createVolume  (required)
     * @param xDaytonaOrganizationID Use with JWT to specify the organization ID (optional)
     * @return VolumeDto
     * @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> The volume has been successfully created. </td><td>  -  </td></tr>
     </table>
     */
    public VolumeDto createVolume(@javax.annotation.Nonnull CreateVolume createVolume, @javax.annotation.Nullable String xDaytonaOrganizationID) throws ApiException {
        ApiResponse<VolumeDto> localVarResp = createVolumeWithHttpInfo(createVolume, xDaytonaOrganizationID);
        return localVarResp.getData();
    }

    /**
     * Create a new volume
     * 
     * @param createVolume  (required)
     * @param xDaytonaOrganizationID Use with JWT to specify the organization ID (optional)
     * @return ApiResponse&lt;VolumeDto&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> The volume has been successfully created. </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<VolumeDto> createVolumeWithHttpInfo(@javax.annotation.Nonnull CreateVolume createVolume, @javax.annotation.Nullable String xDaytonaOrganizationID) throws ApiException {
        okhttp3.Call localVarCall = createVolumeValidateBeforeCall(createVolume, xDaytonaOrganizationID, null);
        Type localVarReturnType = new TypeToken<VolumeDto>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    /**
     * Create a new volume (asynchronously)
     * 
     * @param createVolume  (required)
     * @param xDaytonaOrganizationID Use with JWT to specify the organization ID (optional)
     * @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> The volume has been successfully created. </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call createVolumeAsync(@javax.annotation.Nonnull CreateVolume createVolume, @javax.annotation.Nullable String xDaytonaOrganizationID, final ApiCallback<VolumeDto> _callback) throws ApiException {

        okhttp3.Call localVarCall = createVolumeValidateBeforeCall(createVolume, xDaytonaOrganizationID, _callback);
        Type localVarReturnType = new TypeToken<VolumeDto>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }
    /**
     * Build call for deleteVolume
     * @param volumeId ID of the volume (required)
     * @param xDaytonaOrganizationID Use with JWT to specify the organization ID (optional)
     * @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> Volume has been marked for deletion </td><td>  -  </td></tr>
        <tr><td> 409 </td><td> Volume is in use by one or more sandboxes </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call deleteVolumeCall(@javax.annotation.Nonnull String volumeId, @javax.annotation.Nullable String xDaytonaOrganizationID, 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 = "/volumes/{volumeId}"
            .replace("{" + "volumeId" + "}", localVarApiClient.escapeString(volumeId.toString()));

        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 = {
        };
        final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
        if (localVarContentType != null) {
            localVarHeaderParams.put("Content-Type", localVarContentType);
        }

        if (xDaytonaOrganizationID != null) {
            localVarHeaderParams.put("X-Daytona-Organization-ID", localVarApiClient.parameterToString(xDaytonaOrganizationID));
        }


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

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

        return deleteVolumeCall(volumeId, xDaytonaOrganizationID, _callback);

    }

    /**
     * Delete volume
     * 
     * @param volumeId ID of the volume (required)
     * @param xDaytonaOrganizationID Use with JWT to specify the organization ID (optional)
     * @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> Volume has been marked for deletion </td><td>  -  </td></tr>
        <tr><td> 409 </td><td> Volume is in use by one or more sandboxes </td><td>  -  </td></tr>
     </table>
     */
    public void deleteVolume(@javax.annotation.Nonnull String volumeId, @javax.annotation.Nullable String xDaytonaOrganizationID) throws ApiException {
        deleteVolumeWithHttpInfo(volumeId, xDaytonaOrganizationID);
    }

    /**
     * Delete volume
     * 
     * @param volumeId ID of the volume (required)
     * @param xDaytonaOrganizationID Use with JWT to specify the organization ID (optional)
     * @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> Volume has been marked for deletion </td><td>  -  </td></tr>
        <tr><td> 409 </td><td> Volume is in use by one or more sandboxes </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<Void> deleteVolumeWithHttpInfo(@javax.annotation.Nonnull String volumeId, @javax.annotation.Nullable String xDaytonaOrganizationID) throws ApiException {
        okhttp3.Call localVarCall = deleteVolumeValidateBeforeCall(volumeId, xDaytonaOrganizationID, null);
        return localVarApiClient.execute(localVarCall);
    }

    /**
     * Delete volume (asynchronously)
     * 
     * @param volumeId ID of the volume (required)
     * @param xDaytonaOrganizationID Use with JWT to specify the organization ID (optional)
     * @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> Volume has been marked for deletion </td><td>  -  </td></tr>
        <tr><td> 409 </td><td> Volume is in use by one or more sandboxes </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call deleteVolumeAsync(@javax.annotation.Nonnull String volumeId, @javax.annotation.Nullable String xDaytonaOrganizationID, final ApiCallback<Void> _callback) throws ApiException {

        okhttp3.Call localVarCall = deleteVolumeValidateBeforeCall(volumeId, xDaytonaOrganizationID, _callback);
        localVarApiClient.executeAsync(localVarCall, _callback);
        return localVarCall;
    }
    /**
     * Build call for getVolume
     * @param volumeId ID of the volume (required)
     * @param xDaytonaOrganizationID Use with JWT to specify the organization ID (optional)
     * @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> Volume details </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call getVolumeCall(@javax.annotation.Nonnull String volumeId, @javax.annotation.Nullable String xDaytonaOrganizationID, 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 = "/volumes/{volumeId}"
            .replace("{" + "volumeId" + "}", localVarApiClient.escapeString(volumeId.toString()));

        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 = {
        };
        final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
        if (localVarContentType != null) {
            localVarHeaderParams.put("Content-Type", localVarContentType);
        }

        if (xDaytonaOrganizationID != null) {
            localVarHeaderParams.put("X-Daytona-Organization-ID", localVarApiClient.parameterToString(xDaytonaOrganizationID));
        }


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

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

        return getVolumeCall(volumeId, xDaytonaOrganizationID, _callback);

    }

    /**
     * Get volume details
     * 
     * @param volumeId ID of the volume (required)
     * @param xDaytonaOrganizationID Use with JWT to specify the organization ID (optional)
     * @return VolumeDto
     * @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> Volume details </td><td>  -  </td></tr>
     </table>
     */
    public VolumeDto getVolume(@javax.annotation.Nonnull String volumeId, @javax.annotation.Nullable String xDaytonaOrganizationID) throws ApiException {
        ApiResponse<VolumeDto> localVarResp = getVolumeWithHttpInfo(volumeId, xDaytonaOrganizationID);
        return localVarResp.getData();
    }

    /**
     * Get volume details
     * 
     * @param volumeId ID of the volume (required)
     * @param xDaytonaOrganizationID Use with JWT to specify the organization ID (optional)
     * @return ApiResponse&lt;VolumeDto&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> Volume details </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<VolumeDto> getVolumeWithHttpInfo(@javax.annotation.Nonnull String volumeId, @javax.annotation.Nullable String xDaytonaOrganizationID) throws ApiException {
        okhttp3.Call localVarCall = getVolumeValidateBeforeCall(volumeId, xDaytonaOrganizationID, null);
        Type localVarReturnType = new TypeToken<VolumeDto>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    /**
     * Get volume details (asynchronously)
     * 
     * @param volumeId ID of the volume (required)
     * @param xDaytonaOrganizationID Use with JWT to specify the organization ID (optional)
     * @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> Volume details </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call getVolumeAsync(@javax.annotation.Nonnull String volumeId, @javax.annotation.Nullable String xDaytonaOrganizationID, final ApiCallback<VolumeDto> _callback) throws ApiException {

        okhttp3.Call localVarCall = getVolumeValidateBeforeCall(volumeId, xDaytonaOrganizationID, _callback);
        Type localVarReturnType = new TypeToken<VolumeDto>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }
    /**
     * Build call for getVolumeByName
     * @param name Name of the volume (required)
     * @param xDaytonaOrganizationID Use with JWT to specify the organization ID (optional)
     * @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> Volume details </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call getVolumeByNameCall(@javax.annotation.Nonnull String name, @javax.annotation.Nullable String xDaytonaOrganizationID, 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 = "/volumes/by-name/{name}"
            .replace("{" + "name" + "}", localVarApiClient.escapeString(name.toString()));

        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 = {
        };
        final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
        if (localVarContentType != null) {
            localVarHeaderParams.put("Content-Type", localVarContentType);
        }

        if (xDaytonaOrganizationID != null) {
            localVarHeaderParams.put("X-Daytona-Organization-ID", localVarApiClient.parameterToString(xDaytonaOrganizationID));
        }


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

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

        return getVolumeByNameCall(name, xDaytonaOrganizationID, _callback);

    }

    /**
     * Get volume details by name
     * 
     * @param name Name of the volume (required)
     * @param xDaytonaOrganizationID Use with JWT to specify the organization ID (optional)
     * @return VolumeDto
     * @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> Volume details </td><td>  -  </td></tr>
     </table>
     */
    public VolumeDto getVolumeByName(@javax.annotation.Nonnull String name, @javax.annotation.Nullable String xDaytonaOrganizationID) throws ApiException {
        ApiResponse<VolumeDto> localVarResp = getVolumeByNameWithHttpInfo(name, xDaytonaOrganizationID);
        return localVarResp.getData();
    }

    /**
     * Get volume details by name
     * 
     * @param name Name of the volume (required)
     * @param xDaytonaOrganizationID Use with JWT to specify the organization ID (optional)
     * @return ApiResponse&lt;VolumeDto&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> Volume details </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<VolumeDto> getVolumeByNameWithHttpInfo(@javax.annotation.Nonnull String name, @javax.annotation.Nullable String xDaytonaOrganizationID) throws ApiException {
        okhttp3.Call localVarCall = getVolumeByNameValidateBeforeCall(name, xDaytonaOrganizationID, null);
        Type localVarReturnType = new TypeToken<VolumeDto>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    /**
     * Get volume details by name (asynchronously)
     * 
     * @param name Name of the volume (required)
     * @param xDaytonaOrganizationID Use with JWT to specify the organization ID (optional)
     * @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> Volume details </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call getVolumeByNameAsync(@javax.annotation.Nonnull String name, @javax.annotation.Nullable String xDaytonaOrganizationID, final ApiCallback<VolumeDto> _callback) throws ApiException {

        okhttp3.Call localVarCall = getVolumeByNameValidateBeforeCall(name, xDaytonaOrganizationID, _callback);
        Type localVarReturnType = new TypeToken<VolumeDto>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }
    /**
     * Build call for listVolumes
     * @param xDaytonaOrganizationID Use with JWT to specify the organization ID (optional)
     * @param includeDeleted Include deleted volumes in the response (optional)
     * @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> List of all volumes </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call listVolumesCall(@javax.annotation.Nullable String xDaytonaOrganizationID, @javax.annotation.Nullable Boolean includeDeleted, 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 = "/volumes";

        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 (includeDeleted != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("includeDeleted", includeDeleted));
        }

        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);
        }

        if (xDaytonaOrganizationID != null) {
            localVarHeaderParams.put("X-Daytona-Organization-ID", localVarApiClient.parameterToString(xDaytonaOrganizationID));
        }


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

    @SuppressWarnings("rawtypes")
    private okhttp3.Call listVolumesValidateBeforeCall(@javax.annotation.Nullable String xDaytonaOrganizationID, @javax.annotation.Nullable Boolean includeDeleted, final ApiCallback _callback) throws ApiException {
        return listVolumesCall(xDaytonaOrganizationID, includeDeleted, _callback);

    }

    /**
     * List all volumes
     * 
     * @param xDaytonaOrganizationID Use with JWT to specify the organization ID (optional)
     * @param includeDeleted Include deleted volumes in the response (optional)
     * @return List&lt;VolumeDto&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> List of all volumes </td><td>  -  </td></tr>
     </table>
     */
    public List<VolumeDto> listVolumes(@javax.annotation.Nullable String xDaytonaOrganizationID, @javax.annotation.Nullable Boolean includeDeleted) throws ApiException {
        ApiResponse<List<VolumeDto>> localVarResp = listVolumesWithHttpInfo(xDaytonaOrganizationID, includeDeleted);
        return localVarResp.getData();
    }

    /**
     * List all volumes
     * 
     * @param xDaytonaOrganizationID Use with JWT to specify the organization ID (optional)
     * @param includeDeleted Include deleted volumes in the response (optional)
     * @return ApiResponse&lt;List&lt;VolumeDto&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> List of all volumes </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<List<VolumeDto>> listVolumesWithHttpInfo(@javax.annotation.Nullable String xDaytonaOrganizationID, @javax.annotation.Nullable Boolean includeDeleted) throws ApiException {
        okhttp3.Call localVarCall = listVolumesValidateBeforeCall(xDaytonaOrganizationID, includeDeleted, null);
        Type localVarReturnType = new TypeToken<List<VolumeDto>>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    /**
     * List all volumes (asynchronously)
     * 
     * @param xDaytonaOrganizationID Use with JWT to specify the organization ID (optional)
     * @param includeDeleted Include deleted volumes in the response (optional)
     * @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> List of all volumes </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call listVolumesAsync(@javax.annotation.Nullable String xDaytonaOrganizationID, @javax.annotation.Nullable Boolean includeDeleted, final ApiCallback<List<VolumeDto>> _callback) throws ApiException {

        okhttp3.Call localVarCall = listVolumesValidateBeforeCall(xDaytonaOrganizationID, includeDeleted, _callback);
        Type localVarReturnType = new TypeToken<List<VolumeDto>>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }
}
