Documentation
¶
Overview ¶
Package bapp provides a client for the BAPP Auto API.
Index ¶
- type Client
- func (c *Client) Create(contentType string, data interface{}) (map[string]interface{}, error)
- func (c *Client) Delete(contentType, id string) (map[string]interface{}, error)
- func (c *Client) DetailIntrospect(contentType string, pk string) (map[string]interface{}, error)
- func (c *Client) DetailTask(code string) (map[string]interface{}, error)
- func (c *Client) DownloadDocument(record map[string]interface{}, w io.Writer, output, label, variation string, ...) error
- func (c *Client) DownloadDocumentToFile(record map[string]interface{}, path, output, label, variation string, ...) error
- func (c *Client) Get(contentType, id string) (map[string]interface{}, error)
- func (c *Client) GetApp(appSlug string) (map[string]interface{}, error)
- func (c *Client) GetDocumentContent(record map[string]interface{}, output, label, variation string, download bool) ([]byte, error)
- func (c *Client) GetDocumentURL(record map[string]interface{}, output, label, variation string, download bool) string
- func (c *Client) List(contentType string, filters url.Values) (*PagedList, error)
- func (c *Client) ListIntrospect(contentType string) (map[string]interface{}, error)
- func (c *Client) ListTasks() ([]interface{}, error)
- func (c *Client) Me() (map[string]interface{}, error)
- func (c *Client) Patch(contentType, id string, data interface{}) (map[string]interface{}, error)
- func (c *Client) RunTask(code string, payload interface{}) (map[string]interface{}, error)
- func (c *Client) RunTaskAsync(code string, payload interface{}, pollInterval, timeout time.Duration) (map[string]interface{}, error)
- func (c *Client) Update(contentType, id string, data interface{}) (map[string]interface{}, error)
- type DocumentView
- type File
- type Option
- type PagedList
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
Host string
Tenant string
App string
// contains filtered or unexported fields
}
Client is a BAPP Auto API client.
func (*Client) DetailIntrospect ¶
DetailIntrospect returns detail introspect for a content type.
func (*Client) DetailTask ¶
DetailTask returns task configuration.
func (*Client) DownloadDocument ¶ added in v0.5.0
func (c *Client) DownloadDocument(record map[string]interface{}, w io.Writer, output, label, variation string, download bool) error
DownloadDocument streams document content to w without buffering it in memory. Returns an error when the record has no view tokens.
func (*Client) DownloadDocumentToFile ¶ added in v0.5.0
func (c *Client) DownloadDocumentToFile(record map[string]interface{}, path, output, label, variation string, download bool) error
DownloadDocumentToFile is a convenience wrapper around DownloadDocument that writes directly to a file path.
func (*Client) GetDocumentContent ¶ added in v0.4.1
func (c *Client) GetDocumentContent(record map[string]interface{}, output, label, variation string, download bool) ([]byte, error)
GetDocumentContent fetches document content (PDF, HTML, JPG, etc.) as bytes. Builds the URL via GetDocumentURL and performs a plain GET request. Returns (nil, nil) when the record has no view tokens.
func (*Client) GetDocumentURL ¶ added in v0.4.1
func (c *Client) GetDocumentURL(record map[string]interface{}, output, label, variation string, download bool) string
GetDocumentURL builds a document render/download URL from a record. Prefers public_view when both formats are present.
output: "html", "pdf", "jpg", or "context" label: select a specific view by label (empty string = first available) variation: variation code for public_view entries (empty string = use default) download: when true the response is sent as an attachment
func (*Client) List ¶
List lists entities for a content type. Returns a PagedList with Results, Count, Next, Previous.
func (*Client) ListIntrospect ¶
ListIntrospect returns list introspect for a content type.
func (*Client) RunTaskAsync ¶
func (c *Client) RunTaskAsync(code string, payload interface{}, pollInterval, timeout time.Duration) (map[string]interface{}, error)
RunTaskAsync runs a long-running task and polls until finished. Returns the final task data which includes "file" when the task produces a download.
type DocumentView ¶ added in v0.4.1
type DocumentView struct {
Label string
Token string
Type string // "public_view" or "view_token"
Variations []map[string]interface{}
DefaultVariation string
}
DocumentView represents a normalized document view entry extracted from a record.
func GetDocumentViews ¶ added in v0.4.1
func GetDocumentViews(record map[string]interface{}) []DocumentView
GetDocumentViews extracts available document views from a record. Works with both public_view (new) and view_token (legacy) formats.
type Option ¶
type Option func(*Client)
Option configures the client.
func WithMaxRetries ¶ added in v0.5.0
WithMaxRetries sets the maximum number of retries on transient errors.
func WithTimeout ¶ added in v0.5.0
WithTimeout sets the HTTP client timeout.
func WithUserAgent ¶ added in v0.4.3
WithUserAgent sets a custom User-Agent header.