forked from intercom/intercom-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAdmin.java
More file actions
157 lines (120 loc) · 4.13 KB
/
Copy pathAdmin.java
File metadata and controls
157 lines (120 loc) · 4.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
package io.intercom.api;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.collect.Maps;
import java.util.Map;
@SuppressWarnings("UnusedDeclaration")
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class Admin extends TypedData implements Replier {
private static final Map<String, String> SENTINEL = Maps.newHashMap();
public static final String TYPE_NOBODY = "nobody_admin";
// don't make public for now
static AdminCollection list(Map<String, String> params)
throws AuthorizationException, ClientException, ServerException, InvalidException, RateLimitException {
return DataResource.list(params, "admins", AdminCollection.class);
}
public static AdminCollection list()
throws AuthorizationException, ClientException, ServerException, InvalidException, RateLimitException {
return DataResource.list(SENTINEL, "admins", AdminCollection.class);
}
@SuppressWarnings("FieldCanBeLocal")
@JsonProperty("type")
private final String type = "admin";
@JsonProperty("id")
private String id;
@JsonProperty("name")
private String name;
@JsonProperty("email")
private String email;
@JsonProperty("created_at")
private long createdAt;
@JsonProperty("updated_at")
private long updatedAt;
@JsonProperty("open")
private long open;
@JsonProperty("closed")
private long closed;
public Admin() {
}
@JsonIgnore
public String getReplyType() {
return getType() + "_reply";
}
public String getType() {
return type;
}
@JsonIgnore
public boolean isNobody() {
return TYPE_NOBODY.equalsIgnoreCase(getType());
}
@JsonIgnore
public boolean isSomebody() {
return (!isNobody()) && (getId() != null);
}
public String getId() {
return id;
}
public Admin setId(String id) {
this.id = id;
return this;
}
public String getName() {
return name;
}
public String getEmail() {
return email;
}
public long getCreatedAt() {
return createdAt;
}
public long getUpdatedAt() {
return updatedAt;
}
public long getOpen() {
return open;
}
public long getClosed() {
return closed;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Admin admin = (Admin) o;
if (closed != admin.closed) return false;
if (createdAt != admin.createdAt) return false;
if (open != admin.open) return false;
if (updatedAt != admin.updatedAt) return false;
if (email != null ? !email.equals(admin.email) : admin.email != null) return false;
if (id != null ? !id.equals(admin.id) : admin.id != null) return false;
if (name != null ? !name.equals(admin.name) : admin.name != null) return false;
//noinspection RedundantIfStatement
if (!type.equals(admin.type)) return false;
return true;
}
@Override
public int hashCode() {
int result = type.hashCode();
result = 31 * result + (id != null ? id.hashCode() : 0);
result = 31 * result + (name != null ? name.hashCode() : 0);
result = 31 * result + (email != null ? email.hashCode() : 0);
result = 31 * result + (int) (createdAt ^ (createdAt >>> 32));
result = 31 * result + (int) (updatedAt ^ (updatedAt >>> 32));
result = 31 * result + (int) (open ^ (open >>> 32));
result = 31 * result + (int) (closed ^ (closed >>> 32));
return result;
}
@Override
public String toString() {
return "Admin{" +
"id='" + id + '\'' +
", name='" + name + '\'' +
", email='" + email + '\'' +
", createdAt=" + createdAt +
", updatedAt=" + updatedAt +
"} " + super.toString();
}
}