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

Commit

Permalink
Added ipfs object
Browse files Browse the repository at this point in the history
This one, in particular, is not great, but this should be a good start. There's a few things in the `ipfs object` docs that are inconsistent; for instance, I'm not sure that <name>  and <ref> aren't options. The "--encoding" flag is mentioned several times, but never specified as an option, unless it is in `put`, where it has the name `inputenc`, which I think does something different. The formatting is also a bit inconsistent - tick marks given here but not there, and so on. I think I'll need to comb over this in more detail later. For now, here's a stub. Better to have something than nothing.
  • Loading branch information
RichardLitt committed Dec 15, 2015
1 parent 4089955 commit 3804212
Show file tree
Hide file tree
Showing 2 changed files with 107 additions and 8 deletions.
115 changes: 107 additions & 8 deletions apiary.apib
Original file line number Diff line number Diff line change
Expand Up @@ -940,34 +940,133 @@ Gets the value currently published at an IPNS name
# Group object
Interact with ipfs objects.

## data [GET /object/data]
`ipfs object` is a plumbing command used to manipulate DAG objects
directly.

+ Response 200 (text/plain)
## data [GET /object/data{?arg}]
Outputs the raw bytes in an IPFS object

`ipfs object data` is a plumbing command for retreiving the raw bytes stored in
a DAG node. It outputs to stdout, and <key> is a base58 encoded
multihash.

## get [GET /object/get]
Note that the "--encoding" option does not affect the output, since the
output is the raw data of the object.

+ Parameters
+ arg (string, optional) - Key of the object to retrieve, in base58-encoded multihash format

+ Response 200 (text/plain)

## links [GET /object/links]
## get [GET /object/get{?arg,&encoding}]
Get and serialize the DAG node named by <key>

`ipfs object get` is a plumbing command for retreiving DAG nodes.
It serializes the DAG node to the format specified by the "--encoding"
flag. It outputs to stdout, and <key> is a base58 encoded multihash.

+ Parameters
+ arg (string, required) - Key of the object to retrieve (in base58-encoded multihash format)
+ encoding (enum[string], optional) - Serializes the DAG node to the format specified
+ Default: `protobuf`
+ Members:
+ `protobuf`
+ `json`
+ `xml`

+ Response 200 (text/plain)

## new [GET /object/new]
## links [GET /object/links{?arg}]
Outputs the links pointed to by the specified object

`ipfs object links` is a plumbing command for retreiving the links from
a DAG node. It outputs to stdout, and <key> is a base58 encoded
multihash.

+ Parameters
+ arg (string, required) - Key of the object to retrieve, in base58-encoded multihash format

+ Response 200 (text/plain)

## patch [GET /object/patch]
## new [GET /object/new{?arg}]
Creates a new object from an ipfs template

`ipfs object new` is a plumbing command for creating new DAG nodes.
By default it creates and returns a new empty merkledag node, but
you may pass an optional template argument to create a preformatted
node.

+ Parameters
+ arg (string, required) - optional template to use

Available templates:
* unixfs-dir


+ Response 200 (text/plain)

## put [GET /object/put]
## patch [GET /object/patch{?arg1,arg2,&name,ref}]
Create a new merkledag object based on an existing one

`ipfs object patch <root> <cmd> <args>` is a plumbing command used to
build custom DAG objects. It adds and removes links from objects, creating a new object as a result. This is the merkle-dag version of modifying an object. It can also set the data inside a node with `set-data` and append to that data as well with `append-data`.

+ Parameters
+ arg1 (string, required) - the hash of the node to modify
+ arg2 (enum[string], required) - the operation to perform
+ Members:
+ `add-link` - with `<name> <ref>`, adds a link to a node
+ `rm-link` - with `<name>`, removes a link from a node
+ `set-data` - sets a nodes data from stdin
+ `append-data` - appends to a nodes data from stdin
+ name (string, optional) - used with `<add-link>` and `<rm-link>`
+ ref (string, optional) - used with `<add-link> <name>`
+ create (boolean, optional) - create intermediate directories on `<add-link>`

+ Response 200 (text/plain)

## stat [GET /object/stat]
## put [GET /object/put{?arg,&inputenc}]
Stores input as a DAG object, outputs its key

`ipfs object put` is a plumbing command for storing DAG nodes.
It reads from stdin, and the output is a base58 encoded multihash.

Data should be in the format specified by the --inputenc flag.

+ Parameters
+ arg (string, required) - Data to be stored as a DAG object
+ inputenc (enum[string], optional) - Encoding type of input data
+ Default: `json`
+ Members:
+ `protobuf`
+ `json`

+ Response 200 (text/plain)

+ Body

```
added QmXg9Pp2ytZ14xgmQjYEiHjVjMFXzCVVEcRTWJBmLgR39V
```
## stat [GET /object/stat{?arg}]
Get stats for the DAG node named by <key>

`ipfs object stat` is a plumbing command to print DAG node statistics.
<key> is a base58 encoded multihash.

+ Parameters
+ arg (string, required) - Key of the object to retrieve (in base58-encoded multihash format)

+ Response 200 (application/json)

+ Attributes
- `Hash`: "QmXg9Pp2ytZ14xgmQjYEiHjVjMFXzCVVEcRTWJBmLgR39V" (string) - number of links in link table
- `NumLinks`: 0 (number) - number of links in link table
- `BlockSize`: 5 (number) - size of the raw, encoded data
- `LinksSize`: 2 (number) - size of the links segment
- `DataSize`: 3 (number) - size of the data segment
- `CumulativeSize`: 5 (number) - cumulative size of object and its references

# Group pin
## add [GET /pin/add]

Expand Down
Empty file removed test
Empty file.

0 comments on commit 3804212

Please sign in to comment.