@@ -254,11 +254,14 @@ public virtual async Task<PackageMetadata> GetPackageMetadataAsync(string packag
254
254
/// </param>
255
255
/// <param name="cancellationToken">A token to cancel the task.</param>
256
256
/// <returns>The search results, including prerelease packages.</returns>
257
- public virtual async Task < SearchResponse > SearchAsync ( string query = null , CancellationToken cancellationToken = default )
257
+ public virtual async Task < IReadOnlyList < SearchResult > > SearchAsync (
258
+ string query = null ,
259
+ CancellationToken cancellationToken = default )
258
260
{
259
261
var client = await _clientFactory . CreateSearchClientAsync ( cancellationToken ) ;
262
+ var response = await client . SearchAsync ( query , cancellationToken : cancellationToken ) ;
260
263
261
- return await client . SearchAsync ( query , cancellationToken : cancellationToken ) ;
264
+ return response . Data ;
262
265
}
263
266
264
267
/// <summary>
@@ -270,14 +273,18 @@ public virtual async Task<SearchResponse> SearchAsync(string query = null, Cance
270
273
/// <param name="includePrerelease">Whether to include prerelease packages.</param>
271
274
/// <param name="cancellationToken">A token to cancel the task.</param>
272
275
/// <returns>The search results.</returns>
273
- public virtual async Task < SearchResponse > SearchAsync ( string query , bool includePrerelease , CancellationToken cancellationToken = default )
276
+ public virtual async Task < IReadOnlyList < SearchResult > > SearchAsync (
277
+ string query ,
278
+ bool includePrerelease ,
279
+ CancellationToken cancellationToken = default )
274
280
{
275
281
var client = await _clientFactory . CreateSearchClientAsync ( cancellationToken ) ;
276
-
277
- return await client . SearchAsync (
282
+ var response = await client . SearchAsync (
278
283
query ,
279
284
includePrerelease : includePrerelease ,
280
285
cancellationToken : cancellationToken ) ;
286
+
287
+ return response . Data ;
281
288
}
282
289
283
290
/// <summary>
@@ -290,11 +297,20 @@ public virtual async Task<SearchResponse> SearchAsync(string query, bool include
290
297
/// <param name="take">The number of results to include.</param>
291
298
/// <param name="cancellationToken">A token to cancel the task.</param>
292
299
/// <returns>The search results, including prerelease packages.</returns>
293
- public virtual async Task < SearchResponse > SearchAsync ( string query , int skip , int take , CancellationToken cancellationToken = default )
300
+ public virtual async Task < IReadOnlyList < SearchResult > > SearchAsync (
301
+ string query ,
302
+ int skip ,
303
+ int take ,
304
+ CancellationToken cancellationToken = default )
294
305
{
295
306
var client = await _clientFactory . CreateSearchClientAsync ( cancellationToken ) ;
307
+ var response = await client . SearchAsync (
308
+ query ,
309
+ skip ,
310
+ take ,
311
+ cancellationToken : cancellationToken ) ;
296
312
297
- return await client . SearchAsync ( query , skip , take , cancellationToken : cancellationToken ) ;
313
+ return response . Data ;
298
314
}
299
315
300
316
/// <summary>
@@ -308,11 +324,23 @@ public virtual async Task<SearchResponse> SearchAsync(string query, int skip, in
308
324
/// <param name="take">The number of results to include.</param>
309
325
/// <param name="cancellationToken">A token to cancel the task.</param>
310
326
/// <returns>The search results, including prerelease packages.</returns>
311
- public virtual async Task < SearchResponse > SearchAsync ( string query , bool includePrerelease , int skip , int take , CancellationToken cancellationToken = default )
327
+ public virtual async Task < IReadOnlyList < SearchResult > > SearchAsync (
328
+ string query ,
329
+ bool includePrerelease ,
330
+ int skip ,
331
+ int take ,
332
+ CancellationToken cancellationToken = default )
312
333
{
313
334
var client = await _clientFactory . CreateSearchClientAsync ( cancellationToken ) ;
335
+ var response = await client . SearchAsync (
336
+ query ,
337
+ skip ,
338
+ take ,
339
+ includePrerelease ,
340
+ includeSemVer2 : true ,
341
+ cancellationToken ) ;
314
342
315
- return await client . SearchAsync ( query , skip , take , includePrerelease , includeSemVer2 : true , cancellationToken ) ;
343
+ return response . Data ;
316
344
}
317
345
318
346
/// <summary>
@@ -322,12 +350,15 @@ public virtual async Task<SearchResponse> SearchAsync(string query, bool include
322
350
/// The search query. If <see langword="null"/>, gets default autocomplete results.
323
351
/// </param>
324
352
/// <param name="cancellationToken">A token to cancel the task.</param>
325
- /// <returns>The autocomplete results.</returns>
326
- public virtual async Task < AutocompleteResponse > AutocompleteAsync ( string query = null , CancellationToken cancellationToken = default )
353
+ /// <returns>The package IDs that matched the query.</returns>
354
+ public virtual async Task < IReadOnlyList < string > > AutocompleteAsync (
355
+ string query = null ,
356
+ CancellationToken cancellationToken = default )
327
357
{
328
358
var client = await _clientFactory . CreateSearchClientAsync ( cancellationToken ) ;
359
+ var response = await client . AutocompleteAsync ( query , cancellationToken : cancellationToken ) ;
329
360
330
- return await client . AutocompleteAsync ( query , cancellationToken : cancellationToken ) ;
361
+ return response . Data ;
331
362
}
332
363
333
364
/// <summary>
@@ -339,16 +370,17 @@ public virtual async Task<AutocompleteResponse> AutocompleteAsync(string query =
339
370
/// <param name="skip">The number of results to skip.</param>
340
371
/// <param name="take">The number of results to include.</param>
341
372
/// <param name="cancellationToken">A token to cancel the task.</param>
342
- /// <returns>The autocomplete results .</returns>
343
- public virtual async Task < AutocompleteResponse > AutocompleteAsync ( string query , int skip , int take , CancellationToken cancellationToken = default )
373
+ /// <returns>The package IDs that matched the query .</returns>
374
+ public virtual async Task < IReadOnlyList < string > > AutocompleteAsync ( string query , int skip , int take , CancellationToken cancellationToken = default )
344
375
{
345
376
var client = await _clientFactory . CreateSearchClientAsync ( cancellationToken ) ;
346
-
347
- return await client . AutocompleteAsync (
377
+ var response = await client . AutocompleteAsync (
348
378
query ,
349
379
skip : skip ,
350
380
take : take ,
351
381
cancellationToken : cancellationToken ) ;
382
+
383
+ return response . Data ;
352
384
}
353
385
}
354
386
}
0 commit comments