@@ -75,7 +75,7 @@ function MyComponent() {
7575
7676### Functions
7777
78- #### ` getAbilities(category?: string ): Promise<Ability[]> `
78+ #### ` getAbilities( args: AbilitiesQueryArgs = {} ): Promise<Ability[]> `
7979
8080Returns all registered abilities. Optionally filter by category slug. Automatically handles pagination to fetch all abilities across multiple pages if needed.
8181
@@ -85,11 +85,11 @@ const abilities = await getAbilities();
8585console .log ( ` Found ${ abilities .length } abilities` );
8686
8787// Get abilities in a specific category
88- const dataAbilities = await getAbilities ( ' data-retrieval' );
88+ const dataAbilities = await getAbilities ( { category : ' data-retrieval' } );
8989console .log ( ` Found ${ dataAbilities .length } data retrieval abilities` );
9090```
9191
92- #### ` getAbility(name: string): Promise<Ability | null> `
92+ #### ` getAbility( name: string ): Promise<Ability | null> `
9393
9494Returns a specific ability by name, or null if not found.
9595
@@ -100,7 +100,7 @@ if ( ability ) {
100100}
101101```
102102
103- #### ` registerAbility(ability: Ability): void `
103+ #### ` registerAbility( ability: Ability ): void `
104104
105105Registers a client-side ability. Client abilities are executed locally in the browser and must include a callback function and a valid category.
106106
@@ -115,18 +115,18 @@ registerAbility( {
115115 input_schema: {
116116 type: ' object' ,
117117 properties: {
118- url: { type: ' string' }
118+ url: { type: ' string' },
119119 },
120- required: [ ' url' ]
120+ required: [ ' url' ],
121121 },
122122 callback: async ( { url } ) => {
123123 window .location .href = url;
124124 return { success: true };
125- }
125+ },
126126} );
127127```
128128
129- #### ` executeAbility(name: string, input?: Record<string, any>): Promise<any> `
129+ #### ` executeAbility( name: string, input?: Record<string, any> ): Promise<any> `
130130
131131Executes an ability with optional input parameters. The HTTP method is automatically determined based on the ability's annotations:
132132
@@ -150,8 +150,8 @@ const result = await executeAbility( 'my-plugin/create-item', {
150150
151151When using with ` @wordpress/data ` :
152152
153- - ` getAbilities(category? ) ` - Returns all abilities from the store, optionally filtered by category
154- - ` getAbility(name) ` - Returns a specific ability from the store
153+ - ` getAbilities( args: AbilitiesQueryArgs = {} ) ` - Returns all abilities from the store, optionally filtered by query arguments
154+ - ` getAbility( name: string ) ` - Returns a specific ability from the store
155155
156156``` javascript
157157import { useSelect } from ' @wordpress/data' ;
@@ -166,7 +166,8 @@ function MyComponent() {
166166
167167 // Get abilities in a specific category
168168 const dataAbilities = useSelect (
169- ( select ) => select ( abilitiesStore ).getAbilities ( ' data-retrieval' ),
169+ ( select ) =>
170+ select ( abilitiesStore ).getAbilities ( { category: ' data-retrieval' } ),
170171 []
171172 );
172173
0 commit comments