diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 479be09b..e397832d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,7 +7,6 @@ jobs: strategy: matrix: go-version: - - 1.17.x - 1.18.x - 1.19.x - 1.20.x @@ -15,14 +14,14 @@ jobs: runs-on: ubuntu-latest steps: - name: Set up Go 1.x - uses: actions/setup-go@v4 + uses: actions/setup-go@v5 with: go-version: ${{ matrix.go-version }} - name: Check out code into the Go module directory uses: actions/checkout@v4 - - uses: actions/cache@v3 + - uses: actions/cache@v4 with: path: | ~/go/pkg/mod @@ -43,7 +42,7 @@ jobs: path-to-profile: profile.cov flag-name: Go-${{ matrix.go-version }} parallel: true - ignore: zendesk/mock/client.go + ignore: zendesk/mock/client.go, zendesk/*_generated.go finalize: needs: test diff --git a/CBPMigration.md b/CBPMigration.md new file mode 100644 index 00000000..6a546b17 --- /dev/null +++ b/CBPMigration.md @@ -0,0 +1,92 @@ +# OBP to CBP migration + +Zendesk is [obsoleting](https://support.zendesk.com/hc/en-us/articles/4408846180634-Introducing-Pagination-Changes-Zendesk-API#h_01F7Y57A0G5M3R8JXGCQTBKVWA) Offset Based Pagination (OBP), it's recomended to start adopting Cursor Based Pagination (CBP). This SDK have created pagination Iterators to help facilite the change. + +To use the pagination iterator, start with `NewPaginationOptions()` function, it will return a `PaginationOptions` object, you can specify the default page size in `PageSize` variable. By default, `PageSize` is 100. Then you can call the `client.GetXXXXXIterator(ctx, ops)` to return an object pagination iterator, with the iterator, you can iterator through the objects with `HasMore()` and `GetNext()` until `HasMore` return `false`. + +```go +ops := NewPaginationOptions() +// ops.PageSize = 50 // PageSize can be set to 50 +it := client.GetTicketsIterator(ctx, ops) +for it.HasMore() { + tickets, err := it.GetNext() + if err == nil { + for _, ticket := range tickets { + println(ticket.Subject) + } + } +} +``` + +If the API endpoint requires more options like organization ID, it can be set into the `Id` attribute like below example: + +```go +ops := NewPaginationOptions() +ops.Sort = "updated_at" +ops.PageSize = 10 +ops.Id = 360363695492 +it := client.GetOrganizationTicketsIterator(ctx, ops) + +for it.HasMore() { + tickets, err := it.GetNext() + if err == nil { + for _, ticket := range tickets { + println(ticket.Subject) + } + } +} +``` + +For any API specific parameters, they are predefined in the `CommonOptions` struct, we can set these attributes in the `PaginationOptions` object. +If new attributes are introduced to any existing or new API endpoints, it can be added into this struct. + +```go +type CommonOptions struct { + Active bool `url:"active,omitempty"` + Role string `url:"role,omitempty"` + Roles []string `url:"role[],omitempty"` + PermissionSet int64 `url:"permission_set,omitempty"` + + // SortBy can take "assignee", "assignee.name", "created_at", "group", "id", + // "locale", "requester", "requester.name", "status", "subject", "updated_at" + SortBy string `url:"sort_by,omitempty"` + + // SortOrder can take "asc" or "desc" + SortOrder string `url:"sort_order,omitempty"` + Sort string `url:"sort,omitempty"` + Id int64 + GroupID int64 `json:"group_id,omitempty" url:"group_id,omitempty"` + UserID int64 `json:"user_id,omitempty" url:"user_id,omitempty"` + OrganizationID int64 `json:"organization_id,omitempty" url:"organization_id,omitempty"` + + Access string `json:"access"` + Category int `json:"category"` + Include string `json:"include" url:"include,omitempty"` + OnlyViewable bool `json:"only_viewable"` + Query string `url:"query"` + EndUserVisible bool `url:"end_user_visible,omitempty"` + FallbackToDefault bool `url:"fallback_to_default,omitempty"` + AssociatedToBrand bool `url:"associated_to_brand,omitempty"` + CategoryID string `url:"category_id,omitempty"` + + IncludeInlineImages string `url:"include_inline_images,omitempty"` +} +``` + +## To regenerate CBP(Cursor Based Pagination), OBP(Offset Based Pagination) helper function and Iterators + +If a new API endpoint supports CBP, add a new element to the funcData in script/codegen/main.go file like this: + +```go +{ + FuncName: "Automations", + ObjectName: "Automation", + ApiEndpoint: "/automation.json", + JsonName: "automations", + FileName: "automation", +}, +``` + +should use the script to generate the helper functions and the iterator +`go run script/codegen/main.go` + diff --git a/README.md b/README.md index 84ac1d8e..1e8d332a 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # go-zendesk + [![Actions Status](https://github.com/nukosuke/go-zendesk/workflows/CI/badge.svg)](https://github.com/nukosuke/go-zendesk/actions) [![Build status](https://ci.appveyor.com/api/projects/status/ce4p1mswjkdftv6o/branch/master?svg=true)](https://ci.appveyor.com/project/nukosuke/go-zendesk/branch/master) [![Coverage Status](https://coveralls.io/repos/github/nukosuke/go-zendesk/badge.svg?branch=master)](https://coveralls.io/github/nukosuke/go-zendesk?branch=master) @@ -12,7 +13,7 @@ Zendesk API client library for Go ## Installation -``` shell +```shell $ go get github.com/nukosuke/go-zendesk ``` @@ -48,14 +49,19 @@ func main() { ``` ## Want to mock API? -go-zendesk has a [mock package](https://pkg.go.dev/github.com/nukosuke/go-zendesk/zendesk/mock) generated by [golang/mock](https://github.com/golang/mock). + +go-zendesk has a [mock package](https://pkg.go.dev/github.com/nukosuke/go-zendesk/zendesk/mock) generated by [uber-go/mock](https://github.com/uber-go/mock). You can simulate the response from Zendesk API with it. ## To regenerate the mock client `go generate ./...` +## Zendesk OBP(Offset Based Pagination) to CBP(Cursor Based Pagination) migration guide +[CBPMigration](CBPMigration.md) + ## Maintainer + - [nukosuke](https://github.com/nukosuke) ## License @@ -64,5 +70,4 @@ MIT License. See the file [LICENSE](./LICENSE). - [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fnukosuke%2Fgo-zendesk.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fnukosuke%2Fgo-zendesk?ref=badge_large) diff --git a/fixture/GET/views_ticket_count.json b/fixture/GET/views_ticket_count.json new file mode 100644 index 00000000..270c9e72 --- /dev/null +++ b/fixture/GET/views_ticket_count.json @@ -0,0 +1,18 @@ +{ + "view_counts": [ + { + "fresh": true, + "pretty": "~700", + "url": "https://company.zendesk.com/api/v2/views/25/count.json", + "value": 719, + "view_id": 25 + }, + { + "fresh": false, + "pretty": "...", + "url": "https://company.zendesk.com/api/v2/views/78/count.json", + "value": null, + "view_id": 78 + } + ] +} \ No newline at end of file diff --git a/go.mod b/go.mod index 2bfa3938..797b0b05 100644 --- a/go.mod +++ b/go.mod @@ -3,6 +3,14 @@ module github.com/nukosuke/go-zendesk go 1.19 require ( - github.com/golang/mock v1.6.0 github.com/google/go-querystring v1.1.0 + github.com/stretchr/testify v1.8.4 + go.uber.org/mock v0.4.0 +) + +require ( + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/google/go-cmp v0.5.9 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 05ed0f51..84bbf083 100644 --- a/go.sum +++ b/go.sum @@ -1,30 +1,18 @@ -github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= -github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= -github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= -github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= +go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/script/codegen/main.go b/script/codegen/main.go new file mode 100644 index 00000000..56cff823 --- /dev/null +++ b/script/codegen/main.go @@ -0,0 +1,284 @@ +package main + +import ( + "fmt" + "html/template" + "os" +) + +var tpl = ` +// Code generated by Script. DO NOT EDIT. +// Source: script/codegen/main.go +// +// Generated by this command: +// +// go run script/codegen/main.go + +package zendesk +{{ if .ExtraParam }} +import ( + "context" + "fmt" +) +{{ else }} +import "context" +{{ end }} +func (z *Client) Get{{.FuncName}}Iterator(ctx context.Context, opts *PaginationOptions) *Iterator[{{.ObjectName}}] { + return &Iterator[{{.ObjectName}}]{ + CommonOptions: opts.CommonOptions, + pageSize: opts.PageSize, + hasMore: true, + isCBP: opts.IsCBP, + pageAfter: "", + pageIndex: 1, + ctx: ctx, + obpFunc: z.Get{{.FuncName}}OBP, + cbpFunc: z.Get{{.FuncName}}CBP, + } +} + +func (z *Client) Get{{.FuncName}}OBP(ctx context.Context, opts *OBPOptions) ([]{{.ObjectName}}, Page, error) { + var data struct { + {{.ObjectName}}s []{{.ObjectName}} ` + "`json:\"{{.JsonName}}\"`" + ` + Page + } + + tmp := opts + if tmp == nil { + tmp = &OBPOptions{} + } + {{ if .ExtraParam }} + path := fmt.Sprintf("{{.ApiEndpoint}}", tmp.Id) + u, err := addOptions(path, tmp) + {{ else }} + u, err := addOptions("{{.ApiEndpoint}}", tmp) + {{ end }} + if err != nil { + return nil, Page{}, err + } + + err = getData(z, ctx, u, &data) + if err != nil { + return nil, Page{}, err + } + return data.{{.ObjectName}}s, data.Page, nil +} + +func (z *Client) Get{{.FuncName}}CBP(ctx context.Context, opts *CBPOptions) ([]{{.ObjectName}}, CursorPaginationMeta, error) { + var data struct { + {{.ObjectName}}s []{{.ObjectName}} ` + "`json:\"{{.JsonName}}\"`" + ` + Meta CursorPaginationMeta ` + "`json:\"meta\"`" + ` + } + + tmp := opts + if tmp == nil { + tmp = &CBPOptions{} + } + {{ if .ExtraParam }} + path := fmt.Sprintf("{{.ApiEndpoint}}", tmp.Id) + u, err := addOptions(path, tmp) + {{ else }} + u, err := addOptions("{{.ApiEndpoint}}", tmp) + {{ end }} + if err != nil { + return nil, data.Meta, err + } + + err = getData(z, ctx, u, &data) + if err != nil { + return nil, data.Meta, err + } + return data.{{.ObjectName}}s, data.Meta, nil +} + +` + +type FuncTemplateData struct { + FuncName string + ObjectName string + ApiEndpoint string + JsonName string + FileName string + ExtraParam bool +} + +var funcData []FuncTemplateData = []FuncTemplateData{ + { + FuncName: "Automations", + ObjectName: "Automation", + ApiEndpoint: "/automation.json", + JsonName: "automations", + FileName: "automation", + }, + { + FuncName: "GroupMemberships", + ObjectName: "GroupMembership", + ApiEndpoint: "/group_memberships.json", + JsonName: "group_memberships", + FileName: "group_membership", + }, + { + FuncName: "Macros", + ObjectName: "Macro", + ApiEndpoint: "/macros.json", + JsonName: "macros", + FileName: "macro", + }, + { + FuncName: "OrganizationFields", + ObjectName: "OrganizationField", + ApiEndpoint: "/organization_fields.json", + JsonName: "organization_fields", + FileName: "organization_field", + }, + { + FuncName: "OrganizationMemberships", + ObjectName: "OrganizationMembership", + ApiEndpoint: "/organization_memberships.json", + JsonName: "organization_memberships", + FileName: "organization_membership", + }, + { + FuncName: "Organizations", + ObjectName: "Organization", + ApiEndpoint: "/organizations.json", + JsonName: "organizations", + FileName: "organization", + }, + { + FuncName: "Search", + ObjectName: "SearchResults", + ApiEndpoint: "/search.json", + JsonName: "results", + FileName: "search", + }, + { + FuncName: "SLAPolicies", + ObjectName: "SLAPolicy", + ApiEndpoint: "/slas/policies.json", + JsonName: "sla_policies", + FileName: "sla_policy", + }, + { + FuncName: "AllTicketAudits", + ObjectName: "TicketAudit", + ApiEndpoint: "/ticket_audits.json", + JsonName: "audits", + FileName: "all_ticket_audit", + }, + { + FuncName: "TicketAudits", + ObjectName: "TicketAudit", + ApiEndpoint: "/tickets/%d/audits.json", + JsonName: "audits", + FileName: "ticket_audit", + ExtraParam: true, + }, + { + FuncName: "TicketFields", + ObjectName: "TicketField", + ApiEndpoint: "/ticket_fields.json", + JsonName: "ticket_fields", + FileName: "ticket_field", + }, + { + FuncName: "TicketForms", + ObjectName: "TicketForm", + ApiEndpoint: "/ticket_forms.json", + JsonName: "ticket_forms", + FileName: "ticket_form", + }, + { + FuncName: "Triggers", + ObjectName: "Trigger", + ApiEndpoint: "/triggers.json", + JsonName: "triggers", + FileName: "trigger", + }, + { + FuncName: "UserFields", + ObjectName: "UserField", + ApiEndpoint: "/user_fields.json", + JsonName: "user_fields", + FileName: "user_field", + }, + { + FuncName: "Users", + ObjectName: "User", + ApiEndpoint: "/users.json", + JsonName: "users", + FileName: "user", + }, + { + FuncName: "OrganizationUsers", + ObjectName: "User", + ApiEndpoint: "/organizations/%d/users.json", + JsonName: "users", + FileName: "organization_users", + ExtraParam: true, + }, + { + FuncName: "Views", + ObjectName: "View", + ApiEndpoint: "/views.json", + JsonName: "views", + FileName: "view", + }, + { + FuncName: "TicketsFromView", + ObjectName: "Ticket", + ApiEndpoint: "/views/%d/tickets.json", + JsonName: "tickets", + FileName: "tickets_from_view", + ExtraParam: true, + }, + { + FuncName: "Tickets", + ObjectName: "Ticket", + ApiEndpoint: "/tickets.json", + JsonName: "tickets", + FileName: "ticket", + }, + { + FuncName: "TicketComments", + ObjectName: "TicketComment", + ApiEndpoint: "/tickets/%d/comments.json", + JsonName: "comments", + FileName: "ticket_comment", + ExtraParam: true, + }, + { + FuncName: "Groups", + ObjectName: "Group", + ApiEndpoint: "/groups.json", + JsonName: "groups", + FileName: "group", + }, + { + FuncName: "OrganizationTickets", + ObjectName: "Ticket", + ApiEndpoint: "/organizations/%d/tickets.json", + JsonName: "tickets", + FileName: "organization_tickets", + ExtraParam: true, + }, +} + +func main() { + + tt := template.Must(template.New("func").Parse(tpl)) + + for _, v := range funcData { + dest := "zendesk/" + v.FileName + "_generated.go" + file, err := os.Create(dest) + if err != nil { + panic(err) + } + defer file.Close() + err = tt.Execute(file, v) + if err != nil { + panic(err) + } + fmt.Println("Generated " + dest + " successfully") + } +} diff --git a/zendesk/all_ticket_audit_generated.go b/zendesk/all_ticket_audit_generated.go new file mode 100644 index 00000000..8b7a77d6 --- /dev/null +++ b/zendesk/all_ticket_audit_generated.go @@ -0,0 +1,74 @@ + +// Code generated by Script. DO NOT EDIT. +// Source: script/codegen/main.go +// +// Generated by this command: +// +// go run script/codegen/main.go + +package zendesk + +import "context" + +func (z *Client) GetAllTicketAuditsIterator(ctx context.Context, opts *PaginationOptions) *Iterator[TicketAudit] { + return &Iterator[TicketAudit]{ + CommonOptions: opts.CommonOptions, + pageSize: opts.PageSize, + hasMore: true, + isCBP: opts.IsCBP, + pageAfter: "", + pageIndex: 1, + ctx: ctx, + obpFunc: z.GetAllTicketAuditsOBP, + cbpFunc: z.GetAllTicketAuditsCBP, + } +} + +func (z *Client) GetAllTicketAuditsOBP(ctx context.Context, opts *OBPOptions) ([]TicketAudit, Page, error) { + var data struct { + TicketAudits []TicketAudit `json:"audits"` + Page + } + + tmp := opts + if tmp == nil { + tmp = &OBPOptions{} + } + + u, err := addOptions("/ticket_audits.json", tmp) + + if err != nil { + return nil, Page{}, err + } + + err = getData(z, ctx, u, &data) + if err != nil { + return nil, Page{}, err + } + return data.TicketAudits, data.Page, nil +} + +func (z *Client) GetAllTicketAuditsCBP(ctx context.Context, opts *CBPOptions) ([]TicketAudit, CursorPaginationMeta, error) { + var data struct { + TicketAudits []TicketAudit `json:"audits"` + Meta CursorPaginationMeta `json:"meta"` + } + + tmp := opts + if tmp == nil { + tmp = &CBPOptions{} + } + + u, err := addOptions("/ticket_audits.json", tmp) + + if err != nil { + return nil, data.Meta, err + } + + err = getData(z, ctx, u, &data) + if err != nil { + return nil, data.Meta, err + } + return data.TicketAudits, data.Meta, nil +} + diff --git a/zendesk/api.go b/zendesk/api.go index 852d4582..78a468e1 100644 --- a/zendesk/api.go +++ b/zendesk/api.go @@ -1,7 +1,7 @@ package zendesk //nolint -//go:generate mockgen -destination=mock/client.go -package=mock -mock_names=API=Client github.com/nukosuke/go-zendesk/zendesk API +//go:generate mockgen -source=api.go -destination=mock/client.go -package=mock -mock_names=API=Client github.com/nukosuke/go-zendesk/zendesk API // API an interface containing all of the zendesk client methods type API interface { diff --git a/zendesk/automation.go b/zendesk/automation.go index c04be55b..4538b466 100644 --- a/zendesk/automation.go +++ b/zendesk/automation.go @@ -59,6 +59,9 @@ type AutomationAPI interface { GetAutomation(ctx context.Context, id int64) (Automation, error) UpdateAutomation(ctx context.Context, id int64, automation Automation) (Automation, error) DeleteAutomation(ctx context.Context, id int64) error + GetAutomationsIterator(ctx context.Context, opts *PaginationOptions) *Iterator[Automation] + GetAutomationsOBP(ctx context.Context, opts *OBPOptions) ([]Automation, Page, error) + GetAutomationsCBP(ctx context.Context, opts *CBPOptions) ([]Automation, CursorPaginationMeta, error) } // GetAutomations fetch automation list diff --git a/zendesk/automation_generated.go b/zendesk/automation_generated.go new file mode 100644 index 00000000..4d6d92d4 --- /dev/null +++ b/zendesk/automation_generated.go @@ -0,0 +1,74 @@ + +// Code generated by Script. DO NOT EDIT. +// Source: script/codegen/main.go +// +// Generated by this command: +// +// go run script/codegen/main.go + +package zendesk + +import "context" + +func (z *Client) GetAutomationsIterator(ctx context.Context, opts *PaginationOptions) *Iterator[Automation] { + return &Iterator[Automation]{ + CommonOptions: opts.CommonOptions, + pageSize: opts.PageSize, + hasMore: true, + isCBP: opts.IsCBP, + pageAfter: "", + pageIndex: 1, + ctx: ctx, + obpFunc: z.GetAutomationsOBP, + cbpFunc: z.GetAutomationsCBP, + } +} + +func (z *Client) GetAutomationsOBP(ctx context.Context, opts *OBPOptions) ([]Automation, Page, error) { + var data struct { + Automations []Automation `json:"automations"` + Page + } + + tmp := opts + if tmp == nil { + tmp = &OBPOptions{} + } + + u, err := addOptions("/automation.json", tmp) + + if err != nil { + return nil, Page{}, err + } + + err = getData(z, ctx, u, &data) + if err != nil { + return nil, Page{}, err + } + return data.Automations, data.Page, nil +} + +func (z *Client) GetAutomationsCBP(ctx context.Context, opts *CBPOptions) ([]Automation, CursorPaginationMeta, error) { + var data struct { + Automations []Automation `json:"automations"` + Meta CursorPaginationMeta `json:"meta"` + } + + tmp := opts + if tmp == nil { + tmp = &CBPOptions{} + } + + u, err := addOptions("/automation.json", tmp) + + if err != nil { + return nil, data.Meta, err + } + + err = getData(z, ctx, u, &data) + if err != nil { + return nil, data.Meta, err + } + return data.Automations, data.Meta, nil +} + diff --git a/zendesk/custom_object.go b/zendesk/custom_object.go index c4f7f70b..6386c5f5 100644 --- a/zendesk/custom_object.go +++ b/zendesk/custom_object.go @@ -72,7 +72,8 @@ func (z *Client) CreateCustomObjectRecord( // CustomObjectListOptions custom object list options type CustomObjectListOptions struct { PageOptions - ExternalIds []string `url:"external_ids"` + Ids string `url:"filter[ids],omitempty"` + ExternalIds string `url:"filter[external_ids],omitempty"` } // ListCustomObjectRecords list objects diff --git a/zendesk/dynamic_content.go b/zendesk/dynamic_content.go index 39fc83ad..b94395ee 100644 --- a/zendesk/dynamic_content.go +++ b/zendesk/dynamic_content.go @@ -14,6 +14,9 @@ type DynamicContentAPI interface { GetDynamicContentItem(ctx context.Context, id int64) (DynamicContentItem, error) UpdateDynamicContentItem(ctx context.Context, id int64, item DynamicContentItem) (DynamicContentItem, error) DeleteDynamicContentItem(ctx context.Context, id int64) error + GetDynamicContentItemsIterator(ctx context.Context, opts *PaginationOptions) *Iterator[DynamicContentItem] + GetDynamicContentItemsOBP(ctx context.Context, opts *OBPOptions) ([]DynamicContentItem, Page, error) + GetDynamicContentItemsCBP(ctx context.Context, opts *CBPOptions) ([]DynamicContentItem, CursorPaginationMeta, error) } // DynamicContentItem is zendesk dynamic content item JSON payload format diff --git a/zendesk/dynamic_content_generated.go b/zendesk/dynamic_content_generated.go new file mode 100644 index 00000000..f9f78727 --- /dev/null +++ b/zendesk/dynamic_content_generated.go @@ -0,0 +1,64 @@ +package zendesk + +import "context" + +func (z *Client) GetDynamicContentItemsIterator(ctx context.Context, opts *PaginationOptions) *Iterator[DynamicContentItem] { + return &Iterator[DynamicContentItem]{ + CommonOptions: opts.CommonOptions, + pageSize: opts.PageSize, + hasMore: true, + isCBP: opts.IsCBP, + pageAfter: "", + pageIndex: 1, + ctx: ctx, + obpFunc: z.GetDynamicContentItemsOBP, + cbpFunc: z.GetDynamicContentItemsCBP, + } +} + +func (z *Client) GetDynamicContentItemsOBP(ctx context.Context, opts *OBPOptions) ([]DynamicContentItem, Page, error) { + var data struct { + DynamicContentItems []DynamicContentItem `json:"items"` + Page + } + + tmp := opts + if tmp == nil { + tmp = &OBPOptions{} + } + + u, err := addOptions("/dynamic_content/items.json", tmp) + if err != nil { + return nil, Page{}, err + } + + err = getData(z, ctx, u, &data) + if err != nil { + return nil, Page{}, err + } + return data.DynamicContentItems, data.Page, nil +} + +func (z *Client) GetDynamicContentItemsCBP(ctx context.Context, opts *CBPOptions) ([]DynamicContentItem, CursorPaginationMeta, error) { + var data struct { + DynamicContentItems []DynamicContentItem `json:"items"` + Meta CursorPaginationMeta `json:"meta"` + } + + tmp := opts + if tmp == nil { + tmp = &CBPOptions{} + } + + u, err := addOptions("/dynamic_content/items.json", tmp) + if err != nil { + return nil, data.Meta, err + } + + err = getData(z, ctx, u, &data) + if err != nil { + return nil, data.Meta, err + } + return data.DynamicContentItems, data.Meta, nil +} + diff --git a/zendesk/group.go b/zendesk/group.go index fb544af9..500039d9 100644 --- a/zendesk/group.go +++ b/zendesk/group.go @@ -30,6 +30,9 @@ type GroupListOptions struct { // GroupAPI an interface containing all methods associated with zendesk groups type GroupAPI interface { GetGroups(ctx context.Context, opts *GroupListOptions) ([]Group, Page, error) + GetGroupsOBP(ctx context.Context, opts *OBPOptions) ([]Group, Page, error) + GetGroupsCBP(ctx context.Context, opts *CBPOptions) ([]Group, CursorPaginationMeta, error) + GetGroupsIterator(ctx context.Context, opts *PaginationOptions) *Iterator[Group] GetGroup(ctx context.Context, groupID int64) (Group, error) CreateGroup(ctx context.Context, group Group) (Group, error) UpdateGroup(ctx context.Context, groupID int64, group Group) (Group, error) diff --git a/zendesk/group_generated.go b/zendesk/group_generated.go new file mode 100644 index 00000000..eb6e9c76 --- /dev/null +++ b/zendesk/group_generated.go @@ -0,0 +1,74 @@ + +// Code generated by Script. DO NOT EDIT. +// Source: script/codegen/main.go +// +// Generated by this command: +// +// go run script/codegen/main.go + +package zendesk + +import "context" + +func (z *Client) GetGroupsIterator(ctx context.Context, opts *PaginationOptions) *Iterator[Group] { + return &Iterator[Group]{ + CommonOptions: opts.CommonOptions, + pageSize: opts.PageSize, + hasMore: true, + isCBP: opts.IsCBP, + pageAfter: "", + pageIndex: 1, + ctx: ctx, + obpFunc: z.GetGroupsOBP, + cbpFunc: z.GetGroupsCBP, + } +} + +func (z *Client) GetGroupsOBP(ctx context.Context, opts *OBPOptions) ([]Group, Page, error) { + var data struct { + Groups []Group `json:"groups"` + Page + } + + tmp := opts + if tmp == nil { + tmp = &OBPOptions{} + } + + u, err := addOptions("/groups.json", tmp) + + if err != nil { + return nil, Page{}, err + } + + err = getData(z, ctx, u, &data) + if err != nil { + return nil, Page{}, err + } + return data.Groups, data.Page, nil +} + +func (z *Client) GetGroupsCBP(ctx context.Context, opts *CBPOptions) ([]Group, CursorPaginationMeta, error) { + var data struct { + Groups []Group `json:"groups"` + Meta CursorPaginationMeta `json:"meta"` + } + + tmp := opts + if tmp == nil { + tmp = &CBPOptions{} + } + + u, err := addOptions("/groups.json", tmp) + + if err != nil { + return nil, data.Meta, err + } + + err = getData(z, ctx, u, &data) + if err != nil { + return nil, data.Meta, err + } + return data.Groups, data.Meta, nil +} + diff --git a/zendesk/group_membership.go b/zendesk/group_membership.go index 590d0d78..f4e69689 100644 --- a/zendesk/group_membership.go +++ b/zendesk/group_membership.go @@ -31,6 +31,9 @@ type ( // GroupMembershipAPI is an interface containing group membership related methods GroupMembershipAPI interface { GetGroupMemberships(context.Context, *GroupMembershipListOptions) ([]GroupMembership, Page, error) + GetGroupMembershipsIterator(ctx context.Context, opts *PaginationOptions) *Iterator[GroupMembership] + GetGroupMembershipsOBP(ctx context.Context, opts *OBPOptions) ([]GroupMembership, Page, error) + GetGroupMembershipsCBP(ctx context.Context, opts *CBPOptions) ([]GroupMembership, CursorPaginationMeta, error) } ) diff --git a/zendesk/group_membership_generated.go b/zendesk/group_membership_generated.go new file mode 100644 index 00000000..22e58c0b --- /dev/null +++ b/zendesk/group_membership_generated.go @@ -0,0 +1,74 @@ + +// Code generated by Script. DO NOT EDIT. +// Source: script/codegen/main.go +// +// Generated by this command: +// +// go run script/codegen/main.go + +package zendesk + +import "context" + +func (z *Client) GetGroupMembershipsIterator(ctx context.Context, opts *PaginationOptions) *Iterator[GroupMembership] { + return &Iterator[GroupMembership]{ + CommonOptions: opts.CommonOptions, + pageSize: opts.PageSize, + hasMore: true, + isCBP: opts.IsCBP, + pageAfter: "", + pageIndex: 1, + ctx: ctx, + obpFunc: z.GetGroupMembershipsOBP, + cbpFunc: z.GetGroupMembershipsCBP, + } +} + +func (z *Client) GetGroupMembershipsOBP(ctx context.Context, opts *OBPOptions) ([]GroupMembership, Page, error) { + var data struct { + GroupMemberships []GroupMembership `json:"group_memberships"` + Page + } + + tmp := opts + if tmp == nil { + tmp = &OBPOptions{} + } + + u, err := addOptions("/group_memberships.json", tmp) + + if err != nil { + return nil, Page{}, err + } + + err = getData(z, ctx, u, &data) + if err != nil { + return nil, Page{}, err + } + return data.GroupMemberships, data.Page, nil +} + +func (z *Client) GetGroupMembershipsCBP(ctx context.Context, opts *CBPOptions) ([]GroupMembership, CursorPaginationMeta, error) { + var data struct { + GroupMemberships []GroupMembership `json:"group_memberships"` + Meta CursorPaginationMeta `json:"meta"` + } + + tmp := opts + if tmp == nil { + tmp = &CBPOptions{} + } + + u, err := addOptions("/group_memberships.json", tmp) + + if err != nil { + return nil, data.Meta, err + } + + err = getData(z, ctx, u, &data) + if err != nil { + return nil, data.Meta, err + } + return data.GroupMemberships, data.Meta, nil +} + diff --git a/zendesk/group_test.go b/zendesk/group_test.go index c707dc05..e1d1f5ba 100644 --- a/zendesk/group_test.go +++ b/zendesk/group_test.go @@ -6,6 +6,33 @@ import ( "testing" ) +func TestGetGroupsIterator(t *testing.T) { + mockAPI := newMockAPI(http.MethodGet, "groups.json") + client := newTestClient(mockAPI) + defer mockAPI.Close() + + ops := NewPaginationOptions() + ops.PageSize = 10 + + it := client.GetGroupsIterator(ctx, ops) + + expectedLength := 1 + groupsCount := 0 + for it.HasMore() { + groups, err := it.GetNext() + if len(groups) != expectedLength { + t.Fatalf("expected length of groups is 1, but got %d", len(groups)) + } + groupsCount += len(groups) + if err != nil { + t.Fatalf("Failed to get groups: %s", err) + } + } + if groupsCount != 1 { + t.Fatalf("expected length of groups is 1, but got %d", groupsCount) + } +} + func TestGetGroups(t *testing.T) { mockAPI := newMockAPI(http.MethodGet, "groups.json") client := newTestClient(mockAPI) @@ -21,6 +48,36 @@ func TestGetGroups(t *testing.T) { } } +func TestGetGroupsOBP(t *testing.T) { + mockAPI := newMockAPI(http.MethodGet, "groups.json") + client := newTestClient(mockAPI) + defer mockAPI.Close() + + groups, _, err := client.GetGroupsOBP(ctx, nil) + if err != nil { + t.Fatalf("Failed to get groups: %s", err) + } + + if len(groups) != 1 { + t.Fatalf("expected length of groups is 1, but got %d", len(groups)) + } +} + +func TestGetGroupsCBP(t *testing.T) { + mockAPI := newMockAPI(http.MethodGet, "groups.json") + client := newTestClient(mockAPI) + defer mockAPI.Close() + + groups, _, err := client.GetGroupsCBP(ctx, nil) + if err != nil { + t.Fatalf("Failed to get groups: %s", err) + } + + if len(groups) != 1 { + t.Fatalf("expected length of groups is 1, but got %d", len(groups)) + } +} + func TestCreateGroup(t *testing.T) { mockAPI := newMockAPIWithStatus(http.MethodPost, "groups.json", http.StatusCreated) client := newTestClient(mockAPI) diff --git a/zendesk/iterator.go b/zendesk/iterator.go new file mode 100644 index 00000000..7c07e03b --- /dev/null +++ b/zendesk/iterator.go @@ -0,0 +1,139 @@ +package zendesk + +import ( + "context" +) + +// PaginationOptions struct represents general pagination options. +// PageSize specifies the number of items per page, IsCBP indicates if it's cursor-based pagination, +// SortBy and SortOrder describe how to sort the items in Offset Based Pagination, and Sort describes how to sort items in Cursor Based Pagination. +type PaginationOptions struct { + CommonOptions + PageSize int //default is 100 + IsCBP bool //default is true +} + +// NewPaginationOptions() returns a pointer to a new PaginationOptions struct with default values (PageSize is 100, IsCBP is true). +func NewPaginationOptions() *PaginationOptions { + return &PaginationOptions{ + PageSize: 100, + IsCBP: true, + } +} + +type CommonOptions struct { + Active bool `url:"active,omitempty"` + Role string `url:"role,omitempty"` + Roles []string `url:"role[],omitempty"` + PermissionSet int64 `url:"permission_set,omitempty"` + + // SortBy can take "assignee", "assignee.name", "created_at", "group", "id", + // "locale", "requester", "requester.name", "status", "subject", "updated_at" + SortBy string `url:"sort_by,omitempty"` + + // SortOrder can take "asc" or "desc" + SortOrder string `url:"sort_order,omitempty"` + Sort string `url:"sort,omitempty"` + Id int64 + GroupID int64 `json:"group_id,omitempty" url:"group_id,omitempty"` + UserID int64 `json:"user_id,omitempty" url:"user_id,omitempty"` + OrganizationID int64 `json:"organization_id,omitempty" url:"organization_id,omitempty"` + + Access string `json:"access"` + Category int `json:"category"` + Include string `json:"include" url:"include,omitempty"` + OnlyViewable bool `json:"only_viewable"` + Query string `url:"query"` + EndUserVisible bool `url:"end_user_visible,omitempty"` + FallbackToDefault bool `url:"fallback_to_default,omitempty"` + AssociatedToBrand bool `url:"associated_to_brand,omitempty"` + CategoryID string `url:"category_id,omitempty"` + + IncludeInlineImages string `url:"include_inline_images,omitempty"` +} + +// CBPOptions struct is used to specify options for listing objects in CBP (Cursor Based Pagination). +// It embeds the CursorPagination struct for pagination and provides an option Sort for sorting the result. +type CBPOptions struct { + CursorPagination + CommonOptions +} + +// OBPOptions struct is used to specify options for listing objects in OBP (Offset Based Pagination). +// It embeds the PageOptions struct for pagination and provides options for sorting the result; +// SortBy specifies the field to sort by, and SortOrder specifies the order (either 'asc' or 'desc'). +type OBPOptions struct { + PageOptions + CommonOptions +} + +// ObpFunc defines the signature of the function used to list objects in OBP. +type ObpFunc[T any] func(ctx context.Context, opts *OBPOptions) ([]T, Page, error) + +// CbpFunc defines the signature of the function used to list objects in CBP. +type CbpFunc[T any] func(ctx context.Context, opts *CBPOptions) ([]T, CursorPaginationMeta, error) + +// terator struct provides a convenient and genric way to iterate over pages of objects in either OBP or CBP. +// It holds state for iteration, including the current page size, a flag indicating more pages, pagination type (OBP or CBP), and sorting options. +type Iterator[T any] struct { + CommonOptions + // generic fields + pageSize int + hasMore bool + isCBP bool + + // OBP fields + pageIndex int + + // CBP fields + pageAfter string + + // common fields + ctx context.Context + obpFunc ObpFunc[T] + cbpFunc CbpFunc[T] +} + +// HasMore() returns a boolean indicating whether more pages are available for iteration. +func (i *Iterator[T]) HasMore() bool { + return i.hasMore +} + +// GetNext() retrieves the next batch of objects according to the current pagination and sorting options. +// It updates the state of the iterator for subsequent calls. +// In case of an error, it sets hasMore to false and returns an error. +func (i *Iterator[T]) GetNext() ([]T, error) { + if !i.isCBP { + obpOps := &OBPOptions{ + PageOptions: PageOptions{ + PerPage: i.pageSize, + Page: i.pageIndex, + }, + CommonOptions: i.CommonOptions, + } + results, page, err := i.obpFunc(i.ctx, obpOps) + if err != nil { + i.hasMore = false + return nil, err + } + i.hasMore = page.HasNext() + i.pageIndex++ + return results, nil + } + + cbpOps := &CBPOptions{ + CursorPagination: CursorPagination{ + PageSize: i.pageSize, + PageAfter: i.pageAfter, + }, + CommonOptions: i.CommonOptions, + } + results, meta, err := i.cbpFunc(i.ctx, cbpOps) + if err != nil { + i.hasMore = false + return nil, err + } + i.hasMore = meta.HasMore + i.pageAfter = meta.AfterCursor + return results, nil +} diff --git a/zendesk/iterator_test.go b/zendesk/iterator_test.go new file mode 100644 index 00000000..4a7c0e87 --- /dev/null +++ b/zendesk/iterator_test.go @@ -0,0 +1,58 @@ +package zendesk + +import ( + "context" + "testing" + + "github.com/stretchr/testify/assert" +) + +// Test for NewPaginationOptions function +func TestNewPaginationOptions(t *testing.T) { + opts := NewPaginationOptions() + + assert.Equal(t, 100, opts.PageSize) + assert.Equal(t, true, opts.IsCBP) +} + +// Test for HasMore function +func TestHasMore(t *testing.T) { + iter := &Iterator[int]{ + hasMore: true, + } + + result := iter.HasMore() + + assert.Equal(t, true, result) +} + +// Mock functions for GetNext testing +func mockObpFunc(ctx context.Context, opts *OBPOptions) ([]int, Page, error) { + nextPage := "2" + return []int{1, 2, 3}, Page{NextPage: &nextPage, Count: 3}, nil +} + +func mockCbpFunc(ctx context.Context, opts *CBPOptions) ([]int, CursorPaginationMeta, error) { + return []int{1, 2, 3}, CursorPaginationMeta{HasMore: true, AfterCursor: "3"}, nil +} + +// Test for GetNext function +func TestGetNext(t *testing.T) { + ctx := context.Background() + + iter := &Iterator[int]{ + pageSize: 2, + hasMore: true, + isCBP: false, + pageIndex: 1, + ctx: ctx, + obpFunc: mockObpFunc, + cbpFunc: mockCbpFunc, + } + + results, err := iter.GetNext() + + assert.NoError(t, err) + assert.Equal(t, []int{1, 2, 3}, results) + assert.Equal(t, true, iter.HasMore()) +} diff --git a/zendesk/macro.go b/zendesk/macro.go index 89822556..8631ba59 100644 --- a/zendesk/macro.go +++ b/zendesk/macro.go @@ -55,6 +55,9 @@ type MacroAPI interface { CreateMacro(ctx context.Context, macro Macro) (Macro, error) UpdateMacro(ctx context.Context, macroID int64, macro Macro) (Macro, error) DeleteMacro(ctx context.Context, macroID int64) error + GetMacrosIterator(ctx context.Context, opts *PaginationOptions) *Iterator[Macro] + GetMacrosOBP(ctx context.Context, opts *OBPOptions) ([]Macro, Page, error) + GetMacrosCBP(ctx context.Context, opts *CBPOptions) ([]Macro, CursorPaginationMeta, error) } // GetMacros get macro list diff --git a/zendesk/macro_generated.go b/zendesk/macro_generated.go new file mode 100644 index 00000000..15798206 --- /dev/null +++ b/zendesk/macro_generated.go @@ -0,0 +1,74 @@ + +// Code generated by Script. DO NOT EDIT. +// Source: script/codegen/main.go +// +// Generated by this command: +// +// go run script/codegen/main.go + +package zendesk + +import "context" + +func (z *Client) GetMacrosIterator(ctx context.Context, opts *PaginationOptions) *Iterator[Macro] { + return &Iterator[Macro]{ + CommonOptions: opts.CommonOptions, + pageSize: opts.PageSize, + hasMore: true, + isCBP: opts.IsCBP, + pageAfter: "", + pageIndex: 1, + ctx: ctx, + obpFunc: z.GetMacrosOBP, + cbpFunc: z.GetMacrosCBP, + } +} + +func (z *Client) GetMacrosOBP(ctx context.Context, opts *OBPOptions) ([]Macro, Page, error) { + var data struct { + Macros []Macro `json:"macros"` + Page + } + + tmp := opts + if tmp == nil { + tmp = &OBPOptions{} + } + + u, err := addOptions("/macros.json", tmp) + + if err != nil { + return nil, Page{}, err + } + + err = getData(z, ctx, u, &data) + if err != nil { + return nil, Page{}, err + } + return data.Macros, data.Page, nil +} + +func (z *Client) GetMacrosCBP(ctx context.Context, opts *CBPOptions) ([]Macro, CursorPaginationMeta, error) { + var data struct { + Macros []Macro `json:"macros"` + Meta CursorPaginationMeta `json:"meta"` + } + + tmp := opts + if tmp == nil { + tmp = &CBPOptions{} + } + + u, err := addOptions("/macros.json", tmp) + + if err != nil { + return nil, data.Meta, err + } + + err = getData(z, ctx, u, &data) + if err != nil { + return nil, data.Meta, err + } + return data.Macros, data.Meta, nil +} + diff --git a/zendesk/mock/client.go b/zendesk/mock/client.go index 549d059c..fe8720fb 100644 --- a/zendesk/mock/client.go +++ b/zendesk/mock/client.go @@ -1,6 +1,10 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: github.com/nukosuke/go-zendesk/zendesk (interfaces: API) - +// Source: api.go +// +// Generated by this command: +// +// mockgen -source=api.go -destination=mock/client.go -package=mock -mock_names=API=Client github.com/nukosuke/go-zendesk/zendesk API +// // Package mock is a generated GoMock package. package mock @@ -8,8 +12,8 @@ import ( context "context" reflect "reflect" - gomock "github.com/golang/mock/gomock" zendesk "github.com/nukosuke/go-zendesk/zendesk" + gomock "go.uber.org/mock/gomock" ) // Client is a mock of API interface. @@ -36,54 +40,54 @@ func (m *Client) EXPECT() *ClientMockRecorder { } // AddOrganizationTags mocks base method. -func (m *Client) AddOrganizationTags(arg0 context.Context, arg1 int64, arg2 []zendesk.Tag) ([]zendesk.Tag, error) { +func (m *Client) AddOrganizationTags(ctx context.Context, organizationID int64, tags []zendesk.Tag) ([]zendesk.Tag, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AddOrganizationTags", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "AddOrganizationTags", ctx, organizationID, tags) ret0, _ := ret[0].([]zendesk.Tag) ret1, _ := ret[1].(error) return ret0, ret1 } // AddOrganizationTags indicates an expected call of AddOrganizationTags. -func (mr *ClientMockRecorder) AddOrganizationTags(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) AddOrganizationTags(ctx, organizationID, tags any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddOrganizationTags", reflect.TypeOf((*Client)(nil).AddOrganizationTags), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddOrganizationTags", reflect.TypeOf((*Client)(nil).AddOrganizationTags), ctx, organizationID, tags) } // AddTicketTags mocks base method. -func (m *Client) AddTicketTags(arg0 context.Context, arg1 int64, arg2 []zendesk.Tag) ([]zendesk.Tag, error) { +func (m *Client) AddTicketTags(ctx context.Context, ticketID int64, tags []zendesk.Tag) ([]zendesk.Tag, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AddTicketTags", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "AddTicketTags", ctx, ticketID, tags) ret0, _ := ret[0].([]zendesk.Tag) ret1, _ := ret[1].(error) return ret0, ret1 } // AddTicketTags indicates an expected call of AddTicketTags. -func (mr *ClientMockRecorder) AddTicketTags(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) AddTicketTags(ctx, ticketID, tags any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddTicketTags", reflect.TypeOf((*Client)(nil).AddTicketTags), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddTicketTags", reflect.TypeOf((*Client)(nil).AddTicketTags), ctx, ticketID, tags) } // AddUserTags mocks base method. -func (m *Client) AddUserTags(arg0 context.Context, arg1 int64, arg2 []zendesk.Tag) ([]zendesk.Tag, error) { +func (m *Client) AddUserTags(ctx context.Context, userID int64, tags []zendesk.Tag) ([]zendesk.Tag, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AddUserTags", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "AddUserTags", ctx, userID, tags) ret0, _ := ret[0].([]zendesk.Tag) ret1, _ := ret[1].(error) return ret0, ret1 } // AddUserTags indicates an expected call of AddUserTags. -func (mr *ClientMockRecorder) AddUserTags(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) AddUserTags(ctx, userID, tags any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddUserTags", reflect.TypeOf((*Client)(nil).AddUserTags), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddUserTags", reflect.TypeOf((*Client)(nil).AddUserTags), ctx, userID, tags) } // AutocompleteSearchCustomObjectRecords mocks base method. -func (m *Client) AutocompleteSearchCustomObjectRecords(arg0 context.Context, arg1 string, arg2 *zendesk.CustomObjectAutocompleteOptions) ([]zendesk.CustomObjectRecord, zendesk.Page, error) { +func (m *Client) AutocompleteSearchCustomObjectRecords(ctx context.Context, customObjectKey string, opts *zendesk.CustomObjectAutocompleteOptions) ([]zendesk.CustomObjectRecord, zendesk.Page, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AutocompleteSearchCustomObjectRecords", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "AutocompleteSearchCustomObjectRecords", ctx, customObjectKey, opts) ret0, _ := ret[0].([]zendesk.CustomObjectRecord) ret1, _ := ret[1].(zendesk.Page) ret2, _ := ret[2].(error) @@ -91,144 +95,144 @@ func (m *Client) AutocompleteSearchCustomObjectRecords(arg0 context.Context, arg } // AutocompleteSearchCustomObjectRecords indicates an expected call of AutocompleteSearchCustomObjectRecords. -func (mr *ClientMockRecorder) AutocompleteSearchCustomObjectRecords(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) AutocompleteSearchCustomObjectRecords(ctx, customObjectKey, opts any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AutocompleteSearchCustomObjectRecords", reflect.TypeOf((*Client)(nil).AutocompleteSearchCustomObjectRecords), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AutocompleteSearchCustomObjectRecords", reflect.TypeOf((*Client)(nil).AutocompleteSearchCustomObjectRecords), ctx, customObjectKey, opts) } // CreateAutomation mocks base method. -func (m *Client) CreateAutomation(arg0 context.Context, arg1 zendesk.Automation) (zendesk.Automation, error) { +func (m *Client) CreateAutomation(ctx context.Context, automation zendesk.Automation) (zendesk.Automation, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CreateAutomation", arg0, arg1) + ret := m.ctrl.Call(m, "CreateAutomation", ctx, automation) ret0, _ := ret[0].(zendesk.Automation) ret1, _ := ret[1].(error) return ret0, ret1 } // CreateAutomation indicates an expected call of CreateAutomation. -func (mr *ClientMockRecorder) CreateAutomation(arg0, arg1 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) CreateAutomation(ctx, automation any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateAutomation", reflect.TypeOf((*Client)(nil).CreateAutomation), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateAutomation", reflect.TypeOf((*Client)(nil).CreateAutomation), ctx, automation) } // CreateBrand mocks base method. -func (m *Client) CreateBrand(arg0 context.Context, arg1 zendesk.Brand) (zendesk.Brand, error) { +func (m *Client) CreateBrand(ctx context.Context, brand zendesk.Brand) (zendesk.Brand, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CreateBrand", arg0, arg1) + ret := m.ctrl.Call(m, "CreateBrand", ctx, brand) ret0, _ := ret[0].(zendesk.Brand) ret1, _ := ret[1].(error) return ret0, ret1 } // CreateBrand indicates an expected call of CreateBrand. -func (mr *ClientMockRecorder) CreateBrand(arg0, arg1 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) CreateBrand(ctx, brand any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateBrand", reflect.TypeOf((*Client)(nil).CreateBrand), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateBrand", reflect.TypeOf((*Client)(nil).CreateBrand), ctx, brand) } // CreateCustomObjectRecord mocks base method. -func (m *Client) CreateCustomObjectRecord(arg0 context.Context, arg1 zendesk.CustomObjectRecord, arg2 string) (zendesk.CustomObjectRecord, error) { +func (m *Client) CreateCustomObjectRecord(ctx context.Context, record zendesk.CustomObjectRecord, customObjectKey string) (zendesk.CustomObjectRecord, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CreateCustomObjectRecord", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "CreateCustomObjectRecord", ctx, record, customObjectKey) ret0, _ := ret[0].(zendesk.CustomObjectRecord) ret1, _ := ret[1].(error) return ret0, ret1 } // CreateCustomObjectRecord indicates an expected call of CreateCustomObjectRecord. -func (mr *ClientMockRecorder) CreateCustomObjectRecord(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) CreateCustomObjectRecord(ctx, record, customObjectKey any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateCustomObjectRecord", reflect.TypeOf((*Client)(nil).CreateCustomObjectRecord), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateCustomObjectRecord", reflect.TypeOf((*Client)(nil).CreateCustomObjectRecord), ctx, record, customObjectKey) } // CreateDynamicContentItem mocks base method. -func (m *Client) CreateDynamicContentItem(arg0 context.Context, arg1 zendesk.DynamicContentItem) (zendesk.DynamicContentItem, error) { +func (m *Client) CreateDynamicContentItem(ctx context.Context, item zendesk.DynamicContentItem) (zendesk.DynamicContentItem, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CreateDynamicContentItem", arg0, arg1) + ret := m.ctrl.Call(m, "CreateDynamicContentItem", ctx, item) ret0, _ := ret[0].(zendesk.DynamicContentItem) ret1, _ := ret[1].(error) return ret0, ret1 } // CreateDynamicContentItem indicates an expected call of CreateDynamicContentItem. -func (mr *ClientMockRecorder) CreateDynamicContentItem(arg0, arg1 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) CreateDynamicContentItem(ctx, item any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateDynamicContentItem", reflect.TypeOf((*Client)(nil).CreateDynamicContentItem), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateDynamicContentItem", reflect.TypeOf((*Client)(nil).CreateDynamicContentItem), ctx, item) } // CreateGroup mocks base method. -func (m *Client) CreateGroup(arg0 context.Context, arg1 zendesk.Group) (zendesk.Group, error) { +func (m *Client) CreateGroup(ctx context.Context, group zendesk.Group) (zendesk.Group, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CreateGroup", arg0, arg1) + ret := m.ctrl.Call(m, "CreateGroup", ctx, group) ret0, _ := ret[0].(zendesk.Group) ret1, _ := ret[1].(error) return ret0, ret1 } // CreateGroup indicates an expected call of CreateGroup. -func (mr *ClientMockRecorder) CreateGroup(arg0, arg1 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) CreateGroup(ctx, group any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateGroup", reflect.TypeOf((*Client)(nil).CreateGroup), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateGroup", reflect.TypeOf((*Client)(nil).CreateGroup), ctx, group) } // CreateMacro mocks base method. -func (m *Client) CreateMacro(arg0 context.Context, arg1 zendesk.Macro) (zendesk.Macro, error) { +func (m *Client) CreateMacro(ctx context.Context, macro zendesk.Macro) (zendesk.Macro, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CreateMacro", arg0, arg1) + ret := m.ctrl.Call(m, "CreateMacro", ctx, macro) ret0, _ := ret[0].(zendesk.Macro) ret1, _ := ret[1].(error) return ret0, ret1 } // CreateMacro indicates an expected call of CreateMacro. -func (mr *ClientMockRecorder) CreateMacro(arg0, arg1 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) CreateMacro(ctx, macro any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateMacro", reflect.TypeOf((*Client)(nil).CreateMacro), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateMacro", reflect.TypeOf((*Client)(nil).CreateMacro), ctx, macro) } // CreateOrUpdateUser mocks base method. -func (m *Client) CreateOrUpdateUser(arg0 context.Context, arg1 zendesk.User) (zendesk.User, error) { +func (m *Client) CreateOrUpdateUser(ctx context.Context, user zendesk.User) (zendesk.User, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CreateOrUpdateUser", arg0, arg1) + ret := m.ctrl.Call(m, "CreateOrUpdateUser", ctx, user) ret0, _ := ret[0].(zendesk.User) ret1, _ := ret[1].(error) return ret0, ret1 } // CreateOrUpdateUser indicates an expected call of CreateOrUpdateUser. -func (mr *ClientMockRecorder) CreateOrUpdateUser(arg0, arg1 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) CreateOrUpdateUser(ctx, user any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateOrUpdateUser", reflect.TypeOf((*Client)(nil).CreateOrUpdateUser), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateOrUpdateUser", reflect.TypeOf((*Client)(nil).CreateOrUpdateUser), ctx, user) } // CreateOrganization mocks base method. -func (m *Client) CreateOrganization(arg0 context.Context, arg1 zendesk.Organization) (zendesk.Organization, error) { +func (m *Client) CreateOrganization(ctx context.Context, org zendesk.Organization) (zendesk.Organization, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CreateOrganization", arg0, arg1) + ret := m.ctrl.Call(m, "CreateOrganization", ctx, org) ret0, _ := ret[0].(zendesk.Organization) ret1, _ := ret[1].(error) return ret0, ret1 } // CreateOrganization indicates an expected call of CreateOrganization. -func (mr *ClientMockRecorder) CreateOrganization(arg0, arg1 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) CreateOrganization(ctx, org any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateOrganization", reflect.TypeOf((*Client)(nil).CreateOrganization), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateOrganization", reflect.TypeOf((*Client)(nil).CreateOrganization), ctx, org) } // CreateOrganizationField mocks base method. -func (m *Client) CreateOrganizationField(arg0 context.Context, arg1 zendesk.OrganizationField) (zendesk.OrganizationField, error) { +func (m *Client) CreateOrganizationField(ctx context.Context, organizationField zendesk.OrganizationField) (zendesk.OrganizationField, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CreateOrganizationField", arg0, arg1) + ret := m.ctrl.Call(m, "CreateOrganizationField", ctx, organizationField) ret0, _ := ret[0].(zendesk.OrganizationField) ret1, _ := ret[1].(error) return ret0, ret1 } // CreateOrganizationField indicates an expected call of CreateOrganizationField. -func (mr *ClientMockRecorder) CreateOrganizationField(arg0, arg1 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) CreateOrganizationField(ctx, organizationField any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateOrganizationField", reflect.TypeOf((*Client)(nil).CreateOrganizationField), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateOrganizationField", reflect.TypeOf((*Client)(nil).CreateOrganizationField), ctx, organizationField) } // CreateOrganizationMembership mocks base method. @@ -241,390 +245,390 @@ func (m *Client) CreateOrganizationMembership(arg0 context.Context, arg1 zendesk } // CreateOrganizationMembership indicates an expected call of CreateOrganizationMembership. -func (mr *ClientMockRecorder) CreateOrganizationMembership(arg0, arg1 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) CreateOrganizationMembership(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateOrganizationMembership", reflect.TypeOf((*Client)(nil).CreateOrganizationMembership), arg0, arg1) } // CreateSLAPolicy mocks base method. -func (m *Client) CreateSLAPolicy(arg0 context.Context, arg1 zendesk.SLAPolicy) (zendesk.SLAPolicy, error) { +func (m *Client) CreateSLAPolicy(ctx context.Context, slaPolicy zendesk.SLAPolicy) (zendesk.SLAPolicy, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CreateSLAPolicy", arg0, arg1) + ret := m.ctrl.Call(m, "CreateSLAPolicy", ctx, slaPolicy) ret0, _ := ret[0].(zendesk.SLAPolicy) ret1, _ := ret[1].(error) return ret0, ret1 } // CreateSLAPolicy indicates an expected call of CreateSLAPolicy. -func (mr *ClientMockRecorder) CreateSLAPolicy(arg0, arg1 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) CreateSLAPolicy(ctx, slaPolicy any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateSLAPolicy", reflect.TypeOf((*Client)(nil).CreateSLAPolicy), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateSLAPolicy", reflect.TypeOf((*Client)(nil).CreateSLAPolicy), ctx, slaPolicy) } // CreateTarget mocks base method. -func (m *Client) CreateTarget(arg0 context.Context, arg1 zendesk.Target) (zendesk.Target, error) { +func (m *Client) CreateTarget(ctx context.Context, ticketField zendesk.Target) (zendesk.Target, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CreateTarget", arg0, arg1) + ret := m.ctrl.Call(m, "CreateTarget", ctx, ticketField) ret0, _ := ret[0].(zendesk.Target) ret1, _ := ret[1].(error) return ret0, ret1 } // CreateTarget indicates an expected call of CreateTarget. -func (mr *ClientMockRecorder) CreateTarget(arg0, arg1 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) CreateTarget(ctx, ticketField any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateTarget", reflect.TypeOf((*Client)(nil).CreateTarget), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateTarget", reflect.TypeOf((*Client)(nil).CreateTarget), ctx, ticketField) } // CreateTicket mocks base method. -func (m *Client) CreateTicket(arg0 context.Context, arg1 zendesk.Ticket) (zendesk.Ticket, error) { +func (m *Client) CreateTicket(ctx context.Context, ticket zendesk.Ticket) (zendesk.Ticket, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CreateTicket", arg0, arg1) + ret := m.ctrl.Call(m, "CreateTicket", ctx, ticket) ret0, _ := ret[0].(zendesk.Ticket) ret1, _ := ret[1].(error) return ret0, ret1 } // CreateTicket indicates an expected call of CreateTicket. -func (mr *ClientMockRecorder) CreateTicket(arg0, arg1 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) CreateTicket(ctx, ticket any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateTicket", reflect.TypeOf((*Client)(nil).CreateTicket), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateTicket", reflect.TypeOf((*Client)(nil).CreateTicket), ctx, ticket) } // CreateTicketComment mocks base method. -func (m *Client) CreateTicketComment(arg0 context.Context, arg1 int64, arg2 zendesk.TicketComment) (zendesk.TicketComment, error) { +func (m *Client) CreateTicketComment(ctx context.Context, ticketID int64, ticketComment zendesk.TicketComment) (zendesk.TicketComment, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CreateTicketComment", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "CreateTicketComment", ctx, ticketID, ticketComment) ret0, _ := ret[0].(zendesk.TicketComment) ret1, _ := ret[1].(error) return ret0, ret1 } // CreateTicketComment indicates an expected call of CreateTicketComment. -func (mr *ClientMockRecorder) CreateTicketComment(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) CreateTicketComment(ctx, ticketID, ticketComment any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateTicketComment", reflect.TypeOf((*Client)(nil).CreateTicketComment), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateTicketComment", reflect.TypeOf((*Client)(nil).CreateTicketComment), ctx, ticketID, ticketComment) } // CreateTicketField mocks base method. -func (m *Client) CreateTicketField(arg0 context.Context, arg1 zendesk.TicketField) (zendesk.TicketField, error) { +func (m *Client) CreateTicketField(ctx context.Context, ticketField zendesk.TicketField) (zendesk.TicketField, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CreateTicketField", arg0, arg1) + ret := m.ctrl.Call(m, "CreateTicketField", ctx, ticketField) ret0, _ := ret[0].(zendesk.TicketField) ret1, _ := ret[1].(error) return ret0, ret1 } // CreateTicketField indicates an expected call of CreateTicketField. -func (mr *ClientMockRecorder) CreateTicketField(arg0, arg1 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) CreateTicketField(ctx, ticketField any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateTicketField", reflect.TypeOf((*Client)(nil).CreateTicketField), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateTicketField", reflect.TypeOf((*Client)(nil).CreateTicketField), ctx, ticketField) } // CreateTicketForm mocks base method. -func (m *Client) CreateTicketForm(arg0 context.Context, arg1 zendesk.TicketForm) (zendesk.TicketForm, error) { +func (m *Client) CreateTicketForm(ctx context.Context, ticketForm zendesk.TicketForm) (zendesk.TicketForm, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CreateTicketForm", arg0, arg1) + ret := m.ctrl.Call(m, "CreateTicketForm", ctx, ticketForm) ret0, _ := ret[0].(zendesk.TicketForm) ret1, _ := ret[1].(error) return ret0, ret1 } // CreateTicketForm indicates an expected call of CreateTicketForm. -func (mr *ClientMockRecorder) CreateTicketForm(arg0, arg1 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) CreateTicketForm(ctx, ticketForm any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateTicketForm", reflect.TypeOf((*Client)(nil).CreateTicketForm), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateTicketForm", reflect.TypeOf((*Client)(nil).CreateTicketForm), ctx, ticketForm) } // CreateTrigger mocks base method. -func (m *Client) CreateTrigger(arg0 context.Context, arg1 zendesk.Trigger) (zendesk.Trigger, error) { +func (m *Client) CreateTrigger(ctx context.Context, trigger zendesk.Trigger) (zendesk.Trigger, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CreateTrigger", arg0, arg1) + ret := m.ctrl.Call(m, "CreateTrigger", ctx, trigger) ret0, _ := ret[0].(zendesk.Trigger) ret1, _ := ret[1].(error) return ret0, ret1 } // CreateTrigger indicates an expected call of CreateTrigger. -func (mr *ClientMockRecorder) CreateTrigger(arg0, arg1 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) CreateTrigger(ctx, trigger any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateTrigger", reflect.TypeOf((*Client)(nil).CreateTrigger), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateTrigger", reflect.TypeOf((*Client)(nil).CreateTrigger), ctx, trigger) } // CreateUser mocks base method. -func (m *Client) CreateUser(arg0 context.Context, arg1 zendesk.User) (zendesk.User, error) { +func (m *Client) CreateUser(ctx context.Context, user zendesk.User) (zendesk.User, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CreateUser", arg0, arg1) + ret := m.ctrl.Call(m, "CreateUser", ctx, user) ret0, _ := ret[0].(zendesk.User) ret1, _ := ret[1].(error) return ret0, ret1 } // CreateUser indicates an expected call of CreateUser. -func (mr *ClientMockRecorder) CreateUser(arg0, arg1 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) CreateUser(ctx, user any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateUser", reflect.TypeOf((*Client)(nil).CreateUser), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateUser", reflect.TypeOf((*Client)(nil).CreateUser), ctx, user) } // CreateUserField mocks base method. -func (m *Client) CreateUserField(arg0 context.Context, arg1 zendesk.UserField) (zendesk.UserField, error) { +func (m *Client) CreateUserField(ctx context.Context, userField zendesk.UserField) (zendesk.UserField, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CreateUserField", arg0, arg1) + ret := m.ctrl.Call(m, "CreateUserField", ctx, userField) ret0, _ := ret[0].(zendesk.UserField) ret1, _ := ret[1].(error) return ret0, ret1 } // CreateUserField indicates an expected call of CreateUserField. -func (mr *ClientMockRecorder) CreateUserField(arg0, arg1 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) CreateUserField(ctx, userField any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateUserField", reflect.TypeOf((*Client)(nil).CreateUserField), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateUserField", reflect.TypeOf((*Client)(nil).CreateUserField), ctx, userField) } // CreateWebhook mocks base method. -func (m *Client) CreateWebhook(arg0 context.Context, arg1 *zendesk.Webhook) (*zendesk.Webhook, error) { +func (m *Client) CreateWebhook(ctx context.Context, hook *zendesk.Webhook) (*zendesk.Webhook, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CreateWebhook", arg0, arg1) + ret := m.ctrl.Call(m, "CreateWebhook", ctx, hook) ret0, _ := ret[0].(*zendesk.Webhook) ret1, _ := ret[1].(error) return ret0, ret1 } // CreateWebhook indicates an expected call of CreateWebhook. -func (mr *ClientMockRecorder) CreateWebhook(arg0, arg1 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) CreateWebhook(ctx, hook any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateWebhook", reflect.TypeOf((*Client)(nil).CreateWebhook), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateWebhook", reflect.TypeOf((*Client)(nil).CreateWebhook), ctx, hook) } // Delete mocks base method. -func (m *Client) Delete(arg0 context.Context, arg1 string) error { +func (m *Client) Delete(ctx context.Context, path string) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Delete", arg0, arg1) + ret := m.ctrl.Call(m, "Delete", ctx, path) ret0, _ := ret[0].(error) return ret0 } // Delete indicates an expected call of Delete. -func (mr *ClientMockRecorder) Delete(arg0, arg1 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) Delete(ctx, path any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*Client)(nil).Delete), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*Client)(nil).Delete), ctx, path) } // DeleteAutomation mocks base method. -func (m *Client) DeleteAutomation(arg0 context.Context, arg1 int64) error { +func (m *Client) DeleteAutomation(ctx context.Context, id int64) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DeleteAutomation", arg0, arg1) + ret := m.ctrl.Call(m, "DeleteAutomation", ctx, id) ret0, _ := ret[0].(error) return ret0 } // DeleteAutomation indicates an expected call of DeleteAutomation. -func (mr *ClientMockRecorder) DeleteAutomation(arg0, arg1 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) DeleteAutomation(ctx, id any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteAutomation", reflect.TypeOf((*Client)(nil).DeleteAutomation), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteAutomation", reflect.TypeOf((*Client)(nil).DeleteAutomation), ctx, id) } // DeleteBrand mocks base method. -func (m *Client) DeleteBrand(arg0 context.Context, arg1 int64) error { +func (m *Client) DeleteBrand(ctx context.Context, brandID int64) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DeleteBrand", arg0, arg1) + ret := m.ctrl.Call(m, "DeleteBrand", ctx, brandID) ret0, _ := ret[0].(error) return ret0 } // DeleteBrand indicates an expected call of DeleteBrand. -func (mr *ClientMockRecorder) DeleteBrand(arg0, arg1 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) DeleteBrand(ctx, brandID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteBrand", reflect.TypeOf((*Client)(nil).DeleteBrand), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteBrand", reflect.TypeOf((*Client)(nil).DeleteBrand), ctx, brandID) } // DeleteDynamicContentItem mocks base method. -func (m *Client) DeleteDynamicContentItem(arg0 context.Context, arg1 int64) error { +func (m *Client) DeleteDynamicContentItem(ctx context.Context, id int64) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DeleteDynamicContentItem", arg0, arg1) + ret := m.ctrl.Call(m, "DeleteDynamicContentItem", ctx, id) ret0, _ := ret[0].(error) return ret0 } // DeleteDynamicContentItem indicates an expected call of DeleteDynamicContentItem. -func (mr *ClientMockRecorder) DeleteDynamicContentItem(arg0, arg1 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) DeleteDynamicContentItem(ctx, id any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteDynamicContentItem", reflect.TypeOf((*Client)(nil).DeleteDynamicContentItem), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteDynamicContentItem", reflect.TypeOf((*Client)(nil).DeleteDynamicContentItem), ctx, id) } // DeleteGroup mocks base method. -func (m *Client) DeleteGroup(arg0 context.Context, arg1 int64) error { +func (m *Client) DeleteGroup(ctx context.Context, groupID int64) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DeleteGroup", arg0, arg1) + ret := m.ctrl.Call(m, "DeleteGroup", ctx, groupID) ret0, _ := ret[0].(error) return ret0 } // DeleteGroup indicates an expected call of DeleteGroup. -func (mr *ClientMockRecorder) DeleteGroup(arg0, arg1 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) DeleteGroup(ctx, groupID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteGroup", reflect.TypeOf((*Client)(nil).DeleteGroup), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteGroup", reflect.TypeOf((*Client)(nil).DeleteGroup), ctx, groupID) } // DeleteMacro mocks base method. -func (m *Client) DeleteMacro(arg0 context.Context, arg1 int64) error { +func (m *Client) DeleteMacro(ctx context.Context, macroID int64) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DeleteMacro", arg0, arg1) + ret := m.ctrl.Call(m, "DeleteMacro", ctx, macroID) ret0, _ := ret[0].(error) return ret0 } // DeleteMacro indicates an expected call of DeleteMacro. -func (mr *ClientMockRecorder) DeleteMacro(arg0, arg1 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) DeleteMacro(ctx, macroID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteMacro", reflect.TypeOf((*Client)(nil).DeleteMacro), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteMacro", reflect.TypeOf((*Client)(nil).DeleteMacro), ctx, macroID) } // DeleteOrganization mocks base method. -func (m *Client) DeleteOrganization(arg0 context.Context, arg1 int64) error { +func (m *Client) DeleteOrganization(ctx context.Context, orgID int64) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DeleteOrganization", arg0, arg1) + ret := m.ctrl.Call(m, "DeleteOrganization", ctx, orgID) ret0, _ := ret[0].(error) return ret0 } // DeleteOrganization indicates an expected call of DeleteOrganization. -func (mr *ClientMockRecorder) DeleteOrganization(arg0, arg1 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) DeleteOrganization(ctx, orgID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteOrganization", reflect.TypeOf((*Client)(nil).DeleteOrganization), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteOrganization", reflect.TypeOf((*Client)(nil).DeleteOrganization), ctx, orgID) } // DeleteSLAPolicy mocks base method. -func (m *Client) DeleteSLAPolicy(arg0 context.Context, arg1 int64) error { +func (m *Client) DeleteSLAPolicy(ctx context.Context, id int64) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DeleteSLAPolicy", arg0, arg1) + ret := m.ctrl.Call(m, "DeleteSLAPolicy", ctx, id) ret0, _ := ret[0].(error) return ret0 } // DeleteSLAPolicy indicates an expected call of DeleteSLAPolicy. -func (mr *ClientMockRecorder) DeleteSLAPolicy(arg0, arg1 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) DeleteSLAPolicy(ctx, id any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteSLAPolicy", reflect.TypeOf((*Client)(nil).DeleteSLAPolicy), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteSLAPolicy", reflect.TypeOf((*Client)(nil).DeleteSLAPolicy), ctx, id) } // DeleteTarget mocks base method. -func (m *Client) DeleteTarget(arg0 context.Context, arg1 int64) error { +func (m *Client) DeleteTarget(ctx context.Context, ticketID int64) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DeleteTarget", arg0, arg1) + ret := m.ctrl.Call(m, "DeleteTarget", ctx, ticketID) ret0, _ := ret[0].(error) return ret0 } // DeleteTarget indicates an expected call of DeleteTarget. -func (mr *ClientMockRecorder) DeleteTarget(arg0, arg1 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) DeleteTarget(ctx, ticketID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteTarget", reflect.TypeOf((*Client)(nil).DeleteTarget), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteTarget", reflect.TypeOf((*Client)(nil).DeleteTarget), ctx, ticketID) } // DeleteTicket mocks base method. -func (m *Client) DeleteTicket(arg0 context.Context, arg1 int64) error { +func (m *Client) DeleteTicket(ctx context.Context, ticketID int64) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DeleteTicket", arg0, arg1) + ret := m.ctrl.Call(m, "DeleteTicket", ctx, ticketID) ret0, _ := ret[0].(error) return ret0 } // DeleteTicket indicates an expected call of DeleteTicket. -func (mr *ClientMockRecorder) DeleteTicket(arg0, arg1 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) DeleteTicket(ctx, ticketID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteTicket", reflect.TypeOf((*Client)(nil).DeleteTicket), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteTicket", reflect.TypeOf((*Client)(nil).DeleteTicket), ctx, ticketID) } // DeleteTicketField mocks base method. -func (m *Client) DeleteTicketField(arg0 context.Context, arg1 int64) error { +func (m *Client) DeleteTicketField(ctx context.Context, ticketID int64) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DeleteTicketField", arg0, arg1) + ret := m.ctrl.Call(m, "DeleteTicketField", ctx, ticketID) ret0, _ := ret[0].(error) return ret0 } // DeleteTicketField indicates an expected call of DeleteTicketField. -func (mr *ClientMockRecorder) DeleteTicketField(arg0, arg1 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) DeleteTicketField(ctx, ticketID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteTicketField", reflect.TypeOf((*Client)(nil).DeleteTicketField), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteTicketField", reflect.TypeOf((*Client)(nil).DeleteTicketField), ctx, ticketID) } // DeleteTicketForm mocks base method. -func (m *Client) DeleteTicketForm(arg0 context.Context, arg1 int64) error { +func (m *Client) DeleteTicketForm(ctx context.Context, id int64) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DeleteTicketForm", arg0, arg1) + ret := m.ctrl.Call(m, "DeleteTicketForm", ctx, id) ret0, _ := ret[0].(error) return ret0 } // DeleteTicketForm indicates an expected call of DeleteTicketForm. -func (mr *ClientMockRecorder) DeleteTicketForm(arg0, arg1 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) DeleteTicketForm(ctx, id any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteTicketForm", reflect.TypeOf((*Client)(nil).DeleteTicketForm), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteTicketForm", reflect.TypeOf((*Client)(nil).DeleteTicketForm), ctx, id) } // DeleteTrigger mocks base method. -func (m *Client) DeleteTrigger(arg0 context.Context, arg1 int64) error { +func (m *Client) DeleteTrigger(ctx context.Context, id int64) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DeleteTrigger", arg0, arg1) + ret := m.ctrl.Call(m, "DeleteTrigger", ctx, id) ret0, _ := ret[0].(error) return ret0 } // DeleteTrigger indicates an expected call of DeleteTrigger. -func (mr *ClientMockRecorder) DeleteTrigger(arg0, arg1 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) DeleteTrigger(ctx, id any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteTrigger", reflect.TypeOf((*Client)(nil).DeleteTrigger), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteTrigger", reflect.TypeOf((*Client)(nil).DeleteTrigger), ctx, id) } // DeleteUpload mocks base method. -func (m *Client) DeleteUpload(arg0 context.Context, arg1 string) error { +func (m *Client) DeleteUpload(ctx context.Context, token string) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DeleteUpload", arg0, arg1) + ret := m.ctrl.Call(m, "DeleteUpload", ctx, token) ret0, _ := ret[0].(error) return ret0 } // DeleteUpload indicates an expected call of DeleteUpload. -func (mr *ClientMockRecorder) DeleteUpload(arg0, arg1 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) DeleteUpload(ctx, token any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteUpload", reflect.TypeOf((*Client)(nil).DeleteUpload), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteUpload", reflect.TypeOf((*Client)(nil).DeleteUpload), ctx, token) } // DeleteWebhook mocks base method. -func (m *Client) DeleteWebhook(arg0 context.Context, arg1 string) error { +func (m *Client) DeleteWebhook(ctx context.Context, webhookID string) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DeleteWebhook", arg0, arg1) + ret := m.ctrl.Call(m, "DeleteWebhook", ctx, webhookID) ret0, _ := ret[0].(error) return ret0 } // DeleteWebhook indicates an expected call of DeleteWebhook. -func (mr *ClientMockRecorder) DeleteWebhook(arg0, arg1 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) DeleteWebhook(ctx, webhookID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteWebhook", reflect.TypeOf((*Client)(nil).DeleteWebhook), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteWebhook", reflect.TypeOf((*Client)(nil).DeleteWebhook), ctx, webhookID) } // Get mocks base method. -func (m *Client) Get(arg0 context.Context, arg1 string) ([]byte, error) { +func (m *Client) Get(ctx context.Context, path string) ([]byte, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Get", arg0, arg1) + ret := m.ctrl.Call(m, "Get", ctx, path) ret0, _ := ret[0].([]byte) ret1, _ := ret[1].(error) return ret0, ret1 } // Get indicates an expected call of Get. -func (mr *ClientMockRecorder) Get(arg0, arg1 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) Get(ctx, path any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*Client)(nil).Get), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*Client)(nil).Get), ctx, path) } // GetAllTicketAudits mocks base method. -func (m *Client) GetAllTicketAudits(arg0 context.Context, arg1 zendesk.CursorOption) ([]zendesk.TicketAudit, zendesk.Cursor, error) { +func (m *Client) GetAllTicketAudits(ctx context.Context, opts zendesk.CursorOption) ([]zendesk.TicketAudit, zendesk.Cursor, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetAllTicketAudits", arg0, arg1) + ret := m.ctrl.Call(m, "GetAllTicketAudits", ctx, opts) ret0, _ := ret[0].([]zendesk.TicketAudit) ret1, _ := ret[1].(zendesk.Cursor) ret2, _ := ret[2].(error) @@ -632,45 +636,45 @@ func (m *Client) GetAllTicketAudits(arg0 context.Context, arg1 zendesk.CursorOpt } // GetAllTicketAudits indicates an expected call of GetAllTicketAudits. -func (mr *ClientMockRecorder) GetAllTicketAudits(arg0, arg1 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) GetAllTicketAudits(ctx, opts any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAllTicketAudits", reflect.TypeOf((*Client)(nil).GetAllTicketAudits), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAllTicketAudits", reflect.TypeOf((*Client)(nil).GetAllTicketAudits), ctx, opts) } // GetAttachment mocks base method. -func (m *Client) GetAttachment(arg0 context.Context, arg1 int64) (zendesk.Attachment, error) { +func (m *Client) GetAttachment(ctx context.Context, id int64) (zendesk.Attachment, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetAttachment", arg0, arg1) + ret := m.ctrl.Call(m, "GetAttachment", ctx, id) ret0, _ := ret[0].(zendesk.Attachment) ret1, _ := ret[1].(error) return ret0, ret1 } // GetAttachment indicates an expected call of GetAttachment. -func (mr *ClientMockRecorder) GetAttachment(arg0, arg1 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) GetAttachment(ctx, id any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAttachment", reflect.TypeOf((*Client)(nil).GetAttachment), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAttachment", reflect.TypeOf((*Client)(nil).GetAttachment), ctx, id) } // GetAutomation mocks base method. -func (m *Client) GetAutomation(arg0 context.Context, arg1 int64) (zendesk.Automation, error) { +func (m *Client) GetAutomation(ctx context.Context, id int64) (zendesk.Automation, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetAutomation", arg0, arg1) + ret := m.ctrl.Call(m, "GetAutomation", ctx, id) ret0, _ := ret[0].(zendesk.Automation) ret1, _ := ret[1].(error) return ret0, ret1 } // GetAutomation indicates an expected call of GetAutomation. -func (mr *ClientMockRecorder) GetAutomation(arg0, arg1 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) GetAutomation(ctx, id any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAutomation", reflect.TypeOf((*Client)(nil).GetAutomation), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAutomation", reflect.TypeOf((*Client)(nil).GetAutomation), ctx, id) } // GetAutomations mocks base method. -func (m *Client) GetAutomations(arg0 context.Context, arg1 *zendesk.AutomationListOptions) ([]zendesk.Automation, zendesk.Page, error) { +func (m *Client) GetAutomations(ctx context.Context, opts *zendesk.AutomationListOptions) ([]zendesk.Automation, zendesk.Page, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetAutomations", arg0, arg1) + ret := m.ctrl.Call(m, "GetAutomations", ctx, opts) ret0, _ := ret[0].([]zendesk.Automation) ret1, _ := ret[1].(zendesk.Page) ret2, _ := ret[2].(error) @@ -678,60 +682,121 @@ func (m *Client) GetAutomations(arg0 context.Context, arg1 *zendesk.AutomationLi } // GetAutomations indicates an expected call of GetAutomations. -func (mr *ClientMockRecorder) GetAutomations(arg0, arg1 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) GetAutomations(ctx, opts any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAutomations", reflect.TypeOf((*Client)(nil).GetAutomations), ctx, opts) +} + +// GetAutomationsCBP mocks base method. +func (m *Client) GetAutomationsCBP(ctx context.Context, opts *zendesk.CBPOptions) ([]zendesk.Automation, zendesk.CursorPaginationMeta, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetAutomationsCBP", ctx, opts) + ret0, _ := ret[0].([]zendesk.Automation) + ret1, _ := ret[1].(zendesk.CursorPaginationMeta) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetAutomationsCBP indicates an expected call of GetAutomationsCBP. +func (mr *ClientMockRecorder) GetAutomationsCBP(ctx, opts any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAutomationsCBP", reflect.TypeOf((*Client)(nil).GetAutomationsCBP), ctx, opts) +} + +// GetAutomationsIterator mocks base method. +func (m *Client) GetAutomationsIterator(ctx context.Context, opts *zendesk.PaginationOptions) *zendesk.Iterator[zendesk.Automation] { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetAutomationsIterator", ctx, opts) + ret0, _ := ret[0].(*zendesk.Iterator[zendesk.Automation]) + return ret0 +} + +// GetAutomationsIterator indicates an expected call of GetAutomationsIterator. +func (mr *ClientMockRecorder) GetAutomationsIterator(ctx, opts any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAutomationsIterator", reflect.TypeOf((*Client)(nil).GetAutomationsIterator), ctx, opts) +} + +// GetAutomationsOBP mocks base method. +func (m *Client) GetAutomationsOBP(ctx context.Context, opts *zendesk.OBPOptions) ([]zendesk.Automation, zendesk.Page, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetAutomationsOBP", ctx, opts) + ret0, _ := ret[0].([]zendesk.Automation) + ret1, _ := ret[1].(zendesk.Page) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetAutomationsOBP indicates an expected call of GetAutomationsOBP. +func (mr *ClientMockRecorder) GetAutomationsOBP(ctx, opts any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAutomations", reflect.TypeOf((*Client)(nil).GetAutomations), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAutomationsOBP", reflect.TypeOf((*Client)(nil).GetAutomationsOBP), ctx, opts) } // GetBrand mocks base method. -func (m *Client) GetBrand(arg0 context.Context, arg1 int64) (zendesk.Brand, error) { +func (m *Client) GetBrand(ctx context.Context, brandID int64) (zendesk.Brand, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetBrand", arg0, arg1) + ret := m.ctrl.Call(m, "GetBrand", ctx, brandID) ret0, _ := ret[0].(zendesk.Brand) ret1, _ := ret[1].(error) return ret0, ret1 } // GetBrand indicates an expected call of GetBrand. -func (mr *ClientMockRecorder) GetBrand(arg0, arg1 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) GetBrand(ctx, brandID any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBrand", reflect.TypeOf((*Client)(nil).GetBrand), ctx, brandID) +} + +// GetCountTicketsInViews mocks base method. +func (m *Client) GetCountTicketsInViews(arg0 context.Context, arg1 []string) ([]zendesk.ViewCount, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetCountTicketsInViews", arg0, arg1) + ret0, _ := ret[0].([]zendesk.ViewCount) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetCountTicketsInViews indicates an expected call of GetCountTicketsInViews. +func (mr *ClientMockRecorder) GetCountTicketsInViews(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBrand", reflect.TypeOf((*Client)(nil).GetBrand), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetCountTicketsInViews", reflect.TypeOf((*Client)(nil).GetCountTicketsInViews), arg0, arg1) } // GetCustomRoles mocks base method. -func (m *Client) GetCustomRoles(arg0 context.Context) ([]zendesk.CustomRole, error) { +func (m *Client) GetCustomRoles(ctx context.Context) ([]zendesk.CustomRole, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetCustomRoles", arg0) + ret := m.ctrl.Call(m, "GetCustomRoles", ctx) ret0, _ := ret[0].([]zendesk.CustomRole) ret1, _ := ret[1].(error) return ret0, ret1 } // GetCustomRoles indicates an expected call of GetCustomRoles. -func (mr *ClientMockRecorder) GetCustomRoles(arg0 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) GetCustomRoles(ctx any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetCustomRoles", reflect.TypeOf((*Client)(nil).GetCustomRoles), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetCustomRoles", reflect.TypeOf((*Client)(nil).GetCustomRoles), ctx) } // GetDynamicContentItem mocks base method. -func (m *Client) GetDynamicContentItem(arg0 context.Context, arg1 int64) (zendesk.DynamicContentItem, error) { +func (m *Client) GetDynamicContentItem(ctx context.Context, id int64) (zendesk.DynamicContentItem, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetDynamicContentItem", arg0, arg1) + ret := m.ctrl.Call(m, "GetDynamicContentItem", ctx, id) ret0, _ := ret[0].(zendesk.DynamicContentItem) ret1, _ := ret[1].(error) return ret0, ret1 } // GetDynamicContentItem indicates an expected call of GetDynamicContentItem. -func (mr *ClientMockRecorder) GetDynamicContentItem(arg0, arg1 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) GetDynamicContentItem(ctx, id any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetDynamicContentItem", reflect.TypeOf((*Client)(nil).GetDynamicContentItem), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetDynamicContentItem", reflect.TypeOf((*Client)(nil).GetDynamicContentItem), ctx, id) } // GetDynamicContentItems mocks base method. -func (m *Client) GetDynamicContentItems(arg0 context.Context) ([]zendesk.DynamicContentItem, zendesk.Page, error) { +func (m *Client) GetDynamicContentItems(ctx context.Context) ([]zendesk.DynamicContentItem, zendesk.Page, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetDynamicContentItems", arg0) + ret := m.ctrl.Call(m, "GetDynamicContentItems", ctx) ret0, _ := ret[0].([]zendesk.DynamicContentItem) ret1, _ := ret[1].(zendesk.Page) ret2, _ := ret[2].(error) @@ -739,24 +804,70 @@ func (m *Client) GetDynamicContentItems(arg0 context.Context) ([]zendesk.Dynamic } // GetDynamicContentItems indicates an expected call of GetDynamicContentItems. -func (mr *ClientMockRecorder) GetDynamicContentItems(arg0 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) GetDynamicContentItems(ctx any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetDynamicContentItems", reflect.TypeOf((*Client)(nil).GetDynamicContentItems), ctx) +} + +// GetDynamicContentItemsCBP mocks base method. +func (m *Client) GetDynamicContentItemsCBP(ctx context.Context, opts *zendesk.CBPOptions) ([]zendesk.DynamicContentItem, zendesk.CursorPaginationMeta, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetDynamicContentItemsCBP", ctx, opts) + ret0, _ := ret[0].([]zendesk.DynamicContentItem) + ret1, _ := ret[1].(zendesk.CursorPaginationMeta) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetDynamicContentItemsCBP indicates an expected call of GetDynamicContentItemsCBP. +func (mr *ClientMockRecorder) GetDynamicContentItemsCBP(ctx, opts any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetDynamicContentItemsCBP", reflect.TypeOf((*Client)(nil).GetDynamicContentItemsCBP), ctx, opts) +} + +// GetDynamicContentItemsIterator mocks base method. +func (m *Client) GetDynamicContentItemsIterator(ctx context.Context, opts *zendesk.PaginationOptions) *zendesk.Iterator[zendesk.DynamicContentItem] { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetDynamicContentItemsIterator", ctx, opts) + ret0, _ := ret[0].(*zendesk.Iterator[zendesk.DynamicContentItem]) + return ret0 +} + +// GetDynamicContentItemsIterator indicates an expected call of GetDynamicContentItemsIterator. +func (mr *ClientMockRecorder) GetDynamicContentItemsIterator(ctx, opts any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetDynamicContentItemsIterator", reflect.TypeOf((*Client)(nil).GetDynamicContentItemsIterator), ctx, opts) +} + +// GetDynamicContentItemsOBP mocks base method. +func (m *Client) GetDynamicContentItemsOBP(ctx context.Context, opts *zendesk.OBPOptions) ([]zendesk.DynamicContentItem, zendesk.Page, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetDynamicContentItemsOBP", ctx, opts) + ret0, _ := ret[0].([]zendesk.DynamicContentItem) + ret1, _ := ret[1].(zendesk.Page) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetDynamicContentItemsOBP indicates an expected call of GetDynamicContentItemsOBP. +func (mr *ClientMockRecorder) GetDynamicContentItemsOBP(ctx, opts any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetDynamicContentItems", reflect.TypeOf((*Client)(nil).GetDynamicContentItems), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetDynamicContentItemsOBP", reflect.TypeOf((*Client)(nil).GetDynamicContentItemsOBP), ctx, opts) } // GetGroup mocks base method. -func (m *Client) GetGroup(arg0 context.Context, arg1 int64) (zendesk.Group, error) { +func (m *Client) GetGroup(ctx context.Context, groupID int64) (zendesk.Group, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetGroup", arg0, arg1) + ret := m.ctrl.Call(m, "GetGroup", ctx, groupID) ret0, _ := ret[0].(zendesk.Group) ret1, _ := ret[1].(error) return ret0, ret1 } // GetGroup indicates an expected call of GetGroup. -func (mr *ClientMockRecorder) GetGroup(arg0, arg1 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) GetGroup(ctx, groupID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetGroup", reflect.TypeOf((*Client)(nil).GetGroup), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetGroup", reflect.TypeOf((*Client)(nil).GetGroup), ctx, groupID) } // GetGroupMemberships mocks base method. @@ -770,15 +881,61 @@ func (m *Client) GetGroupMemberships(arg0 context.Context, arg1 *zendesk.GroupMe } // GetGroupMemberships indicates an expected call of GetGroupMemberships. -func (mr *ClientMockRecorder) GetGroupMemberships(arg0, arg1 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) GetGroupMemberships(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetGroupMemberships", reflect.TypeOf((*Client)(nil).GetGroupMemberships), arg0, arg1) } +// GetGroupMembershipsCBP mocks base method. +func (m *Client) GetGroupMembershipsCBP(ctx context.Context, opts *zendesk.CBPOptions) ([]zendesk.GroupMembership, zendesk.CursorPaginationMeta, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetGroupMembershipsCBP", ctx, opts) + ret0, _ := ret[0].([]zendesk.GroupMembership) + ret1, _ := ret[1].(zendesk.CursorPaginationMeta) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetGroupMembershipsCBP indicates an expected call of GetGroupMembershipsCBP. +func (mr *ClientMockRecorder) GetGroupMembershipsCBP(ctx, opts any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetGroupMembershipsCBP", reflect.TypeOf((*Client)(nil).GetGroupMembershipsCBP), ctx, opts) +} + +// GetGroupMembershipsIterator mocks base method. +func (m *Client) GetGroupMembershipsIterator(ctx context.Context, opts *zendesk.PaginationOptions) *zendesk.Iterator[zendesk.GroupMembership] { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetGroupMembershipsIterator", ctx, opts) + ret0, _ := ret[0].(*zendesk.Iterator[zendesk.GroupMembership]) + return ret0 +} + +// GetGroupMembershipsIterator indicates an expected call of GetGroupMembershipsIterator. +func (mr *ClientMockRecorder) GetGroupMembershipsIterator(ctx, opts any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetGroupMembershipsIterator", reflect.TypeOf((*Client)(nil).GetGroupMembershipsIterator), ctx, opts) +} + +// GetGroupMembershipsOBP mocks base method. +func (m *Client) GetGroupMembershipsOBP(ctx context.Context, opts *zendesk.OBPOptions) ([]zendesk.GroupMembership, zendesk.Page, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetGroupMembershipsOBP", ctx, opts) + ret0, _ := ret[0].([]zendesk.GroupMembership) + ret1, _ := ret[1].(zendesk.Page) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetGroupMembershipsOBP indicates an expected call of GetGroupMembershipsOBP. +func (mr *ClientMockRecorder) GetGroupMembershipsOBP(ctx, opts any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetGroupMembershipsOBP", reflect.TypeOf((*Client)(nil).GetGroupMembershipsOBP), ctx, opts) +} + // GetGroups mocks base method. -func (m *Client) GetGroups(arg0 context.Context, arg1 *zendesk.GroupListOptions) ([]zendesk.Group, zendesk.Page, error) { +func (m *Client) GetGroups(ctx context.Context, opts *zendesk.GroupListOptions) ([]zendesk.Group, zendesk.Page, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetGroups", arg0, arg1) + ret := m.ctrl.Call(m, "GetGroups", ctx, opts) ret0, _ := ret[0].([]zendesk.Group) ret1, _ := ret[1].(zendesk.Page) ret2, _ := ret[2].(error) @@ -786,45 +943,91 @@ func (m *Client) GetGroups(arg0 context.Context, arg1 *zendesk.GroupListOptions) } // GetGroups indicates an expected call of GetGroups. -func (mr *ClientMockRecorder) GetGroups(arg0, arg1 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) GetGroups(ctx, opts any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetGroups", reflect.TypeOf((*Client)(nil).GetGroups), ctx, opts) +} + +// GetGroupsCBP mocks base method. +func (m *Client) GetGroupsCBP(ctx context.Context, opts *zendesk.CBPOptions) ([]zendesk.Group, zendesk.CursorPaginationMeta, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetGroupsCBP", ctx, opts) + ret0, _ := ret[0].([]zendesk.Group) + ret1, _ := ret[1].(zendesk.CursorPaginationMeta) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetGroupsCBP indicates an expected call of GetGroupsCBP. +func (mr *ClientMockRecorder) GetGroupsCBP(ctx, opts any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetGroups", reflect.TypeOf((*Client)(nil).GetGroups), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetGroupsCBP", reflect.TypeOf((*Client)(nil).GetGroupsCBP), ctx, opts) +} + +// GetGroupsIterator mocks base method. +func (m *Client) GetGroupsIterator(ctx context.Context, opts *zendesk.PaginationOptions) *zendesk.Iterator[zendesk.Group] { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetGroupsIterator", ctx, opts) + ret0, _ := ret[0].(*zendesk.Iterator[zendesk.Group]) + return ret0 +} + +// GetGroupsIterator indicates an expected call of GetGroupsIterator. +func (mr *ClientMockRecorder) GetGroupsIterator(ctx, opts any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetGroupsIterator", reflect.TypeOf((*Client)(nil).GetGroupsIterator), ctx, opts) +} + +// GetGroupsOBP mocks base method. +func (m *Client) GetGroupsOBP(ctx context.Context, opts *zendesk.OBPOptions) ([]zendesk.Group, zendesk.Page, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetGroupsOBP", ctx, opts) + ret0, _ := ret[0].([]zendesk.Group) + ret1, _ := ret[1].(zendesk.Page) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetGroupsOBP indicates an expected call of GetGroupsOBP. +func (mr *ClientMockRecorder) GetGroupsOBP(ctx, opts any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetGroupsOBP", reflect.TypeOf((*Client)(nil).GetGroupsOBP), ctx, opts) } // GetLocales mocks base method. -func (m *Client) GetLocales(arg0 context.Context) ([]zendesk.Locale, error) { +func (m *Client) GetLocales(ctx context.Context) ([]zendesk.Locale, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetLocales", arg0) + ret := m.ctrl.Call(m, "GetLocales", ctx) ret0, _ := ret[0].([]zendesk.Locale) ret1, _ := ret[1].(error) return ret0, ret1 } // GetLocales indicates an expected call of GetLocales. -func (mr *ClientMockRecorder) GetLocales(arg0 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) GetLocales(ctx any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetLocales", reflect.TypeOf((*Client)(nil).GetLocales), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetLocales", reflect.TypeOf((*Client)(nil).GetLocales), ctx) } // GetMacro mocks base method. -func (m *Client) GetMacro(arg0 context.Context, arg1 int64) (zendesk.Macro, error) { +func (m *Client) GetMacro(ctx context.Context, macroID int64) (zendesk.Macro, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetMacro", arg0, arg1) + ret := m.ctrl.Call(m, "GetMacro", ctx, macroID) ret0, _ := ret[0].(zendesk.Macro) ret1, _ := ret[1].(error) return ret0, ret1 } // GetMacro indicates an expected call of GetMacro. -func (mr *ClientMockRecorder) GetMacro(arg0, arg1 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) GetMacro(ctx, macroID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetMacro", reflect.TypeOf((*Client)(nil).GetMacro), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetMacro", reflect.TypeOf((*Client)(nil).GetMacro), ctx, macroID) } // GetMacros mocks base method. -func (m *Client) GetMacros(arg0 context.Context, arg1 *zendesk.MacroListOptions) ([]zendesk.Macro, zendesk.Page, error) { +func (m *Client) GetMacros(ctx context.Context, opts *zendesk.MacroListOptions) ([]zendesk.Macro, zendesk.Page, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetMacros", arg0, arg1) + ret := m.ctrl.Call(m, "GetMacros", ctx, opts) ret0, _ := ret[0].([]zendesk.Macro) ret1, _ := ret[1].(zendesk.Page) ret2, _ := ret[2].(error) @@ -832,15 +1035,61 @@ func (m *Client) GetMacros(arg0 context.Context, arg1 *zendesk.MacroListOptions) } // GetMacros indicates an expected call of GetMacros. -func (mr *ClientMockRecorder) GetMacros(arg0, arg1 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) GetMacros(ctx, opts any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetMacros", reflect.TypeOf((*Client)(nil).GetMacros), ctx, opts) +} + +// GetMacrosCBP mocks base method. +func (m *Client) GetMacrosCBP(ctx context.Context, opts *zendesk.CBPOptions) ([]zendesk.Macro, zendesk.CursorPaginationMeta, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetMacrosCBP", ctx, opts) + ret0, _ := ret[0].([]zendesk.Macro) + ret1, _ := ret[1].(zendesk.CursorPaginationMeta) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetMacrosCBP indicates an expected call of GetMacrosCBP. +func (mr *ClientMockRecorder) GetMacrosCBP(ctx, opts any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetMacrosCBP", reflect.TypeOf((*Client)(nil).GetMacrosCBP), ctx, opts) +} + +// GetMacrosIterator mocks base method. +func (m *Client) GetMacrosIterator(ctx context.Context, opts *zendesk.PaginationOptions) *zendesk.Iterator[zendesk.Macro] { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetMacrosIterator", ctx, opts) + ret0, _ := ret[0].(*zendesk.Iterator[zendesk.Macro]) + return ret0 +} + +// GetMacrosIterator indicates an expected call of GetMacrosIterator. +func (mr *ClientMockRecorder) GetMacrosIterator(ctx, opts any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetMacrosIterator", reflect.TypeOf((*Client)(nil).GetMacrosIterator), ctx, opts) +} + +// GetMacrosOBP mocks base method. +func (m *Client) GetMacrosOBP(ctx context.Context, opts *zendesk.OBPOptions) ([]zendesk.Macro, zendesk.Page, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetMacrosOBP", ctx, opts) + ret0, _ := ret[0].([]zendesk.Macro) + ret1, _ := ret[1].(zendesk.Page) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetMacrosOBP indicates an expected call of GetMacrosOBP. +func (mr *ClientMockRecorder) GetMacrosOBP(ctx, opts any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetMacros", reflect.TypeOf((*Client)(nil).GetMacros), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetMacrosOBP", reflect.TypeOf((*Client)(nil).GetMacrosOBP), ctx, opts) } // GetManyUsers mocks base method. -func (m *Client) GetManyUsers(arg0 context.Context, arg1 *zendesk.GetManyUsersOptions) ([]zendesk.User, zendesk.Page, error) { +func (m *Client) GetManyUsers(ctx context.Context, opts *zendesk.GetManyUsersOptions) ([]zendesk.User, zendesk.Page, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetManyUsers", arg0, arg1) + ret := m.ctrl.Call(m, "GetManyUsers", ctx, opts) ret0, _ := ret[0].([]zendesk.User) ret1, _ := ret[1].(zendesk.Page) ret2, _ := ret[2].(error) @@ -848,45 +1097,45 @@ func (m *Client) GetManyUsers(arg0 context.Context, arg1 *zendesk.GetManyUsersOp } // GetManyUsers indicates an expected call of GetManyUsers. -func (mr *ClientMockRecorder) GetManyUsers(arg0, arg1 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) GetManyUsers(ctx, opts any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetManyUsers", reflect.TypeOf((*Client)(nil).GetManyUsers), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetManyUsers", reflect.TypeOf((*Client)(nil).GetManyUsers), ctx, opts) } // GetMultipleTickets mocks base method. -func (m *Client) GetMultipleTickets(arg0 context.Context, arg1 []int64) ([]zendesk.Ticket, error) { +func (m *Client) GetMultipleTickets(ctx context.Context, ticketIDs []int64) ([]zendesk.Ticket, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetMultipleTickets", arg0, arg1) + ret := m.ctrl.Call(m, "GetMultipleTickets", ctx, ticketIDs) ret0, _ := ret[0].([]zendesk.Ticket) ret1, _ := ret[1].(error) return ret0, ret1 } // GetMultipleTickets indicates an expected call of GetMultipleTickets. -func (mr *ClientMockRecorder) GetMultipleTickets(arg0, arg1 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) GetMultipleTickets(ctx, ticketIDs any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetMultipleTickets", reflect.TypeOf((*Client)(nil).GetMultipleTickets), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetMultipleTickets", reflect.TypeOf((*Client)(nil).GetMultipleTickets), ctx, ticketIDs) } // GetOrganization mocks base method. -func (m *Client) GetOrganization(arg0 context.Context, arg1 int64) (zendesk.Organization, error) { +func (m *Client) GetOrganization(ctx context.Context, orgID int64) (zendesk.Organization, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetOrganization", arg0, arg1) + ret := m.ctrl.Call(m, "GetOrganization", ctx, orgID) ret0, _ := ret[0].(zendesk.Organization) ret1, _ := ret[1].(error) return ret0, ret1 } // GetOrganization indicates an expected call of GetOrganization. -func (mr *ClientMockRecorder) GetOrganization(arg0, arg1 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) GetOrganization(ctx, orgID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetOrganization", reflect.TypeOf((*Client)(nil).GetOrganization), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetOrganization", reflect.TypeOf((*Client)(nil).GetOrganization), ctx, orgID) } // GetOrganizationByExternalID mocks base method. -func (m *Client) GetOrganizationByExternalID(arg0 context.Context, arg1 string) ([]zendesk.Organization, zendesk.Page, error) { +func (m *Client) GetOrganizationByExternalID(ctx context.Context, externalID string) ([]zendesk.Organization, zendesk.Page, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetOrganizationByExternalID", arg0, arg1) + ret := m.ctrl.Call(m, "GetOrganizationByExternalID", ctx, externalID) ret0, _ := ret[0].([]zendesk.Organization) ret1, _ := ret[1].(zendesk.Page) ret2, _ := ret[2].(error) @@ -894,15 +1143,15 @@ func (m *Client) GetOrganizationByExternalID(arg0 context.Context, arg1 string) } // GetOrganizationByExternalID indicates an expected call of GetOrganizationByExternalID. -func (mr *ClientMockRecorder) GetOrganizationByExternalID(arg0, arg1 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) GetOrganizationByExternalID(ctx, externalID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetOrganizationByExternalID", reflect.TypeOf((*Client)(nil).GetOrganizationByExternalID), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetOrganizationByExternalID", reflect.TypeOf((*Client)(nil).GetOrganizationByExternalID), ctx, externalID) } // GetOrganizationFields mocks base method. -func (m *Client) GetOrganizationFields(arg0 context.Context) ([]zendesk.OrganizationField, zendesk.Page, error) { +func (m *Client) GetOrganizationFields(ctx context.Context) ([]zendesk.OrganizationField, zendesk.Page, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetOrganizationFields", arg0) + ret := m.ctrl.Call(m, "GetOrganizationFields", ctx) ret0, _ := ret[0].([]zendesk.OrganizationField) ret1, _ := ret[1].(zendesk.Page) ret2, _ := ret[2].(error) @@ -910,318 +1159,811 @@ func (m *Client) GetOrganizationFields(arg0 context.Context) ([]zendesk.Organiza } // GetOrganizationFields indicates an expected call of GetOrganizationFields. -func (mr *ClientMockRecorder) GetOrganizationFields(arg0 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) GetOrganizationFields(ctx any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetOrganizationFields", reflect.TypeOf((*Client)(nil).GetOrganizationFields), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetOrganizationFields", reflect.TypeOf((*Client)(nil).GetOrganizationFields), ctx) } -// GetOrganizationMemberships mocks base method. -func (m *Client) GetOrganizationMemberships(arg0 context.Context, arg1 *zendesk.OrganizationMembershipListOptions) ([]zendesk.OrganizationMembership, zendesk.Page, error) { +// GetOrganizationFieldsCBP mocks base method. +func (m *Client) GetOrganizationFieldsCBP(ctx context.Context, opts *zendesk.CBPOptions) ([]zendesk.OrganizationField, zendesk.CursorPaginationMeta, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetOrganizationMemberships", arg0, arg1) - ret0, _ := ret[0].([]zendesk.OrganizationMembership) - ret1, _ := ret[1].(zendesk.Page) + ret := m.ctrl.Call(m, "GetOrganizationFieldsCBP", ctx, opts) + ret0, _ := ret[0].([]zendesk.OrganizationField) + ret1, _ := ret[1].(zendesk.CursorPaginationMeta) ret2, _ := ret[2].(error) return ret0, ret1, ret2 } -// GetOrganizationMemberships indicates an expected call of GetOrganizationMemberships. -func (mr *ClientMockRecorder) GetOrganizationMemberships(arg0, arg1 interface{}) *gomock.Call { +// GetOrganizationFieldsCBP indicates an expected call of GetOrganizationFieldsCBP. +func (mr *ClientMockRecorder) GetOrganizationFieldsCBP(ctx, opts any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetOrganizationMemberships", reflect.TypeOf((*Client)(nil).GetOrganizationMemberships), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetOrganizationFieldsCBP", reflect.TypeOf((*Client)(nil).GetOrganizationFieldsCBP), ctx, opts) } -// GetOrganizationTags mocks base method. -func (m *Client) GetOrganizationTags(arg0 context.Context, arg1 int64) ([]zendesk.Tag, error) { +// GetOrganizationFieldsIterator mocks base method. +func (m *Client) GetOrganizationFieldsIterator(ctx context.Context, opts *zendesk.PaginationOptions) *zendesk.Iterator[zendesk.OrganizationField] { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetOrganizationTags", arg0, arg1) - ret0, _ := ret[0].([]zendesk.Tag) - ret1, _ := ret[1].(error) - return ret0, ret1 + ret := m.ctrl.Call(m, "GetOrganizationFieldsIterator", ctx, opts) + ret0, _ := ret[0].(*zendesk.Iterator[zendesk.OrganizationField]) + return ret0 } -// GetOrganizationTags indicates an expected call of GetOrganizationTags. -func (mr *ClientMockRecorder) GetOrganizationTags(arg0, arg1 interface{}) *gomock.Call { +// GetOrganizationFieldsIterator indicates an expected call of GetOrganizationFieldsIterator. +func (mr *ClientMockRecorder) GetOrganizationFieldsIterator(ctx, opts any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetOrganizationTags", reflect.TypeOf((*Client)(nil).GetOrganizationTags), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetOrganizationFieldsIterator", reflect.TypeOf((*Client)(nil).GetOrganizationFieldsIterator), ctx, opts) } -// GetOrganizationTickets mocks base method. -func (m *Client) GetOrganizationTickets(arg0 context.Context, arg1 int64, arg2 *zendesk.TicketListOptions) ([]zendesk.Ticket, zendesk.Page, error) { +// GetOrganizationFieldsOBP mocks base method. +func (m *Client) GetOrganizationFieldsOBP(ctx context.Context, opts *zendesk.OBPOptions) ([]zendesk.OrganizationField, zendesk.Page, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetOrganizationTickets", arg0, arg1, arg2) - ret0, _ := ret[0].([]zendesk.Ticket) + ret := m.ctrl.Call(m, "GetOrganizationFieldsOBP", ctx, opts) + ret0, _ := ret[0].([]zendesk.OrganizationField) ret1, _ := ret[1].(zendesk.Page) ret2, _ := ret[2].(error) return ret0, ret1, ret2 } -// GetOrganizationTickets indicates an expected call of GetOrganizationTickets. -func (mr *ClientMockRecorder) GetOrganizationTickets(arg0, arg1, arg2 interface{}) *gomock.Call { +// GetOrganizationFieldsOBP indicates an expected call of GetOrganizationFieldsOBP. +func (mr *ClientMockRecorder) GetOrganizationFieldsOBP(ctx, opts any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetOrganizationTickets", reflect.TypeOf((*Client)(nil).GetOrganizationTickets), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetOrganizationFieldsOBP", reflect.TypeOf((*Client)(nil).GetOrganizationFieldsOBP), ctx, opts) } -// GetOrganizationUsers mocks base method. -func (m *Client) GetOrganizationUsers(arg0 context.Context, arg1 int64, arg2 *zendesk.UserListOptions) ([]zendesk.User, zendesk.Page, error) { +// GetOrganizationMemberships mocks base method. +func (m *Client) GetOrganizationMemberships(arg0 context.Context, arg1 *zendesk.OrganizationMembershipListOptions) ([]zendesk.OrganizationMembership, zendesk.Page, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetOrganizationUsers", arg0, arg1, arg2) - ret0, _ := ret[0].([]zendesk.User) + ret := m.ctrl.Call(m, "GetOrganizationMemberships", arg0, arg1) + ret0, _ := ret[0].([]zendesk.OrganizationMembership) ret1, _ := ret[1].(zendesk.Page) ret2, _ := ret[2].(error) return ret0, ret1, ret2 } -// GetOrganizationUsers indicates an expected call of GetOrganizationUsers. -func (mr *ClientMockRecorder) GetOrganizationUsers(arg0, arg1, arg2 interface{}) *gomock.Call { +// GetOrganizationMemberships indicates an expected call of GetOrganizationMemberships. +func (mr *ClientMockRecorder) GetOrganizationMemberships(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetOrganizationUsers", reflect.TypeOf((*Client)(nil).GetOrganizationUsers), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetOrganizationMemberships", reflect.TypeOf((*Client)(nil).GetOrganizationMemberships), arg0, arg1) } -// GetOrganizations mocks base method. -func (m *Client) GetOrganizations(arg0 context.Context, arg1 *zendesk.OrganizationListOptions) ([]zendesk.Organization, zendesk.Page, error) { +// GetOrganizationMembershipsCBP mocks base method. +func (m *Client) GetOrganizationMembershipsCBP(ctx context.Context, opts *zendesk.CBPOptions) ([]zendesk.OrganizationMembership, zendesk.CursorPaginationMeta, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetOrganizations", arg0, arg1) - ret0, _ := ret[0].([]zendesk.Organization) - ret1, _ := ret[1].(zendesk.Page) + ret := m.ctrl.Call(m, "GetOrganizationMembershipsCBP", ctx, opts) + ret0, _ := ret[0].([]zendesk.OrganizationMembership) + ret1, _ := ret[1].(zendesk.CursorPaginationMeta) ret2, _ := ret[2].(error) return ret0, ret1, ret2 } -// GetOrganizations indicates an expected call of GetOrganizations. -func (mr *ClientMockRecorder) GetOrganizations(arg0, arg1 interface{}) *gomock.Call { +// GetOrganizationMembershipsCBP indicates an expected call of GetOrganizationMembershipsCBP. +func (mr *ClientMockRecorder) GetOrganizationMembershipsCBP(ctx, opts any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetOrganizations", reflect.TypeOf((*Client)(nil).GetOrganizations), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetOrganizationMembershipsCBP", reflect.TypeOf((*Client)(nil).GetOrganizationMembershipsCBP), ctx, opts) } -// GetSLAPolicies mocks base method. -func (m *Client) GetSLAPolicies(arg0 context.Context, arg1 *zendesk.SLAPolicyListOptions) ([]zendesk.SLAPolicy, zendesk.Page, error) { +// GetOrganizationMembershipsIterator mocks base method. +func (m *Client) GetOrganizationMembershipsIterator(ctx context.Context, opts *zendesk.PaginationOptions) *zendesk.Iterator[zendesk.OrganizationMembership] { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetSLAPolicies", arg0, arg1) - ret0, _ := ret[0].([]zendesk.SLAPolicy) - ret1, _ := ret[1].(zendesk.Page) - ret2, _ := ret[2].(error) - return ret0, ret1, ret2 + ret := m.ctrl.Call(m, "GetOrganizationMembershipsIterator", ctx, opts) + ret0, _ := ret[0].(*zendesk.Iterator[zendesk.OrganizationMembership]) + return ret0 } -// GetSLAPolicies indicates an expected call of GetSLAPolicies. -func (mr *ClientMockRecorder) GetSLAPolicies(arg0, arg1 interface{}) *gomock.Call { +// GetOrganizationMembershipsIterator indicates an expected call of GetOrganizationMembershipsIterator. +func (mr *ClientMockRecorder) GetOrganizationMembershipsIterator(ctx, opts any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSLAPolicies", reflect.TypeOf((*Client)(nil).GetSLAPolicies), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetOrganizationMembershipsIterator", reflect.TypeOf((*Client)(nil).GetOrganizationMembershipsIterator), ctx, opts) } -// GetSLAPolicy mocks base method. -func (m *Client) GetSLAPolicy(arg0 context.Context, arg1 int64) (zendesk.SLAPolicy, error) { +// GetOrganizationMembershipsOBP mocks base method. +func (m *Client) GetOrganizationMembershipsOBP(ctx context.Context, opts *zendesk.OBPOptions) ([]zendesk.OrganizationMembership, zendesk.Page, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetSLAPolicy", arg0, arg1) - ret0, _ := ret[0].(zendesk.SLAPolicy) - ret1, _ := ret[1].(error) - return ret0, ret1 + ret := m.ctrl.Call(m, "GetOrganizationMembershipsOBP", ctx, opts) + ret0, _ := ret[0].([]zendesk.OrganizationMembership) + ret1, _ := ret[1].(zendesk.Page) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 } -// GetSLAPolicy indicates an expected call of GetSLAPolicy. -func (mr *ClientMockRecorder) GetSLAPolicy(arg0, arg1 interface{}) *gomock.Call { +// GetOrganizationMembershipsOBP indicates an expected call of GetOrganizationMembershipsOBP. +func (mr *ClientMockRecorder) GetOrganizationMembershipsOBP(ctx, opts any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSLAPolicy", reflect.TypeOf((*Client)(nil).GetSLAPolicy), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetOrganizationMembershipsOBP", reflect.TypeOf((*Client)(nil).GetOrganizationMembershipsOBP), ctx, opts) } -// GetTarget mocks base method. -func (m *Client) GetTarget(arg0 context.Context, arg1 int64) (zendesk.Target, error) { +// GetOrganizationTags mocks base method. +func (m *Client) GetOrganizationTags(ctx context.Context, organizationID int64) ([]zendesk.Tag, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetTarget", arg0, arg1) - ret0, _ := ret[0].(zendesk.Target) + ret := m.ctrl.Call(m, "GetOrganizationTags", ctx, organizationID) + ret0, _ := ret[0].([]zendesk.Tag) ret1, _ := ret[1].(error) return ret0, ret1 } -// GetTarget indicates an expected call of GetTarget. -func (mr *ClientMockRecorder) GetTarget(arg0, arg1 interface{}) *gomock.Call { +// GetOrganizationTags indicates an expected call of GetOrganizationTags. +func (mr *ClientMockRecorder) GetOrganizationTags(ctx, organizationID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTarget", reflect.TypeOf((*Client)(nil).GetTarget), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetOrganizationTags", reflect.TypeOf((*Client)(nil).GetOrganizationTags), ctx, organizationID) } -// GetTargets mocks base method. -func (m *Client) GetTargets(arg0 context.Context) ([]zendesk.Target, zendesk.Page, error) { +// GetOrganizationTickets mocks base method. +func (m *Client) GetOrganizationTickets(ctx context.Context, organizationID int64, ops *zendesk.TicketListOptions) ([]zendesk.Ticket, zendesk.Page, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetTargets", arg0) - ret0, _ := ret[0].([]zendesk.Target) + ret := m.ctrl.Call(m, "GetOrganizationTickets", ctx, organizationID, ops) + ret0, _ := ret[0].([]zendesk.Ticket) ret1, _ := ret[1].(zendesk.Page) ret2, _ := ret[2].(error) return ret0, ret1, ret2 } -// GetTargets indicates an expected call of GetTargets. -func (mr *ClientMockRecorder) GetTargets(arg0 interface{}) *gomock.Call { +// GetOrganizationTickets indicates an expected call of GetOrganizationTickets. +func (mr *ClientMockRecorder) GetOrganizationTickets(ctx, organizationID, ops any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTargets", reflect.TypeOf((*Client)(nil).GetTargets), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetOrganizationTickets", reflect.TypeOf((*Client)(nil).GetOrganizationTickets), ctx, organizationID, ops) } -// GetTicket mocks base method. -func (m *Client) GetTicket(arg0 context.Context, arg1 int64) (zendesk.Ticket, error) { +// GetOrganizationTicketsCBP mocks base method. +func (m *Client) GetOrganizationTicketsCBP(ctx context.Context, opts *zendesk.CBPOptions) ([]zendesk.Ticket, zendesk.CursorPaginationMeta, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetTicket", arg0, arg1) - ret0, _ := ret[0].(zendesk.Ticket) - ret1, _ := ret[1].(error) - return ret0, ret1 + ret := m.ctrl.Call(m, "GetOrganizationTicketsCBP", ctx, opts) + ret0, _ := ret[0].([]zendesk.Ticket) + ret1, _ := ret[1].(zendesk.CursorPaginationMeta) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 } -// GetTicket indicates an expected call of GetTicket. -func (mr *ClientMockRecorder) GetTicket(arg0, arg1 interface{}) *gomock.Call { +// GetOrganizationTicketsCBP indicates an expected call of GetOrganizationTicketsCBP. +func (mr *ClientMockRecorder) GetOrganizationTicketsCBP(ctx, opts any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTicket", reflect.TypeOf((*Client)(nil).GetTicket), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetOrganizationTicketsCBP", reflect.TypeOf((*Client)(nil).GetOrganizationTicketsCBP), ctx, opts) } -// GetTicketAudit mocks base method. -func (m *Client) GetTicketAudit(arg0 context.Context, arg1, arg2 int64) (zendesk.TicketAudit, error) { +// GetOrganizationTicketsIterator mocks base method. +func (m *Client) GetOrganizationTicketsIterator(ctx context.Context, opts *zendesk.PaginationOptions) *zendesk.Iterator[zendesk.Ticket] { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetTicketAudit", arg0, arg1, arg2) - ret0, _ := ret[0].(zendesk.TicketAudit) - ret1, _ := ret[1].(error) - return ret0, ret1 + ret := m.ctrl.Call(m, "GetOrganizationTicketsIterator", ctx, opts) + ret0, _ := ret[0].(*zendesk.Iterator[zendesk.Ticket]) + return ret0 } -// GetTicketAudit indicates an expected call of GetTicketAudit. -func (mr *ClientMockRecorder) GetTicketAudit(arg0, arg1, arg2 interface{}) *gomock.Call { +// GetOrganizationTicketsIterator indicates an expected call of GetOrganizationTicketsIterator. +func (mr *ClientMockRecorder) GetOrganizationTicketsIterator(ctx, opts any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTicketAudit", reflect.TypeOf((*Client)(nil).GetTicketAudit), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetOrganizationTicketsIterator", reflect.TypeOf((*Client)(nil).GetOrganizationTicketsIterator), ctx, opts) } -// GetTicketAudits mocks base method. -func (m *Client) GetTicketAudits(arg0 context.Context, arg1 int64, arg2 zendesk.PageOptions) ([]zendesk.TicketAudit, zendesk.Page, error) { +// GetOrganizationTicketsOBP mocks base method. +func (m *Client) GetOrganizationTicketsOBP(ctx context.Context, opts *zendesk.OBPOptions) ([]zendesk.Ticket, zendesk.Page, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetTicketAudits", arg0, arg1, arg2) - ret0, _ := ret[0].([]zendesk.TicketAudit) + ret := m.ctrl.Call(m, "GetOrganizationTicketsOBP", ctx, opts) + ret0, _ := ret[0].([]zendesk.Ticket) ret1, _ := ret[1].(zendesk.Page) ret2, _ := ret[2].(error) return ret0, ret1, ret2 } -// GetTicketAudits indicates an expected call of GetTicketAudits. -func (mr *ClientMockRecorder) GetTicketAudits(arg0, arg1, arg2 interface{}) *gomock.Call { +// GetOrganizationTicketsOBP indicates an expected call of GetOrganizationTicketsOBP. +func (mr *ClientMockRecorder) GetOrganizationTicketsOBP(ctx, opts any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTicketAudits", reflect.TypeOf((*Client)(nil).GetTicketAudits), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetOrganizationTicketsOBP", reflect.TypeOf((*Client)(nil).GetOrganizationTicketsOBP), ctx, opts) } -// GetTicketField mocks base method. -func (m *Client) GetTicketField(arg0 context.Context, arg1 int64) (zendesk.TicketField, error) { +// GetOrganizationUsers mocks base method. +func (m *Client) GetOrganizationUsers(ctx context.Context, orgID int64, opts *zendesk.UserListOptions) ([]zendesk.User, zendesk.Page, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetTicketField", arg0, arg1) - ret0, _ := ret[0].(zendesk.TicketField) - ret1, _ := ret[1].(error) - return ret0, ret1 + ret := m.ctrl.Call(m, "GetOrganizationUsers", ctx, orgID, opts) + ret0, _ := ret[0].([]zendesk.User) + ret1, _ := ret[1].(zendesk.Page) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 } -// GetTicketField indicates an expected call of GetTicketField. -func (mr *ClientMockRecorder) GetTicketField(arg0, arg1 interface{}) *gomock.Call { +// GetOrganizationUsers indicates an expected call of GetOrganizationUsers. +func (mr *ClientMockRecorder) GetOrganizationUsers(ctx, orgID, opts any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTicketField", reflect.TypeOf((*Client)(nil).GetTicketField), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetOrganizationUsers", reflect.TypeOf((*Client)(nil).GetOrganizationUsers), ctx, orgID, opts) } -// GetTicketFields mocks base method. -func (m *Client) GetTicketFields(arg0 context.Context) ([]zendesk.TicketField, zendesk.Page, error) { +// GetOrganizationUsersCBP mocks base method. +func (m *Client) GetOrganizationUsersCBP(ctx context.Context, opts *zendesk.CBPOptions) ([]zendesk.User, zendesk.CursorPaginationMeta, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetTicketFields", arg0) - ret0, _ := ret[0].([]zendesk.TicketField) - ret1, _ := ret[1].(zendesk.Page) + ret := m.ctrl.Call(m, "GetOrganizationUsersCBP", ctx, opts) + ret0, _ := ret[0].([]zendesk.User) + ret1, _ := ret[1].(zendesk.CursorPaginationMeta) ret2, _ := ret[2].(error) return ret0, ret1, ret2 } -// GetTicketFields indicates an expected call of GetTicketFields. -func (mr *ClientMockRecorder) GetTicketFields(arg0 interface{}) *gomock.Call { +// GetOrganizationUsersCBP indicates an expected call of GetOrganizationUsersCBP. +func (mr *ClientMockRecorder) GetOrganizationUsersCBP(ctx, opts any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTicketFields", reflect.TypeOf((*Client)(nil).GetTicketFields), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetOrganizationUsersCBP", reflect.TypeOf((*Client)(nil).GetOrganizationUsersCBP), ctx, opts) } -// GetTicketForm mocks base method. -func (m *Client) GetTicketForm(arg0 context.Context, arg1 int64) (zendesk.TicketForm, error) { +// GetOrganizationUsersIterator mocks base method. +func (m *Client) GetOrganizationUsersIterator(ctx context.Context, opts *zendesk.PaginationOptions) *zendesk.Iterator[zendesk.User] { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetTicketForm", arg0, arg1) - ret0, _ := ret[0].(zendesk.TicketForm) - ret1, _ := ret[1].(error) - return ret0, ret1 + ret := m.ctrl.Call(m, "GetOrganizationUsersIterator", ctx, opts) + ret0, _ := ret[0].(*zendesk.Iterator[zendesk.User]) + return ret0 } -// GetTicketForm indicates an expected call of GetTicketForm. -func (mr *ClientMockRecorder) GetTicketForm(arg0, arg1 interface{}) *gomock.Call { +// GetOrganizationUsersIterator indicates an expected call of GetOrganizationUsersIterator. +func (mr *ClientMockRecorder) GetOrganizationUsersIterator(ctx, opts any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTicketForm", reflect.TypeOf((*Client)(nil).GetTicketForm), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetOrganizationUsersIterator", reflect.TypeOf((*Client)(nil).GetOrganizationUsersIterator), ctx, opts) } -// GetTicketForms mocks base method. -func (m *Client) GetTicketForms(arg0 context.Context, arg1 *zendesk.TicketFormListOptions) ([]zendesk.TicketForm, zendesk.Page, error) { +// GetOrganizationUsersOBP mocks base method. +func (m *Client) GetOrganizationUsersOBP(ctx context.Context, opts *zendesk.OBPOptions) ([]zendesk.User, zendesk.Page, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetTicketForms", arg0, arg1) - ret0, _ := ret[0].([]zendesk.TicketForm) + ret := m.ctrl.Call(m, "GetOrganizationUsersOBP", ctx, opts) + ret0, _ := ret[0].([]zendesk.User) ret1, _ := ret[1].(zendesk.Page) ret2, _ := ret[2].(error) return ret0, ret1, ret2 } -// GetTicketForms indicates an expected call of GetTicketForms. -func (mr *ClientMockRecorder) GetTicketForms(arg0, arg1 interface{}) *gomock.Call { +// GetOrganizationUsersOBP indicates an expected call of GetOrganizationUsersOBP. +func (mr *ClientMockRecorder) GetOrganizationUsersOBP(ctx, opts any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTicketForms", reflect.TypeOf((*Client)(nil).GetTicketForms), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetOrganizationUsersOBP", reflect.TypeOf((*Client)(nil).GetOrganizationUsersOBP), ctx, opts) } -// GetTicketTags mocks base method. -func (m *Client) GetTicketTags(arg0 context.Context, arg1 int64) ([]zendesk.Tag, error) { +// GetOrganizations mocks base method. +func (m *Client) GetOrganizations(ctx context.Context, opts *zendesk.OrganizationListOptions) ([]zendesk.Organization, zendesk.Page, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetTicketTags", arg0, arg1) - ret0, _ := ret[0].([]zendesk.Tag) - ret1, _ := ret[1].(error) - return ret0, ret1 + ret := m.ctrl.Call(m, "GetOrganizations", ctx, opts) + ret0, _ := ret[0].([]zendesk.Organization) + ret1, _ := ret[1].(zendesk.Page) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 } -// GetTicketTags indicates an expected call of GetTicketTags. -func (mr *ClientMockRecorder) GetTicketTags(arg0, arg1 interface{}) *gomock.Call { +// GetOrganizations indicates an expected call of GetOrganizations. +func (mr *ClientMockRecorder) GetOrganizations(ctx, opts any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTicketTags", reflect.TypeOf((*Client)(nil).GetTicketTags), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetOrganizations", reflect.TypeOf((*Client)(nil).GetOrganizations), ctx, opts) } -// GetTickets mocks base method. -func (m *Client) GetTickets(arg0 context.Context, arg1 *zendesk.TicketListOptions) ([]zendesk.Ticket, zendesk.Page, error) { +// GetOrganizationsCBP mocks base method. +func (m *Client) GetOrganizationsCBP(ctx context.Context, opts *zendesk.CBPOptions) ([]zendesk.Organization, zendesk.CursorPaginationMeta, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetTickets", arg0, arg1) - ret0, _ := ret[0].([]zendesk.Ticket) + ret := m.ctrl.Call(m, "GetOrganizationsCBP", ctx, opts) + ret0, _ := ret[0].([]zendesk.Organization) + ret1, _ := ret[1].(zendesk.CursorPaginationMeta) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetOrganizationsCBP indicates an expected call of GetOrganizationsCBP. +func (mr *ClientMockRecorder) GetOrganizationsCBP(ctx, opts any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetOrganizationsCBP", reflect.TypeOf((*Client)(nil).GetOrganizationsCBP), ctx, opts) +} + +// GetOrganizationsIterator mocks base method. +func (m *Client) GetOrganizationsIterator(ctx context.Context, opts *zendesk.PaginationOptions) *zendesk.Iterator[zendesk.Organization] { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetOrganizationsIterator", ctx, opts) + ret0, _ := ret[0].(*zendesk.Iterator[zendesk.Organization]) + return ret0 +} + +// GetOrganizationsIterator indicates an expected call of GetOrganizationsIterator. +func (mr *ClientMockRecorder) GetOrganizationsIterator(ctx, opts any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetOrganizationsIterator", reflect.TypeOf((*Client)(nil).GetOrganizationsIterator), ctx, opts) +} + +// GetOrganizationsOBP mocks base method. +func (m *Client) GetOrganizationsOBP(ctx context.Context, opts *zendesk.OBPOptions) ([]zendesk.Organization, zendesk.Page, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetOrganizationsOBP", ctx, opts) + ret0, _ := ret[0].([]zendesk.Organization) ret1, _ := ret[1].(zendesk.Page) ret2, _ := ret[2].(error) return ret0, ret1, ret2 } -// GetTickets indicates an expected call of GetTickets. -func (mr *ClientMockRecorder) GetTickets(arg0, arg1 interface{}) *gomock.Call { +// GetOrganizationsOBP indicates an expected call of GetOrganizationsOBP. +func (mr *ClientMockRecorder) GetOrganizationsOBP(ctx, opts any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTickets", reflect.TypeOf((*Client)(nil).GetTickets), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetOrganizationsOBP", reflect.TypeOf((*Client)(nil).GetOrganizationsOBP), ctx, opts) } -// GetTicketsCBP mocks base method. -func (m *Client) GetTicketsCBP(arg0 context.Context, arg1 *zendesk.TicketListCBPOptions) (*zendesk.TicketListCBPResult, error) { +// GetSLAPolicies mocks base method. +func (m *Client) GetSLAPolicies(ctx context.Context, opts *zendesk.SLAPolicyListOptions) ([]zendesk.SLAPolicy, zendesk.Page, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetSLAPolicies", ctx, opts) + ret0, _ := ret[0].([]zendesk.SLAPolicy) + ret1, _ := ret[1].(zendesk.Page) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetSLAPolicies indicates an expected call of GetSLAPolicies. +func (mr *ClientMockRecorder) GetSLAPolicies(ctx, opts any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSLAPolicies", reflect.TypeOf((*Client)(nil).GetSLAPolicies), ctx, opts) +} + +// GetSLAPoliciesCBP mocks base method. +func (m *Client) GetSLAPoliciesCBP(ctx context.Context, opts *zendesk.CBPOptions) ([]zendesk.SLAPolicy, zendesk.CursorPaginationMeta, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetSLAPoliciesCBP", ctx, opts) + ret0, _ := ret[0].([]zendesk.SLAPolicy) + ret1, _ := ret[1].(zendesk.CursorPaginationMeta) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetSLAPoliciesCBP indicates an expected call of GetSLAPoliciesCBP. +func (mr *ClientMockRecorder) GetSLAPoliciesCBP(ctx, opts any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSLAPoliciesCBP", reflect.TypeOf((*Client)(nil).GetSLAPoliciesCBP), ctx, opts) +} + +// GetSLAPoliciesIterator mocks base method. +func (m *Client) GetSLAPoliciesIterator(ctx context.Context, opts *zendesk.PaginationOptions) *zendesk.Iterator[zendesk.SLAPolicy] { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetSLAPoliciesIterator", ctx, opts) + ret0, _ := ret[0].(*zendesk.Iterator[zendesk.SLAPolicy]) + return ret0 +} + +// GetSLAPoliciesIterator indicates an expected call of GetSLAPoliciesIterator. +func (mr *ClientMockRecorder) GetSLAPoliciesIterator(ctx, opts any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSLAPoliciesIterator", reflect.TypeOf((*Client)(nil).GetSLAPoliciesIterator), ctx, opts) +} + +// GetSLAPoliciesOBP mocks base method. +func (m *Client) GetSLAPoliciesOBP(ctx context.Context, opts *zendesk.OBPOptions) ([]zendesk.SLAPolicy, zendesk.Page, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetSLAPoliciesOBP", ctx, opts) + ret0, _ := ret[0].([]zendesk.SLAPolicy) + ret1, _ := ret[1].(zendesk.Page) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetSLAPoliciesOBP indicates an expected call of GetSLAPoliciesOBP. +func (mr *ClientMockRecorder) GetSLAPoliciesOBP(ctx, opts any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSLAPoliciesOBP", reflect.TypeOf((*Client)(nil).GetSLAPoliciesOBP), ctx, opts) +} + +// GetSLAPolicy mocks base method. +func (m *Client) GetSLAPolicy(ctx context.Context, id int64) (zendesk.SLAPolicy, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetTicketsCBP", arg0, arg1) - ret0, _ := ret[0].(*zendesk.TicketListCBPResult) + ret := m.ctrl.Call(m, "GetSLAPolicy", ctx, id) + ret0, _ := ret[0].(zendesk.SLAPolicy) ret1, _ := ret[1].(error) return ret0, ret1 } -// GetTicketsCBP indicates an expected call of GetTicketsCBP. -func (mr *ClientMockRecorder) GetTicketsCBP(arg0, arg1 interface{}) *gomock.Call { +// GetSLAPolicy indicates an expected call of GetSLAPolicy. +func (mr *ClientMockRecorder) GetSLAPolicy(ctx, id any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSLAPolicy", reflect.TypeOf((*Client)(nil).GetSLAPolicy), ctx, id) +} + +// GetSearchCBP mocks base method. +func (m *Client) GetSearchCBP(ctx context.Context, opts *zendesk.CBPOptions) ([]zendesk.SearchResults, zendesk.CursorPaginationMeta, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetSearchCBP", ctx, opts) + ret0, _ := ret[0].([]zendesk.SearchResults) + ret1, _ := ret[1].(zendesk.CursorPaginationMeta) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetSearchCBP indicates an expected call of GetSearchCBP. +func (mr *ClientMockRecorder) GetSearchCBP(ctx, opts any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSearchCBP", reflect.TypeOf((*Client)(nil).GetSearchCBP), ctx, opts) +} + +// GetSearchIterator mocks base method. +func (m *Client) GetSearchIterator(ctx context.Context, opts *zendesk.PaginationOptions) *zendesk.Iterator[zendesk.SearchResults] { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetSearchIterator", ctx, opts) + ret0, _ := ret[0].(*zendesk.Iterator[zendesk.SearchResults]) + return ret0 +} + +// GetSearchIterator indicates an expected call of GetSearchIterator. +func (mr *ClientMockRecorder) GetSearchIterator(ctx, opts any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSearchIterator", reflect.TypeOf((*Client)(nil).GetSearchIterator), ctx, opts) +} + +// GetSearchOBP mocks base method. +func (m *Client) GetSearchOBP(ctx context.Context, opts *zendesk.OBPOptions) ([]zendesk.SearchResults, zendesk.Page, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetSearchOBP", ctx, opts) + ret0, _ := ret[0].([]zendesk.SearchResults) + ret1, _ := ret[1].(zendesk.Page) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetSearchOBP indicates an expected call of GetSearchOBP. +func (mr *ClientMockRecorder) GetSearchOBP(ctx, opts any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSearchOBP", reflect.TypeOf((*Client)(nil).GetSearchOBP), ctx, opts) +} + +// GetTarget mocks base method. +func (m *Client) GetTarget(ctx context.Context, ticketID int64) (zendesk.Target, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetTarget", ctx, ticketID) + ret0, _ := ret[0].(zendesk.Target) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetTarget indicates an expected call of GetTarget. +func (mr *ClientMockRecorder) GetTarget(ctx, ticketID any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTarget", reflect.TypeOf((*Client)(nil).GetTarget), ctx, ticketID) +} + +// GetTargets mocks base method. +func (m *Client) GetTargets(ctx context.Context) ([]zendesk.Target, zendesk.Page, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetTargets", ctx) + ret0, _ := ret[0].([]zendesk.Target) + ret1, _ := ret[1].(zendesk.Page) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetTargets indicates an expected call of GetTargets. +func (mr *ClientMockRecorder) GetTargets(ctx any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTargets", reflect.TypeOf((*Client)(nil).GetTargets), ctx) +} + +// GetTicket mocks base method. +func (m *Client) GetTicket(ctx context.Context, id int64) (zendesk.Ticket, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetTicket", ctx, id) + ret0, _ := ret[0].(zendesk.Ticket) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetTicket indicates an expected call of GetTicket. +func (mr *ClientMockRecorder) GetTicket(ctx, id any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTicket", reflect.TypeOf((*Client)(nil).GetTicket), ctx, id) +} + +// GetTicketAudit mocks base method. +func (m *Client) GetTicketAudit(ctx context.Context, TicketID, ID int64) (zendesk.TicketAudit, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetTicketAudit", ctx, TicketID, ID) + ret0, _ := ret[0].(zendesk.TicketAudit) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetTicketAudit indicates an expected call of GetTicketAudit. +func (mr *ClientMockRecorder) GetTicketAudit(ctx, TicketID, ID any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTicketAudit", reflect.TypeOf((*Client)(nil).GetTicketAudit), ctx, TicketID, ID) +} + +// GetTicketAudits mocks base method. +func (m *Client) GetTicketAudits(ctx context.Context, ticketID int64, opts zendesk.PageOptions) ([]zendesk.TicketAudit, zendesk.Page, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetTicketAudits", ctx, ticketID, opts) + ret0, _ := ret[0].([]zendesk.TicketAudit) + ret1, _ := ret[1].(zendesk.Page) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetTicketAudits indicates an expected call of GetTicketAudits. +func (mr *ClientMockRecorder) GetTicketAudits(ctx, ticketID, opts any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTicketAudits", reflect.TypeOf((*Client)(nil).GetTicketAudits), ctx, ticketID, opts) +} + +// GetTicketAuditsCBP mocks base method. +func (m *Client) GetTicketAuditsCBP(ctx context.Context, opts *zendesk.CBPOptions) ([]zendesk.TicketAudit, zendesk.CursorPaginationMeta, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetTicketAuditsCBP", ctx, opts) + ret0, _ := ret[0].([]zendesk.TicketAudit) + ret1, _ := ret[1].(zendesk.CursorPaginationMeta) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetTicketAuditsCBP indicates an expected call of GetTicketAuditsCBP. +func (mr *ClientMockRecorder) GetTicketAuditsCBP(ctx, opts any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTicketAuditsCBP", reflect.TypeOf((*Client)(nil).GetTicketAuditsCBP), ctx, opts) +} + +// GetTicketAuditsIterator mocks base method. +func (m *Client) GetTicketAuditsIterator(ctx context.Context, opts *zendesk.PaginationOptions) *zendesk.Iterator[zendesk.TicketAudit] { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetTicketAuditsIterator", ctx, opts) + ret0, _ := ret[0].(*zendesk.Iterator[zendesk.TicketAudit]) + return ret0 +} + +// GetTicketAuditsIterator indicates an expected call of GetTicketAuditsIterator. +func (mr *ClientMockRecorder) GetTicketAuditsIterator(ctx, opts any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTicketAuditsIterator", reflect.TypeOf((*Client)(nil).GetTicketAuditsIterator), ctx, opts) +} + +// GetTicketAuditsOBP mocks base method. +func (m *Client) GetTicketAuditsOBP(ctx context.Context, opts *zendesk.OBPOptions) ([]zendesk.TicketAudit, zendesk.Page, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetTicketAuditsOBP", ctx, opts) + ret0, _ := ret[0].([]zendesk.TicketAudit) + ret1, _ := ret[1].(zendesk.Page) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetTicketAuditsOBP indicates an expected call of GetTicketAuditsOBP. +func (mr *ClientMockRecorder) GetTicketAuditsOBP(ctx, opts any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTicketAuditsOBP", reflect.TypeOf((*Client)(nil).GetTicketAuditsOBP), ctx, opts) +} + +// GetTicketCommentsCBP mocks base method. +func (m *Client) GetTicketCommentsCBP(ctx context.Context, opts *zendesk.CBPOptions) ([]zendesk.TicketComment, zendesk.CursorPaginationMeta, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetTicketCommentsCBP", ctx, opts) + ret0, _ := ret[0].([]zendesk.TicketComment) + ret1, _ := ret[1].(zendesk.CursorPaginationMeta) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetTicketCommentsCBP indicates an expected call of GetTicketCommentsCBP. +func (mr *ClientMockRecorder) GetTicketCommentsCBP(ctx, opts any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTicketCommentsCBP", reflect.TypeOf((*Client)(nil).GetTicketCommentsCBP), ctx, opts) +} + +// GetTicketCommentsIterator mocks base method. +func (m *Client) GetTicketCommentsIterator(ctx context.Context, opts *zendesk.PaginationOptions) *zendesk.Iterator[zendesk.TicketComment] { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetTicketCommentsIterator", ctx, opts) + ret0, _ := ret[0].(*zendesk.Iterator[zendesk.TicketComment]) + return ret0 +} + +// GetTicketCommentsIterator indicates an expected call of GetTicketCommentsIterator. +func (mr *ClientMockRecorder) GetTicketCommentsIterator(ctx, opts any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTicketCommentsIterator", reflect.TypeOf((*Client)(nil).GetTicketCommentsIterator), ctx, opts) +} + +// GetTicketCommentsOBP mocks base method. +func (m *Client) GetTicketCommentsOBP(ctx context.Context, opts *zendesk.OBPOptions) ([]zendesk.TicketComment, zendesk.Page, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetTicketCommentsOBP", ctx, opts) + ret0, _ := ret[0].([]zendesk.TicketComment) + ret1, _ := ret[1].(zendesk.Page) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetTicketCommentsOBP indicates an expected call of GetTicketCommentsOBP. +func (mr *ClientMockRecorder) GetTicketCommentsOBP(ctx, opts any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTicketCommentsOBP", reflect.TypeOf((*Client)(nil).GetTicketCommentsOBP), ctx, opts) +} + +// GetTicketField mocks base method. +func (m *Client) GetTicketField(ctx context.Context, ticketID int64) (zendesk.TicketField, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetTicketField", ctx, ticketID) + ret0, _ := ret[0].(zendesk.TicketField) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetTicketField indicates an expected call of GetTicketField. +func (mr *ClientMockRecorder) GetTicketField(ctx, ticketID any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTicketField", reflect.TypeOf((*Client)(nil).GetTicketField), ctx, ticketID) +} + +// GetTicketFields mocks base method. +func (m *Client) GetTicketFields(ctx context.Context) ([]zendesk.TicketField, zendesk.Page, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetTicketFields", ctx) + ret0, _ := ret[0].([]zendesk.TicketField) + ret1, _ := ret[1].(zendesk.Page) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetTicketFields indicates an expected call of GetTicketFields. +func (mr *ClientMockRecorder) GetTicketFields(ctx any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTicketFields", reflect.TypeOf((*Client)(nil).GetTicketFields), ctx) +} + +// GetTicketFieldsCBP mocks base method. +func (m *Client) GetTicketFieldsCBP(ctx context.Context, opts *zendesk.CBPOptions) ([]zendesk.TicketField, zendesk.CursorPaginationMeta, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetTicketFieldsCBP", ctx, opts) + ret0, _ := ret[0].([]zendesk.TicketField) + ret1, _ := ret[1].(zendesk.CursorPaginationMeta) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetTicketFieldsCBP indicates an expected call of GetTicketFieldsCBP. +func (mr *ClientMockRecorder) GetTicketFieldsCBP(ctx, opts any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTicketFieldsCBP", reflect.TypeOf((*Client)(nil).GetTicketFieldsCBP), ctx, opts) +} + +// GetTicketFieldsIterator mocks base method. +func (m *Client) GetTicketFieldsIterator(ctx context.Context, opts *zendesk.PaginationOptions) *zendesk.Iterator[zendesk.TicketField] { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetTicketFieldsIterator", ctx, opts) + ret0, _ := ret[0].(*zendesk.Iterator[zendesk.TicketField]) + return ret0 +} + +// GetTicketFieldsIterator indicates an expected call of GetTicketFieldsIterator. +func (mr *ClientMockRecorder) GetTicketFieldsIterator(ctx, opts any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTicketFieldsIterator", reflect.TypeOf((*Client)(nil).GetTicketFieldsIterator), ctx, opts) +} + +// GetTicketFieldsOBP mocks base method. +func (m *Client) GetTicketFieldsOBP(ctx context.Context, opts *zendesk.OBPOptions) ([]zendesk.TicketField, zendesk.Page, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetTicketFieldsOBP", ctx, opts) + ret0, _ := ret[0].([]zendesk.TicketField) + ret1, _ := ret[1].(zendesk.Page) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetTicketFieldsOBP indicates an expected call of GetTicketFieldsOBP. +func (mr *ClientMockRecorder) GetTicketFieldsOBP(ctx, opts any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTicketFieldsOBP", reflect.TypeOf((*Client)(nil).GetTicketFieldsOBP), ctx, opts) +} + +// GetTicketForm mocks base method. +func (m *Client) GetTicketForm(ctx context.Context, id int64) (zendesk.TicketForm, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetTicketForm", ctx, id) + ret0, _ := ret[0].(zendesk.TicketForm) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetTicketForm indicates an expected call of GetTicketForm. +func (mr *ClientMockRecorder) GetTicketForm(ctx, id any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTicketForm", reflect.TypeOf((*Client)(nil).GetTicketForm), ctx, id) +} + +// GetTicketForms mocks base method. +func (m *Client) GetTicketForms(ctx context.Context, options *zendesk.TicketFormListOptions) ([]zendesk.TicketForm, zendesk.Page, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetTicketForms", ctx, options) + ret0, _ := ret[0].([]zendesk.TicketForm) + ret1, _ := ret[1].(zendesk.Page) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetTicketForms indicates an expected call of GetTicketForms. +func (mr *ClientMockRecorder) GetTicketForms(ctx, options any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTicketsCBP", reflect.TypeOf((*Client)(nil).GetTicketsCBP), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTicketForms", reflect.TypeOf((*Client)(nil).GetTicketForms), ctx, options) } -// GetTicketsEx mocks base method. -func (m *Client) GetTicketsEx(arg0 context.Context, arg1 *zendesk.PaginationOptions) *zendesk.TicketIterator { +// GetTicketFormsCBP mocks base method. +func (m *Client) GetTicketFormsCBP(ctx context.Context, opts *zendesk.CBPOptions) ([]zendesk.TicketForm, zendesk.CursorPaginationMeta, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetTicketsEx", arg0, arg1) - ret0, _ := ret[0].(*zendesk.TicketIterator) + ret := m.ctrl.Call(m, "GetTicketFormsCBP", ctx, opts) + ret0, _ := ret[0].([]zendesk.TicketForm) + ret1, _ := ret[1].(zendesk.CursorPaginationMeta) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetTicketFormsCBP indicates an expected call of GetTicketFormsCBP. +func (mr *ClientMockRecorder) GetTicketFormsCBP(ctx, opts any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTicketFormsCBP", reflect.TypeOf((*Client)(nil).GetTicketFormsCBP), ctx, opts) +} + +// GetTicketFormsIterator mocks base method. +func (m *Client) GetTicketFormsIterator(ctx context.Context, opts *zendesk.PaginationOptions) *zendesk.Iterator[zendesk.TicketForm] { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetTicketFormsIterator", ctx, opts) + ret0, _ := ret[0].(*zendesk.Iterator[zendesk.TicketForm]) return ret0 } -// GetTicketsEx indicates an expected call of GetTicketsEx. -func (mr *ClientMockRecorder) GetTicketsEx(arg0, arg1 interface{}) *gomock.Call { +// GetTicketFormsIterator indicates an expected call of GetTicketFormsIterator. +func (mr *ClientMockRecorder) GetTicketFormsIterator(ctx, opts any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTicketFormsIterator", reflect.TypeOf((*Client)(nil).GetTicketFormsIterator), ctx, opts) +} + +// GetTicketFormsOBP mocks base method. +func (m *Client) GetTicketFormsOBP(ctx context.Context, opts *zendesk.OBPOptions) ([]zendesk.TicketForm, zendesk.Page, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetTicketFormsOBP", ctx, opts) + ret0, _ := ret[0].([]zendesk.TicketForm) + ret1, _ := ret[1].(zendesk.Page) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetTicketFormsOBP indicates an expected call of GetTicketFormsOBP. +func (mr *ClientMockRecorder) GetTicketFormsOBP(ctx, opts any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTicketFormsOBP", reflect.TypeOf((*Client)(nil).GetTicketFormsOBP), ctx, opts) +} + +// GetTicketTags mocks base method. +func (m *Client) GetTicketTags(ctx context.Context, ticketID int64) ([]zendesk.Tag, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetTicketTags", ctx, ticketID) + ret0, _ := ret[0].([]zendesk.Tag) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetTicketTags indicates an expected call of GetTicketTags. +func (mr *ClientMockRecorder) GetTicketTags(ctx, ticketID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTicketsEx", reflect.TypeOf((*Client)(nil).GetTicketsEx), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTicketTags", reflect.TypeOf((*Client)(nil).GetTicketTags), ctx, ticketID) +} + +// GetTickets mocks base method. +func (m *Client) GetTickets(ctx context.Context, opts *zendesk.TicketListOptions) ([]zendesk.Ticket, zendesk.Page, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetTickets", ctx, opts) + ret0, _ := ret[0].([]zendesk.Ticket) + ret1, _ := ret[1].(zendesk.Page) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetTickets indicates an expected call of GetTickets. +func (mr *ClientMockRecorder) GetTickets(ctx, opts any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTickets", reflect.TypeOf((*Client)(nil).GetTickets), ctx, opts) +} + +// GetTicketsCBP mocks base method. +func (m *Client) GetTicketsCBP(ctx context.Context, opts *zendesk.CBPOptions) ([]zendesk.Ticket, zendesk.CursorPaginationMeta, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetTicketsCBP", ctx, opts) + ret0, _ := ret[0].([]zendesk.Ticket) + ret1, _ := ret[1].(zendesk.CursorPaginationMeta) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetTicketsCBP indicates an expected call of GetTicketsCBP. +func (mr *ClientMockRecorder) GetTicketsCBP(ctx, opts any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTicketsCBP", reflect.TypeOf((*Client)(nil).GetTicketsCBP), ctx, opts) } // GetTicketsFromView mocks base method. @@ -1235,30 +1977,106 @@ func (m *Client) GetTicketsFromView(arg0 context.Context, arg1 int64, arg2 *zend } // GetTicketsFromView indicates an expected call of GetTicketsFromView. -func (mr *ClientMockRecorder) GetTicketsFromView(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) GetTicketsFromView(arg0, arg1, arg2 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTicketsFromView", reflect.TypeOf((*Client)(nil).GetTicketsFromView), arg0, arg1, arg2) } +// GetTicketsFromViewCBP mocks base method. +func (m *Client) GetTicketsFromViewCBP(ctx context.Context, opts *zendesk.CBPOptions) ([]zendesk.Ticket, zendesk.CursorPaginationMeta, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetTicketsFromViewCBP", ctx, opts) + ret0, _ := ret[0].([]zendesk.Ticket) + ret1, _ := ret[1].(zendesk.CursorPaginationMeta) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetTicketsFromViewCBP indicates an expected call of GetTicketsFromViewCBP. +func (mr *ClientMockRecorder) GetTicketsFromViewCBP(ctx, opts any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTicketsFromViewCBP", reflect.TypeOf((*Client)(nil).GetTicketsFromViewCBP), ctx, opts) +} + +// GetTicketsFromViewIterator mocks base method. +func (m *Client) GetTicketsFromViewIterator(ctx context.Context, opts *zendesk.PaginationOptions) *zendesk.Iterator[zendesk.Ticket] { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetTicketsFromViewIterator", ctx, opts) + ret0, _ := ret[0].(*zendesk.Iterator[zendesk.Ticket]) + return ret0 +} + +// GetTicketsFromViewIterator indicates an expected call of GetTicketsFromViewIterator. +func (mr *ClientMockRecorder) GetTicketsFromViewIterator(ctx, opts any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTicketsFromViewIterator", reflect.TypeOf((*Client)(nil).GetTicketsFromViewIterator), ctx, opts) +} + +// GetTicketsFromViewOBP mocks base method. +func (m *Client) GetTicketsFromViewOBP(ctx context.Context, opts *zendesk.OBPOptions) ([]zendesk.Ticket, zendesk.Page, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetTicketsFromViewOBP", ctx, opts) + ret0, _ := ret[0].([]zendesk.Ticket) + ret1, _ := ret[1].(zendesk.Page) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetTicketsFromViewOBP indicates an expected call of GetTicketsFromViewOBP. +func (mr *ClientMockRecorder) GetTicketsFromViewOBP(ctx, opts any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTicketsFromViewOBP", reflect.TypeOf((*Client)(nil).GetTicketsFromViewOBP), ctx, opts) +} + +// GetTicketsIterator mocks base method. +func (m *Client) GetTicketsIterator(ctx context.Context, opts *zendesk.PaginationOptions) *zendesk.Iterator[zendesk.Ticket] { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetTicketsIterator", ctx, opts) + ret0, _ := ret[0].(*zendesk.Iterator[zendesk.Ticket]) + return ret0 +} + +// GetTicketsIterator indicates an expected call of GetTicketsIterator. +func (mr *ClientMockRecorder) GetTicketsIterator(ctx, opts any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTicketsIterator", reflect.TypeOf((*Client)(nil).GetTicketsIterator), ctx, opts) +} + +// GetTicketsOBP mocks base method. +func (m *Client) GetTicketsOBP(ctx context.Context, opts *zendesk.OBPOptions) ([]zendesk.Ticket, zendesk.Page, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetTicketsOBP", ctx, opts) + ret0, _ := ret[0].([]zendesk.Ticket) + ret1, _ := ret[1].(zendesk.Page) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetTicketsOBP indicates an expected call of GetTicketsOBP. +func (mr *ClientMockRecorder) GetTicketsOBP(ctx, opts any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTicketsOBP", reflect.TypeOf((*Client)(nil).GetTicketsOBP), ctx, opts) +} + // GetTrigger mocks base method. -func (m *Client) GetTrigger(arg0 context.Context, arg1 int64) (zendesk.Trigger, error) { +func (m *Client) GetTrigger(ctx context.Context, id int64) (zendesk.Trigger, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetTrigger", arg0, arg1) + ret := m.ctrl.Call(m, "GetTrigger", ctx, id) ret0, _ := ret[0].(zendesk.Trigger) ret1, _ := ret[1].(error) return ret0, ret1 } // GetTrigger indicates an expected call of GetTrigger. -func (mr *ClientMockRecorder) GetTrigger(arg0, arg1 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) GetTrigger(ctx, id any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTrigger", reflect.TypeOf((*Client)(nil).GetTrigger), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTrigger", reflect.TypeOf((*Client)(nil).GetTrigger), ctx, id) } // GetTriggers mocks base method. -func (m *Client) GetTriggers(arg0 context.Context, arg1 *zendesk.TriggerListOptions) ([]zendesk.Trigger, zendesk.Page, error) { +func (m *Client) GetTriggers(ctx context.Context, opts *zendesk.TriggerListOptions) ([]zendesk.Trigger, zendesk.Page, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetTriggers", arg0, arg1) + ret := m.ctrl.Call(m, "GetTriggers", ctx, opts) ret0, _ := ret[0].([]zendesk.Trigger) ret1, _ := ret[1].(zendesk.Page) ret2, _ := ret[2].(error) @@ -1266,30 +2084,76 @@ func (m *Client) GetTriggers(arg0 context.Context, arg1 *zendesk.TriggerListOpti } // GetTriggers indicates an expected call of GetTriggers. -func (mr *ClientMockRecorder) GetTriggers(arg0, arg1 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) GetTriggers(ctx, opts any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTriggers", reflect.TypeOf((*Client)(nil).GetTriggers), ctx, opts) +} + +// GetTriggersCBP mocks base method. +func (m *Client) GetTriggersCBP(ctx context.Context, opts *zendesk.CBPOptions) ([]zendesk.Trigger, zendesk.CursorPaginationMeta, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetTriggersCBP", ctx, opts) + ret0, _ := ret[0].([]zendesk.Trigger) + ret1, _ := ret[1].(zendesk.CursorPaginationMeta) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetTriggersCBP indicates an expected call of GetTriggersCBP. +func (mr *ClientMockRecorder) GetTriggersCBP(ctx, opts any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTriggersCBP", reflect.TypeOf((*Client)(nil).GetTriggersCBP), ctx, opts) +} + +// GetTriggersIterator mocks base method. +func (m *Client) GetTriggersIterator(ctx context.Context, opts *zendesk.PaginationOptions) *zendesk.Iterator[zendesk.Trigger] { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetTriggersIterator", ctx, opts) + ret0, _ := ret[0].(*zendesk.Iterator[zendesk.Trigger]) + return ret0 +} + +// GetTriggersIterator indicates an expected call of GetTriggersIterator. +func (mr *ClientMockRecorder) GetTriggersIterator(ctx, opts any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTriggersIterator", reflect.TypeOf((*Client)(nil).GetTriggersIterator), ctx, opts) +} + +// GetTriggersOBP mocks base method. +func (m *Client) GetTriggersOBP(ctx context.Context, opts *zendesk.OBPOptions) ([]zendesk.Trigger, zendesk.Page, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetTriggersOBP", ctx, opts) + ret0, _ := ret[0].([]zendesk.Trigger) + ret1, _ := ret[1].(zendesk.Page) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetTriggersOBP indicates an expected call of GetTriggersOBP. +func (mr *ClientMockRecorder) GetTriggersOBP(ctx, opts any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTriggers", reflect.TypeOf((*Client)(nil).GetTriggers), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTriggersOBP", reflect.TypeOf((*Client)(nil).GetTriggersOBP), ctx, opts) } // GetUser mocks base method. -func (m *Client) GetUser(arg0 context.Context, arg1 int64) (zendesk.User, error) { +func (m *Client) GetUser(ctx context.Context, userID int64) (zendesk.User, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetUser", arg0, arg1) + ret := m.ctrl.Call(m, "GetUser", ctx, userID) ret0, _ := ret[0].(zendesk.User) ret1, _ := ret[1].(error) return ret0, ret1 } // GetUser indicates an expected call of GetUser. -func (mr *ClientMockRecorder) GetUser(arg0, arg1 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) GetUser(ctx, userID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetUser", reflect.TypeOf((*Client)(nil).GetUser), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetUser", reflect.TypeOf((*Client)(nil).GetUser), ctx, userID) } // GetUserFields mocks base method. -func (m *Client) GetUserFields(arg0 context.Context, arg1 *zendesk.UserFieldListOptions) ([]zendesk.UserField, zendesk.Page, error) { +func (m *Client) GetUserFields(ctx context.Context, opts *zendesk.UserFieldListOptions) ([]zendesk.UserField, zendesk.Page, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetUserFields", arg0, arg1) + ret := m.ctrl.Call(m, "GetUserFields", ctx, opts) ret0, _ := ret[0].([]zendesk.UserField) ret1, _ := ret[1].(zendesk.Page) ret2, _ := ret[2].(error) @@ -1297,45 +2161,91 @@ func (m *Client) GetUserFields(arg0 context.Context, arg1 *zendesk.UserFieldList } // GetUserFields indicates an expected call of GetUserFields. -func (mr *ClientMockRecorder) GetUserFields(arg0, arg1 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) GetUserFields(ctx, opts any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetUserFields", reflect.TypeOf((*Client)(nil).GetUserFields), ctx, opts) +} + +// GetUserFieldsCBP mocks base method. +func (m *Client) GetUserFieldsCBP(ctx context.Context, opts *zendesk.CBPOptions) ([]zendesk.UserField, zendesk.CursorPaginationMeta, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetUserFieldsCBP", ctx, opts) + ret0, _ := ret[0].([]zendesk.UserField) + ret1, _ := ret[1].(zendesk.CursorPaginationMeta) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetUserFieldsCBP indicates an expected call of GetUserFieldsCBP. +func (mr *ClientMockRecorder) GetUserFieldsCBP(ctx, opts any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetUserFieldsCBP", reflect.TypeOf((*Client)(nil).GetUserFieldsCBP), ctx, opts) +} + +// GetUserFieldsIterator mocks base method. +func (m *Client) GetUserFieldsIterator(ctx context.Context, opts *zendesk.PaginationOptions) *zendesk.Iterator[zendesk.UserField] { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetUserFieldsIterator", ctx, opts) + ret0, _ := ret[0].(*zendesk.Iterator[zendesk.UserField]) + return ret0 +} + +// GetUserFieldsIterator indicates an expected call of GetUserFieldsIterator. +func (mr *ClientMockRecorder) GetUserFieldsIterator(ctx, opts any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetUserFieldsIterator", reflect.TypeOf((*Client)(nil).GetUserFieldsIterator), ctx, opts) +} + +// GetUserFieldsOBP mocks base method. +func (m *Client) GetUserFieldsOBP(ctx context.Context, opts *zendesk.OBPOptions) ([]zendesk.UserField, zendesk.Page, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetUserFieldsOBP", ctx, opts) + ret0, _ := ret[0].([]zendesk.UserField) + ret1, _ := ret[1].(zendesk.Page) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetUserFieldsOBP indicates an expected call of GetUserFieldsOBP. +func (mr *ClientMockRecorder) GetUserFieldsOBP(ctx, opts any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetUserFields", reflect.TypeOf((*Client)(nil).GetUserFields), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetUserFieldsOBP", reflect.TypeOf((*Client)(nil).GetUserFieldsOBP), ctx, opts) } // GetUserRelated mocks base method. -func (m *Client) GetUserRelated(arg0 context.Context, arg1 int64) (zendesk.UserRelated, error) { +func (m *Client) GetUserRelated(ctx context.Context, userID int64) (zendesk.UserRelated, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetUserRelated", arg0, arg1) + ret := m.ctrl.Call(m, "GetUserRelated", ctx, userID) ret0, _ := ret[0].(zendesk.UserRelated) ret1, _ := ret[1].(error) return ret0, ret1 } // GetUserRelated indicates an expected call of GetUserRelated. -func (mr *ClientMockRecorder) GetUserRelated(arg0, arg1 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) GetUserRelated(ctx, userID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetUserRelated", reflect.TypeOf((*Client)(nil).GetUserRelated), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetUserRelated", reflect.TypeOf((*Client)(nil).GetUserRelated), ctx, userID) } // GetUserTags mocks base method. -func (m *Client) GetUserTags(arg0 context.Context, arg1 int64) ([]zendesk.Tag, error) { +func (m *Client) GetUserTags(ctx context.Context, userID int64) ([]zendesk.Tag, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetUserTags", arg0, arg1) + ret := m.ctrl.Call(m, "GetUserTags", ctx, userID) ret0, _ := ret[0].([]zendesk.Tag) ret1, _ := ret[1].(error) return ret0, ret1 } // GetUserTags indicates an expected call of GetUserTags. -func (mr *ClientMockRecorder) GetUserTags(arg0, arg1 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) GetUserTags(ctx, userID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetUserTags", reflect.TypeOf((*Client)(nil).GetUserTags), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetUserTags", reflect.TypeOf((*Client)(nil).GetUserTags), ctx, userID) } // GetUsers mocks base method. -func (m *Client) GetUsers(arg0 context.Context, arg1 *zendesk.UserListOptions) ([]zendesk.User, zendesk.Page, error) { +func (m *Client) GetUsers(ctx context.Context, opts *zendesk.UserListOptions) ([]zendesk.User, zendesk.Page, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetUsers", arg0, arg1) + ret := m.ctrl.Call(m, "GetUsers", ctx, opts) ret0, _ := ret[0].([]zendesk.User) ret1, _ := ret[1].(zendesk.Page) ret2, _ := ret[2].(error) @@ -1343,9 +2253,55 @@ func (m *Client) GetUsers(arg0 context.Context, arg1 *zendesk.UserListOptions) ( } // GetUsers indicates an expected call of GetUsers. -func (mr *ClientMockRecorder) GetUsers(arg0, arg1 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) GetUsers(ctx, opts any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetUsers", reflect.TypeOf((*Client)(nil).GetUsers), ctx, opts) +} + +// GetUsersCBP mocks base method. +func (m *Client) GetUsersCBP(ctx context.Context, opts *zendesk.CBPOptions) ([]zendesk.User, zendesk.CursorPaginationMeta, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetUsersCBP", ctx, opts) + ret0, _ := ret[0].([]zendesk.User) + ret1, _ := ret[1].(zendesk.CursorPaginationMeta) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetUsersCBP indicates an expected call of GetUsersCBP. +func (mr *ClientMockRecorder) GetUsersCBP(ctx, opts any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetUsersCBP", reflect.TypeOf((*Client)(nil).GetUsersCBP), ctx, opts) +} + +// GetUsersIterator mocks base method. +func (m *Client) GetUsersIterator(ctx context.Context, opts *zendesk.PaginationOptions) *zendesk.Iterator[zendesk.User] { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetUsersIterator", ctx, opts) + ret0, _ := ret[0].(*zendesk.Iterator[zendesk.User]) + return ret0 +} + +// GetUsersIterator indicates an expected call of GetUsersIterator. +func (mr *ClientMockRecorder) GetUsersIterator(ctx, opts any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetUsersIterator", reflect.TypeOf((*Client)(nil).GetUsersIterator), ctx, opts) +} + +// GetUsersOBP mocks base method. +func (m *Client) GetUsersOBP(ctx context.Context, opts *zendesk.OBPOptions) ([]zendesk.User, zendesk.Page, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetUsersOBP", ctx, opts) + ret0, _ := ret[0].([]zendesk.User) + ret1, _ := ret[1].(zendesk.Page) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetUsersOBP indicates an expected call of GetUsersOBP. +func (mr *ClientMockRecorder) GetUsersOBP(ctx, opts any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetUsers", reflect.TypeOf((*Client)(nil).GetUsers), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetUsersOBP", reflect.TypeOf((*Client)(nil).GetUsersOBP), ctx, opts) } // GetView mocks base method. @@ -1358,7 +2314,7 @@ func (m *Client) GetView(arg0 context.Context, arg1 int64) (zendesk.View, error) } // GetView indicates an expected call of GetView. -func (mr *ClientMockRecorder) GetView(arg0, arg1 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) GetView(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetView", reflect.TypeOf((*Client)(nil).GetView), arg0, arg1) } @@ -1374,45 +2330,91 @@ func (m *Client) GetViews(arg0 context.Context) ([]zendesk.View, zendesk.Page, e } // GetViews indicates an expected call of GetViews. -func (mr *ClientMockRecorder) GetViews(arg0 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) GetViews(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetViews", reflect.TypeOf((*Client)(nil).GetViews), arg0) } +// GetViewsCBP mocks base method. +func (m *Client) GetViewsCBP(ctx context.Context, opts *zendesk.CBPOptions) ([]zendesk.View, zendesk.CursorPaginationMeta, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetViewsCBP", ctx, opts) + ret0, _ := ret[0].([]zendesk.View) + ret1, _ := ret[1].(zendesk.CursorPaginationMeta) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetViewsCBP indicates an expected call of GetViewsCBP. +func (mr *ClientMockRecorder) GetViewsCBP(ctx, opts any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetViewsCBP", reflect.TypeOf((*Client)(nil).GetViewsCBP), ctx, opts) +} + +// GetViewsIterator mocks base method. +func (m *Client) GetViewsIterator(ctx context.Context, opts *zendesk.PaginationOptions) *zendesk.Iterator[zendesk.View] { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetViewsIterator", ctx, opts) + ret0, _ := ret[0].(*zendesk.Iterator[zendesk.View]) + return ret0 +} + +// GetViewsIterator indicates an expected call of GetViewsIterator. +func (mr *ClientMockRecorder) GetViewsIterator(ctx, opts any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetViewsIterator", reflect.TypeOf((*Client)(nil).GetViewsIterator), ctx, opts) +} + +// GetViewsOBP mocks base method. +func (m *Client) GetViewsOBP(ctx context.Context, opts *zendesk.OBPOptions) ([]zendesk.View, zendesk.Page, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetViewsOBP", ctx, opts) + ret0, _ := ret[0].([]zendesk.View) + ret1, _ := ret[1].(zendesk.Page) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetViewsOBP indicates an expected call of GetViewsOBP. +func (mr *ClientMockRecorder) GetViewsOBP(ctx, opts any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetViewsOBP", reflect.TypeOf((*Client)(nil).GetViewsOBP), ctx, opts) +} + // GetWebhook mocks base method. -func (m *Client) GetWebhook(arg0 context.Context, arg1 string) (*zendesk.Webhook, error) { +func (m *Client) GetWebhook(ctx context.Context, webhookID string) (*zendesk.Webhook, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetWebhook", arg0, arg1) + ret := m.ctrl.Call(m, "GetWebhook", ctx, webhookID) ret0, _ := ret[0].(*zendesk.Webhook) ret1, _ := ret[1].(error) return ret0, ret1 } // GetWebhook indicates an expected call of GetWebhook. -func (mr *ClientMockRecorder) GetWebhook(arg0, arg1 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) GetWebhook(ctx, webhookID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetWebhook", reflect.TypeOf((*Client)(nil).GetWebhook), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetWebhook", reflect.TypeOf((*Client)(nil).GetWebhook), ctx, webhookID) } // GetWebhookSigningSecret mocks base method. -func (m *Client) GetWebhookSigningSecret(arg0 context.Context, arg1 string) (*zendesk.WebhookSigningSecret, error) { +func (m *Client) GetWebhookSigningSecret(ctx context.Context, webhookID string) (*zendesk.WebhookSigningSecret, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetWebhookSigningSecret", arg0, arg1) + ret := m.ctrl.Call(m, "GetWebhookSigningSecret", ctx, webhookID) ret0, _ := ret[0].(*zendesk.WebhookSigningSecret) ret1, _ := ret[1].(error) return ret0, ret1 } // GetWebhookSigningSecret indicates an expected call of GetWebhookSigningSecret. -func (mr *ClientMockRecorder) GetWebhookSigningSecret(arg0, arg1 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) GetWebhookSigningSecret(ctx, webhookID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetWebhookSigningSecret", reflect.TypeOf((*Client)(nil).GetWebhookSigningSecret), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetWebhookSigningSecret", reflect.TypeOf((*Client)(nil).GetWebhookSigningSecret), ctx, webhookID) } // ListCustomObjectRecords mocks base method. -func (m *Client) ListCustomObjectRecords(arg0 context.Context, arg1 string, arg2 *zendesk.CustomObjectListOptions) ([]zendesk.CustomObjectRecord, zendesk.Page, error) { +func (m *Client) ListCustomObjectRecords(ctx context.Context, customObjectKey string, opts *zendesk.CustomObjectListOptions) ([]zendesk.CustomObjectRecord, zendesk.Page, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ListCustomObjectRecords", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "ListCustomObjectRecords", ctx, customObjectKey, opts) ret0, _ := ret[0].([]zendesk.CustomObjectRecord) ret1, _ := ret[1].(zendesk.Page) ret2, _ := ret[2].(error) @@ -1420,89 +2422,89 @@ func (m *Client) ListCustomObjectRecords(arg0 context.Context, arg1 string, arg2 } // ListCustomObjectRecords indicates an expected call of ListCustomObjectRecords. -func (mr *ClientMockRecorder) ListCustomObjectRecords(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) ListCustomObjectRecords(ctx, customObjectKey, opts any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListCustomObjectRecords", reflect.TypeOf((*Client)(nil).ListCustomObjectRecords), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListCustomObjectRecords", reflect.TypeOf((*Client)(nil).ListCustomObjectRecords), ctx, customObjectKey, opts) } // ListInstallations mocks base method. -func (m *Client) ListInstallations(arg0 context.Context) ([]zendesk.AppInstallation, error) { +func (m *Client) ListInstallations(ctx context.Context) ([]zendesk.AppInstallation, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ListInstallations", arg0) + ret := m.ctrl.Call(m, "ListInstallations", ctx) ret0, _ := ret[0].([]zendesk.AppInstallation) ret1, _ := ret[1].(error) return ret0, ret1 } // ListInstallations indicates an expected call of ListInstallations. -func (mr *ClientMockRecorder) ListInstallations(arg0 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) ListInstallations(ctx any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListInstallations", reflect.TypeOf((*Client)(nil).ListInstallations), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListInstallations", reflect.TypeOf((*Client)(nil).ListInstallations), ctx) } // ListTicketComments mocks base method. -func (m *Client) ListTicketComments(arg0 context.Context, arg1 int64, arg2 *zendesk.ListTicketCommentsOptions) (*zendesk.ListTicketCommentsResult, error) { +func (m *Client) ListTicketComments(ctx context.Context, ticketID int64, opts *zendesk.ListTicketCommentsOptions) (*zendesk.ListTicketCommentsResult, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ListTicketComments", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "ListTicketComments", ctx, ticketID, opts) ret0, _ := ret[0].(*zendesk.ListTicketCommentsResult) ret1, _ := ret[1].(error) return ret0, ret1 } // ListTicketComments indicates an expected call of ListTicketComments. -func (mr *ClientMockRecorder) ListTicketComments(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) ListTicketComments(ctx, ticketID, opts any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListTicketComments", reflect.TypeOf((*Client)(nil).ListTicketComments), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListTicketComments", reflect.TypeOf((*Client)(nil).ListTicketComments), ctx, ticketID, opts) } // MakeCommentPrivate mocks base method. -func (m *Client) MakeCommentPrivate(arg0 context.Context, arg1, arg2 int64) error { +func (m *Client) MakeCommentPrivate(ctx context.Context, ticketID, ticketCommentID int64) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "MakeCommentPrivate", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "MakeCommentPrivate", ctx, ticketID, ticketCommentID) ret0, _ := ret[0].(error) return ret0 } // MakeCommentPrivate indicates an expected call of MakeCommentPrivate. -func (mr *ClientMockRecorder) MakeCommentPrivate(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) MakeCommentPrivate(ctx, ticketID, ticketCommentID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MakeCommentPrivate", reflect.TypeOf((*Client)(nil).MakeCommentPrivate), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MakeCommentPrivate", reflect.TypeOf((*Client)(nil).MakeCommentPrivate), ctx, ticketID, ticketCommentID) } // Post mocks base method. -func (m *Client) Post(arg0 context.Context, arg1 string, arg2 interface{}) ([]byte, error) { +func (m *Client) Post(ctx context.Context, path string, data any) ([]byte, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Post", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "Post", ctx, path, data) ret0, _ := ret[0].([]byte) ret1, _ := ret[1].(error) return ret0, ret1 } // Post indicates an expected call of Post. -func (mr *ClientMockRecorder) Post(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) Post(ctx, path, data any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Post", reflect.TypeOf((*Client)(nil).Post), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Post", reflect.TypeOf((*Client)(nil).Post), ctx, path, data) } // Put mocks base method. -func (m *Client) Put(arg0 context.Context, arg1 string, arg2 interface{}) ([]byte, error) { +func (m *Client) Put(ctx context.Context, path string, data any) ([]byte, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Put", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "Put", ctx, path, data) ret0, _ := ret[0].([]byte) ret1, _ := ret[1].(error) return ret0, ret1 } // Put indicates an expected call of Put. -func (mr *ClientMockRecorder) Put(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) Put(ctx, path, data any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Put", reflect.TypeOf((*Client)(nil).Put), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Put", reflect.TypeOf((*Client)(nil).Put), ctx, path, data) } // Search mocks base method. -func (m *Client) Search(arg0 context.Context, arg1 *zendesk.SearchOptions) (zendesk.SearchResults, zendesk.Page, error) { +func (m *Client) Search(ctx context.Context, opts *zendesk.SearchOptions) (zendesk.SearchResults, zendesk.Page, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Search", arg0, arg1) + ret := m.ctrl.Call(m, "Search", ctx, opts) ret0, _ := ret[0].(zendesk.SearchResults) ret1, _ := ret[1].(zendesk.Page) ret2, _ := ret[2].(error) @@ -1510,30 +2512,30 @@ func (m *Client) Search(arg0 context.Context, arg1 *zendesk.SearchOptions) (zend } // Search indicates an expected call of Search. -func (mr *ClientMockRecorder) Search(arg0, arg1 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) Search(ctx, opts any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Search", reflect.TypeOf((*Client)(nil).Search), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Search", reflect.TypeOf((*Client)(nil).Search), ctx, opts) } // SearchCount mocks base method. -func (m *Client) SearchCount(arg0 context.Context, arg1 *zendesk.CountOptions) (int, error) { +func (m *Client) SearchCount(ctx context.Context, opts *zendesk.CountOptions) (int, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SearchCount", arg0, arg1) + ret := m.ctrl.Call(m, "SearchCount", ctx, opts) ret0, _ := ret[0].(int) ret1, _ := ret[1].(error) return ret0, ret1 } // SearchCount indicates an expected call of SearchCount. -func (mr *ClientMockRecorder) SearchCount(arg0, arg1 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) SearchCount(ctx, opts any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SearchCount", reflect.TypeOf((*Client)(nil).SearchCount), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SearchCount", reflect.TypeOf((*Client)(nil).SearchCount), ctx, opts) } // SearchCustomObjectRecords mocks base method. -func (m *Client) SearchCustomObjectRecords(arg0 context.Context, arg1 string, arg2 *zendesk.SearchCustomObjectRecordsOptions) ([]zendesk.CustomObjectRecord, zendesk.Page, error) { +func (m *Client) SearchCustomObjectRecords(ctx context.Context, customObjectKey string, opts *zendesk.SearchCustomObjectRecordsOptions) ([]zendesk.CustomObjectRecord, zendesk.Page, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SearchCustomObjectRecords", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "SearchCustomObjectRecords", ctx, customObjectKey, opts) ret0, _ := ret[0].([]zendesk.CustomObjectRecord) ret1, _ := ret[1].(zendesk.Page) ret2, _ := ret[2].(error) @@ -1541,15 +2543,15 @@ func (m *Client) SearchCustomObjectRecords(arg0 context.Context, arg1 string, ar } // SearchCustomObjectRecords indicates an expected call of SearchCustomObjectRecords. -func (mr *ClientMockRecorder) SearchCustomObjectRecords(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) SearchCustomObjectRecords(ctx, customObjectKey, opts any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SearchCustomObjectRecords", reflect.TypeOf((*Client)(nil).SearchCustomObjectRecords), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SearchCustomObjectRecords", reflect.TypeOf((*Client)(nil).SearchCustomObjectRecords), ctx, customObjectKey, opts) } // SearchUsers mocks base method. -func (m *Client) SearchUsers(arg0 context.Context, arg1 *zendesk.SearchUsersOptions) ([]zendesk.User, zendesk.Page, error) { +func (m *Client) SearchUsers(ctx context.Context, opts *zendesk.SearchUsersOptions) ([]zendesk.User, zendesk.Page, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SearchUsers", arg0, arg1) + ret := m.ctrl.Call(m, "SearchUsers", ctx, opts) ret0, _ := ret[0].([]zendesk.User) ret1, _ := ret[1].(zendesk.Page) ret2, _ := ret[2].(error) @@ -1557,9 +2559,9 @@ func (m *Client) SearchUsers(arg0 context.Context, arg1 *zendesk.SearchUsersOpti } // SearchUsers indicates an expected call of SearchUsers. -func (mr *ClientMockRecorder) SearchUsers(arg0, arg1 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) SearchUsers(ctx, opts any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SearchUsers", reflect.TypeOf((*Client)(nil).SearchUsers), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SearchUsers", reflect.TypeOf((*Client)(nil).SearchUsers), ctx, opts) } // SetDefaultOrganization mocks base method. @@ -1572,260 +2574,260 @@ func (m *Client) SetDefaultOrganization(arg0 context.Context, arg1 zendesk.Organ } // SetDefaultOrganization indicates an expected call of SetDefaultOrganization. -func (mr *ClientMockRecorder) SetDefaultOrganization(arg0, arg1 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) SetDefaultOrganization(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetDefaultOrganization", reflect.TypeOf((*Client)(nil).SetDefaultOrganization), arg0, arg1) } // ShowCustomObjectRecord mocks base method. -func (m *Client) ShowCustomObjectRecord(arg0 context.Context, arg1, arg2 string) (*zendesk.CustomObjectRecord, error) { +func (m *Client) ShowCustomObjectRecord(ctx context.Context, customObjectKey, customObjectRecordID string) (*zendesk.CustomObjectRecord, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ShowCustomObjectRecord", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "ShowCustomObjectRecord", ctx, customObjectKey, customObjectRecordID) ret0, _ := ret[0].(*zendesk.CustomObjectRecord) ret1, _ := ret[1].(error) return ret0, ret1 } // ShowCustomObjectRecord indicates an expected call of ShowCustomObjectRecord. -func (mr *ClientMockRecorder) ShowCustomObjectRecord(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) ShowCustomObjectRecord(ctx, customObjectKey, customObjectRecordID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ShowCustomObjectRecord", reflect.TypeOf((*Client)(nil).ShowCustomObjectRecord), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ShowCustomObjectRecord", reflect.TypeOf((*Client)(nil).ShowCustomObjectRecord), ctx, customObjectKey, customObjectRecordID) } // UpdateAutomation mocks base method. -func (m *Client) UpdateAutomation(arg0 context.Context, arg1 int64, arg2 zendesk.Automation) (zendesk.Automation, error) { +func (m *Client) UpdateAutomation(ctx context.Context, id int64, automation zendesk.Automation) (zendesk.Automation, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "UpdateAutomation", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "UpdateAutomation", ctx, id, automation) ret0, _ := ret[0].(zendesk.Automation) ret1, _ := ret[1].(error) return ret0, ret1 } // UpdateAutomation indicates an expected call of UpdateAutomation. -func (mr *ClientMockRecorder) UpdateAutomation(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) UpdateAutomation(ctx, id, automation any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateAutomation", reflect.TypeOf((*Client)(nil).UpdateAutomation), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateAutomation", reflect.TypeOf((*Client)(nil).UpdateAutomation), ctx, id, automation) } // UpdateBrand mocks base method. -func (m *Client) UpdateBrand(arg0 context.Context, arg1 int64, arg2 zendesk.Brand) (zendesk.Brand, error) { +func (m *Client) UpdateBrand(ctx context.Context, brandID int64, brand zendesk.Brand) (zendesk.Brand, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "UpdateBrand", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "UpdateBrand", ctx, brandID, brand) ret0, _ := ret[0].(zendesk.Brand) ret1, _ := ret[1].(error) return ret0, ret1 } // UpdateBrand indicates an expected call of UpdateBrand. -func (mr *ClientMockRecorder) UpdateBrand(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) UpdateBrand(ctx, brandID, brand any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateBrand", reflect.TypeOf((*Client)(nil).UpdateBrand), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateBrand", reflect.TypeOf((*Client)(nil).UpdateBrand), ctx, brandID, brand) } // UpdateCustomObjectRecord mocks base method. -func (m *Client) UpdateCustomObjectRecord(arg0 context.Context, arg1, arg2 string, arg3 zendesk.CustomObjectRecord) (*zendesk.CustomObjectRecord, error) { +func (m *Client) UpdateCustomObjectRecord(ctx context.Context, customObjectKey, customObjectRecordID string, record zendesk.CustomObjectRecord) (*zendesk.CustomObjectRecord, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "UpdateCustomObjectRecord", arg0, arg1, arg2, arg3) + ret := m.ctrl.Call(m, "UpdateCustomObjectRecord", ctx, customObjectKey, customObjectRecordID, record) ret0, _ := ret[0].(*zendesk.CustomObjectRecord) ret1, _ := ret[1].(error) return ret0, ret1 } // UpdateCustomObjectRecord indicates an expected call of UpdateCustomObjectRecord. -func (mr *ClientMockRecorder) UpdateCustomObjectRecord(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) UpdateCustomObjectRecord(ctx, customObjectKey, customObjectRecordID, record any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateCustomObjectRecord", reflect.TypeOf((*Client)(nil).UpdateCustomObjectRecord), arg0, arg1, arg2, arg3) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateCustomObjectRecord", reflect.TypeOf((*Client)(nil).UpdateCustomObjectRecord), ctx, customObjectKey, customObjectRecordID, record) } // UpdateDynamicContentItem mocks base method. -func (m *Client) UpdateDynamicContentItem(arg0 context.Context, arg1 int64, arg2 zendesk.DynamicContentItem) (zendesk.DynamicContentItem, error) { +func (m *Client) UpdateDynamicContentItem(ctx context.Context, id int64, item zendesk.DynamicContentItem) (zendesk.DynamicContentItem, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "UpdateDynamicContentItem", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "UpdateDynamicContentItem", ctx, id, item) ret0, _ := ret[0].(zendesk.DynamicContentItem) ret1, _ := ret[1].(error) return ret0, ret1 } // UpdateDynamicContentItem indicates an expected call of UpdateDynamicContentItem. -func (mr *ClientMockRecorder) UpdateDynamicContentItem(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) UpdateDynamicContentItem(ctx, id, item any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateDynamicContentItem", reflect.TypeOf((*Client)(nil).UpdateDynamicContentItem), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateDynamicContentItem", reflect.TypeOf((*Client)(nil).UpdateDynamicContentItem), ctx, id, item) } // UpdateGroup mocks base method. -func (m *Client) UpdateGroup(arg0 context.Context, arg1 int64, arg2 zendesk.Group) (zendesk.Group, error) { +func (m *Client) UpdateGroup(ctx context.Context, groupID int64, group zendesk.Group) (zendesk.Group, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "UpdateGroup", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "UpdateGroup", ctx, groupID, group) ret0, _ := ret[0].(zendesk.Group) ret1, _ := ret[1].(error) return ret0, ret1 } // UpdateGroup indicates an expected call of UpdateGroup. -func (mr *ClientMockRecorder) UpdateGroup(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) UpdateGroup(ctx, groupID, group any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateGroup", reflect.TypeOf((*Client)(nil).UpdateGroup), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateGroup", reflect.TypeOf((*Client)(nil).UpdateGroup), ctx, groupID, group) } // UpdateMacro mocks base method. -func (m *Client) UpdateMacro(arg0 context.Context, arg1 int64, arg2 zendesk.Macro) (zendesk.Macro, error) { +func (m *Client) UpdateMacro(ctx context.Context, macroID int64, macro zendesk.Macro) (zendesk.Macro, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "UpdateMacro", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "UpdateMacro", ctx, macroID, macro) ret0, _ := ret[0].(zendesk.Macro) ret1, _ := ret[1].(error) return ret0, ret1 } // UpdateMacro indicates an expected call of UpdateMacro. -func (mr *ClientMockRecorder) UpdateMacro(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) UpdateMacro(ctx, macroID, macro any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateMacro", reflect.TypeOf((*Client)(nil).UpdateMacro), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateMacro", reflect.TypeOf((*Client)(nil).UpdateMacro), ctx, macroID, macro) } // UpdateOrganization mocks base method. -func (m *Client) UpdateOrganization(arg0 context.Context, arg1 int64, arg2 zendesk.Organization) (zendesk.Organization, error) { +func (m *Client) UpdateOrganization(ctx context.Context, orgID int64, org zendesk.Organization) (zendesk.Organization, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "UpdateOrganization", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "UpdateOrganization", ctx, orgID, org) ret0, _ := ret[0].(zendesk.Organization) ret1, _ := ret[1].(error) return ret0, ret1 } // UpdateOrganization indicates an expected call of UpdateOrganization. -func (mr *ClientMockRecorder) UpdateOrganization(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) UpdateOrganization(ctx, orgID, org any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateOrganization", reflect.TypeOf((*Client)(nil).UpdateOrganization), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateOrganization", reflect.TypeOf((*Client)(nil).UpdateOrganization), ctx, orgID, org) } // UpdateSLAPolicy mocks base method. -func (m *Client) UpdateSLAPolicy(arg0 context.Context, arg1 int64, arg2 zendesk.SLAPolicy) (zendesk.SLAPolicy, error) { +func (m *Client) UpdateSLAPolicy(ctx context.Context, id int64, slaPolicy zendesk.SLAPolicy) (zendesk.SLAPolicy, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "UpdateSLAPolicy", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "UpdateSLAPolicy", ctx, id, slaPolicy) ret0, _ := ret[0].(zendesk.SLAPolicy) ret1, _ := ret[1].(error) return ret0, ret1 } // UpdateSLAPolicy indicates an expected call of UpdateSLAPolicy. -func (mr *ClientMockRecorder) UpdateSLAPolicy(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) UpdateSLAPolicy(ctx, id, slaPolicy any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateSLAPolicy", reflect.TypeOf((*Client)(nil).UpdateSLAPolicy), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateSLAPolicy", reflect.TypeOf((*Client)(nil).UpdateSLAPolicy), ctx, id, slaPolicy) } // UpdateTarget mocks base method. -func (m *Client) UpdateTarget(arg0 context.Context, arg1 int64, arg2 zendesk.Target) (zendesk.Target, error) { +func (m *Client) UpdateTarget(ctx context.Context, ticketID int64, field zendesk.Target) (zendesk.Target, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "UpdateTarget", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "UpdateTarget", ctx, ticketID, field) ret0, _ := ret[0].(zendesk.Target) ret1, _ := ret[1].(error) return ret0, ret1 } // UpdateTarget indicates an expected call of UpdateTarget. -func (mr *ClientMockRecorder) UpdateTarget(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) UpdateTarget(ctx, ticketID, field any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateTarget", reflect.TypeOf((*Client)(nil).UpdateTarget), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateTarget", reflect.TypeOf((*Client)(nil).UpdateTarget), ctx, ticketID, field) } // UpdateTicket mocks base method. -func (m *Client) UpdateTicket(arg0 context.Context, arg1 int64, arg2 zendesk.Ticket) (zendesk.Ticket, error) { +func (m *Client) UpdateTicket(ctx context.Context, ticketID int64, ticket zendesk.Ticket) (zendesk.Ticket, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "UpdateTicket", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "UpdateTicket", ctx, ticketID, ticket) ret0, _ := ret[0].(zendesk.Ticket) ret1, _ := ret[1].(error) return ret0, ret1 } // UpdateTicket indicates an expected call of UpdateTicket. -func (mr *ClientMockRecorder) UpdateTicket(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) UpdateTicket(ctx, ticketID, ticket any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateTicket", reflect.TypeOf((*Client)(nil).UpdateTicket), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateTicket", reflect.TypeOf((*Client)(nil).UpdateTicket), ctx, ticketID, ticket) } // UpdateTicketField mocks base method. -func (m *Client) UpdateTicketField(arg0 context.Context, arg1 int64, arg2 zendesk.TicketField) (zendesk.TicketField, error) { +func (m *Client) UpdateTicketField(ctx context.Context, ticketID int64, field zendesk.TicketField) (zendesk.TicketField, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "UpdateTicketField", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "UpdateTicketField", ctx, ticketID, field) ret0, _ := ret[0].(zendesk.TicketField) ret1, _ := ret[1].(error) return ret0, ret1 } // UpdateTicketField indicates an expected call of UpdateTicketField. -func (mr *ClientMockRecorder) UpdateTicketField(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) UpdateTicketField(ctx, ticketID, field any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateTicketField", reflect.TypeOf((*Client)(nil).UpdateTicketField), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateTicketField", reflect.TypeOf((*Client)(nil).UpdateTicketField), ctx, ticketID, field) } // UpdateTicketForm mocks base method. -func (m *Client) UpdateTicketForm(arg0 context.Context, arg1 int64, arg2 zendesk.TicketForm) (zendesk.TicketForm, error) { +func (m *Client) UpdateTicketForm(ctx context.Context, id int64, form zendesk.TicketForm) (zendesk.TicketForm, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "UpdateTicketForm", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "UpdateTicketForm", ctx, id, form) ret0, _ := ret[0].(zendesk.TicketForm) ret1, _ := ret[1].(error) return ret0, ret1 } // UpdateTicketForm indicates an expected call of UpdateTicketForm. -func (mr *ClientMockRecorder) UpdateTicketForm(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) UpdateTicketForm(ctx, id, form any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateTicketForm", reflect.TypeOf((*Client)(nil).UpdateTicketForm), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateTicketForm", reflect.TypeOf((*Client)(nil).UpdateTicketForm), ctx, id, form) } // UpdateTrigger mocks base method. -func (m *Client) UpdateTrigger(arg0 context.Context, arg1 int64, arg2 zendesk.Trigger) (zendesk.Trigger, error) { +func (m *Client) UpdateTrigger(ctx context.Context, id int64, trigger zendesk.Trigger) (zendesk.Trigger, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "UpdateTrigger", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "UpdateTrigger", ctx, id, trigger) ret0, _ := ret[0].(zendesk.Trigger) ret1, _ := ret[1].(error) return ret0, ret1 } // UpdateTrigger indicates an expected call of UpdateTrigger. -func (mr *ClientMockRecorder) UpdateTrigger(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) UpdateTrigger(ctx, id, trigger any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateTrigger", reflect.TypeOf((*Client)(nil).UpdateTrigger), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateTrigger", reflect.TypeOf((*Client)(nil).UpdateTrigger), ctx, id, trigger) } // UpdateUser mocks base method. -func (m *Client) UpdateUser(arg0 context.Context, arg1 int64, arg2 zendesk.User) (zendesk.User, error) { +func (m *Client) UpdateUser(ctx context.Context, userID int64, user zendesk.User) (zendesk.User, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "UpdateUser", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "UpdateUser", ctx, userID, user) ret0, _ := ret[0].(zendesk.User) ret1, _ := ret[1].(error) return ret0, ret1 } // UpdateUser indicates an expected call of UpdateUser. -func (mr *ClientMockRecorder) UpdateUser(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) UpdateUser(ctx, userID, user any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateUser", reflect.TypeOf((*Client)(nil).UpdateUser), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateUser", reflect.TypeOf((*Client)(nil).UpdateUser), ctx, userID, user) } // UpdateWebhook mocks base method. -func (m *Client) UpdateWebhook(arg0 context.Context, arg1 string, arg2 *zendesk.Webhook) error { +func (m *Client) UpdateWebhook(ctx context.Context, webhookID string, hook *zendesk.Webhook) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "UpdateWebhook", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "UpdateWebhook", ctx, webhookID, hook) ret0, _ := ret[0].(error) return ret0 } // UpdateWebhook indicates an expected call of UpdateWebhook. -func (mr *ClientMockRecorder) UpdateWebhook(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) UpdateWebhook(ctx, webhookID, hook any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateWebhook", reflect.TypeOf((*Client)(nil).UpdateWebhook), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateWebhook", reflect.TypeOf((*Client)(nil).UpdateWebhook), ctx, webhookID, hook) } // UploadAttachment mocks base method. -func (m *Client) UploadAttachment(arg0 context.Context, arg1, arg2 string) zendesk.UploadWriter { +func (m *Client) UploadAttachment(ctx context.Context, filename, token string) zendesk.UploadWriter { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "UploadAttachment", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "UploadAttachment", ctx, filename, token) ret0, _ := ret[0].(zendesk.UploadWriter) return ret0 } // UploadAttachment indicates an expected call of UploadAttachment. -func (mr *ClientMockRecorder) UploadAttachment(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *ClientMockRecorder) UploadAttachment(ctx, filename, token any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UploadAttachment", reflect.TypeOf((*Client)(nil).UploadAttachment), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UploadAttachment", reflect.TypeOf((*Client)(nil).UploadAttachment), ctx, filename, token) } diff --git a/zendesk/organization.go b/zendesk/organization.go index 66da2e9e..d09bb60c 100644 --- a/zendesk/organization.go +++ b/zendesk/organization.go @@ -41,6 +41,9 @@ type OrganizationAPI interface { GetOrganizationByExternalID(ctx context.Context, externalID string) ([]Organization, Page, error) UpdateOrganization(ctx context.Context, orgID int64, org Organization) (Organization, error) DeleteOrganization(ctx context.Context, orgID int64) error + GetOrganizationsIterator(ctx context.Context, opts *PaginationOptions) *Iterator[Organization] + GetOrganizationsOBP(ctx context.Context, opts *OBPOptions) ([]Organization, Page, error) + GetOrganizationsCBP(ctx context.Context, opts *CBPOptions) ([]Organization, CursorPaginationMeta, error) } // GetOrganizations fetch organization list diff --git a/zendesk/organization_field.go b/zendesk/organization_field.go index e9ba15b3..af8db4cc 100644 --- a/zendesk/organization_field.go +++ b/zendesk/organization_field.go @@ -32,6 +32,9 @@ type OrganizationField struct { type OrganizationFieldAPI interface { GetOrganizationFields(ctx context.Context) ([]OrganizationField, Page, error) CreateOrganizationField(ctx context.Context, organizationField OrganizationField) (OrganizationField, error) + GetOrganizationFieldsIterator(ctx context.Context, opts *PaginationOptions) *Iterator[OrganizationField] + GetOrganizationFieldsOBP(ctx context.Context, opts *OBPOptions) ([]OrganizationField, Page, error) + GetOrganizationFieldsCBP(ctx context.Context, opts *CBPOptions) ([]OrganizationField, CursorPaginationMeta, error) } // GetOrganizationFields fetches organization field list diff --git a/zendesk/organization_field_generated.go b/zendesk/organization_field_generated.go new file mode 100644 index 00000000..149847fd --- /dev/null +++ b/zendesk/organization_field_generated.go @@ -0,0 +1,74 @@ + +// Code generated by Script. DO NOT EDIT. +// Source: script/codegen/main.go +// +// Generated by this command: +// +// go run script/codegen/main.go + +package zendesk + +import "context" + +func (z *Client) GetOrganizationFieldsIterator(ctx context.Context, opts *PaginationOptions) *Iterator[OrganizationField] { + return &Iterator[OrganizationField]{ + CommonOptions: opts.CommonOptions, + pageSize: opts.PageSize, + hasMore: true, + isCBP: opts.IsCBP, + pageAfter: "", + pageIndex: 1, + ctx: ctx, + obpFunc: z.GetOrganizationFieldsOBP, + cbpFunc: z.GetOrganizationFieldsCBP, + } +} + +func (z *Client) GetOrganizationFieldsOBP(ctx context.Context, opts *OBPOptions) ([]OrganizationField, Page, error) { + var data struct { + OrganizationFields []OrganizationField `json:"organization_fields"` + Page + } + + tmp := opts + if tmp == nil { + tmp = &OBPOptions{} + } + + u, err := addOptions("/organization_fields.json", tmp) + + if err != nil { + return nil, Page{}, err + } + + err = getData(z, ctx, u, &data) + if err != nil { + return nil, Page{}, err + } + return data.OrganizationFields, data.Page, nil +} + +func (z *Client) GetOrganizationFieldsCBP(ctx context.Context, opts *CBPOptions) ([]OrganizationField, CursorPaginationMeta, error) { + var data struct { + OrganizationFields []OrganizationField `json:"organization_fields"` + Meta CursorPaginationMeta `json:"meta"` + } + + tmp := opts + if tmp == nil { + tmp = &CBPOptions{} + } + + u, err := addOptions("/organization_fields.json", tmp) + + if err != nil { + return nil, data.Meta, err + } + + err = getData(z, ctx, u, &data) + if err != nil { + return nil, data.Meta, err + } + return data.OrganizationFields, data.Meta, nil +} + diff --git a/zendesk/organization_generated.go b/zendesk/organization_generated.go new file mode 100644 index 00000000..127ee5b1 --- /dev/null +++ b/zendesk/organization_generated.go @@ -0,0 +1,74 @@ + +// Code generated by Script. DO NOT EDIT. +// Source: script/codegen/main.go +// +// Generated by this command: +// +// go run script/codegen/main.go + +package zendesk + +import "context" + +func (z *Client) GetOrganizationsIterator(ctx context.Context, opts *PaginationOptions) *Iterator[Organization] { + return &Iterator[Organization]{ + CommonOptions: opts.CommonOptions, + pageSize: opts.PageSize, + hasMore: true, + isCBP: opts.IsCBP, + pageAfter: "", + pageIndex: 1, + ctx: ctx, + obpFunc: z.GetOrganizationsOBP, + cbpFunc: z.GetOrganizationsCBP, + } +} + +func (z *Client) GetOrganizationsOBP(ctx context.Context, opts *OBPOptions) ([]Organization, Page, error) { + var data struct { + Organizations []Organization `json:"organizations"` + Page + } + + tmp := opts + if tmp == nil { + tmp = &OBPOptions{} + } + + u, err := addOptions("/organizations.json", tmp) + + if err != nil { + return nil, Page{}, err + } + + err = getData(z, ctx, u, &data) + if err != nil { + return nil, Page{}, err + } + return data.Organizations, data.Page, nil +} + +func (z *Client) GetOrganizationsCBP(ctx context.Context, opts *CBPOptions) ([]Organization, CursorPaginationMeta, error) { + var data struct { + Organizations []Organization `json:"organizations"` + Meta CursorPaginationMeta `json:"meta"` + } + + tmp := opts + if tmp == nil { + tmp = &CBPOptions{} + } + + u, err := addOptions("/organizations.json", tmp) + + if err != nil { + return nil, data.Meta, err + } + + err = getData(z, ctx, u, &data) + if err != nil { + return nil, data.Meta, err + } + return data.Organizations, data.Meta, nil +} + diff --git a/zendesk/organization_membership.go b/zendesk/organization_membership.go index 4f657cc0..24f69802 100644 --- a/zendesk/organization_membership.go +++ b/zendesk/organization_membership.go @@ -41,6 +41,9 @@ type ( GetOrganizationMemberships(context.Context, *OrganizationMembershipListOptions) ([]OrganizationMembership, Page, error) CreateOrganizationMembership(context.Context, OrganizationMembershipOptions) (OrganizationMembership, error) SetDefaultOrganization(context.Context, OrganizationMembershipOptions) (OrganizationMembership, error) + GetOrganizationMembershipsIterator(ctx context.Context, opts *PaginationOptions) *Iterator[OrganizationMembership] + GetOrganizationMembershipsOBP(ctx context.Context, opts *OBPOptions) ([]OrganizationMembership, Page, error) + GetOrganizationMembershipsCBP(ctx context.Context, opts *CBPOptions) ([]OrganizationMembership, CursorPaginationMeta, error) } ) diff --git a/zendesk/organization_membership_generated.go b/zendesk/organization_membership_generated.go new file mode 100644 index 00000000..2e6f60a7 --- /dev/null +++ b/zendesk/organization_membership_generated.go @@ -0,0 +1,74 @@ + +// Code generated by Script. DO NOT EDIT. +// Source: script/codegen/main.go +// +// Generated by this command: +// +// go run script/codegen/main.go + +package zendesk + +import "context" + +func (z *Client) GetOrganizationMembershipsIterator(ctx context.Context, opts *PaginationOptions) *Iterator[OrganizationMembership] { + return &Iterator[OrganizationMembership]{ + CommonOptions: opts.CommonOptions, + pageSize: opts.PageSize, + hasMore: true, + isCBP: opts.IsCBP, + pageAfter: "", + pageIndex: 1, + ctx: ctx, + obpFunc: z.GetOrganizationMembershipsOBP, + cbpFunc: z.GetOrganizationMembershipsCBP, + } +} + +func (z *Client) GetOrganizationMembershipsOBP(ctx context.Context, opts *OBPOptions) ([]OrganizationMembership, Page, error) { + var data struct { + OrganizationMemberships []OrganizationMembership `json:"organization_memberships"` + Page + } + + tmp := opts + if tmp == nil { + tmp = &OBPOptions{} + } + + u, err := addOptions("/organization_memberships.json", tmp) + + if err != nil { + return nil, Page{}, err + } + + err = getData(z, ctx, u, &data) + if err != nil { + return nil, Page{}, err + } + return data.OrganizationMemberships, data.Page, nil +} + +func (z *Client) GetOrganizationMembershipsCBP(ctx context.Context, opts *CBPOptions) ([]OrganizationMembership, CursorPaginationMeta, error) { + var data struct { + OrganizationMemberships []OrganizationMembership `json:"organization_memberships"` + Meta CursorPaginationMeta `json:"meta"` + } + + tmp := opts + if tmp == nil { + tmp = &CBPOptions{} + } + + u, err := addOptions("/organization_memberships.json", tmp) + + if err != nil { + return nil, data.Meta, err + } + + err = getData(z, ctx, u, &data) + if err != nil { + return nil, data.Meta, err + } + return data.OrganizationMemberships, data.Meta, nil +} + diff --git a/zendesk/organization_tickets_generated.go b/zendesk/organization_tickets_generated.go new file mode 100644 index 00000000..090cf73f --- /dev/null +++ b/zendesk/organization_tickets_generated.go @@ -0,0 +1,79 @@ + +// Code generated by Script. DO NOT EDIT. +// Source: script/codegen/main.go +// +// Generated by this command: +// +// go run script/codegen/main.go + +package zendesk + +import ( + "context" + "fmt" +) + +func (z *Client) GetOrganizationTicketsIterator(ctx context.Context, opts *PaginationOptions) *Iterator[Ticket] { + return &Iterator[Ticket]{ + CommonOptions: opts.CommonOptions, + pageSize: opts.PageSize, + hasMore: true, + isCBP: opts.IsCBP, + pageAfter: "", + pageIndex: 1, + ctx: ctx, + obpFunc: z.GetOrganizationTicketsOBP, + cbpFunc: z.GetOrganizationTicketsCBP, + } +} + +func (z *Client) GetOrganizationTicketsOBP(ctx context.Context, opts *OBPOptions) ([]Ticket, Page, error) { + var data struct { + Tickets []Ticket `json:"tickets"` + Page + } + + tmp := opts + if tmp == nil { + tmp = &OBPOptions{} + } + + path := fmt.Sprintf("/organizations/%d/tickets.json", tmp.Id) + u, err := addOptions(path, tmp) + + if err != nil { + return nil, Page{}, err + } + + err = getData(z, ctx, u, &data) + if err != nil { + return nil, Page{}, err + } + return data.Tickets, data.Page, nil +} + +func (z *Client) GetOrganizationTicketsCBP(ctx context.Context, opts *CBPOptions) ([]Ticket, CursorPaginationMeta, error) { + var data struct { + Tickets []Ticket `json:"tickets"` + Meta CursorPaginationMeta `json:"meta"` + } + + tmp := opts + if tmp == nil { + tmp = &CBPOptions{} + } + + path := fmt.Sprintf("/organizations/%d/tickets.json", tmp.Id) + u, err := addOptions(path, tmp) + + if err != nil { + return nil, data.Meta, err + } + + err = getData(z, ctx, u, &data) + if err != nil { + return nil, data.Meta, err + } + return data.Tickets, data.Meta, nil +} + diff --git a/zendesk/organization_users_generated.go b/zendesk/organization_users_generated.go new file mode 100644 index 00000000..e9461d6c --- /dev/null +++ b/zendesk/organization_users_generated.go @@ -0,0 +1,79 @@ + +// Code generated by Script. DO NOT EDIT. +// Source: script/codegen/main.go +// +// Generated by this command: +// +// go run script/codegen/main.go + +package zendesk + +import ( + "context" + "fmt" +) + +func (z *Client) GetOrganizationUsersIterator(ctx context.Context, opts *PaginationOptions) *Iterator[User] { + return &Iterator[User]{ + CommonOptions: opts.CommonOptions, + pageSize: opts.PageSize, + hasMore: true, + isCBP: opts.IsCBP, + pageAfter: "", + pageIndex: 1, + ctx: ctx, + obpFunc: z.GetOrganizationUsersOBP, + cbpFunc: z.GetOrganizationUsersCBP, + } +} + +func (z *Client) GetOrganizationUsersOBP(ctx context.Context, opts *OBPOptions) ([]User, Page, error) { + var data struct { + Users []User `json:"users"` + Page + } + + tmp := opts + if tmp == nil { + tmp = &OBPOptions{} + } + + path := fmt.Sprintf("/organizations/%d/users.json", tmp.Id) + u, err := addOptions(path, tmp) + + if err != nil { + return nil, Page{}, err + } + + err = getData(z, ctx, u, &data) + if err != nil { + return nil, Page{}, err + } + return data.Users, data.Page, nil +} + +func (z *Client) GetOrganizationUsersCBP(ctx context.Context, opts *CBPOptions) ([]User, CursorPaginationMeta, error) { + var data struct { + Users []User `json:"users"` + Meta CursorPaginationMeta `json:"meta"` + } + + tmp := opts + if tmp == nil { + tmp = &CBPOptions{} + } + + path := fmt.Sprintf("/organizations/%d/users.json", tmp.Id) + u, err := addOptions(path, tmp) + + if err != nil { + return nil, data.Meta, err + } + + err = getData(z, ctx, u, &data) + if err != nil { + return nil, data.Meta, err + } + return data.Users, data.Meta, nil +} + diff --git a/zendesk/search.go b/zendesk/search.go index 576316de..92497301 100644 --- a/zendesk/search.go +++ b/zendesk/search.go @@ -26,6 +26,9 @@ type CountOptions struct { type SearchAPI interface { Search(ctx context.Context, opts *SearchOptions) (SearchResults, Page, error) SearchCount(ctx context.Context, opts *CountOptions) (int, error) + GetSearchIterator(ctx context.Context, opts *PaginationOptions) *Iterator[SearchResults] + GetSearchOBP(ctx context.Context, opts *OBPOptions) ([]SearchResults, Page, error) + GetSearchCBP(ctx context.Context, opts *CBPOptions) ([]SearchResults, CursorPaginationMeta, error) } type SearchResults struct { diff --git a/zendesk/search_generated.go b/zendesk/search_generated.go new file mode 100644 index 00000000..aadb00fd --- /dev/null +++ b/zendesk/search_generated.go @@ -0,0 +1,74 @@ + +// Code generated by Script. DO NOT EDIT. +// Source: script/codegen/main.go +// +// Generated by this command: +// +// go run script/codegen/main.go + +package zendesk + +import "context" + +func (z *Client) GetSearchIterator(ctx context.Context, opts *PaginationOptions) *Iterator[SearchResults] { + return &Iterator[SearchResults]{ + CommonOptions: opts.CommonOptions, + pageSize: opts.PageSize, + hasMore: true, + isCBP: opts.IsCBP, + pageAfter: "", + pageIndex: 1, + ctx: ctx, + obpFunc: z.GetSearchOBP, + cbpFunc: z.GetSearchCBP, + } +} + +func (z *Client) GetSearchOBP(ctx context.Context, opts *OBPOptions) ([]SearchResults, Page, error) { + var data struct { + SearchResultss []SearchResults `json:"results"` + Page + } + + tmp := opts + if tmp == nil { + tmp = &OBPOptions{} + } + + u, err := addOptions("/search.json", tmp) + + if err != nil { + return nil, Page{}, err + } + + err = getData(z, ctx, u, &data) + if err != nil { + return nil, Page{}, err + } + return data.SearchResultss, data.Page, nil +} + +func (z *Client) GetSearchCBP(ctx context.Context, opts *CBPOptions) ([]SearchResults, CursorPaginationMeta, error) { + var data struct { + SearchResultss []SearchResults `json:"results"` + Meta CursorPaginationMeta `json:"meta"` + } + + tmp := opts + if tmp == nil { + tmp = &CBPOptions{} + } + + u, err := addOptions("/search.json", tmp) + + if err != nil { + return nil, data.Meta, err + } + + err = getData(z, ctx, u, &data) + if err != nil { + return nil, data.Meta, err + } + return data.SearchResultss, data.Meta, nil +} + diff --git a/zendesk/sla_policy.go b/zendesk/sla_policy.go index ed4c9464..a5dd2124 100644 --- a/zendesk/sla_policy.go +++ b/zendesk/sla_policy.go @@ -70,6 +70,9 @@ type SLAPolicyAPI interface { GetSLAPolicy(ctx context.Context, id int64) (SLAPolicy, error) UpdateSLAPolicy(ctx context.Context, id int64, slaPolicy SLAPolicy) (SLAPolicy, error) DeleteSLAPolicy(ctx context.Context, id int64) error + GetSLAPoliciesIterator(ctx context.Context, opts *PaginationOptions) *Iterator[SLAPolicy] + GetSLAPoliciesOBP(ctx context.Context, opts *OBPOptions) ([]SLAPolicy, Page, error) + GetSLAPoliciesCBP(ctx context.Context, opts *CBPOptions) ([]SLAPolicy, CursorPaginationMeta, error) } // GetSLAPolicies fetch slaPolicy list diff --git a/zendesk/sla_policy_generated.go b/zendesk/sla_policy_generated.go new file mode 100644 index 00000000..d2c973a3 --- /dev/null +++ b/zendesk/sla_policy_generated.go @@ -0,0 +1,74 @@ + +// Code generated by Script. DO NOT EDIT. +// Source: script/codegen/main.go +// +// Generated by this command: +// +// go run script/codegen/main.go + +package zendesk + +import "context" + +func (z *Client) GetSLAPoliciesIterator(ctx context.Context, opts *PaginationOptions) *Iterator[SLAPolicy] { + return &Iterator[SLAPolicy]{ + CommonOptions: opts.CommonOptions, + pageSize: opts.PageSize, + hasMore: true, + isCBP: opts.IsCBP, + pageAfter: "", + pageIndex: 1, + ctx: ctx, + obpFunc: z.GetSLAPoliciesOBP, + cbpFunc: z.GetSLAPoliciesCBP, + } +} + +func (z *Client) GetSLAPoliciesOBP(ctx context.Context, opts *OBPOptions) ([]SLAPolicy, Page, error) { + var data struct { + SLAPolicys []SLAPolicy `json:"sla_policies"` + Page + } + + tmp := opts + if tmp == nil { + tmp = &OBPOptions{} + } + + u, err := addOptions("/slas/policies.json", tmp) + + if err != nil { + return nil, Page{}, err + } + + err = getData(z, ctx, u, &data) + if err != nil { + return nil, Page{}, err + } + return data.SLAPolicys, data.Page, nil +} + +func (z *Client) GetSLAPoliciesCBP(ctx context.Context, opts *CBPOptions) ([]SLAPolicy, CursorPaginationMeta, error) { + var data struct { + SLAPolicys []SLAPolicy `json:"sla_policies"` + Meta CursorPaginationMeta `json:"meta"` + } + + tmp := opts + if tmp == nil { + tmp = &CBPOptions{} + } + + u, err := addOptions("/slas/policies.json", tmp) + + if err != nil { + return nil, data.Meta, err + } + + err = getData(z, ctx, u, &data) + if err != nil { + return nil, data.Meta, err + } + return data.SLAPolicys, data.Meta, nil +} + diff --git a/zendesk/ticket.go b/zendesk/ticket.go index 6aa6f9a0..2d70dc67 100644 --- a/zendesk/ticket.go +++ b/zendesk/ticket.go @@ -63,7 +63,7 @@ type Ticket struct { SubmitterID int64 `json:"submitter_id,omitempty"` AssigneeID int64 `json:"assignee_id,omitempty"` OrganizationID int64 `json:"organization_id,omitempty"` - GroupID int64 `json:"group_id,omitempty"` + GroupID json.Number `json:"group_id,omitempty"` CollaboratorIDs []int64 `json:"collaborator_ids,omitempty"` FollowerIDs []int64 `json:"follower_ids,omitempty"` EmailCCIDs []int64 `json:"email_cc_ids,omitempty"` @@ -143,120 +143,22 @@ type TicketListOptions struct { SortOrder string `url:"sort_order,omitempty"` } -// TicketListCBPOptions struct is used to specify options for listing tickets in CBP (Cursor Based Pagination). -// It embeds the CursorPagination struct for pagination and provides an option Sort for sorting the result. -type TicketListCBPOptions struct { - CursorPagination - Sort string `url:"sort,omitempty"` -} - // TicketListCBPResult struct represents the result of a ticket list operation in CBP. It includes an array of Ticket objects, and Meta that holds pagination metadata. type TicketListCBPResult struct { Tickets []Ticket `json:"tickets"` Meta CursorPaginationMeta `json:"meta"` } -// PaginationOptions struct represents general pagination options. -// PageSize specifies the number of items per page, IsCBP indicates if it's cursor-based pagination, -// SortBy and SortOrder describe how to sort the items in Offset Based Pagination, and Sort describes how to sort items in Cursor Based Pagination. -type PaginationOptions struct { - PageSize int //default is 100 - IsCBP bool //default is true - - SortBy string - // SortOrder can take "asc" or "desc" - SortOrder string - Sort string -} - -// NewPaginationOptions() returns a pointer to a new PaginationOptions struct with default values (PageSize is 100, IsCBP is true). -func NewPaginationOptions() *PaginationOptions { - return &PaginationOptions{ - PageSize: 100, - IsCBP: true, - } -} - -// TicketIterator struct provides a convenient way to iterate over pages of tickets in either OBP or CBP. -// It holds state for iteration, including the current page size, a flag indicating more pages, pagination type (OBP or CBP), and sorting options. -type TicketIterator struct { - // generic fields - pageSize int - hasMore bool - isCBP bool - - // OBP fields - sortBy string - // SortOrder can take "asc" or "desc" - sortOrder string - pageIndex int - - // CBP fields - sort string - pageAfter string - - // common fields - client *Client - ctx context.Context -} - -// HasMore() returns a boolean indicating whether more pages are available for iteration. -func (i *TicketIterator) HasMore() bool { - return i.hasMore -} - -// GetNext() retrieves the next batch of tickets according to the current pagination and sorting options. -// It updates the state of the iterator for subsequent calls. -// In case of an error, it sets hasMore to false and returns an error. -func (i *TicketIterator) GetNext() ([]Ticket, error) { - if i.isCBP { - cbpOps := &TicketListCBPOptions{ - CursorPagination: CursorPagination{ - PageSize: i.pageSize, - PageAfter: i.pageAfter, - }, - } - if i.sort != "" { - cbpOps.Sort = i.sort - } - ticketListCBPResult, err := i.client.GetTicketsCBP(i.ctx, cbpOps) - if err != nil { - i.hasMore = false - return nil, err - } - i.hasMore = ticketListCBPResult.Meta.HasMore - i.pageAfter = ticketListCBPResult.Meta.AfterCursor - return ticketListCBPResult.Tickets, nil - } else { - obpOps := &TicketListOptions{ - PageOptions: PageOptions{ - PerPage: i.pageSize, - Page: i.pageIndex, - }, - } - if i.sortBy != "" { - obpOps.SortBy = i.sortBy - } - if i.sortOrder != "" { - obpOps.SortOrder = i.sortOrder - } - tickets, page, err := i.client.GetTickets(i.ctx, obpOps) - if err != nil { - i.hasMore = false - return nil, err - } - i.hasMore = page.HasNext() - i.pageIndex++ - return tickets, nil - } -} - // TicketAPI an interface containing all ticket related methods type TicketAPI interface { - GetTicketsEx(ctx context.Context, opts *PaginationOptions) *TicketIterator + GetTicketsIterator(ctx context.Context, opts *PaginationOptions) *Iterator[Ticket] GetTickets(ctx context.Context, opts *TicketListOptions) ([]Ticket, Page, error) - GetTicketsCBP(ctx context.Context, opts *TicketListCBPOptions) (*TicketListCBPResult, error) + GetTicketsOBP(ctx context.Context, opts *OBPOptions) ([]Ticket, Page, error) + GetTicketsCBP(ctx context.Context, opts *CBPOptions) ([]Ticket, CursorPaginationMeta, error) GetOrganizationTickets(ctx context.Context, organizationID int64, ops *TicketListOptions) ([]Ticket, Page, error) + GetOrganizationTicketsOBP(ctx context.Context, opts *OBPOptions) ([]Ticket, Page, error) + GetOrganizationTicketsCBP(ctx context.Context, opts *CBPOptions) ([]Ticket, CursorPaginationMeta, error) + GetOrganizationTicketsIterator(ctx context.Context, opts *PaginationOptions) *Iterator[Ticket] GetTicket(ctx context.Context, id int64) (Ticket, error) GetMultipleTickets(ctx context.Context, ticketIDs []int64) ([]Ticket, error) CreateTicket(ctx context.Context, ticket Ticket) (Ticket, error) @@ -264,24 +166,6 @@ type TicketAPI interface { DeleteTicket(ctx context.Context, ticketID int64) error } -// GetTicketsEx returns a TicketIterator to iterate over tickets -// -// ref: https://developer.zendesk.com/rest_api/docs/support/tickets#list-tickets -func (z *Client) GetTicketsEx(ctx context.Context, opts *PaginationOptions) *TicketIterator { - return &TicketIterator{ - pageSize: opts.PageSize, - hasMore: true, - isCBP: opts.IsCBP, - sort: opts.Sort, - pageAfter: "", - sortOrder: opts.SortOrder, - sortBy: opts.SortBy, - pageIndex: 1, - client: z, - ctx: ctx, - } -} - // GetTickets get ticket list with offset based pagination // // ref: https://developer.zendesk.com/rest_api/docs/support/tickets#list-tickets @@ -313,33 +197,6 @@ func (z *Client) GetTickets(ctx context.Context, opts *TicketListOptions) ([]Tic return data.Tickets, data.Page, nil } -// GetTicketsCBP get ticket list with cursor based pagination -// -// ref: https://developer.zendesk.com/rest_api/docs/support/tickets#list-tickets -func (z *Client) GetTicketsCBP(ctx context.Context, opts *TicketListCBPOptions) (*TicketListCBPResult, error) { - var data TicketListCBPResult - - tmp := opts - if tmp == nil { - tmp = &TicketListCBPOptions{} - } - - u, err := addOptions("/tickets.json", tmp) - if err != nil { - return nil, err - } - - body, err := z.get(ctx, u) - if err != nil { - return nil, err - } - - err = json.Unmarshal(body, &data) - if err != nil { - return nil, err - } - return &data, nil -} // GetOrganizationTickets get organization ticket list // @@ -363,12 +220,7 @@ func (z *Client) GetOrganizationTickets( return nil, Page{}, err } - body, err := z.get(ctx, u) - if err != nil { - return nil, Page{}, err - } - - err = json.Unmarshal(body, &data) + err = getData(z, ctx, u, &data) if err != nil { return nil, Page{}, err } diff --git a/zendesk/ticket_audit.go b/zendesk/ticket_audit.go index cb661ba5..01bdb582 100644 --- a/zendesk/ticket_audit.go +++ b/zendesk/ticket_audit.go @@ -33,6 +33,9 @@ type TicketAuditAPI interface { GetAllTicketAudits(ctx context.Context, opts CursorOption) ([]TicketAudit, Cursor, error) GetTicketAudits(ctx context.Context, ticketID int64, opts PageOptions) ([]TicketAudit, Page, error) GetTicketAudit(ctx context.Context, TicketID, ID int64) (TicketAudit, error) + GetTicketAuditsIterator(ctx context.Context, opts *PaginationOptions) *Iterator[TicketAudit] + GetTicketAuditsOBP(ctx context.Context, opts *OBPOptions) ([]TicketAudit, Page, error) + GetTicketAuditsCBP(ctx context.Context, opts *CBPOptions) ([]TicketAudit, CursorPaginationMeta, error) } // GetAllTicketAudits list all ticket audits diff --git a/zendesk/ticket_audit_generated.go b/zendesk/ticket_audit_generated.go new file mode 100644 index 00000000..b76163b3 --- /dev/null +++ b/zendesk/ticket_audit_generated.go @@ -0,0 +1,79 @@ + +// Code generated by Script. DO NOT EDIT. +// Source: script/codegen/main.go +// +// Generated by this command: +// +// go run script/codegen/main.go + +package zendesk + +import ( + "context" + "fmt" +) + +func (z *Client) GetTicketAuditsIterator(ctx context.Context, opts *PaginationOptions) *Iterator[TicketAudit] { + return &Iterator[TicketAudit]{ + CommonOptions: opts.CommonOptions, + pageSize: opts.PageSize, + hasMore: true, + isCBP: opts.IsCBP, + pageAfter: "", + pageIndex: 1, + ctx: ctx, + obpFunc: z.GetTicketAuditsOBP, + cbpFunc: z.GetTicketAuditsCBP, + } +} + +func (z *Client) GetTicketAuditsOBP(ctx context.Context, opts *OBPOptions) ([]TicketAudit, Page, error) { + var data struct { + TicketAudits []TicketAudit `json:"audits"` + Page + } + + tmp := opts + if tmp == nil { + tmp = &OBPOptions{} + } + + path := fmt.Sprintf("/tickets/%d/audits.json", tmp.Id) + u, err := addOptions(path, tmp) + + if err != nil { + return nil, Page{}, err + } + + err = getData(z, ctx, u, &data) + if err != nil { + return nil, Page{}, err + } + return data.TicketAudits, data.Page, nil +} + +func (z *Client) GetTicketAuditsCBP(ctx context.Context, opts *CBPOptions) ([]TicketAudit, CursorPaginationMeta, error) { + var data struct { + TicketAudits []TicketAudit `json:"audits"` + Meta CursorPaginationMeta `json:"meta"` + } + + tmp := opts + if tmp == nil { + tmp = &CBPOptions{} + } + + path := fmt.Sprintf("/tickets/%d/audits.json", tmp.Id) + u, err := addOptions(path, tmp) + + if err != nil { + return nil, data.Meta, err + } + + err = getData(z, ctx, u, &data) + if err != nil { + return nil, data.Meta, err + } + return data.TicketAudits, data.Meta, nil +} + diff --git a/zendesk/ticket_comment.go b/zendesk/ticket_comment.go index 9e4bcc38..8790633a 100644 --- a/zendesk/ticket_comment.go +++ b/zendesk/ticket_comment.go @@ -12,6 +12,9 @@ type TicketCommentAPI interface { CreateTicketComment(ctx context.Context, ticketID int64, ticketComment TicketComment) (TicketComment, error) ListTicketComments(ctx context.Context, ticketID int64, opts *ListTicketCommentsOptions) (*ListTicketCommentsResult, error) MakeCommentPrivate(ctx context.Context, ticketID int64, ticketCommentID int64) error + GetTicketCommentsIterator(ctx context.Context, opts *PaginationOptions) *Iterator[TicketComment] + GetTicketCommentsOBP(ctx context.Context, opts *OBPOptions) ([]TicketComment, Page, error) + GetTicketCommentsCBP(ctx context.Context, opts *CBPOptions) ([]TicketComment, CursorPaginationMeta, error) } // TicketComment is a struct for ticket comment payload diff --git a/zendesk/ticket_comment_generated.go b/zendesk/ticket_comment_generated.go new file mode 100644 index 00000000..647e1d03 --- /dev/null +++ b/zendesk/ticket_comment_generated.go @@ -0,0 +1,79 @@ + +// Code generated by Script. DO NOT EDIT. +// Source: script/codegen/main.go +// +// Generated by this command: +// +// go run script/codegen/main.go + +package zendesk + +import ( + "context" + "fmt" +) + +func (z *Client) GetTicketCommentsIterator(ctx context.Context, opts *PaginationOptions) *Iterator[TicketComment] { + return &Iterator[TicketComment]{ + CommonOptions: opts.CommonOptions, + pageSize: opts.PageSize, + hasMore: true, + isCBP: opts.IsCBP, + pageAfter: "", + pageIndex: 1, + ctx: ctx, + obpFunc: z.GetTicketCommentsOBP, + cbpFunc: z.GetTicketCommentsCBP, + } +} + +func (z *Client) GetTicketCommentsOBP(ctx context.Context, opts *OBPOptions) ([]TicketComment, Page, error) { + var data struct { + TicketComments []TicketComment `json:"comments"` + Page + } + + tmp := opts + if tmp == nil { + tmp = &OBPOptions{} + } + + path := fmt.Sprintf("/tickets/%d/comments.json", tmp.Id) + u, err := addOptions(path, tmp) + + if err != nil { + return nil, Page{}, err + } + + err = getData(z, ctx, u, &data) + if err != nil { + return nil, Page{}, err + } + return data.TicketComments, data.Page, nil +} + +func (z *Client) GetTicketCommentsCBP(ctx context.Context, opts *CBPOptions) ([]TicketComment, CursorPaginationMeta, error) { + var data struct { + TicketComments []TicketComment `json:"comments"` + Meta CursorPaginationMeta `json:"meta"` + } + + tmp := opts + if tmp == nil { + tmp = &CBPOptions{} + } + + path := fmt.Sprintf("/tickets/%d/comments.json", tmp.Id) + u, err := addOptions(path, tmp) + + if err != nil { + return nil, data.Meta, err + } + + err = getData(z, ctx, u, &data) + if err != nil { + return nil, data.Meta, err + } + return data.TicketComments, data.Meta, nil +} + diff --git a/zendesk/ticket_field.go b/zendesk/ticket_field.go index ab66aed8..37a72126 100644 --- a/zendesk/ticket_field.go +++ b/zendesk/ticket_field.go @@ -53,6 +53,9 @@ type TicketFieldAPI interface { GetTicketField(ctx context.Context, ticketID int64) (TicketField, error) UpdateTicketField(ctx context.Context, ticketID int64, field TicketField) (TicketField, error) DeleteTicketField(ctx context.Context, ticketID int64) error + GetTicketFieldsIterator(ctx context.Context, opts *PaginationOptions) *Iterator[TicketField] + GetTicketFieldsOBP(ctx context.Context, opts *OBPOptions) ([]TicketField, Page, error) + GetTicketFieldsCBP(ctx context.Context, opts *CBPOptions) ([]TicketField, CursorPaginationMeta, error) } // GetTicketFields fetches ticket field list diff --git a/zendesk/ticket_field_generated.go b/zendesk/ticket_field_generated.go new file mode 100644 index 00000000..c188ff29 --- /dev/null +++ b/zendesk/ticket_field_generated.go @@ -0,0 +1,74 @@ + +// Code generated by Script. DO NOT EDIT. +// Source: script/codegen/main.go +// +// Generated by this command: +// +// go run script/codegen/main.go + +package zendesk + +import "context" + +func (z *Client) GetTicketFieldsIterator(ctx context.Context, opts *PaginationOptions) *Iterator[TicketField] { + return &Iterator[TicketField]{ + CommonOptions: opts.CommonOptions, + pageSize: opts.PageSize, + hasMore: true, + isCBP: opts.IsCBP, + pageAfter: "", + pageIndex: 1, + ctx: ctx, + obpFunc: z.GetTicketFieldsOBP, + cbpFunc: z.GetTicketFieldsCBP, + } +} + +func (z *Client) GetTicketFieldsOBP(ctx context.Context, opts *OBPOptions) ([]TicketField, Page, error) { + var data struct { + TicketFields []TicketField `json:"ticket_fields"` + Page + } + + tmp := opts + if tmp == nil { + tmp = &OBPOptions{} + } + + u, err := addOptions("/ticket_fields.json", tmp) + + if err != nil { + return nil, Page{}, err + } + + err = getData(z, ctx, u, &data) + if err != nil { + return nil, Page{}, err + } + return data.TicketFields, data.Page, nil +} + +func (z *Client) GetTicketFieldsCBP(ctx context.Context, opts *CBPOptions) ([]TicketField, CursorPaginationMeta, error) { + var data struct { + TicketFields []TicketField `json:"ticket_fields"` + Meta CursorPaginationMeta `json:"meta"` + } + + tmp := opts + if tmp == nil { + tmp = &CBPOptions{} + } + + u, err := addOptions("/ticket_fields.json", tmp) + + if err != nil { + return nil, data.Meta, err + } + + err = getData(z, ctx, u, &data) + if err != nil { + return nil, data.Meta, err + } + return data.TicketFields, data.Meta, nil +} + diff --git a/zendesk/ticket_form.go b/zendesk/ticket_form.go index 209f7ef9..017f288a 100644 --- a/zendesk/ticket_form.go +++ b/zendesk/ticket_form.go @@ -41,6 +41,9 @@ type TicketFormAPI interface { DeleteTicketForm(ctx context.Context, id int64) error UpdateTicketForm(ctx context.Context, id int64, form TicketForm) (TicketForm, error) GetTicketForm(ctx context.Context, id int64) (TicketForm, error) + GetTicketFormsIterator(ctx context.Context, opts *PaginationOptions) *Iterator[TicketForm] + GetTicketFormsOBP(ctx context.Context, opts *OBPOptions) ([]TicketForm, Page, error) + GetTicketFormsCBP(ctx context.Context, opts *CBPOptions) ([]TicketForm, CursorPaginationMeta, error) } // GetTicketForms fetches ticket forms diff --git a/zendesk/ticket_form_generated.go b/zendesk/ticket_form_generated.go new file mode 100644 index 00000000..d193d3ad --- /dev/null +++ b/zendesk/ticket_form_generated.go @@ -0,0 +1,74 @@ + +// Code generated by Script. DO NOT EDIT. +// Source: script/codegen/main.go +// +// Generated by this command: +// +// go run script/codegen/main.go + +package zendesk + +import "context" + +func (z *Client) GetTicketFormsIterator(ctx context.Context, opts *PaginationOptions) *Iterator[TicketForm] { + return &Iterator[TicketForm]{ + CommonOptions: opts.CommonOptions, + pageSize: opts.PageSize, + hasMore: true, + isCBP: opts.IsCBP, + pageAfter: "", + pageIndex: 1, + ctx: ctx, + obpFunc: z.GetTicketFormsOBP, + cbpFunc: z.GetTicketFormsCBP, + } +} + +func (z *Client) GetTicketFormsOBP(ctx context.Context, opts *OBPOptions) ([]TicketForm, Page, error) { + var data struct { + TicketForms []TicketForm `json:"ticket_forms"` + Page + } + + tmp := opts + if tmp == nil { + tmp = &OBPOptions{} + } + + u, err := addOptions("/ticket_forms.json", tmp) + + if err != nil { + return nil, Page{}, err + } + + err = getData(z, ctx, u, &data) + if err != nil { + return nil, Page{}, err + } + return data.TicketForms, data.Page, nil +} + +func (z *Client) GetTicketFormsCBP(ctx context.Context, opts *CBPOptions) ([]TicketForm, CursorPaginationMeta, error) { + var data struct { + TicketForms []TicketForm `json:"ticket_forms"` + Meta CursorPaginationMeta `json:"meta"` + } + + tmp := opts + if tmp == nil { + tmp = &CBPOptions{} + } + + u, err := addOptions("/ticket_forms.json", tmp) + + if err != nil { + return nil, data.Meta, err + } + + err = getData(z, ctx, u, &data) + if err != nil { + return nil, data.Meta, err + } + return data.TicketForms, data.Meta, nil +} + diff --git a/zendesk/ticket_generated.go b/zendesk/ticket_generated.go new file mode 100644 index 00000000..8adc647d --- /dev/null +++ b/zendesk/ticket_generated.go @@ -0,0 +1,74 @@ + +// Code generated by Script. DO NOT EDIT. +// Source: script/codegen/main.go +// +// Generated by this command: +// +// go run script/codegen/main.go + +package zendesk + +import "context" + +func (z *Client) GetTicketsIterator(ctx context.Context, opts *PaginationOptions) *Iterator[Ticket] { + return &Iterator[Ticket]{ + CommonOptions: opts.CommonOptions, + pageSize: opts.PageSize, + hasMore: true, + isCBP: opts.IsCBP, + pageAfter: "", + pageIndex: 1, + ctx: ctx, + obpFunc: z.GetTicketsOBP, + cbpFunc: z.GetTicketsCBP, + } +} + +func (z *Client) GetTicketsOBP(ctx context.Context, opts *OBPOptions) ([]Ticket, Page, error) { + var data struct { + Tickets []Ticket `json:"tickets"` + Page + } + + tmp := opts + if tmp == nil { + tmp = &OBPOptions{} + } + + u, err := addOptions("/tickets.json", tmp) + + if err != nil { + return nil, Page{}, err + } + + err = getData(z, ctx, u, &data) + if err != nil { + return nil, Page{}, err + } + return data.Tickets, data.Page, nil +} + +func (z *Client) GetTicketsCBP(ctx context.Context, opts *CBPOptions) ([]Ticket, CursorPaginationMeta, error) { + var data struct { + Tickets []Ticket `json:"tickets"` + Meta CursorPaginationMeta `json:"meta"` + } + + tmp := opts + if tmp == nil { + tmp = &CBPOptions{} + } + + u, err := addOptions("/tickets.json", tmp) + + if err != nil { + return nil, data.Meta, err + } + + err = getData(z, ctx, u, &data) + if err != nil { + return nil, data.Meta, err + } + return data.Tickets, data.Meta, nil +} + diff --git a/zendesk/ticket_metrics.go b/zendesk/ticket_metrics.go new file mode 100644 index 00000000..abc8f1e3 --- /dev/null +++ b/zendesk/ticket_metrics.go @@ -0,0 +1,128 @@ +package zendesk + +import ( + "context" + "encoding/json" + "fmt" + "time" +) + +// TimeDuration represents a time in business or calendar days +type TimeDuration struct { + Business int `json:"business"` + Calendar int `json:"calendar"` +} + +type TicketMetric struct { + AgentWaitTimeInMinutes TimeDuration `json:"agent_wait_time_in_minutes"` + AssignedAt time.Time `json:"assigned_at"` + AssigneeStations int `json:"assignee_stations"` + AssigneeUpdatedAt time.Time `json:"assignee_updated_at"` + CreatedAt time.Time `json:"created_at"` + CustomStatusUpdatedAt time.Time `json:"custom_status_updated_at"` + FirstResolutionTimeInMinutes TimeDuration `json:"first_resolution_time_in_minutes"` + FullResolutionTimeInMinutes TimeDuration `json:"full_resolution_time_in_minutes"` + GroupStations int `json:"group_stations"` + ID int `json:"id"` + InitiallyAssignedAt time.Time `json:"initially_assigned_at"` + LatestCommentAddedAt time.Time `json:"latest_comment_added_at"` + OnHoldTimeInMinutes TimeDuration `json:"on_hold_time_in_minutes"` + Reopens int `json:"reopens"` + Replies int `json:"replies"` + ReplyTimeInMinutes TimeDuration `json:"reply_time_in_minutes"` + ReplyTimeInSeconds struct { + Calendar int `json:"calendar"` + } `json:"reply_time_in_seconds"` + RequesterUpdatedAt time.Time `json:"requester_updated_at"` + RequesterWaitTimeInMinutes TimeDuration `json:"requester_wait_time_in_minutes"` + SolvedAt time.Time `json:"solved_at"` + StatusUpdatedAt time.Time `json:"status_updated_at"` + TicketID int `json:"ticket_id"` + UpdatedAt time.Time `json:"updated_at"` +} + +type TicketMetricListOptions struct { + PageOptions + + SortBy string `url:"sort_by,omitempty"` + + SortOrder string `url:"sort_order,omitempty"` +} + +// TicketMetricsAPI is an interface containing all methods for the ticket +// metrics API +type TicketMetricsAPI interface { + GetTicketMetrics(ctx context.Context, opts ...TicketMetricListOptions) ([]TicketMetric, Page, error) + GetTicketMetric(ctx context.Context, ticketMetricsID int64) (TicketMetric, error) + GetTicketMetricByTicket(ctx context.Context, ticketID int64) (TicketMetric, error) +} + +// GetTicketMetrics get ticket metrics list with offset based pagination +// +// ref: https://developer.zendesk.com/api-reference/ticketing/tickets/ticket_metrics/#list-ticket-metrics +func (z *Client) GetTicketMetrics(ctx context.Context, opts *TicketMetricListOptions) ([]TicketMetric, Page, error) { + var data struct { + TicketMetrics []TicketMetric `json:"ticket_metrics"` + Page + } + + tmp := opts + if tmp == nil { + tmp = &TicketMetricListOptions{} + } + + u, err := addOptions("/ticket_metrics.json", tmp) + if err != nil { + return nil, Page{}, err + } + + body, err := z.get(ctx, u) + if err != nil { + return nil, Page{}, err + } + + err = json.Unmarshal(body, &data) + if err != nil { + return nil, Page{}, err + } + return data.TicketMetrics, data.Page, nil + +} + +// ref: https://developer.zendesk.com/api-reference/ticketing/tickets/ticket_metrics/#show-ticket-metrics +func (z *Client) GetTicketMetric(ctx context.Context, ticketMetricsID int64) (TicketMetric, error) { + var result struct { + TicketMetric TicketMetric `json:"ticket_metric"` + } + + body, err := z.get(ctx, fmt.Sprintf("/ticket_metrics/%d.json", ticketMetricsID)) + if err != nil { + return TicketMetric{}, err + } + + err = json.Unmarshal(body, &result) + if err != nil { + return TicketMetric{}, err + } + + return result.TicketMetric, err +} + +// ref: https://developer.zendesk.com/api-reference/ticketing/tickets/ticket_metrics/#show-ticket-metrics +func (z *Client) GetTicketMetricByTicket(ctx context.Context, ticketID int64) (TicketMetric, error) { + var result struct { + TicketMetric TicketMetric `json:"ticket_metric"` + } + + body, err := z.get(ctx, fmt.Sprintf("/tickets/%d/metrics.json", ticketID)) + if err != nil { + return TicketMetric{}, err + } + + err = json.Unmarshal(body, &result) + if err != nil { + return TicketMetric{}, err + } + + return result.TicketMetric, err +} diff --git a/zendesk/ticket_test.go b/zendesk/ticket_test.go index 222f326c..69ea2efc 100644 --- a/zendesk/ticket_test.go +++ b/zendesk/ticket_test.go @@ -39,7 +39,7 @@ func TestGetTicketsCBP(t *testing.T) { client := newTestClient(mockAPI) defer mockAPI.Close() - tickets, err := client.GetTicketsCBP(ctx, &TicketListCBPOptions{ + tickets, _, err := client.GetTicketsCBP(ctx, &CBPOptions{ CursorPagination: CursorPagination{ PageSize: 10, PageAfter: "", @@ -50,18 +50,18 @@ func TestGetTicketsCBP(t *testing.T) { } expectedLength := 2 - if len(tickets.Tickets) != expectedLength { - t.Fatalf("Returned tickets does not have the expected length %d. Tickets length is %d", expectedLength, len(tickets.Tickets)) + if len(tickets) != expectedLength { + t.Fatalf("Returned tickets does not have the expected length %d. Tickets length is %d", expectedLength, len(tickets)) } } -func TestGetTicketsExCBPDefault(t *testing.T) { +func TestGetTicketsIteratorCBPDefault(t *testing.T) { mockAPI := newMockAPI(http.MethodGet, "tickets.json") client := newTestClient(mockAPI) defer mockAPI.Close() ops := NewPaginationOptions() - it := client.GetTicketsEx(ctx, ops) + it := client.GetTicketsIterator(ctx, ops) expectedLength := 2 ticketCount := 0 @@ -79,14 +79,14 @@ func TestGetTicketsExCBPDefault(t *testing.T) { } } -func TestGetTicketsExOBPOptional(t *testing.T) { +func TestGetTicketsIteratorOBPOptional(t *testing.T) { mockAPI := newMockAPI(http.MethodGet, "tickets.json") client := newTestClient(mockAPI) defer mockAPI.Close() ops := NewPaginationOptions() ops.IsCBP = false - it := client.GetTicketsEx(ctx, ops) + it := client.GetTicketsIterator(ctx, ops) expectedLength := 2 ticketCount := 0 @@ -127,6 +127,88 @@ func TestGetOrganizationTickets(t *testing.T) { } } +func TestGetOrganizationTicketsOBP(t *testing.T) { + mockAPI := newMockAPI(http.MethodGet, "tickets.json") + client := newTestClient(mockAPI) + defer mockAPI.Close() + + tickets, _, err := client.GetOrganizationTicketsOBP(ctx, &OBPOptions{ + PageOptions: PageOptions{ + Page: 1, + PerPage: 10, + }, + CommonOptions: CommonOptions{ + SortBy: "created_at", + SortOrder: "asc", + Id: 360363695492, + }, + }) + if err != nil { + t.Fatalf("Failed to get tickets: %s", err) + } + + expectedLength := 2 + if len(tickets) != expectedLength { + t.Fatalf("Returned tickets does not have the expected length %d. Tickets length is %d", expectedLength, len(tickets)) + } +} + +func TestGetOrganizationTicketsCBP(t *testing.T) { + mockAPI := newMockAPI(http.MethodGet, "tickets.json") + client := newTestClient(mockAPI) + defer mockAPI.Close() + + tickets, _, err := client.GetOrganizationTicketsCBP(ctx, &CBPOptions{ + CursorPagination: CursorPagination{ + PageSize: 10, + PageAfter: "", + }, + CommonOptions: CommonOptions{ + SortBy: "created_at", + SortOrder: "asc", + Id: 360363695492, + }, + }) + if err != nil { + t.Fatalf("Failed to get tickets: %s", err) + } + + expectedLength := 2 + if len(tickets) != expectedLength { + t.Fatalf("Returned tickets does not have the expected length %d. Tickets length is %d", expectedLength, len(tickets)) + } +} + +func TestGetOrganizationTicketsIterator(t *testing.T) { + mockAPI := newMockAPI(http.MethodGet, "tickets.json") + client := newTestClient(mockAPI) + defer mockAPI.Close() + + ops := NewPaginationOptions() + ops.Sort = "updated_at" + ops.PageSize = 10 + ops.Id = 360363695492 + it := client.GetOrganizationTicketsIterator(ctx, ops) + + expectedLength := 2 + ticketCount := 0 + for it.HasMore() { + tickets, err := it.GetNext() + if len(tickets) != expectedLength { + t.Fatalf("Returned tickets does not have the expected length %d. Tickets length is %d", expectedLength, len(tickets)) + } + if err == nil { + for _, ticket := range tickets { + println(ticket.Subject) + ticketCount++ + } + } + if err != nil { + t.Fatalf("Failed to get tickets: %s", err) + } + } +} + func TestGetTicket(t *testing.T) { mockAPI := newMockAPI(http.MethodGet, "ticket.json") client := newTestClient(mockAPI) diff --git a/zendesk/tickets_from_view_generated.go b/zendesk/tickets_from_view_generated.go new file mode 100644 index 00000000..9f020a74 --- /dev/null +++ b/zendesk/tickets_from_view_generated.go @@ -0,0 +1,79 @@ + +// Code generated by Script. DO NOT EDIT. +// Source: script/codegen/main.go +// +// Generated by this command: +// +// go run script/codegen/main.go + +package zendesk + +import ( + "context" + "fmt" +) + +func (z *Client) GetTicketsFromViewIterator(ctx context.Context, opts *PaginationOptions) *Iterator[Ticket] { + return &Iterator[Ticket]{ + CommonOptions: opts.CommonOptions, + pageSize: opts.PageSize, + hasMore: true, + isCBP: opts.IsCBP, + pageAfter: "", + pageIndex: 1, + ctx: ctx, + obpFunc: z.GetTicketsFromViewOBP, + cbpFunc: z.GetTicketsFromViewCBP, + } +} + +func (z *Client) GetTicketsFromViewOBP(ctx context.Context, opts *OBPOptions) ([]Ticket, Page, error) { + var data struct { + Tickets []Ticket `json:"tickets"` + Page + } + + tmp := opts + if tmp == nil { + tmp = &OBPOptions{} + } + + path := fmt.Sprintf("/views/%d/tickets.json", tmp.Id) + u, err := addOptions(path, tmp) + + if err != nil { + return nil, Page{}, err + } + + err = getData(z, ctx, u, &data) + if err != nil { + return nil, Page{}, err + } + return data.Tickets, data.Page, nil +} + +func (z *Client) GetTicketsFromViewCBP(ctx context.Context, opts *CBPOptions) ([]Ticket, CursorPaginationMeta, error) { + var data struct { + Tickets []Ticket `json:"tickets"` + Meta CursorPaginationMeta `json:"meta"` + } + + tmp := opts + if tmp == nil { + tmp = &CBPOptions{} + } + + path := fmt.Sprintf("/views/%d/tickets.json", tmp.Id) + u, err := addOptions(path, tmp) + + if err != nil { + return nil, data.Meta, err + } + + err = getData(z, ctx, u, &data) + if err != nil { + return nil, data.Meta, err + } + return data.Tickets, data.Meta, nil +} + diff --git a/zendesk/trigger.go b/zendesk/trigger.go index 23ce9690..8426a212 100644 --- a/zendesk/trigger.go +++ b/zendesk/trigger.go @@ -61,6 +61,9 @@ type TriggerAPI interface { GetTrigger(ctx context.Context, id int64) (Trigger, error) UpdateTrigger(ctx context.Context, id int64, trigger Trigger) (Trigger, error) DeleteTrigger(ctx context.Context, id int64) error + GetTriggersIterator(ctx context.Context, opts *PaginationOptions) *Iterator[Trigger] + GetTriggersOBP(ctx context.Context, opts *OBPOptions) ([]Trigger, Page, error) + GetTriggersCBP(ctx context.Context, opts *CBPOptions) ([]Trigger, CursorPaginationMeta, error) } // GetTriggers fetch trigger list diff --git a/zendesk/trigger_generated.go b/zendesk/trigger_generated.go new file mode 100644 index 00000000..d0aa967e --- /dev/null +++ b/zendesk/trigger_generated.go @@ -0,0 +1,74 @@ + +// Code generated by Script. DO NOT EDIT. +// Source: script/codegen/main.go +// +// Generated by this command: +// +// go run script/codegen/main.go + +package zendesk + +import "context" + +func (z *Client) GetTriggersIterator(ctx context.Context, opts *PaginationOptions) *Iterator[Trigger] { + return &Iterator[Trigger]{ + CommonOptions: opts.CommonOptions, + pageSize: opts.PageSize, + hasMore: true, + isCBP: opts.IsCBP, + pageAfter: "", + pageIndex: 1, + ctx: ctx, + obpFunc: z.GetTriggersOBP, + cbpFunc: z.GetTriggersCBP, + } +} + +func (z *Client) GetTriggersOBP(ctx context.Context, opts *OBPOptions) ([]Trigger, Page, error) { + var data struct { + Triggers []Trigger `json:"triggers"` + Page + } + + tmp := opts + if tmp == nil { + tmp = &OBPOptions{} + } + + u, err := addOptions("/triggers.json", tmp) + + if err != nil { + return nil, Page{}, err + } + + err = getData(z, ctx, u, &data) + if err != nil { + return nil, Page{}, err + } + return data.Triggers, data.Page, nil +} + +func (z *Client) GetTriggersCBP(ctx context.Context, opts *CBPOptions) ([]Trigger, CursorPaginationMeta, error) { + var data struct { + Triggers []Trigger `json:"triggers"` + Meta CursorPaginationMeta `json:"meta"` + } + + tmp := opts + if tmp == nil { + tmp = &CBPOptions{} + } + + u, err := addOptions("/triggers.json", tmp) + + if err != nil { + return nil, data.Meta, err + } + + err = getData(z, ctx, u, &data) + if err != nil { + return nil, data.Meta, err + } + return data.Triggers, data.Meta, nil +} + diff --git a/zendesk/user.go b/zendesk/user.go index c61324d5..7dacf0e8 100644 --- a/zendesk/user.go +++ b/zendesk/user.go @@ -122,6 +122,12 @@ type UserAPI interface { CreateOrUpdateUser(ctx context.Context, user User) (User, error) UpdateUser(ctx context.Context, userID int64, user User) (User, error) GetUserRelated(ctx context.Context, userID int64) (UserRelated, error) + GetUsersIterator(ctx context.Context, opts *PaginationOptions) *Iterator[User] + GetUsersOBP(ctx context.Context, opts *OBPOptions) ([]User, Page, error) + GetUsersCBP(ctx context.Context, opts *CBPOptions) ([]User, CursorPaginationMeta, error) + GetOrganizationUsersIterator(ctx context.Context, opts *PaginationOptions) *Iterator[User] + GetOrganizationUsersOBP(ctx context.Context, opts *OBPOptions) ([]User, Page, error) + GetOrganizationUsersCBP(ctx context.Context, opts *CBPOptions) ([]User, CursorPaginationMeta, error) } // GetUsers fetch user list diff --git a/zendesk/user_field.go b/zendesk/user_field.go index 19f981b1..27942322 100644 --- a/zendesk/user_field.go +++ b/zendesk/user_field.go @@ -33,6 +33,9 @@ type UserFieldListOptions struct { type UserFieldAPI interface { GetUserFields(ctx context.Context, opts *UserFieldListOptions) ([]UserField, Page, error) CreateUserField(ctx context.Context, userField UserField) (UserField, error) + GetUserFieldsIterator(ctx context.Context, opts *PaginationOptions) *Iterator[UserField] + GetUserFieldsOBP(ctx context.Context, opts *OBPOptions) ([]UserField, Page, error) + GetUserFieldsCBP(ctx context.Context, opts *CBPOptions) ([]UserField, CursorPaginationMeta, error) } // GetUserFields fetch trigger list diff --git a/zendesk/user_field_generated.go b/zendesk/user_field_generated.go new file mode 100644 index 00000000..570c36a8 --- /dev/null +++ b/zendesk/user_field_generated.go @@ -0,0 +1,74 @@ + +// Code generated by Script. DO NOT EDIT. +// Source: script/codegen/main.go +// +// Generated by this command: +// +// go run script/codegen/main.go + +package zendesk + +import "context" + +func (z *Client) GetUserFieldsIterator(ctx context.Context, opts *PaginationOptions) *Iterator[UserField] { + return &Iterator[UserField]{ + CommonOptions: opts.CommonOptions, + pageSize: opts.PageSize, + hasMore: true, + isCBP: opts.IsCBP, + pageAfter: "", + pageIndex: 1, + ctx: ctx, + obpFunc: z.GetUserFieldsOBP, + cbpFunc: z.GetUserFieldsCBP, + } +} + +func (z *Client) GetUserFieldsOBP(ctx context.Context, opts *OBPOptions) ([]UserField, Page, error) { + var data struct { + UserFields []UserField `json:"user_fields"` + Page + } + + tmp := opts + if tmp == nil { + tmp = &OBPOptions{} + } + + u, err := addOptions("/user_fields.json", tmp) + + if err != nil { + return nil, Page{}, err + } + + err = getData(z, ctx, u, &data) + if err != nil { + return nil, Page{}, err + } + return data.UserFields, data.Page, nil +} + +func (z *Client) GetUserFieldsCBP(ctx context.Context, opts *CBPOptions) ([]UserField, CursorPaginationMeta, error) { + var data struct { + UserFields []UserField `json:"user_fields"` + Meta CursorPaginationMeta `json:"meta"` + } + + tmp := opts + if tmp == nil { + tmp = &CBPOptions{} + } + + u, err := addOptions("/user_fields.json", tmp) + + if err != nil { + return nil, data.Meta, err + } + + err = getData(z, ctx, u, &data) + if err != nil { + return nil, data.Meta, err + } + return data.UserFields, data.Meta, nil +} + diff --git a/zendesk/user_generated.go b/zendesk/user_generated.go new file mode 100644 index 00000000..98b95dfb --- /dev/null +++ b/zendesk/user_generated.go @@ -0,0 +1,74 @@ + +// Code generated by Script. DO NOT EDIT. +// Source: script/codegen/main.go +// +// Generated by this command: +// +// go run script/codegen/main.go + +package zendesk + +import "context" + +func (z *Client) GetUsersIterator(ctx context.Context, opts *PaginationOptions) *Iterator[User] { + return &Iterator[User]{ + CommonOptions: opts.CommonOptions, + pageSize: opts.PageSize, + hasMore: true, + isCBP: opts.IsCBP, + pageAfter: "", + pageIndex: 1, + ctx: ctx, + obpFunc: z.GetUsersOBP, + cbpFunc: z.GetUsersCBP, + } +} + +func (z *Client) GetUsersOBP(ctx context.Context, opts *OBPOptions) ([]User, Page, error) { + var data struct { + Users []User `json:"users"` + Page + } + + tmp := opts + if tmp == nil { + tmp = &OBPOptions{} + } + + u, err := addOptions("/users.json", tmp) + + if err != nil { + return nil, Page{}, err + } + + err = getData(z, ctx, u, &data) + if err != nil { + return nil, Page{}, err + } + return data.Users, data.Page, nil +} + +func (z *Client) GetUsersCBP(ctx context.Context, opts *CBPOptions) ([]User, CursorPaginationMeta, error) { + var data struct { + Users []User `json:"users"` + Meta CursorPaginationMeta `json:"meta"` + } + + tmp := opts + if tmp == nil { + tmp = &CBPOptions{} + } + + u, err := addOptions("/users.json", tmp) + + if err != nil { + return nil, data.Meta, err + } + + err = getData(z, ctx, u, &data) + if err != nil { + return nil, data.Meta, err + } + return data.Users, data.Meta, nil +} + diff --git a/zendesk/view.go b/zendesk/view.go index ad32a14e..c78c2d2c 100644 --- a/zendesk/view.go +++ b/zendesk/view.go @@ -4,6 +4,7 @@ import ( "context" "encoding/json" "fmt" + "strings" "time" ) @@ -24,11 +25,26 @@ type ( // Restriction Restriction } + ViewCount struct { + ViewID int64 `json:"view_id"` + URL string `json:"url"` + Value int64 `json:"value"` + Pretty string `json:"pretty"` + Fresh bool `json:"fresh"` + } + // ViewAPI encapsulates methods on view ViewAPI interface { GetView(context.Context, int64) (View, error) GetViews(context.Context) ([]View, Page, error) GetTicketsFromView(context.Context, int64, *TicketListOptions) ([]Ticket, Page, error) + GetCountTicketsInViews(ctx context.Context, ids []string) ([]ViewCount, error) + GetTicketsFromViewIterator(ctx context.Context, opts *PaginationOptions) *Iterator[Ticket] + GetTicketsFromViewOBP(ctx context.Context, opts *OBPOptions) ([]Ticket, Page, error) + GetTicketsFromViewCBP(ctx context.Context, opts *CBPOptions) ([]Ticket, CursorPaginationMeta, error) + GetViewsIterator(ctx context.Context, opts *PaginationOptions) *Iterator[View] + GetViewsOBP(ctx context.Context, opts *OBPOptions) ([]View, Page, error) + GetViewsCBP(ctx context.Context, opts *CBPOptions) ([]View, CursorPaginationMeta, error) } ) @@ -104,3 +120,22 @@ func (z *Client) GetTicketsFromView(ctx context.Context, viewID int64, opts *Tic return result.Tickets, result.Page, nil } + +// GetCountTicketsInViews count tickets in views using views ids +// ref https://developer.zendesk.com/api-reference/ticketing/business-rules/views/#count-tickets-in-views +func (z *Client) GetCountTicketsInViews(ctx context.Context, ids []string) ([]ViewCount, error) { + var result struct { + ViewCounts []ViewCount `json:"view_counts"` + } + idsURLParameter := strings.Join(ids, ",") + body, err := z.get(ctx, fmt.Sprintf("/views/count_many?ids=%s", idsURLParameter)) + + if err != nil { + return []ViewCount{}, err + } + + if err := json.Unmarshal(body, &result); err != nil { + return []ViewCount{}, err + } + return result.ViewCounts, nil +} diff --git a/zendesk/view_generated.go b/zendesk/view_generated.go new file mode 100644 index 00000000..3f7425a5 --- /dev/null +++ b/zendesk/view_generated.go @@ -0,0 +1,74 @@ + +// Code generated by Script. DO NOT EDIT. +// Source: script/codegen/main.go +// +// Generated by this command: +// +// go run script/codegen/main.go + +package zendesk + +import "context" + +func (z *Client) GetViewsIterator(ctx context.Context, opts *PaginationOptions) *Iterator[View] { + return &Iterator[View]{ + CommonOptions: opts.CommonOptions, + pageSize: opts.PageSize, + hasMore: true, + isCBP: opts.IsCBP, + pageAfter: "", + pageIndex: 1, + ctx: ctx, + obpFunc: z.GetViewsOBP, + cbpFunc: z.GetViewsCBP, + } +} + +func (z *Client) GetViewsOBP(ctx context.Context, opts *OBPOptions) ([]View, Page, error) { + var data struct { + Views []View `json:"views"` + Page + } + + tmp := opts + if tmp == nil { + tmp = &OBPOptions{} + } + + u, err := addOptions("/views.json", tmp) + + if err != nil { + return nil, Page{}, err + } + + err = getData(z, ctx, u, &data) + if err != nil { + return nil, Page{}, err + } + return data.Views, data.Page, nil +} + +func (z *Client) GetViewsCBP(ctx context.Context, opts *CBPOptions) ([]View, CursorPaginationMeta, error) { + var data struct { + Views []View `json:"views"` + Meta CursorPaginationMeta `json:"meta"` + } + + tmp := opts + if tmp == nil { + tmp = &CBPOptions{} + } + + u, err := addOptions("/views.json", tmp) + + if err != nil { + return nil, data.Meta, err + } + + err = getData(z, ctx, u, &data) + if err != nil { + return nil, data.Meta, err + } + return data.Views, data.Meta, nil +} + diff --git a/zendesk/view_test.go b/zendesk/view_test.go index 359904e7..466ff3fc 100644 --- a/zendesk/view_test.go +++ b/zendesk/view_test.go @@ -35,3 +35,18 @@ func TestGetViews(t *testing.T) { t.Fatalf("expected length of views is 2, but got %d", len(views)) } } + +func TestGetCountTicketsInViewsTestGetViews(t *testing.T) { + mockAPI := newMockAPI(http.MethodGet, "views_ticket_count.json") + client := newTestClient(mockAPI) + defer mockAPI.Close() + ids := []string{"25", "78"} + viewsCount, err := client.GetCountTicketsInViews(ctx, ids) + if err != nil { + t.Fatalf("Failed to get views tickets count: %s", err) + } + + if len(viewsCount) != 2 { + t.Fatalf("expected length of views ticket counts is 2, but got %d", len(viewsCount)) + } +} diff --git a/zendesk/zendesk.go b/zendesk/zendesk.go index 2b325199..d829ef75 100644 --- a/zendesk/zendesk.go +++ b/zendesk/zendesk.go @@ -18,7 +18,7 @@ const ( ) var defaultHeaders = map[string]string{ - "User-Agent": "nukosuke/go-zendesk", + "User-Agent": "nukosuke/go-zendesk/0.18.0", "Content-Type": "application/json", } @@ -324,6 +324,28 @@ func addOptions(s string, opts interface{}) (string, error) { return u.String(), nil } +// getData is a generic helper function that retrieves and unmarshals JSON data from a specified URL. +// It takes four parameters: +// - a pointer to a Client (z) which is used to execute the GET request, +// - a context (ctx) for managing the request's lifecycle, +// - a string (url) representing the endpoint from which data should be retrieved, +// - and an empty interface (data) where the retrieved data will be stored after being unmarshalled from JSON. +// +// The function starts by sending a GET request to the specified URL. If the request is successful, +// the returned body in the form of a byte slice is unmarshalled into the provided empty interface using the json.Unmarshal function. +// +// If an error occurs during either the GET request or the JSON unmarshalling, the function will return this error. +func getData(z *Client, ctx context.Context, url string, data any) error { + body, err := z.get(ctx, url) + if err == nil { + err = json.Unmarshal(body, data) + if err != nil { + return err + } + } + return err +} + // Get allows users to send requests not yet implemented func (z *Client) Get(ctx context.Context, path string) ([]byte, error) { return z.get(ctx, path) diff --git a/zendesk/zendesk_test.go b/zendesk/zendesk_test.go index d6d85f2f..346e5d13 100644 --- a/zendesk/zendesk_test.go +++ b/zendesk/zendesk_test.go @@ -141,6 +141,32 @@ func TestGet(t *testing.T) { } } +func TestGetData(t *testing.T) { + mockAPI := newMockAPI(http.MethodGet, "groups.json") + client := newTestClient(mockAPI) + defer mockAPI.Close() + + var data struct { + Groups []Group `json:"groups"` + Page + } + + opts := &OBPOptions{} + + u, err := addOptions("/groups.json", opts) + if err != nil { + t.Fatal(err) + } + + err = getData(client, ctx, u, &data) + if err != nil { + t.Fatalf("Failed to send request: %s", err) + } + if len(data.Groups) == 0 { + t.Fatal("Response body is empty") + } +} + func TestGetFailure(t *testing.T) { mockAPI := newMockAPIWithStatus(http.MethodGet, "groups.json", http.StatusInternalServerError) client := newTestClient(mockAPI)