@resolution/jira-api-client 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/package.json +10 -3
- package/.eslintrc.js +0 -3
- package/config/api-typescript-generator.config.ts +0 -91
- package/config/compare-schemas.ts +0 -307
- package/src/index.ts +0 -47
- package/src/openapi/platform/base-jira-platform-api-client.ts +0 -2298
- package/src/openapi/platform/core/common-http-client.ts +0 -723
- package/src/openapi/platform/core/common-http-service.ts +0 -22
- package/src/openapi/platform/core/common-validation-schema-storage.ts +0 -105
- package/src/openapi/platform/models/announcement-banner.ts +0 -59
- package/src/openapi/platform/models/app-data-policies.ts +0 -79
- package/src/openapi/platform/models/app-migration.ts +0 -172
- package/src/openapi/platform/models/app-properties.ts +0 -32
- package/src/openapi/platform/models/audit-records.ts +0 -140
- package/src/openapi/platform/models/avatars.ts +0 -48
- package/src/openapi/platform/models/classification-levels.ts +0 -58
- package/src/openapi/platform/models/common.ts +0 -2669
- package/src/openapi/platform/models/dashboards.ts +0 -849
- package/src/openapi/platform/models/dynamic-modules.ts +0 -121
- package/src/openapi/platform/models/filter-sharing.ts +0 -103
- package/src/openapi/platform/models/filters.ts +0 -319
- package/src/openapi/platform/models/group-and-user-picker.ts +0 -85
- package/src/openapi/platform/models/groups.ts +0 -247
- package/src/openapi/platform/models/issue-attachments.ts +0 -290
- package/src/openapi/platform/models/issue-comment-properties.ts +0 -27
- package/src/openapi/platform/models/issue-comments.ts +0 -91
- package/src/openapi/platform/models/issue-custom-field-configuration-apps.ts +0 -96
- package/src/openapi/platform/models/issue-custom-field-contexts.ts +0 -1072
- package/src/openapi/platform/models/issue-custom-field-options-apps.ts +0 -273
- package/src/openapi/platform/models/issue-custom-field-options.ts +0 -283
- package/src/openapi/platform/models/issue-custom-field-values-apps.ts +0 -118
- package/src/openapi/platform/models/issue-field-configurations.ts +0 -435
- package/src/openapi/platform/models/issue-fields.ts +0 -392
- package/src/openapi/platform/models/issue-link-types.ts +0 -28
- package/src/openapi/platform/models/issue-links.ts +0 -185
- package/src/openapi/platform/models/issue-notification-schemes.ts +0 -370
- package/src/openapi/platform/models/issue-priorities.ts +0 -196
- package/src/openapi/platform/models/issue-properties.ts +0 -259
- package/src/openapi/platform/models/issue-remote-links.ts +0 -207
- package/src/openapi/platform/models/issue-resolutions.ts +0 -180
- package/src/openapi/platform/models/issue-search.ts +0 -367
- package/src/openapi/platform/models/issue-security-level.ts +0 -76
- package/src/openapi/platform/models/issue-security-schemes.ts +0 -496
- package/src/openapi/platform/models/issue-type-schemes.ts +0 -290
- package/src/openapi/platform/models/issue-type-screen-schemes.ts +0 -286
- package/src/openapi/platform/models/issue-types.ts +0 -66
- package/src/openapi/platform/models/issue-votes.ts +0 -38
- package/src/openapi/platform/models/issue-watchers.ts +0 -67
- package/src/openapi/platform/models/issue-worklogs.ts +0 -190
- package/src/openapi/platform/models/issues.ts +0 -1268
- package/src/openapi/platform/models/jira-expressions.ts +0 -578
- package/src/openapi/platform/models/jira-settings.ts +0 -118
- package/src/openapi/platform/models/jql-functions-apps.ts +0 -128
- package/src/openapi/platform/models/jql.ts +0 -783
- package/src/openapi/platform/models/labels.ts +0 -42
- package/src/openapi/platform/models/license-metrics.ts +0 -68
- package/src/openapi/platform/models/myself.ts +0 -29
- package/src/openapi/platform/models/permission-schemes.ts +0 -89
- package/src/openapi/platform/models/permissions.ts +0 -308
- package/src/openapi/platform/models/priority-schemes.ts +0 -527
- package/src/openapi/platform/models/project-avatars.ts +0 -29
- package/src/openapi/platform/models/project-classification-levels.ts +0 -24
- package/src/openapi/platform/models/project-components.ts +0 -231
- package/src/openapi/platform/models/project-email.ts +0 -27
- package/src/openapi/platform/models/project-features.ts +0 -78
- package/src/openapi/platform/models/project-permission-schemes.ts +0 -43
- package/src/openapi/platform/models/project-role-actors.ts +0 -107
- package/src/openapi/platform/models/project-roles.ts +0 -76
- package/src/openapi/platform/models/project-types.ts +0 -36
- package/src/openapi/platform/models/project-versions.ts +0 -216
- package/src/openapi/platform/models/projects.ts +0 -429
- package/src/openapi/platform/models/screen-schemes.ts +0 -192
- package/src/openapi/platform/models/screen-tab-fields.ts +0 -45
- package/src/openapi/platform/models/screens.ts +0 -171
- package/src/openapi/platform/models/server-info.ts +0 -100
- package/src/openapi/platform/models/service-registry.ts +0 -68
- package/src/openapi/platform/models/status.ts +0 -229
- package/src/openapi/platform/models/time-tracking.ts +0 -38
- package/src/openapi/platform/models/ui-modifications-apps.ts +0 -229
- package/src/openapi/platform/models/user-search.ts +0 -69
- package/src/openapi/platform/models/users.ts +0 -121
- package/src/openapi/platform/models/webhooks.ts +0 -307
- package/src/openapi/platform/models/workflow-scheme-drafts.ts +0 -58
- package/src/openapi/platform/models/workflow-scheme-project-associations.ts +0 -68
- package/src/openapi/platform/models/workflow-schemes.ts +0 -545
- package/src/openapi/platform/models/workflow-transition-properties.ts +0 -33
- package/src/openapi/platform/models/workflow-transition-rules.ts +0 -261
- package/src/openapi/platform/models/workflows.ts +0 -1943
- package/src/openapi/platform/services/announcement-banner-service.ts +0 -142
- package/src/openapi/platform/services/app-data-policies-service.ts +0 -136
- package/src/openapi/platform/services/app-migration-service.ts +0 -289
- package/src/openapi/platform/services/app-properties-service.ts +0 -441
- package/src/openapi/platform/services/application-roles-service.ts +0 -247
- package/src/openapi/platform/services/audit-records-service.ts +0 -164
- package/src/openapi/platform/services/avatars-service.ts +0 -769
- package/src/openapi/platform/services/classification-levels-service.ts +0 -131
- package/src/openapi/platform/services/dashboards-service.ts +0 -1721
- package/src/openapi/platform/services/dynamic-modules-service.ts +0 -127
- package/src/openapi/platform/services/filter-sharing-service.ts +0 -687
- package/src/openapi/platform/services/filters-service.ts +0 -1901
- package/src/openapi/platform/services/group-and-user-picker-service.ts +0 -224
- package/src/openapi/platform/services/groups-service.ts +0 -751
- package/src/openapi/platform/services/issue-attachments-service.ts +0 -900
- package/src/openapi/platform/services/issue-comment-properties-service.ts +0 -324
- package/src/openapi/platform/services/issue-comments-service.ts +0 -812
- package/src/openapi/platform/services/issue-custom-field-configuration-apps-service.ts +0 -277
- package/src/openapi/platform/services/issue-custom-field-contexts-service.ts +0 -1339
- package/src/openapi/platform/services/issue-custom-field-options-apps-service.ts +0 -994
- package/src/openapi/platform/services/issue-custom-field-options-service.ts +0 -651
- package/src/openapi/platform/services/issue-custom-field-values-apps-service.ts +0 -201
- package/src/openapi/platform/services/issue-field-configurations-service.ts +0 -1294
- package/src/openapi/platform/services/issue-fields-service.ts +0 -837
- package/src/openapi/platform/services/issue-link-types-service.ts +0 -360
- package/src/openapi/platform/services/issue-links-service.ts +0 -345
- package/src/openapi/platform/services/issue-navigator-settings-service.ts +0 -119
- package/src/openapi/platform/services/issue-notification-schemes-service.ts +0 -1209
- package/src/openapi/platform/services/issue-priorities-service.ts +0 -575
- package/src/openapi/platform/services/issue-properties-service.ts +0 -606
- package/src/openapi/platform/services/issue-remote-links-service.ts +0 -597
- package/src/openapi/platform/services/issue-resolutions-service.ts +0 -534
- package/src/openapi/platform/services/issue-search-service.ts +0 -1139
- package/src/openapi/platform/services/issue-security-level-service.ts +0 -250
- package/src/openapi/platform/services/issue-security-schemes-service.ts +0 -1240
- package/src/openapi/platform/services/issue-type-properties-service.ts +0 -325
- package/src/openapi/platform/services/issue-type-schemes-service.ts +0 -940
- package/src/openapi/platform/services/issue-type-screen-schemes-service.ts +0 -994
- package/src/openapi/platform/services/issue-types-service.ts +0 -679
- package/src/openapi/platform/services/issue-votes-service.ts +0 -221
- package/src/openapi/platform/services/issue-watchers-service.ts +0 -331
- package/src/openapi/platform/services/issue-worklog-properties-service.ts +0 -348
- package/src/openapi/platform/services/issue-worklogs-service.ts +0 -1089
- package/src/openapi/platform/services/issues-service.ts +0 -3346
- package/src/openapi/platform/services/jira-expressions-service.ts +0 -407
- package/src/openapi/platform/services/jira-settings-service.ts +0 -415
- package/src/openapi/platform/services/jql-functions-apps-service.ts +0 -219
- package/src/openapi/platform/services/jql-service.ts +0 -896
- package/src/openapi/platform/services/labels-service.ts +0 -89
- package/src/openapi/platform/services/license-metrics-service.ts +0 -216
- package/src/openapi/platform/services/myself-service.ts +0 -520
- package/src/openapi/platform/services/permission-schemes-service.ts +0 -926
- package/src/openapi/platform/services/permissions-service.ts +0 -407
- package/src/openapi/platform/services/priority-schemes-service.ts +0 -1001
- package/src/openapi/platform/services/project-avatars-service.ts +0 -341
- package/src/openapi/platform/services/project-categories-service.ts +0 -318
- package/src/openapi/platform/services/project-classification-levels-service.ts +0 -232
- package/src/openapi/platform/services/project-components-service.ts +0 -1332
- package/src/openapi/platform/services/project-email-service.ts +0 -161
- package/src/openapi/platform/services/project-features-service.ts +0 -207
- package/src/openapi/platform/services/project-key-and-name-validation-service.ts +0 -200
- package/src/openapi/platform/services/project-permission-schemes-service.ts +0 -384
- package/src/openapi/platform/services/project-properties-service.ts +0 -320
- package/src/openapi/platform/services/project-role-actors-service.ts +0 -627
- package/src/openapi/platform/services/project-roles-service.ts +0 -867
- package/src/openapi/platform/services/project-types-service.ts +0 -297
- package/src/openapi/platform/services/project-versions-service.ts +0 -1287
- package/src/openapi/platform/services/projects-service.ts +0 -2196
- package/src/openapi/platform/services/screen-schemes-service.ts +0 -334
- package/src/openapi/platform/services/screen-tab-fields-service.ts +0 -276
- package/src/openapi/platform/services/screen-tabs-service.ts +0 -421
- package/src/openapi/platform/services/screens-service.ts +0 -528
- package/src/openapi/platform/services/server-info-service.ts +0 -88
- package/src/openapi/platform/services/service-registry-service.ts +0 -89
- package/src/openapi/platform/services/status-service.ts +0 -498
- package/src/openapi/platform/services/tasks-service.ts +0 -159
- package/src/openapi/platform/services/time-tracking-service.ts +0 -386
- package/src/openapi/platform/services/ui-modifications-apps-service.ts +0 -403
- package/src/openapi/platform/services/user-properties-service.ts +0 -413
- package/src/openapi/platform/services/user-search-service.ts +0 -1214
- package/src/openapi/platform/services/users-service.ts +0 -1108
- package/src/openapi/platform/services/webhooks-service.ts +0 -458
- package/src/openapi/platform/services/workflow-scheme-drafts-service.ts +0 -1313
- package/src/openapi/platform/services/workflow-scheme-project-associations-service.ts +0 -189
- package/src/openapi/platform/services/workflow-schemes-service.ts +0 -1617
- package/src/openapi/platform/services/workflow-status-categories-service.ts +0 -151
- package/src/openapi/platform/services/workflow-statuses-service.ts +0 -176
- package/src/openapi/platform/services/workflow-transition-properties-service.ts +0 -388
- package/src/openapi/platform/services/workflow-transition-rules-service.ts +0 -485
- package/src/openapi/platform/services/workflows-service.ts +0 -3477
- package/src/openapi/platform/validation-schema-storage.ts +0 -186
- package/src/openapi/software/base-jira-software-api-client.ts +0 -447
- package/src/openapi/software/core/common-http-client.ts +0 -723
- package/src/openapi/software/core/common-http-service.ts +0 -22
- package/src/openapi/software/core/common-validation-schema-storage.ts +0 -105
- package/src/openapi/software/models/board.ts +0 -918
- package/src/openapi/software/services/backlog-service.ts +0 -160
- package/src/openapi/software/services/board-service.ts +0 -4189
- package/src/openapi/software/services/builds-service.ts +0 -571
- package/src/openapi/software/services/deployments-service.ts +0 -403
- package/src/openapi/software/services/dev-ops-components-service.ts +0 -371
- package/src/openapi/software/services/development-information-service.ts +0 -2357
- package/src/openapi/software/services/epic-service.ts +0 -854
- package/src/openapi/software/services/feature-flags-service.ts +0 -303
- package/src/openapi/software/services/issue-service.ts +0 -529
- package/src/openapi/software/services/operations-service.ts +0 -741
- package/src/openapi/software/services/remote-links-service.ts +0 -653
- package/src/openapi/software/services/security-information-service.ts +0 -495
- package/src/openapi/software/services/sprint-service.ts +0 -969
- package/src/openapi/software/validation-schema-storage.ts +0 -186
- package/tsconfig.build.json +0 -7
- package/tsconfig.json +0 -4
|
@@ -1,900 +0,0 @@
|
|
|
1
|
-
// DO NOT EDIT!
|
|
2
|
-
// This file is generated by "api-typescript-generator".
|
|
3
|
-
// To update this file run "yarn build:openapi".
|
|
4
|
-
import { z } from "zod";
|
|
5
|
-
|
|
6
|
-
import * as commonHttpClient from "../core/common-http-client";
|
|
7
|
-
import { CommonHttpService } from "../core/common-http-service";
|
|
8
|
-
import {
|
|
9
|
-
type Attachment,
|
|
10
|
-
type AttachmentArchiveImpl,
|
|
11
|
-
type AttachmentArchiveMetadataReadable,
|
|
12
|
-
type AttachmentMetadata,
|
|
13
|
-
type AttachmentSettings,
|
|
14
|
-
type MultipartFile,
|
|
15
|
-
registerIssueAttachmentsValidationSchemas,
|
|
16
|
-
} from "../models/issue-attachments";
|
|
17
|
-
import { validationSchemaStorage } from "../validation-schema-storage";
|
|
18
|
-
/**
|
|
19
|
-
* This resource represents issue attachments and the attachment settings for
|
|
20
|
-
* Jira. Use it to get the metadata for an attachment, delete an attachment, and
|
|
21
|
-
* view the metadata for the contents of an attachment. Also, use it to get the
|
|
22
|
-
* attachment settings for Jira.
|
|
23
|
-
*/
|
|
24
|
-
export class IssueAttachmentsService extends CommonHttpService {
|
|
25
|
-
/**
|
|
26
|
-
* Adds one or more attachments to an issue. Attachments are posted as
|
|
27
|
-
* multipart/form-data ([RFC 1867](https://www.ietf.org/rfc/rfc1867.txt)).
|
|
28
|
-
*
|
|
29
|
-
* Note that:
|
|
30
|
-
*
|
|
31
|
-
* * The request must have a `X-Atlassian-Token: no-check` header, if not it is
|
|
32
|
-
* blocked. See [Special headers](#special-request-headers) for more information.
|
|
33
|
-
* * The name of the multipart/form-data parameter that contains the attachments
|
|
34
|
-
* must be `file`.
|
|
35
|
-
*
|
|
36
|
-
* The following examples upload a file called *myfile.txt* to the issue
|
|
37
|
-
* *TEST-123*:
|
|
38
|
-
*
|
|
39
|
-
* #### curl ####
|
|
40
|
-
*
|
|
41
|
-
* curl --location --request POST
|
|
42
|
-
* 'https://your-domain.atlassian.net/rest/api/3/issue/TEST-123/attachments'
|
|
43
|
-
* -u 'email@example.com:<api_token>'
|
|
44
|
-
* -H 'X-Atlassian-Token: no-check'
|
|
45
|
-
* --form 'file=@"myfile.txt"'
|
|
46
|
-
*
|
|
47
|
-
* #### Node.js ####
|
|
48
|
-
*
|
|
49
|
-
* // This code sample uses the 'node-fetch' and 'form-data' libraries:
|
|
50
|
-
* // https://www.npmjs.com/package/node-fetch
|
|
51
|
-
* // https://www.npmjs.com/package/form-data
|
|
52
|
-
* const fetch = require('node-fetch');
|
|
53
|
-
* const FormData = require('form-data');
|
|
54
|
-
* const fs = require('fs');
|
|
55
|
-
*
|
|
56
|
-
* const filePath = 'myfile.txt';
|
|
57
|
-
* const form = new FormData();
|
|
58
|
-
* const stats = fs.statSync(filePath);
|
|
59
|
-
* const fileSizeInBytes = stats.size;
|
|
60
|
-
* const fileStream = fs.createReadStream(filePath);
|
|
61
|
-
*
|
|
62
|
-
* form.append('file', fileStream, {knownLength: fileSizeInBytes});
|
|
63
|
-
*
|
|
64
|
-
* fetch('https://your-domain.atlassian.net/rest/api/3/issue/TEST-123/attachments',
|
|
65
|
-
* {
|
|
66
|
-
* method: 'POST',
|
|
67
|
-
* body: form,
|
|
68
|
-
* headers: {
|
|
69
|
-
* 'Authorization': `Basic ${Buffer.from(
|
|
70
|
-
* 'email@example.com:'
|
|
71
|
-
* ).toString('base64')}`,
|
|
72
|
-
* 'Accept': 'application/json',
|
|
73
|
-
* 'X-Atlassian-Token': 'no-check'
|
|
74
|
-
* }
|
|
75
|
-
* })
|
|
76
|
-
* .then(response => {
|
|
77
|
-
* console.log(
|
|
78
|
-
* `Response: ${response.status} ${response.statusText}`
|
|
79
|
-
* );
|
|
80
|
-
* return response.text();
|
|
81
|
-
* })
|
|
82
|
-
* .then(text => console.log(text))
|
|
83
|
-
* .catch(err => console.error(err));
|
|
84
|
-
*
|
|
85
|
-
* #### Java ####
|
|
86
|
-
*
|
|
87
|
-
* // This code sample uses the 'Unirest' library:
|
|
88
|
-
* // http://unirest.io/java.html
|
|
89
|
-
* HttpResponse response =
|
|
90
|
-
* Unirest.post("https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments")
|
|
91
|
-
* .basicAuth("email@example.com", "")
|
|
92
|
-
* .header("Accept", "application/json")
|
|
93
|
-
* .header("X-Atlassian-Token", "no-check")
|
|
94
|
-
* .field("file", new File("myfile.txt"))
|
|
95
|
-
* .asJson();
|
|
96
|
-
*
|
|
97
|
-
* System.out.println(response.getBody());
|
|
98
|
-
*
|
|
99
|
-
* #### Python ####
|
|
100
|
-
*
|
|
101
|
-
* # This code sample uses the 'requests' library:
|
|
102
|
-
* # http://docs.python-requests.org
|
|
103
|
-
* import requests
|
|
104
|
-
* from requests.auth import HTTPBasicAuth
|
|
105
|
-
* import json
|
|
106
|
-
*
|
|
107
|
-
* url =
|
|
108
|
-
* "https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments"
|
|
109
|
-
*
|
|
110
|
-
* auth = HTTPBasicAuth("email@example.com", "")
|
|
111
|
-
*
|
|
112
|
-
* headers = {
|
|
113
|
-
* "Accept": "application/json",
|
|
114
|
-
* "X-Atlassian-Token": "no-check"
|
|
115
|
-
* }
|
|
116
|
-
*
|
|
117
|
-
* response = requests.request(
|
|
118
|
-
* "POST",
|
|
119
|
-
* url,
|
|
120
|
-
* headers = headers,
|
|
121
|
-
* auth = auth,
|
|
122
|
-
* files = {
|
|
123
|
-
* "file": ("myfile.txt", open("myfile.txt","rb"), "application-type")
|
|
124
|
-
* }
|
|
125
|
-
* )
|
|
126
|
-
*
|
|
127
|
-
* print(json.dumps(json.loads(response.text), sort_keys=True, indent=4,
|
|
128
|
-
* separators=(",", ": ")))
|
|
129
|
-
*
|
|
130
|
-
* #### PHP ####
|
|
131
|
-
*
|
|
132
|
-
* // This code sample uses the 'Unirest' library:
|
|
133
|
-
* // http://unirest.io/php.html
|
|
134
|
-
* Unirest\Request::auth('email@example.com', '');
|
|
135
|
-
*
|
|
136
|
-
* $headers = array(
|
|
137
|
-
* 'Accept' => 'application/json',
|
|
138
|
-
* 'X-Atlassian-Token' => 'no-check'
|
|
139
|
-
* );
|
|
140
|
-
*
|
|
141
|
-
* $parameters = array(
|
|
142
|
-
* 'file' => File::add('myfile.txt')
|
|
143
|
-
* );
|
|
144
|
-
*
|
|
145
|
-
* $response = Unirest\Request::post(
|
|
146
|
-
* 'https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments',
|
|
147
|
-
* $headers,
|
|
148
|
-
* $parameters
|
|
149
|
-
* );
|
|
150
|
-
*
|
|
151
|
-
* var_dump($response)
|
|
152
|
-
*
|
|
153
|
-
* #### Forge ####
|
|
154
|
-
*
|
|
155
|
-
* // This sample uses Atlassian Forge and the `form-data` library.
|
|
156
|
-
* // https://developer.atlassian.com/platform/forge/
|
|
157
|
-
* // https://www.npmjs.com/package/form-data
|
|
158
|
-
* import api from "@forge/api";
|
|
159
|
-
* import FormData from "form-data";
|
|
160
|
-
*
|
|
161
|
-
* const form = new FormData();
|
|
162
|
-
* form.append('file', fileStream, {knownLength: fileSizeInBytes});
|
|
163
|
-
*
|
|
164
|
-
* const response = await
|
|
165
|
-
* api.asApp().requestJira('/rest/api/2/issue/{issueIdOrKey}/attachments', {
|
|
166
|
-
* method: 'POST',
|
|
167
|
-
* body: form,
|
|
168
|
-
* headers: {
|
|
169
|
-
* 'Accept': 'application/json',
|
|
170
|
-
* 'X-Atlassian-Token': 'no-check'
|
|
171
|
-
* }
|
|
172
|
-
* });
|
|
173
|
-
*
|
|
174
|
-
* console.log(`Response: ${response.status} ${response.statusText}`);
|
|
175
|
-
* console.log(await response.json());
|
|
176
|
-
*
|
|
177
|
-
* Tip: Use a client library. Many client libraries have classes for handling
|
|
178
|
-
* multipart POST operations. For example, in Java, the Apache HTTP Components
|
|
179
|
-
* library provides a
|
|
180
|
-
* [MultiPartEntity](http://hc.apache.org/httpcomponents-client-ga/httpmime/apidocs/org/apache/http/entity/mime/MultipartEntity.html)
|
|
181
|
-
* class for multipart POST operations.
|
|
182
|
-
*
|
|
183
|
-
* This operation can be accessed anonymously.
|
|
184
|
-
*
|
|
185
|
-
* **[Permissions](#permissions) required:**
|
|
186
|
-
*
|
|
187
|
-
* * *Browse Projects* and *Create attachments* [ project
|
|
188
|
-
* permission](https://confluence.atlassian.com/x/yodKLg) for the project that the
|
|
189
|
-
* issue is in.
|
|
190
|
-
* * If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is
|
|
191
|
-
* configured, issue-level security permission to view the issue.
|
|
192
|
-
*
|
|
193
|
-
* @returns Returned if the request is successful.
|
|
194
|
-
*
|
|
195
|
-
* example: [
|
|
196
|
-
* {
|
|
197
|
-
* "author": {
|
|
198
|
-
* "accountId": "5b10a2844c20165700ede21g",
|
|
199
|
-
* "active": true,
|
|
200
|
-
* "avatarUrls": {
|
|
201
|
-
* "16x16":
|
|
202
|
-
* "https://avatar-management--avatars.server-location.prod.public.atl-paas.net/initials/MK-5.png?size=16&s=16",
|
|
203
|
-
* "24x24":
|
|
204
|
-
* "https://avatar-management--avatars.server-location.prod.public.atl-paas.net/initials/MK-5.png?size=24&s=24",
|
|
205
|
-
* "32x32":
|
|
206
|
-
* "https://avatar-management--avatars.server-location.prod.public.atl-paas.net/initials/MK-5.png?size=32&s=32",
|
|
207
|
-
* "48x48":
|
|
208
|
-
* "https://avatar-management--avatars.server-location.prod.public.atl-paas.net/initials/MK-5.png?size=48&s=48"
|
|
209
|
-
* },
|
|
210
|
-
* "displayName": "Mia Krystof",
|
|
211
|
-
* "emailAddress": "mia@example.com",
|
|
212
|
-
* "self":
|
|
213
|
-
* "https://your-domain.atlassian.net/rest/api/3/user?accountId=5b10a2844c20165700ede21g",
|
|
214
|
-
* "timeZone": "Australia/Sydney"
|
|
215
|
-
* },
|
|
216
|
-
* "content":
|
|
217
|
-
* "https://your-domain.atlassian.net/rest/api/3/attachment/content/10000",
|
|
218
|
-
* "created": 1651316514000,
|
|
219
|
-
* "filename": "picture.jpg",
|
|
220
|
-
* "id": "10001",
|
|
221
|
-
* "mimeType": "image/jpeg",
|
|
222
|
-
* "self": "https://your-domain.atlassian.net/rest/api/3/attachments/10000",
|
|
223
|
-
* "size": 23123,
|
|
224
|
-
* "thumbnail":
|
|
225
|
-
* "https://your-domain.atlassian.net/rest/api/3/attachment/thumbnail/10000"
|
|
226
|
-
* },
|
|
227
|
-
* {
|
|
228
|
-
* "author": {
|
|
229
|
-
* "accountId": "5b10a2844c20165700ede21g",
|
|
230
|
-
* "active": true,
|
|
231
|
-
* "avatarUrls": {
|
|
232
|
-
* "16x16":
|
|
233
|
-
* "https://avatar-management--avatars.server-location.prod.public.atl-paas.net/initials/MK-5.png?size=16&s=16",
|
|
234
|
-
* "24x24":
|
|
235
|
-
* "https://avatar-management--avatars.server-location.prod.public.atl-paas.net/initials/MK-5.png?size=24&s=24",
|
|
236
|
-
* "32x32":
|
|
237
|
-
* "https://avatar-management--avatars.server-location.prod.public.atl-paas.net/initials/MK-5.png?size=32&s=32",
|
|
238
|
-
* "48x48":
|
|
239
|
-
* "https://avatar-management--avatars.server-location.prod.public.atl-paas.net/initials/MK-5.png?size=48&s=48"
|
|
240
|
-
* },
|
|
241
|
-
* "displayName": "Mia Krystof",
|
|
242
|
-
* "emailAddress": "mia@example.com",
|
|
243
|
-
* "self":
|
|
244
|
-
* "https://your-domain.atlassian.net/rest/api/3/user?accountId=5b10a2844c20165700ede21g",
|
|
245
|
-
* "timeZone": "Australia/Sydney"
|
|
246
|
-
* },
|
|
247
|
-
* "content":
|
|
248
|
-
* "https://your-domain.atlassian.net/rest/api/3/attachment/content/10001",
|
|
249
|
-
* "created": 1658898511000,
|
|
250
|
-
* "filename": "dbeuglog.txt",
|
|
251
|
-
* "mimeType": "text/plain",
|
|
252
|
-
* "self": "https://your-domain.atlassian.net/rest/api/3/attachments/10001",
|
|
253
|
-
* "size": 2460
|
|
254
|
-
* }
|
|
255
|
-
* ]
|
|
256
|
-
* @path {POST} /rest/api/3/issue/{issueIdOrKey}/attachments
|
|
257
|
-
* @scopes-current write:jira-work
|
|
258
|
-
* @scopes-beta read:user:jira, write:attachment:jira, read:attachment:jira, read:avatar:jira
|
|
259
|
-
*/
|
|
260
|
-
addAttachment({
|
|
261
|
-
issueIdOrKey,
|
|
262
|
-
requestBody,
|
|
263
|
-
}: {
|
|
264
|
-
/** The ID or key of the issue that attachments are added to. */
|
|
265
|
-
issueIdOrKey: string;
|
|
266
|
-
requestBody: {
|
|
267
|
-
[key: string]: MultipartFile;
|
|
268
|
-
};
|
|
269
|
-
}): Promise<Attachment[]> {
|
|
270
|
-
return this.getClientInstance()
|
|
271
|
-
.request({
|
|
272
|
-
path: "/rest/api/3/issue/{issueIdOrKey}/attachments",
|
|
273
|
-
method: "POST",
|
|
274
|
-
pathParams: {
|
|
275
|
-
issueIdOrKey,
|
|
276
|
-
},
|
|
277
|
-
headers: {
|
|
278
|
-
"X-Atlassian-Token": "nocheck",
|
|
279
|
-
"Content-Type": "multipart/form-data",
|
|
280
|
-
},
|
|
281
|
-
body: requestBody,
|
|
282
|
-
})
|
|
283
|
-
.then(
|
|
284
|
-
this.getClientInstance().responseHandler({
|
|
285
|
-
200: {
|
|
286
|
-
"application/json": "json",
|
|
287
|
-
},
|
|
288
|
-
}),
|
|
289
|
-
)
|
|
290
|
-
.then(
|
|
291
|
-
commonHttpClient.castResponse<{
|
|
292
|
-
status: 200;
|
|
293
|
-
mediaType: "application/json";
|
|
294
|
-
body: Attachment[];
|
|
295
|
-
}>(),
|
|
296
|
-
)
|
|
297
|
-
.then(
|
|
298
|
-
validationSchemaStorage.validator(
|
|
299
|
-
"IssueAttachmentsService.addAttachment.response",
|
|
300
|
-
),
|
|
301
|
-
)
|
|
302
|
-
.then(commonHttpClient.getBody);
|
|
303
|
-
}
|
|
304
|
-
/**
|
|
305
|
-
* Returns the metadata for the contents of an attachment, if it is an archive,
|
|
306
|
-
* and metadata for the attachment itself. For example, if the attachment is a ZIP
|
|
307
|
-
* archive, then information about the files in the archive is returned and
|
|
308
|
-
* metadata for the ZIP archive. Currently, only the ZIP archive format is
|
|
309
|
-
* supported.
|
|
310
|
-
*
|
|
311
|
-
* Use this operation to retrieve data that is presented to the user, as this
|
|
312
|
-
* operation returns the metadata for the attachment itself, such as the
|
|
313
|
-
* attachment's ID and name. Otherwise, use [ Get contents metadata for an
|
|
314
|
-
* expanded attachment](#api-rest-api-3-attachment-id-expand-raw-get), which only
|
|
315
|
-
* returns the metadata for the attachment's contents.
|
|
316
|
-
*
|
|
317
|
-
* This operation can be accessed anonymously.
|
|
318
|
-
*
|
|
319
|
-
* **[Permissions](#permissions) required:** For the issue containing the
|
|
320
|
-
* attachment:
|
|
321
|
-
*
|
|
322
|
-
* * *Browse projects* [project
|
|
323
|
-
* permission](https://confluence.atlassian.com/x/yodKLg) for the project that the
|
|
324
|
-
* issue is in.
|
|
325
|
-
* * If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is
|
|
326
|
-
* configured, issue-level security permission to view the issue.
|
|
327
|
-
*
|
|
328
|
-
* @returns Returned if the request is successful. If an empty list is returned in the
|
|
329
|
-
* response, the attachment is empty, corrupt, or not an archive.
|
|
330
|
-
*
|
|
331
|
-
* example: {
|
|
332
|
-
* "entries": [
|
|
333
|
-
* {
|
|
334
|
-
* "index": 0,
|
|
335
|
-
* "label": "MG00N067.JPG",
|
|
336
|
-
* "mediaType": "image/jpeg",
|
|
337
|
-
* "path": "MG00N067.JPG",
|
|
338
|
-
* "size": "119 kB"
|
|
339
|
-
* },
|
|
340
|
-
* {
|
|
341
|
-
* "index": 1,
|
|
342
|
-
* "label": "Allegro from Duet in C Major.mp3",
|
|
343
|
-
* "mediaType": "audio/mpeg",
|
|
344
|
-
* "path": "Allegro from Duet in C Major.mp3",
|
|
345
|
-
* "size": "1.36 MB"
|
|
346
|
-
* },
|
|
347
|
-
* {
|
|
348
|
-
* "index": 2,
|
|
349
|
-
* "label": "long/path/thanks/to/.../reach/the/leaf.txt",
|
|
350
|
-
* "mediaType": "text/plain",
|
|
351
|
-
* "path":
|
|
352
|
-
* "long/path/thanks/to/lots/of/subdirectories/inside/making/it/quite/hard/to/reach/the/leaf.txt",
|
|
353
|
-
* "size": "0.0 k"
|
|
354
|
-
* }
|
|
355
|
-
* ],
|
|
356
|
-
* "id": 7237823,
|
|
357
|
-
* "mediaType": "application/zip",
|
|
358
|
-
* "name": "images.zip",
|
|
359
|
-
* "totalEntryCount": 39
|
|
360
|
-
* }
|
|
361
|
-
* @path {GET} /rest/api/3/attachment/{id}/expand/human
|
|
362
|
-
* @scopes-current read:jira-work
|
|
363
|
-
* @scopes-beta read:attachment:jira
|
|
364
|
-
*/
|
|
365
|
-
expandAttachmentForHumans({
|
|
366
|
-
id,
|
|
367
|
-
}: {
|
|
368
|
-
/** The ID of the attachment. */
|
|
369
|
-
id: string;
|
|
370
|
-
}): Promise<AttachmentArchiveMetadataReadable> {
|
|
371
|
-
return this.getClientInstance()
|
|
372
|
-
.request({
|
|
373
|
-
path: "/rest/api/3/attachment/{id}/expand/human",
|
|
374
|
-
method: "GET",
|
|
375
|
-
pathParams: {
|
|
376
|
-
id,
|
|
377
|
-
},
|
|
378
|
-
})
|
|
379
|
-
.then(
|
|
380
|
-
this.getClientInstance().responseHandler({
|
|
381
|
-
200: {
|
|
382
|
-
"application/json": "json",
|
|
383
|
-
},
|
|
384
|
-
}),
|
|
385
|
-
)
|
|
386
|
-
.then(
|
|
387
|
-
commonHttpClient.castResponse<{
|
|
388
|
-
status: 200;
|
|
389
|
-
mediaType: "application/json";
|
|
390
|
-
body: AttachmentArchiveMetadataReadable;
|
|
391
|
-
}>(),
|
|
392
|
-
)
|
|
393
|
-
.then(
|
|
394
|
-
validationSchemaStorage.validator(
|
|
395
|
-
"IssueAttachmentsService.expandAttachmentForHumans.response",
|
|
396
|
-
),
|
|
397
|
-
)
|
|
398
|
-
.then(commonHttpClient.getBody);
|
|
399
|
-
}
|
|
400
|
-
/**
|
|
401
|
-
* Returns the metadata for the contents of an attachment, if it is an archive.
|
|
402
|
-
* For example, if the attachment is a ZIP archive, then information about the
|
|
403
|
-
* files in the archive is returned. Currently, only the ZIP archive format is
|
|
404
|
-
* supported.
|
|
405
|
-
*
|
|
406
|
-
* Use this operation if you are processing the data without presenting it to the
|
|
407
|
-
* user, as this operation only returns the metadata for the contents of the
|
|
408
|
-
* attachment. Otherwise, to retrieve data to present to the user, use [ Get all
|
|
409
|
-
* metadata for an expanded
|
|
410
|
-
* attachment](#api-rest-api-3-attachment-id-expand-human-get) which also returns
|
|
411
|
-
* the metadata for the attachment itself, such as the attachment's ID and name.
|
|
412
|
-
*
|
|
413
|
-
* This operation can be accessed anonymously.
|
|
414
|
-
*
|
|
415
|
-
* **[Permissions](#permissions) required:** For the issue containing the
|
|
416
|
-
* attachment:
|
|
417
|
-
*
|
|
418
|
-
* * *Browse projects* [project
|
|
419
|
-
* permission](https://confluence.atlassian.com/x/yodKLg) for the project that the
|
|
420
|
-
* issue is in.
|
|
421
|
-
* * If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is
|
|
422
|
-
* configured, issue-level security permission to view the issue.
|
|
423
|
-
*
|
|
424
|
-
* @returns Returned if the request is successful. If an empty list is returned in the
|
|
425
|
-
* response, the attachment is empty, corrupt, or not an archive.
|
|
426
|
-
*
|
|
427
|
-
* example: {
|
|
428
|
-
* "entries": [
|
|
429
|
-
* {
|
|
430
|
-
* "entryIndex": 0,
|
|
431
|
-
* "mediaType": "audio/mpeg",
|
|
432
|
-
* "name": "Allegro from Duet in C Major.mp3",
|
|
433
|
-
* "size": 1430174
|
|
434
|
-
* },
|
|
435
|
-
* {
|
|
436
|
-
* "entryIndex": 1,
|
|
437
|
-
* "mediaType": "text/rtf",
|
|
438
|
-
* "name": "lrm.rtf",
|
|
439
|
-
* "size": 331
|
|
440
|
-
* }
|
|
441
|
-
* ],
|
|
442
|
-
* "totalEntryCount": 24
|
|
443
|
-
* }
|
|
444
|
-
* @path {GET} /rest/api/3/attachment/{id}/expand/raw
|
|
445
|
-
* @scopes-current read:jira-work
|
|
446
|
-
* @scopes-beta read:attachment:jira
|
|
447
|
-
*/
|
|
448
|
-
expandAttachmentForMachines({
|
|
449
|
-
id,
|
|
450
|
-
}: {
|
|
451
|
-
/** The ID of the attachment. */
|
|
452
|
-
id: string;
|
|
453
|
-
}): Promise<AttachmentArchiveImpl> {
|
|
454
|
-
return this.getClientInstance()
|
|
455
|
-
.request({
|
|
456
|
-
path: "/rest/api/3/attachment/{id}/expand/raw",
|
|
457
|
-
method: "GET",
|
|
458
|
-
pathParams: {
|
|
459
|
-
id,
|
|
460
|
-
},
|
|
461
|
-
})
|
|
462
|
-
.then(
|
|
463
|
-
this.getClientInstance().responseHandler({
|
|
464
|
-
200: {
|
|
465
|
-
"application/json": "json",
|
|
466
|
-
},
|
|
467
|
-
}),
|
|
468
|
-
)
|
|
469
|
-
.then(
|
|
470
|
-
commonHttpClient.castResponse<{
|
|
471
|
-
status: 200;
|
|
472
|
-
mediaType: "application/json";
|
|
473
|
-
body: AttachmentArchiveImpl;
|
|
474
|
-
}>(),
|
|
475
|
-
)
|
|
476
|
-
.then(
|
|
477
|
-
validationSchemaStorage.validator(
|
|
478
|
-
"IssueAttachmentsService.expandAttachmentForMachines.response",
|
|
479
|
-
),
|
|
480
|
-
)
|
|
481
|
-
.then(commonHttpClient.getBody);
|
|
482
|
-
}
|
|
483
|
-
/**
|
|
484
|
-
* Returns the metadata for an attachment. Note that the attachment itself is not
|
|
485
|
-
* returned.
|
|
486
|
-
*
|
|
487
|
-
* This operation can be accessed anonymously.
|
|
488
|
-
*
|
|
489
|
-
* **[Permissions](#permissions) required:**
|
|
490
|
-
*
|
|
491
|
-
* * *Browse projects* [project
|
|
492
|
-
* permission](https://confluence.atlassian.com/x/yodKLg) for the project that the
|
|
493
|
-
* issue is in.
|
|
494
|
-
* * If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is
|
|
495
|
-
* configured, issue-level security permission to view the issue.
|
|
496
|
-
*
|
|
497
|
-
* @returns Returned if the request is successful.
|
|
498
|
-
*
|
|
499
|
-
* example: {
|
|
500
|
-
* "author": {
|
|
501
|
-
* "accountId": "5b10a2844c20165700ede21g",
|
|
502
|
-
* "accountType": "atlassian",
|
|
503
|
-
* "active": false,
|
|
504
|
-
* "avatarUrls": {
|
|
505
|
-
* "16x16":
|
|
506
|
-
* "https://avatar-management--avatars.server-location.prod.public.atl-paas.net/initials/MK-5.png?size=16&s=16",
|
|
507
|
-
* "24x24":
|
|
508
|
-
* "https://avatar-management--avatars.server-location.prod.public.atl-paas.net/initials/MK-5.png?size=24&s=24",
|
|
509
|
-
* "32x32":
|
|
510
|
-
* "https://avatar-management--avatars.server-location.prod.public.atl-paas.net/initials/MK-5.png?size=32&s=32",
|
|
511
|
-
* "48x48":
|
|
512
|
-
* "https://avatar-management--avatars.server-location.prod.public.atl-paas.net/initials/MK-5.png?size=48&s=48"
|
|
513
|
-
* },
|
|
514
|
-
* "displayName": "Mia Krystof",
|
|
515
|
-
* "key": "",
|
|
516
|
-
* "name": "",
|
|
517
|
-
* "self":
|
|
518
|
-
* "https://your-domain.atlassian.net/rest/api/3/user?accountId=5b10a2844c20165700ede21g"
|
|
519
|
-
* },
|
|
520
|
-
* "content":
|
|
521
|
-
* "https://your-domain.atlassian.net/jira/rest/api/3/attachment/content/10000",
|
|
522
|
-
* "created": "2022-10-06T07:32:47.000+0000",
|
|
523
|
-
* "filename": "picture.jpg",
|
|
524
|
-
* "id": 10000,
|
|
525
|
-
* "mimeType": "image/jpeg",
|
|
526
|
-
* "self": "https://your-domain.atlassian.net/rest/api/3/attachments/10000",
|
|
527
|
-
* "size": 23123,
|
|
528
|
-
* "thumbnail":
|
|
529
|
-
* "https://your-domain.atlassian.net/jira/rest/api/3/attachment/thumbnail/10000"
|
|
530
|
-
* }
|
|
531
|
-
* @path {GET} /rest/api/3/attachment/{id}
|
|
532
|
-
* @scopes-current read:jira-work
|
|
533
|
-
* @scopes-beta read:attachment:jira, read:user:jira, read:application-role:jira,
|
|
534
|
-
* read:avatar:jira, read:group:jira
|
|
535
|
-
*/
|
|
536
|
-
getAttachment({
|
|
537
|
-
id,
|
|
538
|
-
}: {
|
|
539
|
-
/** The ID of the attachment. */
|
|
540
|
-
id: string;
|
|
541
|
-
}): Promise<AttachmentMetadata> {
|
|
542
|
-
return this.getClientInstance()
|
|
543
|
-
.request({
|
|
544
|
-
path: "/rest/api/3/attachment/{id}",
|
|
545
|
-
method: "GET",
|
|
546
|
-
pathParams: {
|
|
547
|
-
id,
|
|
548
|
-
},
|
|
549
|
-
})
|
|
550
|
-
.then(
|
|
551
|
-
this.getClientInstance().responseHandler({
|
|
552
|
-
200: {
|
|
553
|
-
"application/json": "json",
|
|
554
|
-
},
|
|
555
|
-
}),
|
|
556
|
-
)
|
|
557
|
-
.then(
|
|
558
|
-
commonHttpClient.castResponse<{
|
|
559
|
-
status: 200;
|
|
560
|
-
mediaType: "application/json";
|
|
561
|
-
body: AttachmentMetadata;
|
|
562
|
-
}>(),
|
|
563
|
-
)
|
|
564
|
-
.then(
|
|
565
|
-
validationSchemaStorage.validator(
|
|
566
|
-
"IssueAttachmentsService.getAttachment.response",
|
|
567
|
-
),
|
|
568
|
-
)
|
|
569
|
-
.then(commonHttpClient.getBody);
|
|
570
|
-
}
|
|
571
|
-
/**
|
|
572
|
-
* Returns the contents of an attachment. A `Range` header can be set to define a
|
|
573
|
-
* range of bytes within the attachment to download. See the [HTTP Range header
|
|
574
|
-
* standard](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Range) for
|
|
575
|
-
* details.
|
|
576
|
-
*
|
|
577
|
-
* To return a thumbnail of the attachment, use [Get attachment
|
|
578
|
-
* thumbnail](#api-rest-api-3-attachment-thumbnail-id-get).
|
|
579
|
-
*
|
|
580
|
-
* This operation can be accessed anonymously.
|
|
581
|
-
*
|
|
582
|
-
* **[Permissions](#permissions) required:** For the issue containing the
|
|
583
|
-
* attachment:
|
|
584
|
-
*
|
|
585
|
-
* * *Browse projects* [project
|
|
586
|
-
* permission](https://confluence.atlassian.com/x/yodKLg) for the project that the
|
|
587
|
-
* issue is in.
|
|
588
|
-
* * If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is
|
|
589
|
-
* configured, issue-level security permission to view the issue.
|
|
590
|
-
*
|
|
591
|
-
* @returns Returned if the request is successful when `redirect` is set to `false`.
|
|
592
|
-
* @path {GET} /rest/api/3/attachment/content/{id}
|
|
593
|
-
* @scopes-current read:jira-work
|
|
594
|
-
* @scopes-beta read:attachment:jira
|
|
595
|
-
*/
|
|
596
|
-
getAttachmentContent({
|
|
597
|
-
id,
|
|
598
|
-
redirect,
|
|
599
|
-
}: {
|
|
600
|
-
/** The ID of the attachment. */
|
|
601
|
-
id: string;
|
|
602
|
-
/**
|
|
603
|
-
* Whether a redirect is provided for the attachment download. Clients that do not
|
|
604
|
-
* automatically follow redirects can set this to `false` to avoid making multiple
|
|
605
|
-
* requests to download the attachment.
|
|
606
|
-
*/
|
|
607
|
-
redirect?: boolean;
|
|
608
|
-
}): Promise<unknown[]> {
|
|
609
|
-
return this.getClientInstance()
|
|
610
|
-
.request({
|
|
611
|
-
path: "/rest/api/3/attachment/content/{id}",
|
|
612
|
-
method: "GET",
|
|
613
|
-
pathParams: {
|
|
614
|
-
id,
|
|
615
|
-
},
|
|
616
|
-
query: {
|
|
617
|
-
redirect,
|
|
618
|
-
},
|
|
619
|
-
})
|
|
620
|
-
.then(
|
|
621
|
-
this.getClientInstance().responseHandler({
|
|
622
|
-
200: {
|
|
623
|
-
"application/json": "json",
|
|
624
|
-
},
|
|
625
|
-
206: {},
|
|
626
|
-
}),
|
|
627
|
-
)
|
|
628
|
-
.then(
|
|
629
|
-
commonHttpClient.castResponse<{
|
|
630
|
-
status: 200;
|
|
631
|
-
mediaType: "application/json";
|
|
632
|
-
body: unknown[];
|
|
633
|
-
}>(),
|
|
634
|
-
)
|
|
635
|
-
.then(
|
|
636
|
-
validationSchemaStorage.validator(
|
|
637
|
-
"IssueAttachmentsService.getAttachmentContent.response",
|
|
638
|
-
),
|
|
639
|
-
)
|
|
640
|
-
.then(commonHttpClient.getBody);
|
|
641
|
-
}
|
|
642
|
-
/**
|
|
643
|
-
* Returns the attachment settings, that is, whether attachments are enabled and
|
|
644
|
-
* the maximum attachment size allowed.
|
|
645
|
-
*
|
|
646
|
-
* Note that there are also [project
|
|
647
|
-
* permissions](https://confluence.atlassian.com/x/yodKLg) that restrict whether
|
|
648
|
-
* users can create and delete attachments.
|
|
649
|
-
*
|
|
650
|
-
* This operation can be accessed anonymously.
|
|
651
|
-
*
|
|
652
|
-
* **[Permissions](#permissions) required:** None.
|
|
653
|
-
*
|
|
654
|
-
* @returns Returned if the request is successful.
|
|
655
|
-
*
|
|
656
|
-
* example: {
|
|
657
|
-
* "enabled": true,
|
|
658
|
-
* "uploadLimit": 1000000
|
|
659
|
-
* }
|
|
660
|
-
* @path {GET} /rest/api/3/attachment/meta
|
|
661
|
-
* @scopes-current read:jira-work
|
|
662
|
-
* @scopes-beta read:instance-configuration:jira
|
|
663
|
-
*/
|
|
664
|
-
getAttachmentMeta(): Promise<AttachmentSettings> {
|
|
665
|
-
return this.getClientInstance()
|
|
666
|
-
.request({
|
|
667
|
-
path: "/rest/api/3/attachment/meta",
|
|
668
|
-
method: "GET",
|
|
669
|
-
})
|
|
670
|
-
.then(
|
|
671
|
-
this.getClientInstance().responseHandler({
|
|
672
|
-
200: {
|
|
673
|
-
"application/json": "json",
|
|
674
|
-
},
|
|
675
|
-
}),
|
|
676
|
-
)
|
|
677
|
-
.then(
|
|
678
|
-
commonHttpClient.castResponse<{
|
|
679
|
-
status: 200;
|
|
680
|
-
mediaType: "application/json";
|
|
681
|
-
body: AttachmentSettings;
|
|
682
|
-
}>(),
|
|
683
|
-
)
|
|
684
|
-
.then(
|
|
685
|
-
validationSchemaStorage.validator(
|
|
686
|
-
"IssueAttachmentsService.getAttachmentMeta.response",
|
|
687
|
-
),
|
|
688
|
-
)
|
|
689
|
-
.then(commonHttpClient.getBody);
|
|
690
|
-
}
|
|
691
|
-
/**
|
|
692
|
-
* Returns the thumbnail of an attachment.
|
|
693
|
-
*
|
|
694
|
-
* To return the attachment contents, use [Get attachment
|
|
695
|
-
* content](#api-rest-api-3-attachment-content-id-get).
|
|
696
|
-
*
|
|
697
|
-
* This operation can be accessed anonymously.
|
|
698
|
-
*
|
|
699
|
-
* **[Permissions](#permissions) required:** For the issue containing the
|
|
700
|
-
* attachment:
|
|
701
|
-
*
|
|
702
|
-
* * *Browse projects* [project
|
|
703
|
-
* permission](https://confluence.atlassian.com/x/yodKLg) for the project that the
|
|
704
|
-
* issue is in.
|
|
705
|
-
* * If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is
|
|
706
|
-
* configured, issue-level security permission to view the issue.
|
|
707
|
-
*
|
|
708
|
-
* @returns Returned if the request is successful when `redirect` is set to `false`.
|
|
709
|
-
* @path {GET} /rest/api/3/attachment/thumbnail/{id}
|
|
710
|
-
* @scopes-current read:jira-work
|
|
711
|
-
* @scopes-beta read:attachment:jira
|
|
712
|
-
*/
|
|
713
|
-
getAttachmentThumbnail({
|
|
714
|
-
id,
|
|
715
|
-
redirect,
|
|
716
|
-
fallbackToDefault,
|
|
717
|
-
width,
|
|
718
|
-
height,
|
|
719
|
-
}: {
|
|
720
|
-
/** The ID of the attachment. */
|
|
721
|
-
id: string;
|
|
722
|
-
/**
|
|
723
|
-
* Whether a redirect is provided for the attachment download. Clients that do not
|
|
724
|
-
* automatically follow redirects can set this to `false` to avoid making multiple
|
|
725
|
-
* requests to download the attachment.
|
|
726
|
-
*/
|
|
727
|
-
redirect?: boolean;
|
|
728
|
-
/**
|
|
729
|
-
* Whether a default thumbnail is returned when the requested thumbnail is not
|
|
730
|
-
* found.
|
|
731
|
-
*/
|
|
732
|
-
fallbackToDefault?: boolean;
|
|
733
|
-
/** The maximum width to scale the thumbnail to. */
|
|
734
|
-
width?: number;
|
|
735
|
-
/** The maximum height to scale the thumbnail to. */
|
|
736
|
-
height?: number;
|
|
737
|
-
}): Promise<unknown[]> {
|
|
738
|
-
return this.getClientInstance()
|
|
739
|
-
.request({
|
|
740
|
-
path: "/rest/api/3/attachment/thumbnail/{id}",
|
|
741
|
-
method: "GET",
|
|
742
|
-
pathParams: {
|
|
743
|
-
id,
|
|
744
|
-
},
|
|
745
|
-
query: {
|
|
746
|
-
redirect,
|
|
747
|
-
fallbackToDefault,
|
|
748
|
-
width,
|
|
749
|
-
height,
|
|
750
|
-
},
|
|
751
|
-
})
|
|
752
|
-
.then(
|
|
753
|
-
this.getClientInstance().responseHandler({
|
|
754
|
-
200: {
|
|
755
|
-
"application/json": "json",
|
|
756
|
-
},
|
|
757
|
-
}),
|
|
758
|
-
)
|
|
759
|
-
.then(
|
|
760
|
-
commonHttpClient.castResponse<{
|
|
761
|
-
status: 200;
|
|
762
|
-
mediaType: "application/json";
|
|
763
|
-
body: unknown[];
|
|
764
|
-
}>(),
|
|
765
|
-
)
|
|
766
|
-
.then(
|
|
767
|
-
validationSchemaStorage.validator(
|
|
768
|
-
"IssueAttachmentsService.getAttachmentThumbnail.response",
|
|
769
|
-
),
|
|
770
|
-
)
|
|
771
|
-
.then(commonHttpClient.getBody);
|
|
772
|
-
}
|
|
773
|
-
/**
|
|
774
|
-
* Deletes an attachment from an issue.
|
|
775
|
-
*
|
|
776
|
-
* This operation can be accessed anonymously.
|
|
777
|
-
*
|
|
778
|
-
* **[Permissions](#permissions) required:** For the project holding the issue
|
|
779
|
-
* containing the attachment:
|
|
780
|
-
*
|
|
781
|
-
* * *Delete own attachments* [project
|
|
782
|
-
* permission](https://confluence.atlassian.com/x/yodKLg) to delete an attachment
|
|
783
|
-
* created by the calling user.
|
|
784
|
-
* * *Delete all attachments* [project
|
|
785
|
-
* permission](https://confluence.atlassian.com/x/yodKLg) to delete an attachment
|
|
786
|
-
* created by any user.
|
|
787
|
-
*
|
|
788
|
-
* @path {DELETE} /rest/api/3/attachment/{id}
|
|
789
|
-
* @scopes-current write:jira-work
|
|
790
|
-
* @scopes-beta delete:attachment:jira
|
|
791
|
-
*/
|
|
792
|
-
removeAttachment({
|
|
793
|
-
id,
|
|
794
|
-
}: {
|
|
795
|
-
/** The ID of the attachment. */
|
|
796
|
-
id: string;
|
|
797
|
-
}): Promise<void> {
|
|
798
|
-
return this.getClientInstance()
|
|
799
|
-
.request({
|
|
800
|
-
path: "/rest/api/3/attachment/{id}",
|
|
801
|
-
method: "DELETE",
|
|
802
|
-
pathParams: {
|
|
803
|
-
id,
|
|
804
|
-
},
|
|
805
|
-
})
|
|
806
|
-
.then(commonHttpClient.discardResult);
|
|
807
|
-
}
|
|
808
|
-
static initialize() {
|
|
809
|
-
validationSchemaStorage.registerExtensible(
|
|
810
|
-
"IssueAttachmentsService.getAttachment.response",
|
|
811
|
-
z
|
|
812
|
-
.object({
|
|
813
|
-
status: z.literal(200),
|
|
814
|
-
mediaType: z.literal("application/json"),
|
|
815
|
-
body: validationSchemaStorage.lazy("AttachmentMetadata"),
|
|
816
|
-
})
|
|
817
|
-
.describe("IssueAttachmentsService.getAttachment.response"),
|
|
818
|
-
);
|
|
819
|
-
validationSchemaStorage.registerExtensible(
|
|
820
|
-
"IssueAttachmentsService.expandAttachmentForHumans.response",
|
|
821
|
-
z
|
|
822
|
-
.object({
|
|
823
|
-
status: z.literal(200),
|
|
824
|
-
mediaType: z.literal("application/json"),
|
|
825
|
-
body: validationSchemaStorage.lazy(
|
|
826
|
-
"AttachmentArchiveMetadataReadable",
|
|
827
|
-
),
|
|
828
|
-
})
|
|
829
|
-
.describe("IssueAttachmentsService.expandAttachmentForHumans.response"),
|
|
830
|
-
);
|
|
831
|
-
validationSchemaStorage.registerExtensible(
|
|
832
|
-
"IssueAttachmentsService.expandAttachmentForMachines.response",
|
|
833
|
-
z
|
|
834
|
-
.object({
|
|
835
|
-
status: z.literal(200),
|
|
836
|
-
mediaType: z.literal("application/json"),
|
|
837
|
-
body: validationSchemaStorage.lazy("AttachmentArchiveImpl"),
|
|
838
|
-
})
|
|
839
|
-
.describe(
|
|
840
|
-
"IssueAttachmentsService.expandAttachmentForMachines.response",
|
|
841
|
-
),
|
|
842
|
-
);
|
|
843
|
-
validationSchemaStorage.registerExtensible(
|
|
844
|
-
"IssueAttachmentsService.getAttachmentContent.response",
|
|
845
|
-
z
|
|
846
|
-
.object({
|
|
847
|
-
status: z.number(),
|
|
848
|
-
mediaType: z.string(),
|
|
849
|
-
body: z.unknown(),
|
|
850
|
-
})
|
|
851
|
-
.superRefine(({ status: status, body: body }, ctx) => {
|
|
852
|
-
if (status === 200) {
|
|
853
|
-
z.array(z.unknown()).parse(body);
|
|
854
|
-
} else if (status === 206) {
|
|
855
|
-
return;
|
|
856
|
-
} else {
|
|
857
|
-
ctx.addIssue({
|
|
858
|
-
code: z.ZodIssueCode.custom,
|
|
859
|
-
path: ["status"],
|
|
860
|
-
message: `Unexpected status code: ${status}`,
|
|
861
|
-
});
|
|
862
|
-
}
|
|
863
|
-
})
|
|
864
|
-
.describe("IssueAttachmentsService.getAttachmentContent.response"),
|
|
865
|
-
);
|
|
866
|
-
validationSchemaStorage.registerExtensible(
|
|
867
|
-
"IssueAttachmentsService.getAttachmentMeta.response",
|
|
868
|
-
z
|
|
869
|
-
.object({
|
|
870
|
-
status: z.literal(200),
|
|
871
|
-
mediaType: z.literal("application/json"),
|
|
872
|
-
body: validationSchemaStorage.lazy("AttachmentSettings"),
|
|
873
|
-
})
|
|
874
|
-
.describe("IssueAttachmentsService.getAttachmentMeta.response"),
|
|
875
|
-
);
|
|
876
|
-
validationSchemaStorage.registerExtensible(
|
|
877
|
-
"IssueAttachmentsService.getAttachmentThumbnail.response",
|
|
878
|
-
z
|
|
879
|
-
.object({
|
|
880
|
-
status: z.literal(200),
|
|
881
|
-
mediaType: z.literal("application/json"),
|
|
882
|
-
body: z.array(z.unknown()),
|
|
883
|
-
})
|
|
884
|
-
.describe("IssueAttachmentsService.getAttachmentThumbnail.response"),
|
|
885
|
-
);
|
|
886
|
-
validationSchemaStorage.registerExtensible(
|
|
887
|
-
"IssueAttachmentsService.addAttachment.response",
|
|
888
|
-
z
|
|
889
|
-
.object({
|
|
890
|
-
status: z.literal(200),
|
|
891
|
-
mediaType: z.literal("application/json"),
|
|
892
|
-
body: z.array(validationSchemaStorage.lazy("Attachment")),
|
|
893
|
-
})
|
|
894
|
-
.describe("IssueAttachmentsService.addAttachment.response"),
|
|
895
|
-
);
|
|
896
|
-
validationSchemaStorage.registerOnce([
|
|
897
|
-
registerIssueAttachmentsValidationSchemas,
|
|
898
|
-
]);
|
|
899
|
-
}
|
|
900
|
-
}
|