Documentation ¶
Overview ¶
Package carbone provide an SDK to communicate with Carbone Render Carbone is the most efficient report generator It render from a JSON and template into PDF, DOCX, XLSX, PPTX, ODS and many more reports
Index ¶
- type APIResponse
- type APIResponseData
- type CSDK
- func (csdk *CSDK) AddTemplate(templateFileName string, args ...string) (APIResponse, error)
- func (csdk *CSDK) DeleteTemplate(templateID string) (APIResponse, error)
- func (csdk *CSDK) GenerateTemplateID(filepath string, args ...string) (string, error)
- func (csdk *CSDK) GetAPIVersion() (int, error)
- func (csdk *CSDK) GetReport(renderID string) ([]byte, error)
- func (csdk *CSDK) GetTemplate(templateID string) ([]byte, error)
- func (csdk *CSDK) Render(pathOrTemplateID string, jsonData string, args ...string) ([]byte, error)
- func (csdk *CSDK) RenderReport(templateID string, jsonData string) (APIResponse, error)
- func (csdk *CSDK) SetAPIHeaders(headers map[string]string)
- func (csdk *CSDK) SetAPIVersion(version int)
- func (csdk *CSDK) SetAccessToken(newToken string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIResponse ¶
type APIResponse struct { Success bool `json:"success"` Message string `json:"message,omitempty"` Error string `json:"error,omitempty"` Data APIResponseData `json:"data"` }
APIResponse object created during Carbone Render response.
type APIResponseData ¶
type APIResponseData struct { TemplateID string `json:"templateId,omitempty"` RenderID string `json:"renderId,omitempty"` TemplateFileExtension string `json:"inputFileExtension,omitempty"` }
APIResponseData object created during Carbone Render response.
type CSDK ¶
type CSDK struct {
// contains filtered or unexported fields
}
CSDK (CarboneSDK) to use Carbone render API easily.
func NewCarboneSDK ¶
NewCarboneSDK is a constructor and return a new instance of CSDK
func (*CSDK) AddTemplate ¶
func (csdk *CSDK) AddTemplate(templateFileName string, args ...string) (APIResponse, error)
AddTemplate upload your template to Carbone Render. The first parameter is the template file path, the second is an optional payload.
func (*CSDK) DeleteTemplate ¶
func (csdk *CSDK) DeleteTemplate(templateID string) (APIResponse, error)
DeleteTemplate Delete an uploaded template from a templateID.
func (*CSDK) GenerateTemplateID ¶
GenerateTemplateID Generate the templateID from a template filepath {string}: file path args {...string}: You can set a payload (args[0]) returns the file TemplateId
func (*CSDK) GetAPIVersion ¶
GetAPIVersion get the Carbone Render version
func (*CSDK) GetTemplate ¶
GetTemplate returns the original template from the templateId (Unique identifier of the template)
func (*CSDK) Render ¶
Render render a report from a templateID OR a template path. pathOrTemplateID {string}: Accept a file path OR a template ID returned by AddTemplate jsonData {string}: stringify json, all options here: https://carbone.io/api-reference.html#rendering-a-report args {...string}: You can pass an optinal payload used during the template upload (AddTemplate) to create a different templateID. It returns a []byte of the file.
func (*CSDK) RenderReport ¶
func (csdk *CSDK) RenderReport(templateID string, jsonData string) (APIResponse, error)
RenderReport a report from a templateID and a json data
func (*CSDK) SetAPIHeaders ¶ added in v1.1.0
SetAPIHeaders get the Carbone Render version
func (*CSDK) SetAPIVersion ¶
SetAPIVersion set the Carbone Render version
func (*CSDK) SetAccessToken ¶
SetAccessToken set the Carbone Render access token