moeralib 0.16.8 → 0.17.1

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/lib/node/node.js CHANGED
@@ -40,6 +40,53 @@ class MoeraNode extends caller_1.Caller {
40
40
  });
41
41
  });
42
42
  }
43
+ /**
44
+ * Get a list of previously executed search queries, optionally filtered by the given ``prefix`` and limited by the
45
+ * given ``limit``. The node may decide to return fewer queries than the given ``limit``. The queries are always
46
+ * sorted by creation timestamp, descending.
47
+ *
48
+ * @param {string | null} prefix - find queries with the specified prefix (case-insensitive)
49
+ * @param {number | null} limit - maximum number of queries returned
50
+ * @return {Promise<API.SearchHistoryInfo[]>}
51
+ */
52
+ getSearchHistory() {
53
+ return __awaiter(this, arguments, void 0, function* (prefix = null, limit = null) {
54
+ const location = (0, util_1.ut) `/activity/search`;
55
+ const params = { prefix, limit };
56
+ return yield this.call("getSearchHistory", location, {
57
+ method: "GET", params, schema: "SearchHistoryInfoArray"
58
+ });
59
+ });
60
+ }
61
+ /**
62
+ * Save a search query in the registry.
63
+ *
64
+ * @param {API.SearchHistoryText} historyText
65
+ * @return {Promise<API.SearchHistoryInfo>}
66
+ */
67
+ saveToSearchHistory(historyText) {
68
+ return __awaiter(this, void 0, void 0, function* () {
69
+ const location = "/activity/search";
70
+ return yield this.call("saveToSearchHistory", location, {
71
+ method: "POST", body: historyText, schema: "SearchHistoryInfo"
72
+ });
73
+ });
74
+ }
75
+ /**
76
+ * Delete a search query from the registry.
77
+ *
78
+ * @param {string} query - the query to be deleted
79
+ * @return {Promise<API.Result>}
80
+ */
81
+ deleteFromSearchHistory(query) {
82
+ return __awaiter(this, void 0, void 0, function* () {
83
+ const location = (0, util_1.ut) `/activity/search`;
84
+ const params = { query };
85
+ return yield this.call("deleteFromSearchHistory", location, {
86
+ method: "DELETE", params, schema: "Result"
87
+ });
88
+ });
89
+ }
43
90
  /**
44
91
  * Get a slice of the list of all orders sent by the sheriff, delimited by the ``before`` or ``after`` moment and
45
92
  * the given ``limit``. If neither ``before`` nor ``after`` are provided, the latest orders are returned. The node
@@ -1067,6 +1114,24 @@ class MoeraNode extends caller_1.Caller {
1067
1114
  });
1068
1115
  });
1069
1116
  }
1117
+ /**
1118
+ * Delete all stories from the feed with optional filtering.
1119
+ *
1120
+ * @param {string} feedName - name of the feed
1121
+ * @param {API.StoryType | null} type - delete only the stories of the given type
1122
+ * @param {string | null} receiver - delete only the stories about postings located at the given node
1123
+ * @param {boolean | null} recommended - delete only the stories about recommended postings
1124
+ * @return {Promise<API.Result>}
1125
+ */
1126
+ deleteFeedStories(feedName_1) {
1127
+ return __awaiter(this, arguments, void 0, function* (feedName, type = null, receiver = null, recommended = null) {
1128
+ const location = (0, util_1.ut) `/feeds/${feedName}/stories`;
1129
+ const params = { type, receiver, recommended };
1130
+ return yield this.call("deleteFeedStories", location, {
1131
+ method: "DELETE", params, schema: "Result"
1132
+ });
1133
+ });
1134
+ }
1070
1135
  /**
1071
1136
  * Get the list of all groups of friends that exist on the node.
1072
1137
  *
@@ -1962,6 +2027,121 @@ class MoeraNode extends caller_1.Caller {
1962
2027
  });
1963
2028
  });
1964
2029
  }
2030
+ /**
2031
+ * Find postings known to the recommendation service and may be of interest to the client. If the client is
2032
+ * authenticated, the service may tune the recommendations for them. \
2033
+ * \
2034
+ * The service may decide to return fewer recommendations than the given ``limit``.
2035
+ *
2036
+ * @param {string | null} sheriff - filter out entries prohibited by the given sheriff
2037
+ * @param {number | null} limit - maximum number of recommendations returned
2038
+ * @return {Promise<API.RecommendedPostingInfo[]>}
2039
+ */
2040
+ getRecommendedPostings() {
2041
+ return __awaiter(this, arguments, void 0, function* (sheriff = null, limit = null) {
2042
+ const location = (0, util_1.ut) `/recommendations/postings`;
2043
+ const params = { sheriff, limit };
2044
+ return yield this.call("getRecommendedPostings", location, {
2045
+ method: "GET", params, schema: "RecommendedPostingInfoArray"
2046
+ });
2047
+ });
2048
+ }
2049
+ /**
2050
+ * Find postings known to the recommendation service and may be of interest to the client to read them. If the
2051
+ * client is authenticated, the service may tune the recommendations for them. \
2052
+ * \
2053
+ * The service may decide to return fewer recommendations than the given ``limit``.
2054
+ *
2055
+ * @param {string | null} sheriff - filter out entries prohibited by the given sheriff
2056
+ * @param {number | null} limit - maximum number of recommendations returned
2057
+ * @return {Promise<API.RecommendedPostingInfo[]>}
2058
+ */
2059
+ getRecommendedPostingsForReading() {
2060
+ return __awaiter(this, arguments, void 0, function* (sheriff = null, limit = null) {
2061
+ const location = (0, util_1.ut) `/recommendations/postings/reading`;
2062
+ const params = { sheriff, limit };
2063
+ return yield this.call("getRecommendedPostingsForReading", location, {
2064
+ method: "GET", params, schema: "RecommendedPostingInfoArray"
2065
+ });
2066
+ });
2067
+ }
2068
+ /**
2069
+ * Find postings known to the recommendation service and may be of interest to the client to take part in the
2070
+ * discussion. If the client is authenticated, the service may tune the recommendations for them. \
2071
+ * \
2072
+ * The service may decide to return fewer recommendations than the given ``limit``.
2073
+ *
2074
+ * @param {string | null} sheriff - filter out entries prohibited by the given sheriff
2075
+ * @param {number | null} limit - maximum number of recommendations returned
2076
+ * @return {Promise<API.RecommendedPostingInfo[]>}
2077
+ */
2078
+ getRecommendedPostingsForCommenting() {
2079
+ return __awaiter(this, arguments, void 0, function* (sheriff = null, limit = null) {
2080
+ const location = (0, util_1.ut) `/recommendations/postings/commenting`;
2081
+ const params = { sheriff, limit };
2082
+ return yield this.call("getRecommendedPostingsForCommenting", location, {
2083
+ method: "GET", params, schema: "RecommendedPostingInfoArray"
2084
+ });
2085
+ });
2086
+ }
2087
+ /**
2088
+ * Inform the recommendation service that the recommended posting was accepted by the client.
2089
+ *
2090
+ * @param {string} remoteNodeName - name of the remote node
2091
+ * @param {string} postingId - ID of the posting on the remote node
2092
+ * @return {Promise<API.Result>}
2093
+ */
2094
+ acceptRecommendedPosting(remoteNodeName, postingId) {
2095
+ return __awaiter(this, void 0, void 0, function* () {
2096
+ const location = (0, util_1.ut) `/recommendations/postings/accepted/${remoteNodeName}/${postingId}`;
2097
+ return yield this.call("acceptRecommendedPosting", location, {
2098
+ method: "POST", schema: "Result"
2099
+ });
2100
+ });
2101
+ }
2102
+ /**
2103
+ * Inform the recommendation service that the recommended posting was rejected by the client.
2104
+ *
2105
+ * @param {string} remoteNodeName - name of the remote node
2106
+ * @param {string} postingId - ID of the posting on the remote node
2107
+ * @return {Promise<API.Result>}
2108
+ */
2109
+ rejectRecommendedPosting(remoteNodeName, postingId) {
2110
+ return __awaiter(this, void 0, void 0, function* () {
2111
+ const location = (0, util_1.ut) `/recommendations/postings/rejected/${remoteNodeName}/${postingId}`;
2112
+ return yield this.call("rejectRecommendedPosting", location, {
2113
+ method: "POST", schema: "Result"
2114
+ });
2115
+ });
2116
+ }
2117
+ /**
2118
+ * Ask the recommendation service to exclude all content from the given node from future recommendations.
2119
+ *
2120
+ * @param {string} remoteNodeName - name of the remote node
2121
+ * @return {Promise<API.Result>}
2122
+ */
2123
+ excludeNodeFromRecommendations(remoteNodeName) {
2124
+ return __awaiter(this, void 0, void 0, function* () {
2125
+ const location = (0, util_1.ut) `/recommendations/nodes/excluded/${remoteNodeName}`;
2126
+ return yield this.call("excludeNodeFromRecommendations", location, {
2127
+ method: "POST", schema: "Result"
2128
+ });
2129
+ });
2130
+ }
2131
+ /**
2132
+ * Allow the recommendation service to include the content from the given node to future recommendations.
2133
+ *
2134
+ * @param {string} remoteNodeName - name of the remote node
2135
+ * @return {Promise<API.Result>}
2136
+ */
2137
+ allowNodeInRecommendations(remoteNodeName) {
2138
+ return __awaiter(this, void 0, void 0, function* () {
2139
+ const location = (0, util_1.ut) `/recommendations/nodes/excluded/${remoteNodeName}`;
2140
+ return yield this.call("allowNodeInRecommendations", location, {
2141
+ method: "DELETE", schema: "Result"
2142
+ });
2143
+ });
2144
+ }
1965
2145
  /**
1966
2146
  * Send a request to the remote node.
1967
2147
  *