@@ -20,7 +20,6 @@ import (
20
20
"net/url"
21
21
"runtime"
22
22
"strings"
23
- "sync"
24
23
"time"
25
24
)
26
25
@@ -47,20 +46,15 @@ var (
47
46
type Feature int
48
47
49
48
type MessageBirdClient interface {
50
- EnableFeatures (feature Feature )
51
- DisableFeatures (feature Feature )
52
- IsFeatureEnabled (feature Feature ) bool
53
49
Request (v interface {}, method , path string , data interface {}) error
54
50
}
55
51
56
52
// Client is used to access API with a given key.
57
53
// Uses standard lib HTTP client internally, so should be reused instead of created as needed and it is safe for concurrent use.
58
54
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.
64
58
}
65
59
66
60
type contentType string
@@ -83,7 +77,6 @@ func New(accessKey string) *Client {
83
77
HTTPClient : & http.Client {
84
78
Timeout : httpClientTimeout ,
85
79
},
86
- features : make (map [Feature ]bool ),
87
80
}
88
81
}
89
82
@@ -93,30 +86,6 @@ func SetVoiceErrorReader(r errorReader) {
93
86
voiceErrorReader = r
94
87
}
95
88
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
-
120
89
// Request is for internal use only and unstable.
121
90
func (c * Client ) Request (v interface {}, method , path string , data interface {}) error {
122
91
if ! strings .HasPrefix (path , "https://" ) && ! strings .HasPrefix (path , "http://" ) {
0 commit comments