forked from thecodingmachine/gotenberg-go-client
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathembed.go
More file actions
47 lines (35 loc) 路 970 Bytes
/
Copy pathembed.go
File metadata and controls
47 lines (35 loc) 路 970 Bytes
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
43
44
45
46
47
package gotenberg
import "github.com/starwalkn/gotenberg-go-client/v8/document"
type EmbedRequest struct {
pdfs []document.Document
embeds []document.Document
*baseRequest
}
func NewEmbedRequest(pdfs, embeds []document.Document) *EmbedRequest {
return &EmbedRequest{
pdfs: pdfs,
embeds: embeds,
baseRequest: newBaseRequest(),
}
}
func (req *EmbedRequest) endpoint() string {
return "/forms/pdfengines/embed"
}
func (req *EmbedRequest) formDocuments() map[string]document.Document {
files := make(map[string]document.Document)
for _, pdf := range req.pdfs {
files[pdf.Filename()] = pdf
}
return files
}
func (req *EmbedRequest) formEmbeds() map[string]document.Document {
embeds := make(map[string]document.Document)
for _, embed := range req.embeds {
embeds[embed.Filename()] = embed
}
return embeds
}
// Compile-time checks to ensure type implements desired interfaces.
var (
_ = MultipartRequest(new(EmbedRequest))
)