@felixgeelhaar/jira-sdk 0.2.0 → 0.3.0

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.
@@ -1,7 +1,7 @@
1
1
  import { z } from 'zod';
2
2
  import * as _felixgeelhaar_sdk_core from '@felixgeelhaar/sdk-core';
3
3
  import { HttpClient, RequestOptions, HttpResponse } from '@felixgeelhaar/sdk-core';
4
- import { l as GetIssueOptions, e as Issue, h as CreateIssueInput, k as CreateIssueResponse, i as UpdateIssueInput, u as CommentsPage, p as Comment, q as AddCommentInput, s as UpdateCommentInput, x as TransitionsResponse, y as DoTransitionInput, O as Watchers, M as WorklogsPage, E as Worklog, H as AddWorklogInput, K as UpdateWorklogInput, S as Project, a1 as GetProjectsOptions, $ as ProjectSearchResult, X as CreateProjectInput, Z as UpdateProjectInput } from '../project-BtUx-eSv.cjs';
4
+ import { l as GetIssueOptions, e as Issue, h as CreateIssueInput, k as CreateIssueResponse, i as UpdateIssueInput, u as CommentsPage, p as Comment, q as AddCommentInput, s as UpdateCommentInput, x as TransitionsResponse, y as DoTransitionInput, ac as Watchers, S as WorklogsPage, M as Worklog, O as AddWorklogInput, Q as UpdateWorklogInput, B as Attachment, F as AttachmentMetadata, a1 as IssueLink, a3 as CreateIssueLinkInput, a5 as IssueLinkTypesResponse, X as IssueLinkType, ag as Project, ao as GetProjectsOptions, am as ProjectSearchResult, ai as CreateProjectInput, ak as UpdateProjectInput } from '../project-B1UelBH4.cjs';
5
5
  import { User } from '@felixgeelhaar/sdk-core/schemas';
6
6
 
7
7
  /**
@@ -226,6 +226,89 @@ declare class IssueService extends BaseService {
226
226
  * Remove your vote from an issue
227
227
  */
228
228
  removeVote(issueIdOrKey: string): Promise<void>;
229
+ /**
230
+ * Add an attachment to an issue
231
+ *
232
+ * @param issueIdOrKey - Issue ID or key
233
+ * @param file - File or Blob to upload
234
+ * @param filename - Optional filename (defaults to File.name or 'attachment')
235
+ * @returns Array of created attachments
236
+ *
237
+ * @example
238
+ * ```typescript
239
+ * const file = new File(['content'], 'document.txt', { type: 'text/plain' });
240
+ * const attachments = await client.issues.addAttachment('PROJECT-123', file);
241
+ * ```
242
+ */
243
+ addAttachment(issueIdOrKey: string, file: File | Blob, filename?: string): Promise<Attachment[]>;
244
+ /**
245
+ * Get attachment metadata by ID
246
+ *
247
+ * @param attachmentId - Attachment ID
248
+ * @returns Attachment metadata
249
+ */
250
+ getAttachment(attachmentId: string): Promise<AttachmentMetadata>;
251
+ /**
252
+ * Download attachment content
253
+ *
254
+ * @param attachmentId - Attachment ID
255
+ * @returns Blob containing the attachment content
256
+ */
257
+ downloadAttachment(attachmentId: string): Promise<Blob>;
258
+ /**
259
+ * Delete an attachment
260
+ *
261
+ * @param attachmentId - Attachment ID
262
+ */
263
+ deleteAttachment(attachmentId: string): Promise<void>;
264
+ /**
265
+ * Get all links for an issue
266
+ *
267
+ * @param issueIdOrKey - Issue ID or key
268
+ * @returns Array of issue links
269
+ */
270
+ getIssueLinks(issueIdOrKey: string): Promise<IssueLink[]>;
271
+ /**
272
+ * Create a link between two issues
273
+ *
274
+ * @param input - Issue link creation input
275
+ *
276
+ * @example
277
+ * ```typescript
278
+ * await client.issues.createIssueLink({
279
+ * type: { name: 'Blocks' },
280
+ * inwardIssue: { key: 'PROJECT-123' },
281
+ * outwardIssue: { key: 'PROJECT-456' },
282
+ * });
283
+ * ```
284
+ */
285
+ createIssueLink(input: CreateIssueLinkInput): Promise<void>;
286
+ /**
287
+ * Get an issue link by ID
288
+ *
289
+ * @param linkId - Issue link ID
290
+ * @returns Issue link
291
+ */
292
+ getIssueLink(linkId: string): Promise<IssueLink>;
293
+ /**
294
+ * Delete an issue link
295
+ *
296
+ * @param linkId - Issue link ID
297
+ */
298
+ deleteIssueLink(linkId: string): Promise<void>;
299
+ /**
300
+ * List all available issue link types
301
+ *
302
+ * @returns Issue link types response
303
+ */
304
+ listIssueLinkTypes(): Promise<IssueLinkTypesResponse>;
305
+ /**
306
+ * Get a specific issue link type
307
+ *
308
+ * @param linkTypeId - Issue link type ID
309
+ * @returns Issue link type
310
+ */
311
+ getIssueLinkType(linkTypeId: string): Promise<IssueLinkType>;
229
312
  }
