Skip to content

Commit 105e0b9

Browse files
committed
Use solver client in examples
1 parent 36c80ab commit 105e0b9

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

examples/preffered/main.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ package main
22

33
import (
44
"fmt"
5+
"net/http"
56

6-
"github.com/ourstudio-se/puan-sdk-go/internal/gateway/glpk"
77
"github.com/ourstudio-se/puan-sdk-go/puan"
8+
"github.com/ourstudio-se/puan-sdk-go/solver"
89
)
910

1011
//nolint:gocyclo
@@ -57,7 +58,8 @@ func main() {
5758
}
5859

5960
// Create a solution creator with a solver client
60-
solutionCreator := puan.NewSolutionCreator(glpk.NewDefaultClient("http://127.0.0.1:9000"))
61+
solverClient := solver.NewClient("http://127.0.0.1:9000", "1234567890", &http.Client{})
62+
solutionCreator := puan.NewSolutionCreator(solverClient)
6163

6264
// Create the solution
6365
envelope, err := solutionCreator.Create(selections, ruleset, nil)

examples/time/main.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@ package main
22

33
import (
44
"fmt"
5+
"net/http"
56
"time"
67

7-
"github.com/ourstudio-se/puan-sdk-go/internal/gateway/glpk"
88
"github.com/ourstudio-se/puan-sdk-go/puan"
9+
"github.com/ourstudio-se/puan-sdk-go/solver"
910
)
1011

1112
//nolint:gocyclo
@@ -48,7 +49,8 @@ func main() {
4849
panic(err)
4950
}
5051

51-
solutionCreator := puan.NewSolutionCreator(glpk.NewDefaultClient("http://127.0.0.1:9000"))
52+
solverClient := solver.NewClient("http://127.0.0.1:9000", "1234567890", &http.Client{})
53+
solutionCreator := puan.NewSolutionCreator(solverClient)
5254

5355
inSecondPeriod := endOfFirstPeriod.Add(5 * time.Minute)
5456
envelope, err := solutionCreator.Create(

0 commit comments

Comments
 (0)