UNPKG

@unkey/api

Version:

Developer-friendly & type-safe Typescript SDK specifically catered to leverage *@unkey/api* API.

53 lines (48 loc) 1.96 kB
/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { Meta, Meta$inboundSchema } from "./meta.js"; import { Permission, Permission$inboundSchema } from "./permission.js"; export type V2KeysSetPermissionsResponseBody = { /** * Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team. */ meta: Meta; /** * Complete list of all permissions now directly assigned to the key after the set operation has completed. * * @remarks * * The response includes: * - The comprehensive, updated set of direct permissions (reflecting the complete replacement) * - Both ID and name for each permission for easy reference * * Important notes: * - This only shows direct permissions, not those granted through roles * - An empty array means the key has no direct permissions assigned * - For a complete permission picture including roles, use keys.getKey instead */ data: Array<Permission>; }; /** @internal */ export const V2KeysSetPermissionsResponseBody$inboundSchema: z.ZodType< V2KeysSetPermissionsResponseBody, z.ZodTypeDef, unknown > = z.object({ meta: Meta$inboundSchema, data: z.array(Permission$inboundSchema), }); export function v2KeysSetPermissionsResponseBodyFromJSON( jsonString: string, ): SafeParseResult<V2KeysSetPermissionsResponseBody, SDKValidationError> { return safeParse( jsonString, (x) => V2KeysSetPermissionsResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'V2KeysSetPermissionsResponseBody' from JSON`, ); }