File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -17,13 +17,18 @@ export interface SearchParams extends DefaultPaginationParams {
1717}
1818
1919export interface SearchRepository {
20+ /**
21+ * @deprecated Use `list` instead
22+ */
23+ fetch ( params : SearchParams , meta ?: HttpMetaParams ) : Search ;
24+
2025 /**
2126 * Search, but hashtags is an array of strings instead of an array of Tag.
2227 * @param params Parameters
2328 * @return Results
2429 * @see https://docs.joinmastodon.org/methods/search/
2530 */
26- fetch (
31+ list (
2732 params : SearchParams ,
2833 meta ?: HttpMetaParams ,
2934 ) : Paginator < Search , SearchParams > ;
Original file line number Diff line number Diff line change @@ -21,13 +21,18 @@ export interface SearchParams extends DefaultPaginationParams {
2121}
2222
2323export interface SearchRepository {
24+ /**
25+ * @deprecated Use `list` instead
26+ */
27+ fetch ( params : SearchParams , meta ?: HttpMetaParams ) : Search ;
28+
2429 /**
2530 * Perform a search
2631 * @param params Parameters
2732 * @return Results
2833 * @see https://docs.joinmastodon.org/methods/search/
2934 */
30- fetch (
35+ list (
3136 params : SearchParams ,
3237 meta ?: HttpMetaParams ,
3338 ) : Paginator < Search , SearchParams > ;
Original file line number Diff line number Diff line change 11it ( "searches" , async ( ) => {
22 await using session = await sessions . acquire ( ) ;
3- const results = await session . rest . v2 . search . fetch ( {
3+ const results = await session . rest . v2 . search . list ( {
44 q : "mastodon" ,
55 } ) ;
66
@@ -10,3 +10,19 @@ it("searches", async () => {
1010 hashtags : expect . any ( Array ) ,
1111 } ) ;
1212} ) ;
13+
14+ it ( "can be iterated over" , async ( ) => {
15+ await using session = await sessions . acquire ( ) ;
16+ const results = session . rest . v2 . search . list ( {
17+ q : "mastodon" ,
18+ } ) ;
19+
20+ const p1 = await results . next ( ) ;
21+
22+ expect ( typeof p1 . done ) . toBe ( "boolean" ) ;
23+ expect ( p1 . value ) . toMatchObject ( {
24+ accounts : expect . any ( Array ) ,
25+ statuses : expect . any ( Array ) ,
26+ hashtags : expect . any ( Array ) ,
27+ } ) ;
28+ } ) ;
You can’t perform that action at this time.
0 commit comments