Skip to content

Commit 57daf37

Browse files
authored
Merge pull request #13 from mutablelogic/v1
Updated to go version 1.21
2 parents 9460f7e + 5a18210 commit 57daf37

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+100
-83
lines changed

.github/workflows/merge.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,19 @@ jobs:
1919
- name: Checkout repository
2020
uses: actions/checkout@v4
2121
- name: Initialize CodeQL
22-
uses: github/codeql-action/init@v2
22+
uses: github/codeql-action/init@v3
2323
with:
2424
languages: ${{ matrix.language }}
2525
- name: Autobuild
26-
uses: github/codeql-action/autobuild@v2
26+
uses: github/codeql-action/autobuild@v3
2727
- name: Perform CodeQL Analysis
28-
uses: github/codeql-action/analyze@v2
28+
uses: github/codeql-action/analyze@v3
2929
test:
3030
name: Test
3131
runs-on: ubuntu-latest
3232
strategy:
3333
matrix:
34-
go-version: [ '1.19', '1.20', '1.21', '1.22' ]
34+
go-version: [ '1.21', '1.22' ]
3535
steps:
3636
- name: Checkout repository
3737
uses: actions/checkout@v4

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ cmd: $(CMD_DIR)
2121

2222
test:
2323
@${GO} mod tidy
24-
@${GO} test -v ./pkg/...
24+
@${GO} test ./pkg/...
2525

