Factory method for Message list, returns a list of Message objects with page, size preference
@param client the client.
@param page the page
@param size the page size
@return the list
@throws IOException unexpected error
353327
public static ResourceList<Message> list(final BandwidthClient client, final int page, final int size) throws Exception {
    	
        final String messageUri = client.getUserResourceUri(BandwidthConstants.MESSAGES_URI_PATH);

        final ResourceList<Message> messages = 
        			new ResourceList<Message>(page, size, messageUri, Message.class);

        messages.setClient(client);
        messages.initialize();
        
        return messages;
    }
77355
@SuppressWarnings("unchecked")
    public static <E> Page<E> cast(final Page<?> page) {
        return (Page<E>) page;
    }
886545
@Override
    public Page<Variable> nextPage(final Page<Variable> page, 
                                   final TwilioRestClient client) {
        Request request = new Request(
            HttpMethod.GET,
            page.getNextPageUrl(
                Domains.SERVERLESS.toString(),
                client.getRegion()
            )
        );
        return pageForRequest(client, request);
    }
1322500
@Override
    public Page<ShortCode> previousPage(final Page<ShortCode> page, 
                                        final TwilioRestClient client) {
        Request request = new Request(
            HttpMethod.GET,
            page.getPreviousPageUrl(
                Domains.MESSAGING.toString(),
                client.getRegion()
            )
        );
        return pageForRequest(client, request);
    }
764437
@Override
    @SuppressWarnings("checkstyle:linelength")
    public Page<MessageInteraction> firstPage(final TwilioRestClient client) {
        Request request = new Request(
            HttpMethod.GET,
            Domains.PROXY.toString(),
            "/v1/Services/" + this.pathServiceSid + "/Sessions/" + this.pathSessionSid + "/Participants/" + this.pathParticipantSid + "/MessageInteractions",
            client.getRegion()
        );

        addQueryParams(request);
        return pageForRequest(client, request);
    }
1249869
public static PageRequest of(final int page, final int size) {
    return PageRequest.of(page, size, Sort.unsorted());
  }
483982
public static ResourceList<Endpoint> list(final BandwidthClient client, final String domainId, final int page, final int size) {
        assert(domainId != null);
        assert(page  >= 0);
        assert(size > 0);
        final String resourceUri = String.format(client.getUserResourceUri(BandwidthConstants.ENDPOINTS_URI_PATH), domainId);
        final ResourceList<Endpoint> endpoints = new ResourceList<Endpoint>(page, size, resourceUri, Endpoint.class);
        endpoints.setClient(client);
        endpoints.initialize();
        return endpoints;
    }
612061
@Action(name = "List Size",
            outputs = {
                    @Output(RESULT_TEXT),
                    @Output(RESPONSE),
                    @Output(RETURN_RESULT),
                    @Output(RETURN_CODE)
            },
            responses = {
                    @Response(text = Constants.ResponseNames.SUCCESS, field = RETURN_CODE, value = RETURN_CODE_SUCCESS, matchType = MatchType.COMPARE_EQUAL),
                    @Response(text = Constants.ResponseNames.FAILURE, field = RETURN_CODE, value = RETURN_CODE_FAILURE, matchType = MatchType.COMPARE_EQUAL, isOnFail = true, isDefault = true)
            })
    public Map<String, String> getListSize(@Param(value = LIST, required = true) String list,
                                           @Param(value = DELIMITER, required = true) String delimiter) {
        Map<String, String> result = new HashMap<>();
        try {
            String[] table = ListProcessor.toArray(list, delimiter);
            result.put(RESULT_TEXT, String.valueOf(table.length));
            result.put(RESPONSE, Constants.ResponseNames.SUCCESS);
            result.put(RETURN_RESULT, String.valueOf(table.length));
            result.put(RETURN_CODE, RETURN_CODE_SUCCESS);
        } catch (Exception e) {
            result.put(RESULT_TEXT, e.getMessage());
            result.put(RESPONSE, Constants.ResponseNames.FAILURE);
            result.put(RETURN_RESULT, e.getMessage());
            result.put(RETURN_CODE, RETURN_CODE_FAILURE);
        }
        return result;
    }
1186070
public static <T> DataPage<T> getByList(List<T> list, int pageSize, int pageNo) {
        List<T> l = subList(list, pageSize, pageNo);
        return new DataPage<T>(l, list.size(), pageSize, pageNo);
    }
203850
@Override
    public ResourceSet<MessageInteraction> read(final TwilioRestClient client) {
        return new ResourceSet<>(this, client, firstPage(client));
    }
724898
@Override
  public P readPage(int pageID) {
    try {
      countRead();
      long offset = ((long) (header.getReservedPages() + pageID)) * (long) pageSize;
      byte[] buffer = new byte[pageSize];
      file.seek(offset);
      file.read(buffer);
      return byteArrayToPage(buffer);
    }
    catch(IOException e) {
      throw new RuntimeException("IOException occurred during reading of page " + pageID + "\n", e);
    }
  }
66246
public static ResourceList<MediaFile> list(final int page, final int size) throws IOException {
    	
        
        return list(BandwidthClient.getInstance(), page, size);
    }
1038600
public static ArrayList<QueueModel> getQueues(Client client) throws IOException {
        return getQueues(client, null, null, null);
    }
891483
@Override
    public Page<Session> nextPage(final Page<Session> page, 
                                  final TwilioRestClient client) {
        Request request = new Request(
            HttpMethod.GET,
            page.getNextPageUrl(
                Domains.MESSAGING.toString(),
                client.getRegion()
            )
        );
        return pageForRequest(client, request);
    }
1235082
public static <T> List<T> subList(List<T> list, int pageSize, int pageNo) {
        pageSize = (pageSize <= 0 ? 10 : pageSize);
        pageNo = (pageNo <= 0 ? 1 : pageNo);
        int begin = (pageSize * (pageNo - 1) > list.size() ? list.size() : pageSize * (pageNo - 1));
        int end = (pageSize * pageNo > list.size() ? list.size() : pageSize * pageNo);
        return new ArrayList<T>(list.subList(begin, end));
    }
480926
@Override
    public GridMessage listPage(int pPageIndex, int pPageSize) {
        GridMessage data = new GridMessage();
        data.setData(invokePage(pPageIndex, pPageSize));
        data.setTotal(mDao.selectCount(null));
        return data;
    }
1161171
@Override
    public Page<User> previousPage(final Page<User> page, 
                                   final TwilioRestClient client) {
        Request request = new Request(
            HttpMethod.GET,
            page.getPreviousPageUrl(
                Domains.IPMESSAGING.toString(),
                client.getRegion()
            )
        );
        return pageForRequest(client, request);
    }