Skip to content

Commit

Permalink
Audit logs api (fireblocks#240)
Browse files Browse the repository at this point in the history
* COR-29935: Updated audits API

* COR-29935: Added jsdoc param

* COR-29935: Paginated audit logs
  • Loading branch information
dean-ab authored Jan 7, 2024
1 parent 9e86110 commit 4c1d3e1
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 6 deletions.
27 changes: 21 additions & 6 deletions src/fireblocks-sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ import {
ScreeningTenantConfiguration,
ScreeningType,
ScreeningConfigurationsResponse,
ScreeningPolicyRuleResponse, ScreeningProviderConfigurationResponse,
ScreeningPolicyRuleResponse, ScreeningProviderConfigurationResponse, AuditLogsResponse,
} from "./types";
import { AxiosProxyConfig, AxiosResponse } from "axios";
import { PIIEncryption } from "./pii-client";
Expand Down Expand Up @@ -1565,13 +1565,28 @@ export class FireblocksSDK {
/**
* Gets all audits for selected time period
* @param timePeriod
* @param cursor
*/
public async getAudits(timePeriod?: TimePeriod): Promise<AuditsResponse> {
let url = `/v1/audits`;
if (timePeriod) {
url += `?timePeriod=${timePeriod}`;
}
return await this.apiClient.issueGetRequest(url);
const queryParams = {
timePeriod,
};

return await this.apiClient.issueGetRequest(`/v1/audits?${queryString.stringify(queryParams)}`);
}

/**
* Gets paginated audit logs for selected time period
* @param timePeriod
* @param cursor
*/
public async getPaginatedAuditLogs(timePeriod?: TimePeriod, cursor?: string): Promise<AuditLogsResponse> {
const queryParams = {
timePeriod,
cursor,
};

return await this.apiClient.issueGetRequest(`/v1/management/audit_logs?${queryString.stringify(queryParams)}`);
}

/**
Expand Down
4 changes: 4 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1577,6 +1577,10 @@ export interface AuditsResponse {
total: number;
}

export interface AuditLogsResponse extends AuditsResponse {
cursor: string | null;
}

export interface ISystemMessageInfo {
type: string;
message: string;
Expand Down

0 comments on commit 4c1d3e1

Please sign in to comment.