Skip to content

Commit f0a6277

Browse files
Merge pull request #385 from HubSpot/feature/add_basic_models_to_support_work_objects
Feature/add basic models to support work objects
2 parents a12f1d6 + 4912d36 commit f0a6277

16 files changed

+211
-2
lines changed

slack-base/src/main/java/com/hubspot/slack/client/methods/params/chat/ChatUnfurlParamsIF.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import com.fasterxml.jackson.databind.annotation.JsonNaming;
77
import com.hubspot.immutables.style.HubSpotStyle;
88
import com.hubspot.slack.client.methods.interceptor.HasChannel;
9+
import com.hubspot.slack.client.methods.params.chat.workobject.Metadata;
910
import com.hubspot.slack.client.models.ChatUnfurlBlocksOrAttachment;
1011
import com.hubspot.slack.client.models.json.BlockOrAttachmentDeserializer;
1112
import java.net.URI;
@@ -31,4 +32,6 @@ public interface ChatUnfurlParamsIF extends HasChannel {
3132
Optional<String> getUserAuthMessage();
3233

3334
Optional<URI> getUserAuthUrl();
35+
36+
Optional<Metadata> getMetadata();
3437
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package com.hubspot.slack.client.methods.params.chat.workobject;
2+
3+
import com.fasterxml.jackson.annotation.JsonValue;
4+
5+
public enum EntityType {
6+
FILE("slack#/entities/file"),
7+
TASK("slack#/entities/task"),
8+
INCIDENT("slack#/entities/incident"),
9+
CONTENT_ITEM("slack#/entities/content_item"),
10+
ITEM("slack#/entities/item");
11+
12+
private final String value;
13+
14+
EntityType(String value) {
15+
this.value = value;
16+
}
17+
18+
@JsonValue
19+
public String getValue() {
20+
return value;
21+
}
22+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package com.hubspot.slack.client.methods.params.chat.workobject;
2+
3+
import com.hubspot.immutables.style.HubSpotStyle;
4+
import java.util.Optional;
5+
import org.immutables.value.Value;
6+
7+
@Value.Immutable
8+
@HubSpotStyle
9+
public interface ExternalRefIF {
10+
String getId();
11+
Optional<String> getType();
12+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package com.hubspot.slack.client.methods.params.chat.workobject;
2+
3+
import com.hubspot.immutables.style.HubSpotStyle;
4+
import java.util.List;
5+
import org.immutables.value.Value;
6+
7+
@Value.Immutable
8+
@HubSpotStyle
9+
public interface MetadataIF {
10+
List<WorkObject> getEntities();
11+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package com.hubspot.slack.client.methods.params.chat.workobject;
2+
3+
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
4+
import com.hubspot.immutables.style.HubSpotStyle;
5+
import com.hubspot.slack.client.methods.params.chat.workobject.entity.EntityPayload;
6+
import com.hubspot.slack.client.methods.params.chat.workobject.serializers.EntityTypeSerializer;
7+
import org.immutables.value.Value;
8+
9+
@Value.Immutable
10+
@HubSpotStyle
11+
public interface WorkObjectIF {
12+
String getAppUnfurlUrl();
13+
String getUrl();
14+
ExternalRef getExternalRef();
15+
16+
@JsonSerialize(using = EntityTypeSerializer.class)
17+
EntityType getEntityType();
18+
19+
EntityPayload getEntityPayload();
20+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package com.hubspot.slack.client.methods.params.chat.workobject.entity;
2+
3+
import com.fasterxml.jackson.annotation.JsonValue;
4+
5+
public enum DisplayType {
6+
DOCUMENT("Document"),
7+
FILE("File"),
8+
TASK("Task");
9+
10+
private final String value;
11+
12+
DisplayType(String value) {
13+
this.value = value;
14+
}
15+
16+
@JsonValue
17+
public String getValue() {
18+
return value;
19+
}
20+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package com.hubspot.slack.client.methods.params.chat.workobject.entity;
2+
3+
import com.hubspot.immutables.style.HubSpotStyle;
4+
import org.immutables.value.Value;
5+
6+
@Value.Immutable
7+
@HubSpotStyle
8+
public interface EntityPayloadAttributesCustomFieldIF {
9+
String getKey();
10+
String getLabel();
11+
String getValue();
12+
String getType();
13+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package com.hubspot.slack.client.methods.params.chat.workobject.entity;
2+
3+
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
4+
import com.hubspot.immutables.style.HubSpotStyle;
5+
import com.hubspot.slack.client.methods.params.chat.workobject.serializers.DisplayTypeSerializer;
6+
import java.util.Optional;
7+
import org.immutables.value.Value;
8+
9+
@Value.Immutable
10+
@HubSpotStyle
11+
public interface EntityPayloadAttributesIF {
12+
String getTitle();
13+
Optional<String> getDisplayId();
14+
15+
@JsonSerialize(using = DisplayTypeSerializer.class)
16+
Optional<DisplayType> getDisplayType();
17+
18+
Optional<String> getProductName();
19+
Optional<ProductIcon> getProductIcon();
20+
Optional<String> getLocale();
21+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package com.hubspot.slack.client.methods.params.chat.workobject.entity;
2+
3+
import com.hubspot.immutables.style.HubSpotStyle;
4+
import com.hubspot.slack.client.methods.params.chat.workobject.entity.fields.EntityPayloadFields;
5+
import java.util.List;
6+
import org.immutables.value.Value;
7+
8+
@Value.Immutable
9+
@HubSpotStyle
10+
public interface EntityPayloadIF {
11+
EntityPayloadAttributes getAttributes();
12+
EntityPayloadFields getFields();
13+
List<EntityPayloadAttributesCustomField> getCustomFields();
14+
List<String> getDisplayOrder();
15+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package com.hubspot.slack.client.methods.params.chat.workobject.entity;
2+
3+
import com.hubspot.immutables.style.HubSpotStyle;
4+
import org.immutables.value.Value;
5+
6+
@Value.Immutable
7+
@HubSpotStyle
8+
public interface ProductIconIF {
9+
String getUrl();
10+
String getAltText();
11+
}

0 commit comments

Comments
 (0)