Skip to content

Commit 251b034

Browse files
author
stephen powis
committed
finish javadocs
1 parent 4e5c290 commit 251b034

File tree

11 files changed

+104
-22
lines changed

11 files changed

+104
-22
lines changed

pom.xml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,22 @@
246246
</execution>
247247
</executions>
248248
</plugin>
249+
250+
<!-- GPG Signing of Artifacts -->
251+
<plugin>
252+
<groupId>org.apache.maven.plugins</groupId>
253+
<artifactId>maven-gpg-plugin</artifactId>
254+
<version>1.6</version>
255+
<executions>
256+
<execution>
257+
<id>sign-artifacts</id>
258+
<phase>verify</phase>
259+
<goals>
260+
<goal>sign</goal>
261+
</goals>
262+
</execution>
263+
</executions>
264+
</plugin>
249265
</plugins>
250266

251267
<pluginManagement>

src/main/java/com/darksci/pardot/api/request/BaseQueryRequest.java

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ public abstract class BaseQueryRequest<T> extends BaseRequest<T> {
1111
/**
1212
* Add constraint where Id is greater than the specified value.
1313
* @param idGreaterThan Id constraint.
14+
* @return BaseQueryRequest
1415
*/
1516
public T withIdGreaterThan(final Integer idGreaterThan) {
1617
return setParam("id_greater_than", idGreaterThan);
@@ -19,6 +20,7 @@ public T withIdGreaterThan(final Integer idGreaterThan) {
1920
/**
2021
* Add constraint where Id is less than the specified value.
2122
* @param idLessThan Id constraint.
23+
* @return BaseQueryRequest
2224
*/
2325
public T withIdLessThan(final Integer idLessThan) {
2426
return setParam("id_less_than", idLessThan);
@@ -27,6 +29,7 @@ public T withIdLessThan(final Integer idLessThan) {
2729
/**
2830
* Add constraint where CreatedAt field is after than the specified time value.
2931
* @param createdAfter date constraint.
32+
* @return BaseQueryRequest
3033
*/
3134
public T withCreatedAfter(DateParameter createdAfter) {
3235
return setParam("created_after", createdAfter);
@@ -35,6 +38,7 @@ public T withCreatedAfter(DateParameter createdAfter) {
3538
/**
3639
* Add constraint where CreatedAt field is before than the specified time value.
3740
* @param createdBefore date constraint.
41+
* @return BaseQueryRequest
3842
*/
3943
public T withCreatedBefore(final DateParameter createdBefore) {
4044
return setParam("created_before", createdBefore);
@@ -43,6 +47,7 @@ public T withCreatedBefore(final DateParameter createdBefore) {
4347
/**
4448
* Add constraint where UpdatedAt field is after than the specified time value.
4549
* @param updatedAfter date constraint.
50+
* @return BaseQueryRequest
4651
*/
4752
protected T withUpdatedAfter(final DateParameter updatedAfter) {
4853
return setParam("updated_after", updatedAfter);
@@ -51,6 +56,7 @@ protected T withUpdatedAfter(final DateParameter updatedAfter) {
5156
/**
5257
* Add constraint where UpdatedAt field is before than the specified time value.
5358
* @param updatedBefore date constraint.
59+
* @return BaseQueryRequest
5460
*/
5561
protected T withUpdatedBefore(final DateParameter updatedBefore) {
5662
return setParam("updated_before", updatedBefore);
@@ -76,27 +82,31 @@ public Integer getIdLessThan() {
7682

7783
/**
7884
* Sort by CreatedAt.
85+
* @return BaseQueryRequest
7986
*/
8087
protected T withSortByCreatedAt() {
8188
return withSortBy("created_at");
8289
}
8390

8491
/**
8592
* Sort results by UpdatedAt.
93+
* @return BaseQueryRequest
8694
*/
8795
protected T withSortByUpdatedAt() {
8896
return withSortBy("updated_at");
8997
}
9098

9199
/**
92100
* Sort results by Name.
101+
* @return BaseQueryRequest
93102
*/
94103
protected T withSortByName() {
95104
return withSortBy("name");
96105
}
97106

98107
/**
99108
* Sort results by Id.
109+
* @return BaseQueryRequest
100110
*/
101111
protected T withSortById() {
102112
return withSortBy("id");
@@ -111,6 +121,7 @@ public Integer getLimit() {
111121
/**
112122
* Add limit on how many results are returned.
113123
* @param limit Limit of how many results to return.
124+
* @return BaseQueryRequest
114125
*/
115126
public T withLimit(final Integer limit) {
116127
return setParam("limit", limit);
@@ -127,6 +138,7 @@ public Integer getOffset() {
127138
* Example:
128139
* Specifying offset=10 will return the results starting with the 11th campaign matched by the provided criteria
129140
* @param offset Offset to use.
141+
* @return BaseQueryRequest
130142
*/
131143
public T withOffset(final Integer offset) {
132144
return setParam("offset", offset);
@@ -158,12 +170,10 @@ public T withSortOrderAscending() {
158170

159171
/**
160172
* Marked as protected because I'm not sure if all objects support this or not.
173+
* @param onlyReturnArchived True to only get returned archived entries.
174+
* @return BaseQueryRequest
161175
*/
162-
protected T withArchivedOnly(boolean archivedOnly) {
163-
String value = "false";
164-
if (archivedOnly) {
165-
value = "true";
166-
}
167-
return setParam("deleted", archivedOnly);
176+
protected T withArchivedOnly(boolean onlyReturnArchived) {
177+
return setBooleanParam("deleted", onlyReturnArchived);
168178
}
169179
}

src/main/java/com/darksci/pardot/api/request/BaseRequest.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ protected <T> T getParam(final String name) {
1616
return (T) params.getOrDefault(name, null);
1717
}
1818

19-
protected <T> T setParam(final String name, Object value) {
19+
protected T setParam(final String name, Object value) {
2020
if (value == null) {
2121
params.remove(name);
2222
} else {
@@ -29,8 +29,9 @@ protected <T> T setParam(final String name, Object value) {
2929
* Utility method to set a boolean parameter, converts boolean into string "true"/"false"
3030
* @param parameterName Name of the parameter to set.
3131
* @param booleanValue Boolean value to store.
32+
* @return BaseRequest
3233
*/
33-
protected <T> T setBooleanParam(final String parameterName, final boolean booleanValue) {
34+
protected T setBooleanParam(final String parameterName, final boolean booleanValue) {
3435
String value = "true";
3536
if (!booleanValue) {
3637
value = "false";
@@ -40,6 +41,7 @@ protected <T> T setBooleanParam(final String parameterName, final boolean boolea
4041

4142
/**
4243
* Returns all set RequestParameters for the Request.
44+
* @return All set Request Parameters generated from Request builder.
4345
*/
4446
@Override
4547
public Map<String, String> getRequestParameters() {

src/main/java/com/darksci/pardot/api/request/DateParameter.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,14 @@ public static DateParameter custom(final int year, final int month, final int da
4343
}
4444

4545
/**
46-
* Define a custom date & time.
46+
* Define a custom date and time.
47+
* @param year Four digit year, ex. 2017.
48+
* @param month Month, 1 through 12.
49+
* @param day Day of month.
50+
* @param hour Hour of day, 24 time, 0 through 23.
51+
* @param min Minute of hour, 0 through 59.
52+
* @param sec Second of minute, 0 through 59.
53+
* @return Configured DateParameter.
4754
*/
4855
public static DateParameter custom(final int year, final int month, final int day, final int hour, final int min, final int sec) {
4956
String gnuDateStr = year + "-" + month + "-" + day + " ";

src/main/java/com/darksci/pardot/api/request/campaign/CampaignCreateRequest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ public String getApiEndpoint() {
1515
/**
1616
* Define the campaign you want to create in pardot.
1717
* @param campaign The campaign you want to create in pardot.
18+
* @return CampaignCreateRequest builder.
1819
*/
1920
public CampaignCreateRequest withCampaign(final Campaign campaign) {
2021
setParam("name", campaign.getName());

src/main/java/com/darksci/pardot/api/request/campaign/CampaignUpdateRequest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ public String getApiEndpoint() {
1515
/**
1616
* Define the campaign you want to update in pardot.
1717
* @param campaign The campaign you want to update in pardot.
18+
* @return CampaignUpdateRequest builder.
1819
*/
1920
public CampaignUpdateRequest withCampaign(final Campaign campaign) {
2021
setParam("id", campaign.getId());

src/main/java/com/darksci/pardot/api/request/email/EmailReadRequest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ public EmailReadRequest selectById(final Long id) {
2121
* When set to false, the email will not include the html nor text body message.
2222
* Defaults to true.
2323
* @param includeMessage Should the response include the html and text bodies.
24+
* @return EmailReadRequest builder.
2425
*/
2526
public EmailReadRequest withIncludeMessageInResponse(boolean includeMessage) {
2627
String value = "true";

src/main/java/com/darksci/pardot/api/request/email/EmailSendOneToOneRequest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public EmailSendOneToOneRequest withFromAssignedUser(final boolean sendFromAssig
9393
* @param sendFromAccountOwner True to send from Prospect's account owner, false if not.
9494
* @return RequestBuilder
9595
*/
96-
public EmailSendListRequest withFromAccountOwner(final boolean sendFromAccountOwner) {
96+
public EmailSendOneToOneRequest withFromAccountOwner(final boolean sendFromAccountOwner) {
9797
return setBooleanParam("from_account_owner", sendFromAccountOwner);
9898
}
9999

src/main/java/com/darksci/pardot/api/request/user/UserReadRequest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ public String getApiEndpoint() {
1515
/**
1616
* Returns the data for the user specified by email.
1717
* @param email The email address of the target user.
18+
* @return UserReadRequest builder.
1819
*/
1920
public UserReadRequest selectByEmail(final String email) {
2021
if (email != null) {
@@ -26,6 +27,7 @@ public UserReadRequest selectByEmail(final String email) {
2627
/**
2728
* Returns the data for the user specified by id.
2829
* @param id The Pardot ID of the target user.
30+
* @return UserReadRequest builder.
2931
*/
3032
public UserReadRequest selectById(final Long id) {
3133
if (id != null) {

src/main/java/com/darksci/pardot/api/rest/HttpClientRestClient.java

Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -300,76 +300,109 @@ public LoginResponse authenticate() {
300300

301301
/**
302302
* Make API request to query one or more users.
303+
* @param request Request definition.
304+
* @return Parsed user query response.
305+
* @throws IOException on parse errors.
303306
*/
304-
public UserQueryResponse.Result userQuery(final UserQueryRequest userQueryRequest) throws IOException {
305-
return post(userQueryRequest, new UserQueryResponseHandler());
307+
public UserQueryResponse.Result userQuery(final UserQueryRequest request) throws IOException {
308+
return post(request, new UserQueryResponseHandler());
306309
}
307310

308311
/**
309312
* Make API request to read the abilities of the currently authenticated user.
313+
* @param request Request definition.
314+
* @return Parsed api response.
315+
* @throws IOException on parse errors.
310316
*/
311-
public UserAbilitiesResponse.Result userAbilities(final UserAbilitiesRequest userAbilitiesRequest) throws IOException {
312-
return post(userAbilitiesRequest, new UserAbilitiesHandler());
317+
public UserAbilitiesResponse.Result userAbilities(final UserAbilitiesRequest request) throws IOException {
318+
return post(request, new UserAbilitiesHandler());
313319
}
314320

315321
/**
316322
* Make API request to read a specific user.
323+
* @param request Request definition.
324+
* @return Parsed api response.
325+
* @throws IOException on parse errors.
317326
*/
318-
public User userRead(final UserReadRequest readRequest) throws IOException {
319-
return post(readRequest, new UserReadResponseHandler());
327+
public User userRead(final UserReadRequest request) throws IOException {
328+
return post(request, new UserReadResponseHandler());
320329
}
321330

322331
/**
323332
* Make API request to query for one or more campaigns.
333+
* @param request Request definition.
334+
* @return Parsed api response.
335+
* @throws IOException on parse errors.
324336
*/
325337
public CampaignQueryResponse.Result campaignQuery(final CampaignQueryRequest request) throws IOException {
326338
return post(request, new CampaignQueryResponseHandler());
327339
}
328340

329341
/**
330342
* Make API request to read a specific campaign.
343+
* @param request Request definition.
344+
* @return Parsed api response.
345+
* @throws IOException on parse errors.
331346
*/
332347
public Campaign campaignRead(final CampaignReadRequest request) throws IOException {
333348
return post(request, new CampaignReadResponseHandler());
334349
}
335350

336351
/**
337352
* Make API request to create a new Campaign.
353+
* @param request Request definition.
354+
* @return Parsed api response.
355+
* @throws IOException on parse errors.
338356
*/
339357
public Campaign campaignCreate(final CampaignCreateRequest request) throws IOException {
340358
return post(request, new CampaignReadResponseHandler());
341359
}
342360

343361
/**
344362
* Make API request to update an existing Campaign.
363+
* @param request Request definition.
364+
* @return Parsed api response.
365+
* @throws IOException on parse errors.
345366
*/
346367
public Campaign campaignUpdate(final CampaignUpdateRequest request) throws IOException {
347368
return post(request, new CampaignReadResponseHandler());
348369
}
349370

350371
/**
351372
* Make API request to read a specific Email.
373+
* @param request Request definition.
374+
* @return Parsed api response.
375+
* @throws IOException on parse errors.
352376
*/
353377
public Email emailRead(final EmailReadRequest request) throws IOException {
354378
return post(request, new EmailReadResponseHandler());
355379
}
356380

357381
/**
358382
* Make API request to retrieve stats about a List Email Send.
383+
* @param request Request definition.
384+
* @return Parsed api response.
385+
* @throws IOException on parse errors.
359386
*/
360387
public EmailStatsResponse.Stats emailStats(final EmailStatsRequest request) throws IOException {
361388
return post(request, new EmailStatsResponseHandler());
362389
}
363390

364391
/**
365392
* Make API request to send a 1-to-1 prospect email.
393+
* @param request Request definition.
394+
* @return Parsed api response.
395+
* @throws IOException on parse errors.
366396
*/
367397
public Email emailSendOneToOne(final EmailSendOneToOneRequest request) throws IOException {
368398
return post(request, new EmailReadResponseHandler());
369399
}
370400

371401
/**
372402
* Make API request to send a list email.
403+
* @param request Request definition.
404+
* @return Parsed api response.
405+
* @throws IOException on parse errors.
373406
*/
374407
public Email emailSendList(final EmailSendListRequest request) throws IOException {
375408
return post(request, new EmailReadResponseHandler());

0 commit comments

Comments
 (0)