Categorygithub.com/getdyspatch/dyspatch-golang
repositorypackage
6.0.0+incompatible
Repository: https://github.com/getdyspatch/dyspatch-golang.git
Documentation: pkg.go.dev

# README

Go API client for Dyspatch

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.

Overview

This API client was generated by the OpenAPI Generator project. By using the OpenAPI-spec from a remote server, you can easily generate an API client.

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

Installation

Install the following dependencies:

go get github.com/stretchr/testify/assert
go get golang.org/x/oauth2
go get golang.org/x/net/context
go get github.com/antihax/optional

Put the package under your project folder and add the following in import:

import "./dyspatch"

Install the latest version of the client project:

go get -u github.com/getdyspatch/dyspatch-golang

Installing a versioned client:

go get -u gopkg.in/getdyspatch/dyspatch-golang.v6

Importing a versioned client:

import "gopkg.in/getdyspatch/dyspatch-golang.v6"

Getting Started

package main
import (
	"fmt"
	"github.com/antihax/optional"
	"gopkg.in/getdyspatch/dyspatch-golang.v6"
	"golang.org/x/net/context"
)

const version = "application/vnd.dyspatch.2020.11+json"

func main() {
	cfg := dyspatch.NewConfiguration()
	auth := context.WithValue(context.Background(), dyspatch.ContextAPIKey, dyspatch.APIKey{
		Key:    "DYSPATCH_API_KEY",
		Prefix: "Bearer",
	})
	
	client := dyspatch.NewAPIClient(cfg)
	opts := dyspatch.GetTemplatesOpts{Cursor: optional.NewString("")} // Use this to page API results

	templates, _, err := client.TemplatesApi.GetTemplates(auth, version, &opts)
	if err != nil {
		fmt.Println(err)
	}
	for _, template := range templates.Data {
		fmt.Println(template.Name)
	}
}

Documentation for API Endpoints

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

ClassMethodHTTP requestDescription
DraftsApiDeleteLocalizationDelete /drafts/{draftId}/localizations/{languageId}Remove a localization
DraftsApiGetDraftByIdGet /drafts/{draftId}Get Draft by ID
DraftsApiGetDraftLocalizationKeysGet /drafts/{draftId}/localizationKeysGet localization keys
DraftsApiGetDraftsGet /draftsList Drafts
DraftsApiGetLocalizationForDraftGet /drafts/{draftId}/localizationsGet localizations on a draft
DraftsApiSaveLocalizationPut /drafts/{draftId}/localizations/{languageId}Create or update a localization
DraftsApiSetTranslationPut /drafts/{draftId}/localizations/{languageId}/translationsSet translations for language
DraftsApiSubmitDraftForApprovalPost /drafts/{draftId}/publishRequestSubmit the draft for approval
LocalizationsApiGetLocalizationByIdGet /localizations/{localizationId}Get Localization Object by ID
TemplatesApiGetTemplateByIdGet /templates/{templateId}Get Template by ID
TemplatesApiGetTemplatesGet /templatesList Templates

Documentation For Models

Documentation For Authorization

Bearer

  • Type: API key

Example

auth := context.WithValue(context.Background(), sw.ContextAPIKey, sw.APIKey{
    Key: "APIKEY",
    Prefix: "Bearer", // Omit if not necessary.
})
r, err := client.Service.Operation(auth, args)

Author

[email protected]