@dereekb/trello 13.11.15 → 13.11.17

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.
@@ -260,6 +260,37 @@ exports.TrelloApi = /*#__PURE__*/ function() {
260
260
  return trello.listCardActions(this.trelloContext);
261
261
  }
262
262
  },
263
+ {
264
+ key: "listCardAttachments",
265
+ get: // MARK: Card Attachments
266
+ function get() {
267
+ return trello.listCardAttachments(this.trelloContext);
268
+ }
269
+ },
270
+ {
271
+ key: "getCardAttachment",
272
+ get: function get() {
273
+ return trello.getCardAttachment(this.trelloContext);
274
+ }
275
+ },
276
+ {
277
+ key: "addAttachmentToCard",
278
+ get: function get() {
279
+ return trello.addAttachmentToCard(this.trelloContext);
280
+ }
281
+ },
282
+ {
283
+ key: "deleteAttachmentFromCard",
284
+ get: function get() {
285
+ return trello.deleteAttachmentFromCard(this.trelloContext);
286
+ }
287
+ },
288
+ {
289
+ key: "downloadCardAttachment",
290
+ get: function get() {
291
+ return trello.downloadCardAttachment(this.trelloContext);
292
+ }
293
+ },
263
294
  {
264
295
  key: "getMember",
265
296
  get: // MARK: Members
@@ -1,5 +1,5 @@
1
1
  import { Injectable, Inject, Logger, Head, Post, Req, Controller, Module } from '@nestjs/common';
2
- import { trelloFactory, getBoard, createBoard, updateBoard, deleteBoard, listBoardLists, listBoardCards, listBoardMembers, listBoardLabels, getList, createList, updateList, listCardsInList, getCard, createCard, updateCard, deleteCard, addCommentToCard, addMemberToCard, addLabelToCard, listCardActions, getMember, getMe, createWebhook, getWebhook, updateWebhook, deleteWebhook, listWebhooksForToken } from '@dereekb/trello';
2
+ import { trelloFactory, getBoard, createBoard, updateBoard, deleteBoard, listBoardLists, listBoardCards, listBoardMembers, listBoardLabels, getList, createList, updateList, listCardsInList, getCard, createCard, updateCard, deleteCard, addCommentToCard, addMemberToCard, addLabelToCard, listCardActions, listCardAttachments, getCardAttachment, addAttachmentToCard, deleteAttachmentFromCard, downloadCardAttachment, getMember, getMe, createWebhook, getWebhook, updateWebhook, deleteWebhook, listWebhooksForToken } from '@dereekb/trello';
3
3
  import { ConfigService, ConfigModule } from '@nestjs/config';
4
4
  import { handlerFactory, handlerConfigurerFactory, handlerMappedSetFunctionFactory } from '@dereekb/util';
5
5
  import { RawBody } from '@dereekb/nestjs';
@@ -258,6 +258,37 @@ var TrelloApi = /*#__PURE__*/ function() {
258
258
  return listCardActions(this.trelloContext);
259
259
  }
260
260
  },
