@@ -13,7 +13,6 @@ import (
1313 "github.com/kernel/cli/pkg/util"
1414 kernel "github.com/kernel/kernel-go-sdk"
1515 "github.com/kernel/kernel-go-sdk/option"
16- "github.com/kernel/kernel-go-sdk/packages/param"
1716 "github.com/pterm/pterm"
1817)
1918
@@ -143,7 +142,7 @@ func (c VaultsCmd) ListItems(ctx context.Context, vault, output string) error {
143142 if err != nil {
144143 return err
145144 }
146- rows = append (rows , []string {item .Key , item .Type , item .Spec .Provider , item .State .Status , util .OrDash (actions .RequiredAction ), item . Description })
145+ rows = append (rows , []string {item .Key , item .Type , item .Spec .Provider , item .State .Status , util .OrDash (actions .RequiredAction ), vaultItemDescription ( & item ) })
147146 }
148147 PrintTableNoPad (rows , true )
149148 return nil
@@ -197,14 +196,16 @@ func (c VaultsCmd) SaveCard(ctx context.Context, vault, key string, spec kernel.
197196}
198197
199198func (c VaultsCmd ) CreatePaymentToken (ctx context.Context , vault , key string , spec map [string ]json.RawMessage , output string ) error {
200- body := map [string ]any {"type" : "payment_token" , "spec" : spec }
201- params := param.Override [kernel.VaultItemUpsertParams ](body )
202- params .IDOrName = vault
203- item , err := c .vaults .Items .Upsert (ctx , key , params , option .WithMaxRetries (0 ))
199+ body , err := json .Marshal (map [string ]any {"type" : "payment_token" , "spec" : spec })
200+ if err != nil {
201+ return err
202+ }
203+ var item kernel.VaultItemUnion
204+ _ , err = c .vaults .Items .Upsert (ctx , key , kernel.VaultItemUpsertParams {IDOrName : vault }, option .WithRequestBody ("application/json" , body ), option .WithResponseBodyInto (& item ), option .WithMaxRetries (0 ))
204205 if err != nil {
205206 return vaultPaymentTokenError (err )
206207 }
207- return c .showItem (item , output , false )
208+ return c .showItem (& item , output , false )
208209}
209210
210211func (c VaultsCmd ) Invoke (ctx context.Context , vault , key , operation string , spec map [string ]json.RawMessage , output string ) error {
@@ -240,8 +241,12 @@ func (c VaultsCmd) Invoke(ctx context.Context, vault, key, operation string, spe
240241 for name , value := range spec {
241242 body [name ] = value
242243 }
243- params := kernel.VaultItemPerformOperationParams {IDOrName : vault , FillVaultItemOperationRequest : param.Override [kernel.FillVaultItemOperationRequestParam ](body )}
244- result , err := c .vaults .Items .PerformOperation (ctx , key , params , option .WithMaxRetries (0 ))
244+ encoded , err := json .Marshal (body )
245+ if err != nil {
246+ return err
247+ }
248+ var result vaultFillOperationResult
249+ _ , err = c .vaults .Items .PerformOperation (ctx , key , kernel.VaultItemPerformOperationParams {IDOrName : vault , Type : kernel .VaultItemPerformOperationParamsType ("fill" )}, option .WithRequestBody ("application/json" , encoded ), option .WithResponseBodyInto (& result ), option .WithMaxRetries (0 ))
245250 if err != nil {
246251 return util.CleanedUpSdkError {Err : err }
247252 }
0 commit comments