Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8.7.4 #30

Merged
merged 11 commits into from
Dec 21, 2024
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ GOLANG_VERSION=1.23.2
GOTENBERG_VERSION=8.14.1
GOLANGCI_LINT_VERSION=1.61.0

REPO=runatal/gotenberg-go-client/v8
REPO=starwalkn/gotenberg-go-client/v8

# gofmt and goimports all go files.
# gofumpt and goimports all go files.
fmt:
go fmt ./...
gofumpt -l -w .
go mod tidy

# run linters.
Expand Down
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

|Gotenberg version | Client version |
|:----------------:|:----------------------------------------------------------------------------------------------------------:|
|`8.x` **(actual)**| `8.7.3` **(actual)** <br/> |
|`8.x` **(actual)**| `8.7.4` **(actual)** <br/> |
|`7.x` | `<= 8.5.0` |
|`6.x` | <a href="https://github.com/thecodingmachine/gotenberg-go-client">thecodingmachine/gotenberg-go-client</a> |

Expand All @@ -18,7 +18,7 @@
To get the latest version of the client:

```zsh
$ go get github.com/runatal/gotenberg-go-client/v8@latest
$ go get github.com/starwalkn/gotenberg-go-client/v8@latest
```

## Preparing a documents
Expand All @@ -30,8 +30,8 @@ import (
"net/http"
"os"

"github.com/runatal/gotenberg-go-client/v8"
"github.com/runatal/gotenberg-go-client/v8/document"
"github.com/starwalkn/gotenberg-go-client/v8"
"github.com/starwalkn/gotenberg-go-client/v8/document"
)

