Skip to content

marlowe-contrib/marlowe-csharp-sdk

Repository files navigation

MarloweAPIClient - the C# library for the Marlowe Runtime REST API

REST API for Marlowe Runtime

This C# SDK is automatically generated by the OpenAPI Generator project:

  • API version: 0.0.5.1
  • SDK version: 1.0.0
  • Build package: org.openapitools.codegen.languages.CSharpClientCodegen

Frameworks supported

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
Install-Package System.ComponentModel.Annotations

NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See RestSharp#742. NOTE: RestSharp for .Net Core creates a new socket for each api call, which can lead to a socket exhaustion problem. See RestSharp#1406.

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 MarloweAPIClient.Api;
using MarloweAPIClient.Client;
using MarloweAPIClient.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 MarloweAPIClient.csproj

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

Usage

To use the API client with a HTTP proxy, setup a System.Net.WebProxy

Configuration c = new Configuration();
System.Net.WebProxy webProxy = new System.Net.WebProxy("http://myProxyUrl:80/");
webProxy.Credentials = System.Net.CredentialCache.DefaultCredentials;
c.Proxy = webProxy;

Getting Started

using System.Collections.Generic;
using System.Diagnostics;
using MarloweAPIClient.Api;
using MarloweAPIClient.Client;
using MarloweAPIClient.Model;

namespace Example
{
    public class Example
    {
        public static void Main()
        {

            Configuration config = new Configuration();
            config.BasePath = "https://marlowe-runtime-preprod-web.scdev.aws.iohkdev.io";
            var apiInstance = new DefaultApi(config);
            var contractId = 98d601c9307dd43307cf68a03aad0086d4e07a789b66919ccf9f7f7676577eb7%231;  // string | 
            var xChangeAddress = addr1w94f8ywk4fg672xasahtk4t9k6w3aql943uxz5rt62d4dvq8evxaf;  // string | 
            var xAddress = "xAddress_example";  // string? |  (optional) 
            var xCollateralUTxO = "xCollateralUTxO_example";  // string? |  (optional) 
            var postTransactionsRequest = new PostTransactionsRequest?(); // PostTransactionsRequest? |  (optional) 

            try
            {
                // Apply inputs to contract
                ApplyInputsResponse result = apiInstance.ApplyInputsToContract(contractId, xChangeAddress, xAddress, xCollateralUTxO, postTransactionsRequest);
                Debug.WriteLine(result);
            }
            catch (ApiException e)
            {
                Debug.Print("Exception when calling DefaultApi.ApplyInputsToContract: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }

        }
    }
}

Documentation for API Endpoints

All URIs are relative to https://marlowe-runtime-preprod-web.scdev.aws.iohkdev.io

Class Method HTTP request Description
DefaultApi ApplyInputsToContract POST /contracts/{contractId}/transactions Apply inputs to contract
DefaultApi CreateContract POST /contracts Create a new contract
DefaultApi CreateContractSources POST /contracts/sources Upload contract sources
DefaultApi GetContractById GET /contracts/{contractId} Get contract by ID
DefaultApi GetContractSourceAdjacency GET /contracts/sources/{contractSourceId}/adjacency Get adjacent contract source IDs by ID
DefaultApi GetContractSourceById GET /contracts/sources/{contractSourceId} Get contract source by ID
DefaultApi GetContractSourceClosure GET /contracts/sources/{contractSourceId}/closure Get contract source closure by ID
DefaultApi GetContractTransactionById GET /contracts/{contractId}/transactions/{transactionId} Get contract transaction by ID
DefaultApi GetContracts GET /contracts Get contracts
DefaultApi GetNextStepsForContract GET /contracts/{contractId}/next Get next contract steps
DefaultApi GetPayoutById GET /payouts/{payoutId} Get payout by ID
DefaultApi GetPayouts GET /payouts Get role payouts
DefaultApi GetTransactionsForContract GET /contracts/{contractId}/transactions Get transactions for contract
DefaultApi GetWithdrawalById GET /withdrawals/{withdrawalId} Get withdrawal by ID
DefaultApi GetWithdrawals GET /withdrawals Get withdrawals
DefaultApi Healthcheck GET /healthcheck Test server status
DefaultApi SubmitContract PUT /contracts/{contractId} Submit contract to chain
DefaultApi SubmitContractTransaction PUT /contracts/{contractId}/transactions/{transactionId} Submit contract input application
DefaultApi SubmitWithdrawal PUT /withdrawals/{withdrawalId} Submit payout withdrawal
DefaultApi WithdrawPayouts POST /withdrawals Withdraw payouts

Documentation for Models

Documentation for Authorization

Endpoints do not require authorization.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages