ipfs / kubo

An IPFS implementation in Go
https://docs.ipfs.tech/how-to/command-line-quick-start/
Other
15.9k stars 2.98k forks source link

kubo/client/rpc: drop/rework functional options #9972

Open hsanjuan opened 4 years ago

hsanjuan commented 4 years ago

This is the developer journey for wanting to do something with the core API:

I want to list direct pins:

https://godoc.org/github.com/ipfs/interface-go-ipfs-core#PinAPI

Seems PinLs is the method I want. It takes some options. What options?

Ok, it takes a function which takes some settings: https://godoc.org/github.com/ipfs/interface-go-ipfs-core/options#PinLsOption (unhelpful docs: PinLsOption pin ls option func). But what I am supposed to be doing with this?

https://godoc.org/github.com/ipfs/interface-go-ipfs-core/options#PinLsSettings is not even documented. I could use that setting struct though, as it seems to have a way to set the Type, but how do I make it an option?

And we have a https://godoc.org/github.com/ipfs/interface-go-ipfs-core/options#PinLsOptions which returns the settings, also undocumented.

Scroll up and down, look for something useful, ctrl-F for "direct"... eventually after checking the code, realize there are these undocumented variables https://godoc.org/github.com/ipfs/interface-go-ipfs-core/options#pkg-variables .

There is a Pin object there of private pinOpts type. But that type casually implements all the things to make options useful, like the Direct() method I needed in the first place.

Suggestions (PinLs is an example, they apply to everything):

Stebalien commented 4 years ago

Yeah, this is really confusing.

lidel commented 1 year ago

The https://github.com/ipfs/interface-go-ipfs-core has been copied/migrated over to boxo/coreiface and kubo/client/rpc.

In an effort to avoid noise and crippling in the Boxo repo from the weight of issues of the past, we are closing most issues and PRs in this repo. Please feel free to open a new issue in Boxo or Kubo (and reference this issue).

You can learn more in the FAQs for the Boxo repo copying/consolidation effort.

I am keeping this one open, as it highlights remainign work around kubo rpc client API.