func main() {
Expand Down Expand Up @@ -65,8 +65,8 @@ import (
"context"
"net/http"

"github.com/runatal/gotenberg-go-client/v8"
"github.com/runatal/gotenberg-go-client/v8/document"
"github.com/starwalkn/gotenberg-go-client/v8"
"github.com/starwalkn/gotenberg-go-client/v8/document"
)

func main() {
Expand Down Expand Up @@ -121,8 +121,8 @@ import (
"encoding/json"
"net/http"

"github.com/runatal/gotenberg-go-client/v8"
"github.com/runatal/gotenberg-go-client/v8/document"
"github.com/starwalkn/gotenberg-go-client/v8"
"github.com/starwalkn/gotenberg-go-client/v8/document"
)

func main() {
Expand Down Expand Up @@ -160,8 +160,8 @@ import (
"encoding/json"
"net/http"

"github.com/runatal/gotenberg-go-client/v8"
"github.com/runatal/gotenberg-go-client/v8/document"
"github.com/starwalkn/gotenberg-go-client/v8"
"github.com/starwalkn/gotenberg-go-client/v8/document"
)

func main() {
Expand Down Expand Up @@ -198,8 +198,8 @@ import (
"context"
"net/http"

"github.com/runatal/gotenberg-go-client/v8"
"github.com/runatal/gotenberg-go-client/v8/document"
"github.com/starwalkn/gotenberg-go-client/v8"
"github.com/starwalkn/gotenberg-go-client/v8/document"
)

func main() {
Expand Down
2 changes: 1 addition & 1 deletion baserequest.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"fmt"
"net/http"

"github.com/runatal/gotenberg-go-client/v8/document"
"github.com/starwalkn/gotenberg-go-client/v8/document"
)

type baseRequester interface {
Expand Down
2 changes: 1 addition & 1 deletion build/lint/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ARG GOLANG_VERSION

FROM golang:${GOLANG_VERSION}-alpine
FROM golang:${GOLANG_VERSION:-1.23.2}-alpine

# |--------------------------------------------------------------------------
# | GolangCI-Lint
Expand Down
8 changes: 4 additions & 4 deletions build/tests/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
ARG GOLANG_VERSION
ARG GOTENBERG_VERSION

FROM golang:${GOLANG_VERSION}-alpine AS golang
FROM golang:${GOLANG_VERSION:-1.23.2}-alpine AS golang

FROM gotenberg/gotenberg:${GOTENBERG_VERSION}
FROM gotenberg/gotenberg:${GOTENBERG_VERSION:-8.14.1}

USER root

Expand All @@ -29,8 +29,8 @@ COPY --from=golang /usr/local/go /usr/local/go
RUN export PATH="/usr/local/go/bin:$PATH" &&\
go version

ENV GOPATH /go
ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH
ENV GOPATH=/go
ENV PATH=$GOPATH/bin:/usr/local/go/bin:$PATH

# |--------------------------------------------------------------------------
# | Final touch
Expand Down
2 changes: 1 addition & 1 deletion chromium.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"strconv"
"time"

"github.com/runatal/gotenberg-go-client/v8/document"
"github.com/starwalkn/gotenberg-go-client/v8/document"
)

type chromiumRequest struct {
Expand Down
18 changes: 9 additions & 9 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ var (
errSendRequestFailed = errors.New("request sending failed")
)

// MultipartRequester is a type for sending form fields and form files (documents) to the Gotenberg API.
type MultipartRequester interface {
// multipartRequester is a type for sending form fields and form files (documents) to the Gotenberg API.
type multipartRequester interface {
endpoint() string

baseRequester
Expand Down Expand Up @@ -48,11 +48,11 @@ func NewClient(hostname string, httpClient *http.Client) (*Client, error) {
}

// Send sends a request to the Gotenberg API and returns the response.
func (c *Client) Send(ctx context.Context, req MultipartRequester) (*http.Response, error) {
func (c *Client) Send(ctx context.Context, req multipartRequester) (*http.Response, error) {
return c.send(ctx, req)
}

func (c *Client) send(ctx context.Context, r MultipartRequester) (*http.Response, error) {
func (c *Client) send(ctx context.Context, r multipartRequester) (*http.Response, error) {
req, err := c.createRequest(ctx, r, r.endpoint())
if err != nil {
return nil, err
Expand All @@ -67,11 +67,11 @@ func (c *Client) send(ctx context.Context, r MultipartRequester) (*http.Response
}

// Store creates the resulting file to given destination.
func (c *Client) Store(ctx context.Context, req MultipartRequester, dest string) error {
func (c *Client) Store(ctx context.Context, req multipartRequester, dest string) error {
return c.store(ctx, req, dest)
}

func (c *Client) store(ctx context.Context, req MultipartRequester, dest string) error {
func (c *Client) store(ctx context.Context, req multipartRequester, dest string) error {
if hasWebhook(req) {
return errWebhookNotAllowed
}
Expand Down Expand Up @@ -117,8 +117,8 @@ func writeNewFile(fpath string, in io.Reader) error {
return nil
}

func (c *Client) createRequest(ctx context.Context, br baseRequester, endpoint string) (*http.Request, error) {
body, contentType, err := multipartForm(br)
func (c *Client) createRequest(ctx context.Context, mr multipartRequester, endpoint string) (*http.Request, error) {
body, contentType, err := multipartForm(mr)
if err != nil {
return nil, err
}
Expand All @@ -131,7 +131,7 @@ func (c *Client) createRequest(ctx context.Context, br baseRequester, endpoint s
}

req.Header.Set("Content-Type", contentType)
for key, value := range br.customHeaders() {
for key, value := range mr.customHeaders() {
req.Header.Set(string(key), value)
}

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/runatal/gotenberg-go-client/v8
module github.com/starwalkn/gotenberg-go-client/v8

go 1.23.2

Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
Expand Down
4 changes: 2 additions & 2 deletions html.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package gotenberg

import (
"github.com/runatal/gotenberg-go-client/v8/document"
"github.com/starwalkn/gotenberg-go-client/v8/document"
)

const (
Expand Down Expand Up @@ -54,5 +54,5 @@ func (req *HTMLRequest) Assets(assets ...document.Document) {

// Compile-time checks to ensure type implements desired interfaces.
var (
_ = MultipartRequester(new(HTMLRequest))
_ = multipartRequester(new(HTMLRequest))
)
4 changes: 2 additions & 2 deletions html_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/runatal/gotenberg-go-client/v8/document"
"github.com/runatal/gotenberg-go-client/v8/test"
"github.com/starwalkn/gotenberg-go-client/v8/document"
"github.com/starwalkn/gotenberg-go-client/v8/test"
)

func TestHTML(t *testing.T) {
Expand Down
Loading
Loading