Skip to content

Commit

Permalink
Merge pull request #82 from nukosuke/fix-non-ptr-receiver
Browse files Browse the repository at this point in the history
Fix non-pointer receiver
  • Loading branch information
nukosuke authored Mar 17, 2019
2 parents 8ab79cc + 3b34085 commit 118a913
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
10 changes: 5 additions & 5 deletions zendesk/ticket_field.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ type TicketFieldAPI interface {

// GetTicketFields fetches ticket field list
// ref: https://developer.zendesk.com/rest_api/docs/core/ticket_fields#list-ticket-fields
func (z Client) GetTicketFields() ([]TicketField, Page, error) {
func (z *Client) GetTicketFields() ([]TicketField, Page, error) {
var data struct {
TicketFields []TicketField `json:"ticket_fields"`
Page
Expand All @@ -76,7 +76,7 @@ func (z Client) GetTicketFields() ([]TicketField, Page, error) {

// CreateTicketField creates new ticket field
// ref: https://developer.zendesk.com/rest_api/docs/core/ticket_fields#create-ticket-field
func (z Client) CreateTicketField(ticketField TicketField) (TicketField, error) {
func (z *Client) CreateTicketField(ticketField TicketField) (TicketField, error) {
var data, result struct {
TicketField TicketField `json:"ticket_field"`
}
Expand All @@ -96,7 +96,7 @@ func (z Client) CreateTicketField(ticketField TicketField) (TicketField, error)

// GetTicketField gets a specified ticket field
// ref: https://developer.zendesk.com/rest_api/docs/support/ticket_fields#show-ticket-field
func (z Client) GetTicketField(ticketID int64) (TicketField, error) {
func (z *Client) GetTicketField(ticketID int64) (TicketField, error) {
var result struct {
TicketField TicketField `json:"ticket_field"`
}
Expand All @@ -117,7 +117,7 @@ func (z Client) GetTicketField(ticketID int64) (TicketField, error) {

// UpdateTicketField updates a field with the specified ticket field
// ref: https://developer.zendesk.com/rest_api/docs/support/ticket_fields#update-ticket-field
func (z Client) UpdateTicketField(ticketID int64, field TicketField) (TicketField, error) {
func (z *Client) UpdateTicketField(ticketID int64, field TicketField) (TicketField, error) {
var result, data struct {
TicketField TicketField `json:"ticket_field"`
}
Expand All @@ -140,7 +140,7 @@ func (z Client) UpdateTicketField(ticketID int64, field TicketField) (TicketFiel

// DeleteTicketField deletes the specified ticket field
// ref: https://developer.zendesk.com/rest_api/docs/support/ticket_fields#delete-ticket-field
func (z Client) DeleteTicketField(ticketID int64) error {
func (z *Client) DeleteTicketField(ticketID int64) error {
err := z.Delete(fmt.Sprintf("/ticket_fields/%d.json", ticketID))

if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions zendesk/ticket_form.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ type TicketFormAPI interface {
}

// GetTicketForms fetches ticket forms
func (z Client) GetTicketForms() ([]TicketForm, Page, error) {
func (z *Client) GetTicketForms() ([]TicketForm, Page, error) {
var data struct {
TicketForms []TicketForm `json:"ticket_forms"`
Page
Expand All @@ -47,7 +47,7 @@ func (z Client) GetTicketForms() ([]TicketForm, Page, error) {

// CreateTicketForm creates new ticket form
// ref: https://developer.zendesk.com/rest_api/docs/core/ticket_forms#create-ticket-forms
func (z Client) CreateTicketForm(ticketForm TicketForm) (TicketForm, error) {
func (z *Client) CreateTicketForm(ticketForm TicketForm) (TicketForm, error) {
var data, result struct {
TicketForm TicketForm `json:"ticket_form"`
}
Expand Down
2 changes: 1 addition & 1 deletion zendesk/trigger.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func (z *Client) GetTriggers() ([]Trigger, Page, error) {

// CreateTrigger creates new trigger
// ref: https://developer.zendesk.com/rest_api/docs/core/triggers#create-trigger
func (z Client) CreateTrigger(trigger Trigger) (Trigger, error) {
func (z *Client) CreateTrigger(trigger Trigger) (Trigger, error) {
var data, result struct {
Trigger Trigger `json:"trigger"`
}
Expand Down
2 changes: 1 addition & 1 deletion zendesk/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func (z *Client) GetUsers() ([]User, Page, error) {

// CreateUser creates new user
// ref: https://developer.zendesk.com/rest_api/docs/core/triggers#create-trigger
func (z Client) CreateUser(user User) (User, error) {
func (z *Client) CreateUser(user User) (User, error) {
var data, result struct {
User User `json:"user"`
}
Expand Down
8 changes: 4 additions & 4 deletions zendesk/zendesk.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func (z *Client) SetCredential(cred Credential) {
}

// Get get JSON data from API and returns its body as []bytes
func (z Client) Get(path string) ([]byte, error) {
func (z *Client) Get(path string) ([]byte, error) {
req, err := http.NewRequest(http.MethodGet, z.baseURL.String()+path, nil)
if err != nil {
return nil, err
Expand Down Expand Up @@ -145,7 +145,7 @@ func (z Client) Get(path string) ([]byte, error) {
}

// Post send data to API and returns response body as []bytes
func (z Client) Post(path string, data interface{}) ([]byte, error) {
func (z *Client) Post(path string, data interface{}) ([]byte, error) {
bytes, err := json.Marshal(data)
if err != nil {
return nil, err
Expand Down Expand Up @@ -179,7 +179,7 @@ func (z Client) Post(path string, data interface{}) ([]byte, error) {
}

// Put sends data to API and returns response body as []bytes
func (z Client) Put(path string, data interface{}) ([]byte, error) {
func (z *Client) Put(path string, data interface{}) ([]byte, error) {
bytes, err := json.Marshal(data)
if err != nil {
return nil, err
Expand Down Expand Up @@ -213,7 +213,7 @@ func (z Client) Put(path string, data interface{}) ([]byte, error) {
}

// Delete sends data to API and returns an error if unsuccessful
func (z Client) Delete(path string) error {
func (z *Client) Delete(path string) error {
req, err := http.NewRequest(http.MethodDelete, z.baseURL.String()+path, nil)
if err != nil {
return err
Expand Down

0 comments on commit 118a913

Please sign in to comment.