Skip to content

Commit

Permalink
Updated API endpoints to 8.3
Browse files Browse the repository at this point in the history
  • Loading branch information
ezimuel committed Jul 8, 2022
1 parent 647c9cf commit 7f4b892
Show file tree
Hide file tree
Showing 10 changed files with 276 additions and 7 deletions.
11 changes: 11 additions & 0 deletions src/AppSearch/Endpoints.php
Original file line number Diff line number Diff line change
Expand Up @@ -796,6 +796,17 @@ public function search(Request\Search $request): Response
}


/**
* Submit a multi search
*
* @see https://www.elastic.co/guide/en/app-search/current/multi-search.html
*/
public function multiSearch(Request\MultiSearch $request): Response
{
return new Response($this->transport->sendRequest($request->getRequest()));
}


/**
* Retrieve the search query
*
Expand Down
12 changes: 5 additions & 7 deletions src/AppSearch/Request/CreateCrawlerCrawlRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

namespace Elastic\EnterpriseSearch\AppSearch\Request;

use Elastic\EnterpriseSearch\AppSearch\Schema\CrawlRequestOverridesParameters;
use Elastic\EnterpriseSearch\AppSearch\Schema\CrawlRequestOverrides;
use Elastic\EnterpriseSearch\Request\Request;

/**
Expand All @@ -29,16 +29,14 @@ class CreateCrawlerCrawlRequest extends Request
{
/**
* @param string $engineName Name of the engine
* @param CrawlRequestOverridesParameters $crawl_request_overrides_parameters
* @param CrawlRequestOverrides $crawl_request_overrides
*/
public function __construct(
string $engineName,
CrawlRequestOverridesParameters $crawl_request_overrides_parameters = null
) {
public function __construct(string $engineName, CrawlRequestOverrides $crawl_request_overrides = null)
{
$this->method = 'POST';
$engine_name = urlencode($engineName);
$this->path = "/api/as/v1/engines/$engine_name/crawler/crawl_requests";
$this->headers['Content-Type'] = 'application/json';
$this->body = $crawl_request_overrides_parameters;
$this->body = $crawl_request_overrides;
}
}
42 changes: 42 additions & 0 deletions src/AppSearch/Request/MultiSearch.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php

/**
* Elastic Enterprise Search
*
* @link https://github.com/elastic/enterprise-search-php
* @copyright Copyright (c) Elasticsearch B.V (https://www.elastic.co)
* @license https://opensource.org/licenses/MIT MIT License
*
* Licensed to Elasticsearch B.V under one or more agreements.
* Elasticsearch B.V licenses this file to you under the MIT License.
* See the LICENSE file in the project root for more information.
*/

declare(strict_types=1);

namespace Elastic\EnterpriseSearch\AppSearch\Request;

use Elastic\EnterpriseSearch\AppSearch\Schema\MultiSearchData;
use Elastic\EnterpriseSearch\Request\Request;

/**
* Submit a multi search
*
* @see https://www.elastic.co/guide/en/app-search/current/multi-search.html
* @generated This file is generated, please do not edit
*/
class MultiSearch extends Request
{
/**
* @param string $engineName Name of the engine
* @param MultiSearchData $multi_search_data
*/
public function __construct(string $engineName, MultiSearchData $multi_search_data = null)
{
$this->method = 'POST';
$engine_name = urlencode($engineName);
$this->path = "/api/as/v1/engines/$engine_name/multi_search";
$this->headers['Content-Type'] = 'application/json';
$this->body = $multi_search_data;
}
}
31 changes: 31 additions & 0 deletions src/AppSearch/Schema/CrawlRequestOverrides.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

/**
* Elastic Enterprise Search
*
* @link https://github.com/elastic/enterprise-search-php
* @copyright Copyright (c) Elasticsearch B.V (https://www.elastic.co)
* @license https://opensource.org/licenses/MIT MIT License
*
* Licensed to Elasticsearch B.V under one or more agreements.
* Elasticsearch B.V licenses this file to you under the MIT License.
* See the LICENSE file in the project root for more information.
*/

declare(strict_types=1);

namespace Elastic\EnterpriseSearch\AppSearch\Schema;

