Skip to content

Commit

Permalink
feat: add get sources by target and delete custom objects V2
Browse files Browse the repository at this point in the history
Adds the lookup custom objects API.

Signed-off-by: Paolo Romolini <paolo.romolini@enterprisedb.com>
  • Loading branch information
paoloromolini committed Nov 7, 2023
1 parent 780ad86 commit 258bd85
Show file tree
Hide file tree
Showing 4 changed files with 122 additions and 0 deletions.
8 changes: 8 additions & 0 deletions script/codegen/main.go

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

21 changes: 21 additions & 0 deletions zendesk/custom_object.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ type CustomObjectAPI interface {
UpdateCustomObjectRecord(
ctx context.Context, customObjectKey string, customObjectRecordID string, record CustomObjectRecord,
) (*CustomObjectRecord, error)
GetGetSourcesByTargetIterator(ctx context.Context, opts *PaginationOptions) *Iterator[CustomObjectRecord]
GetGetSourcesByTargetOBP(ctx context.Context, opts *OBPOptions) ([]CustomObjectRecord, Page, error)
GetGetSourcesByTargetCBP(ctx context.Context, opts *CBPOptions) ([]CustomObjectRecord, CursorPaginationMeta, error)
DeleteCustomObjectRecord(
ctx context.Context,
record CustomObjectRecord,
) error
}

// CustomObjectAutocompleteOptions custom object search options
Expand Down Expand Up @@ -213,3 +220,17 @@ func (z *Client) UpdateCustomObjectRecord(
}
return &result.CustomObjectRecord, nil
}

// DeleteCustomObjectRecord Delete a custom object record
// https://developer.zendesk.com/api-reference/custom-data/custom-objects/custom_object_records/#delete-custom-object-record
func (z *Client) DeleteCustomObjectRecord(
ctx context.Context,
record CustomObjectRecord,
) error {
endpointURL := fmt.Sprintf("/custom_objects/%s/records/%s", record.CustomObjectKey, record.ID)
err := z.delete(ctx, endpointURL)
if err != nil {
return err
}
return nil
}
79 changes: 79 additions & 0 deletions zendesk/custom_object_generated.go

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

14 changes: 14 additions & 0 deletions zendesk/mock/client.go

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

0 comments on commit 258bd85

Please sign in to comment.