Damanesign.Sdk 0.1.0

dotnet add package Damanesign.Sdk --version 0.1.0
                    
NuGet\Install-Package Damanesign.Sdk -Version 0.1.0
                    
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="Damanesign.Sdk" Version="0.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Damanesign.Sdk" Version="0.1.0" />
                    
Directory.Packages.props
<PackageReference Include="Damanesign.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 Damanesign.Sdk --version 0.1.0
                    
#r "nuget: Damanesign.Sdk, 0.1.0"
                    
#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 Damanesign.Sdk@0.1.0
                    
#: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=Damanesign.Sdk&version=0.1.0
                    
Install as a Cake Addin
#tool nuget:?package=Damanesign.Sdk&version=0.1.0
                    
Install as a Cake Tool

Damanesign .NET SDK

SDK .NET officiel pour consommer les APIs Damanesign.

Prérequis

  • .NET 8+

Installation locale

dotnet restore
dotnet build
dotnet run --project tests/Damanesign.Sdk.Tests/Damanesign.Sdk.Tests.csproj

Installation NuGet

Après publication sur NuGet :

dotnet add package Damanesign.Sdk

Création d'une transaction

Étape 1 : upload du document

Avant de créer la transaction, le PDF doit être envoyé à Damanesign via POST /files/upload. Le SDK expose cette étape avec UploadFileAsync(...).

using Damanesign.Sdk;

using DamanesignClient client = DamanesignClient.Create(
    "https://api-recette.damanesign.ma",
    Environment.GetEnvironmentVariable("DAMANESIGN_API_KEY")!);

var file = await client.UploadFileAsync("contract.pdf");
string fileId = file!.Id!;

Vous utiliserez ensuite fileId dans Members[].Fields[].File.

Étape 2 : création puis lancement

using Damanesign.Sdk;
using Damanesign.Sdk.Models;

using DamanesignClient client = DamanesignClient.Create(
    "https://api-recette.damanesign.ma",
    Environment.GetEnvironmentVariable("DAMANESIGN_API_KEY")!);

var file = await client.UploadFileAsync("contract.pdf");

var transaction = await client.CreateTransactionAsync(new CreateTransactionRequest
{
    Name = "Contrat client",
    Type = "simple",
    DeliveryMode = "email",
    AuthenticationMode = "email",
    Ordered = false,
    Members =
    [
        new MemberRequest
        {
            Type = MemberTypes.Signer,
            Firstname = "Sara",
            Lastname = "El Amrani",
            Email = "sara@example.com",
            Phone = "+212600000000",
            Fields =
            [
                new FieldRequest
                {
                    File = file!.Id,
                    Type = FieldTypes.Signature,
                    Page = 1,
                    Position = "141,268,151,101"
                }
            ]
        }
    ]
});

await client.StartTransactionAsync(transaction!.Id!);

Console.WriteLine(transaction.Id);

Le SDK utilise l'authentification HTTP x-api-key: <apiKey>, conformément au Swagger Damanesign.

Le flux standard suit le Developer Portal :

  1. POST /files/upload avec le champ multipart file.
  2. POST /transactions avec name, type, authenticationMode, members et members[].fields[].file.
  3. POST /transactions/{id}/start pour lancer la transaction.

Méthodes exposées

Le client couvre les opérations publiques du Swagger 2.5.3 :

await client.ListTransactionsAsync(filter);
await client.ListAssignedTransactionsAsync(filter);
await client.GetTransactionAsync(transactionId);
await client.CreateTransactionAsync(request);
await client.UpdateTransactionAsync(transactionId, request);
await client.DeleteTransactionAsync(transactionId);
await client.UpdateMemberAsync(transactionId, memberId, memberRequest);
await client.UpdateMemberAuthenticationAsync(transactionId, memberId, "sms");
await client.StartTransactionAsync(transactionId);
await client.SendReminderAsync(transactionId);
await client.ProlongTransactionAsync(transactionId, new DateOnly(2026, 12, 31));
await client.CancelTransactionAsync(transactionId);
await client.GetSignatureUrlAsync(transactionId, memberId);

await client.UploadFileAsync("contract.pdf");
await client.GetFileAsync(fileId);
await client.DownloadFileAsync(fileId);

await client.SealDocumentAsync(sealRequest);
await client.ListSealsAsync(sealFilter);

Les filtres de liste utilisent TransactionFilter et SealFilter :

var transactions = await client.ListTransactionsAsync(TransactionFilter.Create()
    .Status(["draft", "active"])
    .Type(["simple"])
    .Limit(20));

Champs additionnels

Les modèles acceptent des propriétés additionnelles avec AdditionalProperties. Cela permet de rester compatible avec une évolution du Swagger sans bloquer l'intégration.

var request = new CreateTransactionRequest
{
    Name = "Contrat client",
    AdditionalProperties = new Dictionary<string, object?>
    {
        ["customField"] = "value"
    }
};

Erreurs

Les erreurs API lèvent DamanesignException avec StatusCode et ResponseBody.

try
{
    await client.CreateTransactionAsync(new CreateTransactionRequest { Name = "Invalid" });
}
catch (DamanesignException exception)
{
    Console.Error.WriteLine($"{exception.StatusCode}: {exception.ResponseBody}");
}
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.
  • net8.0

    • No dependencies.

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.0 157 5/23/2026