Function bodies 942 total
updateFolder function · typescript · L15-L23 (9 LOC)snipxn_app/src/api/folder.ts
export function updateFolder(
id: string,
req: UpdateFolderRequest,
): Promise<FolderResponse> {
return apiClient.put<FolderResponse, UpdateFolderRequest>(
`${FOLDERS_BASE_URL}/${id}`,
req,
);
}deleteFolder function · typescript · L25-L27 (3 LOC)snipxn_app/src/api/folder.ts
export function deleteFolder(id: string): Promise<void> {
return apiClient.delete<void>(`${FOLDERS_BASE_URL}/${id}`);
}normalizeNullableString function · typescript · L8-L10 (3 LOC)snipxn_app/src/api/follow.ts
function normalizeNullableString(value: unknown): string | null {
return typeof value === 'string' ? value : null;
}normalizeNumber function · typescript · L12-L14 (3 LOC)snipxn_app/src/api/follow.ts
function normalizeNumber(value: unknown): number {
return typeof value === 'number' && Number.isFinite(value) ? value : 0;
}normalizeUser function · typescript · L17-L38 (22 LOC)snipxn_app/src/api/follow.ts
function normalizeUser(raw: Record<string, unknown>): UserProfileResponse {
return {
id: String(raw.id ?? raw.userId ?? ''),
nickname:
normalizeNullableString(raw.nickname)?.trim() ||
normalizeNullableString(raw.userNickname)?.trim() ||
translateLiteral('未命名用户'),
avatar: normalizeNullableString(raw.avatar),
bio: normalizeNullableString(raw.bio),
createdAt: normalizeNullableString(raw.createdAt) ?? '',
postCount: normalizeNumber(raw.postCount),
primaryLanguage: normalizeNullableString(raw.primaryLanguage),
website: normalizeNullableString(raw.website),
github: normalizeNullableString(raw.github),
location: normalizeNullableString(raw.location),
company: normalizeNullableString(raw.company),
techStack: normalizeNullableString(raw.techStack),
isFollowing: typeof raw.isFollowing === 'boolean' ? raw.isFollowing : null,
followingCount: normalizeNumber(raw.followingCount),
followerCount: normalizeNumber(raw.follownormalizeUsers function · typescript · L40-L42 (3 LOC)snipxn_app/src/api/follow.ts
function normalizeUsers(raw: Record<string, unknown>[]): UserProfileResponse[] {
return raw.map(normalizeUser);
}follow function · typescript · L44-L46 (3 LOC)snipxn_app/src/api/follow.ts
export function follow(userId: string): Promise<void> {
return apiClient.post<void>(`${FOLLOW_BASE_URL}/${userId}`);
}Repobility analyzer · published findings · https://repobility.com
unfollow function · typescript · L48-L50 (3 LOC)snipxn_app/src/api/follow.ts
export function unfollow(userId: string): Promise<void> {
return apiClient.delete<void>(`${FOLLOW_BASE_URL}/${userId}`);
}getFollowing function · typescript · L55-L57 (3 LOC)snipxn_app/src/api/follow.ts
export function getFollowing(): Promise<string[]> {
return apiClient.get<string[]>(`${FOLLOW_BASE_URL}/following`);
}getFollowers function · typescript · L59-L61 (3 LOC)snipxn_app/src/api/follow.ts
export function getFollowers(): Promise<string[]> {
return apiClient.get<string[]>(`${FOLLOW_BASE_URL}/followers`);
}getRecommended function · typescript · L63-L66 (4 LOC)snipxn_app/src/api/follow.ts
export async function getRecommended(): Promise<UserProfileResponse[]> {
const data = await apiClient.get<Record<string, unknown>[]>(`${FOLLOW_BASE_URL}/recommended`);
return normalizeUsers(data);
}getStats function · typescript · L68-L70 (3 LOC)snipxn_app/src/api/follow.ts
export function getStats(): Promise<FollowStatsResponse> {
return apiClient.get<FollowStatsResponse>(`${FOLLOW_BASE_URL}/stats`);
}getUserProfile function · typescript · L72-L75 (4 LOC)snipxn_app/src/api/follow.ts
export async function getUserProfile(userId: string): Promise<UserProfileResponse> {
const data = await apiClient.get<Record<string, unknown>>(`${FOLLOW_BASE_URL}/user/${userId}/profile`);
return normalizeUser(data);
}listNotes function · typescript · L18-L24 (7 LOC)snipxn_app/src/api/note.ts
export function listNotes(
params: NoteListParams = {},
): Promise<PageResult<NoteListItemResponse>> {
return apiClient.get<PageResult<NoteListItemResponse>>(NOTES_BASE_URL, {
params,
});
}listStarred function · typescript · L26-L35 (10 LOC)snipxn_app/src/api/note.ts
export function listStarred(
params: Omit<NoteListParams, 'folderId'> = {},
): Promise<PageResult<NoteListItemResponse>> {
return apiClient.get<PageResult<NoteListItemResponse>>(
`${NOTES_BASE_URL}/starred`,
{
params,
},
);
}Repobility's GitHub App fixes findings like these · https://github.com/apps/repobility-bot
listTrash function · typescript · L37-L46 (10 LOC)snipxn_app/src/api/note.ts
export function listTrash(
params: Omit<NoteListParams, 'folderId'> = {},
): Promise<PageResult<NoteListItemResponse>> {
return apiClient.get<PageResult<NoteListItemResponse>>(
`${NOTES_BASE_URL}/trash`,
{
params,
},
);
}getNoteDetail function · typescript · L48-L50 (3 LOC)snipxn_app/src/api/note.ts
export function getNoteDetail(id: string): Promise<NoteDetailResponse> {
return apiClient.get<NoteDetailResponse>(`${NOTES_BASE_URL}/${id}`);
}createNote function · typescript · L52-L54 (3 LOC)snipxn_app/src/api/note.ts
export function createNote(req: CreateNoteRequest): Promise<NoteDetailResponse> {
return apiClient.post<NoteDetailResponse, CreateNoteRequest>(NOTES_BASE_URL, req);
}updateNote function · typescript · L56-L64 (9 LOC)snipxn_app/src/api/note.ts
export function updateNote(
id: string,
req: UpdateNoteRequest,
): Promise<NoteDetailResponse> {
return apiClient.put<NoteDetailResponse, UpdateNoteRequest>(
`${NOTES_BASE_URL}/${id}`,
req,
);
}deleteNote function · typescript · L66-L68 (3 LOC)snipxn_app/src/api/note.ts
export function deleteNote(id: string): Promise<void> {
return apiClient.delete<void>(`${NOTES_BASE_URL}/${id}`);
}restoreNote function · typescript · L70-L72 (3 LOC)snipxn_app/src/api/note.ts
export function restoreNote(id: string): Promise<void> {
return apiClient.post<void>(`${NOTES_BASE_URL}/${id}/restore`);
}permanentDelete function · typescript · L74-L76 (3 LOC)snipxn_app/src/api/note.ts
export function permanentDelete(id: string): Promise<void> {
return apiClient.delete<void>(`${NOTES_BASE_URL}/${id}/permanent`);
}getShareStatus function · typescript · L78-L80 (3 LOC)snipxn_app/src/api/note.ts
export function getShareStatus(id: string): Promise<ShareStatusResponse> {
return apiClient.get<ShareStatusResponse>(`${NOTES_BASE_URL}/${id}/share`);
}Source: Repobility analyzer · https://repobility.com
shareNote function · typescript · L82-L84 (3 LOC)snipxn_app/src/api/note.ts
export function shareNote(id: string): Promise<ShareResponse> {
return apiClient.post<ShareResponse>(`${NOTES_BASE_URL}/${id}/share`);
}cancelShare function · typescript · L86-L88 (3 LOC)snipxn_app/src/api/note.ts
export function cancelShare(id: string): Promise<void> {
return apiClient.delete<void>(`${NOTES_BASE_URL}/${id}/share`);
}getStorageBreakdown function · typescript · L90-L92 (3 LOC)snipxn_app/src/api/note.ts
export function getStorageBreakdown(): Promise<StorageBreakdownResponse> {
return apiClient.get<StorageBreakdownResponse>(`${NOTES_BASE_URL}/storage-breakdown`);
}importNotes function · typescript · L94-L104 (11 LOC)snipxn_app/src/api/note.ts
export function importNotes(file: FormData): Promise<ImportNotesResponse> {
return apiClient.post<ImportNotesResponse, FormData>(
`${NOTES_BASE_URL}/import`,
file,
{
headers: {
'Content-Type': 'multipart/form-data',
},
},
);
}listPosts function · typescript · L15-L21 (7 LOC)snipxn_app/src/api/post.ts
export function listPosts(
params: PostListParams = {},
): Promise<PageResult<PostListItemResponse>> {
return apiClient.get<PageResult<PostListItemResponse>>(POSTS_BASE_URL, {
params,
});
}listUserPosts function · typescript · L23-L33 (11 LOC)snipxn_app/src/api/post.ts
export function listUserPosts(
userId: string,
params: PostListParams = {},
): Promise<PageResult<PostListItemResponse>> {
return apiClient.get<PageResult<PostListItemResponse>>(
`${POSTS_BASE_URL}/user/${userId}`,
{
params,
},
);
}listHotPosts function · typescript · L35-L44 (10 LOC)snipxn_app/src/api/post.ts
export function listHotPosts(
params: PostListParams = {},
): Promise<PageResult<PostListItemResponse>> {
return apiClient.get<PageResult<PostListItemResponse>>(
`${POSTS_BASE_URL}/hot`,
{
params,
},
);
}getPostDetail function · typescript · L46-L48 (3 LOC)snipxn_app/src/api/post.ts
export function getPostDetail(id: string): Promise<PostDetailResponse> {
return apiClient.get<PostDetailResponse>(`${POSTS_BASE_URL}/${id}`);
}Repobility · open methodology · https://repobility.com/research/
createPost function · typescript · L50-L52 (3 LOC)snipxn_app/src/api/post.ts
export function createPost(req: CreatePostRequest): Promise<PostDetailResponse> {
return apiClient.post<PostDetailResponse, CreatePostRequest>(POSTS_BASE_URL, req);
}deletePost function · typescript · L54-L56 (3 LOC)snipxn_app/src/api/post.ts
export function deletePost(id: string): Promise<void> {
return apiClient.delete<void>(`${POSTS_BASE_URL}/${id}`);
}likePost function · typescript · L58-L60 (3 LOC)snipxn_app/src/api/post.ts
export function likePost(id: string): Promise<void> {
return apiClient.post<void>(`${POSTS_BASE_URL}/${id}/like`);
}unlikePost function · typescript · L62-L64 (3 LOC)snipxn_app/src/api/post.ts
export function unlikePost(id: string): Promise<void> {
return apiClient.delete<void>(`${POSTS_BASE_URL}/${id}/like`);
}collectPost function · typescript · L66-L68 (3 LOC)snipxn_app/src/api/post.ts
export function collectPost(id: string): Promise<void> {
return apiClient.post<void>(`${POSTS_BASE_URL}/${id}/collect`);
}uncollectPost function · typescript · L70-L72 (3 LOC)snipxn_app/src/api/post.ts
export function uncollectPost(id: string): Promise<void> {
return apiClient.delete<void>(`${POSTS_BASE_URL}/${id}/collect`);
}sharePost function · typescript · L74-L76 (3 LOC)snipxn_app/src/api/post.ts
export function sharePost(id: string): Promise<ShareResponse> {
return apiClient.post<ShareResponse>(`${POSTS_BASE_URL}/${id}/share`);
}getShareStatus function · typescript · L78-L80 (3 LOC)snipxn_app/src/api/post.ts
export function getShareStatus(id: string): Promise<ShareStatusResponse> {
return apiClient.get<ShareStatusResponse>(`${POSTS_BASE_URL}/${id}/share`);
}Repobility analyzer · published findings · https://repobility.com
cancelShare function · typescript · L82-L84 (3 LOC)snipxn_app/src/api/post.ts
export function cancelShare(id: string): Promise<void> {
return apiClient.delete<void>(`${POSTS_BASE_URL}/${id}/share`);
}runCode function · typescript · L7-L12 (6 LOC)snipxn_app/src/api/sandbox.ts
export function runCode(req: RunCodeRequest): Promise<RunCodeResponse> {
return apiClient.post<RunCodeResponse, RunCodeRequest>(
`${SANDBOX_BASE_URL}/run`,
req,
);
}pull function · typescript · L7-L13 (7 LOC)snipxn_app/src/api/sync.ts
export function pull(lastPulledAt?: string): Promise<SyncPullResponse> {
return apiClient.get<SyncPullResponse>(`${SYNC_BASE_URL}/pull`, {
params: {
lastPulledAt,
},
});
}push function · typescript · L15-L17 (3 LOC)snipxn_app/src/api/sync.ts
export function push(req: SyncPushRequest): Promise<void> {
return apiClient.post<void, SyncPushRequest>(`${SYNC_BASE_URL}/push`, req);
}listTags function · typescript · L11-L13 (3 LOC)snipxn_app/src/api/tag.ts
export function listTags(): Promise<TagResponse[]> {
return apiClient.get<TagResponse[]>(TAGS_BASE_URL);
}createTag function · typescript · L15-L17 (3 LOC)snipxn_app/src/api/tag.ts
export function createTag(req: CreateTagRequest): Promise<TagResponse> {
return apiClient.post<TagResponse, CreateTagRequest>(TAGS_BASE_URL, req);
}updateTag function · typescript · L19-L21 (3 LOC)snipxn_app/src/api/tag.ts
export function updateTag(id: string, req: UpdateTagRequest): Promise<TagResponse> {
return apiClient.put<TagResponse, UpdateTagRequest>(`${TAGS_BASE_URL}/${id}`, req);
}deleteTag function · typescript · L23-L25 (3 LOC)snipxn_app/src/api/tag.ts
export function deleteTag(id: string): Promise<void> {
return apiClient.delete<void>(`${TAGS_BASE_URL}/${id}`);
}Repobility's GitHub App fixes findings like these · https://github.com/apps/repobility-bot
normalizeNullableString function · typescript · L14-L16 (3 LOC)snipxn_app/src/api/user.ts
function normalizeNullableString(value: unknown): string | null {
return typeof value === 'string' ? value : null;
}normalizeNumber function · typescript · L18-L20 (3 LOC)snipxn_app/src/api/user.ts
function normalizeNumber(value: unknown, fallback = 0): number {
return typeof value === 'number' && Number.isFinite(value) ? value : fallback;
}normalizeStatus function · typescript · L22-L24 (3 LOC)snipxn_app/src/api/user.ts
function normalizeStatus(value: unknown): User['status'] {
return value === 'BANNED' || value === 'LOCKED' ? value : 'ACTIVE';
}