Skip to content

Commit

Permalink
Merge pull request #210 from kyleyee23/kyleyee23-fix-interface
Browse files Browse the repository at this point in the history
expose Get and Put methods in API interface
  • Loading branch information
nukosuke authored Nov 5, 2021
2 parents 8e1d1a9 + 1168ea7 commit 1ce0a60
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 7 deletions.
1 change: 1 addition & 0 deletions zendesk/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ package zendesk
type API interface {
AutomationAPI
AttachmentAPI
BaseAPI
BrandAPI
DynamicContentAPI
GroupAPI
Expand Down
30 changes: 30 additions & 0 deletions zendesk/mock/client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 15 additions & 7 deletions zendesk/zendesk.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,21 @@ var defaultHeaders = map[string]string{

var subdomainRegexp = regexp.MustCompile("^[a-z0-9][a-z0-9-]+[a-z0-9]$")

// Client of Zendesk API
type Client struct {
baseURL *url.URL
httpClient *http.Client
credential Credential
headers map[string]string
}
type (
// Client of Zendesk API
Client struct {
baseURL *url.URL
httpClient *http.Client
credential Credential
headers map[string]string
}

// BaseAPI encapsulates base methods for zendesk client
BaseAPI interface {
Get(ctx context.Context, path string) ([]byte, error)
Post(ctx context.Context, path string, data interface{}) ([]byte, error)
}
)

// NewClient creates new Zendesk API client
func NewClient(httpClient *http.Client) (*Client, error) {
Expand Down

0 comments on commit 1ce0a60

Please sign in to comment.