Skip to content

Commit 942919e

Browse files
committed
Update Node API.
1 parent 09240fc commit 942919e

File tree

4 files changed

+17153
-13026
lines changed

4 files changed

+17153
-13026
lines changed

src/node/node.ts

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,26 @@ export class MoeraNode extends Caller {
3232
}) as API.ActivityReactionInfo[];
3333
}
3434

35+
/**
36+
* Get a slice of the list of all orders sent by the sheriff, delimited by the ``before`` or ``after`` moment and
37+
* the given ``limit``. If neither ``before`` nor ``after`` are provided, the latest orders are returned. The node
38+
* may decide to return fewer orders than the given ``limit``. The orders are always sorted by moment, descending.
39+
*
40+
* @param {number | null} after - filter orders posted strongly after this moment
41+
* @param {number | null} before - filter orders posted at or before this moment
42+
* @param {number | null} limit - maximum number of orders returned
43+
* @return {Promise<API.SheriffOrdersSliceInfo>}
44+
*/
45+
async getRemoteSheriffOrdersSlice(
46+
after: number | null = null, before: number | null = null, limit: number | null = null
47+
): Promise<API.SheriffOrdersSliceInfo> {
48+
const location = ut`/activity/sheriff/orders`;
49+
const params = {after, before, limit};
50+
return await this.call("getRemoteSheriffOrdersSlice", location, {
51+
method: "GET", params, schema: "SheriffOrdersSliceInfo"
52+
}) as API.SheriffOrdersSliceInfo;
53+
}
54+
3555
/**
3656
* Get the status of the asynchronous operation that performs verification of a remote posting signature.
3757
*
@@ -2145,6 +2165,43 @@ export class MoeraNode extends Caller {
21452165
}) as API.SearchNodeInfo[];
21462166
}
21472167

2168+
/**
2169+
* Search for postings and comments containing the specified hashtag(s) and optionally filtered by other criteria.
2170+
* \
2171+
* \
2172+
* The search engine may decide to return fewer nodes than the given ``limit``. \
2173+
* \
2174+
* The returned entries are sorted by moment in descending order.
2175+
*
2176+
* @param {API.SearchHashtagFilter} filter
2177+
* @return {Promise<API.SearchHashtagSliceInfo>}
2178+
*/
2179+
async searchEntriesByHashtag(filter: API.SearchHashtagFilter): Promise<API.SearchHashtagSliceInfo> {
2180+
const location = "/search/entries/by-hashtag";
2181+
return await this.call("searchEntriesByHashtag", location, {
2182+
method: "POST", body: filter, schema: "SearchHashtagSliceInfo", bodies: true
2183+
}) as API.SearchHashtagSliceInfo;
2184+
}
2185+
2186+
/**
2187+
* Search for postings and comments containing the specified words or text fragment, and optionally filtered by
2188+
* other criteria. \
2189+
* \
2190+
* The search engine may decide to return fewer nodes than the given ``limit``. \
2191+
* \
2192+
* The returned entries are sorted by their relevance. The exact definition of this term is left to the search
2193+
* engine's implementation.
2194+
*
2195+
* @param {API.SearchTextFilter} filter
2196+
* @return {Promise<API.SearchTextPageInfo>}
2197+
*/
2198+
async searchEntriesByText(filter: API.SearchTextFilter): Promise<API.SearchTextPageInfo> {
2199+
const location = "/search/entries/by-text";
2200+
return await this.call("searchEntriesByText", location, {
2201+
method: "POST", body: filter, schema: "SearchTextPageInfo", bodies: true
2202+
}) as API.SearchTextPageInfo;
2203+
}
2204+
21482205
/**
21492206
* Update the given settings. If the input contains node settings, they are validated and the first validation
21502207
* error is returned, if any. The update is always performed as a whole - if there is an error saving any one of

src/node/schemas.mjs

Lines changed: 229 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,17 @@ export const NODE_API_SCHEMAS = {
293293
additionalProperties: false
294294
},
295295

296+
SearchEntryOperations: {
297+
type: "object",
298+
properties: {
299+
"view": {
300+
type: "string",
301+
nullable: true
302+
},
303+
},
304+
additionalProperties: false
305+
},
306+
296307
StoryOperations: {
297308
type: "object",
298309
properties: {
@@ -2117,6 +2128,47 @@ export const NODE_API_SCHEMAS = {
21172128
}
21182129
},
21192130

2131+
SearchRepliedTo: {
2132+
type: "object",
2133+
properties: {
2134+
"id": {
2135+
type: "string"
2136+
},
2137+
"revisionId": {
2138+
type: "string",
2139+
nullable: true
2140+
},
2141+
"name": {
2142+
type: "string"
2143+
},
2144+
"fullName": {
2145+
type: "string",
2146+
nullable: true
2147+
},
2148+
"avatar": {
2149+
anyOf: [
2150+
{
2151+
$ref: "node#/definitions/AvatarImage",
2152+
type: "object",
2153+
nullable: true
2154+
},
2155+
{
2156+
type: "null"
2157+
}
2158+
]
2159+
},
2160+
"heading": {
2161+
type: "string",
2162+
nullable: true
2163+
},
2164+
},
2165+
required: [
2166+
"id",
2167+
"name",
2168+
],
2169+
additionalProperties: false
2170+
},
2171+
21202172
SettingInfo: {
21212173
type: "object",
21222174
properties: {
@@ -2461,6 +2513,9 @@ export const NODE_API_SCHEMAS = {
24612513
"createdAt": {
24622514
type: "integer"
24632515
},
2516+
"moment": {
2517+
type: "integer"
2518+
},
24642519
"signature": {
24652520
type: "string"
24662521
},
@@ -2479,12 +2534,49 @@ export const NODE_API_SCHEMAS = {
24792534
"feedName",
24802535
"category",
24812536
"createdAt",
2537+
"moment",
24822538
"signature",
24832539
"signatureVersion",
24842540
],
24852541
additionalProperties: false
24862542
},
24872543

2544+
SheriffOrdersSliceInfo: {
2545+
type: "object",
2546+
properties: {
2547+
"before": {
2548+
type: "integer"
2549+
},
2550+
"after": {
2551+
type: "integer"
2552+
},
2553+
"orders": {
2554+
type: "array",
2555+
items: {
2556+
$ref: "node#/definitions/SheriffOrderInfo"
2557+
}
2558+
},
2559+
"total": {
2560+
type: "integer"
2561+
},
2562+
"totalInPast": {
2563+
type: "integer"
2564+
},
2565+
"totalInFuture": {
2566+
type: "integer"
2567+
},
2568+
},
2569+
required: [
2570+
"before",
2571+
"after",
2572+
"orders",
2573+
"total",
2574+
"totalInPast",
2575+
"totalInFuture",
2576+
],
2577+
additionalProperties: false
2578+
},
2579+
24882580
StorySummaryBlocked: {
24892581
type: "object",
24902582
properties: {
@@ -3917,6 +4009,143 @@ export const NODE_API_SCHEMAS = {
39174009
additionalProperties: false
39184010
},
39194011

4012+
SearchEntryInfo: {
4013+
type: "object",
4014+
properties: {
4015+
"nodeName": {
4016+
type: "string"
4017+
},
4018+
"postingId": {
4019+
type: "string"
4020+
},
4021+
"commentId": {
4022+
type: "string",
4023+
nullable: true
4024+
},
4025+
"ownerName": {
4026+
type: "string"
4027+
},
4028+
"ownerFullName": {
4029+
type: "string",
4030+
nullable: true
4031+
},
4032+
"ownerAvatar": {
4033+
anyOf: [
4034+
{
4035+
$ref: "node#/definitions/AvatarImage",
4036+
type: "object",
4037+
nullable: true
4038+
},
4039+
{
4040+
type: "null"
4041+
}
4042+
]
4043+
},
4044+
"bodyPreview": {
4045+
type: "string"
4046+
},
4047+
"heading": {
4048+
type: "string"
4049+
},
4050+
"imageCount": {
4051+
type: "integer",
4052+
nullable: true
4053+
},
4054+
"videoPresent": {
4055+
type: "boolean",
4056+
nullable: true
4057+
},
4058+
"repliedTo": {
4059+
anyOf: [
4060+
{
4061+
$ref: "node#/definitions/SearchRepliedTo",
4062+
type: "object",
4063+
nullable: true
4064+
},
4065+
{
4066+
type: "null"
4067+
}
4068+
]
4069+
},
4070+
"createdAt": {
4071+
type: "integer"
4072+
},
4073+
"operations": {
4074+
anyOf: [
4075+
{
4076+
$ref: "node#/definitions/SearchEntryOperations",
4077+
type: "object",
4078+
nullable: true
4079+
},
4080+
{
4081+
type: "null"
4082+
}
4083+
]
4084+
},
4085+
"moment": {
4086+
type: "integer"
4087+
},
4088+
},
4089+
required: [
4090+
"nodeName",
4091+
"postingId",
4092+
"ownerName",
4093+
"bodyPreview",
4094+
"heading",
4095+
"createdAt",
4096+
"moment",
4097+
],
4098+
additionalProperties: false
4099+
},
4100+
4101+
SearchHashtagSliceInfo: {
4102+
type: "object",
4103+
properties: {
4104+
"before": {
4105+
type: "integer"
4106+
},
4107+
"after": {
4108+
type: "integer"
4109+
},
4110+
"entries": {
4111+
type: "array",
4112+
items: {
4113+
$ref: "node#/definitions/SearchEntryInfo"
4114+
}
4115+
},
4116+
},
4117+
required: [
4118+
"before",
4119+
"after",
4120+
"entries",
4121+
],
4122+
additionalProperties: false
4123+
},
4124+
4125+
SearchTextPageInfo: {
4126+
type: "object",
4127+
properties: {
4128+
"page": {
4129+
type: "integer"
4130+
},
4131+
"total": {
4132+
type: "integer"
4133+
},
4134+
"entries": {
4135+
type: "array",
4136+
items: {
4137+
$ref: "node#/definitions/SearchEntryInfo"
4138+
}
4139+
},
4140+
},
4141+
required: [
4142+
"page",
4143+
"total",
4144+
"entries",
4145+
],
4146+
additionalProperties: false
4147+
},
4148+
39204149
SettingMetaInfo: {
39214150
type: "object",
39224151
properties: {

0 commit comments

Comments
 (0)