Skip to content

Conversation

@rezatutor475
Copy link

DEVELOPING BY REZA

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant