@molecule/api-resource-follow 1.0.5 → 1.0.6
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/README.md +58 -58
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@ AUTO-GENERATED — DO NOT EDIT THIS FILE.
|
|
|
3
3
|
Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
|
|
4
4
|
Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
|
|
5
5
|
To change this document, edit the module-level JSDoc in src/index.ts.
|
|
6
|
-
Generated: 2026-
|
|
6
|
+
Generated: 2026-10-16T00:32:23.444Z
|
|
7
7
|
-->
|
|
8
8
|
|
|
9
9
|
# @molecule/api-resource-follow
|
|
@@ -65,6 +65,19 @@ interface Follow {
|
|
|
65
65
|
}
|
|
66
66
|
```
|
|
67
67
|
|
|
68
|
+
#### `PaginationOptions`
|
|
69
|
+
|
|
70
|
+
Options for paginated queries.
|
|
71
|
+
|
|
72
|
+
```typescript
|
|
73
|
+
interface PaginationOptions {
|
|
74
|
+
/** Maximum number of results to return. */
|
|
75
|
+
limit?: number
|
|
76
|
+
/** Number of results to skip. */
|
|
77
|
+
offset?: number
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
68
81
|
#### `PaginatedResult`
|
|
69
82
|
|
|
70
83
|
A paginated result set.
|
|
@@ -82,49 +95,58 @@ interface PaginatedResult<T> {
|
|
|
82
95
|
}
|
|
83
96
|
```
|
|
84
97
|
|
|
85
|
-
|
|
98
|
+
### Functions
|
|
86
99
|
|
|
87
|
-
|
|
100
|
+
#### `create(req, res)`
|
|
101
|
+
|
|
102
|
+
Creates a follow relationship. Idempotent.
|
|
88
103
|
|
|
89
104
|
```typescript
|
|
90
|
-
|
|
91
|
-
/** Maximum number of results to return. */
|
|
92
|
-
limit?: number
|
|
93
|
-
/** Number of results to skip. */
|
|
94
|
-
offset?: number
|
|
95
|
-
}
|
|
105
|
+
function create(req: MoleculeRequest, res: MoleculeResponse): Promise<void>
|
|
96
106
|
```
|
|
97
107
|
|
|
98
|
-
|
|
108
|
+
- `req` — The request with `targetType` and `targetId` params.
|
|
109
|
+
- `res` — The response object.
|
|
99
110
|
|
|
100
|
-
#### `
|
|
111
|
+
#### `del(req, res)`
|
|
101
112
|
|
|
102
|
-
|
|
113
|
+
Removes a follow relationship.
|
|
103
114
|
|
|
104
115
|
```typescript
|
|
105
|
-
function
|
|
116
|
+
function del(req: MoleculeRequest, res: MoleculeResponse): Promise<void>
|
|
106
117
|
```
|
|
107
118
|
|
|
108
119
|
- `req` — The request with `targetType` and `targetId` params.
|
|
109
120
|
- `res` — The response object.
|
|
110
121
|
|
|
111
|
-
#### `
|
|
122
|
+
#### `list(req, res)`
|
|
112
123
|
|
|
113
|
-
|
|
124
|
+
Lists paginated followers of a target.
|
|
114
125
|
|
|
115
126
|
```typescript
|
|
116
|
-
function
|
|
127
|
+
function list(req: MoleculeRequest, res: MoleculeResponse): Promise<void>
|
|
117
128
|
```
|
|
118
129
|
|
|
119
130
|
- `req` — The request with `targetType` and `targetId` params.
|
|
120
131
|
- `res` — The response object.
|
|
121
132
|
|
|
122
|
-
#### `
|
|
133
|
+
#### `following(req, res)`
|
|
123
134
|
|
|
124
|
-
|
|
135
|
+
Lists targets the current user is following.
|
|
125
136
|
|
|
126
137
|
```typescript
|
|
127
|
-
function
|
|
138
|
+
function following(req: MoleculeRequest, res: MoleculeResponse): Promise<void>
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
- `req` — The request with pagination query params.
|
|
142
|
+
- `res` — The response object.
|
|
143
|
+
|
|
144
|
+
#### `checkFollowing(req, res)`
|
|
145
|
+
|
|
146
|
+
Checks if the current user is following a target.
|
|
147
|
+
|
|
148
|
+
```typescript
|
|
149
|
+
function checkFollowing(req: MoleculeRequest, res: MoleculeResponse): Promise<void>
|
|
128
150
|
```
|
|
129
151
|
|
|
130
152
|
- `req` — The request with `targetType` and `targetId` params.
|
|
@@ -144,30 +166,18 @@ function follow(followerId: string, targetType: string, targetId: string): Promi
|
|
|
144
166
|
|
|
145
167
|
**Returns:** The created or existing follow.
|
|
146
168
|
|
|
147
|
-
#### `
|
|
148
|
-
|
|
149
|
-
Lists targets the current user is following.
|
|
150
|
-
|
|
151
|
-
```typescript
|
|
152
|
-
function following(req: MoleculeRequest, res: MoleculeResponse): Promise<void>
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
- `req` — The request with pagination query params.
|
|
156
|
-
- `res` — The response object.
|
|
157
|
-
|
|
158
|
-
#### `getFollowerCount(targetType, targetId)`
|
|
169
|
+
#### `unfollow(followerId, targetType, targetId)`
|
|
159
170
|
|
|
160
|
-
|
|
171
|
+
Removes a follow relationship.
|
|
161
172
|
|
|
162
173
|
```typescript
|
|
163
|
-
function
|
|
174
|
+
function unfollow(followerId: string, targetType: string, targetId: string): Promise<void>
|
|
164
175
|
```
|
|
165
176
|
|
|
177
|
+
- `followerId` — The ID of the follower.
|
|
166
178
|
- `targetType` — The type of target.
|
|
167
179
|
- `targetId` — The ID of the target.
|
|
168
180
|
|
|
169
|
-
**Returns:** The number of followers.
|
|
170
|
-
|
|
171
181
|
#### `getFollowers(targetType, targetId, options)`
|
|
172
182
|
|
|
173
183
|
Gets paginated followers of a target.
|
|
@@ -199,18 +209,6 @@ function getFollowing(userId: string, options?: PaginationOptions): Promise<Pagi
|
|
|
199
209
|
|
|
200
210
|
**Returns:** Paginated follows.
|
|
201
211
|
|
|
202
|
-
#### `getFollowingCount(userId)`
|
|
203
|
-
|
|
204
|
-
Gets the following count for a user.
|
|
205
|
-
|
|
206
|
-
```typescript
|
|
207
|
-
function getFollowingCount(userId: string): Promise<number>
|
|
208
|
-
```
|
|
209
|
-
|
|
210
|
-
- `userId` — The user ID.
|
|
211
|
-
|
|
212
|
-
**Returns:** The number of targets the user is following.
|
|
213
|
-
|
|
214
212
|
#### `isFollowing(followerId, targetType, targetId)`
|
|
215
213
|
|
|
216
214
|
Checks if a user is following a target.
|
|
@@ -225,28 +223,30 @@ function isFollowing(followerId: string, targetType: string, targetId: string):
|
|
|
225
223
|
|
|
226
224
|
**Returns:** `true` if following.
|
|
227
225
|
|
|
228
|
-
#### `
|
|
226
|
+
#### `getFollowerCount(targetType, targetId)`
|
|
229
227
|
|
|
230
|
-
|
|
228
|
+
Gets the follower count for a target.
|
|
231
229
|
|
|
232
230
|
```typescript
|
|
233
|
-
function
|
|
231
|
+
function getFollowerCount(targetType: string, targetId: string): Promise<number>
|
|
234
232
|
```
|
|
235
233
|
|
|
236
|
-
- `
|
|
237
|
-
- `
|
|
234
|
+
- `targetType` — The type of target.
|
|
235
|
+
- `targetId` — The ID of the target.
|
|
238
236
|
|
|
239
|
-
|
|
237
|
+
**Returns:** The number of followers.
|
|
240
238
|
|
|
241
|
-
|
|
239
|
+
#### `getFollowingCount(userId)`
|
|
240
|
+
|
|
241
|
+
Gets the following count for a user.
|
|
242
242
|
|
|
243
243
|
```typescript
|
|
244
|
-
function
|
|
244
|
+
function getFollowingCount(userId: string): Promise<number>
|
|
245
245
|
```
|
|
246
246
|
|
|
247
|
-
- `
|
|
248
|
-
|
|
249
|
-
|
|
247
|
+
- `userId` — The user ID.
|
|
248
|
+
|
|
249
|
+
**Returns:** The number of targets the user is following.
|
|
250
250
|
|
|
251
251
|
### Constants
|
|
252
252
|
|