Show / Hide Table of Contents

Interface IConfigApi

Manages the IPFS Configuration.

Namespace: Ipfs.CoreApi
Assembly: Ipfs.Core.dll
Syntax
public interface IConfigApi
Remarks

Configuration values are JSON. Json.NET is used to represent JSON.

Methods

| Improve this Doc View Source

GetAsync(String, CancellationToken)

Gets the value of a configuration key.

Declaration
Task<JToken> GetAsync(string key, CancellationToken cancel = default(CancellationToken))
Parameters
Type Name Description
String key

The key name, such as "Addresses.API".

CancellationToken cancel

Is used to stop the task. When cancelled, the TaskCanceledException is raised.

Returns
Type Description
Task<Newtonsoft.Json.Linq.JToken>

The value of the key as Newtonsoft.Json.Linq.JToken.

Remarks

Keys are case sensistive.

Exceptions
Type Condition
Exception

When the key does not exist.

| Improve this Doc View Source

GetAsync(CancellationToken)

Gets the entire configuration.

Declaration
Task<JObject> GetAsync(CancellationToken cancel = default(CancellationToken))
Parameters
Type Name Description
CancellationToken cancel
Returns
Type Description
Task<Newtonsoft.Json.Linq.JObject>

A Newtonsoft.Json.Linq.JObject containing the configuration.

| Improve this Doc View Source

ReplaceAsync(JObject)

Replaces the entire configuration.

Declaration
Task ReplaceAsync(JObject config)
Parameters
Type Name Description
Newtonsoft.Json.Linq.JObject config
Returns
Type Description
Task
| Improve this Doc View Source

SetAsync(String, JToken, CancellationToken)

Adds or replaces a configuration value.

Declaration
Task SetAsync(string key, JToken value, CancellationToken cancel = default(CancellationToken))
Parameters
Type Name Description
String key

The key name, such as "Addresses.API".

Newtonsoft.Json.Linq.JToken value

The new Newtonsoft.Json.Linq.JToken value of the key.

CancellationToken cancel

Is used to stop the task. When cancelled, the TaskCanceledException is raised.

Returns
Type Description
Task
| Improve this Doc View Source

SetAsync(String, String, CancellationToken)

Adds or replaces a configuration value.

Declaration
Task SetAsync(string key, string value, CancellationToken cancel = default(CancellationToken))
Parameters
Type Name Description
String key

The key name, such as "Addresses.API".

String value

The new String value of the key.

CancellationToken cancel

Is used to stop the task. When cancelled, the TaskCanceledException is raised.

Returns
Type Description
Task

See Also

Config API spec
  • Improve this Doc
  • View Source
Back to top Generated by DocFX