Skip to content

Commit

Permalink
fix custom objects autocomplete options
Browse files Browse the repository at this point in the history
Signed-off-by: Paolo Romolini <[email protected]>
  • Loading branch information
paoloromolini committed Nov 29, 2023
1 parent 85d3812 commit f398667
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions zendesk/custom_object.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ type CustomObjectAPI interface {
AutocompleteSearchCustomObjectRecords(
ctx context.Context,
customObjectKey string,
opts *CustomObjectAutocompleteOptions,
opts *PageOptions,
) ([]CustomObjectRecord, Page, error)
SearchCustomObjectRecords(
ctx context.Context, customObjectKey string, opts *SearchCustomObjectRecordsOptions,
Expand All @@ -54,12 +54,6 @@ type CustomObjectAPI interface {
) error
}

// CustomObjectAutocompleteOptions custom object search options
type CustomObjectAutocompleteOptions struct {
PageOptions
Name string `url:"name"`
}

// CreateCustomObjectRecord CreateCustomObject create a custom object record
func (z *Client) CreateCustomObjectRecord(
ctx context.Context, record CustomObjectRecord, customObjectKey string,
Expand Down Expand Up @@ -117,15 +111,15 @@ func (z *Client) ListCustomObjectRecords(
// AutocompleteSearchCustomObjectRecords search for a custom object record by the name field
// https://developer.zendesk.com/api-reference/custom-objects/custom_object_records/#autocomplete-custom-object-record-search
func (z *Client) AutocompleteSearchCustomObjectRecords(
ctx context.Context, customObjectKey string, opts *CustomObjectAutocompleteOptions,
ctx context.Context, customObjectKey string, opts *PageOptions,
) ([]CustomObjectRecord, Page, error) {
var result struct {
CustomObjectRecords []CustomObjectRecord `json:"custom_object_records"`
Page
}
tmp := opts
if tmp == nil {
tmp = &CustomObjectAutocompleteOptions{}
tmp = &PageOptions{}
}
url := fmt.Sprintf("/custom_objects/%s/records/autocomplete", customObjectKey)
urlWithOptions, err := addOptions(url, tmp)
Expand Down

0 comments on commit f398667

Please sign in to comment.