/*
 * 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 java.math.BigDecimal;
import io.daytona.api.client.model.CreateSnapshot;
import io.daytona.api.client.model.PaginatedSnapshots;
import io.daytona.api.client.model.SnapshotDto;
import io.daytona.api.client.model.Url;

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

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

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

    public SnapshotsApi(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 activateSnapshot
     * @param id Snapshot ID (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 snapshot has been successfully activated. </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> Bad request - Snapshot is already active, not in inactive state, or has associated snapshot runners </td><td>  -  </td></tr>
        <tr><td> 404 </td><td> Snapshot not found </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call activateSnapshotCall(@javax.annotation.Nonnull String id, @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 = "/snapshots/{id}/activate"
            .replace("{" + "id" + "}", localVarApiClient.escapeString(id.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, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
    }

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

        return activateSnapshotCall(id, xDaytonaOrganizationID, _callback);

    }

    /**
     * Activate a snapshot
     * 
     * @param id Snapshot ID (required)
     * @param xDaytonaOrganizationID Use with JWT to specify the organization ID (optional)
     * @return SnapshotDto
     * @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 snapshot has been successfully activated. </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> Bad request - Snapshot is already active, not in inactive state, or has associated snapshot runners </td><td>  -  </td></tr>
        <tr><td> 404 </td><td> Snapshot not found </td><td>  -  </td></tr>
     </table>
     */
    public SnapshotDto activateSnapshot(@javax.annotation.Nonnull String id, @javax.annotation.Nullable String xDaytonaOrganizationID) throws ApiException {
        ApiResponse<SnapshotDto> localVarResp = activateSnapshotWithHttpInfo(id, xDaytonaOrganizationID);
        return localVarResp.getData();
    }

    /**
     * Activate a snapshot
     * 
     * @param id Snapshot ID (required)
     * @param xDaytonaOrganizationID Use with JWT to specify the organization ID (optional)
     * @return ApiResponse&lt;SnapshotDto&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 snapshot has been successfully activated. </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> Bad request - Snapshot is already active, not in inactive state, or has associated snapshot runners </td><td>  -  </td></tr>
        <tr><td> 404 </td><td> Snapshot not found </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<SnapshotDto> activateSnapshotWithHttpInfo(@javax.annotation.Nonnull String id, @javax.annotation.Nullable String xDaytonaOrganizationID) throws ApiException {
        okhttp3.Call localVarCall = activateSnapshotValidateBeforeCall(id, xDaytonaOrganizationID, null);
        Type localVarReturnType = new TypeToken<SnapshotDto>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    /**
     * Activate a snapshot (asynchronously)
     * 
     * @param id Snapshot ID (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 snapshot has been successfully activated. </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> Bad request - Snapshot is already active, not in inactive state, or has associated snapshot runners </td><td>  -  </td></tr>
        <tr><td> 404 </td><td> Snapshot not found </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call activateSnapshotAsync(@javax.annotation.Nonnull String id, @javax.annotation.Nullable String xDaytonaOrganizationID, final ApiCallback<SnapshotDto> _callback) throws ApiException {

        okhttp3.Call localVarCall = activateSnapshotValidateBeforeCall(id, xDaytonaOrganizationID, _callback);
        Type localVarReturnType = new TypeToken<SnapshotDto>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }
    /**
     * Build call for createSnapshot
     * @param createSnapshot  (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 snapshot has been successfully created. </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> Bad request - Snapshots with tag \&quot;:latest\&quot; are not allowed </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call createSnapshotCall(@javax.annotation.Nonnull CreateSnapshot createSnapshot, @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 = createSnapshot;

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

        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 createSnapshotValidateBeforeCall(@javax.annotation.Nonnull CreateSnapshot createSnapshot, @javax.annotation.Nullable String xDaytonaOrganizationID, final ApiCallback _callback) throws ApiException {
        // verify the required parameter 'createSnapshot' is set
        if (createSnapshot == null) {
            throw new ApiException("Missing the required parameter 'createSnapshot' when calling createSnapshot(Async)");
        }

        return createSnapshotCall(createSnapshot, xDaytonaOrganizationID, _callback);

    }

    /**
     * Create a new snapshot
     * 
     * @param createSnapshot  (required)
     * @param xDaytonaOrganizationID Use with JWT to specify the organization ID (optional)
     * @return SnapshotDto
     * @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 snapshot has been successfully created. </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> Bad request - Snapshots with tag \&quot;:latest\&quot; are not allowed </td><td>  -  </td></tr>
     </table>
     */
    public SnapshotDto createSnapshot(@javax.annotation.Nonnull CreateSnapshot createSnapshot, @javax.annotation.Nullable String xDaytonaOrganizationID) throws ApiException {
        ApiResponse<SnapshotDto> localVarResp = createSnapshotWithHttpInfo(createSnapshot, xDaytonaOrganizationID);
        return localVarResp.getData();
    }

    /**
     * Create a new snapshot
     * 
     * @param createSnapshot  (required)
     * @param xDaytonaOrganizationID Use with JWT to specify the organization ID (optional)
     * @return ApiResponse&lt;SnapshotDto&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 snapshot has been successfully created. </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> Bad request - Snapshots with tag \&quot;:latest\&quot; are not allowed </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<SnapshotDto> createSnapshotWithHttpInfo(@javax.annotation.Nonnull CreateSnapshot createSnapshot, @javax.annotation.Nullable String xDaytonaOrganizationID) throws ApiException {
        okhttp3.Call localVarCall = createSnapshotValidateBeforeCall(createSnapshot, xDaytonaOrganizationID, null);
        Type localVarReturnType = new TypeToken<SnapshotDto>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    /**
     * Create a new snapshot (asynchronously)
     * 
     * @param createSnapshot  (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 snapshot has been successfully created. </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> Bad request - Snapshots with tag \&quot;:latest\&quot; are not allowed </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call createSnapshotAsync(@javax.annotation.Nonnull CreateSnapshot createSnapshot, @javax.annotation.Nullable String xDaytonaOrganizationID, final ApiCallback<SnapshotDto> _callback) throws ApiException {

        okhttp3.Call localVarCall = createSnapshotValidateBeforeCall(createSnapshot, xDaytonaOrganizationID, _callback);
        Type localVarReturnType = new TypeToken<SnapshotDto>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }
    /**
     * Build call for deactivateSnapshot
     * @param id Snapshot ID (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> 204 </td><td> The snapshot has been successfully deactivated. </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call deactivateSnapshotCall(@javax.annotation.Nonnull String id, @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 = "/snapshots/{id}/deactivate"
            .replace("{" + "id" + "}", localVarApiClient.escapeString(id.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, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
    }

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

        return deactivateSnapshotCall(id, xDaytonaOrganizationID, _callback);

    }

    /**
     * Deactivate a snapshot
     * 
     * @param id Snapshot ID (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> 204 </td><td> The snapshot has been successfully deactivated. </td><td>  -  </td></tr>
     </table>
     */
    public void deactivateSnapshot(@javax.annotation.Nonnull String id, @javax.annotation.Nullable String xDaytonaOrganizationID) throws ApiException {
        deactivateSnapshotWithHttpInfo(id, xDaytonaOrganizationID);
    }

    /**
     * Deactivate a snapshot
     * 
     * @param id Snapshot ID (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> 204 </td><td> The snapshot has been successfully deactivated. </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<Void> deactivateSnapshotWithHttpInfo(@javax.annotation.Nonnull String id, @javax.annotation.Nullable String xDaytonaOrganizationID) throws ApiException {
        okhttp3.Call localVarCall = deactivateSnapshotValidateBeforeCall(id, xDaytonaOrganizationID, null);
        return localVarApiClient.execute(localVarCall);
    }

    /**
     * Deactivate a snapshot (asynchronously)
     * 
     * @param id Snapshot ID (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> 204 </td><td> The snapshot has been successfully deactivated. </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call deactivateSnapshotAsync(@javax.annotation.Nonnull String id, @javax.annotation.Nullable String xDaytonaOrganizationID, final ApiCallback<Void> _callback) throws ApiException {

        okhttp3.Call localVarCall = deactivateSnapshotValidateBeforeCall(id, xDaytonaOrganizationID, _callback);
        localVarApiClient.executeAsync(localVarCall, _callback);
        return localVarCall;
    }
    /**
     * Build call for getAllSnapshots
     * @param xDaytonaOrganizationID Use with JWT to specify the organization ID (optional)
     * @param page Page number of the results (optional, default to 1)
     * @param limit Number of results per page (optional, default to 100)
     * @param name Filter by partial name match (optional)
     * @param sort Field to sort by (optional, default to lastUsedAt)
     * @param order Direction to sort by (optional, default to desc)
     * @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> Paginated list of all snapshots </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call getAllSnapshotsCall(@javax.annotation.Nullable String xDaytonaOrganizationID, @javax.annotation.Nullable BigDecimal page, @javax.annotation.Nullable BigDecimal limit, @javax.annotation.Nullable String name, @javax.annotation.Nullable String sort, @javax.annotation.Nullable String order, 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 = "/snapshots";

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

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

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

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

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

        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 getAllSnapshotsValidateBeforeCall(@javax.annotation.Nullable String xDaytonaOrganizationID, @javax.annotation.Nullable BigDecimal page, @javax.annotation.Nullable BigDecimal limit, @javax.annotation.Nullable String name, @javax.annotation.Nullable String sort, @javax.annotation.Nullable String order, final ApiCallback _callback) throws ApiException {
        return getAllSnapshotsCall(xDaytonaOrganizationID, page, limit, name, sort, order, _callback);

    }

    /**
     * List all snapshots
     * 
     * @param xDaytonaOrganizationID Use with JWT to specify the organization ID (optional)
     * @param page Page number of the results (optional, default to 1)
     * @param limit Number of results per page (optional, default to 100)
     * @param name Filter by partial name match (optional)
     * @param sort Field to sort by (optional, default to lastUsedAt)
     * @param order Direction to sort by (optional, default to desc)
     * @return PaginatedSnapshots
     * @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> Paginated list of all snapshots </td><td>  -  </td></tr>
     </table>
     */
    public PaginatedSnapshots getAllSnapshots(@javax.annotation.Nullable String xDaytonaOrganizationID, @javax.annotation.Nullable BigDecimal page, @javax.annotation.Nullable BigDecimal limit, @javax.annotation.Nullable String name, @javax.annotation.Nullable String sort, @javax.annotation.Nullable String order) throws ApiException {
        ApiResponse<PaginatedSnapshots> localVarResp = getAllSnapshotsWithHttpInfo(xDaytonaOrganizationID, page, limit, name, sort, order);
        return localVarResp.getData();
    }

    /**
     * List all snapshots
     * 
     * @param xDaytonaOrganizationID Use with JWT to specify the organization ID (optional)
     * @param page Page number of the results (optional, default to 1)
     * @param limit Number of results per page (optional, default to 100)
     * @param name Filter by partial name match (optional)
     * @param sort Field to sort by (optional, default to lastUsedAt)
     * @param order Direction to sort by (optional, default to desc)
     * @return ApiResponse&lt;PaginatedSnapshots&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> Paginated list of all snapshots </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<PaginatedSnapshots> getAllSnapshotsWithHttpInfo(@javax.annotation.Nullable String xDaytonaOrganizationID, @javax.annotation.Nullable BigDecimal page, @javax.annotation.Nullable BigDecimal limit, @javax.annotation.Nullable String name, @javax.annotation.Nullable String sort, @javax.annotation.Nullable String order) throws ApiException {
        okhttp3.Call localVarCall = getAllSnapshotsValidateBeforeCall(xDaytonaOrganizationID, page, limit, name, sort, order, null);
        Type localVarReturnType = new TypeToken<PaginatedSnapshots>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    /**
     * List all snapshots (asynchronously)
     * 
     * @param xDaytonaOrganizationID Use with JWT to specify the organization ID (optional)
     * @param page Page number of the results (optional, default to 1)
     * @param limit Number of results per page (optional, default to 100)
     * @param name Filter by partial name match (optional)
     * @param sort Field to sort by (optional, default to lastUsedAt)
     * @param order Direction to sort by (optional, default to desc)
     * @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> Paginated list of all snapshots </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call getAllSnapshotsAsync(@javax.annotation.Nullable String xDaytonaOrganizationID, @javax.annotation.Nullable BigDecimal page, @javax.annotation.Nullable BigDecimal limit, @javax.annotation.Nullable String name, @javax.annotation.Nullable String sort, @javax.annotation.Nullable String order, final ApiCallback<PaginatedSnapshots> _callback) throws ApiException {

        okhttp3.Call localVarCall = getAllSnapshotsValidateBeforeCall(xDaytonaOrganizationID, page, limit, name, sort, order, _callback);
        Type localVarReturnType = new TypeToken<PaginatedSnapshots>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }
    /**
     * Build call for getSnapshot
     * @param id Snapshot ID or name (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 snapshot </td><td>  -  </td></tr>
        <tr><td> 404 </td><td> Snapshot not found </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call getSnapshotCall(@javax.annotation.Nonnull String id, @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 = "/snapshots/{id}"
            .replace("{" + "id" + "}", localVarApiClient.escapeString(id.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 getSnapshotValidateBeforeCall(@javax.annotation.Nonnull String id, @javax.annotation.Nullable String xDaytonaOrganizationID, final ApiCallback _callback) throws ApiException {
        // verify the required parameter 'id' is set
        if (id == null) {
            throw new ApiException("Missing the required parameter 'id' when calling getSnapshot(Async)");
        }

        return getSnapshotCall(id, xDaytonaOrganizationID, _callback);

    }

    /**
     * Get snapshot by ID or name
     * 
     * @param id Snapshot ID or name (required)
     * @param xDaytonaOrganizationID Use with JWT to specify the organization ID (optional)
     * @return SnapshotDto
     * @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 snapshot </td><td>  -  </td></tr>
        <tr><td> 404 </td><td> Snapshot not found </td><td>  -  </td></tr>
     </table>
     */
    public SnapshotDto getSnapshot(@javax.annotation.Nonnull String id, @javax.annotation.Nullable String xDaytonaOrganizationID) throws ApiException {
        ApiResponse<SnapshotDto> localVarResp = getSnapshotWithHttpInfo(id, xDaytonaOrganizationID);
        return localVarResp.getData();
    }

    /**
     * Get snapshot by ID or name
     * 
     * @param id Snapshot ID or name (required)
     * @param xDaytonaOrganizationID Use with JWT to specify the organization ID (optional)
     * @return ApiResponse&lt;SnapshotDto&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 snapshot </td><td>  -  </td></tr>
        <tr><td> 404 </td><td> Snapshot not found </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<SnapshotDto> getSnapshotWithHttpInfo(@javax.annotation.Nonnull String id, @javax.annotation.Nullable String xDaytonaOrganizationID) throws ApiException {
        okhttp3.Call localVarCall = getSnapshotValidateBeforeCall(id, xDaytonaOrganizationID, null);
        Type localVarReturnType = new TypeToken<SnapshotDto>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    /**
     * Get snapshot by ID or name (asynchronously)
     * 
     * @param id Snapshot ID or name (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 snapshot </td><td>  -  </td></tr>
        <tr><td> 404 </td><td> Snapshot not found </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call getSnapshotAsync(@javax.annotation.Nonnull String id, @javax.annotation.Nullable String xDaytonaOrganizationID, final ApiCallback<SnapshotDto> _callback) throws ApiException {

        okhttp3.Call localVarCall = getSnapshotValidateBeforeCall(id, xDaytonaOrganizationID, _callback);
        Type localVarReturnType = new TypeToken<SnapshotDto>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }
    /**
     * Build call for getSnapshotBuildLogs
     * @param id Snapshot ID (required)
     * @param xDaytonaOrganizationID Use with JWT to specify the organization ID (optional)
     * @param follow Whether to follow the logs stream (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>  </td><td>  -  </td></tr>
     </table>
     * @deprecated
     */
    @Deprecated
    public okhttp3.Call getSnapshotBuildLogsCall(@javax.annotation.Nonnull String id, @javax.annotation.Nullable String xDaytonaOrganizationID, @javax.annotation.Nullable Boolean follow, 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 = "/snapshots/{id}/build-logs"
            .replace("{" + "id" + "}", localVarApiClient.escapeString(id.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>();

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

        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, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
    }

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

        return getSnapshotBuildLogsCall(id, xDaytonaOrganizationID, follow, _callback);

    }

    /**
     * Get snapshot build logs
     * This endpoint is deprecated. Use &#x60;getSnapshotBuildLogsUrl&#x60; instead.
     * @param id Snapshot ID (required)
     * @param xDaytonaOrganizationID Use with JWT to specify the organization ID (optional)
     * @param follow Whether to follow the logs stream (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>  </td><td>  -  </td></tr>
     </table>
     * @deprecated
     */
    @Deprecated
    public void getSnapshotBuildLogs(@javax.annotation.Nonnull String id, @javax.annotation.Nullable String xDaytonaOrganizationID, @javax.annotation.Nullable Boolean follow) throws ApiException {
        getSnapshotBuildLogsWithHttpInfo(id, xDaytonaOrganizationID, follow);
    }

    /**
     * Get snapshot build logs
     * This endpoint is deprecated. Use &#x60;getSnapshotBuildLogsUrl&#x60; instead.
     * @param id Snapshot ID (required)
     * @param xDaytonaOrganizationID Use with JWT to specify the organization ID (optional)
     * @param follow Whether to follow the logs stream (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>  </td><td>  -  </td></tr>
     </table>
     * @deprecated
     */
    @Deprecated
    public ApiResponse<Void> getSnapshotBuildLogsWithHttpInfo(@javax.annotation.Nonnull String id, @javax.annotation.Nullable String xDaytonaOrganizationID, @javax.annotation.Nullable Boolean follow) throws ApiException {
        okhttp3.Call localVarCall = getSnapshotBuildLogsValidateBeforeCall(id, xDaytonaOrganizationID, follow, null);
        return localVarApiClient.execute(localVarCall);
    }

    /**
     * Get snapshot build logs (asynchronously)
     * This endpoint is deprecated. Use &#x60;getSnapshotBuildLogsUrl&#x60; instead.
     * @param id Snapshot ID (required)
     * @param xDaytonaOrganizationID Use with JWT to specify the organization ID (optional)
     * @param follow Whether to follow the logs stream (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>  </td><td>  -  </td></tr>
     </table>
     * @deprecated
     */
    @Deprecated
    public okhttp3.Call getSnapshotBuildLogsAsync(@javax.annotation.Nonnull String id, @javax.annotation.Nullable String xDaytonaOrganizationID, @javax.annotation.Nullable Boolean follow, final ApiCallback<Void> _callback) throws ApiException {

        okhttp3.Call localVarCall = getSnapshotBuildLogsValidateBeforeCall(id, xDaytonaOrganizationID, follow, _callback);
        localVarApiClient.executeAsync(localVarCall, _callback);
        return localVarCall;
    }
    /**
     * Build call for getSnapshotBuildLogsUrl
     * @param id Snapshot ID (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 snapshot build logs URL </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call getSnapshotBuildLogsUrlCall(@javax.annotation.Nonnull String id, @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 = "/snapshots/{id}/build-logs-url"
            .replace("{" + "id" + "}", localVarApiClient.escapeString(id.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 getSnapshotBuildLogsUrlValidateBeforeCall(@javax.annotation.Nonnull String id, @javax.annotation.Nullable String xDaytonaOrganizationID, final ApiCallback _callback) throws ApiException {
        // verify the required parameter 'id' is set
        if (id == null) {
            throw new ApiException("Missing the required parameter 'id' when calling getSnapshotBuildLogsUrl(Async)");
        }

        return getSnapshotBuildLogsUrlCall(id, xDaytonaOrganizationID, _callback);

    }

    /**
     * Get snapshot build logs URL
     * 
     * @param id Snapshot ID (required)
     * @param xDaytonaOrganizationID Use with JWT to specify the organization ID (optional)
     * @return Url
     * @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 snapshot build logs URL </td><td>  -  </td></tr>
     </table>
     */
    public Url getSnapshotBuildLogsUrl(@javax.annotation.Nonnull String id, @javax.annotation.Nullable String xDaytonaOrganizationID) throws ApiException {
        ApiResponse<Url> localVarResp = getSnapshotBuildLogsUrlWithHttpInfo(id, xDaytonaOrganizationID);
        return localVarResp.getData();
    }

    /**
     * Get snapshot build logs URL
     * 
     * @param id Snapshot ID (required)
     * @param xDaytonaOrganizationID Use with JWT to specify the organization ID (optional)
     * @return ApiResponse&lt;Url&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 snapshot build logs URL </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<Url> getSnapshotBuildLogsUrlWithHttpInfo(@javax.annotation.Nonnull String id, @javax.annotation.Nullable String xDaytonaOrganizationID) throws ApiException {
        okhttp3.Call localVarCall = getSnapshotBuildLogsUrlValidateBeforeCall(id, xDaytonaOrganizationID, null);
        Type localVarReturnType = new TypeToken<Url>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    /**
     * Get snapshot build logs URL (asynchronously)
     * 
     * @param id Snapshot ID (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 snapshot build logs URL </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call getSnapshotBuildLogsUrlAsync(@javax.annotation.Nonnull String id, @javax.annotation.Nullable String xDaytonaOrganizationID, final ApiCallback<Url> _callback) throws ApiException {

        okhttp3.Call localVarCall = getSnapshotBuildLogsUrlValidateBeforeCall(id, xDaytonaOrganizationID, _callback);
        Type localVarReturnType = new TypeToken<Url>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }
    /**
     * Build call for removeSnapshot
     * @param id Snapshot ID (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> Snapshot has been deleted </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call removeSnapshotCall(@javax.annotation.Nonnull String id, @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 = "/snapshots/{id}"
            .replace("{" + "id" + "}", localVarApiClient.escapeString(id.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 removeSnapshotValidateBeforeCall(@javax.annotation.Nonnull String id, @javax.annotation.Nullable String xDaytonaOrganizationID, final ApiCallback _callback) throws ApiException {
        // verify the required parameter 'id' is set
        if (id == null) {
            throw new ApiException("Missing the required parameter 'id' when calling removeSnapshot(Async)");
        }

        return removeSnapshotCall(id, xDaytonaOrganizationID, _callback);

    }

    /**
     * Delete snapshot
     * 
     * @param id Snapshot ID (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> Snapshot has been deleted </td><td>  -  </td></tr>
     </table>
     */
    public void removeSnapshot(@javax.annotation.Nonnull String id, @javax.annotation.Nullable String xDaytonaOrganizationID) throws ApiException {
        removeSnapshotWithHttpInfo(id, xDaytonaOrganizationID);
    }

    /**
     * Delete snapshot
     * 
     * @param id Snapshot ID (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> Snapshot has been deleted </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<Void> removeSnapshotWithHttpInfo(@javax.annotation.Nonnull String id, @javax.annotation.Nullable String xDaytonaOrganizationID) throws ApiException {
        okhttp3.Call localVarCall = removeSnapshotValidateBeforeCall(id, xDaytonaOrganizationID, null);
        return localVarApiClient.execute(localVarCall);
    }

    /**
     * Delete snapshot (asynchronously)
     * 
     * @param id Snapshot ID (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> Snapshot has been deleted </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call removeSnapshotAsync(@javax.annotation.Nonnull String id, @javax.annotation.Nullable String xDaytonaOrganizationID, final ApiCallback<Void> _callback) throws ApiException {

        okhttp3.Call localVarCall = removeSnapshotValidateBeforeCall(id, xDaytonaOrganizationID, _callback);
        localVarApiClient.executeAsync(localVarCall, _callback);
        return localVarCall;
    }
}
