api

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package api refers to pdf converter API

BasePath: /
Version: 1.0

Consumes:
- application/json

Produces:
- application/pdf

swagger:meta

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HTMLToPDFGet

func HTMLToPDFGet(w http.ResponseWriter, r *http.Request)

HTMLToPDFGet renders pdf from html

func Logger

func Logger(inner http.Handler, name string) http.Handler

Logger is HTTP middleware that logging,

func NewHandler

func NewHandler(config Config) http.Handler

NewHandler generates HTTP handler to serve api

func NewRouter

func NewRouter() *mux.Router

NewRouter handles function of api

func RenderPdfWithPostTemplateData

func RenderPdfWithPostTemplateData(w http.ResponseWriter, r *http.Request)

RenderPdfWithPostTemplateData renders pdf with posted template & data

func RenderPdfWithPostTemplateOptions

func RenderPdfWithPostTemplateOptions(w http.ResponseWriter, r *http.Request)

RenderPdfWithPostTemplateOptions return options response

func RenderTemplate

func RenderTemplate(w http.ResponseWriter, r *http.Request)

RenderTemplate render pdf by template from request

func Server

func Server(config Config) error

Server provides new api from config

Types

type Config

type Config struct {
	Address       string
	TemplatesPath string
	PublicPath    string
}

Config is preference of api

type PrepareTemplateData

type PrepareTemplateData struct {
	Template        string            `json:"template"`
	Data            template.Context  `json:"data"`
	DocumentOptions document.Document `json:"documentOptions"`
}

PrepareTemplateData refers request of rendering pdf

type RenderTemplateRequest

type RenderTemplateRequest struct {
	TemplateName    string            `json:"templateName"`
	Data            template.Context  `json:"data"`
	DocumentOptions document.Document `json:"documentOptions"`
}

RenderTemplateRequest refers request of rendering pdf

type Route

type Route struct {
	Name        string
	Method      string
	Pattern     string
	HandlerFunc http.HandlerFunc
}

Route is a structure of entry point

type Routes

type Routes []Route

Routes is array of entrypoints this api

Jump to

Keyboard shortcuts

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