@@ -685,6 +685,41 @@ export class Client<T extends BasicAuthorization | ResourceOwnerAuthorization> {
685
685
. post ( buildResourceUrl ( '' ) , { json : data } )
686
686
. json < Bundle > ( ) ;
687
687
} ,
688
+ conditionalUpdate : < T extends keyof ResourceTypeMap > (
689
+ resourceName : T ,
690
+ search : string ,
691
+ input : PartialResourceBody < T >
692
+ ) => {
693
+ return this . client
694
+ . patch ( `${ buildResourceUrl ( resourceName ) } ?${ search } ` , { json : input } )
695
+ . json < BaseResponseResource < T > > ( ) ;
696
+ } ,
697
+ conditionalCreate : < T extends keyof ResourceTypeMap > (
698
+ resourceName : T ,
699
+ search : string ,
700
+ input : PartialResourceBody < T >
701
+ ) => {
702
+ return this . client
703
+ . post ( `${ buildResourceUrl ( resourceName ) } ?${ search } ` , { json : input } )
704
+ . json < BaseResponseResource < T > > ( ) ;
705
+ } ,
706
+ conditionalOverride : < T extends keyof ResourceTypeMap > (
707
+ resourceName : T ,
708
+ search : string ,
709
+ input : PartialResourceBody < T >
710
+ ) => {
711
+ return this . client
712
+ . put ( `${ buildResourceUrl ( resourceName ) } ?${ search } ` , { json : input } )
713
+ . json < BaseResponseResource < T > > ( ) ;
714
+ } ,
715
+ conditionalDelete : < T extends keyof ResourceTypeMap > (
716
+ resourceName : T ,
717
+ search : string
718
+ ) => {
719
+ return this . client
720
+ . delete ( `${ buildResourceUrl ( resourceName ) } ?${ search } ` )
721
+ . json < BaseResponseResource < T > > ( ) ;
722
+ } ,
688
723
search : this . search ,
689
724
list : this . search ,
690
725
get : async < T extends keyof ResourceTypeMap > (
@@ -695,43 +730,35 @@ export class Client<T extends BasicAuthorization | ResourceOwnerAuthorization> {
695
730
. get ( buildResourceUrl ( resourceName , id ) )
696
731
. json < BaseResponseResource < T > > ( ) ;
697
732
} ,
698
- delete : async < T extends keyof ResourceTypeMap > (
733
+ delete : < T extends keyof ResourceTypeMap > (
699
734
resourceName : T ,
700
735
id : string ,
701
- ) : Promise < BaseResponseResource < T > > => {
702
- return new SearchResources < T > ( ( searchParams : URLSearchParams ) => {
703
- return this . client
704
- . delete ( buildResourceUrl ( resourceName , id ) , { searchParams } ) ;
705
- } , resourceName )
736
+ ) => {
737
+ return this . client
738
+ . delete ( buildResourceUrl ( resourceName , id ) ) ;
706
739
} ,
707
- update : async < T extends keyof ResourceTypeMap > (
740
+ update : < T extends keyof ResourceTypeMap > (
708
741
resourceName : T ,
709
742
id : string ,
710
743
input : PartialResourceBody < T > ,
711
- ) : Promise < BaseResponseResource < T > > => {
712
- return new SearchResources < T > ( ( searchParams : URLSearchParams ) => {
713
- return this . client
714
- . patch ( buildResourceUrl ( resourceName , id ) , { json : input , searchParams } ) ;
715
- } , resourceName )
744
+ ) => {
745
+ return this . client
746
+ . patch ( buildResourceUrl ( resourceName , id ) , { json : input } ) ;
716
747
} ,
717
- create : async < T extends keyof ResourceTypeMap > (
748
+ create : < T extends keyof ResourceTypeMap > (
718
749
resourceName : T ,
719
750
input : SetOptional < ResourceTypeMap [ T ] & { resourceType : string } , 'resourceType' > ,
720
- ) : Promise < BaseResponseResource < T > > => {
721
- return new SearchResources < T > ( ( searchParams : URLSearchParams ) => {
722
- return this . client
723
- . post ( buildResourceUrl ( resourceName ) , { json : input , searchParams } ) ;
724
- } , resourceName )
751
+ ) => {
752
+ return this . client
753
+ . post ( buildResourceUrl ( resourceName ) , { json : input } ) ;
725
754
} ,
726
- override : async < T extends keyof ResourceTypeMap > (
755
+ override : < T extends keyof ResourceTypeMap > (
727
756
resourceName : T ,
728
757
id : string ,
729
758
input : PartialResourceBody < T > ,
730
- ) : Promise < BaseResponseResource < T > > => {
731
- return new SearchResources < T > ( ( searchParams : URLSearchParams ) => {
732
- return this . client
733
- . put ( buildResourceUrl ( resourceName , id ) , { json : input , searchParams } ) ;
734
- } , resourceName )
759
+ ) => {
760
+ return this . client
761
+ . put ( buildResourceUrl ( resourceName , id ) , { json : input } ) ;
735
762
} ,
736
763
} ;
737
764
0 commit comments