@ukwhatn/wikidot 1.0.1 → 1.0.3

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 ADDED
@@ -0,0 +1,85 @@
1
+ # wikidot.py - A Python library for making requests to the Wikidot sites.
2
+
3
+ ## Installation
4
+ ```bash
5
+ npm install @ukwhatn/wikidot
6
+ ```
7
+
8
+ ## Usage
9
+ > [!NOTE]
10
+ > You can use this library without logging in, but you can only use the features that do not require logging in.
11
+ ```ts
12
+ import {Client} from "@ukwhatn/wikidot";
13
+
14
+ // Create a new Client class and logging in with the credentials of your wikidot account
15
+ // If you don't want to log in:
16
+ // const client = await Client.init();
17
+ const client = await Client.init('input-your-name', 'input-your-password');
18
+
19
+ // ------
20
+ // user features
21
+ // ------
22
+ // Get the user object of the user
23
+ const user = await client.user.get('input-a-username');
24
+ // Bulk execution by asynchronous request
25
+ const users = await client.user.getBulk(['input-a-username', 'input-another-username']);
26
+
27
+ // ------
28
+ // site features
29
+ // ------
30
+ // Get the site object of the SCP Foundation
31
+ const site = await client.site.get('scp-wiki');
32
+
33
+ // invite a user to the site
34
+ await site.inviteUser(user)
35
+
36
+ // Get all unprocessed applications for the site
37
+ const applications = await site.getApplications()
38
+
39
+ // process an application
40
+ for (const application of applications) {
41
+ application.accept()
42
+ // or
43
+ application.reject()
44
+ }
45
+
46
+ // ------
47
+ // page features
48
+ // ------
49
+ // Search pages by some criteria
50
+ // NOTE: The search criteria are the same as in the ListPages module
51
+ pages = await site.pages.search({
52
+ category: "_default",
53
+ tags: ["tag1", "tag2"], // You can also use the "tag1 -tag2" syntax
54
+ order: "created_at desc desc",
55
+ limit: 10,
56
+ })
57
+
58
+ // Get the page object of the SCP-001
59
+ const page = await site.page.get('scp-001')
60
+
61
+ // destroy a page
62
+ await page.destroy()
63
+
64
+ // ------
65
+ // private message features
66
+ // ------
67
+ // Get messages in your inbox
68
+ const receivedMessages = await client.privateMessage.getInbox()
69
+
70
+ // Get messages in your sent box
71
+ const sentMessages = await client.privateMessage.getSentbox()
72
+
73
+ // Get message by id
74
+ // NOTE: You can only get the message that you have received or sent
75
+ message = client.privateMessage.getMessage(123456)
76
+ // Bulk execution by asynchronous request
77
+ messages = client.privateMessage.getMessages([123456, 123457])
78
+
79
+ // Send a message to a user
80
+ await client.privateMessage.send(
81
+ recipient = user,
82
+ subject = 'Hello',
83
+ body = 'Hello, world!'
84
+ )
85
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ukwhatn/wikidot",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "Library for requesting data to Wikidot",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -21,7 +21,7 @@
21
21
  },
22
22
  "scripts": {
23
23
  "test": "echo \"Error: no test specified\" && exit 1",
24
- "build": "tsc",
24
+ "build": "rm -rf dist && tsc",
25
25
  "prepare": "npm run build"
26
26
  }
27
27
  }
File without changes
@@ -1,2 +0,0 @@
1
- "use strict";
2
- //# sourceMappingURL=decorators.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"decorators.js","sourceRoot":"","sources":["../../src/common/decorators.ts"],"names":[],"mappings":""}