@@ -3,8 +3,8 @@ import type { Strapi5ResponseSingle, Strapi5RequestParams, Strapi5ResponseMany }
33import { useStrapiClient } from '#imports'
44
55interface StrapiV5Client < T > {
6- find < F = T > ( contentType : string , params ?: Strapi5RequestParams ) : Promise < Strapi5ResponseMany < F > >
7- findOne < F = T > ( contentType : string , documentId ?: string | Strapi5RequestParams , params ?: Strapi5RequestParams ) : Promise < Strapi5ResponseSingle < F > >
6+ find < F = T > ( contentType : string , params ?: Strapi5RequestParams < F > ) : Promise < Strapi5ResponseMany < F > >
7+ findOne < F = T > ( contentType : string , documentId ?: string | Strapi5RequestParams < F > , params ?: Strapi5RequestParams < F > ) : Promise < Strapi5ResponseSingle < F > >
88 create < F = T > ( contentType : string , data : Partial < F > ) : Promise < Strapi5ResponseSingle < F > >
99 update < F = T > ( contentType : string , documentId : string | Partial < F > , data ?: Partial < F > ) : Promise < Strapi5ResponseSingle < F > >
1010 delete < F = T > ( contentType : string , documentId ?: string ) : Promise < Strapi5ResponseSingle < F > >
@@ -17,10 +17,10 @@ export const useStrapi = <T>(): StrapiV5Client<T> => {
1717 * Get a list of {content-type} entries
1818 *
1919 * @param {string } contentType - Content type's name pluralized
20- * @param {Strapi5RequestParams } [params] - Query parameters
20+ * @param {Strapi5RequestParams<T> } [params] - Query parameters
2121 * @returns Promise<T>
2222 */
23- const find = < T > ( contentType : string , params ?: Strapi5RequestParams , fetchOptions ?: FetchOptions ) : Promise < Strapi5ResponseMany < T > > => {
23+ const find = < T > ( contentType : string , params ?: Strapi5RequestParams < T > , fetchOptions ?: FetchOptions ) : Promise < Strapi5ResponseMany < T > > => {
2424 return client ( `/${ contentType } ` , { method : 'GET' , params, ...fetchOptions } )
2525 }
2626
@@ -29,10 +29,10 @@ export const useStrapi = <T>(): StrapiV5Client<T> => {
2929 *
3030 * @param {string } contentType - Content type's name pluralized
3131 * @param {string } documentId - ID of entry
32- * @param {Strapi5RequestParams } [params] - Query parameters
32+ * @param {Strapi5RequestParams<T> } [params] - Query parameters
3333 * @returns Promise<T>
3434 */
35- const findOne = < T > ( contentType : string , documentId ?: string | Strapi5RequestParams , params ?: Strapi5RequestParams , fetchOptions ?: FetchOptions ) : Promise < Strapi5ResponseSingle < T > > => {
35+ const findOne = < T > ( contentType : string , documentId ?: string | Strapi5RequestParams < T > , params ?: Strapi5RequestParams < T > , fetchOptions ?: FetchOptions ) : Promise < Strapi5ResponseSingle < T > > => {
3636 if ( typeof documentId === 'object' ) {
3737 params = documentId
3838 documentId = undefined
@@ -48,10 +48,10 @@ export const useStrapi = <T>(): StrapiV5Client<T> => {
4848 *
4949 * @param {string } contentType - Content type's name pluralized
5050 * @param {Record<string, any> } data - Form data
51- * @param {Strapi5RequestParams } [params] - Query parameters
51+ * @param {Strapi5RequestParams<T> } [params] - Query parameters
5252 * @returns Promise<T>
5353 */
54- const create = < T > ( contentType : string , data : Partial < T > , params : Strapi5RequestParams = { } ) : Promise < Strapi5ResponseSingle < T > > => {
54+ const create = < T > ( contentType : string , data : Partial < T > , params : Strapi5RequestParams < T > = { } ) : Promise < Strapi5ResponseSingle < T > > => {
5555 return client ( `/${ contentType } ` , { method : 'POST' , body : { data } , params } )
5656 }
5757
@@ -61,10 +61,10 @@ export const useStrapi = <T>(): StrapiV5Client<T> => {
6161 * @param {string } contentType - Content type's name pluralized
6262 * @param {string } documentId - ID of entry to be updated
6363 * @param {Record<string, any> } data - Form data
64- * @param {Strapi5RequestParams } [params] - Query parameters
64+ * @param {Strapi5RequestParams<T> } [params] - Query parameters
6565 * @returns Promise<T>
6666 */
67- const update = < T > ( contentType : string , documentId : string | Partial < T > , data ?: Partial < T > , params : Strapi5RequestParams = { } ) : Promise < Strapi5ResponseSingle < T > > => {
67+ const update = < T > ( contentType : string , documentId : string | Partial < T > , data ?: Partial < T > , params : Strapi5RequestParams < T > = { } ) : Promise < Strapi5ResponseSingle < T > > => {
6868 if ( typeof documentId === 'object' ) {
6969 data = documentId
7070 documentId = undefined
0 commit comments