Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* 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.Attachment;
import software.tnb.jira.validation.generated.model.AttachmentArchiveImpl;
import software.tnb.jira.validation.generated.model.AttachmentArchiveMetadataReadable;
import software.tnb.jira.validation.generated.model.AttachmentMetadata;
import software.tnb.jira.validation.generated.model.AttachmentSettings;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class IssueAttachmentsApi {
private ApiClient localVarApiClient;
private int localHostIndex;
private String localCustomBaseUrl;
public IssueAttachmentsApi() {
this(Configuration.getDefaultApiClient());
}
public IssueAttachmentsApi(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 addAttachment
* @param issueIdOrKey The ID or key of the issue that attachments are added to. (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.
-
403
Returned if the user does not have the necessary permission.
-
404
Returned if any of the following is true: * the issue is not found. * the user does not have permission to view the issue.
-
413
The attachments exceed the maximum attachment size for issues. See [Configuring file attachments](https://confluence.atlassian.com/x/wIXKM) for details.
-
*/
public okhttp3.Call addAttachmentCall(String issueIdOrKey, 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/issue/{issueIdOrKey}/attachments"
.replace("{" + "issueIdOrKey" + "}", localVarApiClient.escapeString(issueIdOrKey.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 = {
"multipart/form-data"
};
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, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call addAttachmentValidateBeforeCall(String issueIdOrKey, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'issueIdOrKey' is set
if (issueIdOrKey == null) {
throw new ApiException("Missing the required parameter 'issueIdOrKey' when calling addAttachment(Async)");
}
return addAttachmentCall(issueIdOrKey, _callback);
}
/**
* Add attachment
* Adds one or more attachments to an issue. Attachments are posted as multipart/form-data ([RFC 1867](https://www.ietf.org/rfc/rfc1867.txt)). Note that: * The request must have a `X-Atlassian-Token: no-check` header, if not it is blocked. See [Special headers](#special-request-headers) for more information. * The name of the multipart/form-data parameter that contains the attachments must be `file`. The following examples upload a file called *myfile.txt* to the issue *TEST-123*: #### curl #### curl --location --request POST 'https://your-domain.atlassian.net/rest/api/3/issue/TEST-123/attachments' -u '[email protected]:<api_token>' -H 'X-Atlassian-Token: no-check' --form 'file=@\"myfile.txt\"' #### Node.js #### // This code sample uses the 'node-fetch' and 'form-data' libraries: // https://www.npmjs.com/package/node-fetch // https://www.npmjs.com/package/form-data const fetch = require('node-fetch'); const FormData = require('form-data'); const fs = require('fs'); const filePath = 'myfile.txt'; const form = new FormData(); const stats = fs.statSync(filePath); const fileSizeInBytes = stats.size; const fileStream = fs.createReadStream(filePath); form.append('file', fileStream, {knownLength: fileSizeInBytes}); fetch('https://your-domain.atlassian.net/rest/api/3/issue/TEST-123/attachments', { method: 'POST', body: form, headers: { 'Authorization': `Basic ${Buffer.from( '[email protected]:' ).toString('base64')}`, 'Accept': 'application/json', 'X-Atlassian-Token': 'no-check' } }) .then(response => { console.log( `Response: ${response.status} ${response.statusText}` ); return response.text(); }) .then(text => console.log(text)) .catch(err => console.error(err)); #### Java #### // This code sample uses the 'Unirest' library: // http://unirest.io/java.html HttpResponse response = Unirest.post(\"https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments\") .basicAuth(\"[email protected]\", \"\") .header(\"Accept\", \"application/json\") .header(\"X-Atlassian-Token\", \"no-check\") .field(\"file\", new File(\"myfile.txt\")) .asJson(); System.out.println(response.getBody()); #### Python #### # This code sample uses the 'requests' library: # http://docs.python-requests.org import requests from requests.auth import HTTPBasicAuth import json url = \"https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments\" auth = HTTPBasicAuth(\"[email protected]\", \"\") headers = { \"Accept\": \"application/json\", \"X-Atlassian-Token\": \"no-check\" } response = requests.request( \"POST\", url, headers = headers, auth = auth, files = { \"file\": (\"myfile.txt\", open(\"myfile.txt\",\"rb\"), \"application-type\") } ) print(json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(\",\", \": \"))) #### PHP #### // This code sample uses the 'Unirest' library: // http://unirest.io/php.html Unirest\\Request::auth('[email protected]', ''); $headers = array( 'Accept' => 'application/json', 'X-Atlassian-Token' => 'no-check' ); $parameters = array( 'file' => File::add('myfile.txt') ); $response = Unirest\\Request::post( 'https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments', $headers, $parameters ); var_dump($response) #### Forge #### // This sample uses Atlassian Forge and the `form-data` library. // https://developer.atlassian.com/platform/forge/ // https://www.npmjs.com/package/form-data import api from \"@forge/api\"; import FormData from \"form-data\"; const form = new FormData(); form.append('file', fileStream, {knownLength: fileSizeInBytes}); const response = await api.asApp().requestJira('/rest/api/2/issue/{issueIdOrKey}/attachments', { method: 'POST', body: form, headers: { 'Accept': 'application/json', 'X-Atlassian-Token': 'no-check' } }); console.log(`Response: ${response.status} ${response.statusText}`); console.log(await response.json()); Tip: Use a client library. Many client libraries have classes for handling multipart POST operations. For example, in Java, the Apache HTTP Components library provides a [MultiPartEntity](http://hc.apache.org/httpcomponents-client-ga/httpmime/apidocs/org/apache/http/entity/mime/MultipartEntity.html) class for multipart POST operations. This operation can be accessed anonymously. **[Permissions](#permissions) required:** * *Browse Projects* and *Create attachments* [ project permission](https://confluence.atlassian.com/x/yodKLg) for the project that the issue is in. * If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission to view the issue.
* @param issueIdOrKey The ID or key of the issue that attachments are added to. (required)
* @return List<Attachment>
* @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.
-
403
Returned if the user does not have the necessary permission.
-
404
Returned if any of the following is true: * the issue is not found. * the user does not have permission to view the issue.
-
413
The attachments exceed the maximum attachment size for issues. See [Configuring file attachments](https://confluence.atlassian.com/x/wIXKM) for details.
-
*/
public List addAttachment(String issueIdOrKey) throws ApiException {
ApiResponse> localVarResp = addAttachmentWithHttpInfo(issueIdOrKey);
return localVarResp.getData();
}
/**
* Add attachment
* Adds one or more attachments to an issue. Attachments are posted as multipart/form-data ([RFC 1867](https://www.ietf.org/rfc/rfc1867.txt)). Note that: * The request must have a `X-Atlassian-Token: no-check` header, if not it is blocked. See [Special headers](#special-request-headers) for more information. * The name of the multipart/form-data parameter that contains the attachments must be `file`. The following examples upload a file called *myfile.txt* to the issue *TEST-123*: #### curl #### curl --location --request POST 'https://your-domain.atlassian.net/rest/api/3/issue/TEST-123/attachments' -u '[email protected]:<api_token>' -H 'X-Atlassian-Token: no-check' --form 'file=@\"myfile.txt\"' #### Node.js #### // This code sample uses the 'node-fetch' and 'form-data' libraries: // https://www.npmjs.com/package/node-fetch // https://www.npmjs.com/package/form-data const fetch = require('node-fetch'); const FormData = require('form-data'); const fs = require('fs'); const filePath = 'myfile.txt'; const form = new FormData(); const stats = fs.statSync(filePath); const fileSizeInBytes = stats.size; const fileStream = fs.createReadStream(filePath); form.append('file', fileStream, {knownLength: fileSizeInBytes}); fetch('https://your-domain.atlassian.net/rest/api/3/issue/TEST-123/attachments', { method: 'POST', body: form, headers: { 'Authorization': `Basic ${Buffer.from( '[email protected]:' ).toString('base64')}`, 'Accept': 'application/json', 'X-Atlassian-Token': 'no-check' } }) .then(response => { console.log( `Response: ${response.status} ${response.statusText}` ); return response.text(); }) .then(text => console.log(text)) .catch(err => console.error(err)); #### Java #### // This code sample uses the 'Unirest' library: // http://unirest.io/java.html HttpResponse response = Unirest.post(\"https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments\") .basicAuth(\"[email protected]\", \"\") .header(\"Accept\", \"application/json\") .header(\"X-Atlassian-Token\", \"no-check\") .field(\"file\", new File(\"myfile.txt\")) .asJson(); System.out.println(response.getBody()); #### Python #### # This code sample uses the 'requests' library: # http://docs.python-requests.org import requests from requests.auth import HTTPBasicAuth import json url = \"https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments\" auth = HTTPBasicAuth(\"[email protected]\", \"\") headers = { \"Accept\": \"application/json\", \"X-Atlassian-Token\": \"no-check\" } response = requests.request( \"POST\", url, headers = headers, auth = auth, files = { \"file\": (\"myfile.txt\", open(\"myfile.txt\",\"rb\"), \"application-type\") } ) print(json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(\",\", \": \"))) #### PHP #### // This code sample uses the 'Unirest' library: // http://unirest.io/php.html Unirest\\Request::auth('[email protected]', ''); $headers = array( 'Accept' => 'application/json', 'X-Atlassian-Token' => 'no-check' ); $parameters = array( 'file' => File::add('myfile.txt') ); $response = Unirest\\Request::post( 'https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments', $headers, $parameters ); var_dump($response) #### Forge #### // This sample uses Atlassian Forge and the `form-data` library. // https://developer.atlassian.com/platform/forge/ // https://www.npmjs.com/package/form-data import api from \"@forge/api\"; import FormData from \"form-data\"; const form = new FormData(); form.append('file', fileStream, {knownLength: fileSizeInBytes}); const response = await api.asApp().requestJira('/rest/api/2/issue/{issueIdOrKey}/attachments', { method: 'POST', body: form, headers: { 'Accept': 'application/json', 'X-Atlassian-Token': 'no-check' } }); console.log(`Response: ${response.status} ${response.statusText}`); console.log(await response.json()); Tip: Use a client library. Many client libraries have classes for handling multipart POST operations. For example, in Java, the Apache HTTP Components library provides a [MultiPartEntity](http://hc.apache.org/httpcomponents-client-ga/httpmime/apidocs/org/apache/http/entity/mime/MultipartEntity.html) class for multipart POST operations. This operation can be accessed anonymously. **[Permissions](#permissions) required:** * *Browse Projects* and *Create attachments* [ project permission](https://confluence.atlassian.com/x/yodKLg) for the project that the issue is in. * If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission to view the issue.
* @param issueIdOrKey The ID or key of the issue that attachments are added to. (required)
* @return ApiResponse<List<Attachment>>
* @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.
-
403
Returned if the user does not have the necessary permission.
-
404
Returned if any of the following is true: * the issue is not found. * the user does not have permission to view the issue.
-
413
The attachments exceed the maximum attachment size for issues. See [Configuring file attachments](https://confluence.atlassian.com/x/wIXKM) for details.
-
*/
public ApiResponse> addAttachmentWithHttpInfo(String issueIdOrKey) throws ApiException {
okhttp3.Call localVarCall = addAttachmentValidateBeforeCall(issueIdOrKey, null);
Type localVarReturnType = new TypeToken>(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
}
/**
* Add attachment (asynchronously)
* Adds one or more attachments to an issue. Attachments are posted as multipart/form-data ([RFC 1867](https://www.ietf.org/rfc/rfc1867.txt)). Note that: * The request must have a `X-Atlassian-Token: no-check` header, if not it is blocked. See [Special headers](#special-request-headers) for more information. * The name of the multipart/form-data parameter that contains the attachments must be `file`. The following examples upload a file called *myfile.txt* to the issue *TEST-123*: #### curl #### curl --location --request POST 'https://your-domain.atlassian.net/rest/api/3/issue/TEST-123/attachments' -u '[email protected]:<api_token>' -H 'X-Atlassian-Token: no-check' --form 'file=@\"myfile.txt\"' #### Node.js #### // This code sample uses the 'node-fetch' and 'form-data' libraries: // https://www.npmjs.com/package/node-fetch // https://www.npmjs.com/package/form-data const fetch = require('node-fetch'); const FormData = require('form-data'); const fs = require('fs'); const filePath = 'myfile.txt'; const form = new FormData(); const stats = fs.statSync(filePath); const fileSizeInBytes = stats.size; const fileStream = fs.createReadStream(filePath); form.append('file', fileStream, {knownLength: fileSizeInBytes}); fetch('https://your-domain.atlassian.net/rest/api/3/issue/TEST-123/attachments', { method: 'POST', body: form, headers: { 'Authorization': `Basic ${Buffer.from( '[email protected]:' ).toString('base64')}`, 'Accept': 'application/json', 'X-Atlassian-Token': 'no-check' } }) .then(response => { console.log( `Response: ${response.status} ${response.statusText}` ); return response.text(); }) .then(text => console.log(text)) .catch(err => console.error(err)); #### Java #### // This code sample uses the 'Unirest' library: // http://unirest.io/java.html HttpResponse response = Unirest.post(\"https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments\") .basicAuth(\"[email protected]\", \"\") .header(\"Accept\", \"application/json\") .header(\"X-Atlassian-Token\", \"no-check\") .field(\"file\", new File(\"myfile.txt\")) .asJson(); System.out.println(response.getBody()); #### Python #### # This code sample uses the 'requests' library: # http://docs.python-requests.org import requests from requests.auth import HTTPBasicAuth import json url = \"https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments\" auth = HTTPBasicAuth(\"[email protected]\", \"\") headers = { \"Accept\": \"application/json\", \"X-Atlassian-Token\": \"no-check\" } response = requests.request( \"POST\", url, headers = headers, auth = auth, files = { \"file\": (\"myfile.txt\", open(\"myfile.txt\",\"rb\"), \"application-type\") } ) print(json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(\",\", \": \"))) #### PHP #### // This code sample uses the 'Unirest' library: // http://unirest.io/php.html Unirest\\Request::auth('[email protected]', ''); $headers = array( 'Accept' => 'application/json', 'X-Atlassian-Token' => 'no-check' ); $parameters = array( 'file' => File::add('myfile.txt') ); $response = Unirest\\Request::post( 'https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments', $headers, $parameters ); var_dump($response) #### Forge #### // This sample uses Atlassian Forge and the `form-data` library. // https://developer.atlassian.com/platform/forge/ // https://www.npmjs.com/package/form-data import api from \"@forge/api\"; import FormData from \"form-data\"; const form = new FormData(); form.append('file', fileStream, {knownLength: fileSizeInBytes}); const response = await api.asApp().requestJira('/rest/api/2/issue/{issueIdOrKey}/attachments', { method: 'POST', body: form, headers: { 'Accept': 'application/json', 'X-Atlassian-Token': 'no-check' } }); console.log(`Response: ${response.status} ${response.statusText}`); console.log(await response.json()); Tip: Use a client library. Many client libraries have classes for handling multipart POST operations. For example, in Java, the Apache HTTP Components library provides a [MultiPartEntity](http://hc.apache.org/httpcomponents-client-ga/httpmime/apidocs/org/apache/http/entity/mime/MultipartEntity.html) class for multipart POST operations. This operation can be accessed anonymously. **[Permissions](#permissions) required:** * *Browse Projects* and *Create attachments* [ project permission](https://confluence.atlassian.com/x/yodKLg) for the project that the issue is in. * If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission to view the issue.
* @param issueIdOrKey The ID or key of the issue that attachments are added to. (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.
-
403
Returned if the user does not have the necessary permission.
-
404
Returned if any of the following is true: * the issue is not found. * the user does not have permission to view the issue.
-
413
The attachments exceed the maximum attachment size for issues. See [Configuring file attachments](https://confluence.atlassian.com/x/wIXKM) for details.
-
*/
public okhttp3.Call addAttachmentAsync(String issueIdOrKey, final ApiCallback> _callback) throws ApiException {
okhttp3.Call localVarCall = addAttachmentValidateBeforeCall(issueIdOrKey, _callback);
Type localVarReturnType = new TypeToken>(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
}
/**
* Build call for expandAttachmentForHumans
* @param id The ID of the attachment. (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. If an empty list is returned in the response, the attachment is empty, corrupt, or not an archive.
-
401
Returned if the authentication credentials are incorrect or missing.
-
403
The user does not have the necessary permission.
-
404
Returned if: * the attachment is not found. * attachments are disabled in the Jira settings.
-
409
Returned if the attachment is an archive, but not a supported archive format.
-
*/
public okhttp3.Call expandAttachmentForHumansCall(String id, 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/attachment/{id}/expand/human"
.replace("{" + "id" + "}", localVarApiClient.escapeString(id.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 expandAttachmentForHumansValidateBeforeCall(String id, 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 expandAttachmentForHumans(Async)");
}
return expandAttachmentForHumansCall(id, _callback);
}
/**
* Get all metadata for an expanded attachment
* Returns the metadata for the contents of an attachment, if it is an archive, and metadata for the attachment itself. For example, if the attachment is a ZIP archive, then information about the files in the archive is returned and metadata for the ZIP archive. Currently, only the ZIP archive format is supported. Use this operation to retrieve data that is presented to the user, as this operation returns the metadata for the attachment itself, such as the attachment's ID and name. Otherwise, use [ Get contents metadata for an expanded attachment](#api-rest-api-3-attachment-id-expand-raw-get), which only returns the metadata for the attachment's contents. This operation can be accessed anonymously. **[Permissions](#permissions) required:** For the issue containing the attachment: * *Browse projects* [project permission](https://confluence.atlassian.com/x/yodKLg) for the project that the issue is in. * If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission to view the issue.
* @param id The ID of the attachment. (required)
* @return AttachmentArchiveMetadataReadable
* @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. If an empty list is returned in the response, the attachment is empty, corrupt, or not an archive.
-
401
Returned if the authentication credentials are incorrect or missing.
-
403
The user does not have the necessary permission.
-
404
Returned if: * the attachment is not found. * attachments are disabled in the Jira settings.
-
409
Returned if the attachment is an archive, but not a supported archive format.
-
*/
public AttachmentArchiveMetadataReadable expandAttachmentForHumans(String id) throws ApiException {
ApiResponse localVarResp = expandAttachmentForHumansWithHttpInfo(id);
return localVarResp.getData();
}
/**
* Get all metadata for an expanded attachment
* Returns the metadata for the contents of an attachment, if it is an archive, and metadata for the attachment itself. For example, if the attachment is a ZIP archive, then information about the files in the archive is returned and metadata for the ZIP archive. Currently, only the ZIP archive format is supported. Use this operation to retrieve data that is presented to the user, as this operation returns the metadata for the attachment itself, such as the attachment's ID and name. Otherwise, use [ Get contents metadata for an expanded attachment](#api-rest-api-3-attachment-id-expand-raw-get), which only returns the metadata for the attachment's contents. This operation can be accessed anonymously. **[Permissions](#permissions) required:** For the issue containing the attachment: * *Browse projects* [project permission](https://confluence.atlassian.com/x/yodKLg) for the project that the issue is in. * If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission to view the issue.
* @param id The ID of the attachment. (required)
* @return ApiResponse<AttachmentArchiveMetadataReadable>
* @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. If an empty list is returned in the response, the attachment is empty, corrupt, or not an archive.
-
401
Returned if the authentication credentials are incorrect or missing.
-
403
The user does not have the necessary permission.
-
404
Returned if: * the attachment is not found. * attachments are disabled in the Jira settings.
-
409
Returned if the attachment is an archive, but not a supported archive format.
-
*/
public ApiResponse expandAttachmentForHumansWithHttpInfo(String id) throws ApiException {
okhttp3.Call localVarCall = expandAttachmentForHumansValidateBeforeCall(id, null);
Type localVarReturnType = new TypeToken(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
}
/**
* Get all metadata for an expanded attachment (asynchronously)
* Returns the metadata for the contents of an attachment, if it is an archive, and metadata for the attachment itself. For example, if the attachment is a ZIP archive, then information about the files in the archive is returned and metadata for the ZIP archive. Currently, only the ZIP archive format is supported. Use this operation to retrieve data that is presented to the user, as this operation returns the metadata for the attachment itself, such as the attachment's ID and name. Otherwise, use [ Get contents metadata for an expanded attachment](#api-rest-api-3-attachment-id-expand-raw-get), which only returns the metadata for the attachment's contents. This operation can be accessed anonymously. **[Permissions](#permissions) required:** For the issue containing the attachment: * *Browse projects* [project permission](https://confluence.atlassian.com/x/yodKLg) for the project that the issue is in. * If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission to view the issue.
* @param id The ID of the attachment. (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. If an empty list is returned in the response, the attachment is empty, corrupt, or not an archive.
-
401
Returned if the authentication credentials are incorrect or missing.
-
403
The user does not have the necessary permission.
-
404
Returned if: * the attachment is not found. * attachments are disabled in the Jira settings.
-
409
Returned if the attachment is an archive, but not a supported archive format.
-
*/
public okhttp3.Call expandAttachmentForHumansAsync(String id, final ApiCallback _callback) throws ApiException {
okhttp3.Call localVarCall = expandAttachmentForHumansValidateBeforeCall(id, _callback);
Type localVarReturnType = new TypeToken(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
}
/**
* Build call for expandAttachmentForMachines
* @param id The ID of the attachment. (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. If an empty list is returned in the response, the attachment is empty, corrupt, or not an archive.
-
401
Returned if the authentication credentials are incorrect or missing.
-
403
The user does not have the necessary permission.
-
404
Returned if: * the attachment is not found. * attachments are disabled in the Jira settings.
-
409
Returned if the attachment is an archive, but not a supported archive format.
-
*/
public okhttp3.Call expandAttachmentForMachinesCall(String id, 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/attachment/{id}/expand/raw"
.replace("{" + "id" + "}", localVarApiClient.escapeString(id.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 expandAttachmentForMachinesValidateBeforeCall(String id, 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 expandAttachmentForMachines(Async)");
}
return expandAttachmentForMachinesCall(id, _callback);
}
/**
* Get contents metadata for an expanded attachment
* Returns the metadata for the contents of an attachment, if it is an archive. For example, if the attachment is a ZIP archive, then information about the files in the archive is returned. Currently, only the ZIP archive format is supported. Use this operation if you are processing the data without presenting it to the user, as this operation only returns the metadata for the contents of the attachment. Otherwise, to retrieve data to present to the user, use [ Get all metadata for an expanded attachment](#api-rest-api-3-attachment-id-expand-human-get) which also returns the metadata for the attachment itself, such as the attachment's ID and name. This operation can be accessed anonymously. **[Permissions](#permissions) required:** For the issue containing the attachment: * *Browse projects* [project permission](https://confluence.atlassian.com/x/yodKLg) for the project that the issue is in. * If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission to view the issue.
* @param id The ID of the attachment. (required)
* @return AttachmentArchiveImpl
* @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. If an empty list is returned in the response, the attachment is empty, corrupt, or not an archive.
-
401
Returned if the authentication credentials are incorrect or missing.
-
403
The user does not have the necessary permission.
-
404
Returned if: * the attachment is not found. * attachments are disabled in the Jira settings.
-
409
Returned if the attachment is an archive, but not a supported archive format.
-
*/
public AttachmentArchiveImpl expandAttachmentForMachines(String id) throws ApiException {
ApiResponse localVarResp = expandAttachmentForMachinesWithHttpInfo(id);
return localVarResp.getData();
}
/**
* Get contents metadata for an expanded attachment
* Returns the metadata for the contents of an attachment, if it is an archive. For example, if the attachment is a ZIP archive, then information about the files in the archive is returned. Currently, only the ZIP archive format is supported. Use this operation if you are processing the data without presenting it to the user, as this operation only returns the metadata for the contents of the attachment. Otherwise, to retrieve data to present to the user, use [ Get all metadata for an expanded attachment](#api-rest-api-3-attachment-id-expand-human-get) which also returns the metadata for the attachment itself, such as the attachment's ID and name. This operation can be accessed anonymously. **[Permissions](#permissions) required:** For the issue containing the attachment: * *Browse projects* [project permission](https://confluence.atlassian.com/x/yodKLg) for the project that the issue is in. * If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission to view the issue.
* @param id The ID of the attachment. (required)
* @return ApiResponse<AttachmentArchiveImpl>
* @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. If an empty list is returned in the response, the attachment is empty, corrupt, or not an archive.
-
401
Returned if the authentication credentials are incorrect or missing.
-
403
The user does not have the necessary permission.
-
404
Returned if: * the attachment is not found. * attachments are disabled in the Jira settings.
-
409
Returned if the attachment is an archive, but not a supported archive format.
-
*/
public ApiResponse expandAttachmentForMachinesWithHttpInfo(String id) throws ApiException {
okhttp3.Call localVarCall = expandAttachmentForMachinesValidateBeforeCall(id, null);
Type localVarReturnType = new TypeToken(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
}
/**
* Get contents metadata for an expanded attachment (asynchronously)
* Returns the metadata for the contents of an attachment, if it is an archive. For example, if the attachment is a ZIP archive, then information about the files in the archive is returned. Currently, only the ZIP archive format is supported. Use this operation if you are processing the data without presenting it to the user, as this operation only returns the metadata for the contents of the attachment. Otherwise, to retrieve data to present to the user, use [ Get all metadata for an expanded attachment](#api-rest-api-3-attachment-id-expand-human-get) which also returns the metadata for the attachment itself, such as the attachment's ID and name. This operation can be accessed anonymously. **[Permissions](#permissions) required:** For the issue containing the attachment: * *Browse projects* [project permission](https://confluence.atlassian.com/x/yodKLg) for the project that the issue is in. * If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission to view the issue.
* @param id The ID of the attachment. (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. If an empty list is returned in the response, the attachment is empty, corrupt, or not an archive.
-
401
Returned if the authentication credentials are incorrect or missing.
-
403
The user does not have the necessary permission.
-
404
Returned if: * the attachment is not found. * attachments are disabled in the Jira settings.
-
409
Returned if the attachment is an archive, but not a supported archive format.
-
*/
public okhttp3.Call expandAttachmentForMachinesAsync(String id, final ApiCallback _callback) throws ApiException {
okhttp3.Call localVarCall = expandAttachmentForMachinesValidateBeforeCall(id, _callback);
Type localVarReturnType = new TypeToken(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
}
/**
* Build call for getAttachment
* @param id The ID of the attachment. (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 the necessary permission.
-
404
Returned if: * the attachment is not found. * attachments are disabled in the Jira settings.
-
*/
public okhttp3.Call getAttachmentCall(String id, 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/attachment/{id}"
.replace("{" + "id" + "}", localVarApiClient.escapeString(id.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 getAttachmentValidateBeforeCall(String id, 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 getAttachment(Async)");
}
return getAttachmentCall(id, _callback);
}
/**
* Get attachment metadata
* Returns the metadata for an attachment. Note that the attachment itself is not returned. This operation can be accessed anonymously. **[Permissions](#permissions) required:** * *Browse projects* [project permission](https://confluence.atlassian.com/x/yodKLg) for the project that the issue is in. * If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission to view the issue.
* @param id The ID of the attachment. (required)
* @return AttachmentMetadata
* @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 the necessary permission.
-
404
Returned if: * the attachment is not found. * attachments are disabled in the Jira settings.
-
*/
public AttachmentMetadata getAttachment(String id) throws ApiException {
ApiResponse localVarResp = getAttachmentWithHttpInfo(id);
return localVarResp.getData();
}
/**
* Get attachment metadata
* Returns the metadata for an attachment. Note that the attachment itself is not returned. This operation can be accessed anonymously. **[Permissions](#permissions) required:** * *Browse projects* [project permission](https://confluence.atlassian.com/x/yodKLg) for the project that the issue is in. * If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission to view the issue.
* @param id The ID of the attachment. (required)
* @return ApiResponse<AttachmentMetadata>
* @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 the necessary permission.
-
404
Returned if: * the attachment is not found. * attachments are disabled in the Jira settings.
-
*/
public ApiResponse getAttachmentWithHttpInfo(String id) throws ApiException {
okhttp3.Call localVarCall = getAttachmentValidateBeforeCall(id, null);
Type localVarReturnType = new TypeToken(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
}
/**
* Get attachment metadata (asynchronously)
* Returns the metadata for an attachment. Note that the attachment itself is not returned. This operation can be accessed anonymously. **[Permissions](#permissions) required:** * *Browse projects* [project permission](https://confluence.atlassian.com/x/yodKLg) for the project that the issue is in. * If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission to view the issue.
* @param id The ID of the attachment. (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 the necessary permission.
-
404
Returned if: * the attachment is not found. * attachments are disabled in the Jira settings.
-
*/
public okhttp3.Call getAttachmentAsync(String id, final ApiCallback _callback) throws ApiException {
okhttp3.Call localVarCall = getAttachmentValidateBeforeCall(id, _callback);
Type localVarReturnType = new TypeToken(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
}
/**
* Build call for getAttachmentContent
* @param id The ID of the attachment. (required)
* @param redirect Whether a redirect is provided for the attachment download. Clients that do not automatically follow redirects can set this to `false` to avoid making multiple requests to download the attachment. (optional, default to true)
* @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 when `redirect` is set to `false`.
-
206
Returned if the request is successful when a `Range` header is provided and `redirect` is set to `false`.
-
303
Returned if the request is successful. See the `Location` header for the download URL.
-
400
Returned if the range supplied in the `Range` header is malformed.
-
401
Returned if the authentication credentials are incorrect.
-
403
The user does not have the necessary permission.
-
404
Returned if: * the attachment is not found. * attachments are disabled in the Jira settings.
-
416
Returned if the server is unable to satisfy the range of bytes provided.
-
*/
public okhttp3.Call getAttachmentContentCall(String id, Boolean redirect, 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/attachment/content/{id}"
.replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString()));
List localVarQueryParams = new ArrayList();
List localVarCollectionQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarCookieParams = new HashMap();
Map localVarFormParams = new HashMap();
if (redirect != null) {
localVarQueryParams.addAll(localVarApiClient.parameterToPair("redirect", redirect));
}
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 getAttachmentContentValidateBeforeCall(String id, Boolean redirect, 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 getAttachmentContent(Async)");
}
return getAttachmentContentCall(id, redirect, _callback);
}
/**
* Get attachment content
* Returns the contents of an attachment. A `Range` header can be set to define a range of bytes within the attachment to download. See the [HTTP Range header standard](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Range) for details. To return a thumbnail of the attachment, use [Get attachment thumbnail](#api-rest-api-3-attachment-thumbnail-id-get). This operation can be accessed anonymously. **[Permissions](#permissions) required:** For the issue containing the attachment: * *Browse projects* [project permission](https://confluence.atlassian.com/x/yodKLg) for the project that the issue is in. * If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission to view the issue.
* @param id The ID of the attachment. (required)
* @param redirect Whether a redirect is provided for the attachment download. Clients that do not automatically follow redirects can set this to `false` to avoid making multiple requests to download the attachment. (optional, default to true)
* @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
200
Returned if the request is successful when `redirect` is set to `false`.
-
206
Returned if the request is successful when a `Range` header is provided and `redirect` is set to `false`.
-
303
Returned if the request is successful. See the `Location` header for the download URL.
-
400
Returned if the range supplied in the `Range` header is malformed.
-
401
Returned if the authentication credentials are incorrect.
-
403
The user does not have the necessary permission.
-
404
Returned if: * the attachment is not found. * attachments are disabled in the Jira settings.
-
416
Returned if the server is unable to satisfy the range of bytes provided.