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.common; 017 018import com.fasterxml.jackson.annotation.JsonProperty; 019import com.vonage.client.JsonableBaseObject; 020 021/** 022 * Abstract base class for responses that conform to the 023 * <a href=https://datatracker.ietf.org/doc/html/draft-kelly-json-hal-07>HAL specification</a>. 024 */ 025public abstract class HalPageResponse extends JsonableBaseObject { 026 protected Integer page, pageSize, totalItems, totalPages; 027 private HalLinks links; 028 029 /** 030 * Current page. 031 * 032 * @return The current page number, or {@code null} if not applicable. 033 */ 034 @JsonProperty("page") 035 public Integer getPage() { 036 return page; 037 } 038 039 /** 040 * Size of each page. 041 * 042 * @return Number of results per page, or {@code null} if not applicable. 043 */ 044 @JsonProperty("page_size") 045 public Integer getPageSize() { 046 return pageSize; 047 } 048 049 /** 050 * Size of this page. 051 * 052 * @return Number of results on this page, or {@code null} if not applicable. 053 */ 054 @JsonProperty("total_items") 055 public Integer getTotalItems() { 056 return totalItems; 057 } 058 059 /** 060 * Number of results pages. 061 * 062 * @return Total number of available pages, or {@code null} if not applicable. 063 */ 064 @JsonProperty("total_pages") 065 public Integer getTotalPages() { 066 return totalPages; 067 } 068 069 /** 070 * The {@code _links} property in the HAL response. 071 * 072 * @return Navigation links wrapped in an object, or {@code null} if not applicable. 073 */ 074 @JsonProperty("_links") 075 public HalLinks getLinks() { 076 return links; 077 } 078}