|
46 | 46 | use Algolia\AlgoliaSearch\Model\Ingestion\TaskCreate;
|
47 | 47 | use Algolia\AlgoliaSearch\Model\Ingestion\TaskCreateResponse;
|
48 | 48 | use Algolia\AlgoliaSearch\Model\Ingestion\TaskCreateV1;
|
| 49 | +use Algolia\AlgoliaSearch\Model\Ingestion\TaskReplace; |
49 | 50 | use Algolia\AlgoliaSearch\Model\Ingestion\TaskSearch;
|
50 | 51 | use Algolia\AlgoliaSearch\Model\Ingestion\TaskUpdate;
|
51 | 52 | use Algolia\AlgoliaSearch\Model\Ingestion\TaskUpdateResponse;
|
@@ -1939,6 +1940,60 @@ public function pushTask($taskID, $pushTaskPayload, $watch = null, $requestOptio
|
1939 | 1940 | return $this->sendRequest('POST', $resourcePath, $headers, $queryParameters, $httpBody, $requestOptions);
|
1940 | 1941 | }
|
1941 | 1942 |
|
| 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 | + |
1942 | 1997 | /**
|
1943 | 1998 | * Runs all tasks linked to a source, only available for Shopify, BigCommerce and commercetools sources. Creates one run per task.
|
1944 | 1999 | *
|
@@ -2584,7 +2639,7 @@ public function updateSource($sourceID, $sourceUpdate, $requestOptions = [])
|
2584 | 2639 | }
|
2585 | 2640 |
|
2586 | 2641 | /**
|
2587 |
| - * Updates a task by its ID. |
| 2642 | + * Partially updates a task by its ID. |
2588 | 2643 | *
|
2589 | 2644 | * @param string $taskID Unique identifier of a task. (required)
|
2590 | 2645 | * @param array|TaskUpdate $taskUpdate taskUpdate (required)
|
|
0 commit comments