UNPKG

@vercel/sdk

Version:

<p align="center"> <a href="https://vercel.com"> <img src="https://assets.vercel.com/image/upload/v1588805858/repositories/vercel/logo.png" height="96"> <h3 align="center">Vercel</h3> </a> <p align="center">Develop. Preview. Ship.</p> </p>

142 lines (133 loc) 4.29 kB
/* * 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 types from "../types/primitives.js"; import { SDKValidationError } from "./sdkvalidationerror.js"; export type UploadArtifactRequest = { /** * The artifact size in bytes */ contentLength?: number | undefined; /** * The time taken to generate the uploaded artifact in milliseconds. */ xArtifactDuration?: number | undefined; /** * The continuous integration or delivery environment where this artifact was generated. */ xArtifactClientCi?: string | undefined; /** * 1 if the client is an interactive shell. Otherwise 0 */ xArtifactClientInteractive?: number | undefined; /** * The base64 encoded tag for this artifact. The value is sent back to clients when the artifact is downloaded as the header `x-artifact-tag` */ xArtifactTag?: string | undefined; /** * The SHA of the source control revision that generated this artifact. */ xArtifactSha?: string | undefined; /** * A hash representing uncommitted changes in the working directory when this artifact was generated. */ xArtifactDirtyHash?: string | undefined; /** * The artifact hash */ hash: string; /** * The Team identifier to perform the request on behalf of. */ teamId?: string | undefined; /** * The Team slug to perform the request on behalf of. */ slug?: string | undefined; requestBody: ReadableStream<Uint8Array> | Blob | ArrayBuffer | Uint8Array; }; /** * File successfully uploaded */ export type UploadArtifactResponseBody = { /** * Array of URLs where the artifact was updated */ urls: Array<string>; }; /** @internal */ export type UploadArtifactRequest$Outbound = { "'content-Length'"?: number | undefined; "'x-Artifact-Duration'"?: number | undefined; "'x-Artifact-Client-Ci'"?: string | undefined; "'x-Artifact-Client-Interactive'"?: number | undefined; "'x-Artifact-Tag'"?: string | undefined; "'x-Artifact-Sha'"?: string | undefined; "'x-Artifact-Dirty-Hash'"?: string | undefined; hash: string; teamId?: string | undefined; slug?: string | undefined; RequestBody: ReadableStream<Uint8Array> | Blob | ArrayBuffer | Uint8Array; }; /** @internal */ export const UploadArtifactRequest$outboundSchema: z.ZodType< UploadArtifactRequest$Outbound, z.ZodTypeDef, UploadArtifactRequest > = z.object({ contentLength: z.number().optional(), xArtifactDuration: z.number().optional(), xArtifactClientCi: z.string().optional(), xArtifactClientInteractive: z.number().int().optional(), xArtifactTag: z.string().optional(), xArtifactSha: z.string().optional(), xArtifactDirtyHash: z.string().optional(), hash: z.string(), teamId: z.string().optional(), slug: z.string().optional(), requestBody: z.union([ z.instanceof(ReadableStream<Uint8Array>), z.instanceof(Blob), z.instanceof(ArrayBuffer), z.instanceof(Uint8Array), ]), }).transform((v) => { return remap$(v, { contentLength: "'content-Length'", xArtifactDuration: "'x-Artifact-Duration'", xArtifactClientCi: "'x-Artifact-Client-Ci'", xArtifactClientInteractive: "'x-Artifact-Client-Interactive'", xArtifactTag: "'x-Artifact-Tag'", xArtifactSha: "'x-Artifact-Sha'", xArtifactDirtyHash: "'x-Artifact-Dirty-Hash'", requestBody: "RequestBody", }); }); export function uploadArtifactRequestToJSON( uploadArtifactRequest: UploadArtifactRequest, ): string { return JSON.stringify( UploadArtifactRequest$outboundSchema.parse(uploadArtifactRequest), ); } /** @internal */ export const UploadArtifactResponseBody$inboundSchema: z.ZodType< UploadArtifactResponseBody, z.ZodTypeDef, unknown > = z.object({ urls: z.array(types.string()), }); export function uploadArtifactResponseBodyFromJSON( jsonString: string, ): SafeParseResult<UploadArtifactResponseBody, SDKValidationError> { return safeParse( jsonString, (x) => UploadArtifactResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UploadArtifactResponseBody' from JSON`, ); }