Class MoeraNode


public class MoeraNode extends NodeApiClient
MoeraNode is a client for interfacing with Moera nodes using the Moera Node API.
  • Constructor Details

    • MoeraNode

      public MoeraNode()
      Constructs a new MoeraNode object.
    • MoeraNode

      public MoeraNode(String nodeUrl)
      Constructs a new MoeraNode object with the specified node URL.
      Parameters:
      nodeUrl - node URL
  • Method Details

    • searchActivityReactions

      public ActivityReactionInfo[] searchActivityReactions(ActivityReactionFilter filter) throws MoeraNodeException
      Get the list of all reactions performed by the node, filtered by some criteria.
      Parameters:
      filter - filter
      Returns:
      ActivityReactionInfo[]
      Throws:
      MoeraNodeException
    • getRemotePostingVerificationStatus

      public RemotePostingVerificationInfo getRemotePostingVerificationStatus(String id) throws MoeraNodeException
      Get the status of the asynchronous operation that performs verification of a remote posting signature.
      Parameters:
      id - asynchronous operation ID
      Returns:
      RemotePostingVerificationInfo
      Throws:
      MoeraNodeException
    • getRemoteReactionVerificationStatus

      public RemoteReactionVerificationInfo getRemoteReactionVerificationStatus(String id) throws MoeraNodeException
      Get the status of the asynchronous operation that performs verification of the signature of a reaction to a remote posting.
      Parameters:
      id - asynchronous operation ID
      Returns:
      RemoteReactionVerificationInfo
      Throws:
      MoeraNodeException
    • getAvatars

      public AvatarInfo[] getAvatars() throws MoeraNodeException
      Get the list of avatars in the ascending order of their ordinals.
      Returns:
      AvatarInfo[]
      Throws:
      MoeraNodeException
    • createAvatar

      public AvatarInfo createAvatar(AvatarAttributes avatar) throws MoeraNodeException
      Create a new avatar from a public media file that exists on the node. A new public media file is created for the avatar. If the avatar's ordinal is not provided in the input, the avatar is assigned an ordinal that is greater than ordinals of all existing avatars.
      Parameters:
      avatar - avatar
      Returns:
      AvatarInfo
      Throws:
      MoeraNodeException
    • getAvatar

      public AvatarInfo getAvatar(String id) throws MoeraNodeException
      Get an individual avatar.
      Parameters:
      id - avatar ID
      Returns:
      AvatarInfo
      Throws:
      MoeraNodeException
    • deleteAvatar

      public Result deleteAvatar(String id) throws MoeraNodeException
      Delete an avatar.
      Parameters:
      id - avatar ID
      Returns:
      Result
      Throws:
      MoeraNodeException
    • reorderAvatars

      public AvatarOrdinal[] reorderAvatars(AvatarsOrdered order) throws MoeraNodeException
      Reorder avatars. Every avatar mentioned in the input is assigned an ordinal in ascending order as they appear in the input. Ordinals of avatars not mentioned in the input are not touched.
      Parameters:
      order - order
      Returns:
      AvatarOrdinal[]
      Throws:
      MoeraNodeException
    • blockInstant

      public BlockedInstantInfo blockInstant(BlockedInstantAttributes instant) throws MoeraNodeException
      Blocks creation of instants of the given story type, related to the given entry, optionally unblocking at the given time in the future.
      Parameters:
      instant - instant
      Returns:
      BlockedInstantInfo
      Throws:
      MoeraNodeException
    • getBlockedInstant

      public BlockedInstantInfo getBlockedInstant(String id) throws MoeraNodeException
      Get details about the given blocked instant.
      Parameters:
      id - ID of the blocked instant
      Returns:
      BlockedInstantInfo
      Throws:
      MoeraNodeException
    • unblockInstant

      public Result unblockInstant(String id) throws MoeraNodeException
      Unblock the given instant.
      Parameters:
      id - ID of the blocked instant
      Returns:
      Result
      Throws:
      MoeraNodeException
    • searchBlockedInstants

      public BlockedInstantInfo[] searchBlockedInstants(BlockedInstantFilter filter) throws MoeraNodeException
      Search blocked instants by the given criteria.
      Parameters:
      filter - filter
      Returns:
      BlockedInstantInfo[]
      Throws:
      MoeraNodeException
    • blockUser

      Blocks the given node from performing the given operations, in a particular posting or globally, optionally unblocking at the given time in the future.
      Parameters:
      user - user
      Returns:
      BlockedUserInfo
      Throws:
      MoeraNodeException
    • getBlockedUser

      public BlockedUserInfo getBlockedUser(String id) throws MoeraNodeException
      Get details about the given blocked user.
      Parameters:
      id - ID of the blocked user
      Returns:
      BlockedUserInfo
      Throws:
      MoeraNodeException
    • unblockUser

      public Result unblockUser(String id) throws MoeraNodeException
      Unblock the given user.
      Parameters:
      id - ID of the blocked user
      Returns:
      Result
      Throws:
      MoeraNodeException
    • searchBlockedUsers

      public BlockedUserInfo[] searchBlockedUsers(BlockedUserFilter filter) throws MoeraNodeException
      Search blocked users by the given criteria.
      Parameters:
      filter - filter
      Returns:
      BlockedUserInfo[]
      Throws:
      MoeraNodeException
    • getBlockedUsersChecksums

      public BlockedUsersChecksums getBlockedUsersChecksums() throws MoeraNodeException
      Get checksums of the information about the blocked users. This request may be used to quickly detect the changes in the blocked users list to update the cache on the client side.
      Returns:
      BlockedUsersChecksums
      Throws:
      MoeraNodeException
    • getBlockedByUser

      public BlockedByUserInfo getBlockedByUser(String id) throws MoeraNodeException
      Get details about the given node that blocked this node.
      Parameters:
      id - ID of the blocked-by user
      Returns:
      BlockedByUserInfo
      Throws:
      MoeraNodeException
    • searchBlockedByUsers

      public BlockedByUserInfo[] searchBlockedByUsers(BlockedByUserFilter filter) throws MoeraNodeException
      Search nodes that blocked this node, by the given criteria.
      Parameters:
      filter - filter
      Returns:
      BlockedByUserInfo[]
      Throws:
      MoeraNodeException
    • createCartes

      public CarteSet createCartes(CarteAttributes attributes) throws MoeraNodeException
      Create a set of cartes with the given attributes. Cartes in the sequence correspond to successive periods of time.
      Parameters:
      attributes - attributes
      Returns:
      CarteSet
      Throws:
      MoeraNodeException
    • verifyCarte

      public CarteVerificationInfo verifyCarte(ClientCarte clientCarte) throws MoeraNodeException
      Verify if the given carte may be used for authentication on this node. Additionally, if clientName is provided, it is compared to the carte owner's name.
      Parameters:
      clientCarte - clientCarte
      Returns:
      CarteVerificationInfo
      Throws:
      MoeraNodeException
    • getCommentsSlice

      public CommentsSliceInfo getCommentsSlice(String postingId, Long after, Long before, Integer limit) throws MoeraNodeException
      Get a slice of the list of comments, delimited by before or after moments (but not both) and the given limit. If neither before nor after are provided, the latest comments are returned. The node may decide to return fewer comments than the given limit. The stories are always sorted by moment, ascending.
      Parameters:
      postingId - ID of the posting
      after - filter comments posted strongly after this moment
      before - filter comments posted at or before this moment
      limit - maximum number of comments returned
      Returns:
      CommentsSliceInfo
      Throws:
      MoeraNodeException
    • createComment

      public CommentCreated createComment(String postingId, CommentText comment) throws MoeraNodeException
      Create a comment from the given text and add it to the given posting. The comment owner must authenticate in some way. If the comment is not signed, it will be kept for a limited period of time and then erased. If authenticated as admin, the node signs the comment.
      Parameters:
      postingId - ID of the posting
      comment - comment
      Returns:
      CommentCreated
      Throws:
      MoeraNodeException
    • getComment

      public CommentInfo getComment(String postingId, String commentId, boolean withSource) throws MoeraNodeException
      Get an individual comment.
      Parameters:
      postingId - ID of the posting
      commentId - ID of the comment
      withSource - include source text of the comment
      Returns:
      CommentInfo
      Throws:
      MoeraNodeException
    • updateAllComments

      public Result updateAllComments(String postingId, CommentMassAttributes attributes) throws MoeraNodeException
      Update operation overrides for all comments in the posting.
      Parameters:
      postingId - ID of the posting
      attributes - attributes
      Returns:
      Result
      Throws:
      MoeraNodeException
    • updateComment

      public CommentInfo updateComment(String postingId, String commentId, CommentText comment) throws MoeraNodeException
      Update the comment, creating a new revision of it. The text is processed just like in the POST request.
      Parameters:
      postingId - ID of the posting
      commentId - ID of the comment
      comment - comment
      Returns:
      CommentInfo
      Throws:
      MoeraNodeException
    • deleteComment

      public CommentTotalInfo deleteComment(String postingId, String commentId) throws MoeraNodeException
      Delete the comment. The comment may not be purged from the database immediately, but preserved for some period of time to give a chance to restore it.
      Parameters:
      postingId - ID of the posting
      commentId - ID of the comment
      Returns:
      CommentTotalInfo
      Throws:
      MoeraNodeException
    • getPostingsAttachedToComment

      public PostingInfo[] getPostingsAttachedToComment(String postingId, String commentId) throws MoeraNodeException
      Get all postings linked to media attached to the given comment.
      Parameters:
      postingId - ID of the posting
      commentId - ID of the comment
      Returns:
      PostingInfo[]
      Throws:
      MoeraNodeException
    • getCommentRevisions

      public CommentRevisionInfo[] getCommentRevisions(String postingId, String commentId) throws MoeraNodeException
      Get all revisions of the comment.
      Parameters:
      postingId - ID of the posting
      commentId - ID of the comment
      Returns:
      CommentRevisionInfo[]
      Throws:
      MoeraNodeException
    • getCommentRevision

      public CommentRevisionInfo getCommentRevision(String postingId, String commentId, String id) throws MoeraNodeException
      Get an individual revision of the comment.
      Parameters:
      postingId - ID of the posting
      commentId - ID of the comment
      id - ID of the revision
      Returns:
      CommentRevisionInfo
      Throws:
      MoeraNodeException
    • createCommentReaction

      public ReactionCreated createCommentReaction(String postingId, String commentId, ReactionDescription reaction) throws MoeraNodeException
      Add a reaction to the given comment. The reaction owner must authenticate in some way. Only one reaction is allowed from each owner to a particular comment. If a reaction from the same owner to this comment already exists, it is overwritten. If the reaction is not signed, the reaction will be kept for a limited period of time and then erased (the previous reaction of the same owner will be restored, if any).
      Parameters:
      postingId - ID of the posting
      commentId - ID of the comment
      reaction - reaction
      Returns:
      ReactionCreated
      Throws:
      MoeraNodeException
    • updateCommentReaction

      public ReactionInfo updateCommentReaction(String postingId, String commentId, String ownerName, ReactionOverride reaction) throws MoeraNodeException
      Update the reaction's operations or set operations' overrides.
      Parameters:
      postingId - ID of the posting
      commentId - ID of the comment
      ownerName - reaction owner node name
      reaction - reaction
      Returns:
      ReactionInfo
      Throws:
      MoeraNodeException
    • getCommentReactionsSlice

      public ReactionsSliceInfo getCommentReactionsSlice(String postingId, String commentId, Boolean negative, Integer emoji, Long before, Integer limit) throws MoeraNodeException
      Get a slice of the list of reactions to the given comment, optionally filtered by reaction type, delimited by before moment and the given limit. If before is not provided, the latest reactions are returned. The node may decide to return fewer reactions than the given limit. The reactions are always sorted by moment, descending.
      Parameters:
      postingId - ID of the posting
      commentId - ID of the comment
      negative - true, to filter negative reactions, false, to filter positive ones
      emoji - filter by reaction code, usually interpreted by clients as emoji code point
      before - filter reactions created at or before this moment
      limit - maximum number of reactions returned
      Returns:
      ReactionsSliceInfo
      Throws:
      MoeraNodeException
    • getCommentReaction

      public ReactionInfo getCommentReaction(String postingId, String commentId, String ownerName) throws MoeraNodeException
      Get the detailed information about the reaction of the given owner to the given comment. If no reaction with such an owner exists, an empty structure with just commentId is returned.
      Parameters:
      postingId - ID of the posting
      commentId - ID of the comment
      ownerName - reaction owner node name
      Returns:
      ReactionInfo
      Throws:
      MoeraNodeException
    • deleteAllCommentReactions

      public Result deleteAllCommentReactions(String postingId, String commentId) throws MoeraNodeException
      Delete all reactions to the given comment.
      Parameters:
      postingId - ID of the posting
      commentId - ID of the comment
      Returns:
      Result
      Throws:
      MoeraNodeException
    • deleteCommentReaction

      public ReactionTotalsInfo deleteCommentReaction(String postingId, String commentId, String ownerName) throws MoeraNodeException
      Delete the reaction of the given owner to the given comment.
      Parameters:
      postingId - ID of the posting
      commentId - ID of the comment
      ownerName - reaction owner node name
      Returns:
      ReactionTotalsInfo
      Throws:
      MoeraNodeException
    • getCommentReactionTotals

      public ReactionTotalsInfo getCommentReactionTotals(String postingId, String commentId) throws MoeraNodeException
      Get a summary of reactions to the comment given.
      Parameters:
      postingId - ID of the posting
      commentId - ID of the comment
      Returns:
      ReactionTotalsInfo
      Throws:
      MoeraNodeException
    • getContacts

      public ContactInfo[] getContacts(String query, Integer limit) throws MoeraNodeException
      Search for contacts matching the search query. Every space-delimited word in the query must match case-insensitively a beginning of the contact's node name or a beginning of any space-delimited word in the contact's full name. The order of words is not significant.

      The node may decide to return fewer contacts than the given limit.

      The contacts are sorted by their closeness to the node, which is calculated from the number of reactions and comments and their age.
      Parameters:
      query - the search query
      limit - maximum number of contacts returned
      Returns:
      ContactInfo[]
      Throws:
      MoeraNodeException
    • checkCredentials

      public CredentialsCreated checkCredentials() throws MoeraNodeException
      Check whether the credentials are initialized already.
      Returns:
      CredentialsCreated
      Throws:
      MoeraNodeException
    • createCredentials

      public Result createCredentials(Credentials credentials) throws MoeraNodeException
      Initialize credentials if they are not set yet. Note that this operation can be executed without authentication, so this should be done as soon as possible after the node installation. Sign in is not allowed until the credentials are set.
      Parameters:
      credentials - credentials
      Returns:
      Result
      Throws:
      MoeraNodeException
    • updateCredentials

      public Result updateCredentials(CredentialsChange credentials) throws MoeraNodeException
      Update credentials. Either old password or credentials reset token should be set in the input for the operation to succeed. Credentials reset token is not related to the authentication token and usually is sent to the user by E-mail.
      Parameters:
      credentials - credentials
      Returns:
      Result
      Throws:
      MoeraNodeException
    • deleteCredentials

      public Result deleteCredentials() throws MoeraNodeException
      Delete credentials.
      Returns:
      Result
      Throws:
      MoeraNodeException
    • resetCredentials

      public EmailHint resetCredentials() throws MoeraNodeException
      The node generates credentials reset token that is sent to the node admin by E-mail or using any other way that is defined for recovery of credentials. This token then may be used to change the credentials without knowing the password.
      Returns:
      EmailHint
      Throws:
      MoeraNodeException
    • getDeletedPostings

      public PostingInfo[] getDeletedPostings(Integer page, Integer limit) throws MoeraNodeException
      Get the list of deleted postings, page by page. The node may decide to use a smaller page size than the given limit. The postings are always sorted by the deletion timestamp, descending.
      Parameters:
      page - page number, 0 by default
      limit - page size (maximum number of postings returned), the default is defined by the node
      Returns:
      PostingInfo[]
      Throws:
      MoeraNodeException
    • getDeletedPosting

      public PostingInfo getDeletedPosting(String id) throws MoeraNodeException
      Get an individual deleted posting.
      Parameters:
      id - ID of the posting
      Returns:
      PostingInfo
      Throws:
      MoeraNodeException
    • restoreDeletedPosting

      public PostingInfo restoreDeletedPosting(String id) throws MoeraNodeException
      Restore a posting. A new revision is created with the same content as in the latest revision.
      Parameters:
      id - ID of the posting
      Returns:
      PostingInfo
      Throws:
      MoeraNodeException
    • getDeletePostingRevisions

      public PostingRevisionInfo[] getDeletePostingRevisions(String postingId, Integer limit) throws MoeraNodeException
      Get all revisions of the deleted posting, but not more than limit. The node may decide to return fewer revisions than the given limit.
      Parameters:
      postingId - ID of the posting
      limit - maximum number of revisions returned
      Returns:
      PostingRevisionInfo[]
      Throws:
      MoeraNodeException
    • getDeletedPostingRevision

      public PostingRevisionInfo getDeletedPostingRevision(String postingId, String id) throws MoeraNodeException
      Get an individual revision of the deleted posting.
      Parameters:
      postingId - ID of the posting
      id - ID of the revision
      Returns:
      PostingRevisionInfo
      Throws:
      MoeraNodeException
    • restoreDeletedPostingRevision

      public PostingRevisionInfo restoreDeletedPostingRevision(String postingId, String id) throws MoeraNodeException
      Restore a posting at a particular revision. A new revision is created with the same content as in the given revision.
      Parameters:
      postingId - ID of the posting
      id - ID of the revision
      Returns:
      PostingRevisionInfo
      Throws:
      MoeraNodeException
    • getDomains

      public DomainInfo[] getDomains() throws MoeraNodeException
      Get the list of registered domains.
      Returns:
      DomainInfo[]
      Throws:
      MoeraNodeException
    • getDomain

      public DomainInfo getDomain(String name) throws MoeraNodeException
      Get information about the domain with the given hostname. If domain registration for this server is public, this request does not require authentication.
      Parameters:
      name - domain name
      Returns:
      DomainInfo
      Throws:
      MoeraNodeException
    • createDomain

      public DomainInfo createDomain(DomainAttributes domain) throws MoeraNodeException
      Create a new domain with the given hostname. If nodeId is not passed, it is generated automatically. If domain registration for this server is public, this request does not require authentication.
      Parameters:
      domain - domain
      Returns:
      DomainInfo
      Throws:
      MoeraNodeException
    • updateDomain

      public DomainInfo updateDomain(String name, DomainAttributes domain) throws MoeraNodeException
      Update the domain with the given hostname. If the new hostname is not passed, the old hostname is preserved. (Note that you cannot pass a new name for the default hostname, because it cannot be renamed and _default_ is not a valid hostname. Skip this field if you want to update the default hostname.) If nodeId is not passed, it is generated automatically.
      Parameters:
      name - domain's hostname
      domain - domain
      Returns:
      DomainInfo
      Throws:
      MoeraNodeException
    • deleteDomain

      public Result deleteDomain(String name) throws MoeraNodeException
      Delete the domain with the given hostname. This operation deletes the domain record only, the user's data related to the domain is preserved.
      Parameters:
      name - domain name
      Returns:
      Result
      Throws:
      MoeraNodeException
    • isDomainAvailable

      public DomainAvailable isDomainAvailable(String nodeName) throws MoeraNodeException
      Get an available domain name recommended for the given node name. The domain name is usually chosen to be close to the node name in English transcription. If domain registration for this server is not public, this request is not accessible.
      Parameters:
      nodeName - node name
      Returns:
      DomainAvailable
      Throws:
      MoeraNodeException
    • getDrafts

      public DraftInfo[] getDrafts(DraftType draftType, String nodeName, String postingId, String commentId, Integer page, Integer limit) throws MoeraNodeException
      Get the list of drafts, page by page, filtered by the given criteria. The node may decide to use a smaller page size than the given limit. The drafts are always sorted by the creation timestamp, descending.
      Parameters:
      draftType - type of the drafts
      nodeName - name of the node the drafts are related to
      postingId - ID of the posting, mandatory for all types, except new-posting
      commentId - ID of the comment, mandatory for comment-update type
      page - page number, 0 by default
      limit - page size (maximum number of postings returned), the default is defined by the node
      Returns:
      DraftInfo[]
      Throws:
      MoeraNodeException
    • createDraft

      public DraftInfo createDraft(DraftText draft) throws MoeraNodeException
      Create a new draft from the text given.
      Parameters:
      draft - draft
      Returns:
      DraftInfo
      Throws:
      MoeraNodeException
    • getDraft

      public DraftInfo getDraft(String id) throws MoeraNodeException
      Get an individual draft.
      Parameters:
      id - ID of the draft
      Returns:
      DraftInfo
      Throws:
      MoeraNodeException
    • updateDraft

      public DraftInfo updateDraft(String id, DraftText draft) throws MoeraNodeException
      Update the draft.
      Parameters:
      id - ID of the draft
      draft - draft
      Returns:
      DraftInfo
      Throws:
      MoeraNodeException
    • deleteDraft

      public Result deleteDraft(String id) throws MoeraNodeException
      Delete the draft.
      Parameters:
      id - ID of the draft
      Returns:
      Result
      Throws:
      MoeraNodeException
    • getFeatures

      public Features getFeatures() throws MoeraNodeException
      Get information about features supported by the node.
      Returns:
      Features
      Throws:
      MoeraNodeException
    • getFeeds

      public FeedInfo[] getFeeds() throws MoeraNodeException
      Get general information about all feeds accessible by client.
      Returns:
      FeedInfo[]
      Throws:
      MoeraNodeException
    • getFeedGeneral

      public FeedInfo getFeedGeneral(String feedName) throws MoeraNodeException
      Get general information about the feed.
      Parameters:
      feedName - name of the feed
      Returns:
      FeedInfo
      Throws:
      MoeraNodeException
    • getFeedStatus

      public FeedStatus getFeedStatus(String feedName) throws MoeraNodeException
      Get information about the total number and number of non-read and non-viewed stories in the feed.
      Parameters:
      feedName - name of the feed
      Returns:
      FeedStatus
      Throws:
      MoeraNodeException
    • updateFeedStatus

      public FeedStatus updateFeedStatus(String feedName, FeedStatusChange change) throws MoeraNodeException
      Update information about non-read and non-viewed stories in the feed.
      Parameters:
      feedName - name of the feed
      change - change
      Returns:
      FeedStatus
      Throws:
      MoeraNodeException
    • getFeedSlice

      public FeedSliceInfo getFeedSlice(String feedName, Long after, Long before, Integer limit) throws MoeraNodeException
      Get a slice of the feed, delimited by before or after moments (but not both) and the given limit. If neither before nor after are provided, the latest stories are returned. The node may decide to return fewer stories than the given limit. The stories are always sorted by moment, descending.
      Parameters:
      feedName - name of the feed
      after - filter stories posted strongly after this moment
      before - filter stories posted at or before this moment
      limit - maximum number of stories returned
      Returns:
      FeedSliceInfo
      Throws:
      MoeraNodeException
    • getFriendGroups

      public FriendGroupInfo[] getFriendGroups() throws MoeraNodeException
      Get the list of all groups of friends that exist on the node.
      Returns:
      FriendGroupInfo[]
      Throws:
      MoeraNodeException
    • getFriendGroup

      public FriendGroupInfo getFriendGroup(String id) throws MoeraNodeException
      Get the information about the group of friends.
      Parameters:
      id - ID of the group of friends
      Returns:
      FriendGroupInfo
      Throws:
      MoeraNodeException
    • createFriendGroup

      public FriendGroupInfo createFriendGroup(FriendGroupDescription friendGroup) throws MoeraNodeException
      Create a group of friends.
      Parameters:
      friendGroup - friendGroup
      Returns:
      FriendGroupInfo
      Throws:
      MoeraNodeException
    • updateFriendGroup

      public FriendGroupInfo updateFriendGroup(String id, FriendGroupDescription friendGroup) throws MoeraNodeException
      Update the details of the group of friends.
      Parameters:
      id - ID of the group of friends
      friendGroup - friendGroup
      Returns:
      FriendGroupInfo
      Throws:
      MoeraNodeException
    • deleteFriendGroup

      public Result deleteFriendGroup(String id) throws MoeraNodeException
      Delete the group of friends.
      Parameters:
      id - ID of the group of friends
      Returns:
      Result
      Throws:
      MoeraNodeException
    • getFriends

      public FriendInfo[] getFriends(String groupId) throws MoeraNodeException
      Get the list of all friends of the node or friends belonging to a particular group.
      Parameters:
      groupId - ID of a group of friends
      Returns:
      FriendInfo[]
      Throws:
      MoeraNodeException
    • getFriend

      public FriendInfo getFriend(String name) throws MoeraNodeException
      Get the friendship information for the node given.
      Parameters:
      name - name of the node
      Returns:
      FriendInfo
      Throws:
      MoeraNodeException
    • updateFriends

      public FriendInfo[] updateFriends(FriendDescription[] friends) throws MoeraNodeException
      Update the friendship status of the nodes passed in the input. If some node passed in the input is not a member of some of the groups of friends listed for it, the node is added to them. If it is a member of some groups of friends that are not listed for it, the node is removed from them.
      Parameters:
      friends - friends
      Returns:
      FriendInfo[]
      Throws:
      MoeraNodeException
    • getFriendOfs

      public FriendOfInfo[] getFriendOfs() throws MoeraNodeException
      Get the list of all nodes that added this node to their friends.
      Returns:
      FriendOfInfo[]
      Throws:
      MoeraNodeException
    • getFriendOf

      public FriendOfInfo getFriendOf(String name) throws MoeraNodeException
      Get the information for the node given, whether it has added this node to its friends.
      Parameters:
      name - name of the node
      Returns:
      FriendOfInfo
      Throws:
      MoeraNodeException
    • getAllGrants

      public GrantInfo[] getAllGrants() throws MoeraNodeException
      Get the list of all nodes having administrative permissions on this node.
      Returns:
      GrantInfo[]
      Throws:
      MoeraNodeException
    • getGrant

      public GrantInfo getGrant(String nodeName) throws MoeraNodeException
      Get information about the administrative permissions granted to the node.
      Parameters:
      nodeName - name of the node
      Returns:
      GrantInfo
      Throws:
      MoeraNodeException
    • grantOrRevoke

      public GrantInfo grantOrRevoke(String nodeName, GrantChange change) throws MoeraNodeException
      Grant a set of administrative permissions to the node or revoke them.
      Parameters:
      nodeName - name of the node
      change - change
      Returns:
      GrantInfo
      Throws:
      MoeraNodeException
    • revokeAll

      public Result revokeAll(String nodeName) throws MoeraNodeException
      Revoke all administrative permissions granted to the node.
      Parameters:
      nodeName - name of the node
      Returns:
      Result
      Throws:
      MoeraNodeException
    • uploadAdminMedia

      public PrivateMediaFileInfo uploadAdminMedia(Path body, String contentType) throws MoeraNodeException
      Upload a new media file owned by the node admin. The content of the file is passed in the request body.
      Parameters:
      body - body
      contentType - content-type of ``body``
      Returns:
      PrivateMediaFileInfo
      Throws:
      MoeraNodeException
    • uploadPrivateMedia

      public PrivateMediaFileInfo uploadPrivateMedia(String clientName, Path body, String contentType) throws MoeraNodeException
      Upload a new media file owned by the given node. The content of the file is passed in the request body.
      Parameters:
      clientName - name of the node owning the media file
      body - body
      contentType - content-type of ``body``
      Returns:
      PrivateMediaFileInfo
      Throws:
      MoeraNodeException
    • getPrivateMedia

      public void getPrivateMedia(String id, Integer width, Boolean download, NodeApiClient.ResponseConsumer responseConsumer) throws MoeraNodeException
      Get media file content (returned in the response body).
      Parameters:
      id - media file ID
      width - preferred width of the media in pixels; if present, the node will try to return the smallest in size, but the best in quality variant of the media, according to the width provided
      download - if true, the node will add Content-Disposition: attachment header to the output
      responseConsumer - consumer of the data received
      Throws:
      MoeraNodeException
    • getPrivateMediaInfo

      public PrivateMediaFileInfo getPrivateMediaInfo(String id) throws MoeraNodeException
      Get media file details.
      Parameters:
      id - media file ID
      Returns:
      PrivateMediaFileInfo
      Throws:
      MoeraNodeException
    • getPrivateMediaParentEntry

      public EntryInfo[] getPrivateMediaParentEntry(String id) throws MoeraNodeException
      Get the list of all postings and comments the media file is attached to.
      Parameters:
      id - media file ID
      Returns:
      EntryInfo[]
      Throws:
      MoeraNodeException
    • uploadPublicMedia

      public PublicMediaFileInfo uploadPublicMedia(Path body, String contentType) throws MoeraNodeException
      Upload a new media file. The content of the file is passed in the request body
      Parameters:
      body - body
      contentType - content-type of ``body``
      Returns:
      PublicMediaFileInfo
      Throws:
      MoeraNodeException
    • getPublicMedia

      public void getPublicMedia(String id, Integer width, Boolean download, NodeApiClient.ResponseConsumer responseConsumer) throws MoeraNodeException
      Get media file content (returned in the response body).
      Parameters:
      id - media file ID
      width - preferred width of the media in pixels; if present, the node will try to return the smallest in size, but the best in quality variant of the media, according to the width provided
      download - if true, the node will add Content-Disposition: attachment header to the output
      responseConsumer - consumer of the data received
      Throws:
      MoeraNodeException
    • getPublicMediaInfo

      public PublicMediaFileInfo getPublicMediaInfo(String id) throws MoeraNodeException
      Get media file details.
      Parameters:
      id - media file ID
      Returns:
      PublicMediaFileInfo
      Throws:
      MoeraNodeException
    • getNodeName

      public NodeNameInfo getNodeName() throws MoeraNodeException
      Get the name of the node. Admin user receives the current status of the latest operation with the node name.
      Returns:
      NodeNameInfo
      Throws:
      MoeraNodeException
    • createNodeName

      public RegisteredNameSecret createNodeName(NameToRegister nameToRegister) throws MoeraNodeException
      Register a new name for the node. The corresponding signing key is generated automatically and stored at the node. The updating key is generated and returned in the encoded form and in the form of mnemonic (a sequence of English words). The words need to be written down and stored securely to be able to perform further operations with the name.
      Parameters:
      nameToRegister - nameToRegister
      Returns:
      RegisteredNameSecret
      Throws:
      MoeraNodeException
    • updateNodeName

      public Result updateNodeName(RegisteredNameSecret secret) throws MoeraNodeException
      Update the name of the node. May be used to assign an already-registered name to the node (the corresponding signing key is generated automatically and stored at the node), or to prolong the name. The secret or mnemonic of the updating key must be provided for this operation.
      Parameters:
      secret - secret
      Returns:
      Result
      Throws:
      MoeraNodeException
    • deleteNodeName

      public Result deleteNodeName() throws MoeraNodeException
      Delete all the information related to the node name (including the signing key) from the node. The name record on the naming server is not touched.
      Returns:
      Result
      Throws:
      MoeraNodeException
    • getStoredMnemonic

      public KeyMnemonic getStoredMnemonic() throws MoeraNodeException
      Get the updating key mnemonic stored on the node.
      Returns:
      KeyMnemonic
      Throws:
      MoeraNodeException
    • storeMnemonic

      public Result storeMnemonic(KeyMnemonic mnemonic) throws MoeraNodeException
      Store the updating key mnemonic on the node.
      Parameters:
      mnemonic - mnemonic
      Returns:
      Result
      Throws:
      MoeraNodeException
    • deleteStoredMnemonic

      public Result deleteStoredMnemonic() throws MoeraNodeException
      Delete the updating key mnemonic stored on the node.
      Returns:
      Result
      Throws:
      MoeraNodeException
    • sendNotification

      public Result sendNotification(NotificationPacket packet) throws MoeraNodeException
      Accept a notification packet from another node. Notification packets older than 10 minutes are ignored. The sending node should update the packet timestamp and the signature and send the packet again. This mechanism prevents attackers from recording and resending old signed packets.
      Parameters:
      packet - packet
      Returns:
      Result
      Throws:
      MoeraNodeException
    • getPeopleGeneral

      public PeopleGeneralInfo getPeopleGeneral() throws MoeraNodeException
      Get general information about other nodes.
      Returns:
      PeopleGeneralInfo
      Throws:
      MoeraNodeException
    • registerPlugin

      public PluginInfo registerPlugin(PluginDescription plugin) throws MoeraNodeException
      Register the plugin. If the plugin authenticates as root admin, the plugin is registered at the server level. If the plugin authenticates as node admin, the plugin is registered at the node level.
      Parameters:
      plugin - plugin
      Returns:
      PluginInfo
      Throws:
      MoeraNodeException
    • getPlugins

      public PluginInfo[] getPlugins() throws MoeraNodeException
      Get information about all plugins registered for the node and server.
      Returns:
      PluginInfo[]
      Throws:
      MoeraNodeException
    • getPlugin

      public PluginInfo getPlugin(String pluginName) throws MoeraNodeException
      Get information about the plugin.
      Parameters:
      pluginName - name of the plugin
      Returns:
      PluginInfo
      Throws:
      MoeraNodeException
    • unregisterPlugin

      public Result unregisterPlugin(String pluginName) throws MoeraNodeException
      Unregister the plugin.
      Parameters:
      pluginName - name of the plugin
      Returns:
      Result
      Throws:
      MoeraNodeException
    • createPosting

      public PostingInfo createPosting(PostingText posting) throws MoeraNodeException
      Create a new posting from the text given and publish it in the given feeds (if any). The heading and the preview of the posting are created automatically, if needed. The posting owner must authenticate in some way. If the posting is not signed, it will be kept for a limited period of time and then erased. If authenticated as admin, the node signs the posting.
      Parameters:
      posting - posting
      Returns:
      PostingInfo
      Throws:
      MoeraNodeException
    • updatePosting

      public PostingInfo updatePosting(String id, PostingText posting) throws MoeraNodeException
      Update the posting, creating a new revision of it. The text is processed just like in the POST request.
      Parameters:
      id - ID of the posting
      posting - posting
      Returns:
      PostingInfo
      Throws:
      MoeraNodeException
    • getPosting

      public PostingInfo getPosting(String id, boolean withSource) throws MoeraNodeException
      Get an individual posting.
      Parameters:
      id - ID of the posting
      withSource - include source text of the posting
      Returns:
      PostingInfo
      Throws:
      MoeraNodeException
    • deletePosting

      public Result deletePosting(String id) throws MoeraNodeException
      Delete the posting. The posting may not be purged from the database immediately, but preserved for some period of time to give a chance to restore it.
      Parameters:
      id - ID of the posting
      Returns:
      Result
      Throws:
      MoeraNodeException
    • getPostingsAttachedToPosting

      public PostingInfo[] getPostingsAttachedToPosting(String id) throws MoeraNodeException
      Get all postings linked to media attached to the given posting.
      Parameters:
      id - ID of the posting
      Returns:
      PostingInfo[]
      Throws:
      MoeraNodeException
    • getPostingRevisions

      public PostingRevisionInfo[] getPostingRevisions(String postingId, Integer limit) throws MoeraNodeException
      Get all revisions of the posting, but not more than limit. The node may decide to return fewer revisions than the given limit.
      Parameters:
      postingId - ID of the posting
      limit - maximum number of revisions returned
      Returns:
      PostingRevisionInfo[]
      Throws:
      MoeraNodeException
    • getPostingRevision

      public PostingRevisionInfo getPostingRevision(String postingId, String id) throws MoeraNodeException
      Get an individual revision of the posting.
      Parameters:
      postingId - ID of the posting
      id - ID of the revision
      Returns:
      PostingRevisionInfo
      Throws:
      MoeraNodeException
    • restorePostingRevision

      public PostingRevisionInfo restorePostingRevision(String postingId, String id) throws MoeraNodeException
      Restore a revision of the posting. A new revision is created with the same content as in the given revision.
      Parameters:
      postingId - ID of the posting
      id - ID of the revision
      Returns:
      PostingRevisionInfo
      Throws:
      MoeraNodeException
    • createPostingReaction

      public ReactionCreated createPostingReaction(String postingId, ReactionDescription reaction) throws MoeraNodeException
      Add a reaction to the given posting. The reaction owner must authenticate in some way. Only one reaction is allowed from each owner to a particular posting. If a reaction from the same owner to this posting already exists, it is overwritten. If the reaction is not signed, the reaction will be kept for a limited period of time and then erased (the previous reaction of the same owner will be restored, if any).
      Parameters:
      postingId - ID of the posting
      reaction - reaction
      Returns:
      ReactionCreated
      Throws:
      MoeraNodeException
    • getPostingReactionsSlice

      public ReactionsSliceInfo getPostingReactionsSlice(String postingId, Boolean negative, Integer emoji, Long before, Integer limit) throws MoeraNodeException
      Get a slice of the list of reactions to the given posting, optionally filtered by reaction type, delimited by before moment and the given limit. If before is not provided, the latest reactions are returned. The node may decide to return fewer reactions than the given limit. The reactions are always sorted by moment, descending.
      Parameters:
      postingId - ID of the posting
      negative - true, to filter negative reactions, false, to filter positive ones
      emoji - filter by reaction code, usually interpreted by clients as emoji code point
      before - filter reactions created at or before this moment
      limit - maximum number of reactions returned
      Returns:
      ReactionsSliceInfo
      Throws:
      MoeraNodeException
    • updatePostingReaction

      public ReactionInfo updatePostingReaction(String postingId, String ownerName, ReactionOverride reaction) throws MoeraNodeException
      Update the reaction's operations or set operations' overrides.
      Parameters:
      postingId - ID of the posting
      ownerName - reaction owner node name
      reaction - reaction
      Returns:
      ReactionInfo
      Throws:
      MoeraNodeException
    • getPostingReaction

      public ReactionInfo getPostingReaction(String postingId, String ownerName) throws MoeraNodeException
      Get the detailed information about the reaction of the given owner to the given posting. If no reaction with such an owner exists, an empty structure with just postingId is returned.
      Parameters:
      postingId - ID of the posting
      ownerName - reaction owner node name
      Returns:
      ReactionInfo
      Throws:
      MoeraNodeException
    • deleteAllPostingReactions

      public Result deleteAllPostingReactions(String postingId) throws MoeraNodeException
      Delete all reactions to the given posting.
      Parameters:
      postingId - ID of the posting
      Returns:
      Result
      Throws:
      MoeraNodeException
    • deletePostingReaction

      public ReactionTotalsInfo deletePostingReaction(String postingId, String ownerName) throws MoeraNodeException
      Delete the reaction of the given owner to the given posting.
      Parameters:
      postingId - ID of the posting
      ownerName - reaction owner node name
      Returns:
      ReactionTotalsInfo
      Throws:
      MoeraNodeException
    • searchPostingReactions

      public ReactionInfo[] searchPostingReactions(ReactionsFilter filter) throws MoeraNodeException
      Search reactions by criteria provided. Both reaction owner and at least one posting ID should be provided to search, otherwise an empty list is returned.
      Parameters:
      filter - filter
      Returns:
      ReactionInfo[]
      Throws:
      MoeraNodeException
    • getPostingReactionTotals

      public ReactionTotalsInfo getPostingReactionTotals(String postingId) throws MoeraNodeException
      Get a summary of reactions to the posting given.
      Parameters:
      postingId - ID of the posting
      Returns:
      ReactionTotalsInfo
      Throws:
      MoeraNodeException
    • searchPostingReactionTotals

      public ReactionTotalsInfo[] searchPostingReactionTotals(ReactionTotalsFilter filter) throws MoeraNodeException
      Search summaries of reactions by criteria provided. At least one posting ID should be provided to search, otherwise an empty list is returned.
      Parameters:
      filter - filter
      Returns:
      ReactionTotalsInfo[]
      Throws:
      MoeraNodeException
    • getProfile

      public ProfileInfo getProfile(boolean withSource) throws MoeraNodeException
      Get the profile.
      Parameters:
      withSource - include source text of the bio
      Returns:
      ProfileInfo
      Throws:
      MoeraNodeException
    • updateProfile

      public ProfileInfo updateProfile(ProfileAttributes profile) throws MoeraNodeException
      Update the profile. Fields that are not set in the request body are left intact. Fields that are set to an empty value are reset to their defaults.
      Parameters:
      profile - profile
      Returns:
      ProfileInfo
      Throws:
      MoeraNodeException
    • getDeleteNodeRequestStatus

      public DeleteNodeStatus getDeleteNodeRequestStatus() throws MoeraNodeException
      Get the current status of the request to delete the node.
      Returns:
      DeleteNodeStatus
      Throws:
      MoeraNodeException
    • sendDeleteNodeRequest

      public DeleteNodeStatus sendDeleteNodeRequest(DeleteNodeText deleteNodeText) throws MoeraNodeException
      Send a request to the provider to delete the node.
      Parameters:
      deleteNodeText - deleteNodeText
      Returns:
      DeleteNodeStatus
      Throws:
      MoeraNodeException
    • cancelDeleteNodeRequest

      public DeleteNodeStatus cancelDeleteNodeRequest() throws MoeraNodeException
      Cancel the request to delete the node.
      Returns:
      DeleteNodeStatus
      Throws:
      MoeraNodeException
    • proxyMedia

      public void proxyMedia(String url, NodeApiClient.ResponseConsumer responseConsumer) throws MoeraNodeException
      Open the URL passed in the parameters and pass to the client the media file returned by the server.
      Parameters:
      url - url
      responseConsumer - consumer of the data received
      Throws:
      MoeraNodeException
    • proxyLinkPreview

      public LinkPreviewInfo proxyLinkPreview(String url) throws MoeraNodeException
      Parse the page located at the URL and return the title, the description and the picture that may be used to build a preview of the page.
      Parameters:
      url - url
      Returns:
      LinkPreviewInfo
      Throws:
      MoeraNodeException
    • registerAtPushRelay

      public Result registerAtPushRelay(PushRelayClientAttributes attributes) throws MoeraNodeException
      Register a client at the push relay server to receive messages from this node. The operation is synchronous.
      Parameters:
      attributes - attributes
      Returns:
      Result
      Throws:
      MoeraNodeException
    • askRemoteNode

      public Result askRemoteNode(String nodeName, AskDescription details) throws MoeraNodeException
      Send a request to the remote node.
      Parameters:
      nodeName - name of the remote node
      details - details
      Returns:
      Result
      Throws:
      MoeraNodeException
    • createRemoteComment

      public Result createRemoteComment(String nodeName, String postingId, CommentSourceText comment) throws MoeraNodeException
      Add a comment to the posting on the remote node and register it in the registry at the local node.
      Parameters:
      nodeName - name of the remote node
      postingId - ID of the posting on the remote node
      comment - comment
      Returns:
      Result
      Throws:
      MoeraNodeException
    • updateRemoteComment

      public Result updateRemoteComment(String nodeName, String postingId, String commentId, CommentSourceText comment) throws MoeraNodeException
      Update a comment to the posting on the remote node.
      Parameters:
      nodeName - name of the remote node
      postingId - ID of the posting on the remote node
      commentId - ID of the comment on the remote node
      comment - comment
      Returns:
      Result
      Throws:
      MoeraNodeException
    • deleteRemoteComment

      public Result deleteRemoteComment(String nodeName, String postingId, String commentId) throws MoeraNodeException
      Delete a comment from the registry of all comments at the local node.
      Parameters:
      nodeName - name of the remote node
      postingId - ID of the posting on the remote node
      commentId - ID of the comment on the remote node
      Returns:
      Result
      Throws:
      MoeraNodeException
    • verifyRemoteComment

      public AsyncOperationCreated verifyRemoteComment(String nodeName, String postingId, String commentId) throws MoeraNodeException
      Verify the signature of the given comment to the posting on the remote node.
      Parameters:
      nodeName - name of the remote node
      postingId - ID of the posting on the remote node
      commentId - ID of the comment on the remote node
      Returns:
      AsyncOperationCreated
      Throws:
      MoeraNodeException
    • createRemoteCommentReaction

      public Result createRemoteCommentReaction(String nodeName, String postingId, String commentId, ReactionAttributes reaction) throws MoeraNodeException
      Add a reaction to the comment on the remote node and register it in the registry at the local node.
      Parameters:
      nodeName - name of the remote node
      postingId - ID of the posting on the remote node
      commentId - ID of the comment on the remote node
      reaction - reaction
      Returns:
      Result
      Throws:
      MoeraNodeException
    • deleteRemoteCommentReaction

      public Result deleteRemoteCommentReaction(String nodeName, String postingId, String commentId) throws MoeraNodeException
      Delete a reaction from the registry of all reactions at the local node.
      Parameters:
      nodeName - name of the remote node
      postingId - ID of the posting on the remote node
      commentId - ID of the comment on the remote node
      Returns:
      Result
      Throws:
      MoeraNodeException
    • verifyRemoteCommentReaction

      public AsyncOperationCreated verifyRemoteCommentReaction(String nodeName, String postingId, String commentId, String ownerName) throws MoeraNodeException
      Verify the signature of the reaction of the given owner to the comment on the remote node.
      Parameters:
      nodeName - name of the remote node
      postingId - ID of the posting on the remote node
      commentId - ID of the comment on the remote node
      ownerName - reaction owner node name
      Returns:
      AsyncOperationCreated
      Throws:
      MoeraNodeException
    • createRemotePosting

      public Result createRemotePosting(String nodeName, PostingSourceText posting) throws MoeraNodeException
      Add a posting to the remote node and register it in the registry at the local node.
      Parameters:
      nodeName - name of the remote node
      posting - posting
      Returns:
      Result
      Throws:
      MoeraNodeException
    • updateRemotePosting

      public Result updateRemotePosting(String nodeName, String postingId, PostingSourceText posting) throws MoeraNodeException
      Update a posting on the remote node.
      Parameters:
      nodeName - name of the remote node
      postingId - ID of the posting on the remote node
      posting - posting
      Returns:
      Result
      Throws:
      MoeraNodeException
    • deleteRemotePosting

      public Result deleteRemotePosting(String nodeName, String postingId) throws MoeraNodeException
      Delete a posting from the registry of all remote postings at the local node.
      Parameters:
      nodeName - name of the remote node
      postingId - ID of the posting on the remote node
      Returns:
      Result
      Throws:
      MoeraNodeException
    • verifyRemotePosting

      public AsyncOperationCreated verifyRemotePosting(String nodeName, String id) throws MoeraNodeException
      Verify the signature of the given posting.
      Parameters:
      nodeName - name of the remote node
      id - ID of the posting on the remote node
      Returns:
      AsyncOperationCreated
      Throws:
      MoeraNodeException
    • verifyRemotePostingRevision

      public AsyncOperationCreated verifyRemotePostingRevision(String nodeName, String id, String revisionId) throws MoeraNodeException
      Verify the signature of the given revision of a posting.
      Parameters:
      nodeName - name of the remote node
      id - ID of the posting on the remote node
      revisionId - ID of the posting revision
      Returns:
      AsyncOperationCreated
      Throws:
      MoeraNodeException
    • createRemotePostingReaction

      public Result createRemotePostingReaction(String nodeName, String postingId, ReactionAttributes reaction) throws MoeraNodeException
      Add a reaction to the posting on the remote node and register it in the registry at the local node.
      Parameters:
      nodeName - name of the remote node
      postingId - ID of the posting on the remote node
      reaction - reaction
      Returns:
      Result
      Throws:
      MoeraNodeException
    • deleteRemotePostingReaction

      public Result deleteRemotePostingReaction(String nodeName, String postingId) throws MoeraNodeException
      Delete a reaction from the registry of all reactions at the local node.
      Parameters:
      nodeName - name of the remote node
      postingId - ID of the posting on the remote node
      Returns:
      Result
      Throws:
      MoeraNodeException
    • verifyRemotePostingReaction

      public AsyncOperationCreated verifyRemotePostingReaction(String nodeName, String postingId, String ownerName) throws MoeraNodeException
      Verify the signature of the reaction of the given owner to the posting on the remote node.
      Parameters:
      nodeName - name of the remote node
      postingId - ID of the posting on the remote node
      ownerName - reaction owner node name
      Returns:
      AsyncOperationCreated
      Throws:
      MoeraNodeException
    • createRemoteSheriffOrder

      public Result createRemoteSheriffOrder(String nodeName, SheriffOrderAttributes sheriffOrder) throws MoeraNodeException
      Sign and send the order to the remote node and store it in the registry at the local node.
      Parameters:
      nodeName - name of the remote node
      sheriffOrder - sheriffOrder
      Returns:
      Result
      Throws:
      MoeraNodeException
    • getRemoteSheriffOrder

      public SheriffOrderInfo getRemoteSheriffOrder(String nodeName, String id) throws MoeraNodeException
      Get the details of the given sheriff's order
      Parameters:
      nodeName - name of the remote node
      id - ID of the order
      Returns:
      SheriffOrderInfo
      Throws:
      MoeraNodeException
    • updateSettings

      public Result updateSettings(SettingInfo[] settings) throws MoeraNodeException
      Update the given settings. If the input contains node settings, they are validated and the first validation error is returned, if any. The update is always performed as a whole - if there is an error saving any one of the settings in the input, none of them are updated.

      If one of the settings to be updated is privileged, root secret authentication is required. If one of the settings to be updated is non-privileged, admin authentication is required.
      Parameters:
      settings - settings
      Returns:
      Result
      Throws:
      MoeraNodeException
    • getClientSettings

      public SettingInfo[] getClientSettings(String prefix) throws MoeraNodeException
      Get all client settings, sorted by name.
      Parameters:
      prefix - filter settings whose names start with the given prefix, case-sensitive (client. prefix must be included)
      Returns:
      SettingInfo[]
      Throws:
      MoeraNodeException
    • getNodeSettings

      public SettingInfo[] getNodeSettings(String prefix) throws MoeraNodeException
      Get all node settings, sorted by name. If a setting has not changed its value from the default, it is omitted.
      Parameters:
      prefix - filter settings whose names start with the given prefix, case-sensitive
      Returns:
      SettingInfo[]
      Throws:
      MoeraNodeException
    • getNodeSettingsMetadata

      public SettingMetaInfo[] getNodeSettingsMetadata(String prefix) throws MoeraNodeException
      Get all node settings metadata, sorted by name.
      Parameters:
      prefix - filter settings whose names start with the given prefix, case-sensitive
      Returns:
      SettingMetaInfo[]
      Throws:
      MoeraNodeException
    • updateNodeSettingsMetadata

      public Result updateNodeSettingsMetadata(SettingMetaAttributes[] metadata) throws MoeraNodeException
      Update node settings metadata, overriding built-in defaults.
      Parameters:
      metadata - metadata
      Returns:
      Result
      Throws:
      MoeraNodeException
    • getSheriffComplaintGroupsSlice

      public SheriffComplaintGroupsSliceInfo getSheriffComplaintGroupsSlice(Long after, Long before, Integer limit, SheriffComplaintStatus status) throws MoeraNodeException
      Get a slice of the list of groups of complaints, optionally filtered by status, delimited by the before or after moment and the given limit. If neither before nor after are provided, the latest groups are returned. The node may decide to return fewer groups than the given limit. The groups are always sorted by moment, descending.
      Parameters:
      after - filter groups created strongly after this moment
      before - filter groups created at or before this moment
      limit - maximum number of groups returned
      status - filter groups by status
      Returns:
      SheriffComplaintGroupsSliceInfo
      Throws:
      MoeraNodeException
    • getSheriffComplaintGroup

      public SheriffComplaintGroupInfo getSheriffComplaintGroup(String id) throws MoeraNodeException
      Get details of the given group of complaints.
      Parameters:
      id - ID of the group of complaints
      Returns:
      SheriffComplaintGroupInfo
      Throws:
      MoeraNodeException
    • getSheriffComplaintsByGroup

      public SheriffComplaintInfo[] getSheriffComplaintsByGroup(String id) throws MoeraNodeException
      Get complaints included in the given group of complaints.
      Parameters:
      id - ID of the group of complaints
      Returns:
      SheriffComplaintInfo[]
      Throws:
      MoeraNodeException
    • updateSheriffComplaintGroup

      public SheriffComplaintGroupInfo updateSheriffComplaintGroup(String id, SheriffComplaintDecisionText decision) throws MoeraNodeException
      Make a decision on the given group of complaints.
      Parameters:
      id - ID of the group of complaints
      decision - decision
      Returns:
      SheriffComplaintGroupInfo
      Throws:
      MoeraNodeException
    • createSheriffComplaint

      public SheriffComplaintInfo createSheriffComplaint(SheriffComplaintText complaint) throws MoeraNodeException
      Send a complaint to the sheriff.
      Parameters:
      complaint - complaint
      Returns:
      SheriffComplaintInfo
      Throws:
      MoeraNodeException
    • createSheriffOrder

      public Result createSheriffOrder(SheriffOrderDetails sheriffOrder) throws MoeraNodeException
      Receive and execute the sheriff's order.
      Parameters:
      sheriffOrder - sheriffOrder
      Returns:
      Result
      Throws:
      MoeraNodeException
    • getStory

      public StoryInfo getStory(String id) throws MoeraNodeException
      Get an individual story.
      Parameters:
      id - ID of the story
      Returns:
      StoryInfo
      Throws:
      MoeraNodeException
    • updateStory

      public StoryInfo updateStory(String id, StoryAttributes story) throws MoeraNodeException
      Update the story.
      Parameters:
      id - ID of the story
      story - story
      Returns:
      StoryInfo
      Throws:
      MoeraNodeException
    • deleteStory

      public Result deleteStory(String id) throws MoeraNodeException
      Delete the story.
      Parameters:
      id - ID of the story
      Returns:
      Result
      Throws:
      MoeraNodeException
    • getSubscribers

      public SubscriberInfo[] getSubscribers(String nodeName, SubscriptionType type, String feedName, String entryId) throws MoeraNodeException
      Get the list of all subscribers, optionally filtered by some criteria.
      Parameters:
      nodeName - filter by subscribed node name
      type - filter by subscription type
      feedName - filter by name of the feed subscribed to
      entryId - filter by ID of the entry subscribed to
      Returns:
      SubscriberInfo[]
      Throws:
      MoeraNodeException
    • createSubscriber

      public SubscriberInfo createSubscriber(SubscriberDescription subscriber) throws MoeraNodeException
      Subscribe to a particular group of notifications.
      Parameters:
      subscriber - subscriber
      Returns:
      SubscriberInfo
      Throws:
      MoeraNodeException
    • getSubscriber

      public SubscriberInfo getSubscriber(String id) throws MoeraNodeException
      Get an individual subscriber.
      Parameters:
      id - ID of the subscriber
      Returns:
      SubscriberInfo
      Throws:
      MoeraNodeException
    • updateSubscriber

      public SubscriberInfo updateSubscriber(String id, SubscriberOverride subscriber) throws MoeraNodeException
      Update the subscriber's operations or set operations' overrides.
      Parameters:
      id - ID of the subscriber
      subscriber - subscriber
      Returns:
      SubscriberInfo
      Throws:
      MoeraNodeException
    • deleteSubscriber

      public ContactInfo deleteSubscriber(String id) throws MoeraNodeException
      Delete the subscriber and return the updated information about the node that was subscribed.
      Parameters:
      id - ID of the subscriber
      Returns:
      ContactInfo
      Throws:
      MoeraNodeException
    • getSubscriptions

      public SubscriptionInfo[] getSubscriptions(String nodeName, SubscriptionType type) throws MoeraNodeException
      Get the list of all subscriptions, optionally filtered by some criteria.
      Parameters:
      nodeName - filter by node name
      type - filter by subscription type
      Returns:
      SubscriptionInfo[]
      Throws:
      MoeraNodeException
    • createSubscription

      public SubscriptionInfo createSubscription(SubscriptionDescription subscription) throws MoeraNodeException
      Register a subscription to notifications from a particular node.
      Parameters:
      subscription - subscription
      Returns:
      SubscriptionInfo
      Throws:
      MoeraNodeException
    • updateSubscription

      public SubscriptionInfo updateSubscription(String id, SubscriptionOverride subscription) throws MoeraNodeException
      Update the subscription's operations or set operations' overrides.
      Parameters:
      id - ID of the subscription
      subscription - subscription
      Returns:
      SubscriptionInfo
      Throws:
      MoeraNodeException
    • deleteSubscription

      public ContactInfo deleteSubscription(String id) throws MoeraNodeException
      Delete the subscription and return the updated information about the node that was subscribed to.
      Parameters:
      id - ID of the subscription
      Returns:
      ContactInfo
      Throws:
      MoeraNodeException
    • searchSubscriptions

      public SubscriptionInfo[] searchSubscriptions(SubscriptionFilter filter) throws MoeraNodeException
      Search for subscriptions by the given criteria.
      Parameters:
      filter - filter
      Returns:
      SubscriptionInfo[]
      Throws:
      MoeraNodeException
    • getTokens

      public TokenInfo[] getTokens() throws MoeraNodeException
      Get the list of all existing tokens.
      Returns:
      TokenInfo[]
      Throws:
      MoeraNodeException
    • createToken

      public TokenInfo createToken(TokenAttributes token) throws MoeraNodeException
      Sign in and create a token.
      Parameters:
      token - token
      Returns:
      TokenInfo
      Throws:
      MoeraNodeException
    • getTokenInfo

      public TokenInfo getTokenInfo(String id) throws MoeraNodeException
      Get information about the token.
      Parameters:
      id - ID of the token
      Returns:
      TokenInfo
      Throws:
      MoeraNodeException
    • updateToken

      public TokenInfo updateToken(String id, TokenUpdate update) throws MoeraNodeException
      Update the name or permissions of the token. It is not possible to grant token additional permissions with this request, but the granted permissions can be revoked.
      Parameters:
      id - ID of the token
      update - update
      Returns:
      TokenInfo
      Throws:
      MoeraNodeException
    • deleteToken

      public Result deleteToken(String id) throws MoeraNodeException
      Delete the token.
      Parameters:
      id - ID of the token
      Returns:
      Result
      Throws:
      MoeraNodeException
    • getUserListGeneral

      public UserListInfo getUserListGeneral(String name) throws MoeraNodeException
      Get the general information about the user list given.
      Parameters:
      name - the name of the list
      Returns:
      UserListInfo
      Throws:
      MoeraNodeException
    • getUserListSlice

      public UserListSliceInfo getUserListSlice(String name, Long after, Long before, Integer limit) throws MoeraNodeException
      Get a slice of the user list, delimited by the before or after moment and the given limit. If neither before nor after are provided, the latest items are returned. The node may decide to return fewer items than the given limit. The items are always sorted by moment, descending.
      Parameters:
      name - the name of the list
      after - filter items created strongly after this moment
      before - filter items created at or before this moment
      limit - maximum number of items returned
      Returns:
      UserListSliceInfo
      Throws:
      MoeraNodeException
    • getUserListItem

      public UserListItemInfo getUserListItem(String name, String nodeName) throws MoeraNodeException
      Get the information from the user list about the node given.
      Parameters:
      name - the name of the list
      nodeName - the node name to get information about
      Returns:
      UserListItemInfo
      Throws:
      MoeraNodeException
    • createUserListItem

      public UserListItemInfo createUserListItem(String name, UserListItemAttributes item) throws MoeraNodeException
      Add a node to the user list.
      Parameters:
      name - the name of the list
      item - item
      Returns:
      UserListItemInfo
      Throws:
      MoeraNodeException
    • deleteUserListItem

      public Result deleteUserListItem(String name, String nodeName) throws MoeraNodeException
      Delete a node from the user list
      Parameters:
      name - the name of the list
      nodeName - the node name to delete
      Returns:
      Result
      Throws:
      MoeraNodeException
    • whoAmI

      public WhoAmI whoAmI() throws MoeraNodeException
      Get brief information about the node.
      Returns:
      WhoAmI
      Throws:
      MoeraNodeException