Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

@Value.Immutable
@HubSpotStyle
@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
public interface EntityPayloadAttributesCustomFieldIF {
String getKey();
Expand All @@ -27,28 +28,28 @@ public interface EntityPayloadAttributesCustomFieldIF {
FieldDataType getType();

//Can only be set when the type is string. This icon will be displayed next to field's text value. Not compatible with tag_color.
@JsonInclude(JsonInclude.Include.NON_EMPTY)
Optional<Icon> getIcon();

//Can only be set when the type is string, date, or timestamp. The field's content will be hyperlinked with the URL specified here
@JsonInclude(JsonInclude.Include.NON_EMPTY)
Optional<String> getLink();

//Can only be set when the type is string. Allows the string to be highlighted in of one of the following colors: red, yellow, green, gray, blue. E.g. tag_color: "red"
@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonSerialize(using = TagColorSerializer.class)
@JsonDeserialize(using = TagColorDeserializer.class)
Optional<TagColor> getTagColor();

//Can only be set when the type is string. Allows the string to be formatted in markdown. Incompatible with the icon or link properties. Set format: "markdown". Available values: "string", "markdown"
Optional<String> getFormat();

//Can only be set when the type is string. Expands the field across a wider area in the unfurl card. Set long: true.
Optional<Boolean> isLong();

//Used when the field's type is slack#/types/image.
@JsonInclude(JsonInclude.Include.NON_EMPTY)
Optional<String> getImageUrl();

//Used when the field's type is slack#/types/image.
@JsonInclude(JsonInclude.Include.NON_EMPTY)
Optional<String> getSlackFile();

//Used when the field's type is slack#/types/image.
@JsonInclude(JsonInclude.Include.NON_EMPTY)
Optional<String> getAltText();
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,9 @@

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.hubspot.immutables.style.HubSpotStyle;
import com.hubspot.slack.client.methods.params.chat.workobject.serializers.DisplayTypeDeserializer;
import com.hubspot.slack.client.methods.params.chat.workobject.serializers.DisplayTypeSerializer;
import com.hubspot.slack.client.methods.params.chat.workobject.entity.fullsizepreview.FullSizePreview;
import java.util.Optional;
import org.immutables.value.Value;

Expand All @@ -19,12 +16,9 @@ public interface EntityPayloadAttributesIF {
EntityPayloadAttributeTitle getTitle();
Optional<String> getDisplayId();

@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonSerialize(using = DisplayTypeSerializer.class)
@JsonDeserialize(using = DisplayTypeDeserializer.class)
Optional<DisplayType> getDisplayType();

Optional<String> getDisplayType();
Optional<String> getProductName();
Optional<Icon> getProductIcon();
Optional<String> getLocale();
Optional<FullSizePreview> getFullSizePreview();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.hubspot.slack.client.methods.params.chat.workobject.entity.fullsizepreview;

public enum FullSizePreviewErrorCode {
FILE_NOT_SUPPORTED("file_not_supported"),
FILE_SIZE_EXCEEDED("file_size_exceeded"),
CUSTOM("custom");

private final String value;

FullSizePreviewErrorCode(String value) {
this.value = value;
}

public String getValue() {
return value;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.hubspot.slack.client.methods.params.chat.workobject.entity.fullsizepreview;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.hubspot.immutables.style.HubSpotStyle;
import com.hubspot.slack.client.methods.params.chat.workobject.serializers.FullSizePreviewErrorCodeDeserializer;
import com.hubspot.slack.client.methods.params.chat.workobject.serializers.FullSizePreviewErrorCodeSerializer;
import org.immutables.value.Value.Immutable;

@Immutable
@HubSpotStyle
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public interface FullSizePreviewErrorIF {
@JsonSerialize(using = FullSizePreviewErrorCodeSerializer.class)
@JsonDeserialize(using = FullSizePreviewErrorCodeDeserializer.class)
FullSizePreviewErrorCode getCode();

String getMessage();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.hubspot.slack.client.methods.params.chat.workobject.entity.fullsizepreview;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import com.hubspot.immutables.style.HubSpotStyle;
import java.util.Optional;
import org.immutables.value.Value;

@Value.Immutable
@HubSpotStyle
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public interface FullSizePreviewIF {
boolean isSupported();

Optional<String> getPreviewUrl();

Optional<String> getMimeType();
Optional<FullSizePreviewError> getError();
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,31 @@
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.hubspot.slack.client.methods.params.chat.workobject.entity.DisplayType;
import com.hubspot.slack.client.methods.params.chat.workobject.entity.fullsizepreview.FullSizePreviewErrorCode;
import java.io.IOException;
import java.util.Arrays;
import java.util.Optional;

public class DisplayTypeDeserializer extends JsonDeserializer<Optional<DisplayType>> {
public class FullSizePreviewErrorCodeDeserializer
extends JsonDeserializer<Optional<FullSizePreviewErrorCode>> {

@Override
public Optional<DisplayType> deserialize(JsonParser p, DeserializationContext ctxt)
throws IOException {
public Optional<FullSizePreviewErrorCode> deserialize(
JsonParser p,
DeserializationContext ctxt
) throws IOException {
String value = p.getText();
if (value == null || value.isEmpty()) {
return Optional.empty();
}
return Arrays
.stream(DisplayType.values())
.stream(FullSizePreviewErrorCode.values())
.filter(type -> type.getValue().equals(value))
.findFirst();
}

@Override
public Optional<DisplayType> getNullValue(DeserializationContext ctxt) {
public Optional<FullSizePreviewErrorCode> getNullValue(DeserializationContext ctxt) {
return Optional.empty();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,31 @@
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.hubspot.slack.client.methods.params.chat.workobject.entity.DisplayType;
import com.hubspot.slack.client.methods.params.chat.workobject.entity.fullsizepreview.FullSizePreviewErrorCode;
import java.io.IOException;
import java.util.Optional;

public class DisplayTypeSerializer extends JsonSerializer<Optional<DisplayType>> {
public class FullSizePreviewErrorCodeSerializer
extends JsonSerializer<Optional<FullSizePreviewErrorCode>> {

@Override
public void serialize(
Optional<DisplayType> displayTypeMaybe,
Optional<FullSizePreviewErrorCode> errorCodeMaybe,
JsonGenerator gen,
SerializerProvider serializers
) throws IOException {
if (displayTypeMaybe.isPresent()) {
gen.writeString(displayTypeMaybe.get().getValue());
if (errorCodeMaybe.isPresent()) {
gen.writeString(errorCodeMaybe.get().getValue());
} else {
gen.writeNull();
}
}

@Override
public boolean isEmpty(SerializerProvider provider, Optional<DisplayType> value) {
public boolean isEmpty(
SerializerProvider provider,
Optional<FullSizePreviewErrorCode> value
) {
return value.isEmpty();
}
}