Skip to content

DocSpring/docspring-csharp

Repository files navigation

DocSpring.Client - the C# library for the API v1

DocSpring is a service that helps you fill out and sign PDF templates.

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

  • API version: v1
  • SDK version: 1.4.3
  • Build package: com.docspring.codegen.DocSpringCSharpClientCodegen

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 DocSpring.Client.Api;
using DocSpring.Client.Client;
using DocSpring.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 DocSpring.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 DocSpring.Client.Api;
using DocSpring.Client.Client;
using DocSpring.Client.Model;

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

            // Configure HTTP basic authorization: api_token_basic
            Configuration.Default.Username = "YOUR_USERNAME";
            Configuration.Default.Password = "YOUR_PASSWORD";

            var apiInstance = new PDFApi();
            var templateId = tpl_000000000000000002;  // string | 
            var addFieldsData = new AddFieldsData(); // AddFieldsData | 

            try
            {
                // Add new fields to a Template
                AddFieldsTemplateResponse result = apiInstance.AddFieldsToTemplate(templateId, addFieldsData);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling PDFApi.AddFieldsToTemplate: " + e.Message );
            }

        }
    }
}

Documentation for API Endpoints

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

Class Method HTTP request Description
PDFApi AddFieldsToTemplate PUT /templates/{template_id}/add_fields Add new fields to a Template
PDFApi BatchGeneratePdfV1 POST /templates/{template_id}/submissions/batch Generates multiple PDFs
PDFApi BatchGeneratePdfs POST /submissions/batches Generates multiple PDFs
PDFApi CombinePdfs POST /combined_submissions?v=2 Merge submission PDFs, template PDFs, or custom files
PDFApi CombineSubmissions POST /combined_submissions Merge generated PDFs together
PDFApi CopyTemplate POST /templates/{template_id}/copy Copy a Template
PDFApi CreateCustomFileFromUpload POST /custom_files Create a new custom file from a cached presign upload
PDFApi CreateDataRequestToken POST /data_requests/{data_request_id}/tokens Creates a new data request token for form authentication
PDFApi CreateFolder POST /folders/ Create a folder
PDFApi CreateHTMLTemplate POST /templates?desc=html Create a new HTML template
PDFApi CreatePDFTemplate POST /templates Create a new PDF template with a form POST file upload
PDFApi CreatePDFTemplateFromUpload POST /templates?desc=cached_upload Create a new PDF template from a cached presign upload
PDFApi DeleteFolder DELETE /folders/{folder_id} Delete a folder
PDFApi ExpireCombinedSubmission DELETE /combined_submissions/{combined_submission_id} Expire a combined submission
PDFApi ExpireSubmission DELETE /submissions/{submission_id} Expire a PDF submission
PDFApi GeneratePDF POST /templates/{template_id}/submissions Generates a new PDF
PDFApi GetCombinedSubmission GET /combined_submissions/{combined_submission_id} Check the status of a combined submission (merged PDFs)
PDFApi GetDataRequest GET /data_requests/{data_request_id} Look up a submission data request
PDFApi GetFullTemplate GET /templates/{template_id}?full=true Fetch the full template attributes
PDFApi GetPresignUrl GET /uploads/presign Get a presigned URL so that you can upload a file to our AWS S3 bucket
PDFApi GetSubmission GET /submissions/{submission_id} Check the status of a PDF
PDFApi GetSubmissionBatch GET /submissions/batches/{submission_batch_id} Check the status of a submission batch job
PDFApi GetTemplate GET /templates/{template_id} Check the status of an uploaded template
PDFApi GetTemplateSchema GET /templates/{template_id}/schema Fetch the JSON schema for a template
PDFApi ListFolders GET /folders/ Get a list of all folders
PDFApi ListSubmissions GET /submissions List all submissions
PDFApi ListSubmissions_0 GET /templates/{template_id}/submissions List all submissions for a given template
PDFApi ListTemplates GET /templates Get a list of all templates
PDFApi MoveFolderToFolder POST /folders/{folder_id}/move Move a folder
PDFApi MoveTemplateToFolder POST /templates/{template_id}/move Move Template to folder
PDFApi RenameFolder POST /folders/{folder_id}/rename Rename a folder
PDFApi TestAuthentication GET /authentication Test Authentication
PDFApi UpdateDataRequest PUT /data_requests/{data_request_id} Update a submission data request
PDFApi UpdateTemplate PUT /templates/{template_id} Update a Template

Documentation for Models

Documentation for Authorization

api_token_basic

  • Type: HTTP basic authentication