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.meetings; 017 018import com.fasterxml.jackson.annotation.JsonIgnore; 019import com.fasterxml.jackson.annotation.JsonProperty; 020import com.vonage.client.Jsonable; 021import java.time.Instant; 022import java.time.temporal.ChronoUnit; 023import java.util.UUID; 024 025public class UpdateRoomRequest implements Jsonable { 026 @JsonIgnore UUID roomId; 027 028 private final Boolean expireAfterUse; 029 private final InitialJoinOptions initialJoinOptions; 030 private final CallbackUrls callbackUrls; 031 private final AvailableFeatures availableFeatures; 032 private final JoinApprovalLevel joinApprovalLevel; 033 private final UUID themeId; 034 @JsonIgnore private final Instant expiresAt; 035 036 UpdateRoomRequest(Builder builder) { 037 expireAfterUse = builder.expireAfterUse; 038 initialJoinOptions = builder.initialJoinOptions; 039 callbackUrls = builder.callbackUrls; 040 availableFeatures = builder.availableFeatures; 041 joinApprovalLevel = builder.joinApprovalLevel; 042 themeId = builder.themeId; 043 MeetingRoom.validateExpiresAtAndRoomType(expiresAt = builder.expiresAt, null); 044 } 045 046 /** 047 * Close the room after a session ends. Only relevant for long_term rooms. 048 * 049 * @return {@code true} if the room will close after end of session, or {@code null} if unknown / not applicable. 050 */ 051 @JsonProperty("expire_after_use") 052 public Boolean getExpireAfterUse() { 053 return expireAfterUse; 054 } 055 056 /** 057 * Options for when a participant joins a meeting. 058 * 059 * @return The initial joining options. 060 */ 061 @JsonProperty("initial_join_options") 062 public InitialJoinOptions getInitialJoinOptions() { 063 return initialJoinOptions; 064 } 065 066 /** 067 * The callback URLs for this meeting. 068 * 069 * @return The CallbackUrls object. 070 */ 071 @JsonProperty("callback_urls") 072 public CallbackUrls getCallbackUrls() { 073 return callbackUrls; 074 } 075 076 /** 077 * The available features for this meeting. 078 * 079 * @return The AvailableFeatures object. 080 */ 081 @JsonProperty("available_features") 082 public AvailableFeatures getAvailableFeatures() { 083 return availableFeatures; 084 } 085 086 /** 087 * ID of the theme for this room. 088 * 089 * @return The theme ID. 090 */ 091 @JsonProperty("theme_id") 092 public UUID getThemeId() { 093 return themeId; 094 } 095 096 /** 097 * The level of approval needed to join the meeting in the room. 098 * 099 * @return The approval level, as an enum. 100 */ 101 @JsonProperty("join_approval_level") 102 public JoinApprovalLevel getJoinApprovalLevel() { 103 return joinApprovalLevel; 104 } 105 106 /** 107 * The time for when the room will be expired, expressed in ISO 8601 format. 108 * 109 * @return The room expiration time. 110 */ 111 @JsonProperty("expires_at") 112 public Instant getExpiresAt() { 113 return expiresAt; 114 } 115 116 /** 117 * Generates a JSON payload from this request. 118 * 119 * @return JSON representation of this UpdateRoomRequest object. 120 */ 121 @Override 122 public String toJson() { 123 return "{\"update_details\":" + Jsonable.super.toJson() + "}"; 124 } 125 126 /** 127 * Entry point for constructing an instance of this class. 128 * 129 * @return A new Builder. 130 */ 131 public static Builder builder() { 132 return new Builder(); 133 } 134 135 public static class Builder { 136 private Boolean expireAfterUse; 137 private InitialJoinOptions initialJoinOptions; 138 private CallbackUrls callbackUrls; 139 private AvailableFeatures availableFeatures; 140 private JoinApprovalLevel joinApprovalLevel; 141 private UUID themeId; 142 private Instant expiresAt; 143 144 Builder() {} 145 146 /** 147 * 148 * @param expireAfterUse Close the room after a session ends. Only relevant for long_term rooms. 149 * 150 * @return This builder. 151 */ 152 public Builder expireAfterUse(Boolean expireAfterUse) { 153 this.expireAfterUse = expireAfterUse; 154 return this; 155 } 156 157 /** 158 * 159 * @param initialJoinOptions Options for when a participant joins a meeting. 160 * 161 * @return This builder. 162 */ 163 public Builder initialJoinOptions(InitialJoinOptions initialJoinOptions) { 164 this.initialJoinOptions = initialJoinOptions; 165 return this; 166 } 167 168 /** 169 * 170 * @param callbackUrls The callback URLs for this meeting. 171 * 172 * @return This builder. 173 */ 174 public Builder callbackUrls(CallbackUrls callbackUrls) { 175 this.callbackUrls = callbackUrls; 176 return this; 177 } 178 179 /** 180 * 181 * @param availableFeatures The available features for this meeting. 182 * 183 * @return This builder. 184 */ 185 public Builder availableFeatures(AvailableFeatures availableFeatures) { 186 this.availableFeatures = availableFeatures; 187 return this; 188 } 189 190 /** 191 * 192 * @param themeId ID of the theme for this room. 193 * 194 * @return This builder. 195 */ 196 public Builder themeId(UUID themeId) { 197 this.themeId = themeId; 198 return this; 199 } 200 201 /** 202 * 203 * @param joinApprovalLevel The level of approval needed to join the meeting in the room. 204 * 205 * @return This builder. 206 */ 207 public Builder joinApprovalLevel(JoinApprovalLevel joinApprovalLevel) { 208 this.joinApprovalLevel = joinApprovalLevel; 209 return this; 210 } 211 212 /** 213 * 214 * @param expiresAt The time for when the room will be expired, expressed in ISO 8601 format. 215 * 216 * @return This builder. 217 */ 218 public Builder expiresAt(Instant expiresAt) { 219 this.expiresAt = expiresAt.truncatedTo(ChronoUnit.MILLIS); 220 return this; 221 } 222 223 /** 224 * Builds the {@linkplain UpdateRoomRequest}. 225 * 226 * @return An instance of UpdateRoomRequest, populated with all fields from this builder. 227 */ 228 public UpdateRoomRequest build() { 229 return new UpdateRoomRequest(this); 230 } 231 } 232}