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

Audit logs api #240

Merged
merged 5 commits into from
Jan 7, 2024
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
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 @@ -1576,6 +1576,10 @@ export interface AuditsResponse {
total: number;
}

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

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