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.whatsapp; 017 018import com.vonage.client.messages.MessageType; 019import java.util.Map; 020 021public final class WhatsappCustomRequest extends WhatsappRequest { 022 023 WhatsappCustomRequest(Builder builder) { 024 super(builder, MessageType.CUSTOM); 025 } 026 027 @Override 028 public Map<String, ?> getCustom() { 029 return super.getCustom(); 030 } 031 032 public static Builder builder() { 033 return new Builder(); 034 } 035 036 public static final class Builder extends WhatsappRequest.Builder<WhatsappCustomRequest, Builder> { 037 038 Builder() {} 039 040 /** 041 * (OPTIONAL) 042 * A custom payload, which is passed directly to WhatsApp for certain features such as templates and 043 * interactive messages. The schema of a custom object can vary widely. 044 * <a href=https://developer.vonage.com/messages/concepts/custom-objects>Read about Custom Objects here</a>. 045 * 046 * @param payload A serializable Map. 047 * @return This builder. 048 */ 049 @Override 050 public Builder custom(Map<String, ?> payload) { 051 return super.custom(payload); 052 } 053 054 @Override 055 public WhatsappCustomRequest build() { 056 return new WhatsappCustomRequest(this); 057 } 058 } 059}