/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v4-mini"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { Scope, Scope$inboundSchema } from "./scope.js"; export type OrganizationAccessToken = { /** * Creation timestamp of the object. */ createdAt: Date; /** * Last modification timestamp of the object. */ modifiedAt: Date | null; id: string; scopes: Array; expiresAt: Date | null; comment: string; lastUsedAt: Date | null; /** * The organization ID. */ organizationId: string; }; /** @internal */ export const OrganizationAccessToken$inboundSchema: z.ZodMiniType< OrganizationAccessToken, unknown > = z.pipe( z.object({ created_at: z.pipe( z.iso.datetime({ offset: true }), z.transform(v => new Date(v)), ), modified_at: z.nullable( z.pipe(z.iso.datetime({ offset: true }), z.transform(v => new Date(v))), ), id: z.string(), scopes: z.array(Scope$inboundSchema), expires_at: z.nullable( z.pipe(z.iso.datetime({ offset: true }), z.transform(v => new Date(v))), ), comment: z.string(), last_used_at: z.nullable( z.pipe(z.iso.datetime({ offset: true }), z.transform(v => new Date(v))), ), organization_id: z.string(), }), z.transform((v) => { return remap$(v, { "created_at": "createdAt", "modified_at": "modifiedAt", "expires_at": "expiresAt", "last_used_at": "lastUsedAt", "organization_id": "organizationId", }); }), ); export function organizationAccessTokenFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => OrganizationAccessToken$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OrganizationAccessToken' from JSON`, ); }