Skip to content

Commit e6c6218

Browse files
committed
feat: finally total typespec
1 parent 7b3a92a commit e6c6218

File tree

9 files changed

+212
-148
lines changed

9 files changed

+212
-148
lines changed

src/extensions.tsp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ namespace SolvedAC;
22

33
alias XInternal = "x-internal";
44
scalar Color extends string;
5+
alias TODO = unknown;

src/models/Emoticon.tsp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
using TypeSpec.OpenAPI;
2+
3+
namespace SolvedAC;
4+
5+
/**
6+
* 난이도 투표 등에 사용할 수 있는 이모티콘입니다.
7+
*/
8+
model Emoticon {
9+
/**
10+
* 고유 식별자입니다.
11+
* @example "hanbyeol-01"
12+
*/
13+
emoticonId: string;
14+
15+
/**
16+
* 사진으로 가는 하이퍼링크입니다.
17+
* @example "https://static.solved.ac/emoticons/fool.png"
18+
*/
19+
emoticonUrl: url;
20+
21+
/**
22+
* 한국어 이름입니다.
23+
* @example "난 바보야"
24+
*/
25+
displayName: string;
26+
}

src/models/_barrel.tsp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,4 @@ import "./Item.tsp";
2424
import "./Organization.tsp";
2525
import "./OrganizationType.tsp";
2626
import "./Ranked.tsp";
27+
import "./Emoticon.tsp";

src/openapi.yaml

Lines changed: 0 additions & 14 deletions
This file was deleted.

