Skip to content

Commit b398d6d

Browse files
feat(specs): add with transformation helpers (generated)
algolia/api-clients-automation#4931 Co-authored-by: algolia-bot <accounts+algolia-api-client-bot@algolia.com> Co-authored-by: Clément Vannicatte <vannicattec@gmail.com>
1 parent 0c38732 commit b398d6d

File tree

7 files changed

+276
-3
lines changed

7 files changed

+276
-3
lines changed

src/main/scala/algoliasearch/api/SearchClient.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ import algoliasearch.search.UpdateApiKeyResponse
7070
import algoliasearch.search.UpdatedAtResponse
7171
import algoliasearch.search.UpdatedAtWithObjectIdResponse
7272
import algoliasearch.search.UserId
73+
import algoliasearch.search.WatchResponse
7374
import algoliasearch.search._
7475
import algoliasearch.ApiClient
7576
import algoliasearch.api.SearchClient.hosts

src/main/scala/algoliasearch/ingestion/WatchResponse.scala

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,12 @@ package algoliasearch.ingestion
2626
* @param eventID
2727
* Universally unique identifier (UUID) of an event.
2828
* @param data
29-
* when used with discovering or validating sources, the sampled data of your source is returned.
29+
* This field is always null when used with the Push endpoint. When used for a source discover or source validate
30+
* run, it will include the sampled data of the source.
3031
* @param events
31-
* in case of error, observability events will be added to the response, if any.
32+
* in case of error, observability events will be added to the response.
3233
* @param message
33-
* a message describing the outcome of a validate run.
34+
* a message describing the outcome of the operation that has been ran (push, discover or validate) run.
3435
* @param createdAt
3536
* Date of creation in RFC 3339 format.
3637
*/
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/** Search API The Algolia Search API lets you search, configure, and manage 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 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 algoliasearch.search.EventStatus._
37+
import algoliasearch.search.EventType._
38+
39+
/** An event describe a step of the task execution flow..
40+
*
41+
* @param eventID
42+
* Universally unique identifier (UUID) of an event.
43+
* @param runID
44+
* Universally unique identifier (UUID) of a task run.
45+
* @param batchSize
46+
* The extracted record batch size.
47+
* @param publishedAt
48+
* Date of publish RFC 3339 format.
49+
*/
50+
case class Event(
51+
eventID: String,
52+
runID: String,
53+
status: Option[EventStatus] = scala.None,
54+
`type`: EventType,
55+
batchSize: Int,
56+
data: Option[Map[String, Any]] = scala.None,
57+
publishedAt: String
58+
)
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
/** Search API The Algolia Search API lets you search, configure, and manage 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 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 EventStatus
39+
40+
/** EventStatus enumeration
41+
*/
42+
object EventStatus {
43+
case object Created extends EventStatus {
44+
override def toString = "created"
45+
}
46+
case object Started extends EventStatus {
47+
override def toString = "started"
48+
}
49+
case object Retried extends EventStatus {
50+
override def toString = "retried"
51+
}
52+
case object Failed extends EventStatus {
53+
override def toString = "failed"
54+
}
55+
case object Succeeded extends EventStatus {
56+
override def toString = "succeeded"
57+
}
58+
case object Critical extends EventStatus {
59+
override def toString = "critical"
60+
}
61+
val values: Seq[EventStatus] = Seq(Created, Started, Retried, Failed, Succeeded, Critical)
62+
63+
def withName(name: String): EventStatus = EventStatus.values
64+
.find(_.toString == name)
65+
.getOrElse(throw new MappingException(s"Unknown EventStatus value: $name"))
66+
}
67+
68+
class EventStatusSerializer
69+
extends CustomSerializer[EventStatus](_ =>
70+
(
71+
{
72+
case JString(value) => EventStatus.withName(value)
73+
case JNull => null
74+
},
75+
{ case value: EventStatus =>
76+
JString(value.toString)
77+
}
78+
)
79+
)
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
/** Search API The Algolia Search API lets you search, configure, and manage 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 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 EventType
39+
40+
/** EventType enumeration
41+
*/
42+
object EventType {
43+
case object Fetch extends EventType {
44+
override def toString = "fetch"
45+
}
46+
case object Record extends EventType {
47+
override def toString = "record"
48+
}
49+
case object Log extends EventType {
50+
override def toString = "log"
51+
}
52+
case object Transform extends EventType {
53+
override def toString = "transform"
54+
}
55+
val values: Seq[EventType] = Seq(Fetch, Record, Log, Transform)
56+
57+
def withName(name: String): EventType = EventType.values
58+
.find(_.toString == name)
59+
.getOrElse(throw new MappingException(s"Unknown EventType value: $name"))
60+
}
61+
62+
class EventTypeSerializer
63+
extends CustomSerializer[EventType](_ =>
64+
(
65+
{
66+
case JString(value) => EventType.withName(value)
67+
case JNull => null
68+
},
69+
{ case value: EventType =>
70+
JString(value.toString)
71+
}
72+
)
73+
)

src/main/scala/algoliasearch/search/JsonSupport.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ object JsonSupport {
5151
new DictionaryEntryTypeSerializer() :+
5252
new DictionaryTypeSerializer() :+
5353
new EditTypeSerializer() :+
54+
new EventStatusSerializer() :+
55+
new EventTypeSerializer() :+
5456
new ExactOnSingleWordQuerySerializer() :+
5557
new LogTypeSerializer() :+
5658
new MatchLevelSerializer() :+
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/** Search API The Algolia Search API lets you search, configure, and manage 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 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+
/** WatchResponse
37+
*
38+
* @param runID
39+
* Universally unique identifier (UUID) of a task run.
40+
* @param eventID
41+
* Universally unique identifier (UUID) of an event.
42+
* @param data
43+
* This field is always null when used with the Push endpoint. When used for a source discover or source validate
44+
* run, it will include the sampled data of the source.
45+
* @param events
46+
* in case of error, observability events will be added to the response.
47+
* @param message
48+
* a message describing the outcome of the operation that has been ran (push, discover or validate) run.
49+
* @param createdAt
50+
* Date of creation in RFC 3339 format.
51+
*/
52+
case class WatchResponse(
53+
runID: String,
54+
eventID: Option[String] = scala.None,
55+
data: Option[Seq[Any]] = scala.None,
56+
events: Option[Seq[Event]] = scala.None,
57+
message: Option[String] = scala.None,
58+
createdAt: Option[String] = scala.None
59+
)

0 commit comments

Comments
 (0)