import { Prettify, Project, ProjectAsset, ProjectRevision, Screenshot, Site, User, WebsimComment } from "@websimai/shared-types"; export * from "@websimai/shared-types"; //#region src/types/utils.d.ts type WithIncluded = Prettify; interface CursorMeta { readonly count?: number | null; readonly has_next_page: boolean; readonly has_previous_page: boolean; readonly start_cursor: string | null; readonly end_cursor: string | null; } interface OffsetMeta { readonly offset: number; readonly limit: number; } type DataWithMeta = { readonly [key in TName]: { readonly data: TData; readonly meta: CursorMeta; } }; //#endregion //#region src/types/projects.d.ts type ProjectInfo = { readonly project: Project; readonly project_revision: ProjectRevision | null; readonly site: Site | null; readonly token: null; readonly cursor: string; }; type ProjectData = WithIncluded; type ProjectsData = WithIncluded>; //#endregion //#region src/client/feed/posts/index.d.ts type FeedPostsDataComment = WebsimComment & { readonly author_id: string; readonly project_post_project_id: string; }; type FeedPostsData = { readonly data: readonly { readonly comment: FeedPostsDataComment; }[]; readonly included_projects: readonly ProjectInfo[]; readonly meta: { readonly has_next_page: boolean; readonly has_previous_page: boolean; readonly offset: number; readonly limit: number; readonly total_processed: number; }; }; /** * `https://api.websim.com/api/v1/feed/posts` */ declare function getFeedPosts(params?: { limit?: number; offset?: number; sort?: "for_you" | "following" | "latest"; }): Promise; //#endregion //#region src/client/feed/search/index.d.ts type FeedSearchProject = { readonly site: Site; readonly likes: number; readonly views: number; readonly remixes: number; readonly comments: number; readonly project: Project; readonly project_revision: ProjectRevision; readonly token: null; readonly cursor: string; }; type FeedSearchData = WithIncluded<{ readonly feed: { readonly data: readonly FeedSearchProject[]; readonly meta: OffsetMeta; }; }>; /** * `https://api.websim.com/api/v1/feed/search/${sort}/${search}` */ declare function searchFeed(sort: "best" | "newest" | "best_template", search: string, params?: { limit?: number; offset?: number; range?: "day" | "month" | "week" | "all"; }): Promise; //#endregion //#region src/client/feed/trending/index.d.ts type FeedTrendingProject = { readonly site: Site; readonly likes: number; readonly views: number; readonly remixes: number; readonly comments: number; readonly is_multiplayer: boolean; readonly project: Project; readonly project_revision: ProjectRevision; readonly token: null; readonly cursor: string; }; type FeedTrendingData = WithIncluded<{ readonly feed: { readonly data: readonly FeedTrendingProject[]; readonly meta: OffsetMeta; }; }>; /** * `https://api.websim.com/api/v1/feed/trending` */ declare function getFeedTrending(params?: { limit?: number; offset?: number; range?: "day" | "month" | "week" | "all"; feed?: "hot" | "new" | "top" | "viral" | "recommended"; }): Promise; //#endregion //#region src/client/projects/comments/index.d.ts type ProjectsCommentData = { readonly comment: WebsimComment; readonly cursor: string; }; type ProjectsCommentsData = DataWithMeta<"comments", ProjectsCommentData[]>; /** * `https://api.websim.com/api/v1/projects/${projectId}/comments` */ declare function getProjectComments(projectId: string, params?: { first?: number; sort_by?: "best" | "created_at"; sort_order?: "desc" | "asc"; only_tips?: boolean; after?: string; }): Promise; /** * `https://api.websim.com/api/v1/projects/${projectId}/comments/${commentId}` */ declare function getProjectComment(projectId: string, commentId: string): Promise; /** * `https://api.websim.com/api/v1/projects/${projectId}/comments/${commentId}/replies` */ declare function getProjectCommentReplies(projectId: string, commentId: string, params?: { first?: number; sort_by?: "best" | "created_at"; }): Promise; //#endregion //#region src/client/projects/revisions/index.d.ts type ProjectsRevisionData = { readonly cursor: string; readonly project_revision: ProjectRevision; readonly site: Site; }; type ProjectsRevisionsData = Prettify & { readonly project: Project; readonly token: null; }>; /** * `https://api.websim.com/api/v1/projects/${projectId}/revisions` */ declare function getProjectRevisions(projectId: string, params?: { first?: number; }): Promise; /** * `https://api.websim.com/api/v1/projects/${projectId}/revisions/${version}` */ declare function getProjectRevision(projectId: string, version: string): Promise; type ProjectsAssetsData = { readonly assets: readonly ProjectAsset[]; }; /** * `https://api.websim.com/api/v1/projects/${projectId}/revisions/${version}/assets` */ declare function getProjectRevisionAssets(projectId: string, version: string): Promise; type ProjectsScreenshotsData = { readonly screenshots: readonly Screenshot[]; }; /** * `https://api.websim.com/api/v1/projects/${projectId}/revisions/${version}/screenshots` */ declare function getProjectRevisionScreenshots(projectId: string, version: string): Promise; /** * `https://api.websim.com/api/v1/projects/${projectId}/revisions/${version}/html` */ declare function getProjectRevisionHTML(projectId: string, version: string): Promise; //#endregion //#region src/client/projects/stats/index.d.ts type DailyStat = { readonly day: string; readonly views: number; readonly engagement_rewards_earned: number; readonly offplatform_engagement_rewards_earned: number; }; type TopReferrer = { readonly referrer: string; readonly views: number; }; type TopCountry = { readonly country: string; readonly views: number; }; type PlaytimeStat = { readonly total_active_dur: number; readonly avg_active_dur: number; }; type TopTipper = { readonly user_id: string; readonly username: string; readonly total_tips: number; }; type ProjectsStatsData = { readonly daily_stats: readonly DailyStat[]; readonly top_referrers: readonly TopReferrer[]; readonly top_countries: readonly TopCountry[]; readonly mobile_ratio: number; readonly playtime_stats: readonly [PlaytimeStat]; readonly top_tippers: readonly TopTipper[]; readonly total_tip_amount: number; }; /** * `https://api.websim.com/api/v1/projects/${projectId}/stats` */ declare function getProjectStats(projectId: string): Promise; //#endregion //#region src/client/projects/index.d.ts /** * `https://api.websim.com/api/v1/projects/${projectId}` */ declare function getProject(projectId: string): Promise; /** * `https://api.websim.com/api/v1/projects/${projectId}/descendants` */ declare function getDescendants(projectId: string): Promise; /** * `https://api.websim.com/api/v1/projects` */ declare function listPublicProjects(params?: { first?: number; query?: string; sort_by?: "updated_at" | "created_at"; posted?: boolean; }): Promise; //#endregion //#region src/client/user-search.d.ts type UserSearchData = { readonly data: readonly User[]; }; /** * `https://api.websim.com/api/v1/user-search` */ declare function searchUsers(params: { query: string; }): Promise; //#endregion //#region src/client/users/likes.d.ts type ProjectLikedInfo = { readonly project: Project; readonly project_revision: ProjectRevision | null; readonly site: Site | null; readonly like: { readonly site_id: string; readonly user: User; readonly created_at: string; }; readonly cursor: string; }; type UsersLikesProjectsData = { readonly likes: { readonly data: readonly ProjectLikedInfo[]; }; readonly meta: CursorMeta; }; /** * `https://api.websim.com/api/v1/users/${userId}/likes` */ declare function getUserLikedSites(userId: string, params?: { first?: number; }): Promise; //#endregion //#region src/client/users/stats.d.ts type UsersStats = { readonly total_likes: number; readonly total_views: number; readonly user_id: string; readonly following_count: number; readonly follower_count: number; }; type UsersStatsData = { readonly stats: UsersStats; }; /** * `https://api.websim.com/api/v1/users/${userId}/stats` */ declare function getUserStats(userId: string): Promise; //#endregion //#region src/client/users/index.d.ts type UserData = { readonly user: User; }; /** * `https://api.websim.com/api/v1/users/${userId}` * * @param userId Can be either user's id or their username, but using user's id is up to 4x faster */ declare function getUser(userId: string, params?: { posted?: boolean; first?: number; }): Promise; /** * `https://api.websim.com/api/v1/users/${userId}/projects` */ declare function getUserProjects(userId: string, params?: { posted?: boolean; first?: number; }): Promise; type UserFollow = { readonly created_at: string; readonly user: User; }; type UserFollowData = { readonly follow: UserFollow; readonly cursor: string; }; type UserFollowersData = DataWithMeta<"followers", UserFollowData[]>; /** * https://api.websim.com/api/v1/users/${userId}/followers */ declare function getUserFollowers(userId: string, params?: { first?: number; count?: boolean; }): Promise; type UserFollowingData = DataWithMeta<"following", UserFollowData[]>; /** * `https://api.websim.com/api/v1/users/${userId}/following` */ declare function getUserFollowing(userId: string, params?: { first?: number; count?: boolean; }): Promise; /** * `https://api.websim.com/api/v1/users/${userId}/slugs/${slug}` */ declare function getUserProjectBySlug(userId: string, slug: string): Promise; //#endregion export { FeedPostsData, FeedSearchData, FeedSearchProject, FeedTrendingData, FeedTrendingProject, ProjectData, ProjectInfo, ProjectLikedInfo, ProjectsAssetsData, ProjectsCommentData, ProjectsCommentsData, ProjectsData, ProjectsRevisionData, ProjectsRevisionsData, ProjectsScreenshotsData, ProjectsStatsData, UserData, UserFollow, UserFollowData, UserFollowersData, UserFollowingData, UserSearchData, UsersLikesProjectsData, UsersStats, UsersStatsData, getDescendants, getFeedPosts, getFeedTrending, getProject, getProjectComment, getProjectCommentReplies, getProjectComments, getProjectRevision, getProjectRevisionAssets, getProjectRevisionHTML, getProjectRevisionScreenshots, getProjectRevisions, getProjectStats, getUser, getUserFollowers, getUserFollowing, getUserLikedSites, getUserProjectBySlug, getUserProjects, getUserStats, listPublicProjects, searchFeed, searchUsers };