Skip to content
This repository was archived by the owner on Apr 14, 2024. It is now read-only.

Commit 2434075

Browse files
author
Julien Neuhart
committed
updating for Gotenberg 6.0.0
1 parent 31993b5 commit 2434075

File tree

14 files changed

+28
-17
lines changed

14 files changed

+28
-17
lines changed

Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
GOLANG_VERSION=1.12
2-
GOTENBERG_VERSION=5.0.0
2+
GOTENBERG_VERSION=6.0.0
33
VERSION=snapshot
4+
GOLANGCI_LINT_VERSION=1.17.1
45

56
# gofmt and goimports all go files.
67
fmt:
@@ -9,7 +10,7 @@ fmt:
910

1011
# run all linters.
1112
lint:
12-
docker build --build-arg GOLANG_VERSION=$(GOLANG_VERSION) -t thecodingmachine/gotenberg-go-client:lint -f build/lint/Dockerfile .
13+
docker build --build-arg GOLANG_VERSION=$(GOLANG_VERSION) --build-arg GOLANGCI_LINT_VERSION=$(GOLANGCI_LINT_VERSION) -t thecodingmachine/gotenberg-go-client:lint -f build/lint/Dockerfile .
1314
docker run --rm -it -v "$(PWD):/lint" thecodingmachine/gotenberg-go-client:lint
1415

1516
# run all tests.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ A simple Go client for interacting with a Gotenberg API.
55
## Install
66

77
```bash
8-
$ go get -u github.com/thecodingmachine/gotenberg-go-client/v5
8+
$ go get -u github.com/thecodingmachine/gotenberg-go-client/v6
99
```
1010

1111
## Usage
1212

1313
```golang
14-
import "github.com/thecodingmachine/gotenberg-go-client/v5"
14+
import "github.com/thecodingmachine/gotenberg-go-client/v6"
1515

1616
func main() {
1717
// HTML conversion example.

build/lint/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ FROM golang:${GOLANG_VERSION}-stretch
1010
# | than gometalinter.
1111
# |
1212

13-
ENV GOLANGCI_LINT_VERSION 1.16.0
13+
ARG GOLANGCI_LINT_VERSION
1414

1515
RUN curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b /usr/local/bin v${GOLANGCI_LINT_VERSION} &&\
1616
golangci-lint --version

build/tests/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ FROM golang:${GOLANG_VERSION}-stretch AS golang
55

66
FROM thecodingmachine/gotenberg:${GOTENBERG_VERSION}
77

8+
USER root
9+
810
# |--------------------------------------------------------------------------
911
# | Common libraries
1012
# |--------------------------------------------------------------------------

build/tests/docker-entrypoint.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ set -xe
55
# Testing Go client.
66
gotenberg &
77
sleep 10
8-
go test -race -cover -covermode=atomic github.com/thecodingmachine/gotenberg-go-client/v5
9-
sleep 10 # allows Gotenberg to remove generated files (concurrent requests).
8+
go test -race -cover -covermode=atomic github.com/thecodingmachine/gotenberg-go-client/v6
9+
sleep 10 # allows Gotenberg to remove generated files.

client.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@ import (
1414
)
1515

1616
const (
17-
resultFilename string = "resultFilename"
18-
waitTimeout string = "waitTimeout"
19-
webhookURL string = "webhookURL"
17+
resultFilename string = "resultFilename"
18+
waitTimeout string = "waitTimeout"
19+
webhookURL string = "webhookURL"
20+
webhookURLTimeout string = "webhookURLTimeout"
2021
)
2122

2223
// Client facilitates interacting with
@@ -59,6 +60,11 @@ func (req *request) WebhookURL(url string) {
5960
req.values[webhookURL] = url
6061
}
6162

63+
// WebhookURL sets WebhookURLTimeout form field.
64+
func (req *request) WebhookURLTimeout(timeout float64) {
65+
req.values[webhookURLTimeout] = strconv.FormatFloat(timeout, 'f', 2, 64)
66+
}
67+
6268
func (req *request) formValues() map[string]string {
6369
return req.values
6470
}
@@ -87,6 +93,7 @@ func (c *Client) Store(req Request, dest string) error {
8793
if err != nil {
8894
return err
8995
}
96+
defer resp.Body.Close()
9097
return writeNewFile(dest, resp.Body)
9198
}
9299

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module github.com/thecodingmachine/gotenberg-go-client/v5
1+
module github.com/thecodingmachine/gotenberg-go-client/v6
22

33
go 1.12
44

go.sum

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
12
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
23
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
34
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=

html_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77

88
"github.com/stretchr/testify/assert"
99
"github.com/stretchr/testify/require"
10-
"github.com/thecodingmachine/gotenberg-go-client/v5/test"
10+
"github.com/thecodingmachine/gotenberg-go-client/v6/test"
1111
)
1212

1313
func TestHTML(t *testing.T) {

markdown_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77

88
"github.com/stretchr/testify/assert"
99
"github.com/stretchr/testify/require"
10-
"github.com/thecodingmachine/gotenberg-go-client/v5/test"
10+
"github.com/thecodingmachine/gotenberg-go-client/v6/test"
1111
)
1212

1313
func TestMarkdown(t *testing.T) {

0 commit comments

Comments
 (0)