@resolution/jira-api-client 0.4.5 → 0.4.6

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 CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [0.4.6](https://bitbucket.org/resolutiongmbh/atlassian-api-clients/compare/v0.4.5...v0.4.6) (2024-06-14)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * use more optimized / lightweight api client version ([8c628d3](https://bitbucket.org/resolutiongmbh/atlassian-api-clients/commits/8c628d3c80ca6c89572eb003ae6f7cb5c634b4d5))
12
+
13
+
14
+
15
+
16
+
6
17
  ## [0.4.5](https://bitbucket.org/resolutiongmbh/atlassian-api-clients/compare/v0.4.4...v0.4.5) (2024-06-14)
7
18
 
8
19
 
package/README.md CHANGED
@@ -126,6 +126,66 @@ export const handler = async ({ payload }) => {
126
126
  };
127
127
  ```
128
128
 
129
+ ### Impersonalization
130
+
131
+ When using API on the server side, you can impersonalize the API client.
132
+ This is useful when you need to access API resources on behalf of a different user or app.
133
+
134
+ ### `atlassian-connect-express`
135
+
136
+ By default, `atlassian-connect-express` makes requests on behalf of the app.
137
+ To impersonalize the API client, you need to provide the `userAccountId` to the API client:
138
+
139
+ ```typescript
140
+ // ...
141
+ app.get('/sprint-issues/:sprintId', async () => {
142
+ const jiraSoftwareApi = new JiraSoftwareApi({
143
+ ace,
144
+ clientKey: req.context.clientKey,
145
+ userAccountId: req.context.userAccountId
146
+ });
147
+ res.status(200).send(await jiraSoftwareApi.sprint.getIssuesForSprint({
148
+ sprintId: 1
149
+ }));
150
+ });
151
+ // ...
152
+ ```
153
+
154
+ This can also be achieved by calling `asUser` method on the API client:
155
+
156
+ ```typescript
157
+ const jiraSoftwareApi = new JiraSoftwareApi({
158
+ ace,
159
+ clientKey: req.context.clientKey
160
+ });
161
+ const issues = await jiraSoftwareApi.sprint.getIssuesForSprint({
162
+ sprintId: 1
163
+ });
164
+ ```
165
+
166
+ ### `@forge/api`
167
+
168
+ By default, `@forge/api` makes requests on behalf of the current user.
169
+ To perform requests on behalf of the app, you need to provide the `asApp` to the API client:
170
+
171
+ ```typescript
172
+ // ...
173
+ export const handler = async ({ payload }) => {
174
+ const jiraSoftwareApi = new JiraSoftwareApi({
175
+ forgeApi,
176
+ asApp: true
177
+ });
178
+ return await jiraSoftwareApi.sprint.getIssuesForSprint({ sprintId: 1 });
179
+ };
180
+ ```
181
+
182
+ This can also be achieved by calling `asApp` method on the API client:
183
+
184
+ ```typescript
185
+ const jiraSoftwareApi = new JiraSoftwareApi({ forgeApi });
186
+ const issues = await jiraSoftwareApi.sprint.getIssuesForSprint({ sprintId: 1 });
187
+ ```
188
+
129
189
  ## References
130
190
 
131
191
  * [Jira Platform API](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/)