Skip to content

Commit 8bb1c3e

Browse files
committed
Node API updates.
1 parent 7368ade commit 8bb1c3e

25 files changed

+2216
-8
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
<groupId>org.moera</groupId>
77
<artifactId>moeralib</artifactId>
8-
<version>0.16.5</version>
8+
<version>0.16.6</version>
99

1010
<name>moeralib</name>
1111
<description>Java library to interact with Moera decentralized social network</description>

src/main/java/org/moera/lib/node/MoeraNode.java

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,30 @@ public ActivityReactionInfo[] searchActivityReactions(ActivityReactionFilter fil
4040
return call(location, null, "POST", filter, returnTypeRef);
4141
}
4242

43+
/**
44+
* Get a slice of the list of all orders sent by the sheriff, delimited by the <code>before</code> or
45+
* <code>after</code> moment and the given <code>limit</code>. If neither <code>before</code> nor
46+
* <code>after</code> are provided, the latest orders are returned. The node may decide to return fewer orders than
47+
* the given <code>limit</code>. The orders are always sorted by moment, descending.
48+
*
49+
* @param after filter orders posted strongly after this moment
50+
* @param before filter orders posted at or before this moment
51+
* @param limit maximum number of orders returned
52+
* @return SheriffOrdersSliceInfo
53+
*/
54+
public SheriffOrdersSliceInfo getRemoteSheriffOrdersSlice(
55+
Long after, Long before, Integer limit
56+
) throws MoeraNodeException {
57+
var location = "/activity/sheriff/orders";
58+
var params = new QueryParam[] {
59+
QueryParam.of("after", after),
60+
QueryParam.of("before", before),
61+
QueryParam.of("limit", limit)
62+
};
63+
var returnTypeRef = new TypeReference<SheriffOrdersSliceInfo>() {};
64+
return call(location, params, "GET", null, returnTypeRef);
65+
}
66+
4367
/**
4468
* Get the status of the asynchronous operation that performs verification of a remote posting signature.
4569
*
@@ -2089,6 +2113,35 @@ public SearchNodeInfo[] searchNodes(String query, Integer limit) throws MoeraNod
20892113
return call(location, params, "GET", null, returnTypeRef);
20902114
}
20912115

2116+
/**
2117+
* Search for postings and comments containing the specified hashtag(s) and optionally filtered by other criteria.
2118+
* <br><br> The search engine may decide to return fewer nodes than the given <code>limit</code>. <br><br> The
2119+
* returned entries are sorted by moment in descending order.
2120+
*
2121+
* @param filter filter
2122+
* @return SearchHashtagSliceInfo
2123+
*/
2124+
public SearchHashtagSliceInfo searchEntriesByHashtag(SearchHashtagFilter filter) throws MoeraNodeException {
2125+
var location = "/search/entries/by-hashtag";
2126+
var returnTypeRef = new TypeReference<SearchHashtagSliceInfo>() {};
2127+
return call(location, null, "POST", filter, returnTypeRef);
2128+
}
2129+
2130+
/**
2131+
* Search for postings and comments containing the specified words or text fragment, and optionally filtered by
2132+
* other criteria. <br><br> The search engine may decide to return fewer nodes than the given <code>limit</code>.
2133+
* <br><br> The returned entries are sorted by their relevance. The exact definition of this term is left to the
2134+
* search engine's implementation.
2135+
*
2136+
* @param filter filter
2137+
* @return SearchTextPageInfo
2138+
*/
2139+
public SearchTextPageInfo searchEntriesByText(SearchTextFilter filter) throws MoeraNodeException {
2140+
var location = "/search/entries/by-text";
2141+
var returnTypeRef = new TypeReference<SearchTextPageInfo>() {};
2142+
return call(location, null, "POST", filter, returnTypeRef);
2143+
}
2144+
20922145
/**
20932146
* Update the given settings. If the input contains node settings, they are validated and the first validation
20942147
* error is returned, if any. The update is always performed as a whole - if there is an error saving any one of

src/main/java/org/moera/lib/node/types/SearchBlockUpdate.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public void setBlockedOperation(BlockedOperation blockedOperation) {
5050
@Override
5151
public void validate() {
5252
super.validate();
53-
ValidationUtil.maxSize(nodeName, 40, "search.node-name.wrong-size");
53+
ValidationUtil.maxSize(nodeName, 63, "search.node-name.wrong-size");
5454
ValidationUtil.notNull(blockedOperation, "search.blocked-operation.missing");
5555
}
5656

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
package org.moera.lib.node.types;
2+
3+
// This file is generated
4+
5+
import com.fasterxml.jackson.annotation.JsonInclude;
6+
import org.moera.lib.node.types.validate.ValidationUtil;
7+
8+
@JsonInclude(JsonInclude.Include.NON_NULL)
9+
public class SearchCommentUpdate extends Structure implements Cloneable {
10+
11+
private String postingId;
12+
private String commentId;
13+
14+
/**
15+
* Retrieves ID of the posting the comment belongs to.
16+
*
17+
* @return the value
18+
*/
19+
public String getPostingId() {
20+
return postingId;
21+
}
22+
23+
/**
24+
* Sets ID of the posting the comment belongs to.
25+
*
26+
* @param postingId the value to be set
27+
*/
28+
public void setPostingId(String postingId) {
29+
this.postingId = postingId;
30+
}
31+
32+
/**
33+
* Retrieves ID of the comment.
34+
*
35+
* @return the value
36+
*/
37+
public String getCommentId() {
38+
return commentId;
39+
}
40+
41+
/**
42+
* Sets ID of the comment.
43+
*
44+
* @param commentId the value to be set
45+
*/
46+
public void setCommentId(String commentId) {
47+
this.commentId = commentId;
48+
}
49+
50+
@Override
51+
public void validate() {
52+
super.validate();
53+
ValidationUtil.maxSize(postingId, 40, "search.posting-id.wrong-size");
54+
ValidationUtil.maxSize(commentId, 40, "search.comment-id.wrong-size");
55+
}
56+
57+
/**
58+
* Creates and returns a copy of this {@code SearchCommentUpdate} object.
59+
*
60+
* @return a clone of this instance
61+
*/
62+
@Override
63+
public SearchCommentUpdate clone() {
64+
try {
65+
return (SearchCommentUpdate) super.clone();
66+
} catch (CloneNotSupportedException e) {
67+
throw new IllegalArgumentException("Must implement Cloneable", e);
68+
}
69+
}
70+
71+
}

