Skip to content

Commit b990e90

Browse files
feat(specs): add global push endpoint (generated)
algolia/api-clients-automation#4855 Co-authored-by: algolia-bot <[email protected]> Co-authored-by: Clément Vannicatte <[email protected]>
1 parent 479f4b4 commit b990e90

File tree

2 files changed

+68
-11
lines changed

2 files changed

+68
-11
lines changed

lib/Api/IngestionClient.php

Lines changed: 68 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1791,15 +1791,81 @@ public function listTransformations($itemsPerPage = null, $page = null, $sort =
17911791
}
17921792

17931793
/**
1794-
* Push a `batch` request payload through the Pipeline. You can check the status of task pushes with the observability endpoints.
1794+
* Pushes records through the Pipeline, directly to an index. You can make the call synchronous by providing the `watch` parameter, for asynchronous calls, you can use the observability endpoints and/or debugger dashboard to see the status of your task. If you want to leverage the [pre-indexing data transformation](https://www.algolia.com/doc/guides/sending-and-managing-data/send-and-update-your-data/how-to/transform-your-data/), this is the recommended way of ingesting your records. This method is similar to `pushTask`, but requires an `indexName` instead of a `taskID`. If zero or many tasks are found, an error will be returned.
1795+
*
1796+
* Required API Key ACLs:
1797+
* - addObject
1798+
* - deleteIndex
1799+
* - editSettings
1800+
*
1801+
* @param string $indexName Name of the index on which to perform the operation. (required)
1802+
* @param array|PushTaskPayload $pushTaskPayload pushTaskPayload (required)
1803+
* - $pushTaskPayload['action'] => (array) (required)
1804+
* - $pushTaskPayload['records'] => (array) (required)
1805+
*
1806+
* @see PushTaskPayload
1807+
*
1808+
* @param bool $watch When provided, the push operation will be synchronous and the API will wait for the ingestion to be finished before responding. (optional)
1809+
* @param array $requestOptions the requestOptions to send along with the query, they will be merged with the transporter requestOptions
1810+
*
1811+
* @return array<string, mixed>|WatchResponse
1812+
*/
1813+
public function push($indexName, $pushTaskPayload, $watch = null, $requestOptions = [])
1814+
{
1815+
// verify the required parameter 'indexName' is set
1816+
if (!isset($indexName)) {
1817+
throw new \InvalidArgumentException(
1818+
'Parameter `indexName` is required when calling `push`.'
1819+
);
1820+
}
1821+
// verify the required parameter 'pushTaskPayload' is set
1822+
if (!isset($pushTaskPayload)) {
1823+
throw new \InvalidArgumentException(
1824+
'Parameter `pushTaskPayload` is required when calling `push`.'
1825+
);
1826+
}
1827+
1828+
$resourcePath = '/1/push/{indexName}';
1829+
$queryParameters = [];
1830+
$headers = [];
1831+
$httpBody = $pushTaskPayload;
1832+
1833+
if (null !== $watch) {
1834+
$queryParameters['watch'] = $watch;
1835+
}
1836+
1837+
// path params
1838+
if (null !== $indexName) {
1839+
$resourcePath = str_replace(
1840+
'{indexName}',
1841+
ObjectSerializer::toPathValue($indexName),
1842+
$resourcePath
1843+
);
1844+
}
1845+
1846+
if (!isset($requestOptions['readTimeout'])) {
1847+
$requestOptions['readTimeout'] = 180;
1848+
}
1849+
if (!isset($requestOptions['writeTimeout'])) {
1850+
$requestOptions['writeTimeout'] = 180;
1851+
}
1852+
if (!isset($requestOptions['connectTimeout'])) {
1853+
$requestOptions['connectTimeout'] = 180;
1854+
}
1855+
1856+
return $this->sendRequest('POST', $resourcePath, $headers, $queryParameters, $httpBody, $requestOptions);
1857+
}
1858+
1859+
/**
1860+
* Pushes records through the Pipeline, directly to an index. You can make the call synchronous by providing the `watch` parameter, for asynchronous calls, you can use the observability endpoints and/or debugger dashboard to see the status of your task. If you want to leverage the [pre-indexing data transformation](https://www.algolia.com/doc/guides/sending-and-managing-data/send-and-update-your-data/how-to/transform-your-data/), this is the recommended way of ingesting your records. This method is similar to `push`, but requires a `taskID` instead of a `indexName`, which is useful when many `destinations` target the same `indexName`.
17951861
*
17961862
* Required API Key ACLs:
17971863
* - addObject
17981864
* - deleteIndex
17991865
* - editSettings
18001866
*
18011867
* @param string $taskID Unique identifier of a task. (required)
1802-
* @param array|PushTaskPayload $pushTaskPayload Request body of a Search API `batch` request that will be pushed in the Connectors pipeline. (required)
1868+
* @param array|PushTaskPayload $pushTaskPayload pushTaskPayload (required)
18031869
* - $pushTaskPayload['action'] => (array) (required)
18041870
* - $pushTaskPayload['records'] => (array) (required)
18051871
*

lib/Model/Ingestion/Action.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,6 @@ class Action
2424

2525
public const PARTIAL_UPDATE_OBJECT_NO_CREATE = 'partialUpdateObjectNoCreate';
2626

27-
public const DELETE_OBJECT = 'deleteObject';
28-
29-
public const DELETE = 'delete';
30-
31-
public const CLEAR = 'clear';
32-
3327
/**
3428
* Gets allowable values of the enum.
3529
*
@@ -42,9 +36,6 @@ public static function getAllowableEnumValues()
4236
self::UPDATE_OBJECT,
4337
self::PARTIAL_UPDATE_OBJECT,
4438
self::PARTIAL_UPDATE_OBJECT_NO_CREATE,
45-
self::DELETE_OBJECT,
46-
self::DELETE,
47-
self::CLEAR,
4839
];
4940
}
5041
}

0 commit comments

Comments
 (0)