blazingdocs

package module
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 25, 2021 License: MIT Imports: 11 Imported by: 0

README

BlazingDocs GO client

High-performance document generation API. Generate documents and reports from СSV, JSON, XML with 99,9% uptime and 24/7 monitoring.

Installation

import (
    "github.com/blazingdocs/blazingdocs-go"
    "github.com/blazingdocs/blazingdocs-go/config"
)
go get -u github.com/blazingdocs/blazingdocs-go

Integration basics

Setup

You can get your API Key at https://app.blazingdocs.com

config.Default = config.Init("YOUR-API-KEY")
client := blazingdocs.Client{
    Config: *config.Default,
}
Getting account info
resp, err := client.GetAccount()
Getting merge templates list
var s string
tempResp, tempErr := client.GetTemplates(s)
Getting usage info
usageResp, usageErr := client.GetUsage()
Executing merge
file, _ := ioutil.ReadFile("../PO-Template.json")
s := string(file)

params := parameters.MergeParameters{
    DataSourceName: "data", // data source name
    DataSourceType: utils.JSON_TYPE, // data in json format
    Strict:         true, // keep json types
    ParseColumns:   false, // true if data is csv file with column names
    Sequence:       false, // data is object
}

ffile, _ := os.Open("../PO-Template.docx")
formFile := utils.FormFile{
    Name:    "PO-Template.docx",
    Content: ffile,
}

config.Default = config.Init("YOUR-API-KEY")
client := blazingdocs.Client{
    Config: *config.Default,
}

resp, err := client.MergeWithFile(s, "output.pdf", params, formFile)

Documentation

See more details here https://docs.blazingdocs.com

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlazingDocs

type BlazingDocs interface {
	GetAccount() (models.AccountModel, error)

	GetUsage() (models.UsageModel, error)

	GetTemplates(tempatePath string) (models.TemplateModel, error)

	MergeWithFile(data string, fileName string, param parameters.MergeParameters, file utils.FormFile)

	MergeWithGuid(data string, fileName string, param parameters.MergeParameters, guid string)

	MergeWithRelativePath(data string, fileName string, param parameters.MergeParameters, path string)
}

type Client

type Client struct {
	Config     config.Config
	HttpClient http.Client
}

func (*Client) Do

func (client *Client) Do(req *http.Request) (*http.Response, error)

func (*Client) Get

func (client *Client) Get(url string) (resp *http.Response, err error)

func (*Client) GetAccount

func (client *Client) GetAccount() (acc models.AccountModel, err error)

func (*Client) GetTemplates

func (client *Client) GetTemplates(templatePath string) (temp models.TemplateModel, err error)

func (*Client) GetUsage

func (client *Client) GetUsage() (us models.UsageModel, err error)

func (*Client) MergeWithFile

func (client *Client) MergeWithFile(data string, fileName string, param parameters.MergeParameters, file utils.FormFile) (op models.OperationModel, err error)

func (*Client) MergeWithGuid

func (client *Client) MergeWithGuid(data string, fileName string, param parameters.MergeParameters, guid string) (op models.OperationModel, err error)

func (*Client) MergeWithRelativePath

func (client *Client) MergeWithRelativePath(data string, fileName string, param parameters.MergeParameters, path string) (op models.OperationModel, err error)

func (*Client) Post

func (client *Client) Post(url, contentType string, body io.Reader) (resp *http.Response, err error)

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL