Skip to content

Latest commit

 

History

History
155 lines (124 loc) · 6.63 KB

README.md

File metadata and controls

155 lines (124 loc) · 6.63 KB

IO.Dyspatch - the C# library for the Dyspatch API

Introduction

The Dyspatch API is based on the REST paradigm, and features resource based URLs with standard HTTP response codes to indicate errors. We use standard HTTP authentication and request verbs, and all responses are JSON formatted. See our Implementation Guide for more details on how to implement Dyspatch.

API Client Libraries

Dyspatch provides API Clients for popular languages and web frameworks.

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

  • API version: 2020.11
  • SDK version: 6.0.0
  • Build package: org.openapitools.codegen.languages.CSharpNetCoreClientCodegen For more information, please visit https://docs.dyspatch.io

Frameworks supported

  • .NET Core >=1.0
  • .NET Framework >=4.6
  • Mono/Xamarin >=vNext

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

Installation

Generate the DLL using your preferred tool (e.g. dotnet build)

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

using IO.Dyspatch.Api;
using IO.Dyspatch.Client;
using IO.Dyspatch.Model;

Getting Started

using System.Collections.Generic;
using System.Diagnostics;
using IO.Dyspatch.Api;
using IO.Dyspatch.Client;
using IO.Dyspatch.Model;

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

            Configuration config = new Configuration();
            config.BasePath = "https://api.dyspatch.io";
            // Configure API key authorization: Bearer
            config.ApiKey.Add("Authorization", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // config.ApiKeyPrefix.Add("Authorization", "Bearer");

            var apiInstance = new DraftsApi(config);
            var draftId = draftId_example;  // string | A draft ID
            var languageId = languageId_example;  // string | A language ID (eg: en-US)
            var accept = accept_example;  // string | A version of the API that should be used for the request. For example, to use version \"2020.11\", set the value to \"application/vnd.dyspatch.2020.11+json\"

            try
            {
                // Remove a localization
                apiInstance.DeleteLocalization(draftId, languageId, accept);
            }
            catch (ApiException e)
            {
                Debug.Print("Exception when calling DraftsApi.DeleteLocalization: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }

        }
    }
}

Documentation for API Endpoints

All URIs are relative to https://api.dyspatch.io

Class Method HTTP request Description
DraftsApi DeleteLocalization DELETE /drafts/{draftId}/localizations/{languageId} Remove a localization
DraftsApi GetDraftById GET /drafts/{draftId} Get Draft by ID
DraftsApi GetDraftLocalizationKeys GET /drafts/{draftId}/localizationKeys Get localization keys
DraftsApi GetDrafts GET /drafts List Drafts
DraftsApi GetLocalizationForDraft GET /drafts/{draftId}/localizations Get localizations on a draft
DraftsApi SaveLocalization PUT /drafts/{draftId}/localizations/{languageId} Create or update a localization
DraftsApi SetTranslation PUT /drafts/{draftId}/localizations/{languageId}/translations Set translations for language
DraftsApi SubmitDraftForApproval POST /drafts/{draftId}/publishRequest Submit the draft for approval
LocalizationsApi GetLocalizationById GET /localizations/{localizationId} Get Localization Object by ID
TemplatesApi GetTemplateById GET /templates/{templateId} Get Template by ID
TemplatesApi GetTemplates GET /templates List Templates

Documentation for Models

Documentation for Authorization

Bearer

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