230
313
 
231
314
  /**
@@ -1,7 +1,7 @@
1
1
  import { z } from 'zod';
2
2
  import * as _felixgeelhaar_sdk_core from '@felixgeelhaar/sdk-core';
3
3
  import { HttpClient, RequestOptions, HttpResponse } from '@felixgeelhaar/sdk-core';
4
- import { l as GetIssueOptions, e as Issue, h as CreateIssueInput, k as CreateIssueResponse, i as UpdateIssueInput, u as CommentsPage, p as Comment, q as AddCommentInput, s as UpdateCommentInput, x as TransitionsResponse, y as DoTransitionInput, O as Watchers, M as WorklogsPage, E as Worklog, H as AddWorklogInput, K as UpdateWorklogInput, S as Project, a1 as GetProjectsOptions, $ as ProjectSearchResult, X as CreateProjectInput, Z as UpdateProjectInput } from '../project-BtUx-eSv.js';
4
+ import { l as GetIssueOptions, e as Issue, h as CreateIssueInput, k as CreateIssueResponse, i as UpdateIssueInput, u as CommentsPage, p as Comment, q as AddCommentInput, s as UpdateCommentInput, x as TransitionsResponse, y as DoTransitionInput, ac as Watchers, S as WorklogsPage, M as Worklog, O as AddWorklogInput, Q as UpdateWorklogInput, B as Attachment, F as AttachmentMetadata, a1 as IssueLink, a3 as CreateIssueLinkInput, a5 as IssueLinkTypesResponse, X as IssueLinkType, ag as Project, ao as GetProjectsOptions, am as ProjectSearchResult, ai as CreateProjectInput, ak as UpdateProjectInput } from '../project-B1UelBH4.js';
5
5
  import { User } from '@felixgeelhaar/sdk-core/schemas';
6
6
 
7
7
  /**
@@ -226,6 +226,89 @@ declare class IssueService extends BaseService {
226
226
  * Remove your vote from an issue
227
227
  */
228
228
  removeVote(issueIdOrKey: string): Promise<void>;
