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
23 changes: 22 additions & 1 deletion Generator/JavaTypeWriters/JavaInterfaceWriter.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.CodeDom.Compiler;
using System.Reflection;
using Generator.Extensions;
using MessagePack;
using Newtonsoft.Json;

namespace Generator.JavaTypeWriters;
Expand Down Expand Up @@ -31,10 +32,30 @@ public void Write(IndentedTextWriter writer, Type type, string typeName)
deprecationComment
);

var attributes = System.Attribute.GetCustomAttributes(type);
if (attributes.Any(a => a is UnionAttribute))
{
writer.WriteLine("@JsonTypeInfo(");
writer.Indent++;
writer.WriteLine("use = JsonTypeInfo.Id.NAME,");
writer.WriteLine("include = JsonTypeInfo.As.EXISTING_PROPERTY,");
writer.WriteLine("property = \"$type\")");
writer.Indent--;
writer.WriteLine("@JsonSubTypes({");
writer.Indent++;
foreach (var attribute in attributes)
{
if (attribute is not UnionAttribute unionAttribute) continue;
writer.WriteLine($"@JsonSubTypes.Type(value = {javaWriter.TypeName(unionAttribute.SubType)}.class, name = \"{unionAttribute.SubType.FullName}, {unionAttribute.SubType.Assembly.FullName!.Split(",")[0]}\"),");
}
writer.Indent--;
writer.WriteLine("})");
}

