Skip to content

Add basic View support - List the Views; List the tickets in a View #491

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 1, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add basic View support - List the Views; List the tickets in a View
Provide basic functionality for views. Support getting a list of the
Views. Then, using the view id, we can get a list of the Tickets
in the View.
  • Loading branch information
bob committed Jun 23, 2022
commit d7c031b9f533f7095a270a6e8b274130d3880233
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

<groupId>com.cloudbees.thirdparty</groupId>
<artifactId>zendesk-java-client</artifactId>
<version>0.17.1-SNAPSHOT</version>
<version>0.17.2-SNAPSHOT</version>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not required in the PR

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

replaced old value.


<name>zendesk-java-client</name>
<description>Java client for the Zendesk API</description>
Expand Down
14 changes: 13 additions & 1 deletion src/main/java/org/zendesk/client/v2/Zendesk.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
import org.zendesk.client.v2.model.User;
import org.zendesk.client.v2.model.UserField;
import org.zendesk.client.v2.model.UserRelatedInfo;
import org.zendesk.client.v2.model.View;
import org.zendesk.client.v2.model.dynamic.DynamicContentItem;
import org.zendesk.client.v2.model.dynamic.DynamicContentItemVariant;
import org.zendesk.client.v2.model.hc.Article;
Expand Down Expand Up @@ -853,7 +854,18 @@ public void deleteTrigger(long triggerId) {
}


// Automations
// Views
public Iterable<View> getViews() {
return new PagedIterable<>(cnst("/views.json"), handleList(View.class, "views"));

}

public Iterable<Ticket> getView(long id) {
return new PagedIterable<>(tmpl("/views/{id}/tickets.json").set("id", id),
handleList(Ticket.class, "tickets"));
}

// Automations
public Iterable<Automation> getAutomations() {
return new PagedIterable<>(cnst("/automations.json"),
handleList(Automation.class, "automations"));
Expand Down
142 changes: 142 additions & 0 deletions src/main/java/org/zendesk/client/v2/model/View.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
package org.zendesk.client.v2.model;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;

import java.io.Serializable;

@JsonIgnoreProperties(ignoreUnknown = true)
public class View implements Serializable {

<<<<<<< HEAD
private static final long serialVersionUID = 1L;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's probably better to generate a random number. (IDEs are generally proposing it)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed.

=======
private static final long serialVersionUID = 8162172428393948830L;

>>>>>>> 954b71b... Add basic View support - List the Views; List the tickets in a View
private long id;
private String title;
private boolean active;
private String updatedAt;
private String createdAt;
private long position;
private String description;
private Conditions conditions;
private boolean watchable;
<<<<<<< HEAD
private String rawTitle;
=======
>>>>>>> 954b71b... Add basic View support - List the Views; List the tickets in a View

public void setId(long id) {
this.id = id;
}

@JsonProperty("id")
public long getId() {
return this.id;
}

public void setTitle(String title) {
this.title = title;
}

@JsonProperty("title")
public String getTitle() {
return this.title;
}

public void setActive(boolean active) {
this.active = active;
}

@JsonProperty("active")
public boolean getActive() {
return this.active;
}

public void setUpdatedAt(String updatedAt) {
this.updatedAt = updatedAt;
}

@JsonProperty("updated_at")
public String getUpdatedAt() {
return this.updatedAt;
}

public void setCreatedAt(String createdAt) {
this.createdAt = createdAt;
}

@JsonProperty("created_at")
public String getCreatedAt() {
return this.createdAt;
}

public void setPosition(long position) {
this.position = position;
}

@JsonProperty("position")
public long getPosition() {
return this.position;
}

public void setDescription(String description) {
this.description = description;
}

@JsonProperty("description")
public String getDescription() {
return this.description;
}

public void setConditions(Conditions conditions) {
this.conditions = conditions;
}

@JsonProperty("conditions")
public Conditions getConditions() {
return this.conditions;
}

public void setWatchable(boolean watchable) {
this.watchable = watchable;
}

@JsonProperty("watchable")
public boolean getWatchable() {
return this.watchable;
}

<<<<<<< HEAD
public void setRawTitle(String rawTitle) {
this.rawTitle = rawTitle;
}

@JsonProperty("raw_title")
public String getRawTitle() {
return this.rawTitle;
}

=======
>>>>>>> 954b71b... Add basic View support - List the Views; List the tickets in a View
//TODO: fix this.
public String toString() {
return "View " +
"{id=" + id +
", title=" + title +
", active=" + active +
", updatedAt=" + updatedAt +
", createdAt=" + createdAt +
", position=" + position +
", description=" + description +
", conditions=" + conditions +
", watchable=" + watchable +
<<<<<<< HEAD
", rawTitle=" + rawTitle +
=======
>>>>>>> 954b71b... Add basic View support - List the Views; List the tickets in a View
"}";
}
}