229
+ /**
230
+ * Add an attachment to an issue
231
+ *
232
+ * @param issueIdOrKey - Issue ID or key
233
+ * @param file - File or Blob to upload
234
+ * @param filename - Optional filename (defaults to File.name or 'attachment')
235
+ * @returns Array of created attachments
236
+ *
237
+ * @example
238
+ * ```typescript
239
+ * const file = new File(['content'], 'document.txt', { type: 'text/plain' });
240
+ * const attachments = await client.issues.addAttachment('PROJECT-123', file);
241
+ * ```
242
+ */
243
+ addAttachment(issueIdOrKey: string, file: File | Blob, filename?: string): Promise<Attachment[]>;
244
+ /**
245
+ * Get attachment metadata by ID
246
+ *
247
+ * @param attachmentId - Attachment ID
248
+ * @returns Attachment metadata
249
+ */
250
+ getAttachment(attachmentId: string): Promise<AttachmentMetadata>;
251
+ /**
252
+ * Download attachment content
253
+ *
254
+ * @param attachmentId - Attachment ID
255
+ * @returns Blob containing the attachment content
256
+ */
257
+ downloadAttachment(attachmentId: string): Promise<Blob>;
258
+ /**
259
+ * Delete an attachment
260
+ *
261
+ * @param attachmentId - Attachment ID
262
+ */
263
+ deleteAttachment(attachmentId: string): Promise<void>;
264
+ /**
265
+ * Get all links for an issue
266
+ *
267
+ * @param issueIdOrKey - Issue ID or key
268
+ * @returns Array of issue links
269
+ */
270
+ getIssueLinks(issueIdOrKey: string): Promise<IssueLink[]>;
271
+ /**
272
+ * Create a link between two issues
273
+ *
274
+ * @param input - Issue link creation input
275
+ *
276
+ * @example
277
+ * ```typescript
278
+ * await client.issues.createIssueLink({
279
+ * type: { name: 'Blocks' },
280
+ * inwardIssue: { key: 'PROJECT-123' },
281
+ * outwardIssue: { key: 'PROJECT-456' },
282
+ * });
283
+ * ```
284
+ */
285
+ createIssueLink(input: CreateIssueLinkInput): Promise<void>;
286
+ /**
287
+ * Get an issue link by ID
288
+ *
289
+ * @param linkId - Issue link ID
290
+ * @returns Issue link
291
+ */
292
+ getIssueLink(linkId: string): Promise<IssueLink>;
293
+ /**
294
+ * Delete an issue link
295
+ *
296
+ * @param linkId - Issue link ID
297
+ */
298
+ deleteIssueLink(linkId: string): Promise<void>;
299
+ /**
300
+ * List all available issue link types
301
+ *
302
+ * @returns Issue link types response
303
+ */
304
+ listIssueLinkTypes(): Promise<IssueLinkTypesResponse>;
305
+ /**
306
+ * Get a specific issue link type
307
+ *
308
+ * @param linkTypeId - Issue link type ID
309
+ * @returns Issue link type
310
+ */
311
+ getIssueLinkType(linkTypeId: string): Promise<IssueLinkType>;
229
312
  }
230
313
 
