-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathindex.ts
48 lines (45 loc) · 1.45 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import {
getUserProfileBio,
getUserProfileBirthday,
getUserProfileBookmarks,
getUserProfileCollections,
getUserProfileGifts,
getUserProfileHeader,
getUserProfileId,
getUserProfileJoined,
getUserProfileLocation,
getUserProfileName,
getUserProfilePic,
getUserProfilePseuds,
getUserProfileSeries,
getUserProfileWorks,
} from "./getters";
import { User } from "types/entities";
import { getUserProfileUrl } from "../urls";
import { loadUserProfilePage } from "../page-loaders";
export const getUser = async ({
username,
}: {
username: string;
}): Promise<User> => {
const profilePage = await loadUserProfilePage({ username });
return {
// We use this because capitalization might be different
username: getUserProfileName(profilePage),
// TODO: this should really be an array
pseuds: getUserProfilePseuds(profilePage),
id: getUserProfileId(profilePage),
joined: getUserProfileJoined(profilePage),
icon: getUserProfilePic(profilePage),
header: getUserProfileHeader(profilePage),
location: getUserProfileLocation(profilePage),
birthday: getUserProfileBirthday(profilePage),
url: getUserProfileUrl({ username }),
works: getUserProfileWorks(profilePage),
series: getUserProfileSeries(profilePage),
bookmarks: getUserProfileBookmarks(profilePage),
collections: getUserProfileCollections(profilePage),
gifts: getUserProfileGifts(profilePage),
bioHtml: getUserProfileBio(profilePage),
};
};