/**
* @generated This file is generated, please do not edit
*/
class CrawlRequestOverrides
{
public CrawlRequestOverridesParameters $overrides;


public function __construct(CrawlRequestOverridesParameters $overrides)
{
$this->overrides = $overrides;
}
}
11 changes: 11 additions & 0 deletions src/EnterpriseSearch/Endpoints.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,17 @@
*/
class Endpoints extends AbstractEndpoints
{
/**
* Retrieve information about search engines
*
* @see https://www.elastic.co/guide/en/enterprise-search/current/search-engines-apis.html
*/
public function getSearchEngines(Request\GetSearchEngines $request): Response
{
return new Response($this->transport->sendRequest($request->getRequest()));
}


/**
* Get information on the health of a deployment and basic statistics around resource usage
*
Expand Down
34 changes: 34 additions & 0 deletions src/EnterpriseSearch/Request/GetSearchEngines.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

/**
* Elastic Enterprise Search
*
* @link https://github.com/elastic/enterprise-search-php
* @copyright Copyright (c) Elasticsearch B.V (https://www.elastic.co)
* @license https://opensource.org/licenses/MIT MIT License
*
* Licensed to Elasticsearch B.V under one or more agreements.
* Elasticsearch B.V licenses this file to you under the MIT License.
* See the LICENSE file in the project root for more information.
*/

declare(strict_types=1);

namespace Elastic\EnterpriseSearch\EnterpriseSearch\Request;

use Elastic\EnterpriseSearch\Request\Request;

/**
* Retrieve information about search engines
*
* @see https://www.elastic.co/guide/en/enterprise-search/current/search-engines-apis.html
* @generated This file is generated, please do not edit
*/
class GetSearchEngines extends Request
{
public function __construct()
{
$this->method = 'GET';
$this->path = "/api/search_engines";
}
}
36 changes: 36 additions & 0 deletions src/EnterpriseSearch/Schema/ListSearchEnginesResponse.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

/**
* Elastic Enterprise Search
*
* @link https://github.com/elastic/enterprise-search-php
* @copyright Copyright (c) Elasticsearch B.V (https://www.elastic.co)
* @license https://opensource.org/licenses/MIT MIT License
*
* Licensed to Elasticsearch B.V under one or more agreements.
* Elasticsearch B.V licenses this file to you under the MIT License.
* See the LICENSE file in the project root for more information.
*/

declare(strict_types=1);

namespace Elastic\EnterpriseSearch\EnterpriseSearch\Schema;

/**
* @generated This file is generated, please do not edit
*/
class ListSearchEnginesResponse
{
public MetaPage $meta;
public array $results;


/**
* @param SearchEngine[] $results
*/
public function __construct(MetaPage $meta, array $results)
{
$this->meta = $meta;
$this->results = $results;
}
}
31 changes: 31 additions & 0 deletions src/EnterpriseSearch/Schema/MetaPage.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

/**
* Elastic Enterprise Search
*
* @link https://github.com/elastic/enterprise-search-php
* @copyright Copyright (c) Elasticsearch B.V (https://www.elastic.co)
* @license https://opensource.org/licenses/MIT MIT License
*
* Licensed to Elasticsearch B.V under one or more agreements.
* Elasticsearch B.V licenses this file to you under the MIT License.
* See the LICENSE file in the project root for more information.
*/

declare(strict_types=1);

namespace Elastic\EnterpriseSearch\EnterpriseSearch\Schema;

/**
* @generated This file is generated, please do not edit
*/
class MetaPage
{
public Page $page;


public function __construct(Page $page)
{
$this->page = $page;
}
}
37 changes: 37 additions & 0 deletions src/EnterpriseSearch/Schema/Page.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

/**
* Elastic Enterprise Search
*
* @link https://github.com/elastic/enterprise-search-php
* @copyright Copyright (c) Elasticsearch B.V (https://www.elastic.co)
* @license https://opensource.org/licenses/MIT MIT License
*
* Licensed to Elasticsearch B.V under one or more agreements.
* Elasticsearch B.V licenses this file to you under the MIT License.
* See the LICENSE file in the project root for more information.
*/

declare(strict_types=1);

namespace Elastic\EnterpriseSearch\EnterpriseSearch\Schema;

/**
* @generated This file is generated, please do not edit
*/
class Page
{
public int $current;
public int $total_pages;
public int $total_results;
public int $size;


public function __construct(int $current, int $total_pages, int $total_results, int $size)
{
$this->current = $current;
$this->total_pages = $total_pages;
$this->total_results = $total_results;
$this->size = $size;
}
}
38 changes: 38 additions & 0 deletions src/EnterpriseSearch/Schema/SearchEngine.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php

/**
* Elastic Enterprise Search
*
* @link https://github.com/elastic/enterprise-search-php
* @copyright Copyright (c) Elasticsearch B.V (https://www.elastic.co)
* @license https://opensource.org/licenses/MIT MIT License
*
* Licensed to Elasticsearch B.V under one or more agreements.
* Elasticsearch B.V licenses this file to you under the MIT License.
* See the LICENSE file in the project root for more information.
*/

declare(strict_types=1);

namespace Elastic\EnterpriseSearch\EnterpriseSearch\Schema;

/**
* @generated This file is generated, please do not edit
*/
class SearchEngine
{
public string $name;
public int $document_count;
public array $search_indices;


/**
* @param string[] $search_indices
*/
public function __construct(string $name, int $document_count, array $search_indices)
{
$this->name = $name;
$this->document_count = $document_count;
$this->search_indices = $search_indices;
}
}

0 comments on commit 7f4b892

Please sign in to comment.