Skip to content
This repository has been archived by the owner on Mar 10, 2020. It is now read-only.

refactor: object API write methods now return CIDs #896

Merged
merged 2 commits into from
Nov 27, 2018

Commits on Nov 27, 2018

  1. refactor: object API write methods now return CIDs

    BREAKING CHANGE: Object API refactor.
    
    Object API methods that write DAG nodes now return a CID instead of a DAG node. Affected methods:
    
    * `ipfs.object.new`
    * `ipfs.object.patch.addLink`
    * `ipfs.object.patch.appendData`
    * `ipfs.object.patch.rmLink`
    * `ipfs.object.patch.setData`
    * `ipfs.object.put`
    
    Example:
    
    ```js
    // Before
    const dagNode = await ipfs.object.new()
    ```
    
    ```js
    // After
    const cid = await ipfs.object.new() // now returns a CID
    const dagNode = await ipfs.object.get(cid) // fetch the DAG node that was created
    ```
    
    IMPORTANT: `DAGNode` instances, which are part of the IPLD dag-pb format have been refactored.
    
    These instances no longer have `multihash`, `cid` or `serialized` properties.
    
    This effects the following API methods that return these types of objects:
    
    * `ipfs.object.get`
    * `ipfs.dag.get`
    
    See ipld/js-ipld-dag-pb#99 for more information.
    
    License: MIT
    Signed-off-by: Alan Shaw <alan.shaw@protocol.ai>
    alanshaw committed Nov 27, 2018
    Configuration menu
    Copy the full SHA
    251762e View commit details
    Browse the repository at this point in the history
  2. fix: tweaks and fixes

    License: MIT
    Signed-off-by: Alan Shaw <alan.shaw@protocol.ai>
    alanshaw committed Nov 27, 2018
    Configuration menu
    Copy the full SHA
    9d19b95 View commit details
    Browse the repository at this point in the history