@skillhub-xyz/sdk 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +13 -0
- package/src/index.ts +1 -0
- package/src/types.ts +157 -0
- package/tsconfig.json +11 -0
package/package.json
ADDED
package/src/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './types'
|
package/src/types.ts
ADDED
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
// ─── Auth ────────────────────────────────────────────────────────────────────
|
|
2
|
+
|
|
3
|
+
export interface JwtPayload {
|
|
4
|
+
user_id: number
|
|
5
|
+
iat: number
|
|
6
|
+
exp: number
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface TokenExchangeRequest {
|
|
10
|
+
token: string
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface TokenExchangeResponse {
|
|
14
|
+
jwt: string
|
|
15
|
+
expires_at: string
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// ─── Users ───────────────────────────────────────────────────────────────────
|
|
19
|
+
|
|
20
|
+
export interface User {
|
|
21
|
+
id: number
|
|
22
|
+
email: string
|
|
23
|
+
name: string
|
|
24
|
+
avatar: string | null
|
|
25
|
+
created_at: string
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// ─── Personal Tokens ─────────────────────────────────────────────────────────
|
|
29
|
+
|
|
30
|
+
export interface PersonalToken {
|
|
31
|
+
id: number
|
|
32
|
+
name: string
|
|
33
|
+
last_used_at: string | null
|
|
34
|
+
expires_at: string | null
|
|
35
|
+
created_at: string
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface CreateTokenRequest {
|
|
39
|
+
name: string
|
|
40
|
+
expires_in?: '30d' | '90d' | '365d'
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface CreateTokenResponse extends PersonalToken {
|
|
44
|
+
token: string // plaintext, shown once only
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// ─── Orgs ────────────────────────────────────────────────────────────────────
|
|
48
|
+
|
|
49
|
+
export interface Org {
|
|
50
|
+
id: number
|
|
51
|
+
slug: string
|
|
52
|
+
name: string
|
|
53
|
+
created_at: string
|
|
54
|
+
my_role?: OrgRole
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export type OrgRole = 'owner' | 'member' | 'viewer'
|
|
58
|
+
|
|
59
|
+
export interface OrgMember {
|
|
60
|
+
user_id: number
|
|
61
|
+
email: string
|
|
62
|
+
name: string
|
|
63
|
+
role: OrgRole
|
|
64
|
+
created_at: string
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// ─── Projects ────────────────────────────────────────────────────────────────
|
|
68
|
+
|
|
69
|
+
export interface Project {
|
|
70
|
+
id: number
|
|
71
|
+
org_id: number
|
|
72
|
+
slug: string
|
|
73
|
+
name: string
|
|
74
|
+
description: string | null
|
|
75
|
+
created_at: string
|
|
76
|
+
my_role?: ProjectRole
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export type ProjectRole = 'owner' | 'member' | 'viewer'
|
|
80
|
+
|
|
81
|
+
export interface ProjectMember {
|
|
82
|
+
user_id: number
|
|
83
|
+
email: string
|
|
84
|
+
name: string
|
|
85
|
+
role: ProjectRole
|
|
86
|
+
created_at: string
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// ─── Skills ──────────────────────────────────────────────────────────────────
|
|
90
|
+
|
|
91
|
+
export interface Skill {
|
|
92
|
+
id: number
|
|
93
|
+
project_id: number
|
|
94
|
+
slug: string
|
|
95
|
+
name: string
|
|
96
|
+
description: string | null
|
|
97
|
+
created_at: string
|
|
98
|
+
latest_version: SkillVersion | null
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export interface SkillVersion {
|
|
102
|
+
id: number
|
|
103
|
+
skill_id: number
|
|
104
|
+
version: string
|
|
105
|
+
changelog: string | null
|
|
106
|
+
oss_key: string
|
|
107
|
+
file_size: number
|
|
108
|
+
published_by: number
|
|
109
|
+
created_at: string
|
|
110
|
+
is_latest: boolean
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export interface UploadUrlResponse {
|
|
114
|
+
oss_key: string
|
|
115
|
+
oss_endpoint: string
|
|
116
|
+
sts_token: {
|
|
117
|
+
access_key_id: string
|
|
118
|
+
access_key_secret: string
|
|
119
|
+
security_token: string
|
|
120
|
+
expiration: string
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export interface RegisterVersionRequest {
|
|
125
|
+
version: string
|
|
126
|
+
oss_key: string
|
|
127
|
+
changelog?: string
|
|
128
|
+
file_size: number
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export interface DownloadUrlResponse {
|
|
132
|
+
url: string
|
|
133
|
+
expires_at: string
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export interface BulkDownloadItem {
|
|
137
|
+
skill_slug: string
|
|
138
|
+
version: string
|
|
139
|
+
url: string
|
|
140
|
+
expires_at: string
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// ─── Common ──────────────────────────────────────────────────────────────────
|
|
144
|
+
|
|
145
|
+
export interface PaginatedResponse<T> {
|
|
146
|
+
data: T[]
|
|
147
|
+
total: number
|
|
148
|
+
page: number
|
|
149
|
+
limit: number
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export interface ErrorResponse {
|
|
153
|
+
error: {
|
|
154
|
+
code: string
|
|
155
|
+
message: string
|
|
156
|
+
}
|
|
157
|
+
}
|