This repository has been archived by the owner on Feb 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: optional arguments go in the options object (#3118)
We have a few older APIs that take multiple optional arguments, which makes our code more complicated as it has to guess the users' intent, sometimes by inspecting properties on the passed args to see if they happen to correspond with properties on the actual options object. The options object was recently added to all API calls and is the right place for optional arguments to go, so the change here is to move all optional arguments into the options object, except where the presence of an optional argument dramatically changes the behaviour of the call (`ipfs.bootstrap` I'm mostly looking at you), in which case the methods are split out into multiple versions that do distinct things. Only the programatic API is affected, the CLI and HTTP APIs do not change. BREAKING CHANGES: - `ipfs.bitswap.wantlist([peer], [options])` is split into: - `ipfs.bitswap.wantlist([options])` - `ipfs.bitswap.wantlistForPeer(peer, [options])` - `ipfs.bootstrap.add([addr], [options])` is split into: - `ipfs.bootstrap.add(addr, [options])` - add a bootstrap node - `ipfs.bootstrap.reset()` - restore the default list of bootstrap nodes - `ipfs.bootstrap.rm([addr], [options])` is split into: - `ipfs.bootstrap.rm(addr, [options])` - remove a bootstrap node - `ipfs.bootstrap.clear([options])` - empty the bootstrap list - `ipfs.dag.get(cid, [path], [options])` becomes `ipfs.dag.get(cid, [options])` - `path` is moved into the `options` object - `ipfs.dag.tree(cid, [path], [options])` becomes `ipfs.dag.tree(cid, [options])` - `path` is moved into the `options` object - `ipfs.dag.resolve(cid, [path], [options])` becomes `ipfs.dag.resolve(cid, [options])` - `path` is moved into the `options` object - `ipfs.files.flush([path], [options])` becomes `ipfs.files.flush(path, [options])` - `ipfs.files.ls([path], [options])` becomes `ipfs.files.ls(path, [options])` - `ipfs.object.new([template], [options])` becomes `ipfs.object.new([options])` - `template` is moved into the `options` object - `ipfs.pin.ls([paths], [options])` becomes `ipfs.pin.ls([options])` - `paths` is moved into the `options` object Co-authored-by: Hugo Dias <hugomrdias@gmail.com>
- Loading branch information
1 parent
65f8b23
commit 8cb8c73
Showing
86 changed files
with
1,088 additions
and
502 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.