Skip to content
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
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
configured_endpoints: 127
configured_endpoints: 134
34 changes: 31 additions & 3 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,16 @@ Methods:

# Auth

## Context

Types:

- <code><a href="./src/resources/auth/context.ts">AuthContext</a></code>

Methods:

- <code title="get /auth/context">client.auth.context.<a href="./src/resources/auth/context.ts">retrieve</a>() -> AuthContext</code>

## Connections

Types:
Expand Down Expand Up @@ -404,12 +414,30 @@ Methods:

Types:

- <code><a href="./src/resources/audit-logs.ts">AuditLogEntry</a></code>
- <code><a href="./src/resources/audit-logs/audit-logs.ts">AuditLogEntry</a></code>

Methods:

- <code title="get /audit-logs">client.auditLogs.<a href="./src/resources/audit-logs/audit-logs.ts">list</a>({ ...params }) -> AuditLogEntriesPageTokenPagination</code>
- <code title="get /audit-logs/export/chunk">client.auditLogs.<a href="./src/resources/audit-logs/audit-logs.ts">exportChunk</a>({ ...params }) -> Response</code>

## ExportDestinations

Types:

- <code><a href="./src/resources/audit-logs/export-destinations.ts">AuditLogExportDestination</a></code>
- <code><a href="./src/resources/audit-logs/export-destinations.ts">AuditLogExportDestinationTestResult</a></code>
- <code><a href="./src/resources/audit-logs/export-destinations.ts">CreateAuditLogExportDestinationRequest</a></code>
- <code><a href="./src/resources/audit-logs/export-destinations.ts">UpdateAuditLogExportDestinationRequest</a></code>

Methods:

- <code title="get /audit-logs">client.auditLogs.<a href="./src/resources/audit-logs.ts">list</a>({ ...params }) -> AuditLogEntriesPageTokenPagination</code>
- <code title="get /audit-logs/export/chunk">client.auditLogs.<a href="./src/resources/audit-logs.ts">exportChunk</a>({ ...params }) -> Response</code>
- <code title="post /audit-logs/export/destinations">client.auditLogs.exportDestinations.<a href="./src/resources/audit-logs/export-destinations.ts">create</a>({ ...params }) -> AuditLogExportDestination</code>
- <code title="get /audit-logs/export/destinations/{id}">client.auditLogs.exportDestinations.<a href="./src/resources/audit-logs/export-destinations.ts">retrieve</a>(id) -> AuditLogExportDestination</code>
- <code title="patch /audit-logs/export/destinations/{id}">client.auditLogs.exportDestinations.<a href="./src/resources/audit-logs/export-destinations.ts">update</a>(id, { ...params }) -> AuditLogExportDestination</code>
- <code title="get /audit-logs/export/destinations">client.auditLogs.exportDestinations.<a href="./src/resources/audit-logs/export-destinations.ts">list</a>({ ...params }) -> AuditLogExportDestinationsOffsetPagination</code>
- <code title="delete /audit-logs/export/destinations/{id}">client.auditLogs.exportDestinations.<a href="./src/resources/audit-logs/export-destinations.ts">delete</a>(id) -> void</code>
- <code title="post /audit-logs/export/destinations/{id}/test">client.auditLogs.exportDestinations.<a href="./src/resources/audit-logs/export-destinations.ts">test</a>(id) -> AuditLogExportDestinationTestResult</code>

# APIKeys

