typedapi-client-helpers 0.1.13 → 0.1.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/package.json +1 -1
- package/scripts/generate-api-minimal.mjs +15 -8
package/dist/index.d.cts
CHANGED
|
@@ -189,9 +189,9 @@ type ApiMethodCallbacks<TResponse> = {
|
|
|
189
189
|
params?: RequestParams;
|
|
190
190
|
};
|
|
191
191
|
|
|
192
|
-
type ApiMethodOptions<
|
|
193
|
-
onSuccess?: ApiSuccessHandler<
|
|
194
|
-
onError?: ApiErrorHandler<
|
|
192
|
+
type ApiMethodOptions<TResponse, TError = unknown, TRequestParams = RuntimeRequestParams> = {
|
|
193
|
+
onSuccess?: ApiSuccessHandler<TResponse>;
|
|
194
|
+
onError?: ApiErrorHandler<TError>;
|
|
195
195
|
params?: TRequestParams;
|
|
196
196
|
};
|
|
197
197
|
|
package/dist/index.d.ts
CHANGED
|
@@ -189,9 +189,9 @@ type ApiMethodCallbacks<TResponse> = {
|
|
|
189
189
|
params?: RequestParams;
|
|
190
190
|
};
|
|
191
191
|
|
|
192
|
-
type ApiMethodOptions<
|
|
193
|
-
onSuccess?: ApiSuccessHandler<
|
|
194
|
-
onError?: ApiErrorHandler<
|
|
192
|
+
type ApiMethodOptions<TResponse, TError = unknown, TRequestParams = RuntimeRequestParams> = {
|
|
193
|
+
onSuccess?: ApiSuccessHandler<TResponse>;
|
|
194
|
+
onError?: ApiErrorHandler<TError>;
|
|
195
195
|
params?: TRequestParams;
|
|
196
196
|
};
|
|
197
197
|
|
package/package.json
CHANGED
|
@@ -575,7 +575,8 @@ export async function ${methodName}(
|
|
|
575
575
|
> | null = null,
|
|
576
576
|
sortDirection?: SortDirection,
|
|
577
577
|
options: ApiMethodOptions<
|
|
578
|
-
ReturnType<${className}["${methodName}"]
|
|
578
|
+
ExtractResponse<ReturnType<${className}["${methodName}"]>>,
|
|
579
|
+
ExtractError<ReturnType<${className}["${methodName}"]>>,
|
|
579
580
|
RequestParams
|
|
580
581
|
> = {}
|
|
581
582
|
): Promise<ApiResult<ExtractResponse<ReturnType<${className}["${methodName}"]>>>> {
|
|
@@ -604,7 +605,8 @@ export async function ${methodName}(
|
|
|
604
605
|
export async function ${methodName}(
|
|
605
606
|
query?: ${toQueryName(methodName)},
|
|
606
607
|
options: ApiMethodOptions<
|
|
607
|
-
ReturnType<${className}["${methodName}"]
|
|
608
|
+
ExtractResponse<ReturnType<${className}["${methodName}"]>>,
|
|
609
|
+
ExtractError<ReturnType<${className}["${methodName}"]>>,
|
|
608
610
|
RequestParams
|
|
609
611
|
> = {}
|
|
610
612
|
): Promise<ApiResult<ExtractResponse<ReturnType<${className}["${methodName}"]>>>> {
|
|
@@ -629,7 +631,8 @@ export async function ${methodName}(
|
|
|
629
631
|
export async function ${methodName}(
|
|
630
632
|
query?: ${toQueryName(methodName)},
|
|
631
633
|
options: ApiMethodOptions<
|
|
632
|
-
ReturnType<${className}["${methodName}"]
|
|
634
|
+
ExtractResponse<ReturnType<${className}["${methodName}"]>>,
|
|
635
|
+
ExtractError<ReturnType<${className}["${methodName}"]>>,
|
|
633
636
|
RequestParams
|
|
634
637
|
> = {}
|
|
635
638
|
): Promise<
|
|
@@ -665,7 +668,8 @@ export async function ${methodName}(
|
|
|
665
668
|
${className}["${methodName}"]
|
|
666
669
|
>[0],
|
|
667
670
|
options: ApiMethodOptions<
|
|
668
|
-
ReturnType<${className}["${methodName}"]
|
|
671
|
+
ExtractResponse<ReturnType<${className}["${methodName}"]>>,
|
|
672
|
+
ExtractError<ReturnType<${className}["${methodName}"]>>,
|
|
669
673
|
RequestParams
|
|
670
674
|
> = {}
|
|
671
675
|
): Promise<
|
|
@@ -702,7 +706,8 @@ export async function ${methodName}(
|
|
|
702
706
|
RequestParams
|
|
703
707
|
>,
|
|
704
708
|
ApiMethodOptions<
|
|
705
|
-
ReturnType<${className}["${methodName}"]
|
|
709
|
+
ExtractResponse<ReturnType<${className}["${methodName}"]>>,
|
|
710
|
+
ExtractError<ReturnType<${className}["${methodName}"]>>,
|
|
706
711
|
RequestParams
|
|
707
712
|
>?
|
|
708
713
|
]
|
|
@@ -720,9 +725,10 @@ export async function ${methodName}(
|
|
|
720
725
|
const options =
|
|
721
726
|
args.length > ${methodArgumentCount}
|
|
722
727
|
? (args.pop() as ApiMethodOptions<
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
728
|
+
ExtractResponse<ReturnType<${className}["${methodName}"]>>,
|
|
729
|
+
ExtractError<ReturnType<${className}["${methodName}"]>>,
|
|
730
|
+
RequestParams
|
|
731
|
+
>)
|
|
726
732
|
: {};
|
|
727
733
|
|
|
728
734
|
const { onSuccess, onError, params } = options ?? {};
|
|
@@ -757,6 +763,7 @@ export async function ${methodName}(
|
|
|
757
763
|
"ApiMethodOptions",
|
|
758
764
|
...(hasRegularNonQueryMethods ? ["ApiMethodArguments"] : []),
|
|
759
765
|
"ExtractResponse",
|
|
766
|
+
"ExtractError",
|
|
760
767
|
|
|
761
768
|
...(hasPaginatedMethods && useFilterFormValues
|
|
762
769
|
? [
|