writer.WriteLine($"public interface {typeName}");
writer.WriteLine("{");
writer.Indent++;
writer.Indent--;
writer.WriteLine("}");
}
}
}
2 changes: 1 addition & 1 deletion src/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>com.relewise.client</groupId>
<artifactId>relewise-sdk</artifactId>
<version>1.11.0</version>
<version>1.299.0</version>
<name>relewise-sdk</name>
<description>Relewise is a next generation personalization SaaS-platform, which offers functionality within product- and content recommendations and personalized search. This official SDK helps you interact with our API.</description>
<inceptionYear>2023</inceptionYear>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
@JsonIgnoreProperties(ignoreUnknown = true)
public class AbandonedCartTriggerResultTriggerResultResponse extends TimedResponse
{
public String $type = "Relewise.Client.Responses.Triggers.TriggerResultResponse`1[[Relewise.Client.Responses.Triggers.Results.AbandonedCartTriggerResult, Relewise.Client, Version=1.280.0.0, Culture=neutral, PublicKeyToken=null]], Relewise.Client";
public String $type = "Relewise.Client.Responses.Triggers.TriggerResultResponse`1[[Relewise.Client.Responses.Triggers.Results.AbandonedCartTriggerResult, Relewise.Client, Version=1.299.0.0, Culture=neutral, PublicKeyToken=null]], Relewise.Client";
public AbandonedCartTriggerResult result;
public static AbandonedCartTriggerResultTriggerResultResponse create()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
@JsonIgnoreProperties(ignoreUnknown = true)
public class AbandonedSearchTriggerResultTriggerResultResponse extends TimedResponse
{
public String $type = "Relewise.Client.Responses.Triggers.TriggerResultResponse`1[[Relewise.Client.Responses.Triggers.Results.AbandonedSearchTriggerResult, Relewise.Client, Version=1.280.0.0, Culture=neutral, PublicKeyToken=null]], Relewise.Client";
public String $type = "Relewise.Client.Responses.Triggers.TriggerResultResponse`1[[Relewise.Client.Responses.Triggers.Results.AbandonedSearchTriggerResult, Relewise.Client, Version=1.299.0.0, Culture=neutral, PublicKeyToken=null]], Relewise.Client";
public AbandonedSearchTriggerResult result;
public static AbandonedSearchTriggerResultTriggerResultResponse create()
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
package com.relewise.client.model;

import com.fasterxml.jackson.annotation.*;
import javax.annotation.Nullable;
import java.io.IOException;
import java.time.Duration;
import java.time.OffsetDateTime;
import java.time.LocalDateTime;
import java.util.Objects;
import java.util.Arrays;
import java.util.UUID;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Set;
import java.util.HashSet;

@JsonTypeInfo(
use = JsonTypeInfo.Id.NAME,
include = JsonTypeInfo.As.EXISTING_PROPERTY,
property = "$type")
@JsonSubTypes({
})
@JsonIgnoreProperties(ignoreUnknown = true)
public abstract class CommonMetadataValues
{
public String $type = "";
public OffsetDateTime created;
public String createdBy;
public OffsetDateTime modified;
public String modifiedBy;
public OffsetDateTime getCreated()
{
return this.created;
}
public String getCreatedBy()
{
return this.createdBy;
}
public OffsetDateTime getModified()
{
return this.modified;
}
public String getModifiedBy()
{
return this.modifiedBy;
}
public CommonMetadataValues setCreated(OffsetDateTime created)
{
this.created = created;
return this;
}
public CommonMetadataValues setCreatedBy(String createdBy)
{
this.createdBy = createdBy;
return this;
}
public CommonMetadataValues setModified(OffsetDateTime modified)
{
this.modified = modified;
return this;
}
public CommonMetadataValues setModifiedBy(String modifiedBy)
{
this.modifiedBy = modifiedBy;
return this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,49 +18,49 @@
@JsonIgnoreProperties(ignoreUnknown = true)
public class ConditionConfiguration
{
public UserConditionConfiguration user;
public InputConditionConfiguration input;
public TargetConditionConfiguration target;
public ContextConditionConfiguration context;
public @Nullable UserConditionConfiguration user;
public @Nullable InputConditionConfiguration input;
public @Nullable TargetConditionConfiguration target;
public @Nullable ContextConditionConfiguration context;
public static ConditionConfiguration create()
{
return new ConditionConfiguration();
}
public ConditionConfiguration()
{
}
public UserConditionConfiguration getUser()
public @Nullable UserConditionConfiguration getUser()
{
return this.user;
}
public InputConditionConfiguration getInput()
public @Nullable InputConditionConfiguration getInput()
{
return this.input;
}
public TargetConditionConfiguration getTarget()
public @Nullable TargetConditionConfiguration getTarget()
{
return this.target;
}
public ContextConditionConfiguration getContext()
public @Nullable ContextConditionConfiguration getContext()
{
return this.context;
}
public ConditionConfiguration setUser(UserConditionConfiguration user)
public ConditionConfiguration setUser(@Nullable UserConditionConfiguration user)
{
this.user = user;
return this;
}
public ConditionConfiguration setInput(InputConditionConfiguration input)
public ConditionConfiguration setInput(@Nullable InputConditionConfiguration input)
{
this.input = input;
return this;
}
public ConditionConfiguration setTarget(TargetConditionConfiguration target)
public ConditionConfiguration setTarget(@Nullable TargetConditionConfiguration target)
{
this.target = target;
return this;
}
public ConditionConfiguration setContext(ContextConditionConfiguration context)
public ConditionConfiguration setContext(@Nullable ContextConditionConfiguration context)
{
this.context = context;
return this;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
package com.relewise.client.model;

import com.fasterxml.jackson.annotation.*;
import javax.annotation.Nullable;
import java.io.IOException;
import java.time.Duration;
import java.time.OffsetDateTime;
import java.time.LocalDateTime;
import java.util.Objects;
import java.util.Arrays;
import java.util.UUID;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Set;
import java.util.HashSet;

/** Produces content by scoring overlap between seeded content data values and candidate content data values. Use this feed source to show content with similar attributes, such as color or tags, as the seed, for example, on a content page. */
@JsonTypeInfo(
use = JsonTypeInfo.Id.NAME,
include = JsonTypeInfo.As.EXISTING_PROPERTY,
property = "$type",
defaultImpl = ContentByOverlappingDataValuesWithContentSeedFeedSource.class)
@JsonIgnoreProperties(ignoreUnknown = true)
public class ContentByOverlappingDataValuesWithContentSeedFeedSource extends EntityBySeedFeedSource implements IContentFeedSource
{
public String $type = "Relewise.Client.DataTypes.Feed.Sources.ContentByOverlappingDataValuesWithContentSeedFeedSource, Relewise.Client";
/** The content data keys whose values should be compared between the feed seed and each candidate. */
public FeedEntityDataKey[] contentDataKeys;
/** Limits how deep into the popularity-ordered content collection the producer scans before building its queue. */
public Integer contentPopularityThreshold;
public static ContentByOverlappingDataValuesWithContentSeedFeedSource create(FeedSourceSelectionPolicy selectionPolicy, Integer maxSeedItems, FeedEntityDataKey[] contentDataKeys, Integer contentPopularityThreshold, Integer randomizationWindow)
{
return new ContentByOverlappingDataValuesWithContentSeedFeedSource(selectionPolicy, maxSeedItems, contentDataKeys, contentPopularityThreshold, randomizationWindow);
}
public ContentByOverlappingDataValuesWithContentSeedFeedSource(FeedSourceSelectionPolicy selectionPolicy, Integer maxSeedItems, FeedEntityDataKey[] contentDataKeys, Integer contentPopularityThreshold, Integer randomizationWindow)
{
this.selectionPolicy = selectionPolicy;
this.maxSeedItems = maxSeedItems;
this.contentDataKeys = contentDataKeys;
this.contentPopularityThreshold = contentPopularityThreshold;
this.randomizationWindow = randomizationWindow;
}
public ContentByOverlappingDataValuesWithContentSeedFeedSource()
{
}
/** The content data keys whose values should be compared between the feed seed and each candidate. */
public FeedEntityDataKey[] getContentDataKeys()
{
return this.contentDataKeys;
}
/** Limits how deep into the popularity-ordered content collection the producer scans before building its queue. */
public Integer getContentPopularityThreshold()
{
return this.contentPopularityThreshold;
}
/** The content data keys whose values should be compared between the feed seed and each candidate. */
public ContentByOverlappingDataValuesWithContentSeedFeedSource setContentDataKeys(FeedEntityDataKey... contentDataKeys)
{
this.contentDataKeys = contentDataKeys;
return this;
}
/** The content data keys whose values should be compared between the feed seed and each candidate. */
public ContentByOverlappingDataValuesWithContentSeedFeedSource addToContentDataKeys(FeedEntityDataKey contentDataKey)
{
if (this.contentDataKeys == null)
{
this.contentDataKeys = new FeedEntityDataKey[] { contentDataKey };
}
else
{
ArrayList<FeedEntityDataKey> existingList = new ArrayList<>(Arrays.asList(this.contentDataKeys));
existingList.add(contentDataKey);
this.contentDataKeys = existingList.toArray(new FeedEntityDataKey[0]);
}
return this;
}
/** Limits how deep into the popularity-ordered content collection the producer scans before building its queue. */
public ContentByOverlappingDataValuesWithContentSeedFeedSource setContentPopularityThreshold(Integer contentPopularityThreshold)
{
this.contentPopularityThreshold = contentPopularityThreshold;
return this;
}
@Override
public ContentByOverlappingDataValuesWithContentSeedFeedSource setMaxSeedItems(Integer maxSeedItems)
{
this.maxSeedItems = maxSeedItems;
return this;
}
@Override
public ContentByOverlappingDataValuesWithContentSeedFeedSource setRandomizationWindow(Integer randomizationWindow)
{
this.randomizationWindow = randomizationWindow;
return this;
}
@Override
public ContentByOverlappingDataValuesWithContentSeedFeedSource setEnabled(Boolean enabled)
{
this.enabled = enabled;
return this;
}
@Override
public ContentByOverlappingDataValuesWithContentSeedFeedSource setSelectionPolicy(FeedSourceSelectionPolicy selectionPolicy)
{
this.selectionPolicy = selectionPolicy;
return this;
}
@Override
public ContentByOverlappingDataValuesWithContentSeedFeedSource setMaxResults(@Nullable Integer maxResults)
{
this.maxResults = maxResults;
return this;
}
@Override
public ContentByOverlappingDataValuesWithContentSeedFeedSource setMaxResultsPerChanceGiven(@Nullable Integer maxResultsPerChanceGiven)
{
this.maxResultsPerChanceGiven = maxResultsPerChanceGiven;
return this;
}
}
Loading
Loading