Something went wrong. Try again.
Schedule posts and reposts to Bluesky (and other PDSes) with Cloudflare workers. skyscheduler.work
scheduling social-media cloudflare bsky service cloudflare-workers bsky-tool bluesky
Something went wrong. Try again.
2.0 kB · 57 lines
TypeScript
at main
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657// Everything in this file is used for OpenAPI route generation.//// This can be the generally expected results for most endpoints// but not all.import * as z from "zod/v4";import { fileKeyRegex } from "./regexCases";
// Our json response objectsexport const GenericResponseSchema = z.object({ ok: z.boolean().describe("success/failure status check"), msg: z.string().describe("success/error message, could also be formatted as json")});
export const CreatePostResponseSchema = z.object({ ...GenericResponseSchema.shape, id: z.uuidv4().describe("the post/repost id"),});
export const CheckGUIDSchema = z.object({ id: z.uuidv4().describe("the post/repost id")});
export const CheckRepostGUIDSchema = z.object({ ...CheckGUIDSchema.shape, schedule: z.uuidv4().describe("the schedule id for a post")})
export const CheckFileSchema = z.object({ id: z.string().toLowerCase() .regex(fileKeyRegex) .nonempty().describe("the internal file guid name")});
export const FileUploadFailSchema = z.object({ success: z.literal(false), error: z.string().describe("the error message, could also be json")});
export const FileUploadSuccessSchema = z.object({ success: z.literal(true), fileSize: z.number().min(1).describe("the size of the uploaded file"), qualityLevel: z.number().min(1).max(100) .describe("the quality level of the processed file (if compressed/resized)"), data: z.string().describe("internal file guid name"), originalName: z.string().describe("the original file name")});
// These schemas are only used for defining openAPI routes.export const ResetCallbackQuery = z.object({ callbackURL: z.union([z.literal("%2Freset"), z.literal("/reset")]).nonoptional()});
// according to better-auth code, the token will be longer than 10 chars// https://github.com/better-auth/better-auth/blob/0bb0dbf6f38ab53a0c1f2fb639acd7bd602e2a24/packages/test-utils/src/adapter/suites/auth-flow.ts#L113export const ResetTokenValid = z.object({ token: z.string().min(10).nonempty().nonoptional()});