-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(specs): add
dictionary
specs (#49)
- Loading branch information
Showing
75 changed files
with
7,767 additions
and
1,549 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Anchoring.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package com.algolia.model; | ||
|
||
import com.google.gson.TypeAdapter; | ||
import com.google.gson.annotations.JsonAdapter; | ||
import com.google.gson.stream.JsonReader; | ||
import com.google.gson.stream.JsonWriter; | ||
import java.io.IOException; | ||
|
||
/** | ||
* Whether the pattern parameter must match the beginning or the end of the query string, or both, | ||
* or none. | ||
*/ | ||
@JsonAdapter(Anchoring.Adapter.class) | ||
public enum Anchoring { | ||
IS("is"), | ||
|
||
STARTSWITH("startsWith"), | ||
|
||
ENDSWITH("endsWith"), | ||
|
||
CONTAINS("contains"); | ||
|
||
private String value; | ||
|
||
Anchoring(String value) { | ||
this.value = value; | ||
} | ||
|
||
public String getValue() { | ||
return value; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return String.valueOf(value); | ||
} | ||
|
||
public static Anchoring fromValue(String value) { | ||
for (Anchoring b : Anchoring.values()) { | ||
if (b.value.equals(value)) { | ||
return b; | ||
} | ||
} | ||
throw new IllegalArgumentException("Unexpected value '" + value + "'"); | ||
} | ||
|
||
public static class Adapter extends TypeAdapter<Anchoring> { | ||
|
||
@Override | ||
public void write(final JsonWriter jsonWriter, final Anchoring enumeration) | ||
throws IOException { | ||
jsonWriter.value(enumeration.getValue()); | ||
} | ||
|
||
@Override | ||
public Anchoring read(final JsonReader jsonReader) throws IOException { | ||
String value = jsonReader.nextString(); | ||
return Anchoring.fromValue(value); | ||
} | ||
} | ||
} |
138 changes: 138 additions & 0 deletions
138
...lgoliasearch-client-java-2/algoliasearch-core/com/algolia/model/AutomaticFacetFilter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
package com.algolia.model; | ||
|
||
import com.google.gson.annotations.SerializedName; | ||
import io.swagger.annotations.ApiModel; | ||
import io.swagger.annotations.ApiModelProperty; | ||
import java.util.Objects; | ||
|
||
/** Automatic facet Filter. */ | ||
@ApiModel(description = "Automatic facet Filter.") | ||
public class AutomaticFacetFilter { | ||
|
||
public static final String SERIALIZED_NAME_FACET = "facet"; | ||
|
||
@SerializedName(SERIALIZED_NAME_FACET) | ||
private String facet; | ||
|
||
public static final String SERIALIZED_NAME_SCORE = "score"; | ||
|
||
@SerializedName(SERIALIZED_NAME_SCORE) | ||
private Integer score = 1; | ||
|
||
public static final String SERIALIZED_NAME_DISJUNCTIVE = "disjunctive"; | ||
|
||
@SerializedName(SERIALIZED_NAME_DISJUNCTIVE) | ||
private Boolean disjunctive = false; | ||
|
||
public AutomaticFacetFilter facet(String facet) { | ||
this.facet = facet; | ||
return this; | ||
} | ||
|
||
/** | ||
* Attribute to filter on. This must match a facet placeholder in the Rule's pattern. | ||
* | ||
* @return facet | ||
*/ | ||
@javax.annotation.Nonnull | ||
@ApiModelProperty( | ||
required = true, | ||
value = "Attribute to filter on. This must match a facet placeholder in the Rule's pattern." | ||
) | ||
public String getFacet() { | ||
return facet; | ||
} | ||
|
||
public void setFacet(String facet) { | ||
this.facet = facet; | ||
} | ||
|
||
public AutomaticFacetFilter score(Integer score) { | ||
this.score = score; | ||
return this; | ||
} | ||
|
||
/** | ||
* Score for the filter. Typically used for optional or disjunctive filters. | ||
* | ||
* @return score | ||
*/ | ||
@javax.annotation.Nullable | ||
@ApiModelProperty( | ||
value = "Score for the filter. Typically used for optional or disjunctive filters." | ||
) | ||
public Integer getScore() { | ||
return score; | ||
} | ||
|
||
public void setScore(Integer score) { | ||
this.score = score; | ||
} | ||
|
||
public AutomaticFacetFilter disjunctive(Boolean disjunctive) { | ||
this.disjunctive = disjunctive; | ||
return this; | ||
} | ||
|
||
/** | ||
* Whether the filter is disjunctive (true) or conjunctive (false). | ||
* | ||
* @return disjunctive | ||
*/ | ||
@javax.annotation.Nullable | ||
@ApiModelProperty( | ||
value = "Whether the filter is disjunctive (true) or conjunctive (false)." | ||
) | ||
public Boolean getDisjunctive() { | ||
return disjunctive; | ||
} | ||
|
||
public void setDisjunctive(Boolean disjunctive) { | ||
this.disjunctive = disjunctive; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) { | ||
return true; | ||
} | ||
if (o == null || getClass() != o.getClass()) { | ||
return false; | ||
} | ||
AutomaticFacetFilter automaticFacetFilter = (AutomaticFacetFilter) o; | ||
return ( | ||
Objects.equals(this.facet, automaticFacetFilter.facet) && | ||
Objects.equals(this.score, automaticFacetFilter.score) && | ||
Objects.equals(this.disjunctive, automaticFacetFilter.disjunctive) | ||
); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(facet, score, disjunctive); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
StringBuilder sb = new StringBuilder(); | ||
sb.append("class AutomaticFacetFilter {\n"); | ||
sb.append(" facet: ").append(toIndentedString(facet)).append("\n"); | ||
sb.append(" score: ").append(toIndentedString(score)).append("\n"); | ||
sb | ||
.append(" disjunctive: ") | ||
.append(toIndentedString(disjunctive)) | ||
.append("\n"); | ||
sb.append("}"); | ||
return sb.toString(); | ||
} | ||
|
||
/** | ||
* Convert the given object to string with each line indented by 4 spaces (except the first line). | ||
*/ | ||
private String toIndentedString(Object o) { | ||
if (o == null) { | ||
return "null"; | ||
} | ||
return o.toString().replace("\n", "\n "); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.