@theophilusdev/conduit 1.0.1 → 1.0.2

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.
Files changed (3) hide show
  1. package/README.md +57 -38
  2. package/docs/DOCS.md +122 -96
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -5,10 +5,12 @@
5
5
  > A lightweight TypeScript wrapper around [`@dongdev/fca-unofficial`](https://github.com/dongp06/fca-unofficial) with a clean, middleware-based event system.
6
6
 
7
7
  ```ts
8
- const conduit = new ConduitClient({ listenEvents: true });
9
- await conduit.login({ appstate });
8
+ import { ConduitClient } from "@theophilusdev/conduit";
10
9
 
11
- conduit.on("message:create", async (ctx) => {
10
+ const client = new ConduitClient({ listenEvents: true });
11
+ await client.login({ appstate });
12
+
13
+ client.on("message:create", async (ctx) => {
12
14
  await ctx.reply(`hey, you said: ${ctx.body}`);
13
15
  });
14
16
  ```
@@ -22,18 +24,19 @@ npm install @theophilusdev/conduit
22
24
  ## Quick Start
23
25
 
24
26
  ```ts
25
- import { ConduitClient } from "conduit";
27
+ import { ConduitClient } from "@theophilusdev/conduit";
26
28
  import appstate from "./appstate.json" assert { type: "json" };
27
29
 
28
- const conduit = new ConduitClient({ listenEvents: true });
30
+ const client = new ConduitClient({ listenEvents: true });
29
31
 
30
- await conduit.login({ appstate });
32
+ await client.login({ appstate });
31
33
 
32
- conduit.on("message:create", async (ctx, next) => {
34
+ client.on("message:create", async (ctx, next) => {
33
35
  if (ctx.body === "ping") {
34
36
  await ctx.reply("pong");
35
37
  return;
36
38
  }
39
+
37
40
  await next();
38
41
  });
39
42
  ```
@@ -50,56 +53,67 @@ Pass **one** of the following to `.login()`:
50
53
 
51
54
  ```ts
52
55
  // appstate (recommended)
53
- await conduit.login({ appstate: [...] });
56
+ await client.login({ appstate: [...] });
54
57
 
55
58
  // raw cookies
56
- await conduit.login({ cookies: "c_user=...; xs=..." });
59
+ await client.login({ cookies: "c_user=...; xs=..." });
57
60
 
58
61
  // email/password (not recommended)
59
- await conduit.login({ account: { email: "...", password: "..." } });
62
+ await client.login({
63
+ account: { email: "...", password: "..." },
64
+ });
60
65
  ```
61
66
 
62
67
  ## Events
63
68
 
64
- Register handlers with `.on(event, ...middlewares)`. Handlers receive an enriched context object and an optional `next` function to pass control down the stack.
69
+ Register handlers with `.on(event, ...middlewares)`.
70
+
71
+ Handlers receive a context object and an optional `next()` function for middleware chaining.
65
72
 
66
- All events include a `send(body)` helper. Events in the `message:*` namespace additionally include `reply(body)` and `react(emoji)`.
73
+ All events include:
74
+
75
+ - `send(body)`
76
+
77
+ Message events additionally include:
78
+
79
+ - `reply(body)`
80
+ - `react(emoji)`
67
81
 
68
82
  ### Message Events
69
83
 
70
- | Event | Trigger |
71
- | ----------------- | -------------------------------------------------------------- |
72
- | `message:create` | New message received |
73
- | `message:respond` | Reply to an existing message |
74
- | `message:remove` | Message unsent by sender |
75
- | `message:react` | Reaction added or removed |
76
- | `message:writing` | User started or stopped typing (requires `listenTyping: true`) |
77
- | `message:read` | Thread or message marked as read |
84
+ | Event | Description |
85
+ | ----------------- | ------------------------------------------------ |
86
+ | `message:create` | New message received |
87
+ | `message:respond` | Reply to an existing message |
88
+ | `message:remove` | Message unsent by sender |
89
+ | `message:react` | Reaction added or removed |
90
+ | `message:writing` | Typing indicator (requires `listenTyping: true`) |
91
+ | `message:read` | Thread or message marked as read |
78
92
 
79
93
  ### User Events
80
94
 
81
- | Event | Trigger |
95
+ | Event | Description |
82
96
  | ------------- | -------------------------------------------- |
83
97
  | `user:create` | User added to a group thread |
84
98
  | `user:remove` | User left or was removed from a group thread |
85
99
 
86
100
  ### Thread Events
87
101
 
88
- | Event | Trigger |
89
- | ------------------------- | ------------------------------------------ |
90
- | `thread:update` | Any thread metadata change (catch-all) |
91
- | `thread:title_change` | Group title updated |
92
- | `thread:photo_replaced` | Group photo changed |
93
- | `thread:theme_changed` | Chat theme or color changed |
94
- | `thread:nickname_changed` | A participant's nickname changed |
95
- | `thread:admin_changed` | A participant promoted or demoted as admin |
102
+ | Event | Description |
103
+ | ------------------------- | ---------------------------- |
104
+ | `thread:update` | Catch-all for thread updates |
105
+ | `thread:title_change` | Group title updated |
106
+ | `thread:photo_replaced` | Group photo changed |
107
+ | `thread:theme_changed` | Chat theme changed |
108
+ | `thread:nickname_changed` | Participant nickname updated |
109
+ | `thread:admin_changed` | Admin role changed |
96
110
 
97
111
  ## Middleware
98
112
 
99
- `.on()` accepts multiple handlers. Each must call `next()` to pass control to the next one.
113
+ `.on()` accepts multiple handlers. Each must call `next()` to continue the chain.
100
114
 
101
115
  ```ts
102
- conduit.on(
116
+ client.on(
103
117
  "message:create",
104
118
  async (ctx, next) => {
105
119
  console.log("middleware 1");
@@ -114,26 +128,31 @@ conduit.on(
114
128
 
115
129
  ## Raw FCA Access
116
130
 
117
- For events or methods not yet covered by conduit, you can drop down to the raw FCA layer:
131
+ Drop down to FCA when needed:
118
132
 
119
133
  ```ts
120
134
  // raw FCA event
121
- conduit.onFca("presence", async (data) => {
135
+ client.onFca("presence", async (data) => {
122
136
  console.log(data);
123
137
  });
124
138
 
125
- // raw FCA api (no type safety)
126
- conduit.api.getThreadList(10, null, ["INBOX"]);
139
+ // raw FCA API (no type safety)
140
+ client.api.getThreadList(10, null, ["INBOX"]);
127
141
  ```
128
142
 
129
143
  ## API Reference
130
144
 
131
- See [docs/DOCS.md](docs/DOCS.md) for the full API reference covering `client.messages`, `client.threads`, `client.users`, and `client.account`.
145
+ See [docs/DOCS.md](docs/DOCS.md) for full API details:
146
+
147
+ - `client.messages`
148
+ - `client.threads`
149
+ - `client.users`
150
+ - `client.account`
132
151
 
133
152
  ## License
134
153
 
135
- GNU GPL v3 © [theophilusdev](https://github.com/TheophilusWorks)
154
+ GNU GPL v3 © theophilusdev
136
155
 
137
156
  ---
138
157
 
139
- Built on top of [`@dongdev/fca-unofficial`](https://github.com/dongp06/fca-unofficial). Credit to dongp06 and all contributors to the fca-unofficial project.
158
+ Built on top of [`@dongdev/fca-unofficial`](https://github.com/dongp06/fca-unofficial).
package/docs/DOCS.md CHANGED
@@ -1,6 +1,6 @@
1
- # conduit — API Reference
1
+ # Conduit — API Reference
2
2
 
3
- Full reference for all namespaced APIs exposed by `ConduitClient`.
3
+ Full reference for all APIs exposed by `ConduitClient`.
4
4
 
5
5
  ## Table of Contents
6
6
 
@@ -16,28 +16,33 @@ Full reference for all namespaced APIs exposed by `ConduitClient`.
16
16
  ## ConduitClient
17
17
 
18
18
  ```ts
19
- import { ConduitClient } from "conduit";
19
+ import { ConduitClient } from "@theophilusdev/conduit";
20
20
 
21
- const conduit = new ConduitClient(config);
22
- await conduit.login(credentials);
21
+ const client = new ConduitClient(config);
22
+ await client.login(credentials);
23
23
  ```
24
24
 
25
+ ---
26
+
25
27
  ### Constructor
26
28
 
27
29
  ```ts
28
30
  new ConduitClient(config: ConduitClientConfig)
29
31
  ```
30
32
 
31
- `ConduitClientConfig` extends `MessengerBotOptions` from `@dongdev/fca-unofficial`. The `logLevel` defaults to `"silent"` if not provided.
33
+ Creates a new Conduit client instance.
34
+
35
+ - Extends `MessengerBotOptions` from `@dongdev/fca-unofficial`
36
+ - `logLevel` defaults to `"silent"`
32
37
 
33
38
  ---
34
39
 
35
40
  ### `.login(credentials)`
36
41
 
37
- Authenticates with Messenger and initialises the underlying FCA bot. Must be called before any events can be received.
42
+ Authenticates with Messenger and initializes the client.
38
43
 
39
44
  ```ts
40
- await conduit.login(credentials: ConduitCredentials): Promise<ConduitClient>
45
+ await client.login(credentials: ConduitCredentials): Promise<ConduitClient>
41
46
  ```
42
47
 
43
48
  Returns the client instance for chaining.
@@ -46,14 +51,14 @@ Returns the client instance for chaining.
46
51
 
47
52
  ### `.on(event, ...middlewares)`
48
53
 
49
- Registers one or more middleware handlers for a Conduit event. The first call for a given event also binds the corresponding FCA listener internally.
54
+ Registers one or more middleware handlers for a Conduit event.
50
55
 
51
56
  ```ts
52
- conduit.on(event: keyof ConduitEvents, ...middlewares: Middleware[]): this
57
+ client.on(event: keyof ConduitEvents, ...middlewares: Middleware[]): this
53
58
  ```
54
59
 
55
60
  ```ts
56
- conduit.on("message:create", async (ctx, next) => {
61
+ client.on("message:create", async (ctx, next) => {
57
62
  await ctx.reply("hello!");
58
63
  await next();
59
64
  });
@@ -63,27 +68,33 @@ conduit.on("message:create", async (ctx, next) => {
63
68
 
64
69
  ### `.onFca(event, ...middlewares)`
65
70
 
66
- Registers middleware directly against a raw FCA event, bypassing the Conduit abstraction. Useful for events not yet mapped by conduit.
71
+ Registers middleware directly on raw FCA events.
67
72
 
68
73
  ```ts
69
- conduit.onFca(event: string, ...middlewares): this
74
+ client.onFca(event: string, ...middlewares): this
70
75
  ```
71
76
 
72
77
  ---
73
78
 
74
79
  ### `.api`
75
80
 
76
- Direct access to the raw FCA api context. No type safety or autocompletion — use as a last resort.
81
+ Direct access to the raw FCA API.
77
82
 
78
83
  ```ts
79
- conduit.api.getThreadList(10, null, ["INBOX"]);
84
+ client.api.getThreadList(10, null, ["INBOX"]);
80
85
  ```
81
86
 
82
87
  ---
83
88
 
84
89
  ## client.messages
85
90
 
86
- Accessible via `conduit.messages`. Handles all message-level operations.
91
+ Accessible via:
92
+
93
+ ```ts
94
+ client.messages;
95
+ ```
96
+
97
+ Handles message-level operations.
87
98
 
88
99
  ---
89
100
 
@@ -92,27 +103,27 @@ Accessible via `conduit.messages`. Handles all message-level operations.
92
103
  Sends a plain text message to a thread.
93
104
 
94
105
  ```ts
95
- await conduit.messages.send("hello", threadID);
106
+ await client.messages.send("hello", threadID);
96
107
  ```
97
108
 
98
109
  ---
99
110
 
100
111
  ### `.reply(body, threadID, messageID)`
101
112
 
102
- Sends a quoted reply to a specific message.
113
+ Sends a reply to a specific message.
103
114
 
104
115
  ```ts
105
- await conduit.messages.reply("got it", threadID, messageID);
116
+ await client.messages.reply("got it", threadID, messageID);
106
117
  ```
107
118
 
108
119
  ---
109
120
 
110
121
  ### `.edit(messageID, body)`
111
122
 
112
- Edits an existing message sent by the bot.
123
+ Edits an existing message.
113
124
 
114
125
  ```ts
115
- await conduit.messages.edit(messageID, "updated text");
126
+ await client.messages.edit(messageID, "updated text");
116
127
  ```
117
128
 
118
129
  ---
@@ -122,7 +133,7 @@ await conduit.messages.edit(messageID, "updated text");
122
133
  Retracts a message sent by the bot.
123
134
 
124
135
  ```ts
125
- await conduit.messages.unsend(messageID);
136
+ await client.messages.unsend(messageID);
126
137
  ```
127
138
 
128
139
  ---
@@ -132,7 +143,7 @@ await conduit.messages.unsend(messageID);
132
143
  Deletes a message.
133
144
 
134
145
  ```ts
135
- await conduit.messages.delete(messageID);
146
+ await client.messages.delete(messageID);
136
147
  ```
137
148
 
138
149
  ---
@@ -142,17 +153,17 @@ await conduit.messages.delete(messageID);
142
153
  Adds or removes a reaction on a message.
143
154
 
144
155
  ```ts
145
- await conduit.messages.react("👍", messageID, threadID);
156
+ await client.messages.react("👍", messageID, threadID);
146
157
  ```
147
158
 
148
159
  ---
149
160
 
150
161
  ### `.sendTypingIndicator(threadID)`
151
162
 
152
- Sends a typing indicator to a thread.
163
+ Sends a typing indicator.
153
164
 
154
165
  ```ts
155
- await conduit.messages.sendTypingIndicator(threadID);
166
+ await client.messages.sendTypingIndicator(threadID);
156
167
  ```
157
168
 
158
169
  ---
@@ -162,205 +173,209 @@ await conduit.messages.sendTypingIndicator(threadID);
162
173
  Marks a message as read.
163
174
 
164
175
  ```ts
165
- await conduit.messages.markAsRead(messageID);
176
+ await client.messages.markAsRead(messageID);
166
177
  ```
167
178
 
168
179
  ---
169
180
 
170
181
  ### `.uploadAttachment(file)`
171
182
 
172
- Uploads a file attachment and returns an attachment object that can be used in subsequent sends.
183
+ Uploads a file attachment.
173
184
 
174
185
  ```ts
175
- const attachment = await conduit.messages.uploadAttachment(stream);
186
+ const attachment = await client.messages.uploadAttachment(stream);
176
187
  ```
177
188
 
178
189
  ---
179
190
 
180
191
  ### `.forwardAttachment(attachmentID, threadID)`
181
192
 
182
- Forwards an existing attachment to another thread.
193
+ Forwards an attachment to another thread.
183
194
 
184
195
  ```ts
185
- await conduit.messages.forwardAttachment(attachmentID, threadID);
196
+ await client.messages.forwardAttachment(attachmentID, threadID);
186
197
  ```
187
198
 
188
199
  ---
189
200
 
190
201
  ### `.shareContact(userID, threadID)`
191
202
 
192
- Shares a contact card to a thread.
203
+ Shares a contact card.
193
204
 
194
205
  ```ts
195
- await conduit.messages.shareContact(userID, threadID);
206
+ await client.messages.shareContact(userID, threadID);
196
207
  ```
197
208
 
198
209
  ---
199
210
 
200
211
  ### `.changeThreadColor(color, threadID)`
201
212
 
202
- Changes the color theme of a thread.
213
+ Changes thread color.
203
214
 
204
215
  ```ts
205
- await conduit.messages.changeThreadColor("#FF0000", threadID);
216
+ await client.messages.changeThreadColor("#FF0000", threadID);
206
217
  ```
207
218
 
208
219
  ---
209
220
 
210
221
  ### `.changeThreadEmoji(emoji, threadID)`
211
222
 
212
- Changes the quick-reaction emoji of a thread.
223
+ Changes thread emoji.
213
224
 
214
225
  ```ts
215
- await conduit.messages.changeThreadEmoji("🔥", threadID);
226
+ await client.messages.changeThreadEmoji("🔥", threadID);
216
227
  ```
217
228
 
218
229
  ---
219
230
 
220
231
  ### `.getMessage(messageID)`
221
232
 
222
- Fetches a specific message by ID.
233
+ Fetches a message by ID.
223
234
 
224
235
  ```ts
225
- const message = await conduit.messages.getMessage(messageID);
236
+ const message = await client.messages.getMessage(messageID);
226
237
  ```
227
238
 
228
239
  ---
229
240
 
230
241
  ### `.getThreadColors()`
231
242
 
232
- Returns all available thread color themes.
243
+ Returns available thread colors.
233
244
 
234
245
  ```ts
235
- const colors = await conduit.messages.getThreadColors();
246
+ const colors = await client.messages.getThreadColors();
236
247
  ```
237
248
 
238
249
  ---
239
250
 
240
251
  ## client.threads
241
252
 
242
- Accessible via `conduit.threads`. Handles thread-level operations.
253
+ Accessible via:
254
+
255
+ ```ts
256
+ client.threads;
257
+ ```
258
+
259
+ Handles thread-level operations.
243
260
 
244
261
  ---
245
262
 
246
263
  ### `.getInfo(threadID)`
247
264
 
248
- Fetches detailed info about a thread including participants, name, and settings.
265
+ Fetches thread information.
249
266
 
250
267
  ```ts
251
- const info = await conduit.threads.getInfo(threadID);
268
+ const info = await client.threads.getInfo(threadID);
252
269
  ```
253
270
 
254
271
  ---
255
272
 
256
273
  ### `.getList(limit, cursor, folders)`
257
274
 
258
- Fetches a paginated list of threads.
275
+ Fetches a list of threads.
259
276
 
260
277
  ```ts
261
- const threads = await conduit.threads.getList(10, null, ["INBOX"]);
278
+ const threads = await client.threads.getList(10, null, ["INBOX"]);
262
279
  ```
263
280
 
264
281
  ---
265
282
 
266
283
  ### `.getHistory(threadID, limit)`
267
284
 
268
- Fetches message history for a thread.
285
+ Fetches message history.
269
286
 
270
287
  ```ts
271
- const history = await conduit.threads.getHistory(threadID, 20);
288
+ const history = await client.threads.getHistory(threadID, 20);
272
289
  ```
273
290
 
274
291
  ---
275
292
 
276
293
  ### `.search(query)`
277
294
 
278
- Searches for threads by name or keyword.
295
+ Searches threads.
279
296
 
280
297
  ```ts
281
- const results = await conduit.threads.search("dev chat");
298
+ const results = await client.threads.search("dev chat");
282
299
  ```
283
300
 
284
301
  ---
285
302
 
286
303
  ### `.createGroup(userIDs, name?)`
287
304
 
288
- Creates a new group conversation.
305
+ Creates a group conversation.
289
306
 
290
307
  ```ts
291
- const thread = await conduit.threads.createGroup(["uid1", "uid2"], "my group");
308
+ const thread = await client.threads.createGroup(["uid1", "uid2"], "my group");
292
309
  ```
293
310
 
294
311
  ---
295
312
 
296
313
  ### `.addUser(userID, threadID)`
297
314
 
298
- Adds a user to an existing group thread.
315
+ Adds a user to a thread.
299
316
 
300
317
  ```ts
301
- await conduit.threads.addUser(userID, threadID);
318
+ await client.threads.addUser(userID, threadID);
302
319
  ```
303
320
 
304
321
  ---
305
322
 
306
323
  ### `.removeUser(userID, threadID)`
307
324
 
308
- Removes a user from a group thread.
325
+ Removes a user from a thread.
309
326
 
310
327
  ```ts
311
- await conduit.threads.removeUser(userID, threadID);
328
+ await client.threads.removeUser(userID, threadID);
312
329
  ```
313
330
 
314
331
  ---
315
332
 
316
333
  ### `.changeAdminStatus(userID, threadID, admin)`
317
334
 
318
- Promotes or demotes a user's admin status in a group.
335
+ Changes admin status.
319
336
 
320
337
  ```ts
321
- await conduit.threads.changeAdminStatus(userID, threadID, true); // promote
322
- await conduit.threads.changeAdminStatus(userID, threadID, false); // demote
338
+ await client.threads.changeAdminStatus(userID, threadID, true);
323
339
  ```
324
340
 
325
341
  ---
326
342
 
327
343
  ### `.changeGroupImage(image, threadID)`
328
344
 
329
- Updates the group's profile image.
345
+ Updates group image.
330
346
 
331
347
  ```ts
332
- await conduit.threads.changeGroupImage(stream, threadID);
348
+ await client.threads.changeGroupImage(stream, threadID);
333
349
  ```
334
350
 
335
351
  ---
336
352
 
337
353
  ### `.changeNickname(nickname, threadID, userID)`
338
354
 
339
- Sets a participant's nickname. Pass an empty string to clear.
355
+ Sets nickname.
340
356
 
341
357
  ```ts
342
- await conduit.threads.changeNickname("nick", threadID, userID);
343
- await conduit.threads.changeNickname("", threadID, userID); // clear
358
+ await client.threads.changeNickname("nick", threadID, userID);
344
359
  ```
345
360
 
346
361
  ---
347
362
 
348
363
  ### `.setTitle(title, threadID)`
349
364
 
350
- Changes the title of a group thread.
365
+ Changes thread title.
351
366
 
352
367
  ```ts
353
- await conduit.threads.setTitle("new title", threadID);
368
+ await client.threads.setTitle("new title", threadID);
354
369
  ```
355
370
 
356
371
  ---
357
372
 
358
373
  ### `.createPoll(title, threadID, options)`
359
374
 
360
- Creates a poll in a thread.
375
+ Creates a poll.
361
376
 
362
377
  ```ts
363
- await conduit.threads.createPoll("Favourite language?", threadID, [
378
+ await client.threads.createPoll("Favourite language?", threadID, [
364
379
  "TypeScript",
365
380
  "Python",
366
381
  ]);
@@ -373,81 +388,89 @@ await conduit.threads.createPoll("Favourite language?", threadID, [
373
388
  Deletes a thread.
374
389
 
375
390
  ```ts
376
- await conduit.threads.delete(threadID);
391
+ await client.threads.delete(threadID);
377
392
  ```
378
393
 
379
394
  ---
380
395
 
381
396
  ### `.mute(threadID, muteUntil)`
382
397
 
383
- Mutes or unmutes notifications for a thread.
398
+ Mutes or unmutes a thread.
384
399
 
385
400
  ```ts
386
- await conduit.threads.mute(threadID, -1); // mute indefinitely
387
- await conduit.threads.mute(threadID, 0); // unmute
401
+ await client.threads.mute(threadID, -1);
402
+ await client.threads.mute(threadID, 0);
388
403
  ```
389
404
 
390
405
  ---
391
406
 
392
407
  ### `.handleMessageRequest(threadID, accept)`
393
408
 
394
- Accepts or declines a message request.
409
+ Handles message requests.
395
410
 
396
411
  ```ts
397
- await conduit.threads.handleMessageRequest(threadID, true);
412
+ await client.threads.handleMessageRequest(threadID, true);
398
413
  ```
399
414
 
400
415
  ---
401
416
 
402
417
  ## client.users
403
418
 
404
- Accessible via `conduit.users`. Handles user-related operations.
419
+ Accessible via:
420
+
421
+ ```ts
422
+ client.users;
423
+ ```
405
424
 
406
425
  ---
407
426
 
408
427
  ### `.getInfo(userID)`
409
428
 
410
- Fetches info for one or more users by ID.
429
+ Fetches user info.
411
430
 
412
431
  ```ts
413
- const user = await conduit.users.getInfo("uid");
414
- const users = await conduit.users.getInfo(["uid1", "uid2"]);
432
+ const user = await client.users.getInfo("uid");
433
+ const users = await client.users.getInfo(["uid1", "uid2"]);
415
434
  ```
416
435
 
417
436
  ---
418
437
 
419
438
  ### `.getID(vanity)`
420
439
 
421
- Resolves a vanity URL or username to a Facebook user ID.
440
+ Resolves username to ID.
422
441
 
423
442
  ```ts
424
- const id = await conduit.users.getID("zuck");
443
+ const id = await client.users.getID("zuck");
425
444
  ```
426
445
 
427
446
  ---
428
447
 
429
448
  ### `.getFriendsList()`
430
449
 
431
- Returns the authenticated user's friends list.
450
+ Returns friends list.
432
451
 
433
452
  ```ts
434
- const friends = await conduit.users.getFriendsList();
453
+ const friends = await client.users.getFriendsList();
435
454
  ```
436
455
 
437
456
  ---
438
457
 
439
458
  ## client.account
440
459
 
441
- Accessible via `conduit.account`. Handles account-level operations for the authenticated user.
460
+ Accessible via:
461
+
462
+ ```ts
463
+ client.account;
464
+ ```
442
465
 
443
466
  ---
444
467
 
445
468
  ### `.getCurrentUserID()`
446
469
 
447
- Returns the logged-in user's Facebook ID synchronously.
470
+ Returns current user ID.
448
471
 
449
472
  ```ts
450
- const myID = conduit.account.getCurrentUserID();
473
+ const myID = client.account.getCurrentUserID();
451
474
  ```
452
475
 
453
476
  ---
@@ -457,46 +480,43 @@ const myID = conduit.account.getCurrentUserID();
457
480
  Blocks or unblocks a user.
458
481
 
459
482
  ```ts
460
- await conduit.account.blockUser(userID, true); // block
461
- await conduit.account.blockUser(userID, false); // unblock
483
+ await client.account.blockUser(userID, true);
462
484
  ```
463
485
 
464
486
  ---
465
487
 
466
488
  ### `.handleFriendRequest(userID, accept)`
467
489
 
468
- Accepts or declines a friend request.
490
+ Handles friend requests.
469
491
 
470
492
  ```ts
471
- await conduit.account.handleFriendRequest(userID, true);
493
+ await client.account.handleFriendRequest(userID, true);
472
494
  ```
473
495
 
474
496
  ---
475
497
 
476
498
  ### `.unfriend(userID)`
477
499
 
478
- Removes a user from the friends list.
500
+ Removes a friend.
479
501
 
480
502
  ```ts
481
- await conduit.account.unfriend(userID);
503
+ await client.account.unfriend(userID);
482
504
  ```
483
505
 
484
506
  ---
485
507
 
486
508
  ### `.logout()`
487
509
 
488
- Ends the current session and invalidates cookies.
510
+ Logs out of the session.
489
511
 
490
512
  ```ts
491
- await conduit.account.logout();
513
+ await client.account.logout();
492
514
  ```
493
515
 
494
516
  ---
495
517
 
496
518
  ## Types
497
519
 
498
- Key types exported from conduit. See `src/types.ts` for the full source.
499
-
500
520
  ### `ConduitCredentials`
501
521
 
502
522
  ```ts
@@ -510,6 +530,8 @@ interface ConduitCredentials {
510
530
  }
511
531
  ```
512
532
 
533
+ ---
534
+
513
535
  ### `Message`
514
536
 
515
537
  ```ts
@@ -525,6 +547,8 @@ interface Message {
525
547
  }
526
548
  ```
527
549
 
550
+ ---
551
+
528
552
  ### `Middleware<K>`
529
553
 
530
554
  ```ts
@@ -534,6 +558,8 @@ type Middleware<K extends keyof ConduitEvents> = (
534
558
  ) => Promise<void>;
535
559
  ```
536
560
 
561
+ ---
562
+
537
563
  ### `ConduitEvents`
538
564
 
539
- The full map of event names to their payload types. See `src/types.ts` for all payload shapes (`MessageCreatePayload`, `ThreadTitleChangePayload`, etc.).
565
+ Full event map is defined in `src/types.ts`.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@theophilusdev/conduit",
3
3
  "description": "A simple FCA wrapper library with typescript support",
4
- "version": "1.0.1",
4
+ "version": "1.0.2",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
7
7
  "module": "./dist/index.mjs",