diff --git a/zendesk/mock/client.go b/zendesk/mock/client.go index 81cda041..19f76d3c 100644 --- a/zendesk/mock/client.go +++ b/zendesk/mock/client.go @@ -822,6 +822,22 @@ func (mr *ClientMockRecorder) GetOrganization(arg0, arg1 interface{}) *gomock.Ca return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetOrganization", reflect.TypeOf((*Client)(nil).GetOrganization), arg0, arg1) } +// GetOrganizationByExternalID mocks base method. +func (m *Client) GetOrganizationByExternalID(arg0 context.Context, arg1 string) ([]zendesk.Organization, zendesk.Page, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetOrganizationByExternalID", arg0, arg1) + ret0, _ := ret[0].([]zendesk.Organization) + ret1, _ := ret[1].(zendesk.Page) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetOrganizationByExternalID indicates an expected call of GetOrganizationByExternalID. +func (mr *ClientMockRecorder) GetOrganizationByExternalID(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetOrganizationByExternalID", reflect.TypeOf((*Client)(nil).GetOrganizationByExternalID), arg0, arg1) +} + // GetOrganizationMemberships mocks base method. func (m *Client) GetOrganizationMemberships(arg0 context.Context, arg1 *zendesk.OrganizationMembershipListOptions) ([]zendesk.OrganizationMembership, zendesk.Page, error) { m.ctrl.T.Helper() diff --git a/zendesk/organization.go b/zendesk/organization.go index b647d0a9..66da2e9e 100644 --- a/zendesk/organization.go +++ b/zendesk/organization.go @@ -38,6 +38,7 @@ type OrganizationAPI interface { GetOrganizations(ctx context.Context, opts *OrganizationListOptions) ([]Organization, Page, error) CreateOrganization(ctx context.Context, org Organization) (Organization, error) GetOrganization(ctx context.Context, orgID int64) (Organization, error) + 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 } @@ -103,7 +104,6 @@ func (z *Client) GetOrganization(ctx context.Context, orgID int64) (Organization } body, err := z.get(ctx, fmt.Sprintf("/organizations/%d.json", orgID)) - if err != nil { return Organization{}, err } @@ -125,7 +125,6 @@ func (z *Client) GetOrganizationByExternalID(ctx context.Context, externalID str } body, err := z.get(ctx, fmt.Sprintf("/organizations/search?external_id=%s", externalID)) - if err != nil { return []Organization{}, Page{}, err } @@ -148,7 +147,6 @@ func (z *Client) UpdateOrganization(ctx context.Context, orgID int64, org Organi data.Organization = org body, err := z.put(ctx, fmt.Sprintf("/organizations/%d.json", orgID), data) - if err != nil { return Organization{}, err } @@ -165,7 +163,6 @@ func (z *Client) UpdateOrganization(ctx context.Context, orgID int64, org Organi // ref: https://developer.zendesk.com/rest_api/docs/support/organizations#delete-organization func (z *Client) DeleteOrganization(ctx context.Context, orgID int64) error { err := z.delete(ctx, fmt.Sprintf("/organizations/%d.json", orgID)) - if err != nil { return err }