@cryptotaxi247 / kubo / commits / 1bc854bf2

pin: handle Rm options

This commit was moved from ipfs/go-ipfs-http-client@e85e856ea2841cd3e0cf4cb7b87441539af42bbe

Łukasz Magiera committed Feb 4, 2019 at 19:53 UTC 1bc854bf2169f82d2275232e123adae721b8dc0a
1 file changed +9 -2
client/httpapi/pin.go
+9 -2
@@ -68,8 +68,15 @@ func (api *PinAPI) Ls(ctx context.Context, opts ...caopts.PinLsOption) ([]iface.
68 return pins, nil
69 }
70
71 -func (api *PinAPI) Rm(ctx context.Context, p iface.Path) error {
72 - return api.core().request("pin/rm", p.String()).Exec(ctx, nil)
71 +func (api *PinAPI) Rm(ctx context.Context, p iface.Path, opts ...caopts.PinRmOption) error {
72 + options, err := caopts.PinRmOptions(opts...)
73 + if err != nil {
74 + return err
75 + }
76 +
77 + return api.core().request("pin/rm", p.String()).
78 + Option("recursive", options.Recursive).
79 + Exec(ctx, nil)
80 }
81
82 func (api *PinAPI) Update(ctx context.Context, from iface.Path, to iface.Path, opts ...caopts.PinUpdateOption) error {