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.proactiveconnect; 017 018import com.fasterxml.jackson.annotation.JsonIgnore; 019import com.fasterxml.jackson.annotation.JsonProperty; 020import com.vonage.client.Jsonable; 021import com.vonage.client.JsonableBaseObject; 022import com.vonage.client.common.HalPageResponse; 023import java.util.List; 024import java.util.UUID; 025 026/** 027 * HAL response for {@link ProactiveConnectClient#listItems(UUID, int, int, SortOrder)}. 028 */ 029public final class ListItemsResponse extends HalPageResponse { 030 @JsonProperty("_embedded") private Embedded _embedded; 031 032 ListItemsResponse() { 033 } 034 035 static final class Embedded extends JsonableBaseObject { 036 private List<ListItem> items; 037 038 @JsonProperty("items") 039 public List<ListItem> getItems() { 040 return items; 041 } 042 } 043 044 /** 045 * Gets the items contained in the {@code _embedded} response. 046 * 047 * @return The items for this page. 048 */ 049 @JsonIgnore 050 public List<ListItem> getItems() { 051 return _embedded != null ? _embedded.getItems() : null; 052 } 053 054 /** 055 * Creates an instance of this class from a JSON payload. 056 * 057 * @param json The JSON string to parse. 058 * @return An instance of this class with the fields populated, if present. 059 */ 060 public static ListItemsResponse fromJson(String json) { 061 return Jsonable.fromJson(json); 062 } 063}