Package zendesk.support
Class Article
- java.lang.Object
-
- zendesk.support.Article
-
- All Implemented Interfaces:
- java.io.Serializable
public class Article extends java.lang.Object implements java.io.SerializableThis is a model class for an Article object that will be created by theHelpCenterProvider.- See Also:
- Articles, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field and Description static intUNKNOWN_VOTE_COUNT
-
Constructor Summary
Constructors Constructor and Description Article()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description UsergetAuthor()Gets the author of this articlejava.lang.LonggetAuthorId()Gets the ID of the author of the articlejava.lang.StringgetBody()Gets the body of the article in plain textjava.util.DategetCreatedAt()Gets the date that the article was created at.intgetDownvoteCount()Gets the number of downvotes for this articlejava.lang.StringgetHtmlUrl()Gets the html URL of the article.java.lang.LonggetId()Gets the ID of the articlejava.util.List<java.lang.String>getLabelNames()Gets the label names of the articlejava.lang.StringgetLocale()Gets the locale of the article in the form of ll-CC, e.g.java.lang.IntegergetPosition()Gets the position of this article in the article list.java.lang.LonggetSectionId()Gets the ID of the section that the article belongs tojava.lang.StringgetSourceLocale()Gets the source locale of the article in the form of ll-CC, e.g.java.lang.StringgetTitle()Gets the title of the articlejava.util.DategetUpdatedAt()Gets the date that the article was updated at.intgetUpvoteCount()Gets the number of upvotes for this article.java.lang.StringgetUrl()Gets the API URL of the articleintgetVoteCount()Gets the total number of votes that have been cast for this article.intgetVoteSum()Gets the sum of votes.booleanisCommentsDisabled()Checks whether comments are disabled or notbooleanisDraft()Checks if the article is a draft or notbooleanisOutdated()Checks whether the article is outdated or notvoidsetAuthor(User author)Sets the author of this article.
-
-
-
Field Detail
-
UNKNOWN_VOTE_COUNT
public static final int UNKNOWN_VOTE_COUNT
- See Also:
- Constant Field Values
-
-
Method Detail
-
getId
public java.lang.Long getId()
Gets the ID of the article- Returns:
- the ID of the article
- Since:
- 1.0.0.1
-
getUrl
public java.lang.String getUrl()
Gets the API URL of the article- Returns:
- the API URL of the article
- Since:
- 1.0.0.1
-
getHtmlUrl
public java.lang.String getHtmlUrl()
Gets the html URL of the article. This is the URL that can be used to open the article in a browser.- Returns:
- the html URL of the article
- Since:
- 1.0.0.1
-
getAuthorId
public java.lang.Long getAuthorId()
Gets the ID of the author of the article- Returns:
- the ID of the author of the article
- Since:
- 1.0.0.1
-
isCommentsDisabled
public boolean isCommentsDisabled()
Checks whether comments are disabled or not- Returns:
- true if comments are disabled, false otherwise
- Since:
- 1.0.0.1
-
getLabelNames
public java.util.List<java.lang.String> getLabelNames()
Gets the label names of the article- Returns:
- the label names of the article. The list will be unmodifiable.
- Since:
- 1.0.0.1
-
isDraft
public boolean isDraft()
Checks if the article is a draft or not- Returns:
- true if the article is a draft, false otherwise
- Since:
- 1.0.0.1
-
getVoteSum
public int getVoteSum()
Gets the sum of votes. Unhelpful votes are taken as -1 value and helpful votes are taken as +1 value.For example, if there are 3 unhelpful votes and 5 helpful votes then the vote sum is (-1 * 3) + (+1 * 5) = 2
- Returns:
- The sum of votes. Unhelpful ones are -1, helpful ones are +1
- Since:
- 1.1.0.1
-
getVoteCount
public int getVoteCount()
Gets the total number of votes that have been cast for this article.For example, if there are 3 unhelpful votes and 5 helpful votes then the total number of votes is 3 + 5 = 8.
- Returns:
- the total number of votes that have been cast for this article.
- Since:
- 1.0.0.1
-
getSectionId
public java.lang.Long getSectionId()
Gets the ID of the section that the article belongs to- Returns:
- the ID of the section that the article belongs to
- Since:
- 1.0.0.1
-
getCreatedAt
public java.util.Date getCreatedAt()
Gets the date that the article was created at.- Returns:
- the date that the article was created at. Unmodifiable.
- Since:
- 1.0.0.1
-
getUpdatedAt
public java.util.Date getUpdatedAt()
Gets the date that the article was updated at.- Returns:
- the date that the article was created at. Unmodifiable.
- Since:
- 1.0.0.1
-
getTitle
public java.lang.String getTitle()
Gets the title of the article- Returns:
- the title of the article
- Since:
- 1.0.0.1
-
getBody
public java.lang.String getBody()
Gets the body of the article in plain text- Returns:
- the body of the article in plain text
- Since:
- 1.0.0.1
-
getSourceLocale
public java.lang.String getSourceLocale()
Gets the source locale of the article in the form of ll-CC, e.g. en-US- Returns:
- the source locale of the article in the form of ll-CC, e.g. en-US
- Since:
- 1.0.0.1
-
getLocale
public java.lang.String getLocale()
Gets the locale of the article in the form of ll-CC, e.g. en-US- Returns:
- the locale of the article in the form of ll-CC, e.g. en-US
- Since:
- 1.0.0.1
-
isOutdated
public boolean isOutdated()
Checks whether the article is outdated or not- Returns:
- true if the article is outdated, false otherwise
- Since:
- 1.0.0.1
-
getAuthor
public User getAuthor()
Gets the author of this article- Returns:
- the author of this article
- Since:
- 1.0.0.1
-
setAuthor
public void setAuthor(User author)
Sets the author of this article.This method is used by the providers to populate this object for convenience.
- Parameters:
author- The author to set- Since:
- 1.0.0.1
-
getPosition
public java.lang.Integer getPosition()
Gets the position of this article in the article list. 0 by default- Returns:
- the position of this article in the article list. 0 by default
- Since:
- 4.1.0
-
getUpvoteCount
public int getUpvoteCount()
Gets the number of upvotes for this article.The formula that is used is
((vote_sum + vote_count) / 2)- Returns:
- The number of upvotes for this article or
Article.UNKNOWN_VOTE_COUNTif the number of upvotes cannot be determined due to an API error. - Since:
- 1.2.0.1
-
getDownvoteCount
public int getDownvoteCount()
Gets the number of downvotes for this articleThe formula that is used is
abs(vote_sum - vote_count) / 2- Returns:
- The number of downvotes for this article or
Article.UNKNOWN_VOTE_COUNTif the number of downvotes cannot be determined due to an API error. - Since:
- 1.2.0.1
-
-