diff --git a/Generator/JavaTypeWriters/JavaInterfaceWriter.cs b/Generator/JavaTypeWriters/JavaInterfaceWriter.cs index 57e8972..d1c93f0 100644 --- a/Generator/JavaTypeWriters/JavaInterfaceWriter.cs +++ b/Generator/JavaTypeWriters/JavaInterfaceWriter.cs @@ -1,6 +1,7 @@ using System.CodeDom.Compiler; using System.Reflection; using Generator.Extensions; +using MessagePack; using Newtonsoft.Json; namespace Generator.JavaTypeWriters; @@ -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("}"); } -} \ No newline at end of file +} diff --git a/src/pom.xml b/src/pom.xml index c215fe0..621511b 100644 --- a/src/pom.xml +++ b/src/pom.xml @@ -5,7 +5,7 @@ com.relewise.client relewise-sdk - 1.11.0 + 1.299.0 relewise-sdk 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. 2023 diff --git a/src/src/main/java/com/relewise/client/model/AbandonedCartTriggerResultTriggerResultResponse.java b/src/src/main/java/com/relewise/client/model/AbandonedCartTriggerResultTriggerResultResponse.java index 2d4e968..1550a49 100644 --- a/src/src/main/java/com/relewise/client/model/AbandonedCartTriggerResultTriggerResultResponse.java +++ b/src/src/main/java/com/relewise/client/model/AbandonedCartTriggerResultTriggerResultResponse.java @@ -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() { diff --git a/src/src/main/java/com/relewise/client/model/AbandonedSearchTriggerResultTriggerResultResponse.java b/src/src/main/java/com/relewise/client/model/AbandonedSearchTriggerResultTriggerResultResponse.java index 317ad93..d4b00cd 100644 --- a/src/src/main/java/com/relewise/client/model/AbandonedSearchTriggerResultTriggerResultResponse.java +++ b/src/src/main/java/com/relewise/client/model/AbandonedSearchTriggerResultTriggerResultResponse.java @@ -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() { diff --git a/src/src/main/java/com/relewise/client/model/CommonMetadataValues.java b/src/src/main/java/com/relewise/client/model/CommonMetadataValues.java new file mode 100644 index 0000000..d35158e --- /dev/null +++ b/src/src/main/java/com/relewise/client/model/CommonMetadataValues.java @@ -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; + } +} diff --git a/src/src/main/java/com/relewise/client/model/ConditionConfiguration.java b/src/src/main/java/com/relewise/client/model/ConditionConfiguration.java index b3a2cda..e8d9545 100644 --- a/src/src/main/java/com/relewise/client/model/ConditionConfiguration.java +++ b/src/src/main/java/com/relewise/client/model/ConditionConfiguration.java @@ -18,10 +18,10 @@ @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(); @@ -29,38 +29,38 @@ public static ConditionConfiguration create() 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; diff --git a/src/src/main/java/com/relewise/client/model/ContentByOverlappingDataValuesWithContentSeedFeedSource.java b/src/src/main/java/com/relewise/client/model/ContentByOverlappingDataValuesWithContentSeedFeedSource.java new file mode 100644 index 0000000..6a40890 --- /dev/null +++ b/src/src/main/java/com/relewise/client/model/ContentByOverlappingDataValuesWithContentSeedFeedSource.java @@ -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 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; + } +} diff --git a/src/src/main/java/com/relewise/client/model/ContentByPopularityFeedSource.java b/src/src/main/java/com/relewise/client/model/ContentByPopularityFeedSource.java new file mode 100644 index 0000000..ed86c5f --- /dev/null +++ b/src/src/main/java/com/relewise/client/model/ContentByPopularityFeedSource.java @@ -0,0 +1,91 @@ +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 most popular content for the configured time window. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.EXISTING_PROPERTY, + property = "$type", + defaultImpl = ContentByPopularityFeedSource.class) +@JsonIgnoreProperties(ignoreUnknown = true) +public class ContentByPopularityFeedSource extends FeedSource implements IContentFeedSource +{ + public String $type = "Relewise.Client.DataTypes.Feed.Sources.ContentByPopularityFeedSource, Relewise.Client"; + /** The time window in minutes used when reading the popularity source. */ + public Integer popularityWindowMinutes; + /** Controls how much local randomization is applied after ranking by popularity. Randomization makes every impression of the feed unique by slightly changing the order of items which rank close to each other. */ + public Integer randomizationWindow; + public static ContentByPopularityFeedSource create(FeedSourceSelectionPolicy selectionPolicy, Integer popularityWindowMinutes, Integer randomizationWindow) + { + return new ContentByPopularityFeedSource(selectionPolicy, popularityWindowMinutes, randomizationWindow); + } + public ContentByPopularityFeedSource(FeedSourceSelectionPolicy selectionPolicy, Integer popularityWindowMinutes, Integer randomizationWindow) + { + this.selectionPolicy = selectionPolicy; + this.popularityWindowMinutes = popularityWindowMinutes; + this.randomizationWindow = randomizationWindow; + } + public ContentByPopularityFeedSource() + { + } + /** The time window in minutes used when reading the popularity source. */ + public Integer getPopularityWindowMinutes() + { + return this.popularityWindowMinutes; + } + /** Controls how much local randomization is applied after ranking by popularity. Randomization makes every impression of the feed unique by slightly changing the order of items which rank close to each other. */ + public Integer getRandomizationWindow() + { + return this.randomizationWindow; + } + /** The time window in minutes used when reading the popularity source. */ + public ContentByPopularityFeedSource setPopularityWindowMinutes(Integer popularityWindowMinutes) + { + this.popularityWindowMinutes = popularityWindowMinutes; + return this; + } + /** Controls how much local randomization is applied after ranking by popularity. Randomization makes every impression of the feed unique by slightly changing the order of items which rank close to each other. */ + public ContentByPopularityFeedSource setRandomizationWindow(Integer randomizationWindow) + { + this.randomizationWindow = randomizationWindow; + return this; + } + @Override + public ContentByPopularityFeedSource setEnabled(Boolean enabled) + { + this.enabled = enabled; + return this; + } + @Override + public ContentByPopularityFeedSource setSelectionPolicy(FeedSourceSelectionPolicy selectionPolicy) + { + this.selectionPolicy = selectionPolicy; + return this; + } + @Override + public ContentByPopularityFeedSource setMaxResults(@Nullable Integer maxResults) + { + this.maxResults = maxResults; + return this; + } + @Override + public ContentByPopularityFeedSource setMaxResultsPerChanceGiven(@Nullable Integer maxResultsPerChanceGiven) + { + this.maxResultsPerChanceGiven = maxResultsPerChanceGiven; + return this; + } +} diff --git a/src/src/main/java/com/relewise/client/model/ContentByProductPopularityOfProductIdFromContentDataFeedSource.java b/src/src/main/java/com/relewise/client/model/ContentByProductPopularityOfProductIdFromContentDataFeedSource.java new file mode 100644 index 0000000..9b0f192 --- /dev/null +++ b/src/src/main/java/com/relewise/client/model/ContentByProductPopularityOfProductIdFromContentDataFeedSource.java @@ -0,0 +1,161 @@ +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 product popularity for products referenced by product ids on the content items. Use this feed source to create a dynamic personalized feed that shows content related to popular products and products with which the user has recently interacted. To use this content source, content items must contain ids of the related products (for example, products featured in a video) in data key referenced by ContentDataKey. The output will be ranked by popularity of the referenced products, combined with the user's recent interaction with the products in the feed. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.EXISTING_PROPERTY, + property = "$type", + defaultImpl = ContentByProductPopularityOfProductIdFromContentDataFeedSource.class) +@JsonIgnoreProperties(ignoreUnknown = true) +public class ContentByProductPopularityOfProductIdFromContentDataFeedSource extends FeedSource implements IContentFeedSource +{ + public String $type = "Relewise.Client.DataTypes.Feed.Sources.ContentByProductPopularityOfProductIdFromContentDataFeedSource, Relewise.Client"; + /** The content data key that contains related product ids. */ + public String contentDataKey; + /** The popularity window in minutes used for the referenced product ids. */ + public Integer productPopularityWindowMinutes; + /** The popularity dimension used when scoring referenced product ids, such as most viewed vs. most purchased. */ + public PopularityTypes productPopularityDimension; + /** Aggregation strategy used when combining popularity scores. */ + public ProductPopularityScoreAggregation aggregation; + /** Defines how many most-popular content items are considered for the feed. */ + public Integer contentPopularityThreshold; + /** Defines how many product ids are read from each content item. */ + public Integer maxProductIdsPerContent; + /** Controls how much local randomization is applied after ranking by referenced product popularity. */ + public Integer randomizationWindow; + public static ContentByProductPopularityOfProductIdFromContentDataFeedSource create(FeedSourceSelectionPolicy selectionPolicy, String contentDataKey, Integer productPopularityWindowMinutes, PopularityTypes productPopularityDimension, ProductPopularityScoreAggregation aggregation, Integer contentPopularityThreshold, Integer maxProductIdsPerContent, Integer randomizationWindow) + { + return new ContentByProductPopularityOfProductIdFromContentDataFeedSource(selectionPolicy, contentDataKey, productPopularityWindowMinutes, productPopularityDimension, aggregation, contentPopularityThreshold, maxProductIdsPerContent, randomizationWindow); + } + public ContentByProductPopularityOfProductIdFromContentDataFeedSource(FeedSourceSelectionPolicy selectionPolicy, String contentDataKey, Integer productPopularityWindowMinutes, PopularityTypes productPopularityDimension, ProductPopularityScoreAggregation aggregation, Integer contentPopularityThreshold, Integer maxProductIdsPerContent, Integer randomizationWindow) + { + this.selectionPolicy = selectionPolicy; + this.contentDataKey = contentDataKey; + this.productPopularityWindowMinutes = productPopularityWindowMinutes; + this.productPopularityDimension = productPopularityDimension; + this.aggregation = aggregation; + this.contentPopularityThreshold = contentPopularityThreshold; + this.maxProductIdsPerContent = maxProductIdsPerContent; + this.randomizationWindow = randomizationWindow; + } + public ContentByProductPopularityOfProductIdFromContentDataFeedSource() + { + } + /** The content data key that contains related product ids. */ + public String getContentDataKey() + { + return this.contentDataKey; + } + /** The popularity window in minutes used for the referenced product ids. */ + public Integer getProductPopularityWindowMinutes() + { + return this.productPopularityWindowMinutes; + } + /** The popularity dimension used when scoring referenced product ids, such as most viewed vs. most purchased. */ + public PopularityTypes getProductPopularityDimension() + { + return this.productPopularityDimension; + } + /** Aggregation strategy used when combining popularity scores. */ + public ProductPopularityScoreAggregation getAggregation() + { + return this.aggregation; + } + /** Defines how many most-popular content items are considered for the feed. */ + public Integer getContentPopularityThreshold() + { + return this.contentPopularityThreshold; + } + /** Defines how many product ids are read from each content item. */ + public Integer getMaxProductIdsPerContent() + { + return this.maxProductIdsPerContent; + } + /** Controls how much local randomization is applied after ranking by referenced product popularity. */ + public Integer getRandomizationWindow() + { + return this.randomizationWindow; + } + /** The content data key that contains related product ids. */ + public ContentByProductPopularityOfProductIdFromContentDataFeedSource setContentDataKey(String contentDataKey) + { + this.contentDataKey = contentDataKey; + return this; + } + /** The popularity window in minutes used for the referenced product ids. */ + public ContentByProductPopularityOfProductIdFromContentDataFeedSource setProductPopularityWindowMinutes(Integer productPopularityWindowMinutes) + { + this.productPopularityWindowMinutes = productPopularityWindowMinutes; + return this; + } + /** The popularity dimension used when scoring referenced product ids, such as most viewed vs. most purchased. */ + public ContentByProductPopularityOfProductIdFromContentDataFeedSource setProductPopularityDimension(PopularityTypes productPopularityDimension) + { + this.productPopularityDimension = productPopularityDimension; + return this; + } + /** Aggregation strategy used when combining popularity scores. */ + public ContentByProductPopularityOfProductIdFromContentDataFeedSource setAggregation(ProductPopularityScoreAggregation aggregation) + { + this.aggregation = aggregation; + return this; + } + /** Defines how many most-popular content items are considered for the feed. */ + public ContentByProductPopularityOfProductIdFromContentDataFeedSource setContentPopularityThreshold(Integer contentPopularityThreshold) + { + this.contentPopularityThreshold = contentPopularityThreshold; + return this; + } + /** Defines how many product ids are read from each content item. */ + public ContentByProductPopularityOfProductIdFromContentDataFeedSource setMaxProductIdsPerContent(Integer maxProductIdsPerContent) + { + this.maxProductIdsPerContent = maxProductIdsPerContent; + return this; + } + /** Controls how much local randomization is applied after ranking by referenced product popularity. */ + public ContentByProductPopularityOfProductIdFromContentDataFeedSource setRandomizationWindow(Integer randomizationWindow) + { + this.randomizationWindow = randomizationWindow; + return this; + } + @Override + public ContentByProductPopularityOfProductIdFromContentDataFeedSource setEnabled(Boolean enabled) + { + this.enabled = enabled; + return this; + } + @Override + public ContentByProductPopularityOfProductIdFromContentDataFeedSource setSelectionPolicy(FeedSourceSelectionPolicy selectionPolicy) + { + this.selectionPolicy = selectionPolicy; + return this; + } + @Override + public ContentByProductPopularityOfProductIdFromContentDataFeedSource setMaxResults(@Nullable Integer maxResults) + { + this.maxResults = maxResults; + return this; + } + @Override + public ContentByProductPopularityOfProductIdFromContentDataFeedSource setMaxResultsPerChanceGiven(@Nullable Integer maxResultsPerChanceGiven) + { + this.maxResultsPerChanceGiven = maxResultsPerChanceGiven; + return this; + } +} diff --git a/src/src/main/java/com/relewise/client/model/ContentCategoryInterestTriggerResultTriggerResultResponse.java b/src/src/main/java/com/relewise/client/model/ContentCategoryInterestTriggerResultTriggerResultResponse.java index 0f68ac5..f8f7600 100644 --- a/src/src/main/java/com/relewise/client/model/ContentCategoryInterestTriggerResultTriggerResultResponse.java +++ b/src/src/main/java/com/relewise/client/model/ContentCategoryInterestTriggerResultTriggerResultResponse.java @@ -23,7 +23,7 @@ @JsonIgnoreProperties(ignoreUnknown = true) public class ContentCategoryInterestTriggerResultTriggerResultResponse extends TimedResponse { - public String $type = "Relewise.Client.Responses.Triggers.TriggerResultResponse`1[[Relewise.Client.Responses.Triggers.Results.ContentCategoryInterestTriggerResult, 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.ContentCategoryInterestTriggerResult, Relewise.Client, Version=1.299.0.0, Culture=neutral, PublicKeyToken=null]], Relewise.Client"; public ContentCategoryInterestTriggerResult result; public static ContentCategoryInterestTriggerResultTriggerResultResponse create() { diff --git a/src/src/main/java/com/relewise/client/model/ContentsViewedAfterContentSeedFeedSource.java b/src/src/main/java/com/relewise/client/model/ContentsViewedAfterContentSeedFeedSource.java new file mode 100644 index 0000000..7f37d2a --- /dev/null +++ b/src/src/main/java/com/relewise/client/model/ContentsViewedAfterContentSeedFeedSource.java @@ -0,0 +1,77 @@ +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 that is commonly viewed after the content configured by ContentIds. Use this feed source to show related content items in feeds on content pages. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.EXISTING_PROPERTY, + property = "$type", + defaultImpl = ContentsViewedAfterContentSeedFeedSource.class) +@JsonIgnoreProperties(ignoreUnknown = true) +public class ContentsViewedAfterContentSeedFeedSource extends EntityBySeedFeedSource implements IContentFeedSource +{ + public String $type = "Relewise.Client.DataTypes.Feed.Sources.ContentsViewedAfterContentSeedFeedSource, Relewise.Client"; + public static ContentsViewedAfterContentSeedFeedSource create(FeedSourceSelectionPolicy selectionPolicy, Integer maxSeedItems, Integer randomizationWindow) + { + return new ContentsViewedAfterContentSeedFeedSource(selectionPolicy, maxSeedItems, randomizationWindow); + } + public ContentsViewedAfterContentSeedFeedSource(FeedSourceSelectionPolicy selectionPolicy, Integer maxSeedItems, Integer randomizationWindow) + { + this.selectionPolicy = selectionPolicy; + this.maxSeedItems = maxSeedItems; + this.randomizationWindow = randomizationWindow; + } + public ContentsViewedAfterContentSeedFeedSource() + { + } + @Override + public ContentsViewedAfterContentSeedFeedSource setMaxSeedItems(Integer maxSeedItems) + { + this.maxSeedItems = maxSeedItems; + return this; + } + @Override + public ContentsViewedAfterContentSeedFeedSource setRandomizationWindow(Integer randomizationWindow) + { + this.randomizationWindow = randomizationWindow; + return this; + } + @Override + public ContentsViewedAfterContentSeedFeedSource setEnabled(Boolean enabled) + { + this.enabled = enabled; + return this; + } + @Override + public ContentsViewedAfterContentSeedFeedSource setSelectionPolicy(FeedSourceSelectionPolicy selectionPolicy) + { + this.selectionPolicy = selectionPolicy; + return this; + } + @Override + public ContentsViewedAfterContentSeedFeedSource setMaxResults(@Nullable Integer maxResults) + { + this.maxResults = maxResults; + return this; + } + @Override + public ContentsViewedAfterContentSeedFeedSource setMaxResultsPerChanceGiven(@Nullable Integer maxResultsPerChanceGiven) + { + this.maxResultsPerChanceGiven = maxResultsPerChanceGiven; + return this; + } +} diff --git a/src/src/main/java/com/relewise/client/model/ContentsViewedAfterProductSeedFeedSource.java b/src/src/main/java/com/relewise/client/model/ContentsViewedAfterProductSeedFeedSource.java new file mode 100644 index 0000000..696bf3a --- /dev/null +++ b/src/src/main/java/com/relewise/client/model/ContentsViewedAfterProductSeedFeedSource.java @@ -0,0 +1,77 @@ +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 that is commonly viewed after the products configured by ProductAndVariantIds. Use this feed source to show related content items in feeds on product pages, cart pages or power steps. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.EXISTING_PROPERTY, + property = "$type", + defaultImpl = ContentsViewedAfterProductSeedFeedSource.class) +@JsonIgnoreProperties(ignoreUnknown = true) +public class ContentsViewedAfterProductSeedFeedSource extends EntityBySeedFeedSource implements IContentFeedSource +{ + public String $type = "Relewise.Client.DataTypes.Feed.Sources.ContentsViewedAfterProductSeedFeedSource, Relewise.Client"; + public static ContentsViewedAfterProductSeedFeedSource create(FeedSourceSelectionPolicy selectionPolicy, Integer maxSeedItems, Integer randomizationWindow) + { + return new ContentsViewedAfterProductSeedFeedSource(selectionPolicy, maxSeedItems, randomizationWindow); + } + public ContentsViewedAfterProductSeedFeedSource(FeedSourceSelectionPolicy selectionPolicy, Integer maxSeedItems, Integer randomizationWindow) + { + this.selectionPolicy = selectionPolicy; + this.maxSeedItems = maxSeedItems; + this.randomizationWindow = randomizationWindow; + } + public ContentsViewedAfterProductSeedFeedSource() + { + } + @Override + public ContentsViewedAfterProductSeedFeedSource setMaxSeedItems(Integer maxSeedItems) + { + this.maxSeedItems = maxSeedItems; + return this; + } + @Override + public ContentsViewedAfterProductSeedFeedSource setRandomizationWindow(Integer randomizationWindow) + { + this.randomizationWindow = randomizationWindow; + return this; + } + @Override + public ContentsViewedAfterProductSeedFeedSource setEnabled(Boolean enabled) + { + this.enabled = enabled; + return this; + } + @Override + public ContentsViewedAfterProductSeedFeedSource setSelectionPolicy(FeedSourceSelectionPolicy selectionPolicy) + { + this.selectionPolicy = selectionPolicy; + return this; + } + @Override + public ContentsViewedAfterProductSeedFeedSource setMaxResults(@Nullable Integer maxResults) + { + this.maxResults = maxResults; + return this; + } + @Override + public ContentsViewedAfterProductSeedFeedSource setMaxResultsPerChanceGiven(@Nullable Integer maxResultsPerChanceGiven) + { + this.maxResultsPerChanceGiven = maxResultsPerChanceGiven; + return this; + } +} diff --git a/src/src/main/java/com/relewise/client/model/DeleteFeedConfigurationRequest.java b/src/src/main/java/com/relewise/client/model/DeleteFeedConfigurationRequest.java new file mode 100644 index 0000000..1532d82 --- /dev/null +++ b/src/src/main/java/com/relewise/client/model/DeleteFeedConfigurationRequest.java @@ -0,0 +1,66 @@ +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; + +/** Deletes a stored feed configuration. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.EXISTING_PROPERTY, + property = "$type", + defaultImpl = DeleteFeedConfigurationRequest.class) +@JsonIgnoreProperties(ignoreUnknown = true) +public class DeleteFeedConfigurationRequest extends LicensedRequest +{ + public String $type = "Relewise.Client.Requests.Recommendations.Feed.DeleteFeedConfigurationRequest, Relewise.Client"; + /** The identifier of the configuration to delete. */ + public UUID configurationId; + /** The user or system that deleted the configuration. */ + public String deletedBy; + public static DeleteFeedConfigurationRequest create(UUID configurationId, String deletedBy) + { + return new DeleteFeedConfigurationRequest(configurationId, deletedBy); + } + public DeleteFeedConfigurationRequest(UUID configurationId, String deletedBy) + { + this.configurationId = configurationId; + this.deletedBy = deletedBy; + } + public DeleteFeedConfigurationRequest() + { + } + /** The identifier of the configuration to delete. */ + public UUID getConfigurationId() + { + return this.configurationId; + } + /** The user or system that deleted the configuration. */ + public String getDeletedBy() + { + return this.deletedBy; + } + /** The identifier of the configuration to delete. */ + public DeleteFeedConfigurationRequest setConfigurationId(UUID configurationId) + { + this.configurationId = configurationId; + return this; + } + /** The user or system that deleted the configuration. */ + public DeleteFeedConfigurationRequest setDeletedBy(String deletedBy) + { + this.deletedBy = deletedBy; + return this; + } +} diff --git a/src/src/main/java/com/relewise/client/model/EntityBySeedFeedSource.java b/src/src/main/java/com/relewise/client/model/EntityBySeedFeedSource.java new file mode 100644 index 0000000..eef4375 --- /dev/null +++ b/src/src/main/java/com/relewise/client/model/EntityBySeedFeedSource.java @@ -0,0 +1,79 @@ +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; + +/** Base class for feed sources that use input from Seed. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.EXISTING_PROPERTY, + property = "$type") +@JsonSubTypes({ +}) +@JsonIgnoreProperties(ignoreUnknown = true) +public abstract class EntityBySeedFeedSource extends FeedSource +{ + public String $type = ""; + /** Limits how many seed items are considered when building the result queue. */ + public Integer maxSeedItems; + /** Controls how much local randomization is applied to the result queue. */ + public Integer randomizationWindow; + /** Limits how many seed items are considered when building the result queue. */ + public Integer getMaxSeedItems() + { + return this.maxSeedItems; + } + /** Controls how much local randomization is applied to the result queue. */ + public Integer getRandomizationWindow() + { + return this.randomizationWindow; + } + /** Limits how many seed items are considered when building the result queue. */ + public EntityBySeedFeedSource setMaxSeedItems(Integer maxSeedItems) + { + this.maxSeedItems = maxSeedItems; + return this; + } + /** Controls how much local randomization is applied to the result queue. */ + public EntityBySeedFeedSource setRandomizationWindow(Integer randomizationWindow) + { + this.randomizationWindow = randomizationWindow; + return this; + } + @Override + public EntityBySeedFeedSource setEnabled(Boolean enabled) + { + this.enabled = enabled; + return this; + } + @Override + public EntityBySeedFeedSource setSelectionPolicy(FeedSourceSelectionPolicy selectionPolicy) + { + this.selectionPolicy = selectionPolicy; + return this; + } + @Override + public EntityBySeedFeedSource setMaxResults(@Nullable Integer maxResults) + { + this.maxResults = maxResults; + return this; + } + @Override + public EntityBySeedFeedSource setMaxResultsPerChanceGiven(@Nullable Integer maxResultsPerChanceGiven) + { + this.maxResultsPerChanceGiven = maxResultsPerChanceGiven; + return this; + } +} diff --git a/src/src/main/java/com/relewise/client/model/Feed.java b/src/src/main/java/com/relewise/client/model/Feed.java index 9d23dd3..4d3e417 100644 --- a/src/src/main/java/com/relewise/client/model/Feed.java +++ b/src/src/main/java/com/relewise/client/model/Feed.java @@ -35,6 +35,8 @@ public class Feed public @Nullable Boolean recommendVariant; /** Defines if products should be excluded if they are currently present in the users Cart */ public @Nullable Boolean allowProductsCurrentlyInCart; + /** Selects the stored feed configuration to use when the feed is initialized. When omitted, the default feed configuration is used. */ + public @Nullable String configurationKey; /** * Initializes a new instance of the Feed class. * @param minimumPageSize The minimum number of items to return initially and per every @@ -100,6 +102,11 @@ public ArrayList getCompositions() { return this.allowProductsCurrentlyInCart; } + /** Selects the stored feed configuration to use when the feed is initialized. When omitted, the default feed configuration is used. */ + public @Nullable String getConfigurationKey() + { + return this.configurationKey; + } /** The minimum number of items to return initially and per every FeedRecommendationNextItemsRequest. A higher number of results may be returned if composition configurations dictate so. For example, if a given FeedComposition has a lower bound of 5, and the MinimumPageSize is set to 4, then the feed will return at least 5 items whenever the result contains any derived from that composition element. */ public Feed setMinimumPageSize(Integer minimumPageSize) { @@ -158,4 +165,10 @@ public Feed setAllowProductsCurrentlyInCart(@Nullable Boolean allowProductsCurre this.allowProductsCurrentlyInCart = allowProductsCurrentlyInCart; return this; } + /** Selects the stored feed configuration to use when the feed is initialized. When omitted, the default feed configuration is used. */ + public Feed setConfigurationKey(@Nullable String configurationKey) + { + this.configurationKey = configurationKey; + return this; + } } diff --git a/src/src/main/java/com/relewise/client/model/FeedConfiguration.java b/src/src/main/java/com/relewise/client/model/FeedConfiguration.java new file mode 100644 index 0000000..d45578c --- /dev/null +++ b/src/src/main/java/com/relewise/client/model/FeedConfiguration.java @@ -0,0 +1,118 @@ +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; + +/** Stores a feed configuration together with its metadata and configured feed sources. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.EXISTING_PROPERTY, + property = "$type", + defaultImpl = FeedConfiguration.class) +@JsonIgnoreProperties(ignoreUnknown = true) +public class FeedConfiguration extends FeedConfigurationEntityStateUUIDFeedConfigurationMetadataValuesConfigurationEntity +{ + public String $type = "Relewise.Client.DataTypes.Feed.FeedConfiguration, Relewise.Client"; + /** The display name for this configuration. */ + public String name; + /** The stable lookup key for this configuration. The key is the uppercase version of Name with whitespace replaced by underscores. For example, Feed Default becomes FEED_DEFAULT. */ + public @Nullable String key; + /** Indicates whether this configuration is the default configuration. */ + public Boolean isDefault; + /** The configured feed sources for this configuration. */ + public FeedSourceConfiguration sources; + public static FeedConfiguration create(@Nullable UUID id, String name) + { + return new FeedConfiguration(id, name); + } + public FeedConfiguration(@Nullable UUID id, String name) + { + this.id = id; + this.name = name; + } + public static FeedConfiguration create(String name) + { + return new FeedConfiguration(name); + } + public FeedConfiguration(String name) + { + this.name = name; + } + public FeedConfiguration() + { + } + /** The display name for this configuration. */ + public String getName() + { + return this.name; + } + /** The stable lookup key for this configuration. The key is the uppercase version of Name with whitespace replaced by underscores. For example, Feed Default becomes FEED_DEFAULT. */ + public @Nullable String getKey() + { + return this.key; + } + /** Indicates whether this configuration is the default configuration. */ + public Boolean getIsDefault() + { + return this.isDefault; + } + /** The configured feed sources for this configuration. */ + public FeedSourceConfiguration getSources() + { + return this.sources; + } + /** The display name for this configuration. */ + public FeedConfiguration setName(String name) + { + this.name = name; + return this; + } + /** The stable lookup key for this configuration. The key is the uppercase version of Name with whitespace replaced by underscores. For example, Feed Default becomes FEED_DEFAULT. */ + public FeedConfiguration setKey(@Nullable String key) + { + this.key = key; + return this; + } + /** Indicates whether this configuration is the default configuration. */ + public FeedConfiguration setIsDefault(Boolean isDefault) + { + this.isDefault = isDefault; + return this; + } + /** The configured feed sources for this configuration. */ + public FeedConfiguration setSources(FeedSourceConfiguration sources) + { + this.sources = sources; + return this; + } + @Override + public FeedConfiguration setState(FeedConfigurationEntityState state) + { + this.state = state; + return this; + } + @Override + public FeedConfiguration setMetadata(FeedConfigurationMetadataValues metadata) + { + this.metadata = metadata; + return this; + } + @Override + public FeedConfiguration setId(@Nullable UUID id) + { + this.id = id; + return this; + } +} diff --git a/src/src/main/java/com/relewise/client/model/FeedConfigurationEntityState.java b/src/src/main/java/com/relewise/client/model/FeedConfigurationEntityState.java new file mode 100644 index 0000000..c904802 --- /dev/null +++ b/src/src/main/java/com/relewise/client/model/FeedConfigurationEntityState.java @@ -0,0 +1,30 @@ +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; + +public enum FeedConfigurationEntityState +{ + Active { + public String toString() { + return "Active"; + } + }, + Inactive { + public String toString() { + return "Inactive"; + } + }, +} diff --git a/src/src/main/java/com/relewise/client/model/FeedConfigurationEntityStateUUIDFeedConfigurationMetadataValuesConfigurationEntity.java b/src/src/main/java/com/relewise/client/model/FeedConfigurationEntityStateUUIDFeedConfigurationMetadataValuesConfigurationEntity.java new file mode 100644 index 0000000..38e82dc --- /dev/null +++ b/src/src/main/java/com/relewise/client/model/FeedConfigurationEntityStateUUIDFeedConfigurationMetadataValuesConfigurationEntity.java @@ -0,0 +1,57 @@ +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 FeedConfigurationEntityStateUUIDFeedConfigurationMetadataValuesConfigurationEntity extends UUIDConfigurationEntity +{ + public String $type = ""; + public FeedConfigurationEntityState state; + /** Managed on the server side only, manually setting this will have no effect */ + public FeedConfigurationMetadataValues metadata; + public FeedConfigurationEntityState getState() + { + return this.state; + } + /** Managed on the server side only, manually setting this will have no effect */ + public FeedConfigurationMetadataValues getMetadata() + { + return this.metadata; + } + public FeedConfigurationEntityStateUUIDFeedConfigurationMetadataValuesConfigurationEntity setState(FeedConfigurationEntityState state) + { + this.state = state; + return this; + } + /** Managed on the server side only, manually setting this will have no effect */ + public FeedConfigurationEntityStateUUIDFeedConfigurationMetadataValuesConfigurationEntity setMetadata(FeedConfigurationMetadataValues metadata) + { + this.metadata = metadata; + return this; + } + @Override + public FeedConfigurationEntityStateUUIDFeedConfigurationMetadataValuesConfigurationEntity setId(@Nullable UUID id) + { + this.id = id; + return this; + } +} diff --git a/src/src/main/java/com/relewise/client/model/FeedConfigurationMetadataValues.java b/src/src/main/java/com/relewise/client/model/FeedConfigurationMetadataValues.java new file mode 100644 index 0000000..249c5ba --- /dev/null +++ b/src/src/main/java/com/relewise/client/model/FeedConfigurationMetadataValues.java @@ -0,0 +1,98 @@ +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", + defaultImpl = FeedConfigurationMetadataValues.class) +@JsonIgnoreProperties(ignoreUnknown = true) +public class FeedConfigurationMetadataValues extends CommonMetadataValues +{ + public String $type = "Relewise.Client.DataTypes.Feed.FeedConfiguration+MetadataValues, Relewise.Client"; + public @Nullable OffsetDateTime activated; + public @Nullable String activatedBy; + public @Nullable OffsetDateTime inactivated; + public @Nullable String inactivatedBy; + public static FeedConfigurationMetadataValues create() + { + return new FeedConfigurationMetadataValues(); + } + public FeedConfigurationMetadataValues() + { + } + public @Nullable OffsetDateTime getActivated() + { + return this.activated; + } + public @Nullable String getActivatedBy() + { + return this.activatedBy; + } + public @Nullable OffsetDateTime getInactivated() + { + return this.inactivated; + } + public @Nullable String getInactivatedBy() + { + return this.inactivatedBy; + } + public FeedConfigurationMetadataValues setActivated(@Nullable OffsetDateTime activated) + { + this.activated = activated; + return this; + } + public FeedConfigurationMetadataValues setActivatedBy(@Nullable String activatedBy) + { + this.activatedBy = activatedBy; + return this; + } + public FeedConfigurationMetadataValues setInactivated(@Nullable OffsetDateTime inactivated) + { + this.inactivated = inactivated; + return this; + } + public FeedConfigurationMetadataValues setInactivatedBy(@Nullable String inactivatedBy) + { + this.inactivatedBy = inactivatedBy; + return this; + } + @Override + public FeedConfigurationMetadataValues setCreated(OffsetDateTime created) + { + this.created = created; + return this; + } + @Override + public FeedConfigurationMetadataValues setCreatedBy(String createdBy) + { + this.createdBy = createdBy; + return this; + } + @Override + public FeedConfigurationMetadataValues setModified(OffsetDateTime modified) + { + this.modified = modified; + return this; + } + @Override + public FeedConfigurationMetadataValues setModifiedBy(String modifiedBy) + { + this.modifiedBy = modifiedBy; + return this; + } +} diff --git a/src/src/main/java/com/relewise/client/model/FeedConfigurationRequest.java b/src/src/main/java/com/relewise/client/model/FeedConfigurationRequest.java new file mode 100644 index 0000000..dbdc71a --- /dev/null +++ b/src/src/main/java/com/relewise/client/model/FeedConfigurationRequest.java @@ -0,0 +1,52 @@ +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; + +/** Loads a single stored feed configuration. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.EXISTING_PROPERTY, + property = "$type", + defaultImpl = FeedConfigurationRequest.class) +@JsonIgnoreProperties(ignoreUnknown = true) +public class FeedConfigurationRequest extends LicensedRequest +{ + public String $type = "Relewise.Client.Requests.Recommendations.Feed.FeedConfigurationRequest, Relewise.Client"; + /** The identifier of the configuration to load. */ + public UUID configurationId; + public static FeedConfigurationRequest create(UUID configurationId) + { + return new FeedConfigurationRequest(configurationId); + } + public FeedConfigurationRequest(UUID configurationId) + { + this.configurationId = configurationId; + } + public FeedConfigurationRequest() + { + } + /** The identifier of the configuration to load. */ + public UUID getConfigurationId() + { + return this.configurationId; + } + /** The identifier of the configuration to load. */ + public FeedConfigurationRequest setConfigurationId(UUID configurationId) + { + this.configurationId = configurationId; + return this; + } +} diff --git a/src/src/main/java/com/relewise/client/model/FeedConfigurationResponse.java b/src/src/main/java/com/relewise/client/model/FeedConfigurationResponse.java new file mode 100644 index 0000000..d1403a3 --- /dev/null +++ b/src/src/main/java/com/relewise/client/model/FeedConfigurationResponse.java @@ -0,0 +1,58 @@ +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; + +/** Response containing a single stored feed configuration. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.EXISTING_PROPERTY, + property = "$type", + defaultImpl = FeedConfigurationResponse.class) +@JsonIgnoreProperties(ignoreUnknown = true) +public class FeedConfigurationResponse extends TimedResponse +{ + public String $type = "Relewise.Client.Responses.Feed.FeedConfigurationResponse, Relewise.Client"; + /** The retrieved feed configuration. */ + public FeedConfiguration configuration; + public static FeedConfigurationResponse create(FeedConfiguration configuration) + { + return new FeedConfigurationResponse(configuration); + } + public FeedConfigurationResponse(FeedConfiguration configuration) + { + this.configuration = configuration; + } + public FeedConfigurationResponse() + { + } + /** The retrieved feed configuration. */ + public FeedConfiguration getConfiguration() + { + return this.configuration; + } + /** The retrieved feed configuration. */ + public FeedConfigurationResponse setConfiguration(FeedConfiguration configuration) + { + this.configuration = configuration; + return this; + } + @Override + public FeedConfigurationResponse setStatistics(Statistics statistics) + { + this.statistics = statistics; + return this; + } +} diff --git a/src/src/main/java/com/relewise/client/model/FeedConfigurationsRequest.java b/src/src/main/java/com/relewise/client/model/FeedConfigurationsRequest.java new file mode 100644 index 0000000..e6d6bd1 --- /dev/null +++ b/src/src/main/java/com/relewise/client/model/FeedConfigurationsRequest.java @@ -0,0 +1,35 @@ +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; + +/** Loads all stored feed configurations. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.EXISTING_PROPERTY, + property = "$type", + defaultImpl = FeedConfigurationsRequest.class) +@JsonIgnoreProperties(ignoreUnknown = true) +public class FeedConfigurationsRequest extends LicensedRequest +{ + public String $type = "Relewise.Client.Requests.Recommendations.Feed.FeedConfigurationsRequest, Relewise.Client"; + public static FeedConfigurationsRequest create() + { + return new FeedConfigurationsRequest(); + } + public FeedConfigurationsRequest() + { + } +} diff --git a/src/src/main/java/com/relewise/client/model/FeedConfigurationsResponse.java b/src/src/main/java/com/relewise/client/model/FeedConfigurationsResponse.java new file mode 100644 index 0000000..6db63b7 --- /dev/null +++ b/src/src/main/java/com/relewise/client/model/FeedConfigurationsResponse.java @@ -0,0 +1,73 @@ +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; + +/** Response containing all stored feed configurations. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.EXISTING_PROPERTY, + property = "$type", + defaultImpl = FeedConfigurationsResponse.class) +@JsonIgnoreProperties(ignoreUnknown = true) +public class FeedConfigurationsResponse extends TimedResponse +{ + public String $type = "Relewise.Client.Responses.Feed.FeedConfigurationsResponse, Relewise.Client"; + /** The stored feed configurations returned by the request. */ + public FeedConfiguration[] configurations; + public static FeedConfigurationsResponse create(FeedConfiguration... configurations) + { + return new FeedConfigurationsResponse(configurations); + } + public FeedConfigurationsResponse(FeedConfiguration... configurations) + { + this.configurations = configurations; + } + public FeedConfigurationsResponse() + { + } + /** The stored feed configurations returned by the request. */ + public FeedConfiguration[] getConfigurations() + { + return this.configurations; + } + /** The stored feed configurations returned by the request. */ + public FeedConfigurationsResponse setConfigurations(FeedConfiguration... configurations) + { + this.configurations = configurations; + return this; + } + /** The stored feed configurations returned by the request. */ + public FeedConfigurationsResponse addToConfigurations(FeedConfiguration configuration) + { + if (this.configurations == null) + { + this.configurations = new FeedConfiguration[] { configuration }; + } + else + { + ArrayList existingList = new ArrayList<>(Arrays.asList(this.configurations)); + existingList.add(configuration); + this.configurations = existingList.toArray(new FeedConfiguration[0]); + } + return this; + } + @Override + public FeedConfigurationsResponse setStatistics(Statistics statistics) + { + this.statistics = statistics; + return this; + } +} diff --git a/src/src/main/java/com/relewise/client/model/FeedEntityDataKey.java b/src/src/main/java/com/relewise/client/model/FeedEntityDataKey.java new file mode 100644 index 0000000..429b19f --- /dev/null +++ b/src/src/main/java/com/relewise/client/model/FeedEntityDataKey.java @@ -0,0 +1,102 @@ +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; + +/** Describes one entity data key used when scoring overlap against seeded content. */ +@JsonIgnoreProperties(ignoreUnknown = true) +public class FeedEntityDataKey +{ + /** The name of the entity data key whose values should be used when determining overlaps. */ + public String key; + /** The relative importance of overlaps on this key when scoring content. */ + public Float weight; + /** Indicates whether content must overlap on this key to qualify as a valid result. */ + public Boolean required; + /** Limits how many seed collection values are considered for this key. */ + public Integer seedDataCollectionsLimit; + /** Limits how many candidate collection values are considered for this key. */ + public Integer candidateDataCollectionsLimit; + public static FeedEntityDataKey create(String key, Float weight, Integer seedDataCollectionsLimit, Integer candidateDataCollectionsLimit, Boolean required) + { + return new FeedEntityDataKey(key, weight, seedDataCollectionsLimit, candidateDataCollectionsLimit, required); + } + public FeedEntityDataKey(String key, Float weight, Integer seedDataCollectionsLimit, Integer candidateDataCollectionsLimit, Boolean required) + { + this.key = key; + this.weight = weight; + this.seedDataCollectionsLimit = seedDataCollectionsLimit; + this.candidateDataCollectionsLimit = candidateDataCollectionsLimit; + this.required = required; + } + public FeedEntityDataKey() + { + } + /** The name of the entity data key whose values should be used when determining overlaps. */ + public String getKey() + { + return this.key; + } + /** The relative importance of overlaps on this key when scoring content. */ + public Float getWeight() + { + return this.weight; + } + /** Indicates whether content must overlap on this key to qualify as a valid result. */ + public Boolean getRequired() + { + return this.required; + } + /** Limits how many seed collection values are considered for this key. */ + public Integer getSeedDataCollectionsLimit() + { + return this.seedDataCollectionsLimit; + } + /** Limits how many candidate collection values are considered for this key. */ + public Integer getCandidateDataCollectionsLimit() + { + return this.candidateDataCollectionsLimit; + } + /** The name of the entity data key whose values should be used when determining overlaps. */ + public FeedEntityDataKey setKey(String key) + { + this.key = key; + return this; + } + /** The relative importance of overlaps on this key when scoring content. */ + public FeedEntityDataKey setWeight(Float weight) + { + this.weight = weight; + return this; + } + /** Indicates whether content must overlap on this key to qualify as a valid result. */ + public FeedEntityDataKey setRequired(Boolean required) + { + this.required = required; + return this; + } + /** Limits how many seed collection values are considered for this key. */ + public FeedEntityDataKey setSeedDataCollectionsLimit(Integer seedDataCollectionsLimit) + { + this.seedDataCollectionsLimit = seedDataCollectionsLimit; + return this; + } + /** Limits how many candidate collection values are considered for this key. */ + public FeedEntityDataKey setCandidateDataCollectionsLimit(Integer candidateDataCollectionsLimit) + { + this.candidateDataCollectionsLimit = candidateDataCollectionsLimit; + return this; + } +} diff --git a/src/src/main/java/com/relewise/client/model/FeedSource.java b/src/src/main/java/com/relewise/client/model/FeedSource.java new file mode 100644 index 0000000..d134f5f --- /dev/null +++ b/src/src/main/java/com/relewise/client/model/FeedSource.java @@ -0,0 +1,81 @@ +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; + +/** Base settings for a feed source, including enablement, selection policy, and per-source result limits. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.EXISTING_PROPERTY, + property = "$type") +@JsonSubTypes({ +}) +@JsonIgnoreProperties(ignoreUnknown = true) +public abstract class FeedSource +{ + public String $type = ""; + /** Indicates whether this feed source is active. */ + public Boolean enabled; + /** Determines how this feed source is prioritized and how ties are broken. */ + public FeedSourceSelectionPolicy selectionPolicy; + /** Limits the total number of items this feed source may return. */ + public @Nullable Integer maxResults; + /** Limits the number of items this feed source may return per chance given. */ + public @Nullable Integer maxResultsPerChanceGiven; + /** Indicates whether this feed source is active. */ + public Boolean getEnabled() + { + return this.enabled; + } + /** Determines how this feed source is prioritized and how ties are broken. */ + public FeedSourceSelectionPolicy getSelectionPolicy() + { + return this.selectionPolicy; + } + /** Limits the total number of items this feed source may return. */ + public @Nullable Integer getMaxResults() + { + return this.maxResults; + } + /** Limits the number of items this feed source may return per chance given. */ + public @Nullable Integer getMaxResultsPerChanceGiven() + { + return this.maxResultsPerChanceGiven; + } + /** Indicates whether this feed source is active. */ + public FeedSource setEnabled(Boolean enabled) + { + this.enabled = enabled; + return this; + } + /** Determines how this feed source is prioritized and how ties are broken. */ + public FeedSource setSelectionPolicy(FeedSourceSelectionPolicy selectionPolicy) + { + this.selectionPolicy = selectionPolicy; + return this; + } + /** Limits the total number of items this feed source may return. */ + public FeedSource setMaxResults(@Nullable Integer maxResults) + { + this.maxResults = maxResults; + return this; + } + /** Limits the number of items this feed source may return per chance given. */ + public FeedSource setMaxResultsPerChanceGiven(@Nullable Integer maxResultsPerChanceGiven) + { + this.maxResultsPerChanceGiven = maxResultsPerChanceGiven; + return this; + } +} diff --git a/src/src/main/java/com/relewise/client/model/FeedSourceConfiguration.java b/src/src/main/java/com/relewise/client/model/FeedSourceConfiguration.java new file mode 100644 index 0000000..659737e --- /dev/null +++ b/src/src/main/java/com/relewise/client/model/FeedSourceConfiguration.java @@ -0,0 +1,75 @@ +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; + +/** Configuration for feed sources, which determine the content and products that appear in feeds. This includes enablement, selection policies, and result limits for each source. */ +@JsonIgnoreProperties(ignoreUnknown = true) +public class FeedSourceConfiguration +{ + /** Feed sources that produce product results. */ + public ArrayList products; + /** Feed sources that produce content results. */ + public ArrayList content; + public static FeedSourceConfiguration create() + { + return new FeedSourceConfiguration(); + } + public FeedSourceConfiguration() + { + } + /** Feed sources that produce product results. */ + public ArrayList getProducts() + { + return this.products; + } + /** Feed sources that produce content results. */ + public ArrayList getContent() + { + return this.content; + } + /** Feed sources that produce product results. */ + public FeedSourceConfiguration setProducts(IProductFeedSource... products) + { + this.products = new ArrayList<>(Arrays.asList(products));; + return this; + } + /** Feed sources that produce product results. */ + public FeedSourceConfiguration addToProducts(IProductFeedSource products) + { + if (this.products == null) + { + this.products = new ArrayList<>(); + } + this.products.add(products); + return this; + } + /** Feed sources that produce content results. */ + public FeedSourceConfiguration setContent(IContentFeedSource... content) + { + this.content = new ArrayList<>(Arrays.asList(content));; + return this; + } + /** Feed sources that produce content results. */ + public FeedSourceConfiguration addToContent(IContentFeedSource content) + { + if (this.content == null) + { + this.content = new ArrayList<>(); + } + this.content.add(content); + return this; + } +} diff --git a/src/src/main/java/com/relewise/client/model/FeedSourceSelectionPolicy.java b/src/src/main/java/com/relewise/client/model/FeedSourceSelectionPolicy.java new file mode 100644 index 0000000..b04ddf0 --- /dev/null +++ b/src/src/main/java/com/relewise/client/model/FeedSourceSelectionPolicy.java @@ -0,0 +1,60 @@ +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; + +/** Determines how a feed source is prioritized and how ties are broken. */ +@JsonIgnoreProperties(ignoreUnknown = true) +public class FeedSourceSelectionPolicy +{ + /** The selection order where lower values are chosen first. */ + public Integer priority; + /** Relative weight for choosing between feed sources with the same priority. */ + public Float tieBreakerProbability; + public static FeedSourceSelectionPolicy create(Integer priority, Float tieBreakerProbability) + { + return new FeedSourceSelectionPolicy(priority, tieBreakerProbability); + } + public FeedSourceSelectionPolicy(Integer priority, Float tieBreakerProbability) + { + this.priority = priority; + this.tieBreakerProbability = tieBreakerProbability; + } + public FeedSourceSelectionPolicy() + { + } + /** The selection order where lower values are chosen first. */ + public Integer getPriority() + { + return this.priority; + } + /** Relative weight for choosing between feed sources with the same priority. */ + public Float getTieBreakerProbability() + { + return this.tieBreakerProbability; + } + /** The selection order where lower values are chosen first. */ + public FeedSourceSelectionPolicy setPriority(Integer priority) + { + this.priority = priority; + return this; + } + /** Relative weight for choosing between feed sources with the same priority. */ + public FeedSourceSelectionPolicy setTieBreakerProbability(Float tieBreakerProbability) + { + this.tieBreakerProbability = tieBreakerProbability; + return this; + } +} diff --git a/src/src/main/java/com/relewise/client/model/IChange.java b/src/src/main/java/com/relewise/client/model/IChange.java index 59d2fbd..583351f 100644 --- a/src/src/main/java/com/relewise/client/model/IChange.java +++ b/src/src/main/java/com/relewise/client/model/IChange.java @@ -15,6 +15,15 @@ import java.util.Set; import java.util.HashSet; +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.EXISTING_PROPERTY, + property = "$type") +@JsonSubTypes({ + @JsonSubTypes.Type(value = Change.class, name = "Relewise.Client.DataTypes.Changes.Change, Relewise.Client"), + @JsonSubTypes.Type(value = Decrease.class, name = "Relewise.Client.DataTypes.Changes.Decrease, Relewise.Client"), + @JsonSubTypes.Type(value = Increase.class, name = "Relewise.Client.DataTypes.Changes.Increase, Relewise.Client"), +}) public interface IChange { } diff --git a/src/src/main/java/com/relewise/client/model/IContentFeedSource.java b/src/src/main/java/com/relewise/client/model/IContentFeedSource.java new file mode 100644 index 0000000..4cc95fc --- /dev/null +++ b/src/src/main/java/com/relewise/client/model/IContentFeedSource.java @@ -0,0 +1,32 @@ +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; + +/** Marks feed source for content. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.EXISTING_PROPERTY, + property = "$type") +@JsonSubTypes({ + @JsonSubTypes.Type(value = ContentByPopularityFeedSource.class, name = "Relewise.Client.DataTypes.Feed.Sources.ContentByPopularityFeedSource, Relewise.Client"), + @JsonSubTypes.Type(value = ContentByProductPopularityOfProductIdFromContentDataFeedSource.class, name = "Relewise.Client.DataTypes.Feed.Sources.ContentByProductPopularityOfProductIdFromContentDataFeedSource, Relewise.Client"), + @JsonSubTypes.Type(value = ContentsViewedAfterProductSeedFeedSource.class, name = "Relewise.Client.DataTypes.Feed.Sources.ContentsViewedAfterProductSeedFeedSource, Relewise.Client"), + @JsonSubTypes.Type(value = ContentsViewedAfterContentSeedFeedSource.class, name = "Relewise.Client.DataTypes.Feed.Sources.ContentsViewedAfterContentSeedFeedSource, Relewise.Client"), + @JsonSubTypes.Type(value = ContentByOverlappingDataValuesWithContentSeedFeedSource.class, name = "Relewise.Client.DataTypes.Feed.Sources.ContentByOverlappingDataValuesWithContentSeedFeedSource, Relewise.Client"), +}) +public interface IContentFeedSource +{ +} diff --git a/src/src/main/java/com/relewise/client/model/IProductFeedSource.java b/src/src/main/java/com/relewise/client/model/IProductFeedSource.java new file mode 100644 index 0000000..0b021db --- /dev/null +++ b/src/src/main/java/com/relewise/client/model/IProductFeedSource.java @@ -0,0 +1,33 @@ +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; + +/** Marks feed source for products. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.EXISTING_PROPERTY, + property = "$type") +@JsonSubTypes({ + @JsonSubTypes.Type(value = ProductByPurchasePopularityFeedSource.class, name = "Relewise.Client.DataTypes.Feed.Sources.ProductByPurchasePopularityFeedSource, Relewise.Client"), + @JsonSubTypes.Type(value = ProductByViewPopularityFeedSource.class, name = "Relewise.Client.DataTypes.Feed.Sources.ProductByViewPopularityFeedSource, Relewise.Client"), + @JsonSubTypes.Type(value = ProductByProductIdFromContentDataFeedSource.class, name = "Relewise.Client.DataTypes.Feed.Sources.ProductByProductIdFromContentDataFeedSource, Relewise.Client"), + @JsonSubTypes.Type(value = ProductsViewedAfterProductSeedFeedSource.class, name = "Relewise.Client.DataTypes.Feed.Sources.ProductsViewedAfterProductSeedFeedSource, Relewise.Client"), + @JsonSubTypes.Type(value = ProductsPurchasedWithProductSeedFeedSource.class, name = "Relewise.Client.DataTypes.Feed.Sources.ProductsPurchasedWithProductSeedFeedSource, Relewise.Client"), + @JsonSubTypes.Type(value = ProductsViewedAfterContentSeedFeedSource.class, name = "Relewise.Client.DataTypes.Feed.Sources.ProductsViewedAfterContentSeedFeedSource, Relewise.Client"), +}) +public interface IProductFeedSource +{ +} diff --git a/src/src/main/java/com/relewise/client/model/ISchedule.java b/src/src/main/java/com/relewise/client/model/ISchedule.java index ff827c9..b795a03 100644 --- a/src/src/main/java/com/relewise/client/model/ISchedule.java +++ b/src/src/main/java/com/relewise/client/model/ISchedule.java @@ -15,6 +15,13 @@ import java.util.Set; import java.util.HashSet; +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.EXISTING_PROPERTY, + property = "$type") +@JsonSubTypes({ + @JsonSubTypes.Type(value = ScheduledPeriod.class, name = "Relewise.Client.DataTypes.Scheduling.ScheduledPeriod, Relewise.Client"), +}) public interface ISchedule { } diff --git a/src/src/main/java/com/relewise/client/model/ITriggerResult.java b/src/src/main/java/com/relewise/client/model/ITriggerResult.java index 4c517bc..590644e 100644 --- a/src/src/main/java/com/relewise/client/model/ITriggerResult.java +++ b/src/src/main/java/com/relewise/client/model/ITriggerResult.java @@ -15,6 +15,20 @@ import java.util.Set; import java.util.HashSet; +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.EXISTING_PROPERTY, + property = "$type") +@JsonSubTypes({ + @JsonSubTypes.Type(value = ProductCategoryInterestTriggerResult.class, name = "Relewise.Client.Responses.Triggers.Results.ProductCategoryInterestTriggerResult, Relewise.Client"), + @JsonSubTypes.Type(value = ProductInterestTriggerResult.class, name = "Relewise.Client.Responses.Triggers.Results.ProductInterestTriggerResult, Relewise.Client"), + @JsonSubTypes.Type(value = AbandonedCartTriggerResult.class, name = "Relewise.Client.Responses.Triggers.Results.AbandonedCartTriggerResult, Relewise.Client"), + @JsonSubTypes.Type(value = UserActivityTriggerResult.class, name = "Relewise.Client.Responses.Triggers.Results.UserActivityTriggerResult, Relewise.Client"), + @JsonSubTypes.Type(value = ContentCategoryInterestTriggerResult.class, name = "Relewise.Client.Responses.Triggers.Results.ContentCategoryInterestTriggerResult, Relewise.Client"), + @JsonSubTypes.Type(value = AbandonedSearchTriggerResult.class, name = "Relewise.Client.Responses.Triggers.Results.AbandonedSearchTriggerResult, Relewise.Client"), + @JsonSubTypes.Type(value = ProductChangeTriggerResult.class, name = "Relewise.Client.Responses.Triggers.Results.ProductChangeTriggerResult, Relewise.Client"), + @JsonSubTypes.Type(value = VariantChangeTriggerResult.class, name = "Relewise.Client.Responses.Triggers.Results.VariantChangeTriggerResult, Relewise.Client"), +}) public interface ITriggerResult { } diff --git a/src/src/main/java/com/relewise/client/model/IVariantFilter.java b/src/src/main/java/com/relewise/client/model/IVariantFilter.java index 445702e..95e9caa 100644 --- a/src/src/main/java/com/relewise/client/model/IVariantFilter.java +++ b/src/src/main/java/com/relewise/client/model/IVariantFilter.java @@ -16,6 +16,21 @@ import java.util.HashSet; /** a Filter that can be used to define which variants to include for products in queries. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.EXISTING_PROPERTY, + property = "$type") +@JsonSubTypes({ + @JsonSubTypes.Type(value = VariantIdFilter.class, name = "Relewise.Client.Requests.Filters.VariantIdFilter, Relewise.Client"), + @JsonSubTypes.Type(value = VariantSpecificationFilter.class, name = "Relewise.Client.Requests.Filters.VariantSpecificationFilter, Relewise.Client"), + @JsonSubTypes.Type(value = VariantAssortmentFilter.class, name = "Relewise.Client.Requests.Filters.VariantAssortmentFilter, Relewise.Client"), + @JsonSubTypes.Type(value = VariantDataFilter.class, name = "Relewise.Client.Requests.Filters.VariantDataFilter, Relewise.Client"), + @JsonSubTypes.Type(value = VariantListPriceFilter.class, name = "Relewise.Client.Requests.Filters.VariantListPriceFilter, Relewise.Client"), + @JsonSubTypes.Type(value = VariantSalesPriceFilter.class, name = "Relewise.Client.Requests.Filters.VariantSalesPriceFilter, Relewise.Client"), + @JsonSubTypes.Type(value = OrFilter.class, name = "Relewise.Client.Requests.Filters.OrFilter, Relewise.Client"), + @JsonSubTypes.Type(value = AndFilter.class, name = "Relewise.Client.Requests.Filters.AndFilter, Relewise.Client"), + @JsonSubTypes.Type(value = VariantEngagementFilter.class, name = "Relewise.Client.Requests.Filters.VariantEngagementFilter, Relewise.Client"), +}) public interface IVariantFilter { } diff --git a/src/src/main/java/com/relewise/client/model/OverriddenProductRecommendationRequestSettings.java b/src/src/main/java/com/relewise/client/model/OverriddenProductRecommendationRequestSettings.java index abb258b..2b93eac 100644 --- a/src/src/main/java/com/relewise/client/model/OverriddenProductRecommendationRequestSettings.java +++ b/src/src/main/java/com/relewise/client/model/OverriddenProductRecommendationRequestSettings.java @@ -15,12 +15,14 @@ import java.util.Set; import java.util.HashSet; +/** Partial overrides that can be merged into an existing ProductRecommendationRequestSettings instance. */ @JsonIgnoreProperties(ignoreUnknown = true) public class OverriddenProductRecommendationRequestSettings { public @Nullable Integer numberOfRecommendations; public @Nullable Boolean allowFillIfNecessaryToReachNumberOfRecommendations; public @Nullable Boolean allowReplacingOfRecentlyShownRecommendations; + /** @deprecated Use VariantRequestSettings.MaxVariantsPerProduct instead. */ public @Nullable Boolean recommendVariant; public OverriddenSelectedProductPropertiesSettings selectedProductProperties; public OverriddenSelectedVariantPropertiesSettings selectedVariantProperties; @@ -28,6 +30,8 @@ public class OverriddenProductRecommendationRequestSettings public @Nullable Boolean allowProductsCurrentlyInCart; public OverriddenSelectedBrandPropertiesSettings selectedBrandProperties; public @Nullable Integer prioritizeResultsNotRecommendedWithinSeconds; + /** Overrides variant-inclusion behavior for product recommendation requests. Use this to replace the effective VariantRequestSettings for the overridden request. MaxVariantsPerProduct. */ + public @Nullable VariantRecommendationRequestSettings variantRequestSettings; public static OverriddenProductRecommendationRequestSettings create() { return new OverriddenProductRecommendationRequestSettings(); @@ -47,6 +51,7 @@ public OverriddenProductRecommendationRequestSettings() { return this.allowReplacingOfRecentlyShownRecommendations; } + /** @deprecated Use VariantRequestSettings.MaxVariantsPerProduct instead. */ public @Nullable Boolean getRecommendVariant() { return this.recommendVariant; @@ -75,6 +80,11 @@ public OverriddenSelectedBrandPropertiesSettings getSelectedBrandProperties() { return this.prioritizeResultsNotRecommendedWithinSeconds; } + /** Overrides variant-inclusion behavior for product recommendation requests. Use this to replace the effective VariantRequestSettings for the overridden request. MaxVariantsPerProduct. */ + public @Nullable VariantRecommendationRequestSettings getVariantRequestSettings() + { + return this.variantRequestSettings; + } public OverriddenProductRecommendationRequestSettings setNumberOfRecommendations(@Nullable Integer numberOfRecommendations) { this.numberOfRecommendations = numberOfRecommendations; @@ -90,6 +100,7 @@ public OverriddenProductRecommendationRequestSettings setAllowReplacingOfRecentl this.allowReplacingOfRecentlyShownRecommendations = allowReplacingOfRecentlyShownRecommendations; return this; } + /** @deprecated Use VariantRequestSettings.MaxVariantsPerProduct instead. */ public OverriddenProductRecommendationRequestSettings setRecommendVariant(@Nullable Boolean recommendVariant) { this.recommendVariant = recommendVariant; @@ -125,4 +136,10 @@ public OverriddenProductRecommendationRequestSettings setPrioritizeResultsNotRec this.prioritizeResultsNotRecommendedWithinSeconds = prioritizeResultsNotRecommendedWithinSeconds; return this; } + /** Overrides variant-inclusion behavior for product recommendation requests. Use this to replace the effective VariantRequestSettings for the overridden request. MaxVariantsPerProduct. */ + public OverriddenProductRecommendationRequestSettings setVariantRequestSettings(@Nullable VariantRecommendationRequestSettings variantRequestSettings) + { + this.variantRequestSettings = variantRequestSettings; + return this; + } } diff --git a/src/src/main/java/com/relewise/client/model/ProductByPopularityFeedSource.java b/src/src/main/java/com/relewise/client/model/ProductByPopularityFeedSource.java new file mode 100644 index 0000000..ccd5b3b --- /dev/null +++ b/src/src/main/java/com/relewise/client/model/ProductByPopularityFeedSource.java @@ -0,0 +1,79 @@ +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; + +/** Base settings for product popularity feed sources. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.EXISTING_PROPERTY, + property = "$type") +@JsonSubTypes({ +}) +@JsonIgnoreProperties(ignoreUnknown = true) +public abstract class ProductByPopularityFeedSource extends FeedSource +{ + public String $type = ""; + /** The time window in minutes used to calculate the popularity score. */ + public Integer popularityWindowMinutes; + /** Controls how much local randomization is applied after ranking by popularity. */ + public Integer randomizationWindow; + /** The time window in minutes used to calculate the popularity score. */ + public Integer getPopularityWindowMinutes() + { + return this.popularityWindowMinutes; + } + /** Controls how much local randomization is applied after ranking by popularity. */ + public Integer getRandomizationWindow() + { + return this.randomizationWindow; + } + /** The time window in minutes used to calculate the popularity score. */ + public ProductByPopularityFeedSource setPopularityWindowMinutes(Integer popularityWindowMinutes) + { + this.popularityWindowMinutes = popularityWindowMinutes; + return this; + } + /** Controls how much local randomization is applied after ranking by popularity. */ + public ProductByPopularityFeedSource setRandomizationWindow(Integer randomizationWindow) + { + this.randomizationWindow = randomizationWindow; + return this; + } + @Override + public ProductByPopularityFeedSource setEnabled(Boolean enabled) + { + this.enabled = enabled; + return this; + } + @Override + public ProductByPopularityFeedSource setSelectionPolicy(FeedSourceSelectionPolicy selectionPolicy) + { + this.selectionPolicy = selectionPolicy; + return this; + } + @Override + public ProductByPopularityFeedSource setMaxResults(@Nullable Integer maxResults) + { + this.maxResults = maxResults; + return this; + } + @Override + public ProductByPopularityFeedSource setMaxResultsPerChanceGiven(@Nullable Integer maxResultsPerChanceGiven) + { + this.maxResultsPerChanceGiven = maxResultsPerChanceGiven; + return this; + } +} diff --git a/src/src/main/java/com/relewise/client/model/ProductByProductIdFromContentDataFeedSource.java b/src/src/main/java/com/relewise/client/model/ProductByProductIdFromContentDataFeedSource.java new file mode 100644 index 0000000..2297986 --- /dev/null +++ b/src/src/main/java/com/relewise/client/model/ProductByProductIdFromContentDataFeedSource.java @@ -0,0 +1,119 @@ +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; + +/** Shows products referenced by content items that were recently shown in the feed, when combined with a feed source that shows content. Use this feed source to inject related products into a feed of content items such as short promotional videos. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.EXISTING_PROPERTY, + property = "$type", + defaultImpl = ProductByProductIdFromContentDataFeedSource.class) +@JsonIgnoreProperties(ignoreUnknown = true) +public class ProductByProductIdFromContentDataFeedSource extends FeedSource implements IProductFeedSource +{ + public String $type = "Relewise.Client.DataTypes.Feed.Sources.ProductByProductIdFromContentDataFeedSource, Relewise.Client"; + /** The content data key that contains product ids. */ + public String contentDataKey; + /** Defines proximity between a previously shown content and a newly produced product items in the feed. Lower value will place product items in closer proximity to the content items that reference them. */ + public Integer maxLookBehindDistance; + /** Defines how many content items to consider and produce product items from, before moving to the next feed source. Lower value focuses on fewer and more recent content items to retrieve products from. See also MaxResultsPerChanceGiven as a way to define how many products to show each time. */ + public Integer maxLookBehindCount; + /** Controls how much randomization is applied to the output. */ + public Integer randomizationWindow; + public static ProductByProductIdFromContentDataFeedSource create(FeedSourceSelectionPolicy selectionPolicy, String contentDataKey, Integer maxLookBehindDistance, Integer maxLookBehindCount, Integer randomizationWindow) + { + return new ProductByProductIdFromContentDataFeedSource(selectionPolicy, contentDataKey, maxLookBehindDistance, maxLookBehindCount, randomizationWindow); + } + public ProductByProductIdFromContentDataFeedSource(FeedSourceSelectionPolicy selectionPolicy, String contentDataKey, Integer maxLookBehindDistance, Integer maxLookBehindCount, Integer randomizationWindow) + { + this.selectionPolicy = selectionPolicy; + this.contentDataKey = contentDataKey; + this.maxLookBehindDistance = maxLookBehindDistance; + this.maxLookBehindCount = maxLookBehindCount; + this.randomizationWindow = randomizationWindow; + } + public ProductByProductIdFromContentDataFeedSource() + { + } + /** The content data key that contains product ids. */ + public String getContentDataKey() + { + return this.contentDataKey; + } + /** Defines proximity between a previously shown content and a newly produced product items in the feed. Lower value will place product items in closer proximity to the content items that reference them. */ + public Integer getMaxLookBehindDistance() + { + return this.maxLookBehindDistance; + } + /** Defines how many content items to consider and produce product items from, before moving to the next feed source. Lower value focuses on fewer and more recent content items to retrieve products from. See also MaxResultsPerChanceGiven as a way to define how many products to show each time. */ + public Integer getMaxLookBehindCount() + { + return this.maxLookBehindCount; + } + /** Controls how much randomization is applied to the output. */ + public Integer getRandomizationWindow() + { + return this.randomizationWindow; + } + /** The content data key that contains product ids. */ + public ProductByProductIdFromContentDataFeedSource setContentDataKey(String contentDataKey) + { + this.contentDataKey = contentDataKey; + return this; + } + /** Defines proximity between a previously shown content and a newly produced product items in the feed. Lower value will place product items in closer proximity to the content items that reference them. */ + public ProductByProductIdFromContentDataFeedSource setMaxLookBehindDistance(Integer maxLookBehindDistance) + { + this.maxLookBehindDistance = maxLookBehindDistance; + return this; + } + /** Defines how many content items to consider and produce product items from, before moving to the next feed source. Lower value focuses on fewer and more recent content items to retrieve products from. See also MaxResultsPerChanceGiven as a way to define how many products to show each time. */ + public ProductByProductIdFromContentDataFeedSource setMaxLookBehindCount(Integer maxLookBehindCount) + { + this.maxLookBehindCount = maxLookBehindCount; + return this; + } + /** Controls how much randomization is applied to the output. */ + public ProductByProductIdFromContentDataFeedSource setRandomizationWindow(Integer randomizationWindow) + { + this.randomizationWindow = randomizationWindow; + return this; + } + @Override + public ProductByProductIdFromContentDataFeedSource setEnabled(Boolean enabled) + { + this.enabled = enabled; + return this; + } + @Override + public ProductByProductIdFromContentDataFeedSource setSelectionPolicy(FeedSourceSelectionPolicy selectionPolicy) + { + this.selectionPolicy = selectionPolicy; + return this; + } + @Override + public ProductByProductIdFromContentDataFeedSource setMaxResults(@Nullable Integer maxResults) + { + this.maxResults = maxResults; + return this; + } + @Override + public ProductByProductIdFromContentDataFeedSource setMaxResultsPerChanceGiven(@Nullable Integer maxResultsPerChanceGiven) + { + this.maxResultsPerChanceGiven = maxResultsPerChanceGiven; + return this; + } +} diff --git a/src/src/main/java/com/relewise/client/model/ProductByPurchasePopularityFeedSource.java b/src/src/main/java/com/relewise/client/model/ProductByPurchasePopularityFeedSource.java new file mode 100644 index 0000000..6b6e2b7 --- /dev/null +++ b/src/src/main/java/com/relewise/client/model/ProductByPurchasePopularityFeedSource.java @@ -0,0 +1,77 @@ +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 a feed of most purchased products for the configured time window. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.EXISTING_PROPERTY, + property = "$type", + defaultImpl = ProductByPurchasePopularityFeedSource.class) +@JsonIgnoreProperties(ignoreUnknown = true) +public class ProductByPurchasePopularityFeedSource extends ProductByPopularityFeedSource implements IProductFeedSource +{ + public String $type = "Relewise.Client.DataTypes.Feed.Sources.ProductByPurchasePopularityFeedSource, Relewise.Client"; + public static ProductByPurchasePopularityFeedSource create(FeedSourceSelectionPolicy selectionPolicy, Integer popularityWindowMinutes, Integer randomizationWindow) + { + return new ProductByPurchasePopularityFeedSource(selectionPolicy, popularityWindowMinutes, randomizationWindow); + } + public ProductByPurchasePopularityFeedSource(FeedSourceSelectionPolicy selectionPolicy, Integer popularityWindowMinutes, Integer randomizationWindow) + { + this.selectionPolicy = selectionPolicy; + this.popularityWindowMinutes = popularityWindowMinutes; + this.randomizationWindow = randomizationWindow; + } + public ProductByPurchasePopularityFeedSource() + { + } + @Override + public ProductByPurchasePopularityFeedSource setPopularityWindowMinutes(Integer popularityWindowMinutes) + { + this.popularityWindowMinutes = popularityWindowMinutes; + return this; + } + @Override + public ProductByPurchasePopularityFeedSource setRandomizationWindow(Integer randomizationWindow) + { + this.randomizationWindow = randomizationWindow; + return this; + } + @Override + public ProductByPurchasePopularityFeedSource setEnabled(Boolean enabled) + { + this.enabled = enabled; + return this; + } + @Override + public ProductByPurchasePopularityFeedSource setSelectionPolicy(FeedSourceSelectionPolicy selectionPolicy) + { + this.selectionPolicy = selectionPolicy; + return this; + } + @Override + public ProductByPurchasePopularityFeedSource setMaxResults(@Nullable Integer maxResults) + { + this.maxResults = maxResults; + return this; + } + @Override + public ProductByPurchasePopularityFeedSource setMaxResultsPerChanceGiven(@Nullable Integer maxResultsPerChanceGiven) + { + this.maxResultsPerChanceGiven = maxResultsPerChanceGiven; + return this; + } +} diff --git a/src/src/main/java/com/relewise/client/model/ProductByViewPopularityFeedSource.java b/src/src/main/java/com/relewise/client/model/ProductByViewPopularityFeedSource.java new file mode 100644 index 0000000..f864dd1 --- /dev/null +++ b/src/src/main/java/com/relewise/client/model/ProductByViewPopularityFeedSource.java @@ -0,0 +1,77 @@ +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 a feed of most viewed products for the configured time window. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.EXISTING_PROPERTY, + property = "$type", + defaultImpl = ProductByViewPopularityFeedSource.class) +@JsonIgnoreProperties(ignoreUnknown = true) +public class ProductByViewPopularityFeedSource extends ProductByPopularityFeedSource implements IProductFeedSource +{ + public String $type = "Relewise.Client.DataTypes.Feed.Sources.ProductByViewPopularityFeedSource, Relewise.Client"; + public static ProductByViewPopularityFeedSource create(FeedSourceSelectionPolicy selectionPolicy, Integer popularityWindowMinutes, Integer randomizationWindow) + { + return new ProductByViewPopularityFeedSource(selectionPolicy, popularityWindowMinutes, randomizationWindow); + } + public ProductByViewPopularityFeedSource(FeedSourceSelectionPolicy selectionPolicy, Integer popularityWindowMinutes, Integer randomizationWindow) + { + this.selectionPolicy = selectionPolicy; + this.popularityWindowMinutes = popularityWindowMinutes; + this.randomizationWindow = randomizationWindow; + } + public ProductByViewPopularityFeedSource() + { + } + @Override + public ProductByViewPopularityFeedSource setPopularityWindowMinutes(Integer popularityWindowMinutes) + { + this.popularityWindowMinutes = popularityWindowMinutes; + return this; + } + @Override + public ProductByViewPopularityFeedSource setRandomizationWindow(Integer randomizationWindow) + { + this.randomizationWindow = randomizationWindow; + return this; + } + @Override + public ProductByViewPopularityFeedSource setEnabled(Boolean enabled) + { + this.enabled = enabled; + return this; + } + @Override + public ProductByViewPopularityFeedSource setSelectionPolicy(FeedSourceSelectionPolicy selectionPolicy) + { + this.selectionPolicy = selectionPolicy; + return this; + } + @Override + public ProductByViewPopularityFeedSource setMaxResults(@Nullable Integer maxResults) + { + this.maxResults = maxResults; + return this; + } + @Override + public ProductByViewPopularityFeedSource setMaxResultsPerChanceGiven(@Nullable Integer maxResultsPerChanceGiven) + { + this.maxResultsPerChanceGiven = maxResultsPerChanceGiven; + return this; + } +} diff --git a/src/src/main/java/com/relewise/client/model/ProductCategoryInterestTriggerResultTriggerResultResponse.java b/src/src/main/java/com/relewise/client/model/ProductCategoryInterestTriggerResultTriggerResultResponse.java index 85b0394..204fa6e 100644 --- a/src/src/main/java/com/relewise/client/model/ProductCategoryInterestTriggerResultTriggerResultResponse.java +++ b/src/src/main/java/com/relewise/client/model/ProductCategoryInterestTriggerResultTriggerResultResponse.java @@ -23,7 +23,7 @@ @JsonIgnoreProperties(ignoreUnknown = true) public class ProductCategoryInterestTriggerResultTriggerResultResponse extends TimedResponse { - public String $type = "Relewise.Client.Responses.Triggers.TriggerResultResponse`1[[Relewise.Client.Responses.Triggers.Results.ProductCategoryInterestTriggerResult, 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.ProductCategoryInterestTriggerResult, Relewise.Client, Version=1.299.0.0, Culture=neutral, PublicKeyToken=null]], Relewise.Client"; public ProductCategoryInterestTriggerResult result; public static ProductCategoryInterestTriggerResultTriggerResultResponse create() { diff --git a/src/src/main/java/com/relewise/client/model/ProductChangeTriggerResultTriggerResultResponse.java b/src/src/main/java/com/relewise/client/model/ProductChangeTriggerResultTriggerResultResponse.java index a8b5475..6c0d571 100644 --- a/src/src/main/java/com/relewise/client/model/ProductChangeTriggerResultTriggerResultResponse.java +++ b/src/src/main/java/com/relewise/client/model/ProductChangeTriggerResultTriggerResultResponse.java @@ -23,7 +23,7 @@ @JsonIgnoreProperties(ignoreUnknown = true) public class ProductChangeTriggerResultTriggerResultResponse extends TimedResponse { - public String $type = "Relewise.Client.Responses.Triggers.TriggerResultResponse`1[[Relewise.Client.Responses.Triggers.Results.ProductChangeTriggerResult, 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.ProductChangeTriggerResult, Relewise.Client, Version=1.299.0.0, Culture=neutral, PublicKeyToken=null]], Relewise.Client"; public ProductChangeTriggerResult result; public static ProductChangeTriggerResultTriggerResultResponse create() { diff --git a/src/src/main/java/com/relewise/client/model/ProductInterestTriggerResultTriggerResultResponse.java b/src/src/main/java/com/relewise/client/model/ProductInterestTriggerResultTriggerResultResponse.java index ffe09d9..003abd6 100644 --- a/src/src/main/java/com/relewise/client/model/ProductInterestTriggerResultTriggerResultResponse.java +++ b/src/src/main/java/com/relewise/client/model/ProductInterestTriggerResultTriggerResultResponse.java @@ -23,7 +23,7 @@ @JsonIgnoreProperties(ignoreUnknown = true) public class ProductInterestTriggerResultTriggerResultResponse extends TimedResponse { - public String $type = "Relewise.Client.Responses.Triggers.TriggerResultResponse`1[[Relewise.Client.Responses.Triggers.Results.ProductInterestTriggerResult, 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.ProductInterestTriggerResult, Relewise.Client, Version=1.299.0.0, Culture=neutral, PublicKeyToken=null]], Relewise.Client"; public ProductInterestTriggerResult result; public static ProductInterestTriggerResultTriggerResultResponse create() { diff --git a/src/src/main/java/com/relewise/client/model/ProductPopularityScoreAggregation.java b/src/src/main/java/com/relewise/client/model/ProductPopularityScoreAggregation.java new file mode 100644 index 0000000..ca611f4 --- /dev/null +++ b/src/src/main/java/com/relewise/client/model/ProductPopularityScoreAggregation.java @@ -0,0 +1,31 @@ +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; + +/** Aggregation strategy for product popularity scores referenced by content data. */ +public enum ProductPopularityScoreAggregation +{ + Max { + public String toString() { + return "Max"; + } + }, + Average { + public String toString() { + return "Average"; + } + }, +} diff --git a/src/src/main/java/com/relewise/client/model/ProductRecommendationRequestSettings.java b/src/src/main/java/com/relewise/client/model/ProductRecommendationRequestSettings.java index e8e6758..cbb5557 100644 --- a/src/src/main/java/com/relewise/client/model/ProductRecommendationRequestSettings.java +++ b/src/src/main/java/com/relewise/client/model/ProductRecommendationRequestSettings.java @@ -15,12 +15,14 @@ import java.util.Set; import java.util.HashSet; +/** Controls how product recommendation requests should shape and trim the returned product and variant output. */ @JsonIgnoreProperties(ignoreUnknown = true) public class ProductRecommendationRequestSettings { public Integer numberOfRecommendations; public Boolean allowFillIfNecessaryToReachNumberOfRecommendations; public Boolean allowReplacingOfRecentlyShownRecommendations; + /** @deprecated Use VariantRequestSettings.MaxVariantsPerProduct instead. Setting VariantRequestSettings.MaxVariantsPerProduct = 1 is the same as RecommendVariant = true. */ public Boolean recommendVariant; public @Nullable SelectedProductPropertiesSettings selectedProductProperties; public @Nullable SelectedVariantPropertiesSettings selectedVariantProperties; @@ -28,6 +30,8 @@ public class ProductRecommendationRequestSettings public @Nullable Boolean allowProductsCurrentlyInCart; public @Nullable SelectedBrandPropertiesSettings selectedBrandProperties; public @Nullable Integer prioritizeResultsNotRecommendedWithinSeconds; + /** Controls whether recommendation results may include concrete variants, and how many variants may be returned per product. Use MaxVariantsPerProduct to switch between product-only output and variant-inclusive output. */ + public @Nullable VariantRecommendationRequestSettings variantRequestSettings; public static ProductRecommendationRequestSettings create() { return new ProductRecommendationRequestSettings(); @@ -47,6 +51,7 @@ public Boolean getAllowReplacingOfRecentlyShownRecommendations() { return this.allowReplacingOfRecentlyShownRecommendations; } + /** @deprecated Use VariantRequestSettings.MaxVariantsPerProduct instead. Setting VariantRequestSettings.MaxVariantsPerProduct = 1 is the same as RecommendVariant = true. */ public Boolean getRecommendVariant() { return this.recommendVariant; @@ -75,6 +80,11 @@ public Boolean getPrioritizeDiversityBetweenRequests() { return this.prioritizeResultsNotRecommendedWithinSeconds; } + /** Controls whether recommendation results may include concrete variants, and how many variants may be returned per product. Use MaxVariantsPerProduct to switch between product-only output and variant-inclusive output. */ + public @Nullable VariantRecommendationRequestSettings getVariantRequestSettings() + { + return this.variantRequestSettings; + } public ProductRecommendationRequestSettings setNumberOfRecommendations(Integer numberOfRecommendations) { this.numberOfRecommendations = numberOfRecommendations; @@ -90,6 +100,7 @@ public ProductRecommendationRequestSettings setAllowReplacingOfRecentlyShownReco this.allowReplacingOfRecentlyShownRecommendations = allowReplacingOfRecentlyShownRecommendations; return this; } + /** @deprecated Use VariantRequestSettings.MaxVariantsPerProduct instead. Setting VariantRequestSettings.MaxVariantsPerProduct = 1 is the same as RecommendVariant = true. */ public ProductRecommendationRequestSettings setRecommendVariant(Boolean recommendVariant) { this.recommendVariant = recommendVariant; @@ -125,4 +136,10 @@ public ProductRecommendationRequestSettings setPrioritizeResultsNotRecommendedWi this.prioritizeResultsNotRecommendedWithinSeconds = prioritizeResultsNotRecommendedWithinSeconds; return this; } + /** Controls whether recommendation results may include concrete variants, and how many variants may be returned per product. Use MaxVariantsPerProduct to switch between product-only output and variant-inclusive output. */ + public ProductRecommendationRequestSettings setVariantRequestSettings(@Nullable VariantRecommendationRequestSettings variantRequestSettings) + { + this.variantRequestSettings = variantRequestSettings; + return this; + } } diff --git a/src/src/main/java/com/relewise/client/model/ProductResult.java b/src/src/main/java/com/relewise/client/model/ProductResult.java index e595e19..0a24c72 100644 --- a/src/src/main/java/com/relewise/client/model/ProductResult.java +++ b/src/src/main/java/com/relewise/client/model/ProductResult.java @@ -39,6 +39,8 @@ public class ProductResult public @Nullable Score score; /** Contains engagement signals (sentiment, favorite) recorded for the current user on this product. Populated only when explicitly requested via UserEngagement. */ public @Nullable ProductEngagementData userEngagement; + /** Explains how Variant got selected for this product result. Populated only when explicitly requested via VariantResolution. */ + public @Nullable VariantResolutionInfo variantResolution; public static ProductResult create(String productId, Integer rank) { return new ProductResult(productId, rank); @@ -129,6 +131,11 @@ public VariantResult[] getFilteredVariants() { return this.userEngagement; } + /** Explains how Variant got selected for this product result. Populated only when explicitly requested via VariantResolution. */ + public @Nullable VariantResolutionInfo getVariantResolution() + { + return this.variantResolution; + } public ProductResult setProductId(String productId) { this.productId = productId; @@ -291,4 +298,10 @@ public ProductResult setUserEngagement(@Nullable ProductEngagementData userEngag this.userEngagement = userEngagement; return this; } + /** Explains how Variant got selected for this product result. Populated only when explicitly requested via VariantResolution. */ + public ProductResult setVariantResolution(@Nullable VariantResolutionInfo variantResolution) + { + this.variantResolution = variantResolution; + return this; + } } diff --git a/src/src/main/java/com/relewise/client/model/ProductSearchSettings.java b/src/src/main/java/com/relewise/client/model/ProductSearchSettings.java index b4abd02..12f76ec 100644 --- a/src/src/main/java/com/relewise/client/model/ProductSearchSettings.java +++ b/src/src/main/java/com/relewise/client/model/ProductSearchSettings.java @@ -26,6 +26,7 @@ public class ProductSearchSettings extends SearchSettings implements ProductProd public String $type = "Relewise.Client.Requests.Search.Settings.ProductSearchSettings, Relewise.Client"; public @Nullable SelectedProductPropertiesSettings selectedProductProperties; public @Nullable SelectedVariantPropertiesSettings selectedVariantProperties; + /** @deprecated Use VariantRequestSettings.MaxVariantsPerProduct instead. */ public @Nullable Integer explodedVariants; /** @deprecated Not currently in use */ public RecommendationSettings recommendations; @@ -34,6 +35,7 @@ public class ProductSearchSettings extends SearchSettings implements ProductProd /** Used to define constraints which must be honoured to be a valid results. The difference between this and Filters, is that filters are evaluated per product and variant, constraints could be acting on the result of such filter evaluations or a combination of factors, such as whether the product has any variants which matched the provided filters etc. */ public @Nullable ProductSearchResultConstraint resultConstraint; public @Nullable ProductSearchSettingsHighlightSettings highlight; + public @Nullable VariantSearchRequestSettings variantRequestSettings; public static ProductSearchSettings create() { return new ProductSearchSettings(); @@ -49,6 +51,7 @@ public ProductSearchSettings() { return this.selectedVariantProperties; } + /** @deprecated Use VariantRequestSettings.MaxVariantsPerProduct instead. */ public @Nullable Integer getExplodedVariants() { return this.explodedVariants; @@ -75,6 +78,10 @@ public RecommendationSettings getRecommendations() { return this.highlight; } + public @Nullable VariantSearchRequestSettings getVariantRequestSettings() + { + return this.variantRequestSettings; + } public ProductSearchSettings setSelectedProductProperties(@Nullable SelectedProductPropertiesSettings selectedProductProperties) { this.selectedProductProperties = selectedProductProperties; @@ -85,6 +92,7 @@ public ProductSearchSettings setSelectedVariantProperties(@Nullable SelectedVari this.selectedVariantProperties = selectedVariantProperties; return this; } + /** @deprecated Use VariantRequestSettings.MaxVariantsPerProduct instead. */ public ProductSearchSettings setExplodedVariants(@Nullable Integer explodedVariants) { this.explodedVariants = explodedVariants; @@ -117,4 +125,9 @@ public ProductSearchSettings setHighlight(@Nullable ProductSearchSettingsHighlig this.highlight = highlight; return this; } + public ProductSearchSettings setVariantRequestSettings(@Nullable VariantSearchRequestSettings variantRequestSettings) + { + this.variantRequestSettings = variantRequestSettings; + return this; + } } diff --git a/src/src/main/java/com/relewise/client/model/ProductsPurchasedWithProductSeedFeedSource.java b/src/src/main/java/com/relewise/client/model/ProductsPurchasedWithProductSeedFeedSource.java new file mode 100644 index 0000000..b024e38 --- /dev/null +++ b/src/src/main/java/com/relewise/client/model/ProductsPurchasedWithProductSeedFeedSource.java @@ -0,0 +1,77 @@ +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 products that are commonly purchased with the products configured by ProductAndVariantIds. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.EXISTING_PROPERTY, + property = "$type", + defaultImpl = ProductsPurchasedWithProductSeedFeedSource.class) +@JsonIgnoreProperties(ignoreUnknown = true) +public class ProductsPurchasedWithProductSeedFeedSource extends EntityBySeedFeedSource implements IProductFeedSource +{ + public String $type = "Relewise.Client.DataTypes.Feed.Sources.ProductsPurchasedWithProductSeedFeedSource, Relewise.Client"; + public static ProductsPurchasedWithProductSeedFeedSource create(FeedSourceSelectionPolicy selectionPolicy, Integer maxSeedItems, Integer randomizationWindow) + { + return new ProductsPurchasedWithProductSeedFeedSource(selectionPolicy, maxSeedItems, randomizationWindow); + } + public ProductsPurchasedWithProductSeedFeedSource(FeedSourceSelectionPolicy selectionPolicy, Integer maxSeedItems, Integer randomizationWindow) + { + this.selectionPolicy = selectionPolicy; + this.maxSeedItems = maxSeedItems; + this.randomizationWindow = randomizationWindow; + } + public ProductsPurchasedWithProductSeedFeedSource() + { + } + @Override + public ProductsPurchasedWithProductSeedFeedSource setMaxSeedItems(Integer maxSeedItems) + { + this.maxSeedItems = maxSeedItems; + return this; + } + @Override + public ProductsPurchasedWithProductSeedFeedSource setRandomizationWindow(Integer randomizationWindow) + { + this.randomizationWindow = randomizationWindow; + return this; + } + @Override + public ProductsPurchasedWithProductSeedFeedSource setEnabled(Boolean enabled) + { + this.enabled = enabled; + return this; + } + @Override + public ProductsPurchasedWithProductSeedFeedSource setSelectionPolicy(FeedSourceSelectionPolicy selectionPolicy) + { + this.selectionPolicy = selectionPolicy; + return this; + } + @Override + public ProductsPurchasedWithProductSeedFeedSource setMaxResults(@Nullable Integer maxResults) + { + this.maxResults = maxResults; + return this; + } + @Override + public ProductsPurchasedWithProductSeedFeedSource setMaxResultsPerChanceGiven(@Nullable Integer maxResultsPerChanceGiven) + { + this.maxResultsPerChanceGiven = maxResultsPerChanceGiven; + return this; + } +} diff --git a/src/src/main/java/com/relewise/client/model/ProductsViewedAfterContentSeedFeedSource.java b/src/src/main/java/com/relewise/client/model/ProductsViewedAfterContentSeedFeedSource.java new file mode 100644 index 0000000..b5045a9 --- /dev/null +++ b/src/src/main/java/com/relewise/client/model/ProductsViewedAfterContentSeedFeedSource.java @@ -0,0 +1,77 @@ +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 products that are commonly viewed after the content configured by ContentIds. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.EXISTING_PROPERTY, + property = "$type", + defaultImpl = ProductsViewedAfterContentSeedFeedSource.class) +@JsonIgnoreProperties(ignoreUnknown = true) +public class ProductsViewedAfterContentSeedFeedSource extends EntityBySeedFeedSource implements IProductFeedSource +{ + public String $type = "Relewise.Client.DataTypes.Feed.Sources.ProductsViewedAfterContentSeedFeedSource, Relewise.Client"; + public static ProductsViewedAfterContentSeedFeedSource create(FeedSourceSelectionPolicy selectionPolicy, Integer maxSeedItems, Integer randomizationWindow) + { + return new ProductsViewedAfterContentSeedFeedSource(selectionPolicy, maxSeedItems, randomizationWindow); + } + public ProductsViewedAfterContentSeedFeedSource(FeedSourceSelectionPolicy selectionPolicy, Integer maxSeedItems, Integer randomizationWindow) + { + this.selectionPolicy = selectionPolicy; + this.maxSeedItems = maxSeedItems; + this.randomizationWindow = randomizationWindow; + } + public ProductsViewedAfterContentSeedFeedSource() + { + } + @Override + public ProductsViewedAfterContentSeedFeedSource setMaxSeedItems(Integer maxSeedItems) + { + this.maxSeedItems = maxSeedItems; + return this; + } + @Override + public ProductsViewedAfterContentSeedFeedSource setRandomizationWindow(Integer randomizationWindow) + { + this.randomizationWindow = randomizationWindow; + return this; + } + @Override + public ProductsViewedAfterContentSeedFeedSource setEnabled(Boolean enabled) + { + this.enabled = enabled; + return this; + } + @Override + public ProductsViewedAfterContentSeedFeedSource setSelectionPolicy(FeedSourceSelectionPolicy selectionPolicy) + { + this.selectionPolicy = selectionPolicy; + return this; + } + @Override + public ProductsViewedAfterContentSeedFeedSource setMaxResults(@Nullable Integer maxResults) + { + this.maxResults = maxResults; + return this; + } + @Override + public ProductsViewedAfterContentSeedFeedSource setMaxResultsPerChanceGiven(@Nullable Integer maxResultsPerChanceGiven) + { + this.maxResultsPerChanceGiven = maxResultsPerChanceGiven; + return this; + } +} diff --git a/src/src/main/java/com/relewise/client/model/ProductsViewedAfterProductSeedFeedSource.java b/src/src/main/java/com/relewise/client/model/ProductsViewedAfterProductSeedFeedSource.java new file mode 100644 index 0000000..9b02106 --- /dev/null +++ b/src/src/main/java/com/relewise/client/model/ProductsViewedAfterProductSeedFeedSource.java @@ -0,0 +1,77 @@ +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 products that are commonly viewed after the products configured by ProductAndVariantIds. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.EXISTING_PROPERTY, + property = "$type", + defaultImpl = ProductsViewedAfterProductSeedFeedSource.class) +@JsonIgnoreProperties(ignoreUnknown = true) +public class ProductsViewedAfterProductSeedFeedSource extends EntityBySeedFeedSource implements IProductFeedSource +{ + public String $type = "Relewise.Client.DataTypes.Feed.Sources.ProductsViewedAfterProductSeedFeedSource, Relewise.Client"; + public static ProductsViewedAfterProductSeedFeedSource create(FeedSourceSelectionPolicy selectionPolicy, Integer maxSeedItems, Integer randomizationWindow) + { + return new ProductsViewedAfterProductSeedFeedSource(selectionPolicy, maxSeedItems, randomizationWindow); + } + public ProductsViewedAfterProductSeedFeedSource(FeedSourceSelectionPolicy selectionPolicy, Integer maxSeedItems, Integer randomizationWindow) + { + this.selectionPolicy = selectionPolicy; + this.maxSeedItems = maxSeedItems; + this.randomizationWindow = randomizationWindow; + } + public ProductsViewedAfterProductSeedFeedSource() + { + } + @Override + public ProductsViewedAfterProductSeedFeedSource setMaxSeedItems(Integer maxSeedItems) + { + this.maxSeedItems = maxSeedItems; + return this; + } + @Override + public ProductsViewedAfterProductSeedFeedSource setRandomizationWindow(Integer randomizationWindow) + { + this.randomizationWindow = randomizationWindow; + return this; + } + @Override + public ProductsViewedAfterProductSeedFeedSource setEnabled(Boolean enabled) + { + this.enabled = enabled; + return this; + } + @Override + public ProductsViewedAfterProductSeedFeedSource setSelectionPolicy(FeedSourceSelectionPolicy selectionPolicy) + { + this.selectionPolicy = selectionPolicy; + return this; + } + @Override + public ProductsViewedAfterProductSeedFeedSource setMaxResults(@Nullable Integer maxResults) + { + this.maxResults = maxResults; + return this; + } + @Override + public ProductsViewedAfterProductSeedFeedSource setMaxResultsPerChanceGiven(@Nullable Integer maxResultsPerChanceGiven) + { + this.maxResultsPerChanceGiven = maxResultsPerChanceGiven; + return this; + } +} diff --git a/src/src/main/java/com/relewise/client/model/SaveFeedConfigurationRequest.java b/src/src/main/java/com/relewise/client/model/SaveFeedConfigurationRequest.java new file mode 100644 index 0000000..dc58e66 --- /dev/null +++ b/src/src/main/java/com/relewise/client/model/SaveFeedConfigurationRequest.java @@ -0,0 +1,66 @@ +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; + +/** Saves a feed configuration under the specified identifier. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.EXISTING_PROPERTY, + property = "$type", + defaultImpl = SaveFeedConfigurationRequest.class) +@JsonIgnoreProperties(ignoreUnknown = true) +public class SaveFeedConfigurationRequest extends LicensedRequest +{ + public String $type = "Relewise.Client.Requests.Recommendations.Feed.SaveFeedConfigurationRequest, Relewise.Client"; + /** The feed configuration to save. */ + public FeedConfiguration configuration; + /** The user or system that modified the configuration. */ + public String modifiedBy; + public static SaveFeedConfigurationRequest create(FeedConfiguration configuration, String modifiedBy) + { + return new SaveFeedConfigurationRequest(configuration, modifiedBy); + } + public SaveFeedConfigurationRequest(FeedConfiguration configuration, String modifiedBy) + { + this.configuration = configuration; + this.modifiedBy = modifiedBy; + } + public SaveFeedConfigurationRequest() + { + } + /** The feed configuration to save. */ + public FeedConfiguration getConfiguration() + { + return this.configuration; + } + /** The user or system that modified the configuration. */ + public String getModifiedBy() + { + return this.modifiedBy; + } + /** The feed configuration to save. */ + public SaveFeedConfigurationRequest setConfiguration(FeedConfiguration configuration) + { + this.configuration = configuration; + return this; + } + /** The user or system that modified the configuration. */ + public SaveFeedConfigurationRequest setModifiedBy(String modifiedBy) + { + this.modifiedBy = modifiedBy; + return this; + } +} diff --git a/src/src/main/java/com/relewise/client/model/SelectedProductPropertiesSettings.java b/src/src/main/java/com/relewise/client/model/SelectedProductPropertiesSettings.java index cac1664..6a8054f 100644 --- a/src/src/main/java/com/relewise/client/model/SelectedProductPropertiesSettings.java +++ b/src/src/main/java/com/relewise/client/model/SelectedProductPropertiesSettings.java @@ -41,6 +41,8 @@ public class SelectedProductPropertiesSettings public @Nullable SelectedScorePropertiesSettings score; /** Determines whether UserEngagement should be populated when results are mapped. */ public Boolean userEngagement; + /** Determines whether VariantResolution should be populated for product search results. */ + public Boolean variantResolution; public static SelectedProductPropertiesSettings create() { return new SelectedProductPropertiesSettings(); @@ -110,6 +112,11 @@ public Boolean getUserEngagement() { return this.userEngagement; } + /** Determines whether VariantResolution should be populated for product search results. */ + public Boolean getVariantResolution() + { + return this.variantResolution; + } public SelectedProductPropertiesSettings setDisplayName(Boolean displayName) { this.displayName = displayName; @@ -201,4 +208,10 @@ public SelectedProductPropertiesSettings setUserEngagement(Boolean userEngagemen this.userEngagement = userEngagement; return this; } + /** Determines whether VariantResolution should be populated for product search results. */ + public SelectedProductPropertiesSettings setVariantResolution(Boolean variantResolution) + { + this.variantResolution = variantResolution; + return this; + } } diff --git a/src/src/main/java/com/relewise/client/model/SimilarProductsRequest.java b/src/src/main/java/com/relewise/client/model/SimilarProductsRequest.java index aaa670e..3d9e9b3 100644 --- a/src/src/main/java/com/relewise/client/model/SimilarProductsRequest.java +++ b/src/src/main/java/com/relewise/client/model/SimilarProductsRequest.java @@ -28,6 +28,7 @@ public class SimilarProductsRequest extends ProductRecommendationRequest impleme public @Nullable Product productData; public Boolean considerAlreadyKnownInformationAboutProduct; public @Nullable SimilarProductsEvaluationSettings evaluationSettings; + /** @deprecated Use Settings.VariantRequestSettings.MaxVariantsPerProduct instead. */ public @Nullable Integer explodedVariants; public static SimilarProductsRequest create(@Nullable Language language, @Nullable Currency currency, String displayedAtLocationType, User user, Product productData, Boolean considerAlreadyKnownInformationAboutProduct) { @@ -103,6 +104,7 @@ public Boolean getConsiderAlreadyKnownInformationAboutProduct() { return this.evaluationSettings; } + /** @deprecated Use Settings.VariantRequestSettings.MaxVariantsPerProduct instead. */ public @Nullable Integer getExplodedVariants() { return this.explodedVariants; @@ -127,6 +129,7 @@ public SimilarProductsRequest setEvaluationSettings(@Nullable SimilarProductsEva this.evaluationSettings = evaluationSettings; return this; } + /** @deprecated Use Settings.VariantRequestSettings.MaxVariantsPerProduct instead. */ public SimilarProductsRequest setExplodedVariants(@Nullable Integer explodedVariants) { this.explodedVariants = explodedVariants; diff --git a/src/src/main/java/com/relewise/client/model/TimedResponse.java b/src/src/main/java/com/relewise/client/model/TimedResponse.java index d4f2508..c884ffb 100644 --- a/src/src/main/java/com/relewise/client/model/TimedResponse.java +++ b/src/src/main/java/com/relewise/client/model/TimedResponse.java @@ -37,6 +37,8 @@ @JsonSubTypes.Type(value = ProductCategoryRecommendationResponse.class, name = "Relewise.Client.Responses.ProductCategoryRecommendationResponse, Relewise.Client"), @JsonSubTypes.Type(value = ContentCategoryRecommendationResponse.class, name = "Relewise.Client.Responses.ContentCategoryRecommendationResponse, Relewise.Client"), @JsonSubTypes.Type(value = BrandRecommendationResponse.class, name = "Relewise.Client.Responses.BrandRecommendationResponse, Relewise.Client"), + @JsonSubTypes.Type(value = FeedConfigurationResponse.class, name = "Relewise.Client.Responses.Feed.FeedConfigurationResponse, Relewise.Client"), + @JsonSubTypes.Type(value = FeedConfigurationsResponse.class, name = "Relewise.Client.Responses.Feed.FeedConfigurationsResponse, Relewise.Client"), }) @JsonIgnoreProperties(ignoreUnknown = true) public abstract class TimedResponse diff --git a/src/src/main/java/com/relewise/client/model/UUIDConfigurationEntity.java b/src/src/main/java/com/relewise/client/model/UUIDConfigurationEntity.java new file mode 100644 index 0000000..25cfd5f --- /dev/null +++ b/src/src/main/java/com/relewise/client/model/UUIDConfigurationEntity.java @@ -0,0 +1,38 @@ +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 UUIDConfigurationEntity +{ + public String $type = ""; + public @Nullable UUID id; + public @Nullable UUID getId() + { + return this.id; + } + public UUIDConfigurationEntity setId(@Nullable UUID id) + { + this.id = id; + return this; + } +} diff --git a/src/src/main/java/com/relewise/client/model/UserActivityTriggerResultTriggerResultResponse.java b/src/src/main/java/com/relewise/client/model/UserActivityTriggerResultTriggerResultResponse.java index 74afcf5..2a190b9 100644 --- a/src/src/main/java/com/relewise/client/model/UserActivityTriggerResultTriggerResultResponse.java +++ b/src/src/main/java/com/relewise/client/model/UserActivityTriggerResultTriggerResultResponse.java @@ -23,7 +23,7 @@ @JsonIgnoreProperties(ignoreUnknown = true) public class UserActivityTriggerResultTriggerResultResponse extends TimedResponse { - public String $type = "Relewise.Client.Responses.Triggers.TriggerResultResponse`1[[Relewise.Client.Responses.Triggers.Results.UserActivityTriggerResult, 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.UserActivityTriggerResult, Relewise.Client, Version=1.299.0.0, Culture=neutral, PublicKeyToken=null]], Relewise.Client"; public UserActivityTriggerResult result; public static UserActivityTriggerResultTriggerResultResponse create() { diff --git a/src/src/main/java/com/relewise/client/model/VariantChangeTriggerResultTriggerResultResponse.java b/src/src/main/java/com/relewise/client/model/VariantChangeTriggerResultTriggerResultResponse.java index 118fb77..665124d 100644 --- a/src/src/main/java/com/relewise/client/model/VariantChangeTriggerResultTriggerResultResponse.java +++ b/src/src/main/java/com/relewise/client/model/VariantChangeTriggerResultTriggerResultResponse.java @@ -23,7 +23,7 @@ @JsonIgnoreProperties(ignoreUnknown = true) public class VariantChangeTriggerResultTriggerResultResponse extends TimedResponse { - public String $type = "Relewise.Client.Responses.Triggers.TriggerResultResponse`1[[Relewise.Client.Responses.Triggers.Results.VariantChangeTriggerResult, 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.VariantChangeTriggerResult, Relewise.Client, Version=1.299.0.0, Culture=neutral, PublicKeyToken=null]], Relewise.Client"; public VariantChangeTriggerResult result; public static VariantChangeTriggerResultTriggerResultResponse create() { diff --git a/src/src/main/java/com/relewise/client/model/VariantRecommendationRequestSettings.java b/src/src/main/java/com/relewise/client/model/VariantRecommendationRequestSettings.java new file mode 100644 index 0000000..9a2a5f1 --- /dev/null +++ b/src/src/main/java/com/relewise/client/model/VariantRecommendationRequestSettings.java @@ -0,0 +1,47 @@ +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; + +/** Recommendation-specific variant controls for product recommendation requests. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.EXISTING_PROPERTY, + property = "$type", + defaultImpl = VariantRecommendationRequestSettings.class) +@JsonIgnoreProperties(ignoreUnknown = true) +public class VariantRecommendationRequestSettings extends VariantRequestSettings +{ + public String $type = "Relewise.Client.Requests.Recommendations.VariantRecommendationRequestSettings, Relewise.Client"; + public static VariantRecommendationRequestSettings create() + { + return new VariantRecommendationRequestSettings(); + } + public VariantRecommendationRequestSettings() + { + } + @Override + public VariantRecommendationRequestSettings setMaxVariantsPerProduct(@Nullable Integer maxVariantsPerProduct) + { + this.maxVariantsPerProduct = maxVariantsPerProduct; + return this; + } + @Override + public VariantRecommendationRequestSettings setSorting(@Nullable VariantSorting sorting) + { + this.sorting = sorting; + return this; + } +} diff --git a/src/src/main/java/com/relewise/client/model/VariantRequestSettings.java b/src/src/main/java/com/relewise/client/model/VariantRequestSettings.java new file mode 100644 index 0000000..cbef929 --- /dev/null +++ b/src/src/main/java/com/relewise/client/model/VariantRequestSettings.java @@ -0,0 +1,57 @@ +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; + +/** Request-level controls for how many variants may be returned per product and how those variants should be ordered. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.EXISTING_PROPERTY, + property = "$type") +@JsonSubTypes({ + @JsonSubTypes.Type(value = VariantSearchRequestSettings.class, name = "Relewise.Client.Requests.Search.Settings.VariantSearchRequestSettings, Relewise.Client"), + @JsonSubTypes.Type(value = VariantRecommendationRequestSettings.class, name = "Relewise.Client.Requests.Recommendations.VariantRecommendationRequestSettings, Relewise.Client"), +}) +@JsonIgnoreProperties(ignoreUnknown = true) +public abstract class VariantRequestSettings +{ + public String $type = ""; + /** The maximum number of variants that may be returned for a single product. A value of 0 means product-only output. */ + public @Nullable Integer maxVariantsPerProduct; + /** The preferred sorting strategy for variants when more than one variant per product is allowed. When omitted, the effective sorting is chosen by the engine. */ + public @Nullable VariantSorting sorting; + /** The maximum number of variants that may be returned for a single product. A value of 0 means product-only output. */ + public @Nullable Integer getMaxVariantsPerProduct() + { + return this.maxVariantsPerProduct; + } + /** The preferred sorting strategy for variants when more than one variant per product is allowed. When omitted, the effective sorting is chosen by the engine. */ + public @Nullable VariantSorting getSorting() + { + return this.sorting; + } + /** The maximum number of variants that may be returned for a single product. A value of 0 means product-only output. */ + public VariantRequestSettings setMaxVariantsPerProduct(@Nullable Integer maxVariantsPerProduct) + { + this.maxVariantsPerProduct = maxVariantsPerProduct; + return this; + } + /** The preferred sorting strategy for variants when more than one variant per product is allowed. When omitted, the effective sorting is chosen by the engine. */ + public VariantRequestSettings setSorting(@Nullable VariantSorting sorting) + { + this.sorting = sorting; + return this; + } +} diff --git a/src/src/main/java/com/relewise/client/model/VariantResolutionInfo.java b/src/src/main/java/com/relewise/client/model/VariantResolutionInfo.java new file mode 100644 index 0000000..3a1227b --- /dev/null +++ b/src/src/main/java/com/relewise/client/model/VariantResolutionInfo.java @@ -0,0 +1,42 @@ +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; + +/** Explains why the selected Variant was returned for a product search result. */ +@JsonIgnoreProperties(ignoreUnknown = true) +public class VariantResolutionInfo +{ + /** Describes the selection path that caused the variant to be returned. */ + public VariantResolutionSource source; + public static VariantResolutionInfo create() + { + return new VariantResolutionInfo(); + } + public VariantResolutionInfo() + { + } + /** Describes the selection path that caused the variant to be returned. */ + public VariantResolutionSource getSource() + { + return this.source; + } + /** Describes the selection path that caused the variant to be returned. */ + public VariantResolutionInfo setSource(VariantResolutionSource source) + { + this.source = source; + return this; + } +} diff --git a/src/src/main/java/com/relewise/client/model/VariantResolutionSource.java b/src/src/main/java/com/relewise/client/model/VariantResolutionSource.java new file mode 100644 index 0000000..64522ed --- /dev/null +++ b/src/src/main/java/com/relewise/client/model/VariantResolutionSource.java @@ -0,0 +1,36 @@ +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; + +/** Describes why a product result contains a selected variant. */ +public enum VariantResolutionSource +{ + Default { + public String toString() { + return "Default"; + } + }, + PartialMatchByTerm { + public String toString() { + return "PartialMatchByTerm"; + } + }, + MatchByTerm { + public String toString() { + return "MatchByTerm"; + } + }, +} diff --git a/src/src/main/java/com/relewise/client/model/VariantSearchRequestSettings.java b/src/src/main/java/com/relewise/client/model/VariantSearchRequestSettings.java new file mode 100644 index 0000000..af45e81 --- /dev/null +++ b/src/src/main/java/com/relewise/client/model/VariantSearchRequestSettings.java @@ -0,0 +1,47 @@ +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; + +/** Search-specific variant controls for product search requests. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.EXISTING_PROPERTY, + property = "$type", + defaultImpl = VariantSearchRequestSettings.class) +@JsonIgnoreProperties(ignoreUnknown = true) +public class VariantSearchRequestSettings extends VariantRequestSettings +{ + public String $type = "Relewise.Client.Requests.Search.Settings.VariantSearchRequestSettings, Relewise.Client"; + public static VariantSearchRequestSettings create() + { + return new VariantSearchRequestSettings(); + } + public VariantSearchRequestSettings() + { + } + @Override + public VariantSearchRequestSettings setMaxVariantsPerProduct(@Nullable Integer maxVariantsPerProduct) + { + this.maxVariantsPerProduct = maxVariantsPerProduct; + return this; + } + @Override + public VariantSearchRequestSettings setSorting(@Nullable VariantSorting sorting) + { + this.sorting = sorting; + return this; + } +} diff --git a/src/src/main/java/com/relewise/client/model/VariantSorting.java b/src/src/main/java/com/relewise/client/model/VariantSorting.java new file mode 100644 index 0000000..68f99ac --- /dev/null +++ b/src/src/main/java/com/relewise/client/model/VariantSorting.java @@ -0,0 +1,31 @@ +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; + +/** Controls how variants should be ordered when more than one variant per product can participate in the result. */ +public enum VariantSorting +{ + GroupedByProduct { + public String toString() { + return "GroupedByProduct"; + } + }, + ByRelevance { + public String toString() { + return "ByRelevance"; + } + }, +} diff --git a/src/src/test/java/com/relewise/client/HydrationTest.java b/src/src/test/java/com/relewise/client/HydrationTest.java new file mode 100644 index 0000000..195a228 --- /dev/null +++ b/src/src/test/java/com/relewise/client/HydrationTest.java @@ -0,0 +1,75 @@ +package com.relewise.client; + +import com.fasterxml.jackson.databind.SerializationFeature; +import com.fasterxml.jackson.databind.json.JsonMapper; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +import com.relewise.client.model.AbandonedCartTriggerResult; +import com.relewise.client.model.Campaign; +import com.relewise.client.model.Increase; +import com.relewise.client.model.ObservableVariantAttribute; +import com.relewise.client.model.ObservableVariantAttributeSelector; +import com.relewise.client.model.ScheduledPeriod; +import com.relewise.client.model.TriggerResultResponse; +import com.relewise.client.model.VariantChangeTriggerConfiguration; +import org.junit.jupiter.api.Test; + +import java.time.OffsetDateTime; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; + +public class HydrationTest { + private final JsonMapper objectMapper = JsonMapper.builder() + .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) + .addModule(new JavaTimeModule()) + .build(); + + @Test + public void campaignHydratesScheduleAsScheduledPeriod() throws Exception { + var campaign = objectMapper.readValue(""" + { + "schedule": { + "$type": "Relewise.Client.DataTypes.Scheduling.ScheduledPeriod, Relewise.Client", + "fromUtc": "2026-01-01T12:00:00+00:00", + "toUtc": "2026-01-02T12:00:00+00:00" + } + } + """, Campaign.class); + + var scheduledPeriod = assertInstanceOf(ScheduledPeriod.class, campaign.getSchedule()); + assertEquals(OffsetDateTime.parse("2026-01-01T12:00:00+00:00"), scheduledPeriod.getFromUtc()); + assertEquals(OffsetDateTime.parse("2026-01-02T12:00:00+00:00"), scheduledPeriod.getToUtc()); + } + + @Test + public void variantChangeTriggerConfigurationHydratesNestedInterfaceTypes() throws Exception { + var configuration = objectMapper.readValue(""" + { + "entityPropertySelector": { + "$type": "Relewise.Client.DataTypes.EntityPropertySelectors.ObservableVariantAttributeSelector, Relewise.Client", + "attribute": "SalesPrice" + }, + "change": { + "$type": "Relewise.Client.DataTypes.Changes.Increase, Relewise.Client" + } + } + """, VariantChangeTriggerConfiguration.class); + + var entityPropertySelector = assertInstanceOf(ObservableVariantAttributeSelector.class, configuration.getEntityPropertySelector()); + assertEquals(ObservableVariantAttribute.SalesPrice, entityPropertySelector.getAttribute()); + assertInstanceOf(Increase.class, configuration.getChange()); + } + + @Test + public void triggerResultResponseHydratesResultInterfaceType() throws Exception { + var response = objectMapper.readValue(""" + { + "result": { + "$type": "Relewise.Client.Responses.Triggers.Results.AbandonedCartTriggerResult, Relewise.Client" + } + } + """, TriggerResultResponse.class); + + assertInstanceOf(AbandonedCartTriggerResult.class, response.getResult()); + } +}