Skip to content

Commit

Permalink
Merge pull request #145 from schelldorfer/main
Browse files Browse the repository at this point in the history
#141 Error in Parsing WhatsApp Business Phone Number Response - New fields
  • Loading branch information
Bindambc authored Jan 27, 2024
2 parents 66e610e + 9206bf8 commit dd1f543
Show file tree
Hide file tree
Showing 6 changed files with 249 additions and 127 deletions.
34 changes: 22 additions & 12 deletions src/main/java/com/whatsapp/api/domain/phone/PhoneNumber.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,29 @@
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.whatsapp.api.domain.phone.type.NameStatusType;
import com.whatsapp.api.domain.phone.type.PlatformType;
import com.whatsapp.api.domain.phone.type.QualityRatingType;

/**
* The type Phone number.
*
* @param id The ID associated with the phone number.
* @param displayPhoneNumber The string representation of the phone number.
* @param nameStatus The current status of the review of your business name.
* @param id The ID associated with the phone number.
* @param displayPhoneNumber The string representation of the phone number.
* @param nameStatus The current status of the review of your business name.
* @param codeVerificationStatus Code Verification Status
* @param qualityRating The quality rating of the phone number based on how messages have been received by recipients in recent days. Valid values are:
* <ul>
* <li>Green: High Quality</li>
* <li>Yellow: Medium Quality</li>
* <li> Red: Low Quality</li>
* <li>NA: Quality has not been determined</li>
* </ul>
* @param verifiedName the verified name
* @param qualityRating The quality rating of the phone number based on how messages have been received by recipients in recent days. Valid values are:
* <ul>
* <li>Green: High Quality</li>
* <li>Yellow: Medium Quality</li>
* <li>Red: Low Quality</li>
* <li>NA: Quality has not been determined</li>
* </ul>
* @param verifiedName the verified name
* @param platformType Platform the business phone number is registered with.
* @param throughput The business phone number's Cloud API throughput level.
* @see <a href="https://www.facebook.com/business/help/896873687365001">About WhatsApp Business Account Message Quality Rating</a>
* @see <a href="https://developers.facebook.com/docs/graph-api/reference/whats-app-business-account-to-number-current-status/">WhatsApp Business Phone Number</a>
* @see <a href="https://developers.facebook.com/docs/whatsapp/business-platform/changelog/#september-12--2023">WhatsApp Business Platform - Changelog - September 12, 2023</a>
*/
@JsonInclude(value = Include.NON_NULL)
public record PhoneNumber(
Expand All @@ -36,5 +41,10 @@ public record PhoneNumber(

@JsonProperty("code_verification_status") String codeVerificationStatus,

@JsonProperty("name_status") NameStatusType nameStatus) {
@JsonProperty("name_status") NameStatusType nameStatus,

@JsonProperty("platform_type") PlatformType platformType,

@JsonProperty("throughput") Throughput throughput)
{
}
16 changes: 16 additions & 0 deletions src/main/java/com/whatsapp/api/domain/phone/Throughput.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.whatsapp.api.domain.phone;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.whatsapp.api.domain.phone.type.LevelType;

/**
* The type Throughput.
*/
@JsonInclude(value = Include.NON_NULL)
public record Throughput(

@JsonProperty("level") LevelType Level)
{
}
38 changes: 38 additions & 0 deletions src/main/java/com/whatsapp/api/domain/phone/type/LevelType.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package com.whatsapp.api.domain.phone.type;

import com.fasterxml.jackson.annotation.JsonValue;

/**
* The enum Level type.
*/
public enum LevelType
{

/**
* Standard Level type.
*/
STANDARD("STANDARD"),
/**
* High Level type.
*/
HIGH("HIGH"),
NOT_APPLICABLE("NOT_APPLICABLE");

private final String value;

LevelType(String value)
{
this.value = value;
}

/**
* Gets value.
*
* @return the value
*/
@JsonValue
public String getValue()
{
return value;
}
}
38 changes: 38 additions & 0 deletions src/main/java/com/whatsapp/api/domain/phone/type/PlatformType.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package com.whatsapp.api.domain.phone.type;

import com.fasterxml.jackson.annotation.JsonValue;

/**
* The enum Platform type.
*/
public enum PlatformType
{

/**
* Cloud API Platform type.
*/
CLOUD_API("CLOUD_API"),
/**
* On-Premises API Platform type.
*/
ON_PREMISE("ON_PREMISE"),
NOT_APPLICABLE("NOT_APPLICABLE");

private final String value;

PlatformType(String value)
{
this.value = value;
}

/**
* Gets value.
*
* @return the value
*/
@JsonValue
public String getValue()
{
return value;
}
}
Loading

0 comments on commit dd1f543

Please sign in to comment.