@@ -32,6 +32,52 @@ export class MoeraNode extends Caller {
32
32
} ) as API . ActivityReactionInfo [ ] ;
33
33
}
34
34
35
+ /**
36
+ * Get a list of previously executed search queries, optionally filtered by the given ``prefix`` and limited by the
37
+ * given ``limit``. The node may decide to return fewer queries than the given ``limit``. The queries are always
38
+ * sorted by creation timestamp, descending.
39
+ *
40
+ * @param {string | null } prefix - find queries with the specified prefix (case-insensitive)
41
+ * @param {number | null } limit - maximum number of queries returned
42
+ * @return {Promise<API.SearchHistoryInfo[]> }
43
+ */
44
+ async getSearchHistory (
45
+ prefix : string | null = null , limit : number | null = null
46
+ ) : Promise < API . SearchHistoryInfo [ ] > {
47
+ const location = ut `/activity/search` ;
48
+ const params = { prefix, limit} ;
49
+ return await this . call ( "getSearchHistory" , location , {
50
+ method : "GET" , params, schema : "SearchHistoryInfoArray"
51
+ } ) as API . SearchHistoryInfo [ ] ;
52
+ }
53
+
54
+ /**
55
+ * Save a search query in the registry.
56
+ *
57
+ * @param {API.SearchHistoryText } historyText
58
+ * @return {Promise<API.SearchHistoryInfo> }
59
+ */
60
+ async saveToSearchHistory ( historyText : API . SearchHistoryText ) : Promise < API . SearchHistoryInfo > {
61
+ const location = "/activity/search" ;
62
+ return await this . call ( "saveToSearchHistory" , location , {
63
+ method : "POST" , body : historyText , schema : "SearchHistoryInfo"
64
+ } ) as API . SearchHistoryInfo ;
65
+ }
66
+
67
+ /**
68
+ * Delete a search query from the registry.
69
+ *
70
+ * @param {string } query - the query to be deleted
71
+ * @return {Promise<API.Result> }
72
+ */
73
+ async deleteFromSearchHistory ( query : string ) : Promise < API . Result > {
74
+ const location = ut `/activity/search` ;
75
+ const params = { query} ;
76
+ return await this . call ( "deleteFromSearchHistory" , location , {
77
+ method : "DELETE" , params, schema : "Result"
78
+ } ) as API . Result ;
79
+ }
80
+
35
81
/**
36
82
* Get a slice of the list of all orders sent by the sheriff, delimited by the ``before`` or ``after`` moment and
37
83
* the given ``limit``. If neither ``before`` nor ``after`` are provided, the latest orders are returned. The node
@@ -1013,6 +1059,26 @@ export class MoeraNode extends Caller {
1013
1059
} ) as API . FeedSliceInfo ;
1014
1060
}
1015
1061
1062
+ /**
1063
+ * Delete all stories from the feed with optional filtering.
1064
+ *
1065
+ * @param {string } feedName - name of the feed
1066
+ * @param {API.StoryType | null } type - delete only the stories of the given type
1067
+ * @param {string | null } receiver - delete only the stories about postings located at the given node
1068
+ * @param {boolean | null } recommended - delete only the stories about recommended postings
1069
+ * @return {Promise<API.Result> }
1070
+ */
1071
+ async deleteFeedStories (
1072
+ feedName : string , type : API . StoryType | null = null , receiver : string | null = null ,
1073
+ recommended : boolean | null = null
1074
+ ) : Promise < API . Result > {
1075
+ const location = ut `/feeds/${ feedName } /stories` ;
1076
+ const params = { type, receiver, recommended} ;
1077
+ return await this . call ( "deleteFeedStories" , location , {
1078
+ method : "DELETE" , params, schema : "Result"
1079
+ } ) as API . Result ;
1080
+ }
1081
+
1016
1082
/**
1017
1083
* Get the list of all groups of friends that exist on the node.
1018
1084
*
@@ -1855,6 +1921,120 @@ export class MoeraNode extends Caller {
1855
1921
} ) as API . Result ;
1856
1922
}
1857
1923
1924
+ /**
1925
+ * Find postings known to the recommendation service and may be of interest to the client. If the client is
1926
+ * authenticated, the service may tune the recommendations for them. \
1927
+ * \
1928
+ * The service may decide to return fewer recommendations than the given ``limit``.
1929
+ *
1930
+ * @param {string | null } sheriff - filter out entries prohibited by the given sheriff
1931
+ * @param {number | null } limit - maximum number of recommendations returned
1932
+ * @return {Promise<API.RecommendedPostingInfo[]> }
1933
+ */
1934
+ async getRecommendedPostings (
1935
+ sheriff : string | null = null , limit : number | null = null
1936
+ ) : Promise < API . RecommendedPostingInfo [ ] > {
1937
+ const location = ut `/recommendations/postings` ;
1938
+ const params = { sheriff, limit} ;
1939
+ return await this . call ( "getRecommendedPostings" , location , {
1940
+ method : "GET" , params, schema : "RecommendedPostingInfoArray"
1941
+ } ) as API . RecommendedPostingInfo [ ] ;
1942
+ }
1943
+
1944
+ /**
1945
+ * Find postings known to the recommendation service and may be of interest to the client to read them. If the
1946
+ * client is authenticated, the service may tune the recommendations for them. \
1947
+ * \
1948
+ * The service may decide to return fewer recommendations than the given ``limit``.
1949
+ *
1950
+ * @param {string | null } sheriff - filter out entries prohibited by the given sheriff
1951
+ * @param {number | null } limit - maximum number of recommendations returned
1952
+ * @return {Promise<API.RecommendedPostingInfo[]> }
1953
+ */
1954
+ async getRecommendedPostingsForReading (
1955
+ sheriff : string | null = null , limit : number | null = null
1956
+ ) : Promise < API . RecommendedPostingInfo [ ] > {
1957
+ const location = ut `/recommendations/postings/reading` ;
1958
+ const params = { sheriff, limit} ;
1959
+ return await this . call ( "getRecommendedPostingsForReading" , location , {
1960
+ method : "GET" , params, schema : "RecommendedPostingInfoArray"
1961
+ } ) as API . RecommendedPostingInfo [ ] ;
1962
+ }
1963
+
1964
+ /**
1965
+ * Find postings known to the recommendation service and may be of interest to the client to take part in the
1966
+ * discussion. If the client is authenticated, the service may tune the recommendations for them. \
1967
+ * \
1968
+ * The service may decide to return fewer recommendations than the given ``limit``.
1969
+ *
1970
+ * @param {string | null } sheriff - filter out entries prohibited by the given sheriff
1971
+ * @param {number | null } limit - maximum number of recommendations returned
1972
+ * @return {Promise<API.RecommendedPostingInfo[]> }
1973
+ */
1974
+ async getRecommendedPostingsForCommenting (
1975
+ sheriff : string | null = null , limit : number | null = null
1976
+ ) : Promise < API . RecommendedPostingInfo [ ] > {
1977
+ const location = ut `/recommendations/postings/commenting` ;
1978
+ const params = { sheriff, limit} ;
1979
+ return await this . call ( "getRecommendedPostingsForCommenting" , location , {
1980
+ method : "GET" , params, schema : "RecommendedPostingInfoArray"
1981
+ } ) as API . RecommendedPostingInfo [ ] ;
1982
+ }
1983
+
1984
+ /**
1985
+ * Inform the recommendation service that the recommended posting was accepted by the client.
1986
+ *
1987
+ * @param {string } remoteNodeName - name of the remote node
1988
+ * @param {string } postingId - ID of the posting on the remote node
1989
+ * @return {Promise<API.Result> }
1990
+ */
1991
+ async acceptRecommendedPosting ( remoteNodeName : string , postingId : string ) : Promise < API . Result > {
1992
+ const location = ut `/recommendations/postings/accepted/${ remoteNodeName } /${ postingId } ` ;
1993
+ return await this . call ( "acceptRecommendedPosting" , location , {
1994
+ method : "POST" , schema : "Result"
1995
+ } ) as API . Result ;
1996
+ }
1997
+
1998
+ /**
1999
+ * Inform the recommendation service that the recommended posting was rejected by the client.
2000
+ *
2001
+ * @param {string } remoteNodeName - name of the remote node
2002
+ * @param {string } postingId - ID of the posting on the remote node
2003
+ * @return {Promise<API.Result> }
2004
+ */
2005
+ async rejectRecommendedPosting ( remoteNodeName : string , postingId : string ) : Promise < API . Result > {
2006
+ const location = ut `/recommendations/postings/rejected/${ remoteNodeName } /${ postingId } ` ;
2007
+ return await this . call ( "rejectRecommendedPosting" , location , {
2008
+ method : "POST" , schema : "Result"
2009
+ } ) as API . Result ;
2010
+ }
2011
+
2012
+ /**
2013
+ * Ask the recommendation service to exclude all content from the given node from future recommendations.
2014
+ *
2015
+ * @param {string } remoteNodeName - name of the remote node
2016
+ * @return {Promise<API.Result> }
2017
+ */
2018
+ async excludeNodeFromRecommendations ( remoteNodeName : string ) : Promise < API . Result > {
2019
+ const location = ut `/recommendations/nodes/excluded/${ remoteNodeName } ` ;
2020
+ return await this . call ( "excludeNodeFromRecommendations" , location , {
2021
+ method : "POST" , schema : "Result"
2022
+ } ) as API . Result ;
2023
+ }
2024
+
2025
+ /**
2026
+ * Allow the recommendation service to include the content from the given node to future recommendations.
2027
+ *
2028
+ * @param {string } remoteNodeName - name of the remote node
2029
+ * @return {Promise<API.Result> }
2030
+ */
2031
+ async allowNodeInRecommendations ( remoteNodeName : string ) : Promise < API . Result > {
2032
+ const location = ut `/recommendations/nodes/excluded/${ remoteNodeName } ` ;
2033
+ return await this . call ( "allowNodeInRecommendations" , location , {
2034
+ method : "DELETE" , schema : "Result"
2035
+ } ) as API . Result ;
2036
+ }
2037
+
1858
2038
/**
1859
2039
* Send a request to the remote node.
1860
2040
*
0 commit comments