Skip to content

Implemented the alert logs API #169

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

@appare45 appare45 self-assigned this Mar 3, 2025
@appare45 appare45 force-pushed the add-alerts-logs-api branch from b4fa36a to bf240d9 Compare March 3, 2025 05:08
@appare45 appare45 marked this pull request as ready for review March 3, 2025 05:12
@appare45 appare45 changed the title Implemented the alerts logs API Implemented the alert logs API Mar 3, 2025
@appare45 appare45 force-pushed the add-alerts-logs-api branch from bf240d9 to 08edb4a Compare March 3, 2025 05:25
@@ -381,3 +381,104 @@ func TestGetAlert(t *testing.T) {
t.Errorf("Wrong data for alert: %v", alert)
}
}

func TestFindAlertLogs(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[should] Missing test for FindAlertLogsByNextID

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alerts.go Outdated
Comment on lines 135 to 146
func (c *Client) FindAlertLogs(alertId string) (*AlertLogsResp, error) {
path := fmt.Sprintf("/api/v0/alerts/%s/logs", alertId)
return requestGet[AlertLogsResp](c, path)
}

// FindAlertLogsByNextID finds alert logs by next id.
func (c *Client) FindAlertLogsByNextID(alertId, nextId string) (*AlertLogsResp, error) {
params := url.Values{}
params.Set("nextId", nextId)
path := fmt.Sprintf("/api/v0/alerts/%s/logs", alertId)
return requestGetWithParams[AlertLogsResp](c, path, params)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parameter limit cannot be set in these functions.
limit cannot be set in FindAlerts either, but I am not confident that it is correct.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refactored to use params for request as struct

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants