/* * 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 { CertificateAlgorithm, CertificateAlgorithm$outboundSchema, } from "./certificatealgorithm.js"; export type APIKeyPairCreate = { /** * The display name for the API key pair. */ displayName: string; algorithm?: CertificateAlgorithm | undefined; /** * Whether the API key pair should be active and usable once created. */ active?: boolean | undefined; /** * The IDs of the roles to assign to the API key pair. The caller can only assign roles whose scopes are a subset of its own. */ roleIds: Array; /** * The IDs of the merchant accounts to associate with the API key pair. An empty list grants access to all merchant accounts. The caller can only assign merchant accounts it has access to. */ merchantAccountIds?: Array | undefined; /** * A PEM-encoded ECDSA P-521 (ES512) public key. Provide this to register your own key pair (bring your own key); If omitted, Gr4vy will generate the key pair and return the private key. */ publicKey?: string | null | undefined; }; /** @internal */ export type APIKeyPairCreate$Outbound = { display_name: string; algorithm?: string | undefined; active: boolean; role_ids: Array; merchant_account_ids?: Array | undefined; public_key?: string | null | undefined; }; /** @internal */ export const APIKeyPairCreate$outboundSchema: z.ZodType< APIKeyPairCreate$Outbound, z.ZodTypeDef, APIKeyPairCreate > = z.object({ displayName: z.string(), algorithm: CertificateAlgorithm$outboundSchema.optional(), active: z.boolean().default(true), roleIds: z.array(z.string()), merchantAccountIds: z.array(z.string()).optional(), publicKey: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { displayName: "display_name", roleIds: "role_ids", merchantAccountIds: "merchant_account_ids", publicKey: "public_key", }); }); export function apiKeyPairCreateToJSON( apiKeyPairCreate: APIKeyPairCreate, ): string { return JSON.stringify( APIKeyPairCreate$outboundSchema.parse(apiKeyPairCreate), ); }