-
Notifications
You must be signed in to change notification settings - Fork 3
DEVELOPING BY REZA #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
rezatutor475
wants to merge
15
commits into
kavenegar:master
Choose a base branch
from
rezatutor475:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AccountConfigResult is a Java model class that represents the configuration settings of a Kavenegar user account. It encapsulates options such as API logging, daily reporting, debug mode, default sender, resend behavior, and credit alarm thresholds. The class provides functionality for parsing these settings from a JsonObject, validating their state, updating fields dynamically, and generating summaries or serialized output.
AccountInfoResult Represents the configuration and status details of a user's account in the Kavenegar system, including remaining credit, account type, and expiration time. It provides various utility methods for checking credit sufficiency, expiration status, and account classification (e.g., trial, premium). Designed for easy validation, display formatting, and comparison.
CountInboxResult represents a summary of received messages (inbox) over a specified time range. It stores the start and end timestamps along with the total message count (sumCount) during that period. The class provides methods for data validation, date formatting, message rate calculation, and structured reporting.
CountOutboxResult Represents the result of an outbox message count operation. It extends CountInboxResult by including additional fields for total message parts (sumPart) and associated cost (cost). This class is typically used to analyze outbound messaging metrics over a specified time period, offering utility methods for summarizing message volume, cost, and duration.
The CountPostalCodeResult class represents the result of a message count operation grouped by postal code section. It stores the name of the geographical section and the corresponding message count (value). The class includes utility methods for data validation, comparison, threshold evaluation, result summarization, and scoring.
The SendResult class represents the response details of a message that has been sent using the Kavenegar API. It encapsulates key information such as the message ID, content, recipient, sender, send date, cost, and status. This class provides getter methods for accessing these details and is typically used to analyze the result of an SMS transmission, including whether it was successful or encountered an error.
hasSameLocalId(...): Compares two results' local IDs. isFailedStatus(): Quickly checks if the status indicates failure.
The StatusResult class represents the delivery status of a single message in the Kavenegar API. It encapsulates key information such as the message ID, status code (as an enum), and a descriptive status text. The enhanced version improves reliability and maintainability by introducing utility methods (e.g., isSuccessful() and getSummary()), safer data handling, and better object encapsulation for integration and debugging purposes.
I’ve added enhancements to the MessageStatus enum
getLabel() – to return a user-friendly label. A getLabel() method for human-readable labels. isValidType(int type) – to validate if a given integer is a valid message type. An isValidType(int) method to validate input integers.
Consistent, descriptive enum names (UPPER_SNAKE_CASE). Immutable int code field with accessor getValue(). Safe lookup method fromValue(int) with clear null-return behavior. JavaDoc and a readable toString() override.
I've enhanced the class by adding setters, equality checks, swap functionality, and more robust equals/hashCode methods while keeping it true to the original intent.
I've expanded your StringUtils class with useful additional methods, including split, null/empty check, repeat, capitalization, and reverse, while improving the join method's efficiency.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
DEVELOPING BY REZA