-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add conversation participants support
- Loading branch information
Timothy Lim
committed
Nov 13, 2018
1 parent
c3ddbda
commit 4b63f9e
Showing
8 changed files
with
286 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -603,6 +603,29 @@ Conversation.runAssignmentRules("19240007891"); | |
|
||
// mark conversation as read | ||
Conversation.markAsRead("66"); | ||
|
||
// admin adding participant to conversation | ||
AdminAddParticipant adminAddParticipant = new AdminAddParticipant(); | ||
adminAddParticipant.setAdminId("248698"); | ||
Participant participant = new Participant(); | ||
participant.setIntercomUserId("5310d8e8598c9a0b24000005"); | ||
// participant.setUserId("2"); // or find by user_id | ||
// participant.setEmail("[email protected]"); // or find by user_id | ||
adminAddParticipant.setParticipant(participant); | ||
ParticipantResponse participantResponse = Conversation.addParticipant("19240007891", adminAddParticipant); | ||
|
||
// user adding participant to conversation | ||
UserAddParticipant userAddParticipant = new UserAddParticipant(); | ||
userAddParticipant.setIntercomUserId("575b4dbbd7f9c87f240008c5"); | ||
Participant participant = new Participant(); | ||
participant.setIntercomUserId("5310d8e8598c9a0b24000005"); | ||
// participant.setUserId("2"); // or find by user_id | ||
// participant.setEmail("[email protected]"); // or find by user_id | ||
userAddParticipant.setParticipant(participant); | ||
ParticipantResponse participantResponse = Conversation.addParticipant("19240007891", userAddParticipant); | ||
|
||
// removing participant from conversation | ||
ParticipantResponse participantResponse = Conversation.removeParticipant("19240007891", "248698", "564320845c88872b60000012"); | ||
``` | ||
|
||
### Webhooks | ||
|
45 changes: 45 additions & 0 deletions
45
intercom-java/src/main/java/io/intercom/api/AdminAddParticipant.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package io.intercom.api; | ||
|
||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
|
||
@SuppressWarnings("UnusedDeclaration") | ||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
@JsonInclude(JsonInclude.Include.NON_EMPTY) | ||
public class AdminAddParticipant { | ||
|
||
@JsonProperty("admin_id") | ||
public String adminId; | ||
|
||
@JsonProperty("customer") | ||
private Participant participant; | ||
|
||
public String getAdminId() { | ||
return adminId; | ||
} | ||
|
||
public AdminAddParticipant setAdminId(String adminId) { | ||
this.adminId = adminId; | ||
return this; | ||
} | ||
|
||
private Participant getParticipant(){ | ||
return participant; | ||
} | ||
|
||
public AdminAddParticipant setParticipant(Participant participant){ | ||
this.participant = participant; | ||
return this; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "AdminAddParticipant{" + | ||
"adminId='" + adminId + "\'" + | ||
",participant=" + participant + | ||
"} " + super.toString(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 81 additions & 0 deletions
81
intercom-java/src/main/java/io/intercom/api/Participant.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
package io.intercom.api; | ||
|
||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
@SuppressWarnings("UnusedDeclaration") | ||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
@JsonInclude(JsonInclude.Include.NON_EMPTY) | ||
public class Participant { | ||
|
||
@JsonProperty("intercom_user_id") | ||
private String intercomUserId; | ||
|
||
@JsonProperty("user_id") | ||
private String userId; | ||
|
||
@JsonProperty("email") | ||
private String email; | ||
|
||
public Participant() { | ||
} | ||
|
||
public String getIntercomUserId() { | ||
return intercomUserId; | ||
} | ||
|
||
public Participant setIntercomUserId(String intercomUserId) { | ||
this.intercomUserId = intercomUserId;; | ||
return this; | ||
} | ||
|
||
public String getUserId() { | ||
return userId; | ||
} | ||
|
||
public Participant setUserId(String userId) { | ||
this.userId = userId; | ||
return this; | ||
} | ||
|
||
public String getEmail() { | ||
return email; | ||
} | ||
|
||
public Participant setEmail(String email) { | ||
this.email = email; | ||
return this; | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
int result = intercomUserId != null ? intercomUserId.hashCode() : 0; | ||
result = 31 * result + (userId != null ? userId.hashCode() : 0); | ||
result = 31 * result + (email != null ? email.hashCode() : 0); | ||
return result; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
|
||
Participant customer = (Participant) o; | ||
|
||
if (intercomUserId != null ? !intercomUserId.equals(customer.intercomUserId) : customer.intercomUserId != null) return false; | ||
if (userId != null ? !userId.equals(customer.userId) : customer.userId != null) return false; | ||
if (email != null ? !email.equals(customer.email) : customer.email != null) return false; | ||
return true; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "Participant{" + | ||
", intercomUserId='" + intercomUserId+ '\'' + | ||
", userId='" + userId+ '\'' + | ||
", email='" + email+ '\'' + | ||
"} " + super.toString(); | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
intercom-java/src/main/java/io/intercom/api/ParticipantResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package io.intercom.api; | ||
|
||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
import java.util.List; | ||
|
||
@SuppressWarnings("UnusedDeclaration") | ||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
@JsonInclude(JsonInclude.Include.NON_EMPTY) | ||
public class ParticipantResponse { | ||
|
||
@JsonProperty("customers") | ||
private List<Customer> customers; | ||
|
||
public ParticipantResponse() { | ||
} | ||
|
||
public List<Customer> getCustomers(){ | ||
return customers; | ||
} | ||
} |
71 changes: 71 additions & 0 deletions
71
intercom-java/src/main/java/io/intercom/api/UserAddParticipant.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
package io.intercom.api; | ||
|
||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
|
||
@SuppressWarnings("UnusedDeclaration") | ||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
@JsonInclude(JsonInclude.Include.NON_EMPTY) | ||
public class UserAddParticipant { | ||
|
||
@JsonProperty("intercom_user_id") | ||
public String intercomUserId; | ||
|
||
@JsonProperty("user_id") | ||
public String userId; | ||
|
||
@JsonProperty("email") | ||
public String email; | ||
|
||
@JsonProperty("customer") | ||
private Participant participant; | ||
|
||
public String getIntercomUserId() { | ||
return intercomUserId; | ||
} | ||
|
||
public UserAddParticipant setIntercomUserId(String intercomUserId) { | ||
this.intercomUserId = intercomUserId; | ||
return this; | ||
} | ||
|
||
public String getUserID() { | ||
return userId; | ||
} | ||
|
||
public UserAddParticipant setUserID(String userId) { | ||
this.userId = userId; | ||
return this; | ||
} | ||
|
||
public String getEmail() { | ||
return email; | ||
} | ||
|
||
public UserAddParticipant setEmail(String email) { | ||
this.email = email; | ||
return this; | ||
} | ||
|
||
private Participant getParticipant(){ | ||
return participant; | ||
} | ||
|
||
public UserAddParticipant setParticipant(Participant participant){ | ||
this.participant = participant; | ||
return this; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "UserAddParticipant{" + | ||
"intercomUserId='" + intercomUserId + "\'" + | ||
"userId='" + userId + "\'" + | ||
"email='" + email + "\'" + | ||
",participant=" + participant + | ||
"} " + super.toString(); | ||
} | ||
} |