@ukwhatn/wikidot 1.0.0 → 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.
- package/README.md +85 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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/dist/index.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Client } from './module/client';
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Client = void 0;
|
|
4
|
+
var client_1 = require("./module/client");
|
|
5
|
+
Object.defineProperty(exports, "Client", { enumerable: true, get: function () { return client_1.Client; } });
|
|
2
6
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,0CAAuC;AAA/B,gGAAA,MAAM,OAAA"}
|