Skip to content
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

feat: webhook classes for messages #382

Merged
merged 4 commits into from
Apr 12, 2023
Merged

feat: webhook classes for messages #382

merged 4 commits into from
Apr 12, 2023

Conversation

Tr00d
Copy link
Contributor

@Tr00d Tr00d commented Apr 12, 2023

No description provided.

@Tr00d Tr00d added the feature label Apr 12, 2023
Copy link

@SMadani SMadani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems fine, just check "WhatsAppPreferredProduct" should probably be "WhatsAppReferredProduct"

Vonage/Messages/Webhooks/MessageWebhookResponse.cs Outdated Show resolved Hide resolved
/// <summary>
/// The number of inbound SMS messages concatenated together to comprise this message. SMS messages are 160 characters, if an inbound message exceeds that size they are concatenated together to forma single message. This number indicates how many messages formed this webhook.
/// </summary>
[JsonPropertyName("total_count")] public string TotalCount { get; set; }
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it make sense to parse as int?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Same as below) The problem is that the value in the JSON file is a string. I could turn it around, but it would require a string->int customer converter that could fail. I don't think it's worth it, we could decide tol leave the possibility to parse the value to the caller.

/// <summary>
/// The number of inbound SMS messages concatenated together to comprise this message. SMS messages are 160 characters, if an inbound message exceeds that size they are concatenated together to forma single message. This number indicates how many messages formed this webhook.
/// </summary>
[JsonPropertyName("num_messages")] public string MessagesCount { get; set; }
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be an int?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is that the value in the JSON file is a string. I could turn it around, but it would require a string->int customer converter that could fail. I don't think it's worth it, we could decide tol leave the possibility to parse the value to the caller.

/// <summary>
/// The channel the message came in on.
/// </summary>
public string Channel { get; set; }
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be an enum?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It could be. But if I set it up as an enum, I would have to change the SDK when they bring a new channel.
Leaving it as a string, we kind of cover every kind of value in it. I see that as a compromise, given it's just a webhook class.

@sonarcloud
Copy link

sonarcloud bot commented Apr 12, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication

@Tr00d Tr00d merged commit 5e4d741 into main Apr 12, 2023
@Tr00d Tr00d deleted the devx-6750-v2 branch April 12, 2023 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants