Tachain.Sdk 0.1.1

dotnet add package Tachain.Sdk --version 0.1.1
                    
NuGet\Install-Package Tachain.Sdk -Version 0.1.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Tachain.Sdk" Version="0.1.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Tachain.Sdk" Version="0.1.1" />
                    
Directory.Packages.props
<PackageReference Include="Tachain.Sdk" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Tachain.Sdk --version 0.1.1
                    
#r "nuget: Tachain.Sdk, 0.1.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Tachain.Sdk@0.1.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Tachain.Sdk&version=0.1.1
                    
Install as a Cake Addin
#tool nuget:?package=Tachain.Sdk&version=0.1.1
                    
Install as a Cake Tool

Tachain.Sdk - the C# library for the Tactic Chain Public API

Public integration endpoints. Set your own base URL and credential before calling.

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

  • API version: 1.0.0
  • SDK version: 0.1.1
  • Generator version: 7.25.0
  • Build package: org.openapitools.codegen.languages.CSharpClientCodegen

Source repository and local build

This SDK is in the generated/csharp directory of the open-source SDK repository.

git clone https://github.com/ta-chain/tachain-sdk.git
cd tachain-sdk/generated/csharp
dotnet build src/Tachain.Sdk/Tachain.Sdk.csproj -c Release

<a id="frameworks-supported"></a>

Frameworks supported

<a id="dependencies"></a>

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

<a id="installation"></a>

Installation

Build the .NET 8 project from this SDK directory:

dotnet build src/Tachain.Sdk/Tachain.Sdk.csproj -c Release

The DLL is written under src/Tachain.Sdk/bin/Release/net8.0/.

<a id="packaging"></a>

Packaging

Create a local NuGet package from this SDK directory:

dotnet pack src/Tachain.Sdk/Tachain.Sdk.csproj -c Release -o out

<a id="usage"></a>

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;

Connections

Each ApiClass (properly the ApiClient inside it) will create an instance of HttpClient. It will use that for the entire lifecycle and dispose it when called the Dispose method.

To better manager the connections it's a common practice to reuse the HttpClient and HttpClientHandler (see here for details). To use your own HttpClient instance just pass it to the ApiClass constructor.

HttpClientHandler yourHandler = new HttpClientHandler();
HttpClient yourHttpClient = new HttpClient(yourHandler);
var api = new YourApiClass(yourHttpClient, yourHandler);

If you want to use an HttpClient and don't have access to the handler, for example in a DI context in Asp.net Core when using IHttpClientFactory.

HttpClient yourHttpClient = new HttpClient();
var api = new YourApiClass(yourHttpClient);

You'll loose some configuration settings, the features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings. You need to either manually handle those in your setup of the HttpClient or they won't be available.

Here an example of DI setup in a sample web project:

services.AddHttpClient<YourApiClass>(httpClient =>
   new PetApi(httpClient));

<a id="getting-started"></a>

Getting Started

using System.Collections.Generic;
using System.Diagnostics;
using System.Net.Http;
using Tachain.Sdk.Api;
using Tachain.Sdk.Client;
using Tachain.Sdk.Model;

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

            Configuration config = new Configuration();
            config.BasePath = "https://api.example.com";
            // Configure API key authorization: ApiKey
            config.ApiKey.Add("X-API-Key", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // config.ApiKeyPrefix.Add("X-API-Key", "Bearer");
            // Configure API key authorization: Signature
            config.ApiKey.Add("X-Signature", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // config.ApiKeyPrefix.Add("X-Signature", "Bearer");
            // Configure Bearer token for authorization: BearerToken
            config.AccessToken = "YOUR_BEARER_TOKEN";
            // Configure API key authorization: Timestamp
            config.ApiKey.Add("X-Timestamp", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // config.ApiKeyPrefix.Add("X-Timestamp", "Bearer");

            // create instances of HttpClient, HttpClientHandler to be reused later with different Api classes
            HttpClient httpClient = new HttpClient();
            HttpClientHandler httpClientHandler = new HttpClientHandler();
            var apiInstance = new ApiDeclarationApi(httpClient, config, httpClientHandler);
            var xCredentialType = "Token";  // string | Use 'Token' with bearer authorization, or 'API Key' with signed API key headers. This header is mandatory in the deployed API.
            var attachmentId = "attachmentId_example";  // string? | 查询返回的附件申报记录标识;也可在 Body 按单据和资料类型删除。 (optional) 
            var formDataId = "formDataId_example";  // string? | 查询返回的表单记录标识;也可在 Body 按业务键删除。 (optional) 
            var tacticChainApiServiceControllersApiIntegrationV1ApiDeclarationDeleteRequest = new TacticChainApiServiceControllersApiIntegrationV1ApiDeclarationDeleteRequest?(); // TacticChainApiServiceControllersApiIntegrationV1ApiDeclarationDeleteRequest? |  (optional) 

            try
            {
                // 申报信息删除接口。
                DeleteV1DeclarationDelete200Response result = apiInstance.DeleteV1DeclarationDelete(xCredentialType, attachmentId, formDataId, tacticChainApiServiceControllersApiIntegrationV1ApiDeclarationDeleteRequest);
                Debug.WriteLine(result);
            }
            catch (ApiException e)
            {
                Debug.Print("Exception when calling ApiDeclarationApi.DeleteV1DeclarationDelete: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }

        }
    }
}

<a id="documentation-for-api-endpoints"></a>

Documentation for API Endpoints

All URIs are relative to https://api.example.com

Class Method HTTP request Description
ApiDeclarationApi DeleteV1DeclarationDelete DELETE /v1/declaration/Delete 申报信息删除接口。
ApiDeclarationApi GetV1DeclarationListPaging GET /v1/declaration/ListPaging 申报信息查询接口。
ApiDeclarationApi GetV1DeclarationRequiredDocuments GET /v1/declaration/RequiredDocuments 单据所需申报信息查询接口。
ApiDeclarationApi PostV1DeclarationSubmit POST /v1/declaration/Submit 申报文件/表单提交接口。
ApiDeclarationUploadApi PostV1DeclarationUploadFile POST /v1/declaration/UploadFile 上传申报文件,返回 FileId;文件内容最多 30 MiB。
ApiDeliveryApi DeleteV1DeliveryDelete DELETE /v1/delivery/Delete 删除发货单。
ApiDeliveryApi GetV1DeliveryListPaging GET /v1/delivery/ListPaging 查询发货单信息及明细信息。
ApiDeliveryApi GetV1DeliveryReceiptListPaging GET /v1/delivery/ReceiptListPaging 查询收货单集合,核对收货信息。
ApiDeliveryApi PostV1DeliveryCreate POST /v1/delivery/Create 创建发货单。
ApiDeliveryApi PutV1DeliveryConfirmReceipt PUT /v1/delivery/ConfirmReceipt 确认收货。
ApiDeliveryApi PutV1DeliveryReturnReceipt PUT /v1/delivery/ReturnReceipt 收货退回。
ApiDeliveryApi PutV1DeliveryUpdate PUT /v1/delivery/Update 修改发货单。
ApiEnumApi GetV1EnumGetList GET /v1/enum/GetList 第三方-获取统一枚举列表(支持批量查询/查询所有)
ApiMaterialApi DeleteV1MaterialDelete DELETE /v1/material/Delete 删除未被使用的资料;软删除,已被订单等业务使用时返回业务错误。
ApiMaterialApi GetV1MaterialGet GET /v1/material/Get 按编码或 ID 精确查询。
ApiMaterialApi GetV1MaterialListPaging GET /v1/material/ListPaging 分页查询;searchText 搜索编码或名称,scopeCode 按加工阶段筛选。
ApiMaterialApi PostV1MaterialCreate POST /v1/material/Create 创建原料资料。
ApiMaterialApi PutV1MaterialUpdate PUT /v1/material/Update 完整修改原料资料。
ApiOrderApi DeleteV1OrderDelete DELETE /v1/order/Delete 第三方-更新订单状态(通过匹配条件获取订单ID)
ApiOrderApi DeleteV1OrderDeleteLine DELETE /v1/order/DeleteLine 第三方-更新订单明细状态(通过匹配条件获取明细ID)
ApiOrderApi GetV1OrderPOListPaging GET /v1/order/POListPaging 第三方-获取采购订单分页列表(含明细)
ApiOrderApi GetV1OrderSOListPaging GET /v1/order/SOListPaging 第三方-获取销售订单分页列表(含明细)
ApiOrderApi PostV1OrderCreate POST /v1/order/Create 第三方-创建订单(含明细)
ApiOrderApi PostV1OrderSoAccept POST /v1/order/SoAccept 第三方-销售订单接单(支持绑定成品/自动创建成品)
ApiOrderApi PutV1OrderUpdate PUT /v1/order/Update 第三方-更新订单(部分字段)
ApiOrderWorkflowApi GetV1OrderReceiptPending GET /v1/order/ReceiptPending 采购订单确认收货待办项查询。
ApiOrderWorkflowApi PostV1OrderDeclarationVerification POST /v1/order/DeclarationVerification 销售订单提交审核前一键校验。
ApiOrderWorkflowApi PostV1OrderSubmitAudit POST /v1/order/SubmitAudit 销售方根据已入库的订单、生产、发货及申报资料提交审核。
ApiOrderWorkflowApi PutV1OrderConfirmReceipt PUT /v1/order/ConfirmReceipt 采购方按整单或单条订单明细确认收货。
ApiProcessRouteApi DeleteV1ProcessRouteDelete DELETE /v1/processRoute/Delete 软删除加工路线;历史单据保持其已有引用,新建业务不可再选择该路线。
ApiProcessRouteApi GetV1ProcessRouteGet GET /v1/processRoute/Get 按路线编码或查询返回的 ID 精确查询,两者同时传入须一致。
ApiProcessRouteApi GetV1ProcessRouteListPaging GET /v1/processRoute/ListPaging 分页查询正常路线;searchText 匹配编码或名称,scopeCode 筛选加工阶段。
ApiProcessRouteApi PostV1ProcessRouteCreate POST /v1/processRoute/Create 创建加工路线及有序工序。
ApiProcessRouteApi PutV1ProcessRouteUpdate PUT /v1/processRoute/Update 完整修改路线;steps 省略保留原工序,数组则替换全部工序,空数组清空。
ApiProductApi DeleteV1ProductDelete DELETE /v1/product/Delete 删除未被使用的资料;软删除,已被订单等业务使用时返回业务错误。
ApiProductApi GetV1ProductGet GET /v1/product/Get 按编码或 ID 精确查询。
ApiProductApi GetV1ProductListPaging GET /v1/product/ListPaging 分页查询;searchText 搜索编码或名称,scopeCode 按加工阶段筛选。
ApiProductApi PostV1ProductCreate POST /v1/product/Create 创建成品资料。
ApiProductApi PutV1ProductUpdate PUT /v1/product/Update 完整修改成品资料。
ApiProductionApi DeleteV1ProductionDelete DELETE /v1/production/Delete 删除生产记录单。
ApiProductionApi GetV1ProductionListPaging GET /v1/production/ListPaging 查询生产记录单及详细领料信息。
ApiProductionApi PostV1ProductionCreate POST /v1/production/Create 创建生产记录单。
ApiProductionApi PutV1ProductionUpdate PUT /v1/production/Update 修改生产记录单。
ApiReferenceApi GetV1ReferenceEnumValues GET /v1/reference/EnumValues 查询 enum_value;EnumTypeId 必填,Value 可选精确匹配。
ApiReferenceApi GetV1ReferenceMappings GET /v1/reference/Mappings 查询 external_mapping;MappedTable 必填,ExternalValue 可选精确匹配。

<a id="documentation-for-models"></a>

Documentation for Models

<a id="documentation-for-authorization"></a>

Documentation for Authorization

Authentication schemes defined for the API: <a id="BearerToken"></a>

BearerToken

  • Type: Bearer Authentication

<a id="ApiKey"></a>

ApiKey

  • Type: API key
  • API key parameter name: X-API-Key
  • Location: HTTP header

<a id="Timestamp"></a>

Timestamp

  • Type: API key
  • API key parameter name: X-Timestamp
  • Location: HTTP header

<a id="Signature"></a>

Signature

  • Type: API key
  • API key parameter name: X-Signature
  • Location: HTTP header
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.1 106 10/16/2026
0.1.0 110 9/29/2026

Minor update