@crosspost/types
Version:
Shared type definitions for Crosspost API
657 lines (647 loc) • 30.6 kB
JavaScript
// src/common.ts
import { z } from "zod";
var Platform = /* @__PURE__ */ ((Platform2) => {
Platform2["UNKNOWN"] = "unknown";
Platform2["TWITTER"] = "twitter";
return Platform2;
})(Platform || {});
var PlatformSchema = z.nativeEnum(Platform).describe("Social media platform");
var SUPPORTED_PLATFORMS = [
"twitter" /* TWITTER */
// Add more platforms here as they're implemented
];
var SupportedPlatformSchema = SUPPORTED_PLATFORMS.length > 0 ? z.enum(SUPPORTED_PLATFORMS) : z.never();
SupportedPlatformSchema.describe("Currently supported social media platforms");
function isPlatformSupported(platform) {
return SUPPORTED_PLATFORMS.includes(platform);
}
// src/response.ts
import { z as z3 } from "zod";
// src/errors.ts
import { z as z2 } from "zod";
var ApiErrorCode = /* @__PURE__ */ ((ApiErrorCode2) => {
ApiErrorCode2["UNKNOWN_ERROR"] = "UNKNOWN_ERROR";
ApiErrorCode2["INTERNAL_ERROR"] = "INTERNAL_ERROR";
ApiErrorCode2["UNAUTHORIZED"] = "UNAUTHORIZED";
ApiErrorCode2["FORBIDDEN"] = "FORBIDDEN";
ApiErrorCode2["VALIDATION_ERROR"] = "VALIDATION_ERROR";
ApiErrorCode2["INVALID_REQUEST"] = "INVALID_REQUEST";
ApiErrorCode2["RATE_LIMITED"] = "RATE_LIMITED";
ApiErrorCode2["NOT_FOUND"] = "NOT_FOUND";
ApiErrorCode2["PLATFORM_ERROR"] = "PLATFORM_ERROR";
ApiErrorCode2["PLATFORM_UNAVAILABLE"] = "PLATFORM_UNAVAILABLE";
ApiErrorCode2["CONTENT_POLICY_VIOLATION"] = "CONTENT_POLICY_VIOLATION";
ApiErrorCode2["DUPLICATE_CONTENT"] = "DUPLICATE_CONTENT";
ApiErrorCode2["MEDIA_UPLOAD_FAILED"] = "MEDIA_UPLOAD_FAILED";
ApiErrorCode2["MULTI_STATUS"] = "MULTI_STATUS";
ApiErrorCode2["POST_CREATION_FAILED"] = "POST_CREATION_FAILED";
ApiErrorCode2["THREAD_CREATION_FAILED"] = "THREAD_CREATION_FAILED";
ApiErrorCode2["POST_DELETION_FAILED"] = "POST_DELETION_FAILED";
ApiErrorCode2["POST_INTERACTION_FAILED"] = "POST_INTERACTION_FAILED";
ApiErrorCode2["NETWORK_ERROR"] = "NETWORK_ERROR";
ApiErrorCode2["INVALID_RESPONSE"] = "INVALID_RESPONSE";
ApiErrorCode2["TOKEN_REFRESH_FAILED"] = "TOKEN_REFRESH_FAILED";
ApiErrorCode2["PROFILE_REFRESH_FAILED"] = "PROFILE_REFRESH_FAILED";
return ApiErrorCode2;
})(ApiErrorCode || {});
var ApiErrorCodeSchema = z2.enum(Object.values(ApiErrorCode));
var errorCodeToStatusCode = {
["MULTI_STATUS" /* MULTI_STATUS */]: 207,
["UNKNOWN_ERROR" /* UNKNOWN_ERROR */]: 500,
["INTERNAL_ERROR" /* INTERNAL_ERROR */]: 500,
["VALIDATION_ERROR" /* VALIDATION_ERROR */]: 400,
["INVALID_REQUEST" /* INVALID_REQUEST */]: 400,
["NOT_FOUND" /* NOT_FOUND */]: 404,
["UNAUTHORIZED" /* UNAUTHORIZED */]: 401,
["FORBIDDEN" /* FORBIDDEN */]: 403,
["RATE_LIMITED" /* RATE_LIMITED */]: 429,
["PLATFORM_ERROR" /* PLATFORM_ERROR */]: 502,
["PLATFORM_UNAVAILABLE" /* PLATFORM_UNAVAILABLE */]: 503,
["CONTENT_POLICY_VIOLATION" /* CONTENT_POLICY_VIOLATION */]: 400,
["DUPLICATE_CONTENT" /* DUPLICATE_CONTENT */]: 400,
["MEDIA_UPLOAD_FAILED" /* MEDIA_UPLOAD_FAILED */]: 400,
["POST_CREATION_FAILED" /* POST_CREATION_FAILED */]: 500,
["THREAD_CREATION_FAILED" /* THREAD_CREATION_FAILED */]: 500,
["POST_DELETION_FAILED" /* POST_DELETION_FAILED */]: 500,
["POST_INTERACTION_FAILED" /* POST_INTERACTION_FAILED */]: 500,
["NETWORK_ERROR" /* NETWORK_ERROR */]: 503,
["INVALID_RESPONSE" /* INVALID_RESPONSE */]: 500,
["TOKEN_REFRESH_FAILED" /* TOKEN_REFRESH_FAILED */]: 500,
["PROFILE_REFRESH_FAILED" /* PROFILE_REFRESH_FAILED */]: 500
};
var ErrorDetailSchema = z2.object({
message: z2.string().describe("Human-readable error message"),
code: ApiErrorCodeSchema.describe("Machine-readable error code"),
recoverable: z2.boolean().describe("Whether the error can be recovered from"),
details: z2.record(z2.unknown()).optional().describe("Additional error details")
});
// src/response.ts
var ResponseMetaSchema = z3.object({
requestId: z3.string().uuid().describe("Unique identifier for the request"),
timestamp: z3.string().datetime().describe("ISO timestamp of response generation"),
rateLimit: z3.object({
remaining: z3.number().int().nonnegative(),
limit: z3.number().int().positive(),
reset: z3.number().int().positive().describe("Unix timestamp (seconds)")
}).optional().describe("Rate limit information if applicable"),
pagination: z3.object({
limit: z3.number().int().nonnegative().optional(),
offset: z3.number().int().nonnegative().optional(),
total: z3.number().int().nonnegative().optional()
}).optional().describe("Pagination information if applicable")
});
var createSuccessDetailSchema = (detailsSchema = z3.any().optional()) => z3.object({
platform: z3.string(),
userId: z3.string(),
details: detailsSchema,
status: z3.literal("success")
}).catchall(z3.any());
var SuccessDetailSchema = createSuccessDetailSchema();
var HealthStatusSchema = z3.object({
status: z3.string().describe("Health status of the API"),
version: z3.string().optional().describe("API version"),
timestamp: z3.string().datetime().describe("Current server time")
}).describe("Health status response");
var MultiStatusSummarySchema = z3.object({
total: z3.number().int().nonnegative(),
succeeded: z3.number().int().nonnegative(),
failed: z3.number().int().nonnegative()
});
var createMultiStatusDataSchema = (detailsSchema) => z3.object({
summary: MultiStatusSummarySchema,
results: z3.array(
detailsSchema ? createSuccessDetailSchema(detailsSchema) : SuccessDetailSchema
// Uses default createSuccessDetailSchema() if no specific schema passed
),
errors: z3.array(ErrorDetailSchema)
});
var MultiStatusDataSchema = createMultiStatusDataSchema();
// src/auth.ts
import { z as z5 } from "zod";
// src/user-profile.ts
import { z as z4 } from "zod";
var UserProfileSchema = z4.object({
userId: z4.string().describe("User ID on the platform"),
username: z4.string().describe("Username on the platform"),
url: z4.string().url().optional().describe("URL to the user profile"),
profileImageUrl: z4.string().describe("URL to the user profile image"),
isPremium: z4.boolean().optional().describe("Whether the user has a premium account"),
platform: PlatformSchema.describe("The platform the user profile is from"),
lastUpdated: z4.number().describe("Timestamp when the profile was last updated")
}).describe("User profile");
var ProfileRefreshResponseSchema = z4.object({
profile: UserProfileSchema.optional().describe("The refreshed user profile (if successful)")
}).describe("Profile refresh response");
// src/auth.ts
var PlatformParamSchema = z5.object({
platform: z5.string().describe("Social media platform")
}).describe("Platform parameter");
var AuthStatusSchema = z5.object({
message: z5.string().describe("User-friendly status message"),
code: z5.string().describe("Status code for programmatic handling"),
details: z5.string().optional().describe("Additional status details")
}).describe("Authentication status information");
var AuthInitRequestSchema = z5.object({
successUrl: z5.string().url().optional().describe(
"URL to redirect to on successful authentication"
),
errorUrl: z5.string().url().optional().describe("URL to redirect to on authentication error"),
redirect: z5.boolean().optional().default(false).describe(
"Whether to redirect to successUrl/errorUrl (true) or return data directly (false)"
)
}).describe("Auth initialization request");
var AuthUrlResponseSchema = z5.object({
url: z5.string().describe("Authentication URL to redirect the user to")
}).describe("Auth URL response");
var AuthCallbackQuerySchema = z5.object({
code: z5.string().describe("Authorization code from OAuth provider"),
state: z5.string().describe("State parameter for CSRF protection")
}).describe("Auth callback query");
var AuthCallbackResponseSchema = z5.object({
platform: PlatformSchema,
userId: z5.string().describe("User ID"),
redirectUrl: z5.string().optional().describe("URL to redirect the user to after authentication"),
status: AuthStatusSchema.describe("Authentication status information")
}).describe("Auth callback response");
var AuthStatusParamsSchema = z5.object({
platform: z5.string().describe("Social media platform"),
userId: z5.string().describe("User ID on the platform")
}).describe("Token status parameters");
var NearUnauthorizationResponseSchema = z5.object({
success: z5.boolean().describe("Whether the unauthorized operation was successful"),
nearAccount: z5.string().describe("NEAR account ID that was unauthorized")
}).describe("NEAR unauthorized response");
var AuthStatusResponseSchema = z5.object({
platform: PlatformSchema,
userId: z5.string().describe("User ID"),
authenticated: z5.boolean().describe("Whether the user is authenticated"),
tokenStatus: z5.object({
valid: z5.boolean().describe("Whether the token is valid"),
expired: z5.boolean().describe("Whether the token is expired"),
expiresAt: z5.string().optional().describe("When the token expires")
})
}).describe("Auth status response");
var AuthTokenRequestSchema = z5.object({
userId: z5.string().describe("User ID on the platform")
}).describe("Auth token request");
var AuthRevokeResponseSchema = z5.object({
platform: PlatformSchema,
userId: z5.string().describe("User ID")
}).describe("Auth revoke response");
var ConnectedAccountSchema = z5.object({
platform: PlatformSchema,
userId: z5.string().describe("User ID on the platform"),
connectedAt: z5.string().describe("When the account was connected"),
profile: UserProfileSchema.nullable().describe("Full user profile data"),
error: z5.string().optional().describe("Error message if fetching profile failed")
}).describe("Connected account");
var ConnectedAccountsResponseSchema = z5.object({
accounts: z5.array(ConnectedAccountSchema)
}).describe("Response containing an array of connected accounts");
var NearAuthorizationRequestSchema = z5.object({
// No additional parameters needed, as the NEAR account ID is extracted from the signature
}).describe("NEAR authorization request");
var NearAuthorizationResponseSchema = z5.object({
signerId: z5.string().describe("NEAR account ID"),
isAuthorized: z5.boolean().describe("Whether the account is authorized")
}).describe("NEAR authorization response");
var NearAuthorizationStatusResponseSchema = z5.object({
signerId: z5.string().describe("NEAR account ID"),
isAuthorized: z5.boolean().describe("Whether the account is authorized"),
authorizedAt: z5.string().optional().describe("When the account was authorized")
}).describe("NEAR authorization status response");
// src/post.ts
import { z as z6 } from "zod";
var MediaContentSchema = z6.object({
data: z6.union([z6.string(), z6.instanceof(Blob)]).describe("Media data as string or Blob"),
mimeType: z6.string().optional().describe("Media MIME type"),
altText: z6.string().optional().describe("Alt text for the media")
}).describe("Media content object");
var MediaSchema = z6.object({
id: z6.string().describe("Media ID"),
type: z6.enum(["image", "video", "gif"]).describe("Media type"),
url: z6.string().optional().describe("Media URL"),
altText: z6.string().optional().describe("Alt text for the media")
}).describe("Media object");
var PostMetricsSchema = z6.object({
retweets: z6.number().describe("Number of retweets"),
quotes: z6.number().describe("Number of quotes"),
likes: z6.number().describe("Number of likes"),
replies: z6.number().describe("Number of replies")
}).describe("Post metrics");
var PostSchema = z6.object({
id: z6.string().describe("Post ID"),
text: z6.string().describe("Post text content"),
createdAt: z6.string().describe("Post creation date"),
authorId: z6.string().describe("Author ID"),
media: z6.array(MediaSchema).optional().describe("Media attached to the post"),
metrics: PostMetricsSchema.optional().describe("Post metrics"),
inReplyToId: z6.string().optional().describe("ID of the post this is a reply to"),
quotedPostId: z6.string().optional().describe("ID of the post this is quoting")
}).describe("Post object");
var PostContentSchema = z6.object({
text: z6.string().optional().describe("Text content for the post"),
media: z6.array(MediaContentSchema).optional().describe("Media attachments for the post")
}).describe("Post content");
var PostResultSchema = z6.object({
id: z6.string().describe("Post ID"),
text: z6.string().optional().describe("Post text content"),
createdAt: z6.string().describe("Post creation date"),
mediaIds: z6.array(z6.string()).optional().describe("Media IDs attached to the post"),
threadIds: z6.array(z6.string()).optional().describe("Thread IDs for threaded posts"),
quotedPostId: z6.string().optional().describe("ID of the post this is quoting"),
inReplyToId: z6.string().optional().describe("ID of the post this is a reply to"),
success: z6.boolean().optional().describe("Whether the operation was successful")
}).catchall(z6.any()).describe("Post result");
var DeleteResultSchema = z6.object({
success: z6.boolean().describe("Whether the deletion was successful"),
id: z6.string().describe("ID of the deleted post")
}).describe("Delete result");
var LikeResultSchema = z6.object({
success: z6.boolean().describe("Whether the like was successful"),
id: z6.string().describe("ID of the liked post")
}).describe("Like result");
var TargetSchema = z6.object({
platform: PlatformSchema.describe('The platform to post to (e.g., "twitter")'),
userId: z6.string().describe("User ID on the platform")
}).describe("Target for posting operations");
var CreatePostRequestSchema = z6.object({
targets: z6.array(TargetSchema).describe("Array of targets to post to (can be a single target)"),
content: z6.array(PostContentSchema).describe(
"The content of the post, always an array of PostContent objects, even for a single post"
)
}).describe("Create post request");
var RepostRequestSchema = z6.object({
targets: z6.array(TargetSchema).describe("Array of targets to post to"),
platform: PlatformSchema.describe("Platform of the post being reposted"),
postId: z6.string().describe("ID of the post to repost")
}).describe("Repost request");
var QuotePostRequestSchema = z6.object({
targets: z6.array(TargetSchema).describe(
"Array of targets to post to (must be on the same platform as the post being quoted)"
),
platform: PlatformSchema.describe("Platform of the post being quoted"),
postId: z6.string().describe("ID of the post to quote"),
content: z6.array(PostContentSchema).describe(
"Content for the quote post(s), always an array, even for a single post"
)
}).describe("Quote post request");
var ReplyToPostRequestSchema = z6.object({
targets: z6.array(TargetSchema).describe(
"Array of targets to post to (must be on the same platform as the post being replied to)"
),
platform: PlatformSchema.describe("Platform of the post being replied to"),
postId: z6.string().describe("ID of the post to reply to"),
content: z6.array(PostContentSchema).describe(
"Content for the reply post(s), always an array, even for a single post"
)
}).describe("Reply to post request");
var PostToDeleteSchema = z6.object({
platform: PlatformSchema.describe("Platform of the post to delete"),
userId: z6.string().describe("User ID on the platform"),
postId: z6.string().describe("ID of the post to delete")
}).describe("Post to delete");
var DeletePostRequestSchema = z6.object({
targets: z6.array(TargetSchema).describe("Array of targets to delete posts"),
posts: z6.array(PostToDeleteSchema).describe("Array of posts to delete")
}).describe("Delete post request");
var LikePostRequestSchema = z6.object({
targets: z6.array(TargetSchema).describe(
"Array of targets to like the post (must be on the same platform as the post being liked)"
),
platform: PlatformSchema.describe("Platform of the post being liked"),
postId: z6.string().describe("ID of the post to like")
}).describe("Like post request");
var UnlikePostRequestSchema = z6.object({
targets: z6.array(TargetSchema).describe(
"Array of targets to unlike the post (must be on the same platform as the post being unliked)"
),
platform: PlatformSchema.describe("Platform of the post being unliked"),
postId: z6.string().describe("ID of the post to unlike")
}).describe("Unlike post request");
var PostResponseSchema = z6.union([PostSchema, z6.array(PostSchema)]).describe(
"Post response"
);
var CreatePostResponseSchema = PostResponseSchema.describe(
"Create post response"
);
var RepostResponseSchema = PostResponseSchema.describe("Repost response");
var QuotePostResponseSchema = PostResponseSchema.describe("Quote post response");
var ReplyToPostResponseSchema = PostResponseSchema.describe("Reply to post response");
var DeletePostResponseSchema = z6.object({
id: z6.string().describe("ID of the deleted post")
}).describe("Delete post response");
var LikePostResponseSchema = z6.object({
id: z6.string().describe("ID of the liked post")
}).describe("Like post response");
var UnlikePostResponseSchema = z6.object({
id: z6.string().describe("ID of the unliked post")
}).describe("Unlike post response");
// src/rate-limit.ts
import { z as z7 } from "zod";
var RateLimitEndpointParamSchema = z7.object({
endpoint: z7.string().optional().describe(
"Specific endpoint to get rate limit information for (optional)"
)
}).describe("Rate limit endpoint parameter");
var RateLimitEndpointSchema = z7.object({
endpoint: z7.string().describe("API endpoint"),
method: z7.enum(["GET", "POST", "PUT", "DELETE"]).describe("HTTP method"),
limit: z7.number().describe("Rate limit"),
remaining: z7.number().describe("Remaining requests"),
reset: z7.number().describe("Reset timestamp (Unix timestamp in seconds)"),
resetDate: z7.string().describe("Reset date (ISO string)")
}).describe("Rate limit endpoint");
var RateLimitStatusSchema = z7.object({
endpoint: z7.string().describe("API endpoint or action"),
limit: z7.number().describe("Maximum number of requests allowed in the time window"),
remaining: z7.number().describe("Number of requests remaining in the current time window"),
reset: z7.string().datetime().describe("Timestamp when the rate limit will reset"),
resetSeconds: z7.number().describe("Seconds until the rate limit will reset")
}).describe("Rate limit status");
var PlatformRateLimitSchema = z7.object({
platform: PlatformSchema,
endpoints: z7.record(z7.string(), RateLimitStatusSchema).describe(
"Rate limit status for each endpoint"
)
}).describe("Platform-specific rate limit");
var UsageRateLimitSchema = z7.object({
endpoint: z7.string().describe("API endpoint or action"),
limit: z7.number().describe("Maximum number of requests allowed in the time window"),
remaining: z7.number().describe("Number of requests remaining in the current time window"),
reset: z7.string().datetime().describe("Timestamp when the rate limit will reset"),
resetSeconds: z7.number().describe("Seconds until the rate limit will reset"),
timeWindow: z7.string().describe("Time window for the rate limit")
}).describe("Usage rate limit");
var RateLimitStatusResponseSchema = z7.object({
platform: PlatformSchema,
userId: z7.string().optional().describe("User ID"),
endpoints: z7.array(RateLimitEndpointSchema).describe("Rate limits for specific endpoints"),
app: z7.object({
limit: z7.number().describe("App-wide rate limit"),
remaining: z7.number().describe("Remaining requests"),
reset: z7.number().describe("Reset timestamp (Unix timestamp in seconds)"),
resetDate: z7.string().describe("Reset date (ISO string)")
}).optional().describe("App-wide rate limits")
}).describe("Rate limit status response");
var AllRateLimitsResponseSchema = z7.object({
platforms: z7.record(
PlatformSchema,
z7.object({
users: z7.record(
z7.string(),
z7.object({
endpoints: z7.array(RateLimitEndpointSchema).describe(
"Rate limits for specific endpoints"
),
lastUpdated: z7.string().describe("Last updated date (ISO string)")
})
).describe("User-specific rate limits"),
app: z7.object({
limit: z7.number().describe("App-wide rate limit"),
remaining: z7.number().describe("Remaining requests"),
reset: z7.number().describe("Reset timestamp (Unix timestamp in seconds)"),
resetDate: z7.string().describe("Reset date (ISO string)")
}).optional().describe("App-wide rate limits")
})
).describe("Rate limits by platform")
}).describe("All rate limits response");
var RateLimitResponseSchema = z7.object({
platformLimits: z7.array(PlatformRateLimitSchema).describe("Platform-specific rate limits"),
usageLimits: z7.record(z7.string(), UsageRateLimitSchema).describe(
"Usage-based rate limits for the NEAR account"
),
signerId: z7.string().describe("NEAR account ID")
}).describe("Rate limit response");
var EndpointRateLimitResponseSchema = z7.object({
platformLimits: z7.array(
z7.object({
platform: PlatformSchema,
status: RateLimitStatusSchema.describe("Rate limit status for the endpoint")
})
).describe("Platform-specific rate limits for the endpoint"),
usageLimit: UsageRateLimitSchema.describe("Usage-based rate limit for the NEAR account"),
endpoint: z7.string().describe("API endpoint or action"),
signerId: z7.string().describe("NEAR account ID")
}).describe("Endpoint rate limit response");
// src/activity.ts
import { z as z8 } from "zod";
var ActivityType = /* @__PURE__ */ ((ActivityType2) => {
ActivityType2["POST"] = "post";
ActivityType2["REPOST"] = "repost";
ActivityType2["REPLY"] = "reply";
ActivityType2["QUOTE"] = "quote";
ActivityType2["LIKE"] = "like";
ActivityType2["UNLIKE"] = "unlike";
ActivityType2["DELETE"] = "delete";
return ActivityType2;
})(ActivityType || {});
var TimePeriod = /* @__PURE__ */ ((TimePeriod2) => {
TimePeriod2["ALL"] = "all";
TimePeriod2["YEARLY"] = "year";
TimePeriod2["MONTHLY"] = "month";
TimePeriod2["WEEKLY"] = "week";
TimePeriod2["DAILY"] = "day";
TimePeriod2["CUSTOM"] = "custom";
return TimePeriod2;
})(TimePeriod || {});
var FilterSchema = z8.object({
platforms: z8.string().optional().transform((val) => {
if (!val) return void 0;
return val.split(",").map((p) => p.trim()).map((p) => {
try {
return Platform[p.toUpperCase()];
} catch (_e) {
return p;
}
});
}).pipe(
z8.array(z8.nativeEnum(Platform)).optional()
).describe("Filter by platforms (comma-separated list, optional)"),
types: z8.string().optional().transform((val) => {
if (!val) return void 0;
return val.split(",").map((t) => t.trim()).map((t) => {
try {
return ActivityType[t.toUpperCase()];
} catch (_e) {
return t;
}
});
}).pipe(
z8.array(z8.nativeEnum(ActivityType)).optional()
).describe("Filter by activity types (comma-separated list, optional)"),
timeframe: z8.nativeEnum(TimePeriod).optional().describe(
"Timeframe for filtering (optional)"
),
startDate: z8.string().datetime().optional().describe(
"Start date for custom timeframe (ISO 8601 format, optional - defaults to beginning when timeframe=custom)"
),
endDate: z8.string().datetime().optional().describe(
"End date for custom timeframe (ISO 8601 format, optional - defaults to now when timeframe=custom)"
)
}).describe("Filter parameters");
var PaginationSchema = z8.object({
limit: z8.string().optional().transform((val) => val ? parseInt(val, 10) : void 0).pipe(z8.number().min(1).max(100).optional()).describe("Maximum number of results to return (1-100)"),
offset: z8.string().optional().transform((val) => val ? parseInt(val, 10) : void 0).pipe(z8.number().min(0).optional()).describe("Offset for pagination")
}).describe("Pagination parameters");
var ActivityLeaderboardQuerySchema = FilterSchema.merge(PaginationSchema).describe(
"Account leaderboard query"
);
var AccountActivityEntrySchema = z8.object({
signerId: z8.string().describe("NEAR account ID"),
totalPosts: z8.number().describe("Total number of posts"),
totalLikes: z8.number().describe("Total number of likes"),
totalReposts: z8.number().describe("Total number of reposts"),
totalReplies: z8.number().describe("Total number of replies"),
totalQuotes: z8.number().describe("Total number of quote posts"),
totalScore: z8.number().describe("Total activity score"),
rank: z8.number().describe("Rank on the leaderboard"),
lastActive: z8.string().datetime().describe("Timestamp of last activity"),
firstPostTimestamp: z8.string().datetime().describe("Timestamp of the first post")
}).describe("Account activity entry");
var ActivityLeaderboardResponseSchema = z8.object({
timeframe: z8.nativeEnum(TimePeriod).describe("Timeframe for the leaderboard"),
entries: z8.array(AccountActivityEntrySchema).describe("Leaderboard entries"),
generatedAt: z8.string().datetime().describe("Timestamp when the leaderboard was generated"),
platforms: z8.array(PlatformSchema).optional().describe("Platform filters (if applied)")
});
var AccountActivityParamsSchema = z8.object({
signerId: z8.string().describe("NEAR account ID")
}).describe("Account activity params");
var AccountActivityQuerySchema = FilterSchema.merge(PaginationSchema).describe(
"Account activity query"
);
var PlatformActivitySchema = z8.object({
platform: PlatformSchema,
posts: z8.number().describe("Number of posts on this platform"),
likes: z8.number().describe("Number of likes on this platform"),
reposts: z8.number().describe("Number of reposts on this platform"),
replies: z8.number().describe("Number of replies on this platform"),
quotes: z8.number().describe("Number of quote posts on this platform"),
score: z8.number().describe("Activity score on this platform"),
lastActive: z8.string().datetime().describe("Timestamp of last activity on this platform")
}).describe("Platform activity");
var AccountActivityResponseSchema = z8.object({
signerId: z8.string().describe("NEAR account ID"),
timeframe: z8.nativeEnum(TimePeriod).describe("Timeframe for the activity"),
totalPosts: z8.number().describe("Total number of posts across all platforms"),
totalLikes: z8.number().describe("Total number of likes across all platforms"),
totalReposts: z8.number().describe("Total number of reposts across all platforms"),
totalReplies: z8.number().describe("Total number of replies across all platforms"),
totalQuotes: z8.number().describe("Total number of quote posts across all platforms"),
totalScore: z8.number().describe("Total activity score across all platforms"),
rank: z8.number().describe("Rank on the leaderboard"),
lastActive: z8.string().datetime().describe("Timestamp of last activity across all platforms"),
platforms: z8.array(PlatformActivitySchema).describe("Activity breakdown by platform")
});
var AccountPostsParamsSchema = z8.object({
signerId: z8.string().describe("NEAR account ID")
}).describe("Account posts params");
var AccountPostsQuerySchema = FilterSchema.merge(PaginationSchema).describe(
"Account posts query"
);
var AccountPostSchema = z8.object({
id: z8.string().describe("Post ID"),
platform: PlatformSchema,
userId: z8.string().describe("User ID on the platform"),
type: z8.nativeEnum(ActivityType).describe("Type of post"),
content: z8.string().optional().describe("Post content (if available)"),
url: z8.string().url().optional().describe("URL to the post on the platform (if available)"),
createdAt: z8.string().datetime().describe("Timestamp when the post was created"),
metrics: z8.object({
likes: z8.number().optional().describe("Number of likes (if available)"),
reposts: z8.number().optional().describe("Number of reposts (if available)"),
replies: z8.number().optional().describe("Number of replies (if available)"),
quotes: z8.number().optional().describe("Number of quotes (if available)")
}).optional().describe("Post metrics (if available)"),
inReplyToId: z8.string().optional().describe("ID of the post this is a reply to (if applicable)"),
quotedPostId: z8.string().optional().describe("ID of the post this is quoting (if applicable)")
}).describe("Account post");
var AccountPostsResponseSchema = z8.object({
signerId: z8.string().describe("NEAR account ID"),
posts: z8.array(AccountPostSchema).describe("List of posts"),
platforms: z8.array(z8.string()).optional().describe("Platform filters (if applied)"),
types: z8.array(z8.string()).optional().describe("Post type filters (if applied)")
});
export {
AccountActivityEntrySchema,
AccountActivityParamsSchema,
AccountActivityQuerySchema,
AccountPostSchema,
AccountPostsParamsSchema,
AccountPostsQuerySchema,
ActivityLeaderboardQuerySchema,
ActivityType,
AllRateLimitsResponseSchema,
ApiErrorCode,
ApiErrorCodeSchema,
AuthCallbackQuerySchema,
AuthCallbackResponseSchema,
AuthInitRequestSchema,
AuthRevokeResponseSchema,
AuthStatusParamsSchema,
AuthStatusResponseSchema,
AuthStatusSchema,
AuthTokenRequestSchema,
AuthUrlResponseSchema,
ConnectedAccountSchema,
ConnectedAccountsResponseSchema,
CreatePostRequestSchema,
CreatePostResponseSchema,
DeletePostRequestSchema,
DeletePostResponseSchema,
DeleteResultSchema,
EndpointRateLimitResponseSchema,
ErrorDetailSchema,
FilterSchema,
HealthStatusSchema,
LikePostRequestSchema,
LikePostResponseSchema,
LikeResultSchema,
MediaContentSchema,
MediaSchema,
MultiStatusDataSchema,
MultiStatusSummarySchema,
NearAuthorizationRequestSchema,
NearAuthorizationResponseSchema,
NearAuthorizationStatusResponseSchema,
NearUnauthorizationResponseSchema,
PaginationSchema,
Platform,
PlatformActivitySchema,
PlatformParamSchema,
PlatformRateLimitSchema,
PlatformSchema,
PostContentSchema,
PostMetricsSchema,
PostResponseSchema,
PostResultSchema,
PostSchema,
PostToDeleteSchema,
ProfileRefreshResponseSchema,
QuotePostRequestSchema,
QuotePostResponseSchema,
RateLimitEndpointParamSchema,
RateLimitEndpointSchema,
RateLimitResponseSchema,
RateLimitStatusResponseSchema,
RateLimitStatusSchema,
ReplyToPostRequestSchema,
ReplyToPostResponseSchema,
RepostRequestSchema,
RepostResponseSchema,
ResponseMetaSchema,
SUPPORTED_PLATFORMS,
SuccessDetailSchema,
SupportedPlatformSchema,
TargetSchema,
TimePeriod,
UnlikePostRequestSchema,
UnlikePostResponseSchema,
UsageRateLimitSchema,
UserProfileSchema,
createMultiStatusDataSchema,
createSuccessDetailSchema,
errorCodeToStatusCode,
isPlatformSupported
};