src/operations/account/_barrel.tsp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
import "./redeem.tsp";
22
import "./update_settings.tsp";
3+
import "./verify_credentials.tsp";
Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
/**
2+
* @TODO: 반환에 성공한 경우 문서화하기
3+
*/
4+
using TypeSpec.Http;
5+
using TypeSpec.OpenAPI;
6+
7+
namespace SolvedAC;
8+
/**
9+
* 현재 로그인한 계정 정보를 가져옵니다.
10+
*
11+
* **주의**: 로그인이 필요한 API는 사이트 내에서 호출할 수 없으므로 별도 도구를 이용해주십시오.
12+
*/
13+
@summary("로그인 정보 가져오기")
14+
@tag("account")
15+
@useAuth(TokenAuth)
16+
@get
17+
@route("/account/verify_credentials")
18+
op verifyAccountCredentials(
19+
/**
20+
* 응답을 받을 언어입니다.
21+
*/
22+
@header
23+
`x-solvedac-language`?: Language,
24+
): Unauthorized | VerifyCredentials.Ok;
25+
26+
namespace VerifyCredentials {
27+
/**
28+
* 리딤 코드가 올바르지 않은 경우입니다.
29+
*/
30+
@extension(XInternal, true)
31+
model Ok {
32+
@statusCode status: 200;
33+
@body body: Credential;
34+
}
35+
36+
@extension(XInternal, true)
37+
model Credential {
38+
user: UserWithSettings;
39+
aggredOn: Agreements;
40+
41+
/**
42+
* 보유할 수 있는 모든 이모티콘에 대해 이모티콘 정보에 덧붙여 보유 여부를 함께 담은 목록입니다.
43+
*
44+
* @example
45+
* [
46+
* {
47+
* "emoticonId": "hanbyeol-01", "emoticonUrl": "https://static.solved.ac/emoticons/fool.png",
48+
* "displayName": "난 바보야", "unlocked": true
49+
* },
50+
* {
51+
* "emoticonId": "hanbyeol-02", "emoticonUrl": "https://static.solved.ac/emoticons/lgtm.png",
52+
* "displayName": "LGTM", "unlocked": false
53+
* },
54+
* {
55+
* "emoticonId": "hanbyeol-03", "emoticonUrl": "https://static.solved.ac/emoticons/real.png",
56+
* "displayName": "ㄹㅇㅋㅋ", "unlocked": true
57+
* },
58+
* {
59+
* "emoticonId": "hanbyeol-04", "emoticonUrl": "https://static.solved.ac/emoticons/why-work.png",
60+
* "displayName": "이게 왜 됨?", "unlocked": true
61+
* },
62+
* {
63+
* "emoticonId": "hanbyeol-05", "emoticonUrl": "https://static.solved.ac/emoticons/i-wont-do.png",
64+
* "displayName": "응, 안 해", "unlocked": true
65+
* },
66+
* {
67+
* "emoticonId": "hanbyeol-06", "emoticonUrl": "https://static.solved.ac/emoticons/overclock.png",
68+
* "displayName": "두뇌풀가동!", "unlocked": true
69+
* },
70+
* {
71+
* "emoticonId": "hanbyeol-07", "emoticonUrl": "https://static.solved.ac/emoticons/hello-world.png",
72+
* "displayName": "Hello, World!", "unlocked": true
73+
* },
74+
* {
75+
* "emoticonId": "hanbyeol-08", "emoticonUrl": "https://static.solved.ac/emoticons/i-hate-math.png",
76+
* "displayName": "수학시러!", "unlocked": true
77+
* },
78+
* {
79+
* "emoticonId": "hanbyeol-09", "emoticonUrl": "https://static.solved.ac/emoticons/am-i-screwed.png",
80+
* "displayName": "망?했네?", "unlocked": true
81+
* },
82+
* {
83+
* "emoticonId": "hanbyeol-10", "emoticonUrl": "https://static.solved.ac/emoticons/dont-decieve.png",
84+
* "displayName": "기만ㄴㄴ", "unlocked": true
85+
* },
86+
* {
87+
* "emoticonId": "hanbyeol-11", "emoticonUrl": "https://static.solved.ac/emoticons/i-hate-coding.png",
88+
* "displayName": "코딩시러!", "unlocked": true
89+
* },
90+
* {
91+
* "emoticonId": "hanbyeol-12", "emoticonUrl": "https://static.solved.ac/emoticons/thinking-face.png",
92+
* "displayName": "흠터레스팅", "unlocked": true
93+
* },
94+
* {
95+
* "emoticonId": "hanbyeol-13", "emoticonUrl": "https://static.solved.ac/emoticons/why-dont-work.png",
96+
* "displayName": "이게 왜 안 됨?", "unlocked": true
97+
* },
98+
* {
99+
* "emoticonId": "hanbyeol-14", "emoticonUrl": "https://static.solved.ac/emoticons/well-programmed.png",
100+
* "displayName": "잘짰네ㅎ", "unlocked": true
101+
* },
102+
* {
103+
* "emoticonId": "hanbyeol-15", "emoticonUrl": "https://static.solved.ac/emoticons/please-dont-explode.png",
104+
* "displayName": "터지면 안대...", "unlocked": true
105+
* },
106+
* {
107+
* "emoticonId": "hanbyeol-16", "emoticonUrl": "https://static.solved.ac/emoticons/nooo.png",
108+
* "displayName": "으에에~", "unlocked": false
109+
* }
110+
* ]
111+
*/
112+
emoticons: EmoticonUnlockStatus[];
113+
114+
bookmarks: TODO;
115+
116+
/**
117+
* 받은 알림 수입니다.
118+
* @example 0
119+
*/
120+
notificationCount: uint32;
121+
122+
/**
123+
* 마지막으로 솔브드 상태가 변한 시각입니다.
124+
* @example "2024-03-17T19:24:42.000Z"
125+
*/
126+
lastSolvedStateChangedAt: offsetDateTime;
127+
}
128+
129+
/**
130+
* 사용자 동의 여부입니다.
131+
*/
132+
model Agreements {
133+
/**
134+
* 동의한 약관 버전입니다.
135+
* @example "tos_v1"
136+
*/
137+
tos: string;
138+
139+
/**
140+
* 동의한 개인정보 처리방침 버전입니다.
141+
* @example "privacy_v2"
142+
*/
143+
privacy: string;
144+
}
145+
146+
@extension(XInternal, true)
147+
model EmoticonUnlockStatus extends Emoticon {
148+
/**
149+
* 해금 여부입니다.
150+
* @example true
151+
*/
152+
unlocked: boolean;
153+
}
154+
155+
@extension(XInternal, true)
156+
@withVisibility("brief")
157+
model UserWithSettings extends User {
158+
/**
159+
* 설정입니다.
160+
*/
161+
settings: UserSettings;
162+
163+
/**
164+
* 사용 중인 이메일 주소입니다.
165+
*
166+
* @example `"me@shiftpsh.com"`
167+
*/
168+
email: string;
169+
}
170+
171+
model UserSettings {
172+
twitterPostOnProblemSolve: "true";
173+
screenTheme: "default";
174+
twitterPostHandle: "true";
175+
twitterPostOnRatingIncrease: "true";
176+
twitterPostOnTierIncrease: "true";
177+
twitterPostOnClassIncrease: "true";
178+
pro_hideAds: "true";
179+
siteLanguage: "ko";
180+
showIllustBackground: "true";
181+
showMovieBackground: "true";
182+
}
183+
}

src/paths/account/verify_credentials.yaml

Lines changed: 0 additions & 60 deletions
This file was deleted.

src/schemas/icon-scheme.yaml

Lines changed: 0 additions & 16 deletions
This file was deleted.

src/schemas/settings.yaml

Lines changed: 0 additions & 58 deletions
This file was deleted.

0 commit comments

Comments
 (0)