public JSONAPIDocument<List<Pledge>> fetchPageOfPledges(String campaignId, int pageSize, String pageCursor, Collection<Pledge.PledgeField> optionalFields) throws IOException {
    URIBuilder pathBuilder = new URIBuilder()
                               .setPath(String.format("campaigns/%s/pledges", campaignId))
                               .addParameter("page[count]", String.valueOf(pageSize));
    if (pageCursor != null) {
      pathBuilder.addParameter("page[cursor]", pageCursor);
    }
    if (optionalFields != null) {
      Set<Pledge.PledgeField> optionalAndDefaultFields = new HashSet<>(optionalFields);
      optionalAndDefaultFields.addAll(Pledge.PledgeField.getDefaultFields());
      addFieldsParam(pathBuilder, Pledge.class, optionalAndDefaultFields);
    }
    return converter.readDocumentCollection(
      getDataStream(pathBuilder.toString()),
      Pledge.class
    );
  }
public JSONAPIDocument < List < Pledge > > fetchPageOfPledges ( String campaignId , int pageSize , String pageCursor , Collection < Pledge . PledgeField > optionalFields ) throws IOException { URIBuilder pathBuilder = new URIBuilder ( ) . setPath ( String . format ( "campaigns/%s/pledges" , campaignId ) ) . addParameter ( "page[count]" , String . valueOf ( pageSize ) ) ; if ( pageCursor != null ) { pathBuilder . addParameter ( "page[cursor]" , pageCursor ) ; } if ( optionalFields != null ) { Set < Pledge . PledgeField > optionalAndDefaultFields = new HashSet < > ( optionalFields ) ; optionalAndDefaultFields . addAll ( Pledge . PledgeField . getDefaultFields ( ) ) ; addFieldsParam ( pathBuilder , Pledge . class , optionalAndDefaultFields ) ; } return converter . readDocumentCollection ( getDataStream ( pathBuilder . toString ( ) ) , Pledge . class ) ; }
Retrieve pledges for the specified campaign

@param campaignId id for campaign to retrieve
@param pageSize   how many pledges to return
@param pageCursor A cursor retreived from a previous API call, or null for the initial page.
See {@link #getNextCursorFromDocument(JSONAPIDocument)}
@param optionalFields A list of optional fields to return.  See {@link Pledge.PledgeField}
@return the page of pledges
@throws IOException Thrown when the GET request failed