/* * 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"; export type ApproveBountySubmissionRequestBody = { /** * The reward amount for the performance-based bounty. Applicable if the bounty reward amount is not set. */ rewardAmount?: number | null | undefined; }; export type ApproveBountySubmissionRequest = { /** * The ID of the bounty */ bountyId: string; /** * The ID of the bounty submission */ submissionId: string; requestBody?: ApproveBountySubmissionRequestBody | undefined; }; export type ApproveBountySubmissionFiles = { /** * 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 ApproveBountySubmissionStatus = { Draft: "draft", Submitted: "submitted", Approved: "approved", Rejected: "rejected", } as const; /** * The status of the submission */ export type ApproveBountySubmissionStatus = ClosedEnum< typeof ApproveBountySubmissionStatus >; /** * The approved bounty submission. */ export type ApproveBountySubmissionResponseBody = { /** * 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: ApproveBountySubmissionStatus; /** * 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 type ApproveBountySubmissionRequestBody$Outbound = { rewardAmount?: number | null | undefined; }; /** @internal */ export const ApproveBountySubmissionRequestBody$outboundSchema: z.ZodType< ApproveBountySubmissionRequestBody$Outbound, z.ZodTypeDef, ApproveBountySubmissionRequestBody > = z.object({ rewardAmount: z.nullable(z.number()).optional(), }); export function approveBountySubmissionRequestBodyToJSON( approveBountySubmissionRequestBody: ApproveBountySubmissionRequestBody, ): string { return JSON.stringify( ApproveBountySubmissionRequestBody$outboundSchema.parse( approveBountySubmissionRequestBody, ), ); } /** @internal */ export type ApproveBountySubmissionRequest$Outbound = { bountyId: string; submissionId: string; RequestBody?: ApproveBountySubmissionRequestBody$Outbound | undefined; }; /** @internal */ export const ApproveBountySubmissionRequest$outboundSchema: z.ZodType< ApproveBountySubmissionRequest$Outbound, z.ZodTypeDef, ApproveBountySubmissionRequest > = z.object({ bountyId: z.string(), submissionId: z.string(), requestBody: z.lazy(() => ApproveBountySubmissionRequestBody$outboundSchema) .optional(), }).transform((v) => { return remap$(v, { requestBody: "RequestBody", }); }); export function approveBountySubmissionRequestToJSON( approveBountySubmissionRequest: ApproveBountySubmissionRequest, ): string { return JSON.stringify( ApproveBountySubmissionRequest$outboundSchema.parse( approveBountySubmissionRequest, ), ); } /** @internal */ export const ApproveBountySubmissionFiles$inboundSchema: z.ZodType< ApproveBountySubmissionFiles, z.ZodTypeDef, unknown > = z.object({ url: z.string(), fileName: z.string(), size: z.number(), }); export function approveBountySubmissionFilesFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ApproveBountySubmissionFiles$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ApproveBountySubmissionFiles' from JSON`, ); } /** @internal */ export const ApproveBountySubmissionStatus$inboundSchema: z.ZodNativeEnum< typeof ApproveBountySubmissionStatus > = z.nativeEnum(ApproveBountySubmissionStatus); /** @internal */ export const ApproveBountySubmissionResponseBody$inboundSchema: z.ZodType< ApproveBountySubmissionResponseBody, 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(() => ApproveBountySubmissionFiles$inboundSchema)), ), status: ApproveBountySubmissionStatus$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 approveBountySubmissionResponseBodyFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ApproveBountySubmissionResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ApproveBountySubmissionResponseBody' from JSON`, ); }