Skip to content
This repository was archived by the owner on Apr 4, 2023. It is now read-only.

Commit c061a85

Browse files
committed
Rename client type
1 parent 799c4a2 commit c061a85

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

client.go

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ var (
3636
xmlCheck = regexp.MustCompile("(?i:[application|text]/xml)")
3737
)
3838

39-
// APIClient manages communication with the DevCycle Management API API v1.0.0
40-
// In most cases there should be only one, shared, APIClient.
41-
type APIClient struct {
39+
// DVCClient manages communication with the DevCycle Management API API v1.0.0
40+
// In most cases there should be only one, shared, DVCClient.
41+
type DVCClient struct {
4242
cfg *Configuration
4343
common service // Reuse a single struct instead of allocating one for each service on the heap.
4444

@@ -60,17 +60,17 @@ type APIClient struct {
6060
}
6161

6262
type service struct {
63-
client *APIClient
63+
client *DVCClient
6464
}
6565

6666
// NewAPIClient creates a new API client. Requires a userAgent string describing your application.
6767
// optionally a custom http.Client to allow for advanced features such as caching.
68-
func NewAPIClient(cfg *Configuration) *APIClient {
68+
func NewAPIClient(cfg *Configuration) *DVCClient {
6969
if cfg.HTTPClient == nil {
7070
cfg.HTTPClient = http.DefaultClient
7171
}
7272

73-
c := &APIClient{}
73+
c := &DVCClient{}
7474
c.cfg = cfg
7575
c.common.client = c
7676

@@ -161,17 +161,17 @@ func parameterToString(obj interface{}, collectionFormat string) string {
161161
}
162162

163163
// callAPI do the request.
164-
func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) {
164+
func (c *DVCClient) callAPI(request *http.Request) (*http.Response, error) {
165165
return c.cfg.HTTPClient.Do(request)
166166
}
167167

168168
// Change base path to allow switching to mocks
169-
func (c *APIClient) ChangeBasePath(path string) {
169+
func (c *DVCClient) ChangeBasePath(path string) {
170170
c.cfg.BasePath = path
171171
}
172172

173173
// prepareRequest build the request
174-
func (c *APIClient) prepareRequest(
174+
func (c *DVCClient) prepareRequest(
175175
ctx context.Context,
176176
path string, method string,
177177
postBody interface{},
@@ -326,18 +326,18 @@ func (c *APIClient) prepareRequest(
326326
return localVarRequest, nil
327327
}
328328

329-
func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) {
330-
if strings.Contains(contentType, "application/xml") {
331-
if err = xml.Unmarshal(b, v); err != nil {
332-
return err
333-
}
334-
return nil
335-
} else if strings.Contains(contentType, "application/json") {
336-
if err = json.Unmarshal(b, v); err != nil {
337-
return err
338-
}
339-
return nil
329+
func (c *DVCClient) decode(v interface{}, b []byte, contentType string) (err error) {
330+
if strings.Contains(contentType, "application/xml") {
331+
if err = xml.Unmarshal(b, v); err != nil {
332+
return err
333+
}
334+
return nil
335+
} else if strings.Contains(contentType, "application/json") {
336+
if err = json.Unmarshal(b, v); err != nil {
337+
return err
340338
}
339+
return nil
340+
}
341341
return errors.New("undefined response type")
342342
}
343343

0 commit comments

Comments
 (0)