All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.bandwidth.sdk.model.MessageStatusEnum Maven / Gradle / Ivy

Go to download

The official client SDK for Bandwidth's Voice, Messaging, MFA, and WebRTC APIs

The newest version!
/*
 * Bandwidth
 * Bandwidth's Communication APIs
 *
 * The version of the OpenAPI document: 1.0.0
 * Contact: [email protected]
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */


package com.bandwidth.sdk.model;

import java.util.Objects;
import com.google.gson.annotations.SerializedName;

import java.io.IOException;
import com.google.gson.TypeAdapter;
import com.google.gson.JsonElement;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;

/**
 * The status of the message. One of RECEIVED QUEUED SENDING SENT FAILED DELIVERED ACCEPTED UNDELIVERED.
 */
@JsonAdapter(MessageStatusEnum.Adapter.class)
public enum MessageStatusEnum {
  
  RECEIVED("RECEIVED"),
  
  QUEUED("QUEUED"),
  
  SENDING("SENDING"),
  
  SENT("SENT"),
  
  FAILED("FAILED"),
  
  DELIVERED("DELIVERED"),
  
  ACCEPTED("ACCEPTED"),
  
  UNDELIVERED("UNDELIVERED");

  private String value;

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

  public String getValue() {
    return value;
  }

  @Override
  public String toString() {
    return String.valueOf(value);
  }

  public static MessageStatusEnum fromValue(String value) {
    for (MessageStatusEnum b : MessageStatusEnum.values()) {
      if (b.value.equalsIgnoreCase(value)) {
        return b;
      }
    }
    throw new IllegalArgumentException("Unexpected value '" + value + "'");
  }

  public static class Adapter extends TypeAdapter {
    @Override
    public void write(final JsonWriter jsonWriter, final MessageStatusEnum enumeration) throws IOException {
      jsonWriter.value(enumeration.getValue());
    }

    @Override
    public MessageStatusEnum read(final JsonReader jsonReader) throws IOException {
      String value = jsonReader.nextString();
      return MessageStatusEnum.fromValue(value);
    }
  }

  public static void validateJsonElement(JsonElement jsonElement) throws IOException {
    String value = jsonElement.getAsString();
    MessageStatusEnum.fromValue(value);
  }
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy