/*
 * 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.CreateDockerRegistry;
import io.daytona.api.client.model.DockerRegistry;
import io.daytona.api.client.model.RegistryPushAccessDto;
import io.daytona.api.client.model.UpdateDockerRegistry;

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

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

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

    public DockerRegistryApi(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 createRegistry
     * @param createDockerRegistry  (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> 201 </td><td> The docker registry has been successfully created. </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call createRegistryCall(@javax.annotation.Nonnull CreateDockerRegistry createDockerRegistry, @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 = createDockerRegistry;

        // create path and map variables
        String localVarPath = "/docker-registry";

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

        return createRegistryCall(createDockerRegistry, xDaytonaOrganizationID, _callback);

    }

    /**
     * Create registry
     * 
     * @param createDockerRegistry  (required)
     * @param xDaytonaOrganizationID Use with JWT to specify the organization ID (optional)
     * @return DockerRegistry
     * @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> 201 </td><td> The docker registry has been successfully created. </td><td>  -  </td></tr>
     </table>
     */
    public DockerRegistry createRegistry(@javax.annotation.Nonnull CreateDockerRegistry createDockerRegistry, @javax.annotation.Nullable String xDaytonaOrganizationID) throws ApiException {
        ApiResponse<DockerRegistry> localVarResp = createRegistryWithHttpInfo(createDockerRegistry, xDaytonaOrganizationID);
        return localVarResp.getData();
    }

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

    /**
     * Create registry (asynchronously)
     * 
     * @param createDockerRegistry  (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> 201 </td><td> The docker registry has been successfully created. </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call createRegistryAsync(@javax.annotation.Nonnull CreateDockerRegistry createDockerRegistry, @javax.annotation.Nullable String xDaytonaOrganizationID, final ApiCallback<DockerRegistry> _callback) throws ApiException {

        okhttp3.Call localVarCall = createRegistryValidateBeforeCall(createDockerRegistry, xDaytonaOrganizationID, _callback);
        Type localVarReturnType = new TypeToken<DockerRegistry>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }
    /**
     * Build call for deleteRegistry
     * @param id ID of the docker registry (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 docker registry has been successfully deleted. </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call deleteRegistryCall(@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 = "/docker-registry/{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 deleteRegistryValidateBeforeCall(@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 deleteRegistry(Async)");
        }

        return deleteRegistryCall(id, xDaytonaOrganizationID, _callback);

    }

    /**
     * Delete registry
     * 
     * @param id ID of the docker registry (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 docker registry has been successfully deleted. </td><td>  -  </td></tr>
     </table>
     */
    public void deleteRegistry(@javax.annotation.Nonnull String id, @javax.annotation.Nullable String xDaytonaOrganizationID) throws ApiException {
        deleteRegistryWithHttpInfo(id, xDaytonaOrganizationID);
    }

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

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

        okhttp3.Call localVarCall = deleteRegistryValidateBeforeCall(id, xDaytonaOrganizationID, _callback);
        localVarApiClient.executeAsync(localVarCall, _callback);
        return localVarCall;
    }
    /**
     * Build call for getRegistry
     * @param id ID of the docker registry (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 docker registry </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call getRegistryCall(@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 = "/docker-registry/{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 getRegistryValidateBeforeCall(@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 getRegistry(Async)");
        }

        return getRegistryCall(id, xDaytonaOrganizationID, _callback);

    }

    /**
     * Get registry
     * 
     * @param id ID of the docker registry (required)
     * @param xDaytonaOrganizationID Use with JWT to specify the organization ID (optional)
     * @return DockerRegistry
     * @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 docker registry </td><td>  -  </td></tr>
     </table>
     */
    public DockerRegistry getRegistry(@javax.annotation.Nonnull String id, @javax.annotation.Nullable String xDaytonaOrganizationID) throws ApiException {
        ApiResponse<DockerRegistry> localVarResp = getRegistryWithHttpInfo(id, xDaytonaOrganizationID);
        return localVarResp.getData();
    }

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

    /**
     * Get registry (asynchronously)
     * 
     * @param id ID of the docker registry (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 docker registry </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call getRegistryAsync(@javax.annotation.Nonnull String id, @javax.annotation.Nullable String xDaytonaOrganizationID, final ApiCallback<DockerRegistry> _callback) throws ApiException {

        okhttp3.Call localVarCall = getRegistryValidateBeforeCall(id, xDaytonaOrganizationID, _callback);
        Type localVarReturnType = new TypeToken<DockerRegistry>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }
    /**
     * Build call for getTransientPushAccess
     * @param xDaytonaOrganizationID Use with JWT to specify the organization ID (optional)
     * @param regionId ID of the region where the snapshot will be available (defaults to organization default region) (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> Temporary registry access has been generated </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call getTransientPushAccessCall(@javax.annotation.Nullable String xDaytonaOrganizationID, @javax.annotation.Nullable String regionId, 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 = "/docker-registry/registry-push-access";

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

        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 getTransientPushAccessValidateBeforeCall(@javax.annotation.Nullable String xDaytonaOrganizationID, @javax.annotation.Nullable String regionId, final ApiCallback _callback) throws ApiException {
        return getTransientPushAccessCall(xDaytonaOrganizationID, regionId, _callback);

    }

    /**
     * Get temporary registry access for pushing snapshots
     * 
     * @param xDaytonaOrganizationID Use with JWT to specify the organization ID (optional)
     * @param regionId ID of the region where the snapshot will be available (defaults to organization default region) (optional)
     * @return RegistryPushAccessDto
     * @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> Temporary registry access has been generated </td><td>  -  </td></tr>
     </table>
     */
    public RegistryPushAccessDto getTransientPushAccess(@javax.annotation.Nullable String xDaytonaOrganizationID, @javax.annotation.Nullable String regionId) throws ApiException {
        ApiResponse<RegistryPushAccessDto> localVarResp = getTransientPushAccessWithHttpInfo(xDaytonaOrganizationID, regionId);
        return localVarResp.getData();
    }

    /**
     * Get temporary registry access for pushing snapshots
     * 
     * @param xDaytonaOrganizationID Use with JWT to specify the organization ID (optional)
     * @param regionId ID of the region where the snapshot will be available (defaults to organization default region) (optional)
     * @return ApiResponse&lt;RegistryPushAccessDto&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> Temporary registry access has been generated </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<RegistryPushAccessDto> getTransientPushAccessWithHttpInfo(@javax.annotation.Nullable String xDaytonaOrganizationID, @javax.annotation.Nullable String regionId) throws ApiException {
        okhttp3.Call localVarCall = getTransientPushAccessValidateBeforeCall(xDaytonaOrganizationID, regionId, null);
        Type localVarReturnType = new TypeToken<RegistryPushAccessDto>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    /**
     * Get temporary registry access for pushing snapshots (asynchronously)
     * 
     * @param xDaytonaOrganizationID Use with JWT to specify the organization ID (optional)
     * @param regionId ID of the region where the snapshot will be available (defaults to organization default region) (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> Temporary registry access has been generated </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call getTransientPushAccessAsync(@javax.annotation.Nullable String xDaytonaOrganizationID, @javax.annotation.Nullable String regionId, final ApiCallback<RegistryPushAccessDto> _callback) throws ApiException {

        okhttp3.Call localVarCall = getTransientPushAccessValidateBeforeCall(xDaytonaOrganizationID, regionId, _callback);
        Type localVarReturnType = new TypeToken<RegistryPushAccessDto>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }
    /**
     * Build call for listRegistries
     * @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> List of all docker registries </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call listRegistriesCall(@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 = "/docker-registry";

        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 listRegistriesValidateBeforeCall(@javax.annotation.Nullable String xDaytonaOrganizationID, final ApiCallback _callback) throws ApiException {
        return listRegistriesCall(xDaytonaOrganizationID, _callback);

    }

    /**
     * List registries
     * 
     * @param xDaytonaOrganizationID Use with JWT to specify the organization ID (optional)
     * @return List&lt;DockerRegistry&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 docker registries </td><td>  -  </td></tr>
     </table>
     */
    public List<DockerRegistry> listRegistries(@javax.annotation.Nullable String xDaytonaOrganizationID) throws ApiException {
        ApiResponse<List<DockerRegistry>> localVarResp = listRegistriesWithHttpInfo(xDaytonaOrganizationID);
        return localVarResp.getData();
    }

    /**
     * List registries
     * 
     * @param xDaytonaOrganizationID Use with JWT to specify the organization ID (optional)
     * @return ApiResponse&lt;List&lt;DockerRegistry&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 docker registries </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<List<DockerRegistry>> listRegistriesWithHttpInfo(@javax.annotation.Nullable String xDaytonaOrganizationID) throws ApiException {
        okhttp3.Call localVarCall = listRegistriesValidateBeforeCall(xDaytonaOrganizationID, null);
        Type localVarReturnType = new TypeToken<List<DockerRegistry>>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    /**
     * List registries (asynchronously)
     * 
     * @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> List of all docker registries </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call listRegistriesAsync(@javax.annotation.Nullable String xDaytonaOrganizationID, final ApiCallback<List<DockerRegistry>> _callback) throws ApiException {

        okhttp3.Call localVarCall = listRegistriesValidateBeforeCall(xDaytonaOrganizationID, _callback);
        Type localVarReturnType = new TypeToken<List<DockerRegistry>>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }
    /**
     * Build call for updateRegistry
     * @param id ID of the docker registry (required)
     * @param updateDockerRegistry  (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 docker registry has been successfully updated. </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call updateRegistryCall(@javax.annotation.Nonnull String id, @javax.annotation.Nonnull UpdateDockerRegistry updateDockerRegistry, @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 = updateDockerRegistry;

        // create path and map variables
        String localVarPath = "/docker-registry/{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 = {
            "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, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call updateRegistryValidateBeforeCall(@javax.annotation.Nonnull String id, @javax.annotation.Nonnull UpdateDockerRegistry updateDockerRegistry, @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 updateRegistry(Async)");
        }

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

        return updateRegistryCall(id, updateDockerRegistry, xDaytonaOrganizationID, _callback);

    }

    /**
     * Update registry
     * 
     * @param id ID of the docker registry (required)
     * @param updateDockerRegistry  (required)
     * @param xDaytonaOrganizationID Use with JWT to specify the organization ID (optional)
     * @return DockerRegistry
     * @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 docker registry has been successfully updated. </td><td>  -  </td></tr>
     </table>
     */
    public DockerRegistry updateRegistry(@javax.annotation.Nonnull String id, @javax.annotation.Nonnull UpdateDockerRegistry updateDockerRegistry, @javax.annotation.Nullable String xDaytonaOrganizationID) throws ApiException {
        ApiResponse<DockerRegistry> localVarResp = updateRegistryWithHttpInfo(id, updateDockerRegistry, xDaytonaOrganizationID);
        return localVarResp.getData();
    }

    /**
     * Update registry
     * 
     * @param id ID of the docker registry (required)
     * @param updateDockerRegistry  (required)
     * @param xDaytonaOrganizationID Use with JWT to specify the organization ID (optional)
     * @return ApiResponse&lt;DockerRegistry&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 docker registry has been successfully updated. </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<DockerRegistry> updateRegistryWithHttpInfo(@javax.annotation.Nonnull String id, @javax.annotation.Nonnull UpdateDockerRegistry updateDockerRegistry, @javax.annotation.Nullable String xDaytonaOrganizationID) throws ApiException {
        okhttp3.Call localVarCall = updateRegistryValidateBeforeCall(id, updateDockerRegistry, xDaytonaOrganizationID, null);
        Type localVarReturnType = new TypeToken<DockerRegistry>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    /**
     * Update registry (asynchronously)
     * 
     * @param id ID of the docker registry (required)
     * @param updateDockerRegistry  (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 docker registry has been successfully updated. </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call updateRegistryAsync(@javax.annotation.Nonnull String id, @javax.annotation.Nonnull UpdateDockerRegistry updateDockerRegistry, @javax.annotation.Nullable String xDaytonaOrganizationID, final ApiCallback<DockerRegistry> _callback) throws ApiException {

        okhttp3.Call localVarCall = updateRegistryValidateBeforeCall(id, updateDockerRegistry, xDaytonaOrganizationID, _callback);
        Type localVarReturnType = new TypeToken<DockerRegistry>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }
}
