/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import * as components from "../components/index.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type ListAuditLogsGlobals = { merchantAccountId?: string | undefined; }; export type ListAuditLogsRequest = { /** * A pointer to the page of results to return. */ cursor?: string | null | undefined; /** * The maximum number of items that are at returned. */ limit?: number | undefined; /** * Filters the results to only the items for which the `audit-log` has an `action` that matches this value. */ action?: components.AuditLogAction | null | undefined; /** * Filters the results to only the items for which the `user` has an `id` that matches this value. */ userId?: string | null | undefined; /** * Filters the results to only the items for which the `audit-log` has a `resource` that matches this type value. */ resourceType?: string | null | undefined; /** * The ID of the merchant account to use for this request. */ merchantAccountId?: string | null | undefined; }; export type ListAuditLogsResponse = { result: components.AuditLogEntries; }; /** @internal */ export type ListAuditLogsRequest$Outbound = { cursor?: string | null | undefined; limit: number; action?: string | null | undefined; user_id?: string | null | undefined; resource_type?: string | null | undefined; merchantAccountId?: string | null | undefined; }; /** @internal */ export const ListAuditLogsRequest$outboundSchema: z.ZodType< ListAuditLogsRequest$Outbound, z.ZodTypeDef, ListAuditLogsRequest > = z.object({ cursor: z.nullable(z.string()).optional(), limit: z.number().int().default(20), action: z.nullable(components.AuditLogAction$outboundSchema).optional(), userId: z.nullable(z.string()).optional(), resourceType: z.nullable(z.string()).optional(), merchantAccountId: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { userId: "user_id", resourceType: "resource_type", }); }); export function listAuditLogsRequestToJSON( listAuditLogsRequest: ListAuditLogsRequest, ): string { return JSON.stringify( ListAuditLogsRequest$outboundSchema.parse(listAuditLogsRequest), ); } /** @internal */ export const ListAuditLogsResponse$inboundSchema: z.ZodType< ListAuditLogsResponse, z.ZodTypeDef, unknown > = z.object({ Result: components.AuditLogEntries$inboundSchema, }).transform((v) => { return remap$(v, { "Result": "result", }); }); export function listAuditLogsResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListAuditLogsResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListAuditLogsResponse' from JSON`, ); }