Skip to content

SWI-7822 Update SDK Based on Recent Spec Changes #187

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

Merged
merged 2 commits into from
May 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8456,6 +8456,13 @@ components:
example: 4405
nullable: true
type: integer
carrierName:
description: "The name of the Authorized Message Provider (AMP) that handled\
\ this message. In the US, this is the carrier that the message was sent\
\ to."
example: AT&T
nullable: true
type: string
required:
- description
- message
Expand Down Expand Up @@ -13173,8 +13180,6 @@ components:
- VERIFIED
- UNVERIFIED
- PENDING
- PARTIALLY_VERIFIED
- INVALID_STATUS
example: VERIFIED
type: string
sharedSecretKey:
Expand Down
10 changes: 8 additions & 2 deletions bandwidth.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2494,6 +2494,14 @@ components:
description: Optional error code, applicable only when type is `message-failed`.
nullable: true
example: 4405
carrierName:
type: string
description: >-
The name of the Authorized Message Provider (AMP) that handled this
message. In the US, this is the carrier that the message was sent
to.
nullable: true
example: AT&T
required:
- time
- type
Expand Down Expand Up @@ -5849,8 +5857,6 @@ components:
- VERIFIED
- UNVERIFIED
- PENDING
- PARTIALLY_VERIFIED
- INVALID_STATUS
example: VERIFIED
sharedSecretKey:
description: >-
Expand Down
1 change: 1 addition & 0 deletions docs/MessageCallback.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Message Callback Schema
|**description** | **String** | A detailed description of the event described by the callback. | |
|**message** | [**MessageCallbackMessage**](MessageCallbackMessage.md) | | |
|**errorCode** | **Integer** | Optional error code, applicable only when type is `message-failed`. | [optional] |
|**carrierName** | **String** | The name of the Authorized Message Provider (AMP) that handled this message. In the US, this is the carrier that the message was sent to. | [optional] |



4 changes: 0 additions & 4 deletions docs/TfvStatusEnum.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,5 @@

* `PENDING` (value: `"PENDING"`)

* `PARTIALLY_VERIFIED` (value: `"PARTIALLY_VERIFIED"`)

* `INVALID_STATUS` (value: `"INVALID_STATUS"`)



34 changes: 32 additions & 2 deletions src/main/java/com/bandwidth/sdk/model/MessageCallback.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ public class MessageCallback {
@javax.annotation.Nullable
private Integer errorCode;

public static final String SERIALIZED_NAME_CARRIER_NAME = "carrierName";
@SerializedName(SERIALIZED_NAME_CARRIER_NAME)
@javax.annotation.Nullable
private String carrierName;

public MessageCallback() {
}

Expand Down Expand Up @@ -200,6 +205,25 @@ public void setErrorCode(@javax.annotation.Nullable Integer errorCode) {
this.errorCode = errorCode;
}


public MessageCallback carrierName(@javax.annotation.Nullable String carrierName) {
this.carrierName = carrierName;
return this;
}

/**
* The name of the Authorized Message Provider (AMP) that handled this message. In the US, this is the carrier that the message was sent to.
* @return carrierName
*/
@javax.annotation.Nullable
public String getCarrierName() {
return carrierName;
}

public void setCarrierName(@javax.annotation.Nullable String carrierName) {
this.carrierName = carrierName;
}

/**
* A container for additional, undeclared properties.
* This is a holder for any undeclared properties as specified with
Expand Down Expand Up @@ -260,7 +284,8 @@ public boolean equals(Object o) {
Objects.equals(this.to, messageCallback.to) &&
Objects.equals(this.description, messageCallback.description) &&
Objects.equals(this.message, messageCallback.message) &&
Objects.equals(this.errorCode, messageCallback.errorCode)&&
Objects.equals(this.errorCode, messageCallback.errorCode) &&
Objects.equals(this.carrierName, messageCallback.carrierName)&&
Objects.equals(this.additionalProperties, messageCallback.additionalProperties);
}

Expand All @@ -270,7 +295,7 @@ private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> b)

@Override
public int hashCode() {
return Objects.hash(time, type, to, description, message, errorCode, additionalProperties);
return Objects.hash(time, type, to, description, message, errorCode, carrierName, additionalProperties);
}

private static <T> int hashCodeNullable(JsonNullable<T> a) {
Expand All @@ -290,6 +315,7 @@ public String toString() {
sb.append(" description: ").append(toIndentedString(description)).append("\n");
sb.append(" message: ").append(toIndentedString(message)).append("\n");
sb.append(" errorCode: ").append(toIndentedString(errorCode)).append("\n");
sb.append(" carrierName: ").append(toIndentedString(carrierName)).append("\n");
sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n");
sb.append("}");
return sb.toString();
Expand Down Expand Up @@ -319,6 +345,7 @@ private String toIndentedString(Object o) {
openapiFields.add("description");
openapiFields.add("message");
openapiFields.add("errorCode");
openapiFields.add("carrierName");

// a set of required properties/fields (JSON key names)
openapiRequiredFields = new HashSet<String>();
Expand Down Expand Up @@ -359,6 +386,9 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti
}
// validate the required field `message`
MessageCallbackMessage.validateJsonElement(jsonObj.get("message"));
if ((jsonObj.get("carrierName") != null && !jsonObj.get("carrierName").isJsonNull()) && !jsonObj.get("carrierName").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `carrierName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("carrierName").toString()));
}
}

public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
Expand Down
6 changes: 1 addition & 5 deletions src/main/java/com/bandwidth/sdk/model/TfvStatusEnum.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,7 @@ public enum TfvStatusEnum {

UNVERIFIED("UNVERIFIED"),

PENDING("PENDING"),

PARTIALLY_VERIFIED("PARTIALLY_VERIFIED"),

INVALID_STATUS("INVALID_STATUS");
PENDING("PENDING");

private String value;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ public class MessageCallbackTest {
.to("+1234567890")
.description("description")
.message(new MessageCallbackMessage())
.errorCode(123);
.errorCode(123)
.carrierName("carrierName");

/**
* Model tests for MessageCallback
Expand Down Expand Up @@ -90,4 +91,12 @@ public void errorCodeTest() {
assertThat(model.getErrorCode(), instanceOf(Integer.class));
}

/**
* Test the property 'carrierName'
*/
@Test
public void carrierNameTest() {
assertThat(model.getCarrierName(), instanceOf(String.class));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ public void testTfvStatusEnum() {
assertThat(TfvStatusEnum.VERIFIED.toString(), equalTo("VERIFIED"));
assertThat(TfvStatusEnum.UNVERIFIED.toString(), equalTo("UNVERIFIED"));
assertThat(TfvStatusEnum.PENDING.toString(), equalTo("PENDING"));
assertThat(TfvStatusEnum.PARTIALLY_VERIFIED.toString(), equalTo("PARTIALLY_VERIFIED"));
assertThat(TfvStatusEnum.INVALID_STATUS.toString(), equalTo("INVALID_STATUS"));
}

}