Skip to content

Commit 1e6ba70

Browse files
authored
🤖 Merge PR DefinitelyTyped#73017 feat: add types for the Trello PowerUp Client Library by @tatablack
1 parent 8153e55 commit 1e6ba70

23 files changed

+2820
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
*
2+
!**/*.d.ts
3+
!**/*.d.cts
4+
!**/*.d.mts
5+
!**/*.d.*.ts
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
export as namespace Trello;
2+
3+
export * from "./lib/base";
4+
export * as Callback from "./lib/callback";
5+
export * as L18N from "./lib/localizer";
6+
export * as PowerUp from "./lib/powerup";
7+
export * as Theming from "./lib/theming";
8+
9+
declare global {
10+
interface Window {
11+
TrelloPowerUp: Trello.PowerUp.PowerUp;
12+
locale: string;
13+
}
14+
}
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
import * as Theming from "./theming";
2+
3+
export type MemberType = "admin" | "normal" | "observer";
4+
5+
export interface Organization {
6+
id: string;
7+
name: string;
8+
paidStatus: string; // One of "free" or "paid", I suspect. I can only verify "free".
9+
}
10+
11+
export interface Member {
12+
id: string;
13+
fullName: string | null;
14+
username: string | null;
15+
initials: string | null;
16+
avatar: string | null;
17+
}
18+
19+
export interface Membership {
20+
deactivated: boolean;
21+
id: string;
22+
idMember: string;
23+
memberType: MemberType;
24+
unconfirmed: boolean;
25+
}
26+
27+
export interface Label {
28+
id: string;
29+
name: string;
30+
color: Theming.ColorName;
31+
}
32+
33+
export interface CustomFieldValue {
34+
checked?: string;
35+
date?: string;
36+
text?: string;
37+
number?: string;
38+
}
39+
40+
export interface CustomField {
41+
id: string;
42+
idCustomField: string;
43+
idValue?: string;
44+
value?: CustomFieldValue;
45+
}
46+
47+
export interface AttachmentPreview {
48+
bytes: number;
49+
height: number;
50+
scaled: boolean;
51+
url: string;
52+
width: number;
53+
}
54+
55+
export interface Attachment {
56+
date: string;
57+
edgeColor: string;
58+
id: string;
59+
idMember: string;
60+
name: string;
61+
previews: AttachmentPreview[];
62+
url: string;
63+
}
64+
65+
export interface Coordinates {
66+
latitude: number;
67+
longitude: number;
68+
}
69+
70+
export interface AttachmentsByType {
71+
[key: string]: {
72+
board: number;
73+
card: number;
74+
};
75+
}
76+
77+
export interface BadgesInfo {
78+
attachments: number;
79+
attachmentsByType: AttachmentsByType;
80+
checkItems: number;
81+
checkItemsChecked: number;
82+
comments: number;
83+
description: boolean;
84+
due: string; // timestamp
85+
dueComplete: boolean;
86+
fogbugz: string;
87+
location: boolean;
88+
subscribed: boolean;
89+
viewingMemberVoted: boolean;
90+
votes: number;
91+
}
92+
93+
export interface Board {
94+
id: string;
95+
name: string;
96+
url: string; // https://trello.com/c/I5nAdteE/9-test
97+
shortLink: string;
98+
members: Member[];
99+
dateLastActivity: string; // "2025-05-21T09:14:24.641Z"
100+
idOrganization: string;
101+
customFields: CustomField[];
102+
labels: Label[];
103+
memberships: Membership[];
104+
paidStatus: string; // One of "free" or "paid", I suspect. I can only verify "free".
105+
}
106+
107+
export interface Card {
108+
address: string | null;
109+
attachments: Attachment[];
110+
badges: BadgesInfo;
111+
closed: boolean;
112+
coordinates: Coordinates | null;
113+
cover: Attachment | null;
114+
customFieldItems: CustomField[];
115+
dateLastActivity: string; // "2019-11-28T15:53:19.709Z"
116+
desc: string;
117+
due: string | null; // "2019-11-28T15:53:19.709Z"
118+
dueComplete: boolean;
119+
id: string;
120+
idList: string;
121+
idShort: number;
122+
labels: Label[];
123+
locationName: string | null;
124+
members: Member[];
125+
name: string;
126+
pos: number;
127+
shortLink: string;
128+
url: string; // https://trello.com/c/I5nAdteE/9-test
129+
}
130+
131+
export interface List {
132+
id: string;
133+
name: string;
134+
cards: Card[];
135+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import * as PowerUp from "./powerup";
2+
3+
export type CacheAction = "run" | "retain" | "release";
4+
export type SerializeResult = (value: unknown, key?: string) => unknown | SerializeOutput;
5+
6+
export interface SerializeOutput {
7+
_callback: string;
8+
}
9+
10+
export interface CacheOptions {
11+
action: CacheAction;
12+
options: unknown;
13+
callback: string;
14+
}
15+
16+
export interface Cache {
17+
callback(t: PowerUp.Plugin, options: CacheOptions, serializeResult: SerializeResult): Promise<unknown>;
18+
serialize(fx: (t: PowerUp.Plugin, args: unknown) => unknown): SerializeOutput;
19+
reset(): void;
20+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
export type Permissions = "read" | "write";
2+
3+
export interface Context {
4+
board: string;
5+
card?: string;
6+
command?: string; // e.g. "show-settings"
7+
member: string; // Member ID
8+
organization?: string; // Organization ID
9+
enterprise?: string;
10+
permissions?: {
11+
board: Permissions;
12+
card: Permissions;
13+
organization: Permissions;
14+
};
15+
version: string;
16+
locale: string; // e.g. "en-US"
17+
theme: string; // e.g. dark. "dark" or "light"? What about "system"?
18+
initialTheme: string; // e.g. dark. "dark" or "light"? What about "system"?
19+
el: string;
20+
plugin: string; // Power-up ID
21+
}

0 commit comments

Comments
 (0)