src/main/java/org/moera/lib/node/types/SearchContentUpdateType.java

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,18 @@ public enum SearchContentUpdateType {
1111
* The node was blocked.
1212
*/
1313
BLOCK,
14+
/**
15+
* A comment was added.
16+
*/
17+
COMMENT_ADD,
18+
/**
19+
* A comment was updated.
20+
*/
21+
COMMENT_UPDATE,
22+
/**
23+
* A comment was deleted.
24+
*/
25+
COMMENT_DELETE,
1426
/**
1527
* The node was added to the list of friends.
1628
*/
@@ -19,6 +31,30 @@ public enum SearchContentUpdateType {
1931
* The profile was updated.
2032
*/
2133
PROFILE,
34+
/**
35+
* A posting was added.
36+
*/
37+
POSTING_ADD,
38+
/**
39+
* A posting was updated; sent by the original node only.
40+
*/
41+
POSTING_UPDATE,
42+
/**
43+
* A posting was deleted.
44+
*/
45+
POSTING_DELETE,
46+
/**
47+
* A reaction was added.
48+
*/
49+
REACTION_ADD,
50+
/**
51+
* A reaction was deleted.
52+
*/
53+
REACTION_DELETE,
54+
/**
55+
* All reaction were deleted.
56+
*/
57+
REACTIONS_DELETE_ALL,
2258
/**
2359
* Subscribed to the node.
2460
*/

0 commit comments

Comments
 (0)