-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdoc.go
More file actions
42 lines (42 loc) · 1.41 KB
/
doc.go
File metadata and controls
42 lines (42 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// Package cloudlayer provides a Go client for the CloudLayer.io document
// generation API. It supports URL/HTML/template to PDF/image conversion,
// document format conversion, job management, and storage configuration.
//
// Basic usage:
//
// client, err := cloudlayer.NewClient("your-api-key", cloudlayer.V2)
// if err != nil {
// log.Fatal(err)
// }
//
// result, err := client.HTMLToPDF(ctx, &cloudlayer.HTMLToPDFOptions{
// HTMLOptions: cloudlayer.HTMLOptions{
// HTML: cloudlayer.EncodeHTML("<h1>Hello World</h1>"),
// },
// })
//
// # API Versions
//
// CloudLayer.io supports two API versions with different response behaviors:
//
// - V1: Synchronous by default. Conversion endpoints return raw binary data.
// - V2: Asynchronous by default. Conversion endpoints return a [Job] object.
// Use [Client.WaitForJob] to poll until completion, then
// [Client.DownloadJobResult] to fetch the binary.
//
// The API version must be specified when creating the client — there is no default.
//
// # Error Handling
//
// All errors returned by the SDK are concrete types that support [errors.As]:
//
// var authErr *cloudlayer.AuthError
// if errors.As(err, &authErr) {
// // Handle authentication failure (401 or 403)
// }
//
// var rateLimitErr *cloudlayer.RateLimitError
// if errors.As(err, &rateLimitErr) {
// // Handle rate limiting (429), check rateLimitErr.RetryAfter
// }
package cloudlayer