Class IncludesQueryBuilder
java.lang.Object
net.amcintosh.freshbooks.models.builders.IncludesQueryBuilder
- All Implemented Interfaces:
QueryBuilder
Builder for including relationships, sub-resources, or additional data in the response.
Can be passed to a
.get()
call, or to a .list()
call.
FreshBooksClient freshBooksClient = new FreshBooksClient.FreshBooksClientBuilder("some_client_id")
.withAccessToken("some_token")
.build();
Clients clients = new Clients(freshBooksClient);
IncludesQueryBuilder inc = new IncludesQueryBuilder();
inc.includes("last_activity").includes("late_reminders");
assertEquals("&includes[]=last_activity&includes[]=late_reminders", inc.build(ResourceType.ACCOUNTING_LIKE));
Client clientResponse = clients.get(accountId, clientId, inc);
ArrayList<QueryBuilder> builders = new ArrayList<QueryBuilder>();
builders.add(inc);
ClientList clientListResponse = clients.list(accountId, builders);
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild
(ResourceType resourceType) Build the query string parameters for the list or get call.Add an include key to the builder.toString()
-
Constructor Details
-
IncludesQueryBuilder
public IncludesQueryBuilder()
-
-
Method Details
-
include
Add an include key to the builder.- Parameters:
key
- The key for the included field, sub-resource, etc.- Returns:
- The IncludesQueryBuilder instance.
-
toString
-
build
Build the query string parameters for the list or get call. As different FreshBooks resources use different structure for includes parameters, a resource type is required.- Specified by:
build
in interfaceQueryBuilder
- Parameters:
resourceType
- The resource type.- Returns:
- The composed query string parameters.
-