|
| 1 | +/** Search API The Algolia Search API lets you search, configure, and mange your indices and records. ## Client |
| 2 | + * libraries Use Algolia's API clients and libraries to reliably integrate Algolia's APIs with your apps. The official |
| 3 | + * API clients are covered by Algolia's [Service Level Agreement](https://www.algolia.com/policies/sla/). See: |
| 4 | + * [Algolia's ecosystem](https://www.algolia.com/doc/guides/getting-started/how-algolia-works/in-depth/ecosystem/) ## |
| 5 | + * Base URLs The base URLs for requests to the Search API are: - `https://{APPLICATION_ID}.algolia.net` - |
| 6 | + * `https://{APPLICATION_ID}-dsn.algolia.net`. If your subscription includes a [Distributed Search |
| 7 | + * Network](https://dashboard.algolia.com/infra), this ensures that requests are sent to servers closest to users. Both |
| 8 | + * URLs provide high availability by distributing requests with load balancing. **All requests must use HTTPS.** ## |
| 9 | + * Retry strategy To guarantee a high availability, implement a retry strategy for all API requests using the URLs of |
| 10 | + * your servers as fallbacks: - `https://{APPLICATION_ID}-1.algolianet.com` - |
| 11 | + * `https://{APPLICATION_ID}-2.algolianet.com` - `https://{APPLICATION_ID}-3.algolianet.com` These URLs use a different |
| 12 | + * DNS provider than the primary URLs. You should randomize this list to ensure an even load across the three servers. |
| 13 | + * All Algolia API clients implement this retry strategy. ## Authentication To authenticate your API requests, add |
| 14 | + * these headers: - `x-algolia-application-id`. Your Algolia application ID. - `x-algolia-api-key`. An API key with the |
| 15 | + * necessary permissions to make the request. The required access control list (ACL) to make a request is listed in |
| 16 | + * each endpoint's reference. You can find your application ID and API key in the [Algolia |
| 17 | + * dashboard](https://dashboard.algolia.com/account). ## Request format Depending on the endpoint, request bodies are |
| 18 | + * either JSON objects or arrays of JSON objects, ## Parameters Parameters are passed as query parameters for GET and |
| 19 | + * DELETE requests, and in the request body for POST and PUT requests. Query parameters must be |
| 20 | + * [URL-encoded](https://developer.mozilla.org/en-US/docs/Glossary/Percent-encoding). Non-ASCII characters must be |
| 21 | + * UTF-8 encoded. Plus characters (`+`) are interpreted as spaces. Arrays as query parameters must be one of: - A |
| 22 | + * comma-separated string: `attributesToRetrieve=title,description` - A URL-encoded JSON array: |
| 23 | + * `attributesToRetrieve=%5B%22title%22,%22description%22%D` ## Response status and errors The Search API returns JSON |
| 24 | + * responses. Since JSON doesn't guarantee any specific ordering, don't rely on the order of attributes in the API |
| 25 | + * response. Successful responses return a `2xx` status. Client errors return a `4xx` status. Server errors are |
| 26 | + * indicated by a `5xx` status. Error responses have a `message` property with more information. ## Version The current |
| 27 | + * version of the Search API is version 1, as indicated by the `/1/` in each endpoint's URL. |
| 28 | + * |
| 29 | + * The version of the OpenAPI document: 1.0.0 |
| 30 | + * |
| 31 | + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). |
| 32 | + * https://openapi-generator.tech Do not edit the class manually. |
| 33 | + */ |
| 34 | +package algoliasearch.search |
| 35 | + |
| 36 | +import org.json4s._ |
| 37 | + |
| 38 | +sealed trait DictionaryEntryType |
| 39 | + |
| 40 | +/** Whether a dictionary entry is provided by Algolia (standard), or has been added by you (custom). |
| 41 | + */ |
| 42 | +object DictionaryEntryType { |
| 43 | + case object Custom extends DictionaryEntryType { |
| 44 | + override def toString = "custom" |
| 45 | + } |
| 46 | + case object Standard extends DictionaryEntryType { |
| 47 | + override def toString = "standard" |
| 48 | + } |
| 49 | + val values: Seq[DictionaryEntryType] = Seq(Custom, Standard) |
| 50 | + |
| 51 | + def withName(name: String): DictionaryEntryType = DictionaryEntryType.values |
| 52 | + .find(_.toString == name) |
| 53 | + .getOrElse(throw new MappingException(s"Unknown DictionaryEntryType value: $name")) |
| 54 | +} |
| 55 | + |
| 56 | +class DictionaryEntryTypeSerializer |
| 57 | + extends CustomSerializer[DictionaryEntryType](_ => |
| 58 | + ( |
| 59 | + { |
| 60 | + case JString(value) => DictionaryEntryType.withName(value) |
| 61 | + case JNull => null |
| 62 | + }, |
| 63 | + { case value: DictionaryEntryType => |
| 64 | + JString(value.toString) |
| 65 | + } |
| 66 | + ) |
| 67 | + ) |
0 commit comments