Skip to content

Commit

Permalink
feat: GET /details API client can send multiple sort_by query params (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
benwaples authored Dec 20, 2024
1 parent 3136941 commit 67e986c
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions packages/javascript/js-client-library/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -534,17 +534,22 @@ class BHEAPIClient {
skip: number,
limit: number,
filterAccepted?: boolean,
sortBy?: string,
sortBy?: string | string[],
options?: types.RequestOptions
) => {
const params: types.RiskDetailsRequest = {
finding: finding,
skip: skip,
limit: limit,
sort_by: sortBy,
};
const params = new URLSearchParams();
params.append('finding', finding);
params.append('skip', skip.toString());
params.append('limit', limit.toString());
if (sortBy) {
if (typeof sortBy === 'string') {
params.append('sort_by', sortBy);
} else {
sortBy.forEach((sort) => params.append('sort_by', sort));
}
}

if (typeof filterAccepted === 'boolean') params.Accepted = `eq:${filterAccepted}`;
if (typeof filterAccepted === 'boolean') params.append('Accepted', `eq:${filterAccepted}`);

return this.baseClient.get(
`/api/v2/domains/${domainId}/details`,
Expand Down

0 comments on commit 67e986c

Please sign in to comment.