/* * 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 { ClosedEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * The reason for rejecting the submission. */ export const RejectionReason = { InvalidProof: "invalidProof", DuplicateSubmission: "duplicateSubmission", OutOfTimeWindow: "outOfTimeWindow", DidNotMeetCriteria: "didNotMeetCriteria", Other: "other", } as const; /** * The reason for rejecting the submission. */ export type RejectionReason = ClosedEnum; export type RejectBountySubmissionRequestBody = { /** * The reason for rejecting the submission. */ rejectionReason?: RejectionReason | undefined; /** * The note for rejecting the submission. */ rejectionNote?: string | undefined; }; export type RejectBountySubmissionRequest = { /** * The ID of the bounty */ bountyId: string; /** * The ID of the bounty submission */ submissionId: string; requestBody?: RejectBountySubmissionRequestBody | undefined; }; export type RejectBountySubmissionFiles = { /** * The URL of the uploaded file. */ url: string; /** * The original file name. */ fileName: string; /** * The file size in bytes. */ size: number; }; /** * The status of the submission */ export const RejectBountySubmissionStatus = { Draft: "draft", Submitted: "submitted", Approved: "approved", Rejected: "rejected", } as const; /** * The status of the submission */ export type RejectBountySubmissionStatus = ClosedEnum< typeof RejectBountySubmissionStatus >; /** * The rejected bounty submission. */ export type RejectBountySubmissionResponseBody = { /** * The ID of the bounty submission */ id: string; /** * The ID of the bounty */ bountyId: string; /** * The ID of the partner */ partnerId: string; /** * The description of the submission */ description: string | null; /** * The URLs submitted for the submission */ urls: Array | null; /** * The files uploaded for the submission */ files: Array | null; /** * The status of the submission */ status: RejectBountySubmissionStatus; /** * The performance count of the submission */ performanceCount: number | null; /** * The social metric count (views or likes) for the social content */ socialMetricCount: number | null; /** * The date and time the submission's social metrics were last synced */ socialMetricsLastSyncedAt?: string | null | undefined; /** * The date and time the submission was created */ createdAt: string; /** * The date and time the submission was completed */ completedAt: string | null; /** * The date and time the submission was reviewed */ reviewedAt: string | null; /** * The reason for rejecting the submission */ rejectionReason: string | null; /** * The note for rejecting the submission */ rejectionNote: string | null; /** * The period number for this submission (1-indexed) */ periodNumber: number; }; /** @internal */ export const RejectionReason$outboundSchema: z.ZodNativeEnum< typeof RejectionReason > = z.nativeEnum(RejectionReason); /** @internal */ export type RejectBountySubmissionRequestBody$Outbound = { rejectionReason?: string | undefined; rejectionNote?: string | undefined; }; /** @internal */ export const RejectBountySubmissionRequestBody$outboundSchema: z.ZodType< RejectBountySubmissionRequestBody$Outbound, z.ZodTypeDef, RejectBountySubmissionRequestBody > = z.object({ rejectionReason: RejectionReason$outboundSchema.optional(), rejectionNote: z.string().optional(), }); export function rejectBountySubmissionRequestBodyToJSON( rejectBountySubmissionRequestBody: RejectBountySubmissionRequestBody, ): string { return JSON.stringify( RejectBountySubmissionRequestBody$outboundSchema.parse( rejectBountySubmissionRequestBody, ), ); } /** @internal */ export type RejectBountySubmissionRequest$Outbound = { bountyId: string; submissionId: string; RequestBody?: RejectBountySubmissionRequestBody$Outbound | undefined; }; /** @internal */ export const RejectBountySubmissionRequest$outboundSchema: z.ZodType< RejectBountySubmissionRequest$Outbound, z.ZodTypeDef, RejectBountySubmissionRequest > = z.object({ bountyId: z.string(), submissionId: z.string(), requestBody: z.lazy(() => RejectBountySubmissionRequestBody$outboundSchema) .optional(), }).transform((v) => { return remap$(v, { requestBody: "RequestBody", }); }); export function rejectBountySubmissionRequestToJSON( rejectBountySubmissionRequest: RejectBountySubmissionRequest, ): string { return JSON.stringify( RejectBountySubmissionRequest$outboundSchema.parse( rejectBountySubmissionRequest, ), ); } /** @internal */ export const RejectBountySubmissionFiles$inboundSchema: z.ZodType< RejectBountySubmissionFiles, z.ZodTypeDef, unknown > = z.object({ url: z.string(), fileName: z.string(), size: z.number(), }); export function rejectBountySubmissionFilesFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => RejectBountySubmissionFiles$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'RejectBountySubmissionFiles' from JSON`, ); } /** @internal */ export const RejectBountySubmissionStatus$inboundSchema: z.ZodNativeEnum< typeof RejectBountySubmissionStatus > = z.nativeEnum(RejectBountySubmissionStatus); /** @internal */ export const RejectBountySubmissionResponseBody$inboundSchema: z.ZodType< RejectBountySubmissionResponseBody, z.ZodTypeDef, unknown > = z.object({ id: z.string(), bountyId: z.string(), partnerId: z.string(), description: z.nullable(z.string()), urls: z.nullable(z.array(z.string())), files: z.nullable( z.array(z.lazy(() => RejectBountySubmissionFiles$inboundSchema)), ), status: RejectBountySubmissionStatus$inboundSchema, performanceCount: z.nullable(z.number()), socialMetricCount: z.nullable(z.number().int()), socialMetricsLastSyncedAt: z.nullable(z.string()).optional(), createdAt: z.string(), completedAt: z.nullable(z.string()), reviewedAt: z.nullable(z.string()), rejectionReason: z.nullable(z.string()), rejectionNote: z.nullable(z.string()), periodNumber: z.number().int(), }); export function rejectBountySubmissionResponseBodyFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => RejectBountySubmissionResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'RejectBountySubmissionResponseBody' from JSON`, ); }