Skip to content

Commit

Permalink
fix(specs): getObject return object (#3446) (generated) [skip ci]
Browse files Browse the repository at this point in the history
Co-authored-by: Pierre Millot <pierre.millot@algolia.com>
  • Loading branch information
algolia-bot and millotp committed Jul 30, 2024
1 parent 8fbbd5e commit 3e90919
Show file tree
Hide file tree
Showing 13 changed files with 47 additions and 60 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -724,8 +724,8 @@ public interface ISearchClient
/// <exception cref="ArgumentException">Thrown when arguments are not correct</exception>
/// <exception cref="Algolia.Search.Exceptions.AlgoliaApiException">Thrown when the API call was rejected by Algolia</exception>
/// <exception cref="Algolia.Search.Exceptions.AlgoliaUnreachableHostException">Thrown when the client failed to call the endpoint</exception>
/// <returns>Task of Dictionary{string, string}</returns>
Task<Dictionary<string, string>> GetObjectAsync(string indexName, string objectID, List<string> attributesToRetrieve = default, RequestOptions options = null, CancellationToken cancellationToken = default);
/// <returns>Task of object</returns>
Task<object> GetObjectAsync(string indexName, string objectID, List<string> attributesToRetrieve = default, RequestOptions options = null, CancellationToken cancellationToken = default);

/// <summary>
/// Retrieves one record by its object ID. To retrieve more than one record, use the [`objects` operation](#tag/Records/operation/getObjects). (Synchronous version)
Expand All @@ -738,8 +738,8 @@ public interface ISearchClient
/// <exception cref="ArgumentException">Thrown when arguments are not correct</exception>
/// <exception cref="Algolia.Search.Exceptions.AlgoliaApiException">Thrown when the API call was rejected by Algolia</exception>
/// <exception cref="Algolia.Search.Exceptions.AlgoliaUnreachableHostException">Thrown when the client failed to call the endpoint</exception>
/// <returns>Dictionary{string, string}</returns>
Dictionary<string, string> GetObject(string indexName, string objectID, List<string> attributesToRetrieve = default, RequestOptions options = null, CancellationToken cancellationToken = default);
/// <returns>object</returns>
object GetObject(string indexName, string objectID, List<string> attributesToRetrieve = default, RequestOptions options = null, CancellationToken cancellationToken = default);

/// <summary>
/// Retrieves one or more records, potentially from different indices. Records are returned in the same order as the requests.
Expand Down Expand Up @@ -2929,8 +2929,8 @@ public GetLogsResponse GetLogs(int? offset = default, int? length = default, str
/// <exception cref="ArgumentException">Thrown when arguments are not correct</exception>
/// <exception cref="Algolia.Search.Exceptions.AlgoliaApiException">Thrown when the API call was rejected by Algolia</exception>
/// <exception cref="Algolia.Search.Exceptions.AlgoliaUnreachableHostException">Thrown when the client failed to call the endpoint</exception>
/// <returns>Task of Dictionary{string, string}</returns>
public async Task<Dictionary<string, string>> GetObjectAsync(string indexName, string objectID, List<string> attributesToRetrieve = default, RequestOptions options = null, CancellationToken cancellationToken = default)
/// <returns>Task of object</returns>
public async Task<object> GetObjectAsync(string indexName, string objectID, List<string> attributesToRetrieve = default, RequestOptions options = null, CancellationToken cancellationToken = default)
{

if (indexName == null)
Expand All @@ -2946,7 +2946,7 @@ public async Task<Dictionary<string, string>> GetObjectAsync(string indexName, s
requestOptions.PathParameters.Add("objectID", QueryStringHelper.ParameterToString(objectID));

requestOptions.AddQueryParameter("attributesToRetrieve", attributesToRetrieve);
return await _transport.ExecuteRequestAsync<Dictionary<string, string>>(new HttpMethod("GET"), "/1/indexes/{indexName}/{objectID}", requestOptions, cancellationToken).ConfigureAwait(false);
return await _transport.ExecuteRequestAsync<object>(new HttpMethod("GET"), "/1/indexes/{indexName}/{objectID}", requestOptions, cancellationToken).ConfigureAwait(false);
}


Expand All @@ -2964,8 +2964,8 @@ public async Task<Dictionary<string, string>> GetObjectAsync(string indexName, s
/// <exception cref="ArgumentException">Thrown when arguments are not correct</exception>
/// <exception cref="Algolia.Search.Exceptions.AlgoliaApiException">Thrown when the API call was rejected by Algolia</exception>
/// <exception cref="Algolia.Search.Exceptions.AlgoliaUnreachableHostException">Thrown when the client failed to call the endpoint</exception>
/// <returns>Dictionary{string, string}</returns>
public Dictionary<string, string> GetObject(string indexName, string objectID, List<string> attributesToRetrieve = default, RequestOptions options = null, CancellationToken cancellationToken = default) =>
/// <returns>object</returns>
public object GetObject(string indexName, string objectID, List<string> attributesToRetrieve = default, RequestOptions options = null, CancellationToken cancellationToken = default) =>
AsyncHelper.RunSync(() => GetObjectAsync(indexName, objectID, attributesToRetrieve, options, cancellationToken));


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1051,7 +1051,7 @@ final class SearchClient implements ApiClient {
/// * [objectID] Unique record identifier.
/// * [attributesToRetrieve] Attributes to include with the records in the response. This is useful to reduce the size of the API response. By default, all retrievable attributes are returned. `objectID` is always retrieved. Attributes included in `unretrievableAttributes` won't be retrieved unless the request is authenticated with the admin API key.
/// * [requestOptions] additional request configuration.
Future<Map<String, String>> getObject({
Future<Object> getObject({
required String indexName,
required String objectID,
List<String>? attributesToRetrieve,
Expand Down Expand Up @@ -1081,9 +1081,9 @@ final class SearchClient implements ApiClient {
request: request,
options: requestOptions,
);
return deserialize<Map<String, String>, String>(
return deserialize<Object, Object>(
response,
'Map<String, String>',
'Object',
growable: true,
);
}
Expand Down
6 changes: 3 additions & 3 deletions clients/algoliasearch-client-go/algolia/search/api_search.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -2383,7 +2383,7 @@ public CompletableFuture<GetLogsResponse> getLogsAsync() throws AlgoliaRuntimeEx
* the transporter requestOptions.
* @throws AlgoliaRuntimeException If it fails to process the API call
*/
public Map<String, String> getObject(
public Object getObject(
@Nonnull String indexName,
@Nonnull String objectID,
List<String> attributesToRetrieve,
Expand All @@ -2404,7 +2404,7 @@ public Map<String, String> getObject(
* won't be retrieved unless the request is authenticated with the admin API key. (optional)
* @throws AlgoliaRuntimeException If it fails to process the API call
*/
public Map<String, String> getObject(@Nonnull String indexName, @Nonnull String objectID, List<String> attributesToRetrieve)
public Object getObject(@Nonnull String indexName, @Nonnull String objectID, List<String> attributesToRetrieve)
throws AlgoliaRuntimeException {
return this.getObject(indexName, objectID, attributesToRetrieve, null);
}
Expand All @@ -2419,7 +2419,7 @@ public Map<String, String> getObject(@Nonnull String indexName, @Nonnull String
* the transporter requestOptions.
* @throws AlgoliaRuntimeException If it fails to process the API call
*/
public Map<String, String> getObject(@Nonnull String indexName, @Nonnull String objectID, RequestOptions requestOptions)
public Object getObject(@Nonnull String indexName, @Nonnull String objectID, RequestOptions requestOptions)
throws AlgoliaRuntimeException {
return this.getObject(indexName, objectID, null, requestOptions);
}
Expand All @@ -2432,7 +2432,7 @@ public Map<String, String> getObject(@Nonnull String indexName, @Nonnull String
* @param objectID Unique record identifier. (required)
* @throws AlgoliaRuntimeException If it fails to process the API call
*/
public Map<String, String> getObject(@Nonnull String indexName, @Nonnull String objectID) throws AlgoliaRuntimeException {
public Object getObject(@Nonnull String indexName, @Nonnull String objectID) throws AlgoliaRuntimeException {
return this.getObject(indexName, objectID, null, null);
}

Expand All @@ -2450,7 +2450,7 @@ public Map<String, String> getObject(@Nonnull String indexName, @Nonnull String
* the transporter requestOptions.
* @throws AlgoliaRuntimeException If it fails to process the API call
*/
public CompletableFuture<Map<String, String>> getObjectAsync(
public CompletableFuture<Object> getObjectAsync(
@Nonnull String indexName,
@Nonnull String objectID,
List<String> attributesToRetrieve,
Expand All @@ -2465,7 +2465,7 @@ public CompletableFuture<Map<String, String>> getObjectAsync(
.setMethod("GET")
.addQueryParameter("attributesToRetrieve", attributesToRetrieve)
.build();
return executeAsync(request, requestOptions, new TypeReference<Map<String, String>>() {});
return executeAsync(request, requestOptions, new TypeReference<Object>() {});
}

/**
Expand All @@ -2480,11 +2480,8 @@ public CompletableFuture<Map<String, String>> getObjectAsync(
* won't be retrieved unless the request is authenticated with the admin API key. (optional)
* @throws AlgoliaRuntimeException If it fails to process the API call
*/
public CompletableFuture<Map<String, String>> getObjectAsync(
@Nonnull String indexName,
@Nonnull String objectID,
List<String> attributesToRetrieve
) throws AlgoliaRuntimeException {
public CompletableFuture<Object> getObjectAsync(@Nonnull String indexName, @Nonnull String objectID, List<String> attributesToRetrieve)
throws AlgoliaRuntimeException {
return this.getObjectAsync(indexName, objectID, attributesToRetrieve, null);
}

Expand All @@ -2498,11 +2495,8 @@ public CompletableFuture<Map<String, String>> getObjectAsync(
* the transporter requestOptions.
* @throws AlgoliaRuntimeException If it fails to process the API call
*/
public CompletableFuture<Map<String, String>> getObjectAsync(
@Nonnull String indexName,
@Nonnull String objectID,
RequestOptions requestOptions
) throws AlgoliaRuntimeException {
public CompletableFuture<Object> getObjectAsync(@Nonnull String indexName, @Nonnull String objectID, RequestOptions requestOptions)
throws AlgoliaRuntimeException {
return this.getObjectAsync(indexName, objectID, null, requestOptions);
}

Expand All @@ -2514,8 +2508,7 @@ public CompletableFuture<Map<String, String>> getObjectAsync(
* @param objectID Unique record identifier. (required)
* @throws AlgoliaRuntimeException If it fails to process the API call
*/
public CompletableFuture<Map<String, String>> getObjectAsync(@Nonnull String indexName, @Nonnull String objectID)
throws AlgoliaRuntimeException {
public CompletableFuture<Object> getObjectAsync(@Nonnull String indexName, @Nonnull String objectID) throws AlgoliaRuntimeException {
return this.getObjectAsync(indexName, objectID, null, null);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1837,7 +1837,7 @@ export function createSearchClient({
getObject(
{ indexName, objectID, attributesToRetrieve }: GetObjectProps,
requestOptions?: RequestOptions
): Promise<Record<string, string>> {
): Promise<Record<string, any>> {
if (!indexName) {
throw new Error(
'Parameter `indexName` is required when calling `getObject`.'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ public class SearchClient(
* @param attributesToRetrieve Attributes to include with the records in the response. This is useful to reduce the size of the API response. By default, all retrievable attributes are returned. `objectID` is always retrieved. Attributes included in `unretrievableAttributes` won't be retrieved unless the request is authenticated with the admin API key.
* @param requestOptions additional request configuration.
*/
public suspend fun getObject(indexName: String, objectID: String, attributesToRetrieve: List<String>? = null, requestOptions: RequestOptions? = null): Map<kotlin.String, String> {
public suspend fun getObject(indexName: String, objectID: String, attributesToRetrieve: List<String>? = null, requestOptions: RequestOptions? = null): JsonObject {
require(indexName.isNotBlank()) { "Parameter `indexName` is required when calling `getObject`." }
require(objectID.isNotBlank()) { "Parameter `objectID` is required when calling `getObject`." }
val requestConfig = RequestConfig(
Expand Down
2 changes: 1 addition & 1 deletion clients/algoliasearch-client-php/lib/Api/SearchClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -1263,7 +1263,7 @@ public function getLogs($offset = null, $length = null, $indexName = null, $type
* @param array $attributesToRetrieve Attributes to include with the records in the response. This is useful to reduce the size of the API response. By default, all retrievable attributes are returned. &#x60;objectID&#x60; is always retrieved. Attributes included in &#x60;unretrievableAttributes&#x60; won&#39;t be retrieved unless the request is authenticated with the admin API key. (optional)
* @param array $requestOptions the requestOptions to send along with the query, they will be merged with the transporter requestOptions
*
* @return array<string, mixed>|array<string,string>
* @return array<string, mixed>|object
*/
public function getObject($indexName, $objectID, $attributesToRetrieve = null, $requestOptions = [])
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2606,7 +2606,7 @@ async def get_object(
),
] = None,
request_options: Optional[Union[dict, RequestOptions]] = None,
) -> Dict[str, str]:
) -> object:
"""
Retrieves one record by its object ID. To retrieve more than one record, use the [`objects` operation](#tag/Records/operation/getObjects).
Expand All @@ -2620,13 +2620,13 @@ async def get_object(
:param attributes_to_retrieve: Attributes to include with the records in the response. This is useful to reduce the size of the API response. By default, all retrievable attributes are returned. `objectID` is always retrieved. Attributes included in `unretrievableAttributes` won't be retrieved unless the request is authenticated with the admin API key.
:type attributes_to_retrieve: List[str]
:param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)
:return: Returns the deserialized response in a 'Dict[str, str]' result object.
:return: Returns the deserialized response in a 'object' result object.
"""
return (
await self.get_object_with_http_info(
index_name, object_id, attributes_to_retrieve, request_options
)
).deserialize(Dict[str, str])
).deserialize(object)

async def get_objects_with_http_info(
self,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1389,10 +1389,10 @@ def get_object_with_http_info(index_name, object_id, attributes_to_retrieve = ni
# @param object_id [String] Unique record identifier. (required)
# @param attributes_to_retrieve [Array<String>] Attributes to include with the records in the response. This is useful to reduce the size of the API response. By default, all retrievable attributes are returned. &#x60;objectID&#x60; is always retrieved. Attributes included in &#x60;unretrievableAttributes&#x60; won&#39;t be retrieved unless the request is authenticated with the admin API key.
# @param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)
# @return [Hash<String, String>]
# @return [Object]
def get_object(index_name, object_id, attributes_to_retrieve = nil, request_options = {})
response = get_object_with_http_info(index_name, object_id, attributes_to_retrieve, request_options)
@api_client.deserialize(response.body, request_options[:debug_return_type] || "Search::Hash<String, String>")
@api_client.deserialize(response.body, request_options[:debug_return_type] || "Search::Object")
end

# Retrieves one or more records, potentially from different indices. Records are returned in the same order as the requests.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,7 @@ class SearchClient(
objectID: String,
attributesToRetrieve: Option[Seq[String]] = None,
requestOptions: Option[RequestOptions] = None
)(implicit ec: ExecutionContext): Future[Map[String, String]] = Future {
)(implicit ec: ExecutionContext): Future[Any] = Future {
requireNotNull(indexName, "Parameter `indexName` is required when calling `getObject`.")
requireNotNull(objectID, "Parameter `objectID` is required when calling `getObject`.")

Expand All @@ -836,7 +836,7 @@ class SearchClient(
.withPath(s"/1/indexes/${escape(indexName)}/${escape(objectID)}")
.withQueryParameter("attributesToRetrieve", attributesToRetrieve)
.build()
execute[Map[String, String]](request, requestOptions)
execute[Any](request, requestOptions)
}

/** Retrieves one or more records, potentially from different indices. Records are returned in the same order as the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1726,15 +1726,15 @@ open class SearchClient {
/// to reduce the size of the API response. By default, all retrievable attributes are returned. `objectID` is
/// always retrieved. Attributes included in `unretrievableAttributes` won't be retrieved unless the request is
/// authenticated with the admin API key. (optional)
/// - returns: [String: String]
/// - returns: AnyCodable
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open func getObject(
indexName: String,
objectID: String,
attributesToRetrieve: [String]? = nil,
requestOptions: RequestOptions? = nil
) async throws -> [String: String] {
let response: Response<[String: String]> = try await getObjectWithHTTPInfo(
) async throws -> AnyCodable {
let response: Response<AnyCodable> = try await getObjectWithHTTPInfo(
indexName: indexName,
objectID: objectID,
attributesToRetrieve: attributesToRetrieve,
Expand Down Expand Up @@ -1762,14 +1762,14 @@ open class SearchClient {
// always
// retrieved. Attributes included in `unretrievableAttributes` won't be retrieved unless the request is
// authenticated with the admin API key. (optional)
// - returns: RequestBuilder<[String: String]>
// - returns: RequestBuilder<AnyCodable>

open func getObjectWithHTTPInfo(
indexName: String,
objectID: String,
attributesToRetrieve: [String]? = nil,
requestOptions userRequestOptions: RequestOptions? = nil
) async throws -> Response<[String: String]> {
) async throws -> Response<AnyCodable> {
guard !indexName.isEmpty else {
throw AlgoliaError.invalidArgument("indexName", "getObject")
}
Expand Down
Loading

0 comments on commit 3e90919

Please sign in to comment.