Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNotFound is returned on a 404 ErrNotFound error = fmt.Errorf("Resource not found") )
Functions ¶
This section is empty.
Types ¶
type Endpoint ¶
type Endpoint struct {
// contains filtered or unexported fields
}
Endpoint is the starting point for all publishing activity
func NewEndpoint ¶
NewEndpoint starts a publishing session.
func (*Endpoint) AvailableVersions ¶
AvailableVersions returns a list of versions available on the server. The version 'latest' is not included in the list.
func (*Endpoint) NewPublishRequest ¶
func (e *Endpoint) NewPublishRequest() *PublishRequest
NewPublishRequest is the base structure to start a publishing request to the endpoint.
func (*Endpoint) Publish ¶
func (e *Endpoint) Publish(data *PublishRequest) (PublishResponse, error)
Publish sends data to the server.
type Error ¶
type Error struct { ErrorType string `json:"type"` Title string Detail string Instance string RequestID int }
Error is an error struct which is used when the communication between the client and the endpoint is broken.
type Errormessage ¶
Errormessage contains a message from the publisher together with its error code. The error message is a message from the publishing run (like image not found).
type ProcessStatus ¶
type ProcessStatus struct { Finished *time.Time Errors int Errormessages []Errormessage }
ProcessStatus contains information about the current status of the PDF generation. If the Finished field is nil, Errors and Errormessages are not set.
type PublishFile ¶
PublishFile is a file for the publishing request.
type PublishRequest ¶
type PublishRequest struct { Version string Files []PublishFile `json:"files"` // contains filtered or unexported fields }
PublishRequest is an instance to send data to a server and get a PDF. One Endpoint can have multiple PublishingRequests.
func (*PublishRequest) AttachFile ¶
func (p *PublishRequest) AttachFile(pathToFile string) error
AttachFile adds a file to the PublishRequest for the server. Usually you have to provide the layout and the data file. All assets (fonts, images) can be referenced by http(s) hyperlinks.
type PublishResponse ¶
type PublishResponse struct { ID string // contains filtered or unexported fields }
PublishResponse holds the id to the publishing process.
func (*PublishResponse) GetPDF ¶
func (p *PublishResponse) GetPDF(w io.Writer) error
GetPDF gets the PDF from the server. In case of an error, the bytes written to w might not contain a valid PDF.
func (*PublishResponse) Status ¶
func (p *PublishResponse) Status() (*ProcessStatus, error)
Status returns the status of the publishing run. If the process is still running, the Finished field is set to nil.
func (*PublishResponse) Wait ¶
func (p *PublishResponse) Wait() (*ProcessStatus, error)
Wait for the publishing process to finish. Return an error if something is wrong with the request. If there is an error during the publishing run but the request itself is without errors, the error is nil, but the returned publishing status has the numbers of errors set.