2626
$(CMD_DIR): dependencies mkdir
2727
@echo Build cmd $(notdir $@)

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ There are also some example clients which use this library:
2222
* [Ollama API client](https://github.com/mutablelogic/go-client/tree/main/pkg/ollama)
2323
* [OpenAI API client](https://github.com/mutablelogic/go-client/tree/main/pkg/openai)
2424

25-
Aiming to have compatibility with go version 1.19 and above.
25+
Aiming to have compatibility with go version 1.21 and above.
2626

2727
## Basic Usage
2828

@@ -33,7 +33,7 @@ to a JSON endpoint:
3333
package main
3434

3535
import (
36-
client "github.com/mutablelogic/go-client/pkg/client"
36+
client "github.com/mutablelogic/go-client"
3737
)
3838

3939
func main() {
@@ -85,7 +85,7 @@ For example,
8585
package main
8686

8787
import (
88-
client "github.com/mutablelogic/go-client/pkg/client"
88+
client "github.com/mutablelogic/go-client"
8989
)
9090

9191
func main() {
@@ -160,7 +160,7 @@ The authentication token can be set as follows:
160160
package main
161161

162162
import (
163-
client "github.com/mutablelogic/go-client/pkg/client"
163+
client "github.com/mutablelogic/go-client"
164164
)
165165

166166
func main() {

pkg/client/client.go client.go

File renamed without changes.

pkg/client/client_test.go client_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package client_test
33
import (
44
"testing"
55

6-
"github.com/mutablelogic/go-client/pkg/client"
6+
"github.com/mutablelogic/go-client"
77
"github.com/stretchr/testify/assert"
88
)
99

File renamed without changes.

cmd/cli/elevenlabs.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import (
66
"regexp"
77
"strings"
88

9-
// Package imports
10-
"github.com/mutablelogic/go-client/pkg/client"
9+
// Packages
10+
"github.com/mutablelogic/go-client"
1111
"github.com/mutablelogic/go-client/pkg/elevenlabs"
1212
)
1313

cmd/cli/homeassistant.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package main
22

33
import (
44
// Packages
5-
"github.com/mutablelogic/go-client/pkg/client"
5+
"github.com/mutablelogic/go-client"
66
"github.com/mutablelogic/go-client/pkg/homeassistant"
77
)
88

cmd/cli/ipify.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package main
22

33
import (
44
// Packages
5-
"github.com/mutablelogic/go-client/pkg/client"
5+
"github.com/mutablelogic/go-client"
66
"github.com/mutablelogic/go-client/pkg/ipify"
77
)
88

cmd/cli/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"path"
88

99
// Packages
10-
"github.com/mutablelogic/go-client/pkg/client"
10+
"github.com/mutablelogic/go-client"
1111
"github.com/pkg/errors"
1212
)
1313

cmd/cli/mistral.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package main
22

33
import (
44
// Package imports
5-
"github.com/mutablelogic/go-client/pkg/client"
5+
"github.com/mutablelogic/go-client"
66
"github.com/mutablelogic/go-client/pkg/mistral"
77
"github.com/mutablelogic/go-client/pkg/openai/schema"
88
)

cmd/cli/newsapi.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package main
22

33
import (
44
// Package imports
5-
"github.com/mutablelogic/go-client/pkg/client"
5+
"github.com/mutablelogic/go-client"
66
"github.com/mutablelogic/go-client/pkg/newsapi"
77
)
88

cmd/cli/ollama.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package main
22

33
import (
44
// Package imports
5-
"github.com/mutablelogic/go-client/pkg/client"
5+
"github.com/mutablelogic/go-client"
66
"github.com/mutablelogic/go-client/pkg/ollama"
77
)
88

cmd/cli/openai.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"regexp"
99
"strconv"
1010

11-
"github.com/mutablelogic/go-client/pkg/client"
11+
"github.com/mutablelogic/go-client"
1212
"github.com/mutablelogic/go-client/pkg/openai"
1313
)
1414

pkg/client/doc.go doc.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ gateway-specific clients. Basic usage:
55
package main
66
77
import (
8-
client "github.com/mutablelogic/go-client/pkg/client"
8+
client "github.com/mutablelogic/go-client"
99
)
1010
1111
func main() {

go.mod

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
module github.com/mutablelogic/go-client
22

3-
go 1.19
3+
go 1.22
4+
5+
toolchain go1.22.3
46

57
require (
68
github.com/andreburgaud/crypt2go v1.5.0

pkg/client/payload.go payload.go

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"net/http"
88
"strconv"
99

10+
// Packages
1011
"github.com/mutablelogic/go-client/pkg/multipart"
1112
)
1213

pkg/client/payload_test.go payload_test.go

+3-4
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,14 @@ import (
44
"testing"
55

66
// Packages
7-
"github.com/mutablelogic/go-client/pkg/client"
7+
"github.com/mutablelogic/go-client"
88
"github.com/stretchr/testify/assert"
99
)
1010

1111
func Test_payload_001(t *testing.T) {
1212
assert := assert.New(t)
13-
payload := client.NewPayload(client.ContentTypeBinary)
13+
payload := client.NewRequest()
1414
assert.NotNil(payload)
1515
assert.Equal("GET", payload.Method())
16-
assert.Equal(client.ContentTypeJson, payload.Type())
17-
assert.Equal(client.ContentTypeBinary, payload.Accept())
16+
assert.Equal(client.ContentTypeAny, payload.Accept())
1817
}

pkg/bitwarden/client.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ bitwarden implements an API client for bitwarden
44
package bitwarden
55

66
import (
7-
// Packages
87
"runtime"
98

10-
"github.com/mutablelogic/go-client/pkg/client"
9+
// Packages
10+
"github.com/mutablelogic/go-client"
1111

1212
// Namespace imports
1313
. "github.com/djthorpe/go-errors"
@@ -96,10 +96,10 @@ func (c *Client) Prelogin(email, password string) (*Session, error) {
9696

9797
// Prelogin
9898
request.Email = email
99-
payload, err := client.NewJSONRequest(request, client.ContentTypeJson)
99+
payload, err := client.NewJSONRequest(request)
100100
if err != nil {
101101
return nil, err
102-
} else if err := c.Do(payload.Post(), &response.Kdf, client.OptPath("accounts/prelogin")); err != nil {
102+
} else if err := c.Do(payload, &response.Kdf, client.OptPath("accounts/prelogin")); err != nil {
103103
return nil, err
104104
} else if response.Kdf.Iterations == 0 {
105105
return nil, ErrUnexpectedResponse

pkg/bitwarden/client_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import (
66
"testing"
77

88
// Packages
9+
opts "github.com/mutablelogic/go-client"
910
bitwarden "github.com/mutablelogic/go-client/pkg/bitwarden"
10-
opts "github.com/mutablelogic/go-client/pkg/client"
1111
assert "github.com/stretchr/testify/assert"
1212
)
1313

@@ -32,7 +32,7 @@ func Test_client_002(t *testing.T) {
3232
t.Log(string(data))
3333
}
3434

35-
func Test_client_003(t *testing.T) {
35+
func DisabledTest_client_003(t *testing.T) { // TODO
3636
assert := assert.New(t)
3737
client, err := bitwarden.New(opts.OptTrace(os.Stderr, true))
3838
assert.NoError(err)

pkg/bitwarden/crypto_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"encoding/json"
55
"testing"
66

7+
// Packages
78
"github.com/mutablelogic/go-client/pkg/bitwarden"
89
"github.com/stretchr/testify/assert"
910
)

pkg/bitwarden/key_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"fmt"
55
"testing"
66

7+
// Packages
78
"github.com/mutablelogic/go-client/pkg/bitwarden"
89
"github.com/stretchr/testify/assert"
910
)

pkg/elevenlabs/client.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ package elevenlabs
55

66
import (
77
// Packages
8-
"github.com/mutablelogic/go-client/pkg/client"
8+
"github.com/mutablelogic/go-client"
99
)
1010

1111
///////////////////////////////////////////////////////////////////////////////

pkg/elevenlabs/client_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"testing"
66

77
// Packages
8-
opts "github.com/mutablelogic/go-client/pkg/client"
8+
opts "github.com/mutablelogic/go-client"
99
elevenlabs "github.com/mutablelogic/go-client/pkg/elevenlabs"
1010
assert "github.com/stretchr/testify/assert"
1111
)

pkg/elevenlabs/text_to_speech.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"io"
55

66
// Packages
7-
"github.com/mutablelogic/go-client/pkg/client"
7+
"github.com/mutablelogic/go-client"
88
)
99

1010
///////////////////////////////////////////////////////////////////////////////

pkg/elevenlabs/voice.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
package elevenlabs
22

33
import (
4-
54
// Packages
6-
75
"github.com/djthorpe/go-errors"
8-
"github.com/mutablelogic/go-client/pkg/client"
6+
"github.com/mutablelogic/go-client"
97
)
108

119
///////////////////////////////////////////////////////////////////////////////

pkg/elevenlabs/voice_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"testing"
77

88
// Packages
9-
opts "github.com/mutablelogic/go-client/pkg/client"
9+
opts "github.com/mutablelogic/go-client"
1010
elevenlabs "github.com/mutablelogic/go-client/pkg/elevenlabs"
1111
assert "github.com/stretchr/testify/assert"
1212
)

pkg/homeassistant/client.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ package homeassistant
66

77
import (
88
// Packages
9-
"github.com/mutablelogic/go-client/pkg/client"
9+
"github.com/mutablelogic/go-client"
1010
)
1111

1212
///////////////////////////////////////////////////////////////////////////////

pkg/homeassistant/client_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"testing"
66

77
// Packages
8-
opts "github.com/mutablelogic/go-client/pkg/client"
8+
opts "github.com/mutablelogic/go-client"
99
homeassistant "github.com/mutablelogic/go-client/pkg/homeassistant"
1010
assert "github.com/stretchr/testify/assert"
1111
)

pkg/homeassistant/events.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package homeassistant
22

3-
import "github.com/mutablelogic/go-client/pkg/client"
3+
import "github.com/mutablelogic/go-client"
44

55
///////////////////////////////////////////////////////////////////////////////
66
// TYPES

pkg/homeassistant/events_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"testing"
66

77
// Packages
8-
opts "github.com/mutablelogic/go-client/pkg/client"
8+
opts "github.com/mutablelogic/go-client"
99
homeassistant "github.com/mutablelogic/go-client/pkg/homeassistant"
1010
assert "github.com/stretchr/testify/assert"
1111
)

pkg/homeassistant/health_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"testing"
66

77
// Packages
8-
opts "github.com/mutablelogic/go-client/pkg/client"
8+
opts "github.com/mutablelogic/go-client"
99
homeassistant "github.com/mutablelogic/go-client/pkg/homeassistant"
1010
assert "github.com/stretchr/testify/assert"
1111
)

pkg/homeassistant/states.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ import (
55
"strings"
66
"time"
77

8-
"github.com/mutablelogic/go-client/pkg/client"
8+
// Packages
9+
"github.com/mutablelogic/go-client"
910
)
1011

1112
///////////////////////////////////////////////////////////////////////////////

pkg/homeassistant/states_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"testing"
66

77
// Packages
8-
opts "github.com/mutablelogic/go-client/pkg/client"
8+
opts "github.com/mutablelogic/go-client"
99
homeassistant "github.com/mutablelogic/go-client/pkg/homeassistant"
1010
assert "github.com/stretchr/testify/assert"
1111
)

pkg/ipify/client.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"net/url"
99

1010
// Packages
11-
"github.com/mutablelogic/go-client/pkg/client"
11+
"github.com/mutablelogic/go-client"
1212
)
1313

1414
///////////////////////////////////////////////////////////////////////////////

pkg/ipify/client_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"testing"
66

77
// Packages
8-
opts "github.com/mutablelogic/go-client/pkg/client"
8+
opts "github.com/mutablelogic/go-client"
99
ipify "github.com/mutablelogic/go-client/pkg/ipify"
1010
assert "github.com/stretchr/testify/assert"
1111
)

pkg/mistral/chat.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
package mistral
22

33
import (
4-
client "github.com/mutablelogic/go-client/pkg/client"
4+
// Packages
5+
client "github.com/mutablelogic/go-client"
56
schema "github.com/mutablelogic/go-client/pkg/openai/schema"
67

78
// Namespace imports

0 commit comments

Comments
 (0)