Skip to content

Commit

Permalink
Add missing optFns
Browse files Browse the repository at this point in the history
  • Loading branch information
hupe1980 committed Sep 17, 2023
1 parent d76f9e6 commit 78c2c1b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions integration/ernie/ernie.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,17 @@ type Client struct {
mu sync.RWMutex
}

// New creates a new instance of the Ernie client with default options.
func New(clientID, clientSecret string) *Client {
// New creates a new instance of the Ernie client.
func New(clientID, clientSecret string, optFns ...func(o *Options)) *Client {
opts := Options{
APIUrl: "https://aip.baidubce.com",
HTTPClient: http.DefaultClient,
}

for _, fn := range optFns {
fn(&opts)
}

return &Client{
clientID: clientID,
clientSecret: clientSecret,
Expand Down

0 comments on commit 78c2c1b

Please sign in to comment.