-
Notifications
You must be signed in to change notification settings - Fork 1
/
flowApi.js
119 lines (106 loc) · 2.88 KB
/
flowApi.js
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
export const getUserMessage = ({ $axios, channel, since_id, is_up, count }) => {
return $axios.$get('v1/message/history', {
params: { channel, since_id, count, is_up }
})
}
export const getUserRelation = ({ $axios, seen_ids, slug, relation }) => {
return $axios.$get('v1/user/relation', {
params: { seen_ids, slug, relation }
})
}
export const getUserDrafts = ({ $axios, page, count }) => {
return $axios.$get('v1/pin/drafts', {
params: { page, count }
})
}
export const getUserTimeline = ({ $axios, page, count, slug }) => {
return $axios.$get('v1/user/timeline', {
params: { page, count, slug }
})
}
export const getPinComments = ({ $axios, sort, slug, count, last_id, seen_ids, mode, page }) => {
return $axios.$get('v1/comment/list', {
params: { sort, slug, count, last_id, seen_ids, mode, page }
})
}
export const getTagFlows = ({ $axios, slug, sort, time, take, seen_ids, last_id }) => {
const timeout = () => new Promise(resolve => setTimeout(resolve, 400))
const request = () =>
$axios.$get('v1/flow/pins', {
params: {
slug,
sort,
time,
take,
is_up: 0,
spec_id: sort === 'newest' ? last_id : seen_ids
}
})
return new Promise((resolve, reject) => {
Promise.all([request(), timeout()])
.then(data => {
resolve(data[0])
})
.catch(reject)
})
}
export const getATField = ({ $axios, page, count, sort, slug }) => {
const timeout = () => new Promise(resolve => setTimeout(resolve, 400))
const request = () =>
$axios.$get('v1/atfield/flow', {
params: { page, count, sort, slug }
})
return new Promise((resolve, reject) => {
Promise.all([request(), timeout()])
.then(data => {
resolve(data[0])
})
.catch(reject)
})
}
export const getZoneQuestions = ({ $axios, slug }) => {
return $axios.$get('v1/atfield/list', {
params: { slug }
})
}
export const getMixinSearch = ({ $axios, page, type, q }) => {
return $axios.$get('v1/search/mixin', {
params: { page, type, q }
})
}
export const getTimeline = ({ $axios, type, slug }) => {
return $axios.$get(`v1/${type}/timeline`, {
params: { slug }
})
}
export const getFlowRecommendedIndex = ({ $axios, seen_ids, rand_id }) => {
return $axios.$get('v1/flow/index', {
params: { seen_ids, rand_id }
})
}
export const tagHottest = ({ $axios, page, take }) =>
$axios.$get('v1/tag/hottest', {
params: { page, take }
})
export const getBangumiQuestionTrials = ({ $axios, page, take, bangumi_slug, user_slug, status, sort }) => {
return $axios.$get('v1/join/flow', {
params: {
page,
take,
bangumi_slug,
user_slug,
status,
sort
}
})
}
export const getIdolFans = ({ $axios, page, take, slug, sort }) => {
return $axios.$get('v1/idol/fans', {
params: {
page,
take,
slug,
sort
}
})
}