001/* 002 * Copyright 2024 Vonage 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package com.vonage.client.messages.messenger; 017 018import com.vonage.client.messages.MessageType; 019import com.vonage.client.messages.TextMessageRequest; 020 021public final class MessengerTextRequest extends MessengerRequest implements TextMessageRequest { 022 023 MessengerTextRequest(Builder builder) { 024 super(builder, MessageType.TEXT); 025 } 026 027 @Override 028 protected int maxTextLength() { 029 return 640; 030 } 031 032 @Override 033 public String getText() { 034 return super.getText(); 035 } 036 037 public static Builder builder() { 038 return new Builder(); 039 } 040 041 public static final class Builder extends MessengerRequest.Builder<MessengerTextRequest, Builder> implements TextMessageRequest.Builder<Builder> { 042 043 Builder() {} 044 045 /** 046 * (REQUIRED) 047 * Sets the text field. Must be between 1 and 640 characters, including unicode. 048 * 049 * @param text The text string. 050 * @return This builder. 051 */ 052 @Override 053 public Builder text(String text) { 054 return super.text(text); 055 } 056 057 public MessengerTextRequest build() { 058 return new MessengerTextRequest(this); 059 } 060 } 061}