Skip to content

Commit

Permalink
docs: describe the Core API
Browse files Browse the repository at this point in the history
  • Loading branch information
richardschneider committed Nov 5, 2018
1 parent 29380fd commit 300b189
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 16 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![build status](https://ci.appveyor.com/api/projects/status/github/richardschneider/net-ipfs-api?branch=master&svg=true)](https://ci.appveyor.com/project/richardschneider/net-ipfs-api)
[![Coverage Status](https://coveralls.io/repos/github/richardschneider/net-ipfs-api/badge.svg?branch=master)](https://coveralls.io/github/richardschneider/net-ipfs-api?branch=master)
[![Version](https://img.shields.io/nuget/v/Ipfs.Api.svg)](https://www.nuget.org/packages/Ipfs.Api)
[![docs](https://cdn.rawgit.com/richardschneider/net-ipfs-api/master/doc/images/docs-latest-green.svg)](https://richardschneider.github.io/net-ipfs-api)
[![docs](https://cdn.rawgit.com/richardschneider/net-ipfs-api/master/doc/images/docs-latest-green.svg)](https://richardschneider.github.io/net-ipfs-api/articles/client.html)


A .Net client library for the IPFS HTTP API, implemented in C#.
Expand All @@ -17,7 +17,7 @@ More information, including the Class Reference, is on the [Project](https://ric
- [Asynchronous I/O](https://richardschneider.github.io/net-ipfs-api/articles/async.html) to an IPFS server
- Supports [cancellation](https://richardschneider.github.io/net-ipfs-api/articles/cancellation.html) of all requests to the IPFS Server
- Requests that all responses are compressed
- Comprehensive [documentation](https://richardschneider.github.io/net-ipfs-api)
- Comprehensive [documentation](https://richardschneider.github.io/net-ipfs-api/articles/client.html)
- C# style access to the [ipfs core interface](https://richardschneider.github.io/net-ipfs-core/api/Ipfs.CoreApi.html)
- [Bitswap API](https://richardschneider.github.io/net-ipfs-core/api/Ipfs.CoreApi.IBitswapApi.html)
- [Block API](https://richardschneider.github.io/net-ipfs-core/api/Ipfs.CoreApi.IBlockApi.html)
Expand Down Expand Up @@ -45,7 +45,7 @@ For the latest build or older non-released builds see [Continuous Integration](h

Every IPFS Api is a property of the [IpfsClient](https://richardschneider.github.io/net-ipfs-api/api/Ipfs.Api.IpfsClient.html). The following example reads a text file

```
```csharp
var ipfs = new IpfsClient();

const string filename = "QmXarR6rgkQ2fDSHjSY5nM2kuCXKYGViky5nohtwgF65Ec/about";
Expand Down
41 changes: 30 additions & 11 deletions doc/articles/client.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,33 @@ public class Program
}
```

## Locating the daemon

By default the client looks for a deamon at `http://localhost:5001`. This can be overriden by either
setting the environment variable [IpfsHttpUrl](envvars.md) or initialising the client with an URL.

```csharp
// js-ipfs likes this address
static readonly IpfsClient ipfs = new IpfsClient("http://127.0.0.1:5002");
```


## Core API

The [Core API](xref:Ipfs.CoreApi.ICoreApi) is a set of interfaces to IPFS features and is implemented by the client. The
[FileSystem]() and [PubSub]() features are most often used.

```csharp
const string filename = "QmXarR6rgkQ2fDSHjSY5nM2kuCXKYGViky5nohtwgF65Ec/about";
string text = await ipfs.FileSystem.ReadAllTextAsync(filename);
```

### Features

| Feature | Purpose |
| ------- | ------- |
| [Bitswap](xref:Ipfs.CoreApi.IBitswapApi) | Data trading module for IPFS; requests blocks from and sends blocks to other peers |
| [Block](xref:Ipfs.CoreApi.IBlockApi) | Manages the blocks |
| [Bootstrap](xref:Ipfs.CoreApi.IBootstrapApi) | Trusted peers |
| [Config](xref:Ipfs.CoreApi.IConfigApi) | Manages the configuration of the local peer |
| [Dag](xref:Ipfs.CoreApi.IDagApi) | Manages the IPLD (linked data) Directed Acrylic Graph |
| [Dht](xref:Ipfs.CoreApi.IDhtApi) | Manages the Distributed Hash Table |
| [Dns](xref:Ipfs.CoreApi.IDhtApi) | DNS mapping to IPFS |
| [Misc](xref:Ipfs.CoreApi.IGenericApi) | Some miscellaneous methods |
| [FileSystem](xref:Ipfs.CoreApi.IFileSystemApi) | Manages the files/directories in IPFS |
| [Key](xref:Ipfs.CoreApi.IKeyApi) | Manages the cryptographic keys |
| [Name](xref:Ipfs.CoreApi.INameApi) | Manages the Interplanetary Name Space (IPNS) |
| [Object](xref:Ipfs.CoreApi.IObjectApi) | Manages the IPFS Directed Acrylic Graph |
| [Pin](xref:Ipfs.CoreApi.IPinApi) | Manage objects that are locally stored and permanent |
| [PubSub](xref:Ipfs.CoreApi.IPubSubApi) | Publish and subscribe to topic messages |
| [Swarm](xref:Ipfs.CoreApi.ISwarmApi) | Manages the swarm of peers |

14 changes: 13 additions & 1 deletion doc/articles/daemon.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,16 @@ For Windows using [chocolatey](https://chocolatey.org/)
> choco install go-ipfs
> ipfs init
> ipfs daemon
```
```

## Locating the daemon

By default the client looks for a deamon at `http://localhost:5001`. This can be overriden by either
setting the environment variable [IpfsHttpUrl](envvars.md) or initialising the client with an URL.

```csharp
// js-ipfs likes this address
static readonly IpfsClient ipfs = new IpfsClient("http://127.0.0.1:5002");
```


4 changes: 3 additions & 1 deletion doc/articles/toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@
- name: Environment variables
href: envvars.md
- name: IPFS daemon
href: daemon.md
href: daemon.md
- name: Class Reference
href: ../api/Ipfs.Api.yml

0 comments on commit 300b189

Please sign in to comment.