Skip to content

Commit 2cd31f8

Browse files
committed
refactor: improve entity
1 parent dd4a91e commit 2cd31f8

File tree

4 files changed

+13
-14
lines changed

4 files changed

+13
-14
lines changed

src/client/client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { HTTPError } from 'ky'
2-
import { EventEmitter } from 'eventemitter3'
2+
import EventEmitter from 'eventemitter3'
33
import { resolveApiConfig } from '../request'
44
import { ApiClient } from '../api-client'
55
import { objectPick } from '../utils/objects'

src/types/api-responses.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import type {
77
PostDetail,
88
Profile as ProfileEntity,
99
RecommendPost,
10-
StoryDetails,
10+
Story,
1111
TabIcons,
1212
User,
1313
} from './entity'
@@ -187,6 +187,6 @@ export namespace Stories {
187187
}
188188

189189
export interface ListUserStoriesResponse {
190-
data: StoryDetails[]
190+
data: Story[]
191191
}
192192
}

src/types/entity/other.ts

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type { CommonImage } from './common'
12
import type { Topic } from './topic'
23
import type {
34
Picture,
@@ -162,18 +163,14 @@ export interface RecommendPost {
162163
type: string
163164
}
164165

165-
export interface StoryPic {
166+
export interface StoryPicture extends CommonImage {
166167
key: string
167-
thumbnailUrl: string
168-
smallPicUrl: string
169-
middlePicUrl: string
170-
picUrl: string
171-
format: string
172168
cropperPosX: number
173169
cropperPosY: number
174170
width: number
175171
height: number
176172
}
173+
177174
export interface StoryVideo {
178175
duration: number
179176
height: number
@@ -186,22 +183,22 @@ export interface StoryVideo {
186183
}
187184
}
188185

189-
export interface StoryDetails {
190-
id: string
186+
export interface Story {
191187
type: 'STORY'
188+
id: string
192189
storyType: LiteralUnion<'PICTURE' | 'VIDEO'>
190+
status: LiteralUnion<'PUBLIC'>
193191
user: User
194192
emoji?: string
195193
video?: StoryVideo
196194
thumbnailVideo?: StoryVideo
197-
status: string
198-
picture: StoryPic
195+
picture?: StoryPicture
199196
liked: boolean
200197
likeCount: number
201198
commentCount: number
202199
viewerCount: number
203200
createdAt: string
204-
likedUsers: []
201+
likedUsers: User[]
205202
enablePictureComments: boolean
206203
isFeatured: boolean
207204
}

src/types/entity/user.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type { StoryStatus } from './post'
12
import type { CommonImage } from './common'
23

34
/**
@@ -80,6 +81,7 @@ export interface User {
8081
/** 尾部图标 */
8182
trailingIcons?: TrailingIcon[]
8283
following?: boolean
84+
storyStatus?: StoryStatus
8385
}
8486

8587
export interface RefRemark {

0 commit comments

Comments
 (0)