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.application.capabilities; 017 018import com.fasterxml.jackson.annotation.JsonProperty; 019import com.vonage.client.common.Webhook; 020 021/** 022 * Rtc capability configuration settings. 023 */ 024public final class Rtc extends Capability { 025 private Boolean signedCallbacks; 026 027 private Rtc() { 028 } 029 030 private Rtc(Builder builder) { 031 super(builder); 032 this.signedCallbacks = builder.signedCallbacks; 033 } 034 035 @Override 036 public Type getType() { 037 return Type.RTC; 038 } 039 040 /** 041 * Whether to use signed webhooks. This is a way of verifying that the request is coming from Vonage. 042 * 043 * @return {@code true} if signed webhooks are used, {@code false} if not and {@code null} if unknown. 044 * 045 * @since 8.12.0 046 */ 047 @JsonProperty("signed_callbacks") 048 public Boolean getSignedCallbacks() { 049 return signedCallbacks; 050 } 051 052 /** 053 * Entry point for constructing an instance of this class. 054 * 055 * @return A new Builder. 056 */ 057 public static Builder builder() { 058 return new Builder(); 059 } 060 061 public static class Builder extends Capability.Builder<Rtc, Builder> { 062 private Boolean signedCallbacks; 063 064 /** 065 * Constructs a new Builder. 066 * 067 * @deprecated Use {@link #builder()} instead. This constructor will be made private in a future release. 068 */ 069 @Deprecated 070 public Builder() { 071 } 072 073 /** 074 * Set whether to use signed webhooks. This is a way of verifying that the request is coming from Vonage. 075 * 076 * @param signedCallbacks {@code true} if signed webhooks should be used. 077 * @return This builder. 078 * @since 8.12.0 079 */ 080 public Builder signedCallbacks(boolean signedCallbacks) { 081 this.signedCallbacks = signedCallbacks; 082 return this; 083 } 084 085 @Override 086 public Builder addWebhook(Webhook.Type type, Webhook webhook) { 087 return super.addWebhook(type, webhook); 088 } 089 090 @Override 091 public Builder removeWebhook(Webhook.Type type) { 092 return super.removeWebhook(type); 093 } 094 095 /** 096 * Builds the Rtc object. 097 * 098 * @return A new RTC capability containing the configured properties. 099 */ 100 @Override 101 public Rtc build() { 102 return new Rtc(this); 103 } 104 } 105}