All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.tnb.jira.validation.generated.api.ProjectEmailApi Maven / Gradle / Ivy

The newest version!
/*
 * The Jira Cloud platform REST API
 * Jira Cloud platform REST API documentation
 *
 * The version of the OpenAPI document: 1001.0.0-SNAPSHOT
 * Contact: [email protected]
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */


package software.tnb.jira.validation.generated.api;

import software.tnb.jira.validation.generated.ApiCallback;
import software.tnb.jira.validation.generated.ApiClient;
import software.tnb.jira.validation.generated.ApiException;
import software.tnb.jira.validation.generated.ApiResponse;
import software.tnb.jira.validation.generated.Configuration;
import software.tnb.jira.validation.generated.Pair;
import software.tnb.jira.validation.generated.ProgressRequestBody;
import software.tnb.jira.validation.generated.ProgressResponseBody;

import com.google.gson.reflect.TypeToken;

import java.io.IOException;


import software.tnb.jira.validation.generated.model.ProjectEmailAddress;

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

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

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

    public ProjectEmailApi(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 getProjectEmail
     * @param projectId The project ID. (required)
     * @param _callback Callback for upload/download progress
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     * @http.response.details
     
Status Code Description Response Headers
200 Returned if the request is successful. -
401 Returned if the authentication credentials are incorrect or missing. -
403 Returned if the user does not have permission to read project. -
404 Returned if the project or project's sender email address is not found. -
*/ public okhttp3.Call getProjectEmailCall(Long projectId, 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 = "/rest/api/3/project/{projectId}/email" .replace("{" + "projectId" + "}", localVarApiClient.escapeString(projectId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); Map localVarHeaderParams = new HashMap(); Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); 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); } String[] localVarAuthNames = new String[] { "OAuth2", "basicAuth" }; return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") private okhttp3.Call getProjectEmailValidateBeforeCall(Long projectId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'projectId' is set if (projectId == null) { throw new ApiException("Missing the required parameter 'projectId' when calling getProjectEmail(Async)"); } return getProjectEmailCall(projectId, _callback); } /** * Get project's sender email * Returns the [project's sender email address](https://confluence.atlassian.com/x/dolKLg). **[Permissions](#permissions) required:** *Browse projects* [project permission](https://confluence.atlassian.com/x/yodKLg) for the project. * @param projectId The project ID. (required) * @return ProjectEmailAddress * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details
Status Code Description Response Headers
200 Returned if the request is successful. -
401 Returned if the authentication credentials are incorrect or missing. -
403 Returned if the user does not have permission to read project. -
404 Returned if the project or project's sender email address is not found. -
*/ public ProjectEmailAddress getProjectEmail(Long projectId) throws ApiException { ApiResponse localVarResp = getProjectEmailWithHttpInfo(projectId); return localVarResp.getData(); } /** * Get project's sender email * Returns the [project's sender email address](https://confluence.atlassian.com/x/dolKLg). **[Permissions](#permissions) required:** *Browse projects* [project permission](https://confluence.atlassian.com/x/yodKLg) for the project. * @param projectId The project ID. (required) * @return ApiResponse<ProjectEmailAddress> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details
Status Code Description Response Headers
200 Returned if the request is successful. -
401 Returned if the authentication credentials are incorrect or missing. -
403 Returned if the user does not have permission to read project. -
404 Returned if the project or project's sender email address is not found. -
*/ public ApiResponse getProjectEmailWithHttpInfo(Long projectId) throws ApiException { okhttp3.Call localVarCall = getProjectEmailValidateBeforeCall(projectId, null); Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** * Get project's sender email (asynchronously) * Returns the [project's sender email address](https://confluence.atlassian.com/x/dolKLg). **[Permissions](#permissions) required:** *Browse projects* [project permission](https://confluence.atlassian.com/x/yodKLg) for the project. * @param projectId The project ID. (required) * @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
Status Code Description Response Headers
200 Returned if the request is successful. -
401 Returned if the authentication credentials are incorrect or missing. -
403 Returned if the user does not have permission to read project. -
404 Returned if the project or project's sender email address is not found. -
*/ public okhttp3.Call getProjectEmailAsync(Long projectId, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = getProjectEmailValidateBeforeCall(projectId, _callback); Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for updateProjectEmail * @param projectId The project ID. (required) * @param projectEmailAddress The project's sender email address to be set. (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details
Status Code Description Response Headers
204 Returned if the project's sender email address is successfully set. -
400 Returned if the request is not valid, if the email address is not valid. -
401 Returned if the authentication credentials are incorrect or missing. -
403 Returned if the user does not have permission to read project. -
404 Returned if the project is not found. -
*/ public okhttp3.Call updateProjectEmailCall(Long projectId, ProjectEmailAddress projectEmailAddress, 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 = projectEmailAddress; // create path and map variables String localVarPath = "/rest/api/3/project/{projectId}/email" .replace("{" + "projectId" + "}", localVarApiClient.escapeString(projectId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); Map localVarHeaderParams = new HashMap(); Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); 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); } String[] localVarAuthNames = new String[] { "OAuth2", "basicAuth" }; return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") private okhttp3.Call updateProjectEmailValidateBeforeCall(Long projectId, ProjectEmailAddress projectEmailAddress, final ApiCallback _callback) throws ApiException { // verify the required parameter 'projectId' is set if (projectId == null) { throw new ApiException("Missing the required parameter 'projectId' when calling updateProjectEmail(Async)"); } // verify the required parameter 'projectEmailAddress' is set if (projectEmailAddress == null) { throw new ApiException("Missing the required parameter 'projectEmailAddress' when calling updateProjectEmail(Async)"); } return updateProjectEmailCall(projectId, projectEmailAddress, _callback); } /** * Set project's sender email * Sets the [project's sender email address](https://confluence.atlassian.com/x/dolKLg). If `emailAddress` is an empty string, the default email address is restored. **[Permissions](#permissions) required:** *Browse projects* [project permission](https://confluence.atlassian.com/x/yodKLg) for the project. * @param projectId The project ID. (required) * @param projectEmailAddress The project's sender email address to be set. (required) * @return Object * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details
Status Code Description Response Headers
204 Returned if the project's sender email address is successfully set. -
400 Returned if the request is not valid, if the email address is not valid. -
401 Returned if the authentication credentials are incorrect or missing. -
403 Returned if the user does not have permission to read project. -
404 Returned if the project is not found. -
*/ public Object updateProjectEmail(Long projectId, ProjectEmailAddress projectEmailAddress) throws ApiException { ApiResponse localVarResp = updateProjectEmailWithHttpInfo(projectId, projectEmailAddress); return localVarResp.getData(); } /** * Set project's sender email * Sets the [project's sender email address](https://confluence.atlassian.com/x/dolKLg). If `emailAddress` is an empty string, the default email address is restored. **[Permissions](#permissions) required:** *Browse projects* [project permission](https://confluence.atlassian.com/x/yodKLg) for the project. * @param projectId The project ID. (required) * @param projectEmailAddress The project's sender email address to be set. (required) * @return ApiResponse<Object> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details
Status Code Description Response Headers
204 Returned if the project's sender email address is successfully set. -
400 Returned if the request is not valid, if the email address is not valid. -
401 Returned if the authentication credentials are incorrect or missing. -
403 Returned if the user does not have permission to read project. -
404 Returned if the project is not found. -
*/ public ApiResponse updateProjectEmailWithHttpInfo(Long projectId, ProjectEmailAddress projectEmailAddress) throws ApiException { okhttp3.Call localVarCall = updateProjectEmailValidateBeforeCall(projectId, projectEmailAddress, null); Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** * Set project's sender email (asynchronously) * Sets the [project's sender email address](https://confluence.atlassian.com/x/dolKLg). If `emailAddress` is an empty string, the default email address is restored. **[Permissions](#permissions) required:** *Browse projects* [project permission](https://confluence.atlassian.com/x/yodKLg) for the project. * @param projectId The project ID. (required) * @param projectEmailAddress The project's sender email address to be set. (required) * @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
Status Code Description Response Headers
204 Returned if the project's sender email address is successfully set. -
400 Returned if the request is not valid, if the email address is not valid. -
401 Returned if the authentication credentials are incorrect or missing. -
403 Returned if the user does not have permission to read project. -
404 Returned if the project is not found. -
*/ public okhttp3.Call updateProjectEmailAsync(Long projectId, ProjectEmailAddress projectEmailAddress, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = updateProjectEmailValidateBeforeCall(projectId, projectEmailAddress, _callback); Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } }