Skip to content

Commit d2882c3

Browse files
committed
Merge pull request cloudbees-oss#62 from christ66/hcsearch
Add api to search for articles in help center.
2 parents 7a2c2ea + 790bede commit d2882c3

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/main/java/org/zendesk/client/v2/Zendesk.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ private static Map<String, Class<? extends SearchResultEntity>> searchResultType
9292
result.put("group", Group.class);
9393
result.put("organization", Organization.class);
9494
result.put("topic", Topic.class);
95+
result.put("article", Article.class);
9596
return Collections.unmodifiableMap(result);
9697
}
9798

@@ -275,6 +276,11 @@ public Iterable<Ticket> getTicketsFromSearch(String searchTerm) {
275276
handleList(Ticket.class, "results"));
276277
}
277278

279+
public Iterable<Article> getArticleFromSearch(String searchTerm) {
280+
return new PagedIterable<Article>(tmpl("/help_center/articles/search.json{?query}").set("query", searchTerm),
281+
handleList(Article.class, "results"));
282+
}
283+
278284
public List<Ticket> getTickets(long id, long... ids) {
279285
return complete(submit(req("GET", tmpl("/tickets/show_many.json{?ids}").set("ids", idArray(id, ids))),
280286
handleList(Ticket.class, "tickets")));

src/main/java/org/zendesk/client/v2/model/hc/Article.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
package org.zendesk.client.v2.model.hc;
22

33
import com.fasterxml.jackson.annotation.JsonProperty;
4+
import org.zendesk.client.v2.model.SearchResultEntity;
45

56
import java.util.Date;
67
import java.util.List;
78

8-
public class Article {
9+
public class Article implements SearchResultEntity {
910
/** Automatically assigned when the article is created */
1011
private Long id;
1112

0 commit comments

Comments
 (0)