001 002package com.commercetools.ml.models.similar_products; 003 004import java.time.*; 005import java.time.ZonedDateTime; 006import java.util.*; 007import java.util.function.Function; 008 009import javax.annotation.Nullable; 010import javax.validation.Valid; 011import javax.validation.constraints.NotNull; 012 013import com.commercetools.ml.models.common.TaskStatusEnum; 014import com.fasterxml.jackson.annotation.*; 015import com.fasterxml.jackson.databind.annotation.*; 016 017import io.vrap.rmf.base.client.utils.Generated; 018 019/** 020 * <p>Represents a URL path to poll to get the results of an Asynchronous Request.</p> 021 * 022 * <hr> 023 * Example to create an instance using the builder pattern 024 * <div class=code-example> 025 * <pre><code class='java'> 026 * SimilarProductsTaskStatus similarProductsTaskStatus = SimilarProductsTaskStatus.builder() 027 * .state(TaskStatusEnum.PENDING) 028 * .result(resultBuilder -> resultBuilder) 029 * .build() 030 * </code></pre> 031 * </div> 032 */ 033@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 034@JsonDeserialize(as = SimilarProductsTaskStatusImpl.class) 035public interface SimilarProductsTaskStatus { 036 037 /** 038 * 039 * @return state 040 */ 041 @NotNull 042 @JsonProperty("state") 043 public TaskStatusEnum getState(); 044 045 /** 046 * <p>The expiry date of the result. You cannot access the result after the expiry date. Default: 1 day after the result first becomes available. This is only available when the TaskStatus state is SUCCESS.</p> 047 * @return expires 048 */ 049 050 @JsonProperty("expires") 051 public ZonedDateTime getExpires(); 052 053 /** 054 * <p>The response to an asynchronous request. The type depends on the request initiated. Only populated when the status is <code>SUCCESS</code>.</p> 055 * @return result 056 */ 057 @NotNull 058 @Valid 059 @JsonProperty("result") 060 public SimilarProductsPagedQueryResult getResult(); 061 062 /** 063 * set state 064 * @param state value to be set 065 */ 066 067 public void setState(final TaskStatusEnum state); 068 069 /** 070 * <p>The expiry date of the result. You cannot access the result after the expiry date. Default: 1 day after the result first becomes available. This is only available when the TaskStatus state is SUCCESS.</p> 071 * @param expires value to be set 072 */ 073 074 public void setExpires(final ZonedDateTime expires); 075 076 /** 077 * <p>The response to an asynchronous request. The type depends on the request initiated. Only populated when the status is <code>SUCCESS</code>.</p> 078 * @param result value to be set 079 */ 080 081 public void setResult(final SimilarProductsPagedQueryResult result); 082 083 /** 084 * factory method 085 * @return instance of SimilarProductsTaskStatus 086 */ 087 public static SimilarProductsTaskStatus of() { 088 return new SimilarProductsTaskStatusImpl(); 089 } 090 091 /** 092 * factory method to create a shallow copy SimilarProductsTaskStatus 093 * @param template instance to be copied 094 * @return copy instance 095 */ 096 public static SimilarProductsTaskStatus of(final SimilarProductsTaskStatus template) { 097 SimilarProductsTaskStatusImpl instance = new SimilarProductsTaskStatusImpl(); 098 instance.setState(template.getState()); 099 instance.setExpires(template.getExpires()); 100 instance.setResult(template.getResult()); 101 return instance; 102 } 103 104 /** 105 * factory method to create a deep copy of SimilarProductsTaskStatus 106 * @param template instance to be copied 107 * @return copy instance 108 */ 109 @Nullable 110 public static SimilarProductsTaskStatus deepCopy(@Nullable final SimilarProductsTaskStatus template) { 111 if (template == null) { 112 return null; 113 } 114 SimilarProductsTaskStatusImpl instance = new SimilarProductsTaskStatusImpl(); 115 instance.setState(template.getState()); 116 instance.setExpires(template.getExpires()); 117 instance.setResult(com.commercetools.ml.models.similar_products.SimilarProductsPagedQueryResult 118 .deepCopy(template.getResult())); 119 return instance; 120 } 121 122 /** 123 * builder factory method for SimilarProductsTaskStatus 124 * @return builder 125 */ 126 public static SimilarProductsTaskStatusBuilder builder() { 127 return SimilarProductsTaskStatusBuilder.of(); 128 } 129 130 /** 131 * create builder for SimilarProductsTaskStatus instance 132 * @param template instance with prefilled values for the builder 133 * @return builder 134 */ 135 public static SimilarProductsTaskStatusBuilder builder(final SimilarProductsTaskStatus template) { 136 return SimilarProductsTaskStatusBuilder.of(template); 137 } 138 139 /** 140 * accessor map function 141 * @param <T> mapped type 142 * @param helper function to map the object 143 * @return mapped value 144 */ 145 default <T> T withSimilarProductsTaskStatus(Function<SimilarProductsTaskStatus, T> helper) { 146 return helper.apply(this); 147 } 148 149 /** 150 * gives a TypeReference for usage with Jackson DataBind 151 * @return TypeReference 152 */ 153 public static com.fasterxml.jackson.core.type.TypeReference<SimilarProductsTaskStatus> typeReference() { 154 return new com.fasterxml.jackson.core.type.TypeReference<SimilarProductsTaskStatus>() { 155 @Override 156 public String toString() { 157 return "TypeReference<SimilarProductsTaskStatus>"; 158 } 159 }; 160 } 161}