Expand Down
14 changes: 7 additions & 7 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,6 @@ import {
browserRoutingSubresourcesFromEnv,
createRoutingFetch,
} from './lib/browser-routing';
import {
AuditLogEntriesPageTokenPagination,
AuditLogEntry,
AuditLogExportChunkParams,
AuditLogListParams,
AuditLogs,
} from './resources/audit-logs';
import {
BrowserPool,
BrowserPoolAcquireParams,
Expand Down Expand Up @@ -143,6 +136,13 @@ import {
ProxyUpdateParams,
ProxyUpdateResponse,
} from './resources/proxies';
import {
AuditLogEntriesPageTokenPagination,
AuditLogEntry,
AuditLogExportChunkParams,
AuditLogListParams,
AuditLogs,
} from './resources/audit-logs/audit-logs';
import { Auth } from './resources/auth/auth';
import {
BrowserCreateParams,
Expand Down
250 changes: 1 addition & 249 deletions src/resources/audit-logs.ts
Original file line number Diff line number Diff line change
@@ -1,251 +1,3 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

import { APIResource } from '../core/resource';
import { APIPromise } from '../core/api-promise';
import { PagePromise, PageTokenPagination, type PageTokenPaginationParams } from '../core/pagination';
import { buildHeaders } from '../internal/headers';
import { RequestOptions } from '../internal/request-options';
import {
downloadAuditLogs,
type AuditLogDownloadDestination,
type AuditLogDownloadOptions,
type AuditLogDownloadParams,
type AuditLogDownloadProgress,
type AuditLogDownloadResult,
} from '../lib/audit-log-download';

export type {
AuditLogDownloadDestination,
AuditLogDownloadOptions,
AuditLogDownloadParams,
AuditLogDownloadProgress,
AuditLogDownloadResult,
} from '../lib/audit-log-download';

/**
* Read audit log records for the authenticated organization.
*/
export class AuditLogs extends APIResource {
/**
* API for searching audit logs. Limited to at most 30 day search, returns up to
* 100 records per page. Not recommended for bulk export.
*/
list(
query: AuditLogListParams,
options?: RequestOptions,
): PagePromise<AuditLogEntriesPageTokenPagination, AuditLogEntry> {
return this._client.getAPIList('/audit-logs', PageTokenPagination<AuditLogEntry>, { query, ...options });
}

/**
* Download an organization's audit log records for a time range as a file, for
* archival, compliance, or offline analysis. For interactive browsing, use GET
* /audit-logs.
*/
exportChunk(query: AuditLogExportChunkParams, options?: RequestOptions): APIPromise<Response> {
return this._client.get('/audit-logs/export/chunk', {
query,
...options,
headers: buildHeaders([{ Accept: 'application/octet-stream' }, options?.headers]),
__binaryResponse: true,
});
}

/**
* Download a complete gzip-compressed JSON Lines audit log export to a writable
* destination. The SDK verifies every chunk and retries transient transfer
* failures. It does not close the destination. If the download fails, the
* destination may contain a partial export; use a temporary file and atomic
* rename when the completed export must be published atomically.
*/
download(
query: AuditLogDownloadParams,
destination: AuditLogDownloadDestination,
options?: AuditLogDownloadOptions,
): Promise<AuditLogDownloadResult> {
return downloadAuditLogs(
(chunkQuery, chunkOptions) => this.exportChunk(chunkQuery, chunkOptions),
query,
destination,
this._client.timeout,
options,
);
}
}

export type AuditLogEntriesPageTokenPagination = PageTokenPagination<AuditLogEntry>;

export interface AuditLogEntry {
/**
* Authentication strategy used for the request.
*/
auth_strategy: string;

/**
* Client IP address.
*/
client_ip: string;

/**
* Request host.
*/
domain: string;

/**
* Request duration in milliseconds.
*/
duration_ms: number;

/**
* Email of the authenticated user at request time, if any.
*/
email: string;

/**
* HTTP method.
*/
method: string;

/**
* Request path.
*/
path: string;

/**
* Matched API route pattern, if available.
*/
route: string;

/**
* HTTP response status code.
*/
status: number;

/**
* UTC time when the request was received.
*/
timestamp: string;

/**
* User agent header.
*/
user_agent: string;

/**
* ID of the authenticated user, if any.
*/
user_id: string;
}

export interface AuditLogListParams extends PageTokenPaginationParams {
/**
* Upper bound (exclusive) for the audit record timestamp.
*/
end: string;

/**
* Lower bound (inclusive) for the audit record timestamp.
*/
start: string;

/**
* Filter by authentication strategy.
*/
auth_strategy?: string;

/**
* Filter out results by HTTP method.
*/
exclude_method?: Array<string>;

/**
* Filter by HTTP method.
*/
method?: string;

/**
* Free-text search over path, user ID, email, client IP, and status.
*/
search?: string;

/**
* Additional user IDs to OR into free-text search.
*/
search_user_id?: Array<string>;

/**
* Filter by service name.
*/
service?: string;
}

export interface AuditLogExportChunkParams {
/**
* Upper bound (exclusive) for the audit record timestamp.
*/
end: string;

/**
* Lower bound (inclusive) for the audit record timestamp.
*/
start: string;

/**
* Filter by authentication strategy.
*/
auth_strategy?: string;

/**
* Opaque cursor from X-Next-Cursor for the next chunk of older records.
*/
cursor?: string;

/**
* Filter out results by HTTP method.
*/
exclude_method?: Array<string>;

/**
* Encoding for the returned chunk.
*/
format?: 'jsonl' | 'jsonl.gz';

/**
* Maximum number of records to return in this chunk.
*/
limit?: number;

/**
* Filter by HTTP method.
*/
method?: string;

/**
* Free-text search over path, user ID, email, client IP, and status.
*/
search?: string;

/**
* Additional user IDs to OR into free-text search.
*/
search_user_id?: Array<string>;

/**
* Filter by service name.
*/
service?: string;
}

export declare namespace AuditLogs {
export {
type AuditLogEntry as AuditLogEntry,
type AuditLogEntriesPageTokenPagination as AuditLogEntriesPageTokenPagination,
type AuditLogListParams as AuditLogListParams,
type AuditLogExportChunkParams as AuditLogExportChunkParams,
type AuditLogDownloadDestination as AuditLogDownloadDestination,
type AuditLogDownloadOptions as AuditLogDownloadOptions,
type AuditLogDownloadParams as AuditLogDownloadParams,
type AuditLogDownloadProgress as AuditLogDownloadProgress,
type AuditLogDownloadResult as AuditLogDownloadResult,
};
}
export * from './audit-logs/index';
Loading
Loading