Skip to content

An automatically generated C# client library for Factom Harmony Connect. This client is currently in beta.

License

Notifications You must be signed in to change notification settings

FPriv/factom-harmony-connect-csharp-client

Repository files navigation

Factom Harmony Connect - C# Client Library

An easy to use API that helps you access the Factom blockchain.

This Client is currently in beta. It has been automatically generated by the OpenAPI Generator project:

  • API version: 1.0.19
  • SDK version: 1.0.7
  • Build package: org.openapitools.codegen.languages.CSharpClientCodegen For more information, please visit https://docs.harmony.factom.com

Frameworks supported

  • .NET 4.0 or later
  • Windows Phone 7.1 (Mango)

Dependencies

The DLLs included in the package may not be the latest version. We recommend using NuGet to obtain the latest version of the packages:

Install-Package RestSharp
Install-Package Newtonsoft.Json
Install-Package JsonSubTypes

NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See RestSharp#742

Installation

Run the following command to generate the DLL

  • [Mac/Linux] /bin/sh build.sh
  • [Windows] build.bat

Then include the DLL (under the bin folder) in the C# project, and use the namespaces:

using harmony-connect-client.Api;
using harmony-connect-client.Client;
using harmony-connect-client.Model;

Packaging

A .nuspec is included with the project. You can follow the Nuget quickstart to create and publish packages.

This .nuspec uses placeholders from the .csproj, so build the .csproj directly:

nuget pack -Build -OutputDirectory out harmony-connect-client.csproj

Then, publish to a local feed or other host and consume the new package via Nuget as usual.

Getting Started

using System;
using System.Diagnostics;
using harmony-connect-client.Api;
using harmony-connect-client.Client;
using harmony-connect-client.Model;

namespace Example
{
    public class Example
    {
        public void main()
        {

            // Configure API key authorization: AppId
            Configuration.Default.ApiKey.Add("app_id", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // Configuration.Default.ApiKeyPrefix.Add("app_id", "Bearer");
            // Configure API key authorization: AppKey
            Configuration.Default.ApiKey.Add("app_key", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // Configuration.Default.ApiKeyPrefix.Add("app_key", "Bearer");

            var apiInstance = new ChainsApi();
            var chainId = 285904;  // string | Chain identifier

            try
            {
                // Get Chain Info
                Chain result = apiInstance.GetChainByID(chainId);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling ChainsApi.GetChainByID: " + e.Message );
            }

        }
    }
}

Documentation for API Endpoints

All URIs are relative to https://ephemeral.api.factom.com/v1

Class Method HTTP request Description
ChainsApi GetChainByID GET /chains/{chain_id} Get Chain Info
ChainsApi GetChains GET /chains Get All Chains
ChainsApi PostChain POST /chains Create a Chain
ChainsApi PostChainSearch POST /chains/search Search Chains
EntriesApi GetEntriesByChainID GET /chains/{chain_id}/entries Get Chain's Entries
EntriesApi GetEntryByHash GET /chains/{chain_id}/entries/{entry_hash} Get Entry Info
EntriesApi GetFirstEntry GET /chains/{chain_id}/entries/first Get Chain's First Entry
EntriesApi GetLastEntry GET /chains/{chain_id}/entries/last Get Chain's Last Entry
EntriesApi PostEntriesSearch POST /chains/{chain_id}/entries/search Search Chain's Entries
EntriesApi PostEntryToChainID POST /chains/{chain_id}/entries Create an Entry
IdentitiesApi GetIdChainbyId GET /identities/{identity_chain_id} Get Identity Chain Info
IdentitiesApi GetKeybyEntryHash GET /identities/{identity_chain_id}/keys/{key_string} Get Key Info
IdentitiesApi GetKeysbyIdChainId GET /identities/{identity_chain_id}/keys Get Identity Chain's Keys
IdentitiesApi PostIdChain POST /identities Create Identity Chain
IdentitiesApi PostKeytoIdChainId POST /identities/{identity_chain_id}/keys Replace Identity Key
InfoApi GetApiInfo GET / API Info
ProofsApi GetAnchorbySearch GET /anchors/{object_id} Get Object's Anchors
ProofsApi GetReceiptsbyEntry GET /receipts/{entry_hash} Get Entry's Receipts
ProofsApi GetSearch GET /search Search

Documentation for Models

Documentation for Authorization

AppId

  • Type: API key
  • API key parameter name: app_id
  • Location: HTTP header

AppKey

  • Type: API key
  • API key parameter name: app_key
  • Location: HTTP header

About

An automatically generated C# client library for Factom Harmony Connect. This client is currently in beta.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages