Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Feature/improve data source search - fixes #13

Merged
merged 5 commits into from
Sep 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 06.09.2022, Version 2.2.1

- fix alert action search method
- fix connector search method
- change user search

## 04.09.2022, Version 2.2.0

- add search by name for all entities
Expand Down
4 changes: 2 additions & 2 deletions alertaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ type SearchAlertActionInput struct {
// SearchAlertActionOutput represents the output of a SearchAlertAction operation.
type SearchAlertActionOutput struct {
_ struct{}
AlertAction *AlertAction
AlertAction *AlertActionOutput
}

// SearchAlertAction gets the alertAction with specified name.
Expand All @@ -369,7 +369,7 @@ func (c *Client) SearchAlertAction(input *SearchAlertActionInput) (*SearchAlertA
return nil, apiErr
}

alertAction := &AlertAction{}
alertAction := &AlertActionOutput{}
err = json.Unmarshal(resp.Body(), alertAction)
if err != nil {
return nil, err
Expand Down
4 changes: 2 additions & 2 deletions connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ type SearchConnectorInput struct {
// SearchConnectorOutput represents the output of a SearchConnector operation.
type SearchConnectorOutput struct {
_ struct{}
Connector *Connector
Connector *ConnectorOutput
}

// SearchConnector gets the connector with specified name.
Expand All @@ -345,7 +345,7 @@ func (c *Client) SearchConnector(input *SearchConnectorInput) (*SearchConnectorO
return nil, apiErr
}

connector := &Connector{}
connector := &ConnectorOutput{}
err = json.Unmarshal(resp.Body(), connector)
if err != nil {
return nil, err
Expand Down
10 changes: 5 additions & 5 deletions user.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,8 @@ func (c *Client) GetUsers(input *GetUsersInput) (*GetUsersOutput, error) {

// SearchUserInput represents the input of a SearchUser operation.
type SearchUserInput struct {
_ struct{}
UserName *string
_ struct{}
UserEmail *string
}

// SearchUserOutput represents the output of a SearchUser operation.
Expand All @@ -283,11 +283,11 @@ func (c *Client) SearchUser(input *SearchUserInput) (*SearchUserOutput, error) {
if input == nil {
return nil, errors.New("input is required")
}
if input.UserName == nil {
return nil, errors.New("username is required")
if input.UserEmail == nil {
return nil, errors.New("user email is required")
}

resp, err := c.httpClient.R().Get(fmt.Sprintf("%s/name/%s", apiRoutes.users, *input.UserName))
resp, err := c.httpClient.R().SetBody(User{Email: *input.UserEmail}).Post(fmt.Sprintf("%s/search-email", apiRoutes.users))
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion version.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ilert

// Version package version
const Version = "v2.2.0"
const Version = "v2.2.1"