Skip to content

Commit

Permalink
Add types, bump to 2.0.3 [fixes #29]
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewchilds committed Aug 7, 2022
1 parent 9a020ac commit 7abcc0d
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"name": "slack-notify",
"description": "A simple Node.js wrapper around the Slack webhook API.",
"version": "2.0.2",
"version": "2.0.3",
"repository": "https://github.com/andrewchilds/slack-notify.git",
"homepage": "https://github.com/andrewchilds/slack-notify",
"main": "./src/esm/index.mjs",
"types": "./src/index.d.ts",
"author": {
"name": "Andrew Childs",
"email": "[email protected]"
Expand Down
38 changes: 38 additions & 0 deletions src/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
declare module 'slack-notify' {
interface SlackNofifier {
send(args: string | SendArgs): Promise<void>;
}

interface SlackNotify extends SlackNofifier {
extend(args: string | SendArgs): SlackNofifier;
success(args: string | SendArgs): SlackNofifier;
bug(args: string | SendArgs): SlackNofifier;
alert(args: string | SendArgs): SlackNofifier;
}

interface SendArgs {
text: string;
channel?: string;
icno_url?: string;
icon_emoji?: string;
unfurl_links?: number;
username?: string;
attachments?: SendAttachment[];
fields?: { [key: string]: string }[];
}

interface SendAttachment {
fallback: string;
fields?: SendAttachmentField[];
}

interface SendAttachmentField {
title: string;
value: string;
short: boolean;
}

function SlackNotifyFactory(webhookUrl: string): SlackNotify;

export default SlackNotifyFactory;
}

0 comments on commit 7abcc0d

Please sign in to comment.