Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix non-pointer receiver #82

Merged
merged 1 commit into from
Mar 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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