UNPKG

attio-js

Version:

Developer-friendly & type-safe JS/TS SDK based on the official OpenAPI spec of Attio.

143 lines (127 loc) 4.01 kB
/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { Task, Task$inboundSchema, Task$Outbound, Task$outboundSchema, } from "../components/task.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type GetV2TasksTaskIdRequest = { taskId: string; }; /** * Success */ export type GetV2TasksTaskIdResponse = { data: Task; }; /** @internal */ export const GetV2TasksTaskIdRequest$inboundSchema: z.ZodType< GetV2TasksTaskIdRequest, z.ZodTypeDef, unknown > = z.object({ task_id: z.string(), }).transform((v) => { return remap$(v, { "task_id": "taskId", }); }); /** @internal */ export type GetV2TasksTaskIdRequest$Outbound = { task_id: string; }; /** @internal */ export const GetV2TasksTaskIdRequest$outboundSchema: z.ZodType< GetV2TasksTaskIdRequest$Outbound, z.ZodTypeDef, GetV2TasksTaskIdRequest > = z.object({ taskId: z.string(), }).transform((v) => { return remap$(v, { taskId: "task_id", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace GetV2TasksTaskIdRequest$ { /** @deprecated use `GetV2TasksTaskIdRequest$inboundSchema` instead. */ export const inboundSchema = GetV2TasksTaskIdRequest$inboundSchema; /** @deprecated use `GetV2TasksTaskIdRequest$outboundSchema` instead. */ export const outboundSchema = GetV2TasksTaskIdRequest$outboundSchema; /** @deprecated use `GetV2TasksTaskIdRequest$Outbound` instead. */ export type Outbound = GetV2TasksTaskIdRequest$Outbound; } export function getV2TasksTaskIdRequestToJSON( getV2TasksTaskIdRequest: GetV2TasksTaskIdRequest, ): string { return JSON.stringify( GetV2TasksTaskIdRequest$outboundSchema.parse(getV2TasksTaskIdRequest), ); } export function getV2TasksTaskIdRequestFromJSON( jsonString: string, ): SafeParseResult<GetV2TasksTaskIdRequest, SDKValidationError> { return safeParse( jsonString, (x) => GetV2TasksTaskIdRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetV2TasksTaskIdRequest' from JSON`, ); } /** @internal */ export const GetV2TasksTaskIdResponse$inboundSchema: z.ZodType< GetV2TasksTaskIdResponse, z.ZodTypeDef, unknown > = z.object({ data: Task$inboundSchema, }); /** @internal */ export type GetV2TasksTaskIdResponse$Outbound = { data: Task$Outbound; }; /** @internal */ export const GetV2TasksTaskIdResponse$outboundSchema: z.ZodType< GetV2TasksTaskIdResponse$Outbound, z.ZodTypeDef, GetV2TasksTaskIdResponse > = z.object({ data: Task$outboundSchema, }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace GetV2TasksTaskIdResponse$ { /** @deprecated use `GetV2TasksTaskIdResponse$inboundSchema` instead. */ export const inboundSchema = GetV2TasksTaskIdResponse$inboundSchema; /** @deprecated use `GetV2TasksTaskIdResponse$outboundSchema` instead. */ export const outboundSchema = GetV2TasksTaskIdResponse$outboundSchema; /** @deprecated use `GetV2TasksTaskIdResponse$Outbound` instead. */ export type Outbound = GetV2TasksTaskIdResponse$Outbound; } export function getV2TasksTaskIdResponseToJSON( getV2TasksTaskIdResponse: GetV2TasksTaskIdResponse, ): string { return JSON.stringify( GetV2TasksTaskIdResponse$outboundSchema.parse(getV2TasksTaskIdResponse), ); } export function getV2TasksTaskIdResponseFromJSON( jsonString: string, ): SafeParseResult<GetV2TasksTaskIdResponse, SDKValidationError> { return safeParse( jsonString, (x) => GetV2TasksTaskIdResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetV2TasksTaskIdResponse' from JSON`, ); }