Skip to content

Commit dcaa89e

Browse files
committed
API updates.
1 parent 050b477 commit dcaa89e

File tree

4 files changed

+1929
-1304
lines changed

4 files changed

+1929
-1304
lines changed

src/node/node.ts

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1353,6 +1353,43 @@ export class MoeraNode extends Caller {
13531353
}) as API.Result;
13541354
}
13551355

1356+
/**
1357+
* Get the updating key mnemonic stored on the node.
1358+
*
1359+
* @return {Promise<API.KeyMnemonic>}
1360+
*/
1361+
async getStoredMnemonic(): Promise<API.KeyMnemonic> {
1362+
const location = "/node-name/mnemonic";
1363+
return await this.call("getStoredMnemonic", location, {
1364+
method: "GET", schema: "KeyMnemonic"
1365+
}) as API.KeyMnemonic;
1366+
}
1367+
1368+
/**
1369+
* Store the updating key mnemonic on the node.
1370+
*
1371+
* @param {API.KeyMnemonic} mnemonic
1372+
* @return {Promise<API.Result>}
1373+
*/
1374+
async storeMnemonic(mnemonic: API.KeyMnemonic): Promise<API.Result> {
1375+
const location = "/node-name/mnemonic";
1376+
return await this.call("storeMnemonic", location, {
1377+
method: "POST", body: mnemonic, schema: "Result"
1378+
}) as API.Result;
1379+
}
1380+
1381+
/**
1382+
* Delete the updating key mnemonic stored on the node.
1383+
*
1384+
* @return {Promise<API.Result>}
1385+
*/
1386+
async deleteStoredMnemonic(): Promise<API.Result> {
1387+
const location = "/node-name/mnemonic";
1388+
return await this.call("deleteStoredMnemonic", location, {
1389+
method: "DELETE", schema: "Result"
1390+
}) as API.Result;
1391+
}
1392+
13561393
/**
13571394
* Accept a notification packet from another node. Notification packets older than 10 minutes are ignored. The
13581395
* sending node should update the packet timestamp and the signature and send the packet again. This mechanism
@@ -2278,6 +2315,19 @@ export class MoeraNode extends Caller {
22782315
}) as API.StoryInfo;
22792316
}
22802317

2318+
/**
2319+
* Delete the story.
2320+
*
2321+
* @param {string} id - ID of the story
2322+
* @return {Promise<API.Result>}
2323+
*/
2324+
async deleteStory(id: string): Promise<API.Result> {
2325+
const location = ut`/stories/${id}`;
2326+
return await this.call("deleteStory", location, {
2327+
method: "DELETE", schema: "Result"
2328+
}) as API.Result;
2329+
}
2330+
22812331
/**
22822332
* Get the list of all subscribers, optionally filtered by some criteria.
22832333
*

src/node/schemas.mjs

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1196,6 +1196,22 @@ export const NODE_API_SCHEMAS = {
11961196
}
11971197
},
11981198

1199+
KeyMnemonic: {
1200+
type: "object",
1201+
properties: {
1202+
"mnemonic": {
1203+
type: "array",
1204+
items: {
1205+
type: "string"
1206+
}
1207+
},
1208+
},
1209+
required: [
1210+
"mnemonic",
1211+
],
1212+
additionalProperties: false
1213+
},
1214+
11991215
LinkPreview: {
12001216
type: "object",
12011217
properties: {
@@ -1302,6 +1318,10 @@ export const NODE_API_SCHEMAS = {
13021318
type: "string",
13031319
nullable: true
13041320
},
1321+
"storedMnemonic": {
1322+
type: "boolean",
1323+
nullable: true
1324+
},
13051325
"operations": {
13061326
anyOf: [
13071327
{
@@ -2500,6 +2520,27 @@ export const NODE_API_SCHEMAS = {
25002520
additionalProperties: false
25012521
},
25022522

2523+
StorySummaryPageClicks: {
2524+
type: "object",
2525+
properties: {
2526+
"heading": {
2527+
type: "string",
2528+
nullable: true
2529+
},
2530+
"href": {
2531+
type: "string"
2532+
},
2533+
"clicks": {
2534+
type: "integer"
2535+
},
2536+
},
2537+
required: [
2538+
"href",
2539+
"clicks",
2540+
],
2541+
additionalProperties: false
2542+
},
2543+
25032544
StorySummaryReaction: {
25042545
type: "object",
25052546
properties: {
@@ -4013,6 +4054,13 @@ export const NODE_API_SCHEMAS = {
40134054
type: "string",
40144055
nullable: true
40154056
},
4057+
"clicks": {
4058+
type: "array",
4059+
items: {
4060+
$ref: "node#/definitions/StorySummaryPageClicks"
4061+
},
4062+
nullable: true
4063+
},
40164064
},
40174065
additionalProperties: false
40184066
},

src/node/types.ts

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ export const SCOPE_VALUES: Record<Scope, number> = {
6565
"all": 0x3fffffff,
6666
};
6767

68+
export type SearchEngine = "google";
69+
6870
export type SettingType = "bool" | "int" | "string" | "json" | "Duration" | "PrivateKey" | "PublicKey" | "Timestamp"
6971
| "UUID" | "Principal";
7072

@@ -76,7 +78,7 @@ export type SheriffOrderCategory = "visibility";
7678
export type SheriffOrderReason = "unlawful" | "defamatory" | "threat" | "spam" | "scam" | "malware" | "copyright"
7779
| "impersonating" | "privacy" | "other";
7880

79-
export type SourceFormat = "plain-text" | "html" | "markdown" | "application";
81+
export type SourceFormat = "plain-text" | "html" | "markdown" | "html/visual" | "application";
8082

8183
export type StoryType = "asked-to-friend" | "asked-to-subscribe" | "blocked-user" | "blocked-user-in-posting"
8284
| "comment-added" | "comment-media-reaction-added-negative" | "comment-media-reaction-added-positive"
@@ -86,7 +88,8 @@ export type StoryType = "asked-to-friend" | "asked-to-subscribe" | "blocked-user
8688
| "posting-added" | "posting-media-reaction-added-negative" | "posting-media-reaction-added-positive"
8789
| "posting-media-reaction-failed" | "posting-post-task-failed" | "posting-reaction-task-failed"
8890
| "posting-subscribe-task-failed" | "posting-update-task-failed" | "posting-updated" | "reaction-added-negative"
89-
| "reaction-added-positive" | "remote-comment-added" | "reply-comment" | "sheriff-complaint-added"
91+
| "reaction-added-positive" | "reminder-avatar" | "reminder-email" | "reminder-full-name" | "reminder-sheriff-allow"
92+
| "remote-comment-added" | "reply-comment" | "search-report" | "sheriff-complaint-added"
9093
| "sheriff-complaint-decided" | "sheriff-marked" | "sheriff-unmarked" | "subscriber-added" | "subscriber-deleted"
9194
| "unblocked-user" | "unblocked-user-in-posting";
9295

@@ -1186,6 +1189,13 @@ export interface GrantInfo {
11861189
scope: Scope[];
11871190
}
11881191

1192+
export interface KeyMnemonic {
1193+
/**
1194+
* the words
1195+
*/
1196+
mnemonic: string[];
1197+
}
1198+
11891199
export interface LinkPreview {
11901200
/**
11911201
* name of the site
@@ -1332,6 +1342,10 @@ export interface NodeNameInfo {
13321342
* if the operation with the node name was failed, the human-readable description of the failure
13331343
*/
13341344
operationErrorMessage?: string | null;
1345+
/**
1346+
* ``true``, if updating key mnemonic is being stored on the node, ``false`` otherwise
1347+
*/
1348+
storedMnemonic?: boolean | null;
13351349
/**
13361350
* the supported operations and the corresponding principals
13371351
*/
@@ -2630,6 +2644,21 @@ export interface StorySummaryNode {
26302644
ownerGender?: string | null;
26312645
}
26322646

2647+
export interface StorySummaryPageClicks {
2648+
/**
2649+
* page heading, ``null`` for the blog itself
2650+
*/
2651+
heading?: string | null;
2652+
/**
2653+
* page URL
2654+
*/
2655+
href: string;
2656+
/**
2657+
* number of clicks on the page
2658+
*/
2659+
clicks: number;
2660+
}
2661+
26332662
export interface StorySummaryReaction {
26342663
/**
26352664
* reaction owner's name
@@ -4034,6 +4063,10 @@ export interface StorySummaryData {
40344063
* additional descriptive text
40354064
*/
40364065
description?: string | null;
4066+
/**
4067+
* list of pages with number of clicks on each of them
4068+
*/
4069+
clicks?: StorySummaryPageClicks[] | null;
40374070
}
40384071

40394072
export interface CommentInfoBase<B> {

0 commit comments

Comments
 (0)