Skip to content

Commit

Permalink
fix: pagerduty remote api not working (#7485)
Browse files Browse the repository at this point in the history
  • Loading branch information
klesh authored May 17, 2024
1 parent a42e3ee commit 2bfc400
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions backend/plugins/pagerduty/api/remote_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,23 @@ type ServiceResponse struct {
}

func queryPagerdutyRemoteScopes(
connection *models.PagerDutyConnection,
apiClient plugin.ApiClient,
groupId string,
_ string,
page PagerdutyRemotePagination,
search string,
) (
children []dsmodels.DsRemoteApiScopeListEntry[models.Service],
nextPage *PagerdutyRemotePagination,
err errors.Error,
) {
if page.Limit == 0 {
page.Limit = 50
}
var res *http.Response
res, err = apiClient.Get("/services", url.Values{
"offset": {strconv.Itoa(page.Offset)},
"limit": {strconv.Itoa(page.Limit)},
"search": {search},
"query": {search},
}, nil)
if err != nil {
return
Expand All @@ -85,7 +87,6 @@ func queryPagerdutyRemoteScopes(
NoPKModel: common.NoPKModel{
CreatedAt: service.CreatedAt,
},
ConnectionId: connection.ID,
},
},
})
Expand All @@ -112,7 +113,7 @@ func listPagerdutyRemoteScopes(
*PagerdutyRemotePagination,
errors.Error,
) {
return queryPagerdutyRemoteScopes(connection, apiClient, groupId, page, "")
return queryPagerdutyRemoteScopes(apiClient, groupId, page, "")
}

func searchPagerdutyRemoteScopes(
Expand All @@ -122,7 +123,7 @@ func searchPagerdutyRemoteScopes(
children []dsmodels.DsRemoteApiScopeListEntry[models.Service],
err errors.Error,
) {
children, _, err = queryPagerdutyRemoteScopes(nil, apiClient, "", PagerdutyRemotePagination{
children, _, err = queryPagerdutyRemoteScopes(apiClient, "", PagerdutyRemotePagination{
Offset: (params.Page - 1) * params.PageSize,
Limit: params.PageSize,
}, params.Search)
Expand Down

0 comments on commit 2bfc400

Please sign in to comment.