Feature/message sending #2
Reference in New Issue
Block a user
Delete Branch "feature/message-sending"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Pull Request Overview
This PR introduces a complete message sending feature for the Pushover library, transitioning from type definitions to a fully functional implementation. The implementation provides a robust TypeScript client for the Pushover API with comprehensive message validation, error handling, and support for all Pushover features including emergency priorities and receipt management.
Key changes:
Pushoverclass that handles API communicationReviewed Changes
Copilot reviewed 6 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
@@ -0,0 +1,718 @@import https from "node:https";Missing closing parenthesis in the template literal. Should be
${data.length}): ${data}.The nullish coalescing operator is unnecessary here since
options.useris required in theValidateOptionsinterface and cannot be undefined.This incorrectly resolves with a Promise instead of the resolved value. Should be
Promise.all(promises).then(resolve).catch(reject)or useasync/awaitpattern.Pull Request Overview
This PR implements the core message sending functionality for a Pushover notification library. It replaces the existing type definitions with a complete implementation that includes message validation, API communication, and comprehensive TypeScript types.
Reviewed Changes
Copilot reviewed 6 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
@@ -0,0 +1,718 @@import https from "node:https";Calling
resolvewith a Promise will cause the method to returnPromise<Promise<PushoverMessageResponse[]>>instead of the expectedPromise<PushoverMessageResponse[]>. Useawait Promise.all(promises)or restructure to avoid wrapping a Promise in another Promise.@@ -0,0 +169,4 @@* emergencyOpts: {* retry: 60, // Retry every 60 seconds* expire: 3600, // Expire after 1 hour* tags: ["critical", "infra"]Missing comma after the
tagsarray in the JSDoc example. Should betags: [\"critical\", \"infra\"],@@ -0,0 +372,4 @@): Promise<PushoverMessageResponse[]> {return new Promise((resolve, reject) => {if (options.recipients.length === 0) {reject(new Error("No recipients specified."));The function continues executing after rejecting the promise when no recipients are specified. Add a
returnstatement after the reject call to prevent further execution.@@ -0,0 +438,4 @@if (message.emergencyOpts.callback)params.append("callback", message.emergencyOpts.callback);if (message.emergencyOpts.tags)params.append("tags", message.emergencyOpts.tags.join());The
join()method is called without arguments, which will join array elements with commas. However, this may not be the intended format for the Pushover API. Consider specifying an explicit separator likejoin(',')or verify the expected format from the API documentation.Pull Request Overview
This PR introduces a complete message sending feature for the Pushover notification service, replacing the previous type-only implementation with a fully functional API client. The main changes include implementing the core Pushover class with HTTP request handling, comprehensive message validation using Zod schemas, and support for all Pushover API features including emergency notifications, receipt management, and user validation.
Key changes:
Reviewed Changes
Copilot reviewed 6 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
@@ -0,0 +1,718 @@import https from "node:https";This resolve call should use
awaitor return the Promise.all directly. Currently, it's resolving with a Promise object instead of the actual results. Change toresolve(await Promise.all(promises))or restructure to return the Promise.all directly.Missing comma after the array in the JSDoc example code block.
@@ -0,0 +372,4 @@): Promise<PushoverMessageResponse[]> {return new Promise((resolve, reject) => {if (options.recipients.length === 0) {reject(new Error("No recipients specified."));Missing
returnstatement after the reject call. This allows code execution to continue, which could lead to unexpected behavior. Addreturn;after line 356.@@ -0,0 +438,4 @@if (message.emergencyOpts.callback)params.append("callback", message.emergencyOpts.callback);if (message.emergencyOpts.tags)params.append("tags", message.emergencyOpts.tags.join());The
join()method is called without a separator argument. This will use the default comma separator, but it's unclear if this is the intended format for the Pushover API. Consider explicitly specifying the separator asjoin(',')for clarity.lgtm
@@ -0,0 +372,4 @@): Promise<PushoverMessageResponse[]> {return new Promise((resolve, reject) => {if (options.recipients.length === 0) {reject(new Error("No recipients specified."));fixed
lgtm