diff --git a/algolia/abtesting/client.go b/algolia/abtesting/client.go index 23dff52e0..d01a0f630 100644 --- a/algolia/abtesting/client.go +++ b/algolia/abtesting/client.go @@ -14,6 +14,7 @@ import ( "runtime" "slices" "strings" + "time" "github.com/go-playground/validator/v10" @@ -61,6 +62,15 @@ func NewClientWithConfig(cfg AbtestingConfiguration) (*APIClient, error) { if cfg.UserAgent == "" { cfg.UserAgent = getUserAgent() } + if cfg.ReadTimeout == 0 { + cfg.ReadTimeout = 5000 * time.Millisecond + } + if cfg.ConnectTimeout == 0 { + cfg.ConnectTimeout = 2000 * time.Millisecond + } + if cfg.WriteTimeout == 0 { + cfg.WriteTimeout = 30000 * time.Millisecond + } return &APIClient{ appID: cfg.AppID, diff --git a/algolia/analytics/client.go b/algolia/analytics/client.go index 183a60216..e80bfffa1 100644 --- a/algolia/analytics/client.go +++ b/algolia/analytics/client.go @@ -14,6 +14,7 @@ import ( "runtime" "slices" "strings" + "time" "github.com/go-playground/validator/v10" @@ -61,6 +62,15 @@ func NewClientWithConfig(cfg AnalyticsConfiguration) (*APIClient, error) { if cfg.UserAgent == "" { cfg.UserAgent = getUserAgent() } + if cfg.ReadTimeout == 0 { + cfg.ReadTimeout = 5000 * time.Millisecond + } + if cfg.ConnectTimeout == 0 { + cfg.ConnectTimeout = 2000 * time.Millisecond + } + if cfg.WriteTimeout == 0 { + cfg.WriteTimeout = 30000 * time.Millisecond + } return &APIClient{ appID: cfg.AppID, diff --git a/algolia/ingestion/client.go b/algolia/ingestion/client.go index e7d422eec..a733b0d7b 100644 --- a/algolia/ingestion/client.go +++ b/algolia/ingestion/client.go @@ -14,6 +14,7 @@ import ( "runtime" "slices" "strings" + "time" "github.com/go-playground/validator/v10" @@ -61,6 +62,15 @@ func NewClientWithConfig(cfg IngestionConfiguration) (*APIClient, error) { if cfg.UserAgent == "" { cfg.UserAgent = getUserAgent() } + if cfg.ReadTimeout == 0 { + cfg.ReadTimeout = 25000 * time.Millisecond + } + if cfg.ConnectTimeout == 0 { + cfg.ConnectTimeout = 25000 * time.Millisecond + } + if cfg.WriteTimeout == 0 { + cfg.WriteTimeout = 25000 * time.Millisecond + } return &APIClient{ appID: cfg.AppID, diff --git a/algolia/insights/client.go b/algolia/insights/client.go index 3fa12eeb7..69cec43db 100644 --- a/algolia/insights/client.go +++ b/algolia/insights/client.go @@ -14,6 +14,7 @@ import ( "runtime" "slices" "strings" + "time" "github.com/go-playground/validator/v10" @@ -61,6 +62,15 @@ func NewClientWithConfig(cfg InsightsConfiguration) (*APIClient, error) { if cfg.UserAgent == "" { cfg.UserAgent = getUserAgent() } + if cfg.ReadTimeout == 0 { + cfg.ReadTimeout = 5000 * time.Millisecond + } + if cfg.ConnectTimeout == 0 { + cfg.ConnectTimeout = 2000 * time.Millisecond + } + if cfg.WriteTimeout == 0 { + cfg.WriteTimeout = 30000 * time.Millisecond + } return &APIClient{ appID: cfg.AppID, diff --git a/algolia/monitoring/client.go b/algolia/monitoring/client.go index d284d5ce5..c02166c40 100644 --- a/algolia/monitoring/client.go +++ b/algolia/monitoring/client.go @@ -13,6 +13,7 @@ import ( "net/url" "runtime" "strings" + "time" "github.com/go-playground/validator/v10" @@ -56,6 +57,15 @@ func NewClientWithConfig(cfg MonitoringConfiguration) (*APIClient, error) { if cfg.UserAgent == "" { cfg.UserAgent = getUserAgent() } + if cfg.ReadTimeout == 0 { + cfg.ReadTimeout = 5000 * time.Millisecond + } + if cfg.ConnectTimeout == 0 { + cfg.ConnectTimeout = 2000 * time.Millisecond + } + if cfg.WriteTimeout == 0 { + cfg.WriteTimeout = 30000 * time.Millisecond + } return &APIClient{ appID: cfg.AppID, diff --git a/algolia/personalization/client.go b/algolia/personalization/client.go index 79f068498..eb092a5a8 100644 --- a/algolia/personalization/client.go +++ b/algolia/personalization/client.go @@ -14,6 +14,7 @@ import ( "runtime" "slices" "strings" + "time" "github.com/go-playground/validator/v10" @@ -61,6 +62,15 @@ func NewClientWithConfig(cfg PersonalizationConfiguration) (*APIClient, error) { if cfg.UserAgent == "" { cfg.UserAgent = getUserAgent() } + if cfg.ReadTimeout == 0 { + cfg.ReadTimeout = 5000 * time.Millisecond + } + if cfg.ConnectTimeout == 0 { + cfg.ConnectTimeout = 2000 * time.Millisecond + } + if cfg.WriteTimeout == 0 { + cfg.WriteTimeout = 30000 * time.Millisecond + } return &APIClient{ appID: cfg.AppID, diff --git a/algolia/query-suggestions/client.go b/algolia/query-suggestions/client.go index 480e1a48a..b4d8fc892 100644 --- a/algolia/query-suggestions/client.go +++ b/algolia/query-suggestions/client.go @@ -14,6 +14,7 @@ import ( "runtime" "slices" "strings" + "time" "github.com/go-playground/validator/v10" @@ -61,6 +62,15 @@ func NewClientWithConfig(cfg QuerySuggestionsConfiguration) (*APIClient, error) if cfg.UserAgent == "" { cfg.UserAgent = getUserAgent() } + if cfg.ReadTimeout == 0 { + cfg.ReadTimeout = 5000 * time.Millisecond + } + if cfg.ConnectTimeout == 0 { + cfg.ConnectTimeout = 2000 * time.Millisecond + } + if cfg.WriteTimeout == 0 { + cfg.WriteTimeout = 30000 * time.Millisecond + } return &APIClient{ appID: cfg.AppID, diff --git a/algolia/recommend/client.go b/algolia/recommend/client.go index 56048ae10..04b87730d 100644 --- a/algolia/recommend/client.go +++ b/algolia/recommend/client.go @@ -13,6 +13,7 @@ import ( "net/url" "runtime" "strings" + "time" "github.com/go-playground/validator/v10" @@ -56,6 +57,15 @@ func NewClientWithConfig(cfg RecommendConfiguration) (*APIClient, error) { if cfg.UserAgent == "" { cfg.UserAgent = getUserAgent() } + if cfg.ReadTimeout == 0 { + cfg.ReadTimeout = 5000 * time.Millisecond + } + if cfg.ConnectTimeout == 0 { + cfg.ConnectTimeout = 2000 * time.Millisecond + } + if cfg.WriteTimeout == 0 { + cfg.WriteTimeout = 30000 * time.Millisecond + } return &APIClient{ appID: cfg.AppID, diff --git a/algolia/search/client.go b/algolia/search/client.go index 17b96b3b4..5db81848e 100644 --- a/algolia/search/client.go +++ b/algolia/search/client.go @@ -13,6 +13,7 @@ import ( "net/url" "runtime" "strings" + "time" "github.com/go-playground/validator/v10" @@ -56,6 +57,15 @@ func NewClientWithConfig(cfg SearchConfiguration) (*APIClient, error) { if cfg.UserAgent == "" { cfg.UserAgent = getUserAgent() } + if cfg.ReadTimeout == 0 { + cfg.ReadTimeout = 5000 * time.Millisecond + } + if cfg.ConnectTimeout == 0 { + cfg.ConnectTimeout = 2000 * time.Millisecond + } + if cfg.WriteTimeout == 0 { + cfg.WriteTimeout = 30000 * time.Millisecond + } return &APIClient{ appID: cfg.AppID,