261
+ {
262
+ key: "listCardAttachments",
263
+ get: // MARK: Card Attachments
264
+ function get() {
265
+ return listCardAttachments(this.trelloContext);
266
+ }
267
+ },
268
+ {
269
+ key: "getCardAttachment",
270
+ get: function get() {
271
+ return getCardAttachment(this.trelloContext);
272
+ }
273
+ },
274
+ {
275
+ key: "addAttachmentToCard",
276
+ get: function get() {
277
+ return addAttachmentToCard(this.trelloContext);
278
+ }
279
+ },
280
+ {
281
+ key: "deleteAttachmentFromCard",
282
+ get: function get() {
283
+ return deleteAttachmentFromCard(this.trelloContext);
284
+ }
285
+ },
286
+ {
287
+ key: "downloadCardAttachment",
288
+ get: function get() {
289
+ return downloadCardAttachment(this.trelloContext);
290
+ }
291
+ },
261
292
  {
262
293
  key: "getMember",
263
294
  get: // MARK: Members
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@dereekb/trello/nestjs",
3
- "version": "13.11.15",
3
+ "version": "13.11.17",
4
4
  "peerDependencies": {
5
- "@dereekb/nestjs": "13.11.15",
6
- "@dereekb/rxjs": "13.11.15",
7
- "@dereekb/trello": "13.11.15",
8
- "@dereekb/util": "13.11.15",
5
+ "@dereekb/nestjs": "13.11.17",
6
+ "@dereekb/rxjs": "13.11.17",
7
+ "@dereekb/trello": "13.11.17",
8
+ "@dereekb/util": "13.11.17",
9
9
  "@nestjs/common": "^11.1.19",
10
10
  "@nestjs/config": "^4.0.4",
11
11
  "express": "^5.2.1"
@@ -26,6 +26,11 @@ export declare class TrelloApi {
26
26
  get addMemberToCard(): import("@dereekb/trello").AddMemberToCardFunction;
27
27
  get addLabelToCard(): import("@dereekb/trello").AddLabelToCardFunction;
28
28
  get listCardActions(): import("@dereekb/trello").ListCardActionsFunction;
29
+ get listCardAttachments(): import("@dereekb/trello").ListCardAttachmentsFunction;
30
+ get getCardAttachment(): import("@dereekb/trello").GetCardAttachmentFunction;
31
+ get addAttachmentToCard(): import("@dereekb/trello").AddAttachmentToCardFunction;
32
+ get deleteAttachmentFromCard(): import("@dereekb/trello").DeleteAttachmentFromCardFunction;
33
+ get downloadCardAttachment(): import("@dereekb/trello").DownloadCardAttachmentFunction;
29
34
  get getMember(): import("@dereekb/trello").GetMemberFunction;
30
35
  get getMe(): import("@dereekb/trello").GetMeFunction;
31
36
  get createWebhook(): import("@dereekb/trello").CreateWebhookFunction;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dereekb/trello",
3
- "version": "13.11.15",
3
+ "version": "13.11.17",
4
4
  "exports": {
5
5
  "./nestjs": {
6
6
  "module": "./nestjs/index.esm.js",
@@ -17,9 +17,9 @@
17
17
  }
18
18
  },
19
19
  "peerDependencies": {
20
- "@dereekb/nestjs": "13.11.15",
21
- "@dereekb/rxjs": "13.11.15",
22
- "@dereekb/util": "13.11.15",
20
+ "@dereekb/nestjs": "13.11.17",
21
+ "@dereekb/rxjs": "13.11.17",
22
+ "@dereekb/util": "13.11.17",
23
23
  "@nestjs/common": "^11.1.19",
24
24
  "@nestjs/config": "^4.0.4",
25
25
  "express": "^5.2.1",
@@ -5,6 +5,8 @@ export * from './trello.api.list';
5
5
  export * from './trello.api.list.type';
6
6
  export * from './trello.api.card';
7
7
  export * from './trello.api.card.type';
8
+ export * from './trello.api.card.attachment';
9
+ export * from './trello.api.card.attachment.type';
8
10
  export * from './trello.api.member';
9
11
  export * from './trello.api.member.type';
10
12
  export * from './trello.api.webhook';
@@ -0,0 +1,105 @@
1
+ import { type TrelloContext } from './trello.factory';
2
+ import { type TrelloAttachmentId, type TrelloCardId } from '../trello.type';
3
+ import { type AddAttachmentToCardBody, type TrelloAttachment } from './trello.api.card.attachment.type';
4
+ export interface ListCardAttachmentsInput {
5
+ readonly cardId: TrelloCardId;
6
+ /**
7
+ * Comma-separated list of attachment fields to return, or `all`.
8
+ */
9
+ readonly fields?: string;
10
+ /**
11
+ * Optional filter (e.g. `cover`).
12
+ */
13
+ readonly filter?: string;
14
+ }
15
+ export type ListCardAttachmentsFunction = (input: ListCardAttachmentsInput) => Promise<ReadonlyArray<TrelloAttachment>>;
16
+ /**
17
+ * Https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-id-attachments-get.
18
+ *
19
+ * @param context - The Trello API context.
20
+ * @returns Lists attachments on a card.
21
+ */
22
+ export declare function listCardAttachments(context: TrelloContext): ListCardAttachmentsFunction;
23
+ export interface GetCardAttachmentInput {
24
+ readonly cardId: TrelloCardId;
25
+ readonly attachmentId: TrelloAttachmentId;
26
+ /**
27
+ * Comma-separated list of attachment fields to return, or `all`.
28
+ */
29
+ readonly fields?: string;
30
+ }
31
+ export type GetCardAttachmentFunction = (input: GetCardAttachmentInput) => Promise<TrelloAttachment>;
32
+ /**
33
+ * Https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-id-attachments-idattachment-get.
34
+ *
35
+ * @param context - The Trello API context.
36
+ * @returns Retrieves a single attachment on a card.
37
+ */
38
+ export declare function getCardAttachment(context: TrelloContext): GetCardAttachmentFunction;
39
+ export interface AddAttachmentToCardInput extends AddAttachmentToCardBody {
40
+ readonly cardId: TrelloCardId;
41
+ }
42
+ export type AddAttachmentToCardFunction = (input: AddAttachmentToCardInput) => Promise<TrelloAttachment>;
43
+ /**
44
+ * Https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-id-attachments-post.
45
+ *
46
+ * Supports both file uploads (multipart/form-data) and url-only attachments. Pass exactly one of `file` or `url`.
47
+ *
48
+ * @param context - The Trello API context.
49
+ * @returns Adds an attachment (file or url) to a card.
50
+ */
51
+ export declare function addAttachmentToCard(context: TrelloContext): AddAttachmentToCardFunction;
52
+ export interface DeleteAttachmentFromCardInput {
53
+ readonly cardId: TrelloCardId;
54
+ readonly attachmentId: TrelloAttachmentId;
55
+ }
56
+ export type DeleteAttachmentFromCardFunction = (input: DeleteAttachmentFromCardInput) => Promise<void>;
57
+ /**
58
+ * Https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-id-attachments-idattachment-delete.
59
+ *
60
+ * @param context - The Trello API context.
61
+ * @returns Removes an attachment from a card.
62
+ */
63
+ export declare function deleteAttachmentFromCard(context: TrelloContext): DeleteAttachmentFromCardFunction;
64
+ /**
65
+ * Result returned by {@link downloadCardAttachment}. The attachment metadata is included so callers
66
+ * can correlate the bytes with the original filename, mime type, and size without an extra request.
67
+ */
68
+ export interface DownloadCardAttachmentResult {
69
+ readonly attachment: TrelloAttachment;
70
+ readonly response: Response;
71
+ /**
72
+ * Reads the response body as an ArrayBuffer.
73
+ */
74
+ readonly arrayBuffer: () => Promise<ArrayBuffer>;
75
+ /**
76
+ * Reads the response body as a Blob (typed with the attachment's mime type when available).
77
+ */
78
+ readonly blob: () => Promise<Blob>;
79
+ /**
80
+ * Reads the response body as text.
81
+ */
82
+ readonly text: () => Promise<string>;
83
+ }
84
+ export interface DownloadCardAttachmentInput {
85
+ readonly cardId: TrelloCardId;
86
+ readonly attachmentId: TrelloAttachmentId;
87
+ /**
88
+ * Optional pre-fetched attachment metadata. When provided, skips the extra GET request used to resolve the file name.
89
+ */
90
+ readonly attachment?: TrelloAttachment;
91
+ }
92
+ export type DownloadCardAttachmentFunction = (input: DownloadCardAttachmentInput) => Promise<DownloadCardAttachmentResult>;
93
+ /**
94
+ * Downloads the raw bytes of a card attachment via the authenticated Trello download endpoint:
95
+ * `GET /cards/{id}/attachments/{idAttachment}/download/{filename}`.
96
+ *
97
+ * The configured Trello fetch automatically attaches the OAuth `Authorization` header required by Trello
98
+ * for private file downloads.
99
+ *
100
+ * @param context - The Trello API context.
101
+ * @returns Downloads the attachment bytes along with its metadata.
102
+ *
103
+ * @see https://developer.atlassian.com/cloud/trello/guides/rest-api/file-attachments/
104
+ */
105
+ export declare function downloadCardAttachment(context: TrelloContext): DownloadCardAttachmentFunction;
@@ -0,0 +1,88 @@
1
+ import { type ContentTypeMimeType, type Maybe } from '@dereekb/util';
2
+ import { type TrelloAttachmentId, type TrelloMemberId } from '../trello.type';
3
+ /**
4
+ * A scaled preview generated by Trello for image attachments.
5
+ *
6
+ * @see https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-id-attachments-id-get
7
+ */
8
+ export interface TrelloAttachmentPreview {
9
+ readonly id: string;
10
+ readonly url: string;
11
+ readonly bytes: number;
12
+ readonly width: number;
13
+ readonly height: number;
14
+ readonly scaled: boolean;
15
+ }
16
+ /**
17
+ * A Trello attachment.
18
+ *
19
+ * Attachments can be uploaded files or URL-only references. File attachments expose `bytes`, `mimeType`,
20
+ * and a non-empty `previews` array for image content. URL attachments have `bytes === null` and an empty
21
+ * `previews` array.
22
+ *
23
+ * @see https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-id-attachments-get
24
+ */
25
+ export interface TrelloAttachment {
26
+ readonly id: TrelloAttachmentId;
27
+ readonly idMember: TrelloMemberId;
28
+ readonly name: string;
29
+ /**
30
+ * Original file name (for uploaded files). Empty for URL-only attachments.
31
+ */
32
+ readonly fileName: string;
33
+ /**
34
+ * Authenticated download url for the attachment file (or the external url for URL-only attachments).
35
+ *
36
+ * For uploaded private files Trello requires the OAuth `Authorization` header to download.
37
+ */
38
+ readonly url: string;
39
+ /**
40
+ * File size in bytes, or `null` for URL-only attachments.
41
+ */
42
+ readonly bytes: Maybe<number>;
43
+ /**
44
+ * MIME type of the uploaded file, or `null` for URL-only attachments.
45
+ */
46
+ readonly mimeType: Maybe<ContentTypeMimeType>;
47
+ readonly date: string;
48
+ readonly edgeColor: Maybe<string>;
49
+ readonly pos: number;
50
+ readonly isUpload: boolean;
51
+ readonly previews: ReadonlyArray<TrelloAttachmentPreview>;
52
+ }
53
+ export interface AddAttachmentToCardFileInput {
54
+ /**
55
+ * File bytes to upload. Accepts anything `BlobPart` supports — `Buffer`, `Uint8Array`, `ArrayBuffer`, `string`, or a `Blob`.
56
+ */
57
+ readonly content: BlobPart;
58
+ /**
59
+ * File name (including extension) that Trello will display.
60
+ */
61
+ readonly fileName: string;
62
+ /**
63
+ * MIME type for the uploaded file. Defaults to `application/octet-stream` when omitted.
64
+ */
65
+ readonly mimeType?: ContentTypeMimeType;
66
+ }
67
+ export interface AddAttachmentToCardBody {
68
+ /**
69
+ * Optional display name. Defaults to the file name (for file uploads) or the url (for url-only attachments).
70
+ */
71
+ readonly name?: string;
72
+ /**
73
+ * Uploads a file. Mutually exclusive with `url`.
74
+ */
75
+ readonly file?: AddAttachmentToCardFileInput;
76
+ /**
77
+ * Attaches an external url. Mutually exclusive with `file`.
78
+ */
79
+ readonly url?: string;
80
+ /**
81
+ * If true, asks Trello to use this attachment for the card cover (uploaded files only).
82
+ */
83
+ readonly setCover?: boolean;
84
+ /**
85
+ * Optional mimeType override sent as a form field — only honored for url-only attachments.
86
+ */
87
+ readonly mimeType?: ContentTypeMimeType;
88
+ }
@@ -9,6 +9,7 @@ export type TrelloMemberId = TrelloId;
9
9
  export type TrelloLabelId = TrelloId;
10
10
  export type TrelloActionId = TrelloId;
11
11
  export type TrelloChecklistId = TrelloId;
12
+ export type TrelloAttachmentId = TrelloId;
12
13
  export type TrelloWebhookId = TrelloId;
13
14
  export type TrelloOrganizationId = TrelloId;
14
15
  export type TrelloEnterpriseId = TrelloId;