|
| 1 | +package com.recombee.api_client.api_requests; |
| 2 | + |
| 3 | +/* |
| 4 | + This file is auto-generated, do not edit |
| 5 | +*/ |
| 6 | + |
| 7 | +import java.util.Date; |
| 8 | +import java.util.Map; |
| 9 | +import java.util.HashMap; |
| 10 | + |
| 11 | +import com.recombee.api_client.bindings.Logic; |
| 12 | +import com.recombee.api_client.util.HTTPMethod; |
| 13 | + |
| 14 | +/** |
| 15 | + * Adds a new synonym for the [Search items](https://docs.recombee.com/api.html#search-items). |
| 16 | + * When the `term` is used in the search query, the `synonym` is also used for the full-text search. |
| 17 | + * Unless `oneWay=true`, it works also in the opposite way (`synonym` -> `term`). |
| 18 | + * An example of a synonym can be `science fiction` for the term `sci-fi`. |
| 19 | + */ |
| 20 | +public class AddSearchSynonym extends Request { |
| 21 | + |
| 22 | + /** |
| 23 | + * A word to which the `synonym` is specified. |
| 24 | + */ |
| 25 | + protected String term; |
| 26 | + /** |
| 27 | + * A word that should be considered equal to the `term` by the full-text search engine. |
| 28 | + */ |
| 29 | + protected String synonym; |
| 30 | + /** |
| 31 | + * If set to `true`, only `term` -> `synonym` is considered. If set to `false`, also `synonym` -> `term` works. |
| 32 | + * Default: `false`. |
| 33 | + */ |
| 34 | + protected Boolean oneWay; |
| 35 | + |
| 36 | + /** |
| 37 | + * Construct the request |
| 38 | + * @param term A word to which the `synonym` is specified. |
| 39 | + * @param synonym A word that should be considered equal to the `term` by the full-text search engine. |
| 40 | + */ |
| 41 | + public AddSearchSynonym (String term,String synonym) { |
| 42 | + this.term = term; |
| 43 | + this.synonym = synonym; |
| 44 | + this.timeout = 10000; |
| 45 | + } |
| 46 | + |
| 47 | + /** |
| 48 | + * @param oneWay If set to `true`, only `term` -> `synonym` is considered. If set to `false`, also `synonym` -> `term` works. |
| 49 | + * Default: `false`. |
| 50 | + */ |
| 51 | + public AddSearchSynonym setOneWay(boolean oneWay) { |
| 52 | + this.oneWay = oneWay; |
| 53 | + return this; |
| 54 | + } |
| 55 | + |
| 56 | + public String getTerm() { |
| 57 | + return this.term; |
| 58 | + } |
| 59 | + |
| 60 | + public String getSynonym() { |
| 61 | + return this.synonym; |
| 62 | + } |
| 63 | + |
| 64 | + public boolean getOneWay() { |
| 65 | + if (this.oneWay==null) return false; |
| 66 | + return this.oneWay; |
| 67 | + } |
| 68 | + |
| 69 | + /** |
| 70 | + * @return Used HTTP method |
| 71 | + */ |
| 72 | + @Override |
| 73 | + public HTTPMethod getHTTPMethod() { |
| 74 | + return HTTPMethod.POST; |
| 75 | + } |
| 76 | + |
| 77 | + /** |
| 78 | + * @return URI to the endpoint including path parameters |
| 79 | + */ |
| 80 | + @Override |
| 81 | + public String getPath() { |
| 82 | + return "/synonyms/items/"; |
| 83 | + } |
| 84 | + |
| 85 | + /** |
| 86 | + * Get query parameters |
| 87 | + * @return Values of query parameters (name of parameter: value of the parameter) |
| 88 | + */ |
| 89 | + @Override |
| 90 | + public Map<String, Object> getQueryParameters() { |
| 91 | + HashMap<String, Object> params = new HashMap<String, Object>(); |
| 92 | + return params; |
| 93 | + } |
| 94 | + |
| 95 | + /** |
| 96 | + * Get body parameters |
| 97 | + * @return Values of body parameters (name of parameter: value of the parameter) |
| 98 | + */ |
| 99 | + @Override |
| 100 | + public Map<String, Object> getBodyParameters() { |
| 101 | + HashMap<String, Object> params = new HashMap<String, Object>(); |
| 102 | + params.put("term", this.term); |
| 103 | + params.put("synonym", this.synonym); |
| 104 | + if (this.oneWay!=null) { |
| 105 | + params.put("oneWay", this.oneWay); |
| 106 | + } |
| 107 | + return params; |
| 108 | + } |
| 109 | + |
| 110 | +} |
0 commit comments