231
314
  /**
@@ -13060,6 +13060,30 @@ var DoTransitionInputSchema = external_exports.object({
13060
13060
  historyMetadata: external_exports.record(external_exports.string(), external_exports.unknown()).optional(),
13061
13061
  properties: external_exports.array(external_exports.record(external_exports.string(), external_exports.unknown())).optional()
13062
13062
  });
13063
+ var AttachmentSchema = external_exports.object({
13064
+ self: external_exports.url(),
13065
+ id: external_exports.string(),
13066
+ filename: external_exports.string(),
13067
+ author: UserRefSchema.optional(),
13068
+ created: OptionalJiraDateTimeSchema,
13069
+ size: external_exports.number().int().min(0),
13070
+ mimeType: external_exports.string(),
13071
+ content: external_exports.url(),
13072
+ thumbnail: external_exports.url().optional()
13073
+ });
13074
+ var AttachmentMetadataSchema = external_exports.object({
13075
+ id: external_exports.number(),
13076
+ self: external_exports.url(),
13077
+ filename: external_exports.string(),
13078
+ author: UserRefSchema,
13079
+ created: OptionalJiraDateTimeSchema,
13080
+ size: external_exports.number(),
13081
+ mimeType: external_exports.string(),
13082
+ properties: external_exports.record(external_exports.string(), external_exports.unknown()).optional(),
13083
+ content: external_exports.url().optional(),
13084
+ thumbnail: external_exports.url().optional()
13085
+ });
13086
+ var AddAttachmentResponseSchema = external_exports.array(AttachmentSchema);
13063
13087
  var WorklogVisibilitySchema = external_exports.object({
13064
13088
  type: external_exports.enum(["group", "role"]),
13065
13089
  value: external_exports.string(),
@@ -13097,6 +13121,52 @@ var WorklogsPageSchema = external_exports.object({
13097
13121
  total: external_exports.number(),
13098
13122
  worklogs: external_exports.array(WorklogSchema)
13099
13123
  });
13124
+
13125
+ // src/schemas/issue/link.ts
13126
+ var IssueLinkTypeSchema = external_exports.object({
13127
+ id: external_exports.string(),
13128
+ name: external_exports.string(),
13129
+ inward: external_exports.string(),
13130
+ outward: external_exports.string(),
13131
+ self: external_exports.url().optional()
13132
+ });
13133
+ var LinkedIssueFieldsSchema = external_exports.object({
13134
+ summary: external_exports.string().optional(),
13135
+ status: IssueStatusSchema.optional(),
13136
+ priority: IssuePrioritySchema.nullable().optional(),
13137
+ issuetype: IssueTypeSchema.optional()
13138
+ });
13139
+ var LinkedIssueSchema = external_exports.object({
13140
+ id: external_exports.string(),
13141
+ key: external_exports.string(),
13142
+ self: external_exports.url().optional(),
13143
+ fields: LinkedIssueFieldsSchema.optional()
13144
+ });
13145
+ var IssueLinkSchema = external_exports.object({
13146
+ id: external_exports.string(),
13147
+ self: external_exports.url().optional(),
13148
+ type: IssueLinkTypeSchema,
13149
+ inwardIssue: LinkedIssueSchema.optional(),
13150
+ outwardIssue: LinkedIssueSchema.optional()
13151
+ });
13152
+ var CreateIssueLinkInputSchema = external_exports.object({
13153
+ type: external_exports.object({
13154
+ name: external_exports.string().optional(),
13155
+ id: external_exports.string().optional()
13156
+ }),
13157
+ inwardIssue: external_exports.object({ key: external_exports.string() }).optional(),
13158
+ outwardIssue: external_exports.object({ key: external_exports.string() }).optional(),
13159
+ comment: external_exports.object({
13160
+ body: external_exports.unknown(),
13161
+ visibility: external_exports.object({
13162
+ type: external_exports.enum(["group", "role"]),
13163
+ value: external_exports.string()
13164
+ }).optional()
13165
+ }).optional()
13166
+ });
13167
+ var IssueLinkTypesResponseSchema = external_exports.object({
13168
+ issueLinkTypes: external_exports.array(IssueLinkTypeSchema)
13169
+ });
13100
13170
  var WatchersSchema = external_exports.object({
13101
13171
  self: external_exports.url(),
13102
13172
  watchCount: external_exports.number().int().min(0),
@@ -13465,6 +13535,139 @@ var IssueService = class extends BaseService {
13465
13535
  async removeVote(issueIdOrKey) {
13466
13536
  await this.deleteMethod(`/issue/${issueIdOrKey}/votes`);
13467
13537
  }
13538
+ // Attachments
13539
+ /**
13540
+ * Add an attachment to an issue
13541
+ *
13542
+ * @param issueIdOrKey - Issue ID or key
13543
+ * @param file - File or Blob to upload
13544
+ * @param filename - Optional filename (defaults to File.name or 'attachment')
13545
+ * @returns Array of created attachments
13546
+ *
13547
+ * @example
13548
+ * ```typescript
13549
+ * const file = new File(['content'], 'document.txt', { type: 'text/plain' });
13550
+ * const attachments = await client.issues.addAttachment('PROJECT-123', file);
13551
+ * ```
13552
+ */
13553
+ async addAttachment(issueIdOrKey, file2, filename) {
13554
+ const formData = new FormData();
13555
+ const name = filename ?? (file2 instanceof File ? file2.name : "attachment");
13556
+ formData.append("file", file2, name);
13557
+ const response = await this.http.post(
13558
+ this.buildPath(`/issue/${issueIdOrKey}/attachments`),
13559
+ formData,
13560
+ {
13561
+ headers: {
13562
+ "X-Atlassian-Token": "no-check"
13563
+ }
13564
+ }
13565
+ );
13566
+ return this.validateResponse(response, AddAttachmentResponseSchema);
13567
+ }
13568
+ /**
13569
+ * Get attachment metadata by ID
13570
+ *
13571
+ * @param attachmentId - Attachment ID
13572
+ * @returns Attachment metadata
13573
+ */
13574
+ async getAttachment(attachmentId) {
13575
+ return this.getMethod(`/attachment/${attachmentId}`, AttachmentMetadataSchema);
13576
+ }
13577
+ /**
13578
+ * Download attachment content
13579
+ *
13580
+ * @param attachmentId - Attachment ID
13581
+ * @returns Blob containing the attachment content
13582
+ */
13583
+ async downloadAttachment(attachmentId) {
13584
+ const response = await this.http.request({
13585
+ method: "GET",
13586
+ url: this.buildPath(`/attachment/content/${attachmentId}`),
13587
+ headers: {
13588
+ Accept: "*/*"
13589
+ },
13590
+ metadata: { rawResponse: true }
13591
+ });
13592
+ return response.data;
13593
+ }
13594
+ /**
13595
+ * Delete an attachment
13596
+ *
13597
+ * @param attachmentId - Attachment ID
13598
+ */
13599
+ async deleteAttachment(attachmentId) {
13600
+ await this.deleteMethod(`/attachment/${attachmentId}`);
13601
+ }
13602
+ // Issue Links
13603
+ /**
13604
+ * Get all links for an issue
13605
+ *
13606
+ * @param issueIdOrKey - Issue ID or key
13607
+ * @returns Array of issue links
13608
+ */
13609
+ async getIssueLinks(issueIdOrKey) {
13610
+ const issue2 = await this.get(issueIdOrKey, {
13611
+ fields: ["issuelinks"]
13612
+ });
13613
+ const links = issue2.fields["issuelinks"];
13614
+ if (!links || !Array.isArray(links)) {
13615
+ return [];
13616
+ }
13617
+ return links.map((link) => IssueLinkSchema.parse(link));
13618
+ }
13619
+ /**
13620
+ * Create a link between two issues
13621
+ *
13622
+ * @param input - Issue link creation input
13623
+ *
13624
+ * @example
13625
+ * ```typescript
13626
+ * await client.issues.createIssueLink({
13627
+ * type: { name: 'Blocks' },
13628
+ * inwardIssue: { key: 'PROJECT-123' },
13629
+ * outwardIssue: { key: 'PROJECT-456' },
13630
+ * });
13631
+ * ```
13632
+ */
13633
+ async createIssueLink(input) {
13634
+ const validatedInput = CreateIssueLinkInputSchema.parse(input);
13635
+ await this.postMethodRaw("/issueLink", validatedInput);
13636
+ }
13637
+ /**
13638
+ * Get an issue link by ID
13639
+ *
13640
+ * @param linkId - Issue link ID
13641
+ * @returns Issue link
13642
+ */
13643
+ async getIssueLink(linkId) {
13644
+ return this.getMethod(`/issueLink/${linkId}`, IssueLinkSchema);
13645
+ }
13646
+ /**
13647
+ * Delete an issue link
13648
+ *
13649
+ * @param linkId - Issue link ID
13650
+ */
13651
+ async deleteIssueLink(linkId) {
13652
+ await this.deleteMethod(`/issueLink/${linkId}`);
13653
+ }
13654
+ /**
13655
+ * List all available issue link types
13656
+ *
13657
+ * @returns Issue link types response
13658
+ */
13659
+ async listIssueLinkTypes() {
13660
+ return this.getMethod("/issueLinkType", IssueLinkTypesResponseSchema);
13661
+ }
13662
+ /**
13663
+ * Get a specific issue link type
13664
+ *
13665
+ * @param linkTypeId - Issue link type ID
13666
+ * @returns Issue link type
13667
+ */
13668
+ async getIssueLinkType(linkTypeId) {
13669
+ return this.getMethod(`/issueLinkType/${linkTypeId}`, IssueLinkTypeSchema);
13670
+ }
13468
13671
  };
13469
13672
 
13470
13673
  // src/services/project.service.ts