Skip to content

Commit 998ac14

Browse files
committed
remove features field from client
1 parent 3615c49 commit 998ac14

File tree

1 file changed

+3
-34
lines changed

1 file changed

+3
-34
lines changed

client.go

Lines changed: 3 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import (
2020
"net/url"
2121
"runtime"
2222
"strings"
23-
"sync"
2423
"time"
2524
)
2625

@@ -47,20 +46,15 @@ var (
4746
type Feature int
4847

4948
type MessageBirdClient interface {
50-
EnableFeatures(feature Feature)
51-
DisableFeatures(feature Feature)
52-
IsFeatureEnabled(feature Feature) bool
5349
Request(v interface{}, method, path string, data interface{}) error
5450
}
5551

5652
// Client is used to access API with a given key.
5753
// Uses standard lib HTTP client internally, so should be reused instead of created as needed and it is safe for concurrent use.
5854
type Client struct {
59-
AccessKey string // The API access key.
60-
HTTPClient *http.Client // The HTTP client to send requests on.
61-
DebugLog *log.Logger // Optional logger for debugging purposes.
62-
features map[Feature]bool // Enabled features.
63-
featuresMutex sync.RWMutex // Mutex for accessing feature map.
55+
AccessKey string // The API access key.
56+
HTTPClient *http.Client // The HTTP client to send requests on.
57+
DebugLog *log.Logger // Optional logger for debugging purposes.
6458
}
6559

6660
type contentType string
@@ -83,7 +77,6 @@ func New(accessKey string) *Client {
8377
HTTPClient: &http.Client{
8478
Timeout: httpClientTimeout,
8579
},
86-
features: make(map[Feature]bool),
8780
}
8881
}
8982

@@ -93,30 +86,6 @@ func SetVoiceErrorReader(r errorReader) {
9386
voiceErrorReader = r
9487
}
9588

96-
// EnableFeatures enables a feature.
97-
func (c *Client) EnableFeatures(feature Feature) {
98-
c.featuresMutex.Lock()
99-
defer c.featuresMutex.Unlock()
100-
c.features[feature] = true
101-
}
102-
103-
// DisableFeatures disables a feature.
104-
func (c *Client) DisableFeatures(feature Feature) {
105-
c.featuresMutex.Lock()
106-
defer c.featuresMutex.Unlock()
107-
c.features[feature] = false
108-
}
109-
110-
// IsFeatureEnabled checks if a feature is enabled.
111-
func (c *Client) IsFeatureEnabled(feature Feature) bool {
112-
c.featuresMutex.RLock()
113-
defer c.featuresMutex.RUnlock()
114-
if enabled, ok := c.features[feature]; ok {
115-
return enabled
116-
}
117-
return false
118-
}
119-
12089
// Request is for internal use only and unstable.
12190
func (c *Client) Request(v interface{}, method, path string, data interface{}) error {
12291
if !strings.HasPrefix(path, "https://") && !strings.HasPrefix(path, "http://") {

0 commit comments

Comments
 (0)