Skip to content

Commit 63c42e1

Browse files
feat(specs): add put task endpoint to ingestion api (generated)
algolia/api-clients-automation#5281 Co-authored-by: algolia-bot <[email protected]> Co-authored-by: Clément Vannicatte <[email protected]>
1 parent 418cdc7 commit 63c42e1

File tree

3 files changed

+580
-2
lines changed

3 files changed

+580
-2
lines changed

lib/Api/IngestionClient.php

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
use Algolia\AlgoliaSearch\Model\Ingestion\TaskCreate;
4747
use Algolia\AlgoliaSearch\Model\Ingestion\TaskCreateResponse;
4848
use Algolia\AlgoliaSearch\Model\Ingestion\TaskCreateV1;
49+
use Algolia\AlgoliaSearch\Model\Ingestion\TaskReplace;
4950
use Algolia\AlgoliaSearch\Model\Ingestion\TaskSearch;
5051
use Algolia\AlgoliaSearch\Model\Ingestion\TaskUpdate;
5152
use Algolia\AlgoliaSearch\Model\Ingestion\TaskUpdateResponse;
@@ -1939,6 +1940,60 @@ public function pushTask($taskID, $pushTaskPayload, $watch = null, $requestOptio
19391940
return $this->sendRequest('POST', $resourcePath, $headers, $queryParameters, $httpBody, $requestOptions);
19401941
}
19411942

1943+
/**
1944+
* Fully updates a task by its ID, use partialUpdateTask if you only want to update a subset of fields.
1945+
*
1946+
* @param string $taskID Unique identifier of a task. (required)
1947+
* @param array|TaskReplace $taskReplace taskReplace (required)
1948+
* - $taskReplace['destinationID'] => (string) Universally unique identifier (UUID) of a destination resource. (required)
1949+
* - $taskReplace['action'] => (array) (required)
1950+
* - $taskReplace['subscriptionAction'] => (array)
1951+
* - $taskReplace['cron'] => (string) Cron expression for the task's schedule.
1952+
* - $taskReplace['enabled'] => (bool) Whether the task is enabled.
1953+
* - $taskReplace['failureThreshold'] => (int) Maximum accepted percentage of failures for a task run to finish successfully.
1954+
* - $taskReplace['input'] => (array)
1955+
* - $taskReplace['cursor'] => (string) Date of the last cursor in RFC 3339 format.
1956+
* - $taskReplace['notifications'] => (array)
1957+
* - $taskReplace['policies'] => (array)
1958+
*
1959+
* @see TaskReplace
1960+
*
1961+
* @param array $requestOptions the requestOptions to send along with the query, they will be merged with the transporter requestOptions
1962+
*
1963+
* @return array<string, mixed>|TaskUpdateResponse
1964+
*/
1965+
public function replaceTask($taskID, $taskReplace, $requestOptions = [])
1966+
{
1967+
// verify the required parameter 'taskID' is set
1968+
if (!isset($taskID)) {
1969+
throw new \InvalidArgumentException(
1970+
'Parameter `taskID` is required when calling `replaceTask`.'
1971+
);
1972+
}
1973+
// verify the required parameter 'taskReplace' is set
1974+
if (!isset($taskReplace)) {
1975+
throw new \InvalidArgumentException(
1976+
'Parameter `taskReplace` is required when calling `replaceTask`.'
1977+
);
1978+
}
1979+
1980+
$resourcePath = '/2/tasks/{taskID}';
1981+
$queryParameters = [];
1982+
$headers = [];
1983+
$httpBody = $taskReplace;
1984+
1985+
// path params
1986+
if (null !== $taskID) {
1987+
$resourcePath = str_replace(
1988+
'{taskID}',
1989+
ObjectSerializer::toPathValue($taskID),
1990+
$resourcePath
1991+
);
1992+
}
1993+
1994+
return $this->sendRequest('PUT', $resourcePath, $headers, $queryParameters, $httpBody, $requestOptions);
1995+
}
1996+
19421997
/**
19431998
* Runs all tasks linked to a source, only available for Shopify, BigCommerce and commercetools sources. Creates one run per task.
19441999
*
@@ -2584,7 +2639,7 @@ public function updateSource($sourceID, $sourceUpdate, $requestOptions = [])
25842639
}
25852640

25862641
/**
2587-
* Updates a task by its ID.
2642+
* Partially updates a task by its ID.
25882643
*
25892644
* @param string $taskID Unique identifier of a task. (required)
25902645
* @param array|TaskUpdate $taskUpdate taskUpdate (required)

0 commit comments

Comments
 (0)