/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; 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 status of the submissions to list. */ export const ListBountySubmissionsQueryParamStatus = { Draft: "draft", Submitted: "submitted", Approved: "approved", Rejected: "rejected", } as const; /** * The status of the submissions to list. */ export type ListBountySubmissionsQueryParamStatus = ClosedEnum< typeof ListBountySubmissionsQueryParamStatus >; /** * The field to sort the submissions by. */ export const ListBountySubmissionsQueryParamSortBy = { CompletedAt: "completedAt", PerformanceCount: "performanceCount", SocialMetricCount: "socialMetricCount", } as const; /** * The field to sort the submissions by. */ export type ListBountySubmissionsQueryParamSortBy = ClosedEnum< typeof ListBountySubmissionsQueryParamSortBy >; /** * The order to sort the submissions by. */ export const ListBountySubmissionsQueryParamSortOrder = { Asc: "asc", Desc: "desc", } as const; /** * The order to sort the submissions by. */ export type ListBountySubmissionsQueryParamSortOrder = ClosedEnum< typeof ListBountySubmissionsQueryParamSortOrder >; export type ListBountySubmissionsRequest = { /** * The unique ID of the bounty on Dub. Can be found in the URL of the bounty page, prefixed with `bnty_`. */ bountyId: string; /** * The status of the submissions to list. */ status?: ListBountySubmissionsQueryParamStatus | undefined; /** * The ID of the group to list submissions for. */ groupId?: string | undefined; /** * The ID of the partner to list submissions for. */ partnerId?: string | undefined; /** * The field to sort the submissions by. */ sortBy?: ListBountySubmissionsQueryParamSortBy | undefined; /** * The order to sort the submissions by. */ sortOrder?: ListBountySubmissionsQueryParamSortOrder | undefined; /** * The page number for pagination. */ page?: number | undefined; /** * The number of items per page. */ pageSize?: number | undefined; }; export type Files = { /** * 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 ListBountySubmissionsStatus = { Draft: "draft", Submitted: "submitted", Approved: "approved", Rejected: "rejected", } as const; /** * The status of the submission */ export type ListBountySubmissionsStatus = ClosedEnum< typeof ListBountySubmissionsStatus >; export type ListBountySubmissionsResponseBody = { /** * 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: ListBountySubmissionsStatus; /** * 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 ListBountySubmissionsQueryParamStatus$outboundSchema: z.ZodNativeEnum = z.nativeEnum( ListBountySubmissionsQueryParamStatus, ); /** @internal */ export const ListBountySubmissionsQueryParamSortBy$outboundSchema: z.ZodNativeEnum = z.nativeEnum( ListBountySubmissionsQueryParamSortBy, ); /** @internal */ export const ListBountySubmissionsQueryParamSortOrder$outboundSchema: z.ZodNativeEnum = z .nativeEnum(ListBountySubmissionsQueryParamSortOrder); /** @internal */ export type ListBountySubmissionsRequest$Outbound = { bountyId: string; status?: string | undefined; groupId?: string | undefined; partnerId?: string | undefined; sortBy: string; sortOrder: string; page?: number | undefined; pageSize: number; }; /** @internal */ export const ListBountySubmissionsRequest$outboundSchema: z.ZodType< ListBountySubmissionsRequest$Outbound, z.ZodTypeDef, ListBountySubmissionsRequest > = z.object({ bountyId: z.string(), status: ListBountySubmissionsQueryParamStatus$outboundSchema.optional(), groupId: z.string().optional(), partnerId: z.string().optional(), sortBy: ListBountySubmissionsQueryParamSortBy$outboundSchema.default( "completedAt", ), sortOrder: ListBountySubmissionsQueryParamSortOrder$outboundSchema.default( "asc", ), page: z.number().optional(), pageSize: z.number().default(100), }); export function listBountySubmissionsRequestToJSON( listBountySubmissionsRequest: ListBountySubmissionsRequest, ): string { return JSON.stringify( ListBountySubmissionsRequest$outboundSchema.parse( listBountySubmissionsRequest, ), ); } /** @internal */ export const Files$inboundSchema: z.ZodType = z .object({ url: z.string(), fileName: z.string(), size: z.number(), }); export function filesFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Files$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Files' from JSON`, ); } /** @internal */ export const ListBountySubmissionsStatus$inboundSchema: z.ZodNativeEnum< typeof ListBountySubmissionsStatus > = z.nativeEnum(ListBountySubmissionsStatus); /** @internal */ export const ListBountySubmissionsResponseBody$inboundSchema: z.ZodType< ListBountySubmissionsResponseBody, 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(() => Files$inboundSchema))), status: ListBountySubmissionsStatus$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 listBountySubmissionsResponseBodyFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListBountySubmissionsResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListBountySubmissionsResponseBody' from JSON`, ); }