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.voice.ncco; 017 018import com.fasterxml.jackson.annotation.JsonProperty; 019import com.vonage.client.JsonableBaseObject; 020import com.vonage.client.voice.EndpointType; 021 022/** 023 * Represents a VBC endpoint used in a {@link ConnectAction}. See 024 * <a href=https://developer.vonage.com/en/voice/voice-api/ncco-reference#vbc---the-vonage-business-cloud-vbc-extension-to-connect-to> 025 * the documentation</a> for an example. 026 * 027 * @since 7.3.0 028 */ 029public class VbcEndpoint extends JsonableBaseObject implements Endpoint { 030 private final String extension; 031 032 private VbcEndpoint(Builder builder) { 033 this.extension = builder.extension; 034 } 035 036 /** 037 * The VBC extension to connect the call to. 038 * 039 * @return The VBC extension number as a string. 040 */ 041 @JsonProperty("extension") 042 public String getExtension() { 043 return extension; 044 } 045 046 @Override 047 public String getType() { 048 return EndpointType.VBC.toString(); 049 } 050 051 /** 052 * Entry point for constructing an instance of this class. 053 * 054 * @param extension The VBC extension number as a string. 055 * 056 * @return A new Builder. 057 */ 058 public static Builder builder(String extension) { 059 return new Builder(extension); 060 } 061 062 /** 063 * Builder for specifying properties of a VBC endpoint. 064 */ 065 public static class Builder { 066 private String extension; 067 068 Builder(String extension) { 069 this.extension = extension; 070 } 071 072 /** 073 * The VBC extension to connect the call to. 074 * 075 * @param extension The VBC extension number as a string. 076 * 077 * @return This builder. 078 */ 079 public Builder extension(String extension) { 080 this.extension = extension; 081 return this; 082 } 083 084 /** 085 * Builds the VbcEndpoint with this builder's properties. 086 * 087 * @return A new VbcEndpoint instance. 088 */ 089 public VbcEndpoint build() { 090 return new VbcEndpoint(this); 091 } 092 } 093}