Skip to content

Commit 9270eb9

Browse files
feat(specs): add generate code endpoint to ingestion specs (generated)
algolia/api-clients-automation#3489 Co-authored-by: algolia-bot <[email protected]> Co-authored-by: Clément Vannicatte <[email protected]>
1 parent a1bad70 commit 9270eb9

File tree

3 files changed

+90
-1
lines changed

3 files changed

+90
-1
lines changed

src/main/scala/algoliasearch/api/IngestionClient.scala

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ import algoliasearch.ingestion.Event
2727
import algoliasearch.ingestion.EventSortKeys._
2828
import algoliasearch.ingestion.EventStatus._
2929
import algoliasearch.ingestion.EventType._
30+
import algoliasearch.ingestion.GenerateTransformationCodePayload
31+
import algoliasearch.ingestion.GenerateTransformationCodeResponse
3032
import algoliasearch.ingestion.ListAuthenticationsResponse
3133
import algoliasearch.ingestion.ListDestinationsResponse
3234
import algoliasearch.ingestion.ListEventsResponse
@@ -580,6 +582,31 @@ class IngestionClient(
580582
execute[TaskUpdateResponse](request, requestOptions)
581583
}
582584

585+
/** Generates code for the selected model based on the given prompt.
586+
*
587+
* Required API Key ACLs:
588+
* - addObject
589+
* - deleteIndex
590+
* - editSettings
591+
*/
592+
def generateTransformationCode(
593+
generateTransformationCodePayload: GenerateTransformationCodePayload,
594+
requestOptions: Option[RequestOptions] = None
595+
)(implicit ec: ExecutionContext): Future[GenerateTransformationCodeResponse] = Future {
596+
requireNotNull(
597+
generateTransformationCodePayload,
598+
"Parameter `generateTransformationCodePayload` is required when calling `generateTransformationCode`."
599+
)
600+
601+
val request = HttpRequest
602+
.builder()
603+
.withMethod("POST")
604+
.withPath(s"/1/transformations/models")
605+
.withBody(generateTransformationCodePayload)
606+
.build()
607+
execute[GenerateTransformationCodeResponse](request, requestOptions)
608+
}
609+
583610
/** Retrieves an authentication resource by its ID.
584611
*
585612
* Required API Key ACLs:
@@ -1134,7 +1161,7 @@ class IngestionClient(
11341161
val request = HttpRequest
11351162
.builder()
11361163
.withMethod("GET")
1137-
.withPath(s"/1/transformations/copilot")
1164+
.withPath(s"/1/transformations/models")
11381165
.build()
11391166
execute[TransformationModels](request, requestOptions)
11401167
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/** Ingestion API The Ingestion API lets you connect third-party services and platforms with Algolia and schedule tasks
2+
* to ingest your data. The Ingestion API powers the no-code [data
3+
* connectors](https://dashboard.algolia.com/connectors). ## Base URLs The base URLs for requests to the Ingestion API
4+
* are: - `https://data.us.algolia.com` - `https://data.eu.algolia.com` Use the URL that matches your [analytics
5+
* region](https://dashboard.algolia.com/account/infrastructure/analytics). **All requests must use HTTPS.** ##
6+
* Authentication To authenticate your API requests, add these headers: - `x-algolia-application-id`. Your Algolia
7+
* application ID. - `x-algolia-api-key`. An API key with the necessary permissions to make the request. The required
8+
* access control list (ACL) to make a request is listed in each endpoint's reference. You can find your application ID
9+
* and API key in the [Algolia dashboard](https://dashboard.algolia.com/account). ## Request format Request bodies must
10+
* be JSON objects. ## Response status and errors Response bodies are JSON objects. Deleting a user token returns an
11+
* empty response body with rate-limiting information as headers. Successful responses return a `2xx` status. Client
12+
* errors return a `4xx` status. Server errors are indicated by a `5xx` status. Error responses have a `message`
13+
* property with more information. The Insights API doesn't validate if the event parameters such as `indexName`,
14+
* `objectIDs`, or `userToken`, correspond to anything in the Search API. It justs checks if they're formatted
15+
* correctly. Check the [Events](https://dashboard.algolia.com/events/health) health section, whether your events can
16+
* be used for Algolia features such as Analytics, or Dynamic Re-Ranking. ## Version The current version of the
17+
* Insights API is version 1, as indicated by the `/1/` in each endpoint's URL.
18+
*
19+
* The version of the OpenAPI document: 1.0.0
20+
*
21+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
22+
* https://openapi-generator.tech Do not edit the class manually.
23+
*/
24+
package algoliasearch.ingestion
25+
26+
/** GenerateTransformationCodePayload
27+
*/
28+
case class GenerateTransformationCodePayload(
29+
id: String,
30+
systemPrompt: Option[String] = scala.None,
31+
userPrompt: String
32+
)
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/** Ingestion API The Ingestion API lets you connect third-party services and platforms with Algolia and schedule tasks
2+
* to ingest your data. The Ingestion API powers the no-code [data
3+
* connectors](https://dashboard.algolia.com/connectors). ## Base URLs The base URLs for requests to the Ingestion API
4+
* are: - `https://data.us.algolia.com` - `https://data.eu.algolia.com` Use the URL that matches your [analytics
5+
* region](https://dashboard.algolia.com/account/infrastructure/analytics). **All requests must use HTTPS.** ##
6+
* Authentication To authenticate your API requests, add these headers: - `x-algolia-application-id`. Your Algolia
7+
* application ID. - `x-algolia-api-key`. An API key with the necessary permissions to make the request. The required
8+
* access control list (ACL) to make a request is listed in each endpoint's reference. You can find your application ID
9+
* and API key in the [Algolia dashboard](https://dashboard.algolia.com/account). ## Request format Request bodies must
10+
* be JSON objects. ## Response status and errors Response bodies are JSON objects. Deleting a user token returns an
11+
* empty response body with rate-limiting information as headers. Successful responses return a `2xx` status. Client
12+
* errors return a `4xx` status. Server errors are indicated by a `5xx` status. Error responses have a `message`
13+
* property with more information. The Insights API doesn't validate if the event parameters such as `indexName`,
14+
* `objectIDs`, or `userToken`, correspond to anything in the Search API. It justs checks if they're formatted
15+
* correctly. Check the [Events](https://dashboard.algolia.com/events/health) health section, whether your events can
16+
* be used for Algolia features such as Analytics, or Dynamic Re-Ranking. ## Version The current version of the
17+
* Insights API is version 1, as indicated by the `/1/` in each endpoint's URL.
18+
*
19+
* The version of the OpenAPI document: 1.0.0
20+
*
21+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
22+
* https://openapi-generator.tech Do not edit the class manually.
23+
*/
24+
package algoliasearch.ingestion
25+
26+
/** GenerateTransformationCodeResponse
27+
*/
28+
case class GenerateTransformationCodeResponse(
29+
generatedCode: Option[String] = scala.None
30+
)

0 commit comments

Comments
 (0)