Skip to content

Commit

Permalink
Generate API
Browse files Browse the repository at this point in the history
Signed-off-by: Kim Pepper <[email protected]>
  • Loading branch information
kimpepper committed Jan 15, 2025
1 parent ff70623 commit f99404f
Show file tree
Hide file tree
Showing 27 changed files with 1,686 additions and 191 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Fixed PHP 8.4 deprecations
- Fixed outdated tests
### Updated APIs
- Updated opensearch-php APIs to reflect [opensearch-api-specification@1681adc](https://github.com/opensearch-project/opensearch-api-specification/commit/1681adc7a638187fb3042e639c61bd1b1ab4c4f9)
- Updated opensearch-php APIs to reflect [opensearch-api-specification@2395cb4](https://github.com/opensearch-project/opensearch-api-specification/commit/2395cb472ec5581656aac184f7b20548cd5b06ac)
- Updated opensearch-php APIs to reflect [opensearch-api-specification@ebe0f8a](https://github.com/opensearch-project/opensearch-api-specification/commit/ebe0f8a885f7db7e882d160c101055a5aa70a707)
- Updated opensearch-php APIs to reflect [opensearch-api-specification@398481e](https://github.com/opensearch-project/opensearch-api-specification/commit/398481e5bd1cc590d947c35379c47096f2114f00)
Expand Down
145 changes: 15 additions & 130 deletions src/OpenSearch/Client.php

Large diffs are not rendered by default.

87 changes: 87 additions & 0 deletions src/OpenSearch/Endpoints/Ml/ChunkModel.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
<?php

declare(strict_types=1);

/**
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*
* Modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*/

namespace OpenSearch\Endpoints\Ml;

use OpenSearch\Common\Exceptions\RuntimeException;
use OpenSearch\Endpoints\AbstractEndpoint;

/**
* NOTE: This file is autogenerated using util/GenerateEndpoints.php
*/
/**
* @deprecated Use `upload_chunk` instead.
*/
class ChunkModel extends AbstractEndpoint
{
protected $chunk_number;
protected $model_id;

public function getURI(): string
{
$chunk_number = $this->chunk_number ?? null;
$model_id = $this->model_id ?? null;
if (isset($model_id) && isset($chunk_number)) {
return "/_plugins/_ml/models/$model_id/chunk/$chunk_number";
}
throw new RuntimeException('Missing parameter for the endpoint ml.chunk_model');
}

public function getParamWhitelist(): array
{
return [
'pretty',
'human',
'error_trace',
'source',
'filter_path'
];
}

public function getMethod(): string
{
return 'POST';
}

public function setBody($body): static
{
if (is_null($body)) {
return $this;
}
$this->body = $body;

return $this;
}

public function setChunkNumber($chunk_number): static
{
if (is_null($chunk_number)) {
return $this;
}
$this->chunk_number = $chunk_number;

return $this;
}

public function setModelId($model_id): static
{
if (is_null($model_id)) {
return $this;
}
$this->model_id = $model_id;

return $this;
}
}
72 changes: 72 additions & 0 deletions src/OpenSearch/Endpoints/Ml/CreateController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<?php

declare(strict_types=1);

/**
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*
* Modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*/

namespace OpenSearch\Endpoints\Ml;

use OpenSearch\Common\Exceptions\RuntimeException;
use OpenSearch\Endpoints\AbstractEndpoint;

/**
* NOTE: This file is autogenerated using util/GenerateEndpoints.php
*/
class CreateController extends AbstractEndpoint
{
protected $model_id;

public function getURI(): string
{
$model_id = $this->model_id ?? null;
if (isset($model_id)) {
return "/_plugins/_ml/controllers/$model_id";
}
throw new RuntimeException('Missing parameter for the endpoint ml.create_controller');
}

public function getParamWhitelist(): array
{
return [
'pretty',
'human',
'error_trace',
'source',
'filter_path'
];
}

public function getMethod(): string
{
return 'POST';
}

public function setBody($body): static
{
if (is_null($body)) {
return $this;
}
$this->body = $body;

return $this;
}

public function setModelId($model_id): static
{
if (is_null($model_id)) {
return $this;
}
$this->model_id = $model_id;

return $this;
}
}
58 changes: 58 additions & 0 deletions src/OpenSearch/Endpoints/Ml/CreateModelMeta.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?php

declare(strict_types=1);

/**
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*
* Modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*/

namespace OpenSearch\Endpoints\Ml;

use OpenSearch\Endpoints\AbstractEndpoint;

/**
* NOTE: This file is autogenerated using util/GenerateEndpoints.php
*/
/**
* @deprecated Use `_register_meta` instead.
*/
class CreateModelMeta extends AbstractEndpoint
{
public function getURI(): string
{
return "/_plugins/_ml/models/meta";
}

public function getParamWhitelist(): array
{
return [
'pretty',
'human',
'error_trace',
'source',
'filter_path'
];
}

public function getMethod(): string
{
return 'POST';
}

public function setBody($body): static
{
if (is_null($body)) {
return $this;
}
$this->body = $body;

return $this;
}
}
62 changes: 62 additions & 0 deletions src/OpenSearch/Endpoints/Ml/DeleteController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?php

declare(strict_types=1);

/**
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*
* Modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*/

namespace OpenSearch\Endpoints\Ml;

use OpenSearch\Common\Exceptions\RuntimeException;
use OpenSearch\Endpoints\AbstractEndpoint;

/**
* NOTE: This file is autogenerated using util/GenerateEndpoints.php
*/
class DeleteController extends AbstractEndpoint
{
protected $model_id;

public function getURI(): string
{
$model_id = $this->model_id ?? null;
if (isset($model_id)) {
return "/_plugins/_ml/controllers/$model_id";
}
throw new RuntimeException('Missing parameter for the endpoint ml.delete_controller');
}

public function getParamWhitelist(): array
{
return [
'pretty',
'human',
'error_trace',
'source',
'filter_path'
];
}

public function getMethod(): string
{
return 'DELETE';
}

public function setModelId($model_id): static
{
if (is_null($model_id)) {
return $this;
}
$this->model_id = $model_id;

return $this;
}
}
62 changes: 62 additions & 0 deletions src/OpenSearch/Endpoints/Ml/GetController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?php

declare(strict_types=1);

/**
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*
* Modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*/

namespace OpenSearch\Endpoints\Ml;

use OpenSearch\Common\Exceptions\RuntimeException;
use OpenSearch\Endpoints\AbstractEndpoint;

/**
* NOTE: This file is autogenerated using util/GenerateEndpoints.php
*/
class GetController extends AbstractEndpoint
{
protected $model_id;

public function getURI(): string
{
$model_id = $this->model_id ?? null;
if (isset($model_id)) {
return "/_plugins/_ml/controllers/$model_id";
}
throw new RuntimeException('Missing parameter for the endpoint ml.get_controller');
}

public function getParamWhitelist(): array
{
return [
'pretty',
'human',
'error_trace',
'source',
'filter_path'
];
}

public function getMethod(): string
{
return 'GET';
}

public function setModelId($model_id): static
{
if (is_null($model_id)) {
return $this;
}
$this->model_id = $model_id;

return $this;
}
}
Loading

0 comments on commit f99404f

Please sign in to comment.