11// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22
33import { APIResource } from '../core/resource' ;
4+ import { APIPromise } from '../core/api-promise' ;
45import { PagePromise , PageTokenPagination , type PageTokenPaginationParams } from '../core/pagination' ;
6+ import { buildHeaders } from '../internal/headers' ;
57import { RequestOptions } from '../internal/request-options' ;
68
79/**
@@ -18,6 +20,20 @@ export class AuditLogs extends APIResource {
1820 ) : PagePromise < AuditLogEntriesPageTokenPagination , AuditLogEntry > {
1921 return this . _client . getAPIList ( '/audit-logs' , PageTokenPagination < AuditLogEntry > , { query, ...options } ) ;
2022 }
23+
24+ /**
25+ * Download an organization's audit log records for a time range as a file, for
26+ * archival, compliance, or offline analysis. For interactive browsing, use GET
27+ * /audit-logs.
28+ */
29+ exportChunk ( query : AuditLogExportChunkParams , options ?: RequestOptions ) : APIPromise < Response > {
30+ return this . _client . get ( '/audit-logs/export/chunk' , {
31+ query,
32+ ...options ,
33+ headers : buildHeaders ( [ { Accept : 'application/octet-stream' } , options ?. headers ] ) ,
34+ __binaryResponse : true ,
35+ } ) ;
36+ }
2137}
2238
2339export type AuditLogEntriesPageTokenPagination = PageTokenPagination < AuditLogEntry > ;
@@ -126,10 +142,68 @@ export interface AuditLogListParams extends PageTokenPaginationParams {
126142 service ?: string ;
127143}
128144
145+ export interface AuditLogExportChunkParams {
146+ /**
147+ * Upper bound (exclusive) for the audit record timestamp.
148+ */
149+ end : string ;
150+
151+ /**
152+ * Lower bound (inclusive) for the audit record timestamp.
153+ */
154+ start : string ;
155+
156+ /**
157+ * Filter by authentication strategy.
158+ */
159+ auth_strategy ?: string ;
160+
161+ /**
162+ * Opaque cursor from X-Next-Cursor for the next chunk of older records.
163+ */
164+ cursor ?: string ;
165+
166+ /**
167+ * Filter out results by HTTP method.
168+ */
169+ exclude_method ?: string ;
170+
171+ /**
172+ * Encoding for the returned chunk.
173+ */
174+ format ?: 'jsonl' | 'jsonl.gz' ;
175+
176+ /**
177+ * Maximum number of records to return in this chunk.
178+ */
179+ limit ?: number ;
180+
181+ /**
182+ * Filter by HTTP method.
183+ */
184+ method ?: string ;
185+
186+ /**
187+ * Free-text search over path, user ID, email, client IP, and status.
188+ */
189+ search ?: string ;
190+
191+ /**
192+ * Additional user IDs to OR into free-text search.
193+ */
194+ search_user_id ?: Array < string > ;
195+
196+ /**
197+ * Filter by service name.
198+ */
199+ service ?: string ;
200+ }
201+
129202export declare namespace AuditLogs {
130203 export {
131204 type AuditLogEntry as AuditLogEntry ,
132205 type AuditLogEntriesPageTokenPagination as AuditLogEntriesPageTokenPagination ,
133206 type AuditLogListParams as AuditLogListParams ,
207+ type AuditLogExportChunkParams as AuditLogExportChunkParams ,
134208 } ;
135209}
0 commit comments