@@ -44,6 +44,7 @@ type Client struct {
4444 VPNRegions * VPNRegionsService
4545 LocationContexts * LocationContextsService
4646 AccessGroups * AccessGroupsService
47+ Settings * SettingsService
4748}
4849
4950type service struct {
@@ -134,9 +135,22 @@ func NewClient(baseURL, clientID, clientSecret string) (*Client, error) {
134135 c .VPNRegions = (* VPNRegionsService )(& c .common )
135136 c .LocationContexts = (* LocationContextsService )(& c .common )
136137 c .AccessGroups = (* AccessGroupsService )(& c .common )
138+ c .Settings = (* SettingsService )(& c .common )
137139 return c , nil
138140}
139141
142+ // setCommonHeaders sets the standard headers for API requests.
143+ // It sets Authorization and User-Agent headers, and sets Content-Type to application/json
144+ // if no Content-Type header is already present.
145+ func (c * Client ) setCommonHeaders (req * http.Request ) {
146+ req .Header .Set ("Authorization" , fmt .Sprintf ("Bearer %s" , c .Token ))
147+ req .Header .Set ("User-Agent" , c .UserAgent )
148+
149+ if req .Header .Get ("Content-Type" ) == "" {
150+ req .Header .Set ("Content-Type" , "application/json" )
151+ }
152+ }
153+
140154// DoRequest executes an HTTP request with authentication and rate limiting.
141155// It automatically adds the Bearer token, sets headers, and handles errors.
142156func (c * Client ) DoRequest (req * http.Request ) ([]byte , error ) {
@@ -145,9 +159,7 @@ func (c *Client) DoRequest(req *http.Request) ([]byte, error) {
145159 return nil , err
146160 }
147161
148- req .Header .Set ("Authorization" , fmt .Sprintf ("Bearer %s" , c .Token ))
149- req .Header .Set ("User-Agent" , c .UserAgent )
150- req .Header .Set ("Content-Type" , "application/json" )
162+ c .setCommonHeaders (req )
151163
152164 res , err := c .client .Do (req )
153165 if err != nil {
0 commit comments