| undefined;
disabled?: boolean | undefined;
} & ({
route: string;
} | {
action: string;
})) | {
disabled?: boolean | undefined;
url: string;
} | {
disabled: true;
}))[] | undefined;
}, null>;
/**
* Displays rendered markdown to the action user. Accepts GitHub Flavored Markdown.
*
* **Usage:**
*
* ```typescript
* await io.display.markdown("**Warning:** This _will_ erase user data.");
* ```
*/
markdown: DisplayIOComponentFunction<"DISPLAY_MARKDOWN", {}, null>;
/**
* Displays rendered HTML to the action user.
*
* **Usage:**
*
* ```typescript
* await io.display.html("Message body", {
* html: `Hello, world!
`
* });
* ```
*/
html: DisplayIOComponentFunction<"DISPLAY_HTML", {
html: string;
}, null>;
/**
* Displays an image to the action user.
*
* One of `url` or `buffer` must be provided.
*
* **Usage:**
*
* ```typescript
* await io.display.image("An animated gif", {
* url: "https://media.giphy.com/media/26ybw6AltpBRmyS76/giphy.gif",
* alt: "Man makes like he's going to jump on a skateboard but doesn't",
* size: "medium",
* });
* ```
*/
image: RequiredPropsDisplayIOComponentFunction<"DISPLAY_IMAGE", {
alt?: string | undefined;
width?: "thumbnail" | "small" | "medium" | "large" | undefined;
height?: "thumbnail" | "small" | "medium" | "large" | undefined;
size?: "thumbnail" | "small" | "medium" | "large" | undefined;
} & ({
url: string;
} | {
buffer: Buffer;
}), null>;
/**
* Displays a series of label/value pairs in a variety of layout options.
*
* **Usage:**
*
* ```typescript
* await io.display.metadata("User info", {
* layout: "card",
* data: [
* {
* label: "Name",
* value: `${user.firstName} ${user.lastName}`,
* },
* {
* label: "Email",
* value: user.email,
* url: `mailto:${user.email}`,
* },
* {
* label: "Friends",
* value: user.friends.length,
* },
* ],
* });
* ```
*/
metadata: RequiredPropsDisplayIOComponentFunction<"DISPLAY_METADATA", Pick<{
layout?: "grid" | "list" | "card" | undefined;
data: {
params?: Record | undefined;
value?: string | number | bigint | boolean | Date | null | undefined;
error?: string | null | undefined;
url?: string | undefined;
image?: {
alt?: string | undefined;
size?: "thumbnail" | "small" | "medium" | "large" | undefined;
width?: "thumbnail" | "small" | "medium" | "large" | undefined;
height?: "thumbnail" | "small" | "medium" | "large" | undefined;
url: string;
} | undefined;
action?: string | undefined;
route?: string | undefined;
label: string;
}[];
}, "layout"> & {
data: import("../components/displayMetadata").EventualMetaItem[];
}, null>;
/**
* Displays a button-styled action link to the action user. Can link to an external URL or to another action or page.
*
* **Usage:**
*
* ```typescript
* await io.display.link("Run another action", {
* route: "usefulAction",
* theme: "danger",
* });
* ```
*/
link: RequiredPropsDisplayIOComponentFunction<"DISPLAY_LINK", {
theme?: "default" | "primary" | "secondary" | "danger" | undefined;
} & ({
url: string;
} | {
route: string;
params?: Record | undefined;
} | {
action: string;
params?: Record | undefined;
}), null>;
/**
* Displays an object of nested arbitrary data to the action user.
*
* **Usage:**
*
* ```typescript
* await io.display.object("Example object", {
* data: [
* {
* album: "Exile on Main Street",
* artist: "The Rolling Stones",
* year: 1972,
* },
* ],
* });
* ```
*/
object: RequiredPropsDisplayIOComponentFunction<"DISPLAY_OBJECT", {
data?: object | import("../ioSchema").Literal | {
[key: string]: object | import("../ioSchema").Literal | any | (object | import("../ioSchema").Literal | any | (object | import("../ioSchema").Literal | any | (object | import("../ioSchema").Literal | any | (object | import("../ioSchema").Literal | any | (object | import("../ioSchema").Literal | any | (object | import("../ioSchema").Literal | any | (object | import("../ioSchema").Literal | any | (object | import("../ioSchema").Literal | any | (object | import("../ioSchema").Literal | any | (object | import("../ioSchema").Literal | any | (object | import("../ioSchema").Literal | any | any)[])[])[])[])[])[])[])[])[])[])[];
} | (object | import("../ioSchema").Literal | any | (object | import("../ioSchema").Literal | any | (object | import("../ioSchema").Literal | any | (object | import("../ioSchema").Literal | any | (object | import("../ioSchema").Literal | any | (object | import("../ioSchema").Literal | any | (object | import("../ioSchema").Literal | any | (object | import("../ioSchema").Literal | any | (object | import("../ioSchema").Literal | any | (object | import("../ioSchema").Literal | any | (object | import("../ioSchema").Literal | any | any)[])[])[])[])[])[])[])[])[])[])[];
}, null>;
/**
* Displays tabular data.
*
* **Usage:**
*
* ```typescript
* await io.display.table("Albums", {
* helpText: "Includes the artist and its year of release.",
* data: [
* {
* album: "Exile on Main Street",
* artist: "The Rolling Stones",
* year: 1972,
* },
* {
* album: "Thriller",
* artist: "Michael Jackson",
* year: 1982,
* },
* {
* album: "Enter the Wu-Tang (36 Chambers)",
* artist: "Wu-Tang Clan",
* year: 1993,
* },
* ],
* });
* ```
*/
table: = any>(label: string, props: {
defaultPageSize?: number | undefined;
helpText?: string | undefined;
isFilterable?: boolean | undefined;
orientation?: "vertical" | "horizontal" | undefined;
isSortable?: boolean | undefined;
columns?: (import("../types").TableColumn | (string & keyof Row_1))[] | undefined;
rowMenuItems?: ((row: Row_1) => import("../types").MenuItem[]) | undefined;
data: Row_1[];
} | {
defaultPageSize?: number | undefined;
helpText?: string | undefined;
isFilterable?: boolean | undefined;
orientation?: "vertical" | "horizontal" | undefined;
isSortable?: boolean | undefined;
columns?: (import("../types").TableColumn | (string & keyof Row_1))[] | undefined;
rowMenuItems?: ((row: Row_1) => import("../types").MenuItem[]) | undefined;
getData: import("../utils/table").TableDataFetcher;
}) => DisplayIOPromise<"DISPLAY_TABLE", {
defaultPageSize?: number | undefined;
helpText?: string | undefined;
isFilterable?: boolean | undefined;
totalRecords?: number | undefined;
isAsync?: boolean | undefined;
orientation?: "vertical" | "horizontal" | undefined;
isSortable?: boolean | undefined;
data: {
menu?: ({
theme?: "default" | "danger" | undefined;
label: string;
} & (({
params?: Record | undefined;
disabled?: boolean | undefined;
} & ({
route: string;
} | {
action: string;
})) | {
disabled?: boolean | undefined;
url: string;
} | {
disabled: true;
}))[] | undefined;
filterValue?: string | undefined;
data: Record;
key: string;
}[];
columns: {
accessorKey?: string | undefined;
label: string;
}[];
}, null>;
/**
* Displays data in a grid layout.
*
* Grid items can include a label, description, image, and options menu, and can optionally link to another page, action, or external URL.
*
* Grid item size can be controlled using the idealColumnWidth property. Interval will calculate a column width that is as close as possible to that number while factoring in gutter size and window width.
*
* Images default to a 16:9 aspect ratio with `object-fit` set to cover, and can be customized via the `image.aspectRatio` and `image.fit` properties respectively in the renderItem callback.
*
* **Usage:**
*
* ```typescript
* await io.display.grid("Albums", {
* idealColumnWidth: 180,
* data: [
* {
* album: "Exile on Main Street",
* artist: "The Rolling Stones",
* imageUrl:
* "https://upload.wikimedia.org/wikipedia/en/c/ca/ExileMainSt.jpg",
* spotifyId: "1D0PTM0bg7skufClSUOxTP",
* },
* {
* album: "Thriller",
* artist: "Michael Jackson",
* imageUrl:
* "https://upload.wikimedia.org/wikipedia/en/5/55/Michael_Jackson_-_Thriller.png",
* spotifyId: "2ANVost0y2y52ema1E9xAZ",
* },
* {
* album: "Enter the Wu-Tang (36 Chambers)",
* artist: "Wu-Tang Clan",
* imageUrl:
* "https://upload.wikimedia.org/wikipedia/en/5/53/Wu-TangClanEntertheWu-Tangalbumcover.jpg",
* spotifyId: "6acGx168JViE5LLFR1rGRE",
* },
* ],
* renderItem: row => ({
* label: row.album,
* description: row.artist,
* image: {
* url: row.imageUrl,
* aspectRatio: 1,
* },
* }),
* });
* ```
*/
grid: (label: string, props: {
idealColumnWidth?: number | undefined;
defaultPageSize?: number | undefined;
helpText?: string | undefined;
isFilterable?: boolean | undefined;
renderItem: (row: Row_2) => {
params?: Record | undefined;
label?: string | null | undefined;
url?: string | undefined;
description?: string | null | undefined;
image?: {
alt?: string | undefined;
url?: string | null | undefined;
fit?: "cover" | "contain" | undefined;
aspectRatio?: number | undefined;
} | null | undefined;
route?: string | undefined;
menu?: ({
theme?: "default" | "danger" | undefined;
label: string;
} & (({
params?: Record | undefined;
disabled?: boolean | undefined;
} & ({
route: string;
} | {
action: string;
})) | {
disabled?: boolean | undefined;
url: string;
} | {
disabled: true;
}))[] | undefined;
} & {
title?: string | null | undefined;
};
data: Row_2[];
} | {
idealColumnWidth?: number | undefined;
defaultPageSize?: number | undefined;
helpText?: string | undefined;
isFilterable?: boolean | undefined;
renderItem: (row: Row_2) => {
params?: Record | undefined;
label?: string | null | undefined;
url?: string | undefined;
description?: string | null | undefined;
image?: {
alt?: string | undefined;
url?: string | null | undefined;
fit?: "cover" | "contain" | undefined;
aspectRatio?: number | undefined;
} | null | undefined;
route?: string | undefined;
menu?: ({
theme?: "default" | "danger" | undefined;
label: string;
} & (({
params?: Record | undefined;
disabled?: boolean | undefined;
} & ({
route: string;
} | {
action: string;
})) | {
disabled?: boolean | undefined;
url: string;
} | {
disabled: true;
}))[] | undefined;
} & {
title?: string | null | undefined;
};
getData: import("../utils/grid").GridDataFetcher;
}) => DisplayIOPromise<"DISPLAY_GRID", {
idealColumnWidth?: number | undefined;
defaultPageSize?: number | undefined;
helpText?: string | undefined;
isFilterable?: boolean | undefined;
totalRecords?: number | undefined;
isAsync?: boolean | undefined;
data: {
filterValue?: string | undefined;
data: {
params?: Record | undefined;
label?: string | null | undefined;
url?: string | undefined;
description?: string | null | undefined;
image?: {
alt?: string | undefined;
url?: string | null | undefined;
fit?: "cover" | "contain" | undefined;
aspectRatio?: number | undefined;
} | null | undefined;
route?: string | undefined;
menu?: ({
theme?: "default" | "danger" | undefined;
label: string;
} & (({
params?: Record | undefined;
disabled?: boolean | undefined;
} & ({
route: string;
} | {
action: string;
})) | {
disabled?: boolean | undefined;
url: string;
} | {
disabled: true;
}))[] | undefined;
title?: string | null | undefined;
};
key: string;
}[];
}, null>;
/**
* Displays a video to the action user. One of url or buffer must be provided.
*
* **Usage:**
*
* ```typescript
* await io.display.video("A video", {
* url: "https://upload.wikimedia.org/wikipedia/commons/a/ad/The_Kid_scenes.ogv",
* size: "medium",
* muted: true,
* });
* ```
*/
video: RequiredPropsDisplayIOComponentFunction<"DISPLAY_VIDEO", {
width?: "thumbnail" | "small" | "medium" | "large" | undefined;
height?: "thumbnail" | "small" | "medium" | "large" | undefined;
size?: "thumbnail" | "small" | "medium" | "large" | undefined;
muted?: boolean | undefined;
loop?: boolean | undefined;
} & ({
url: string;
} | {
buffer: Buffer;
}), null>;
};
experimental: {
spreadsheet: >(label: string, props: {
helpText?: string | undefined;
columns: Columns;
defaultValue?: { [key in keyof Columns]: z.TypeOf<{
number: z.ZodNumber;
'number?': z.ZodNullable;
string: z.ZodString;
'string?': z.ZodNullable;
boolean: z.ZodBoolean;
'boolean?': z.ZodNullable;
}[Columns[key]]>; }[] | undefined;
}) => InputIOPromise<"INPUT_SPREADSHEET", {
defaultValue?: Record[] | null | undefined;
helpText?: string | undefined;
columns: Record;
}, { [key_1 in keyof Columns]: z.TypeOf<{
number: z.ZodNumber;
'number?': z.ZodNullable;
string: z.ZodString;
'string?': z.ZodNullable;
boolean: z.ZodBoolean;
'boolean?': z.ZodNullable;
}[Columns[key_1]]>; }[]>;
/**
* Requests OAuth credentials from a third-party service.
*
* **Usage:**
*
* ```typescript
* const { token } = await io.credentials('github');
* ```
*/
credentials: (serviceName: string, props?: {
params?: Record | undefined;
} | undefined) => ExclusiveIOPromise<"CREDENTIALS", {
params?: Record | undefined;
}, {
secret?: string | undefined;
token: string;
}>;
};
};
onResponse(result: T_IO_RESPONSE): void;
}
export {};