UNPKG

moeralib

Version:

Library to interact with Moera decentralized social network

1,110 lines 79.9 kB
import { Caller } from "./caller"; import * as API from "./types"; /** * Node API interface. */ export declare class MoeraNode extends Caller { /** * @param {string | null} nodeUrl - the node URL */ constructor(nodeUrl?: string | null); /** * Get the list of all reactions performed by the node, filtered by some criteria. * * @param {API.ActivityReactionFilter} filter * @return {Promise<API.ActivityReactionInfo[]>} */ searchActivityReactions(filter: API.ActivityReactionFilter): Promise<API.ActivityReactionInfo[]>; /** * Get a list of previously executed search queries, optionally filtered by the given ``prefix`` and limited by the * given ``limit``. The node may decide to return fewer queries than the given ``limit``. The queries are always * sorted by creation timestamp, descending. * * @param {string | null} prefix - find queries with the specified prefix (case-insensitive) * @param {number | null} limit - maximum number of queries returned * @return {Promise<API.SearchHistoryInfo[]>} */ getSearchHistory(prefix?: string | null, limit?: number | null): Promise<API.SearchHistoryInfo[]>; /** * Save a search query in the registry. * * @param {API.SearchHistoryText} historyText * @return {Promise<API.SearchHistoryInfo>} */ saveToSearchHistory(historyText: API.SearchHistoryText): Promise<API.SearchHistoryInfo>; /** * Delete a search query from the registry. * * @param {string} query - the query to be deleted * @return {Promise<API.Result>} */ deleteFromSearchHistory(query: string): Promise<API.Result>; /** * Get a slice of the list of all orders sent by the sheriff, delimited by the ``before`` or ``after`` moment and * the given ``limit``. If neither ``before`` nor ``after`` are provided, the latest orders are returned. The node * may decide to return fewer orders than the given ``limit``. The orders are always sorted by moment, descending. * * @param {number | null} after - filter orders posted strongly after this moment * @param {number | null} before - filter orders posted at or before this moment * @param {number | null} limit - maximum number of orders returned * @return {Promise<API.SheriffOrdersSliceInfo>} */ getRemoteSheriffOrdersSlice(after?: number | null, before?: number | null, limit?: number | null): Promise<API.SheriffOrdersSliceInfo>; /** * Get the status of the asynchronous operation that performs verification of a remote posting signature. * * @param {string} id - asynchronous operation ID * @return {Promise<API.RemotePostingVerificationInfo>} */ getRemotePostingVerificationStatus(id: string): Promise<API.RemotePostingVerificationInfo>; /** * Get the status of the asynchronous operation that performs verification of the signature of a reaction to a * remote posting. * * @param {string} id - asynchronous operation ID * @return {Promise<API.RemoteReactionVerificationInfo>} */ getRemoteReactionVerificationStatus(id: string): Promise<API.RemoteReactionVerificationInfo>; /** * Get the list of avatars in the ascending order of their ordinals. * * @return {Promise<API.AvatarInfo[]>} */ getAvatars(): Promise<API.AvatarInfo[]>; /** * 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. * * @param {API.AvatarAttributes} avatar * @return {Promise<API.AvatarInfo>} */ createAvatar(avatar: API.AvatarAttributes): Promise<API.AvatarInfo>; /** * Get an individual avatar. * * @param {string} id - avatar ID * @return {Promise<API.AvatarInfo>} */ getAvatar(id: string): Promise<API.AvatarInfo>; /** * Delete an avatar. * * @param {string} id - avatar ID * @return {Promise<API.Result>} */ deleteAvatar(id: string): Promise<API.Result>; /** * 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. * * @param {API.AvatarsOrdered} order * @return {Promise<API.AvatarOrdinal[]>} */ reorderAvatars(order: API.AvatarsOrdered): Promise<API.AvatarOrdinal[]>; /** * Blocks creation of instants of the given story type, related to the given entry, optionally unblocking at the * given time in the future. * * @param {API.BlockedInstantAttributes} instant * @return {Promise<API.BlockedInstantInfo>} */ blockInstant(instant: API.BlockedInstantAttributes): Promise<API.BlockedInstantInfo>; /** * Get details about the given blocked instant. * * @param {string} id - ID of the blocked instant * @return {Promise<API.BlockedInstantInfo>} */ getBlockedInstant(id: string): Promise<API.BlockedInstantInfo>; /** * Unblock the given instant. * * @param {string} id - ID of the blocked instant * @return {Promise<API.Result>} */ unblockInstant(id: string): Promise<API.Result>; /** * Search blocked instants by the given criteria. * * @param {API.BlockedInstantFilter} filter * @return {Promise<API.BlockedInstantInfo[]>} */ searchBlockedInstants(filter: API.BlockedInstantFilter): Promise<API.BlockedInstantInfo[]>; /** * Blocks the given node from performing the given operations, in a particular posting or globally, optionally * unblocking at the given time in the future. * * @param {API.BlockedUserAttributes} user * @return {Promise<API.BlockedUserInfo>} */ blockUser(user: API.BlockedUserAttributes): Promise<API.BlockedUserInfo>; /** * Get details about the given blocked user. * * @param {string} id - ID of the blocked user * @return {Promise<API.BlockedUserInfo>} */ getBlockedUser(id: string): Promise<API.BlockedUserInfo>; /** * Unblock the given user. * * @param {string} id - ID of the blocked user * @return {Promise<API.Result>} */ unblockUser(id: string): Promise<API.Result>; /** * Search blocked users by the given criteria. * * @param {API.BlockedUserFilter} filter * @return {Promise<API.BlockedUserInfo[]>} */ searchBlockedUsers(filter: API.BlockedUserFilter): Promise<API.BlockedUserInfo[]>; /** * 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. * * @return {Promise<API.BlockedUsersChecksums>} */ getBlockedUsersChecksums(): Promise<API.BlockedUsersChecksums>; /** * Get details about the given node that blocked this node. * * @param {string} id - ID of the blocked-by user * @return {Promise<API.BlockedByUserInfo>} */ getBlockedByUser(id: string): Promise<API.BlockedByUserInfo>; /** * Search nodes that blocked this node, by the given criteria. * * @param {API.BlockedByUserFilter} filter * @return {Promise<API.BlockedByUserInfo[]>} */ searchBlockedByUsers(filter: API.BlockedByUserFilter): Promise<API.BlockedByUserInfo[]>; /** * Create a set of cartes with the given attributes. Cartes in the sequence correspond to successive periods of * time. * * @param {API.CarteAttributes} attributes * @return {Promise<API.CarteSet>} */ createCartes(attributes: API.CarteAttributes): Promise<API.CarteSet>; /** * 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. * * @param {API.ClientCarte} clientCarte * @return {Promise<API.CarteVerificationInfo>} */ verifyCarte(clientCarte: API.ClientCarte): Promise<API.CarteVerificationInfo>; /** * 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. * * @param {string} postingId - ID of the posting * @param {number | null} after - filter comments posted strongly after this moment * @param {number | null} before - filter comments posted at or before this moment * @param {number | null} limit - maximum number of comments returned * @return {Promise<API.CommentsSliceInfo>} */ getCommentsSlice(postingId: string, after?: number | null, before?: number | null, limit?: number | null): Promise<API.CommentsSliceInfo>; /** * 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. * * @param {string} postingId - ID of the posting * @param {API.CommentText} comment * @return {Promise<API.CommentCreated>} */ createComment(postingId: string, comment: API.CommentText): Promise<API.CommentCreated>; /** * Get an individual comment. * * @param {string} postingId - ID of the posting * @param {string} commentId - ID of the comment * @param {boolean} withSource - include source text of the comment * @return {Promise<API.CommentInfo>} */ getComment(postingId: string, commentId: string, withSource?: boolean): Promise<API.CommentInfo>; /** * Update operation overrides for all comments in the posting. * * @param {string} postingId - ID of the posting * @param {API.CommentMassAttributes} attributes * @return {Promise<API.Result>} */ updateAllComments(postingId: string, attributes: API.CommentMassAttributes): Promise<API.Result>; /** * Update the comment, creating a new revision of it. The text is processed just like in the ``POST`` request. * * @param {string} postingId - ID of the posting * @param {string} commentId - ID of the comment * @param {API.CommentText} comment * @return {Promise<API.CommentInfo>} */ updateComment(postingId: string, commentId: string, comment: API.CommentText): Promise<API.CommentInfo>; /** * 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. * * @param {string} postingId - ID of the posting * @param {string} commentId - ID of the comment * @return {Promise<API.CommentTotalInfo>} */ deleteComment(postingId: string, commentId: string): Promise<API.CommentTotalInfo>; /** * Get all postings linked to media attached to the given comment. * * @param {string} postingId - ID of the posting * @param {string} commentId - ID of the comment * @return {Promise<API.PostingInfo[]>} */ getPostingsAttachedToComment(postingId: string, commentId: string): Promise<API.PostingInfo[]>; /** * Get all revisions of the comment. * * @param {string} postingId - ID of the posting * @param {string} commentId - ID of the comment * @return {Promise<API.CommentRevisionInfo[]>} */ getCommentRevisions(postingId: string, commentId: string): Promise<API.CommentRevisionInfo[]>; /** * Get an individual revision of the comment. * * @param {string} postingId - ID of the posting * @param {string} commentId - ID of the comment * @param {string} id - ID of the revision * @return {Promise<API.CommentRevisionInfo>} */ getCommentRevision(postingId: string, commentId: string, id: string): Promise<API.CommentRevisionInfo>; /** * 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). * * @param {string} postingId - ID of the posting * @param {string} commentId - ID of the comment * @param {API.ReactionDescription} reaction * @return {Promise<API.ReactionCreated>} */ createCommentReaction(postingId: string, commentId: string, reaction: API.ReactionDescription): Promise<API.ReactionCreated>; /** * Update the reaction's operations or set operations' overrides. * * @param {string} postingId - ID of the posting * @param {string} commentId - ID of the comment * @param {string} ownerName - reaction owner node name * @param {API.ReactionOverride} reaction * @return {Promise<API.ReactionInfo>} */ updateCommentReaction(postingId: string, commentId: string, ownerName: string, reaction: API.ReactionOverride): Promise<API.ReactionInfo>; /** * 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. * * @param {string} postingId - ID of the posting * @param {string} commentId - ID of the comment * @param {boolean | null} negative - ``true``, to filter negative reactions, ``false``, to filter positive ones * @param {number | null} emoji - filter by reaction code, usually interpreted by clients as emoji code point * @param {number | null} before - filter reactions created at or before this moment * @param {number | null} limit - maximum number of reactions returned * @return {Promise<API.ReactionsSliceInfo>} */ getCommentReactionsSlice(postingId: string, commentId: string, negative?: boolean | null, emoji?: number | null, before?: number | null, limit?: number | null): Promise<API.ReactionsSliceInfo>; /** * 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. * * @param {string} postingId - ID of the posting * @param {string} commentId - ID of the comment * @param {string} ownerName - reaction owner node name * @return {Promise<API.ReactionInfo>} */ getCommentReaction(postingId: string, commentId: string, ownerName: string): Promise<API.ReactionInfo>; /** * Delete all reactions to the given comment. * * @param {string} postingId - ID of the posting * @param {string} commentId - ID of the comment * @return {Promise<API.Result>} */ deleteAllCommentReactions(postingId: string, commentId: string): Promise<API.Result>; /** * Delete the reaction of the given owner to the given comment. * * @param {string} postingId - ID of the posting * @param {string} commentId - ID of the comment * @param {string} ownerName - reaction owner node name * @return {Promise<API.ReactionTotalsInfo>} */ deleteCommentReaction(postingId: string, commentId: string, ownerName: string): Promise<API.ReactionTotalsInfo>; /** * Get a summary of reactions to the comment given. * * @param {string} postingId - ID of the posting * @param {string} commentId - ID of the comment * @return {Promise<API.ReactionTotalsInfo>} */ getCommentReactionTotals(postingId: string, commentId: string): Promise<API.ReactionTotalsInfo>; /** * 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 *social distance* from the node, which depends on their subscription and friendship * status and the number of recent reactions and comments. * * @param {string | null} query - the search query * @param {number | null} limit - maximum number of contacts returned * @return {Promise<API.ContactInfo[]>} */ getContacts(query?: string | null, limit?: number | null): Promise<API.ContactInfo[]>; /** * Fetch the detailed information, including relationships, about the contacts matching the filter. * * @param {API.ContactFilter} filter * @return {Promise<API.ContactWithRelationships[]>} */ fetchContacts(filter: API.ContactFilter): Promise<API.ContactWithRelationships[]>; /** * Check whether the credentials are initialized already. * * @return {Promise<API.CredentialsCreated>} */ checkCredentials(): Promise<API.CredentialsCreated>; /** * 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. * * @param {API.Credentials} credentials * @return {Promise<API.Result>} */ createCredentials(credentials: API.Credentials): Promise<API.Result>; /** * 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. * * @param {API.CredentialsChange} credentials * @return {Promise<API.Result>} */ updateCredentials(credentials: API.CredentialsChange): Promise<API.Result>; /** * Delete credentials. * * @return {Promise<API.Result>} */ deleteCredentials(): Promise<API.Result>; /** * 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. * * @return {Promise<API.EmailHint>} */ resetCredentials(): Promise<API.EmailHint>; /** * Verify the credentials reset token. If the token is valid, it may be used later to change the credentials * without knowing the password. * * @param {API.CredentialsResetToken} resetToken * @return {Promise<API.VerificationInfo>} */ verifyCredentialsResetToken(resetToken: API.CredentialsResetToken): Promise<API.VerificationInfo>; /** * 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. * * @param {number | null} page - page number, 0 by default * @param {number | null} limit - page size (maximum number of postings returned), the default is defined by the * node * @return {Promise<API.PostingInfo[]>} */ getDeletedPostings(page?: number | null, limit?: number | null): Promise<API.PostingInfo[]>; /** * Get an individual deleted posting. * * @param {string} id - ID of the posting * @return {Promise<API.PostingInfo>} */ getDeletedPosting(id: string): Promise<API.PostingInfo>; /** * Restore a posting. A new revision is created with the same content as in the latest revision. * * @param {string} id - ID of the posting * @return {Promise<API.PostingInfo>} */ restoreDeletedPosting(id: string): Promise<API.PostingInfo>; /** * Get all revisions of the deleted posting, but not more than ``limit``. The node may decide to return fewer * revisions than the given ``limit``. * * @param {string} postingId - ID of the posting * @param {number | null} limit - maximum number of revisions returned * @return {Promise<API.PostingRevisionInfo[]>} */ getDeletePostingRevisions(postingId: string, limit?: number | null): Promise<API.PostingRevisionInfo[]>; /** * Get an individual revision of the deleted posting. * * @param {string} postingId - ID of the posting * @param {string} id - ID of the revision * @return {Promise<API.PostingRevisionInfo>} */ getDeletedPostingRevision(postingId: string, id: string): Promise<API.PostingRevisionInfo>; /** * Restore a posting at a particular revision. A new revision is created with the same content as in the given * revision. * * @param {string} postingId - ID of the posting * @param {string} id - ID of the revision * @return {Promise<API.PostingRevisionInfo>} */ restoreDeletedPostingRevision(postingId: string, id: string): Promise<API.PostingRevisionInfo>; /** * Get the list of registered domains. * * @return {Promise<API.DomainInfo[]>} */ getDomains(): Promise<API.DomainInfo[]>; /** * Get information about the domain with the given hostname. If domain registration for this server is public, this * request does not require authentication. * * @param {string} name - domain name * @return {Promise<API.DomainInfo>} */ getDomain(name: string): Promise<API.DomainInfo>; /** * 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. * * @param {API.DomainAttributes} domain * @return {Promise<API.DomainInfo>} */ createDomain(domain: API.DomainAttributes): Promise<API.DomainInfo>; /** * 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. * * @param {string} name - domain's hostname * @param {API.DomainAttributes} domain * @return {Promise<API.DomainInfo>} */ updateDomain(name: string, domain: API.DomainAttributes): Promise<API.DomainInfo>; /** * Delete the domain with the given hostname. This operation deletes the domain record only, the user's data * related to the domain is preserved. * * @param {string} name - domain name * @return {Promise<API.Result>} */ deleteDomain(name: string): Promise<API.Result>; /** * 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. * * @param {string} remoteNodeName - node name * @return {Promise<API.DomainAvailable>} */ isDomainAvailable(remoteNodeName: string): Promise<API.DomainAvailable>; /** * 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. * * @param {API.DraftType} draftType - type of the drafts * @param {string} remoteNodeName - name of the node the drafts are related to * @param {string | null} postingId - ID of the posting, mandatory for all types, except ``new-posting`` * @param {string | null} commentId - ID of the comment, mandatory for ``comment-update`` type * @param {number | null} page - page number, 0 by default * @param {number | null} limit - page size (maximum number of postings returned), the default is defined by the * node * @return {Promise<API.DraftInfo[]>} */ getDrafts(draftType: API.DraftType, remoteNodeName: string, postingId?: string | null, commentId?: string | null, page?: number | null, limit?: number | null): Promise<API.DraftInfo[]>; /** * Create a new draft from the text given. * * @param {API.DraftText} draft * @return {Promise<API.DraftInfo>} */ createDraft(draft: API.DraftText): Promise<API.DraftInfo>; /** * Get an individual draft. * * @param {string} id - ID of the draft * @return {Promise<API.DraftInfo>} */ getDraft(id: string): Promise<API.DraftInfo>; /** * Update the draft. * * @param {string} id - ID of the draft * @param {API.DraftText} draft * @return {Promise<API.DraftInfo>} */ updateDraft(id: string, draft: API.DraftText): Promise<API.DraftInfo>; /** * Delete the draft. * * @param {string} id - ID of the draft * @return {Promise<API.Result>} */ deleteDraft(id: string): Promise<API.Result>; /** * Get information about features supported by the node. * * @return {Promise<API.Features>} */ getFeatures(): Promise<API.Features>; /** * Get general information about all feeds accessible by client. * * @return {Promise<API.FeedInfo[]>} */ getFeeds(): Promise<API.FeedInfo[]>; /** * Get general information about the feed. * * @param {string} feedName - name of the feed * @return {Promise<API.FeedInfo>} */ getFeedGeneral(feedName: string): Promise<API.FeedInfo>; /** * Get information about the total number and number of non-read and non-viewed stories in the feed. * * @param {string} feedName - name of the feed * @return {Promise<API.FeedStatus>} */ getFeedStatus(feedName: string): Promise<API.FeedStatus>; /** * Update information about non-read and non-viewed stories in the feed. * * @param {string} feedName - name of the feed * @param {API.FeedStatusChange} change * @return {Promise<API.FeedStatus>} */ updateFeedStatus(feedName: string, change: API.FeedStatusChange): Promise<API.FeedStatus>; /** * 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. * * @param {string} feedName - name of the feed * @param {number | null} after - filter stories posted strongly after this moment * @param {number | null} before - filter stories posted at or before this moment * @param {number | null} limit - maximum number of stories returned * @return {Promise<API.FeedSliceInfo>} */ getFeedSlice(feedName: string, after?: number | null, before?: number | null, limit?: number | null): Promise<API.FeedSliceInfo>; /** * Delete all stories from the feed with optional filtering. * * @param {string} feedName - name of the feed * @param {API.StoryType | null} type - delete only the stories of the given type * @param {string | null} receiver - delete only the stories about postings located at the given node * @param {boolean | null} recommended - delete only the stories about recommended postings * @return {Promise<API.Result>} */ deleteFeedStories(feedName: string, type?: API.StoryType | null, receiver?: string | null, recommended?: boolean | null): Promise<API.Result>; /** * Get the list of all groups of friends that exist on the node. * * @return {Promise<API.FriendGroupInfo[]>} */ getFriendGroups(): Promise<API.FriendGroupInfo[]>; /** * Get the information about the group of friends. * * @param {string} id - ID of the group of friends * @return {Promise<API.FriendGroupInfo>} */ getFriendGroup(id: string): Promise<API.FriendGroupInfo>; /** * Create a group of friends. * * @param {API.FriendGroupDescription} friendGroup * @return {Promise<API.FriendGroupInfo>} */ createFriendGroup(friendGroup: API.FriendGroupDescription): Promise<API.FriendGroupInfo>; /** * Update the details of the group of friends. * * @param {string} id - ID of the group of friends * @param {API.FriendGroupDescription} friendGroup * @return {Promise<API.FriendGroupInfo>} */ updateFriendGroup(id: string, friendGroup: API.FriendGroupDescription): Promise<API.FriendGroupInfo>; /** * Delete the group of friends. * * @param {string} id - ID of the group of friends * @return {Promise<API.Result>} */ deleteFriendGroup(id: string): Promise<API.Result>; /** * Get the list of all friends of the node or friends belonging to a particular group. * * @param {string | null} groupId - ID of a group of friends * @return {Promise<API.FriendInfo[]>} */ getFriends(groupId?: string | null): Promise<API.FriendInfo[]>; /** * Get the friendship information for the node given. * * @param {string} name - name of the node * @return {Promise<API.FriendInfo>} */ getFriend(name: string): Promise<API.FriendInfo>; /** * 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. * * @param {API.FriendDescription[]} friends * @return {Promise<API.FriendInfo[]>} */ updateFriends(friends: API.FriendDescription[]): Promise<API.FriendInfo[]>; /** * Get the list of all nodes that added this node to their friends. * * @return {Promise<API.FriendOfInfo[]>} */ getFriendOfs(): Promise<API.FriendOfInfo[]>; /** * Get the information for the node given, whether it has added this node to its friends. * * @param {string} name - name of the node * @return {Promise<API.FriendOfInfo>} */ getFriendOf(name: string): Promise<API.FriendOfInfo>; /** * Get the list of all nodes having administrative permissions on this node. * * @return {Promise<API.GrantInfo[]>} */ getAllGrants(): Promise<API.GrantInfo[]>; /** * Get information about the administrative permissions granted to the node. * * @param {string} remoteNodeName - name of the node * @return {Promise<API.GrantInfo>} */ getGrant(remoteNodeName: string): Promise<API.GrantInfo>; /** * Grant a set of administrative permissions to the node or revoke them. * * @param {string} remoteNodeName - name of the node * @param {API.GrantChange} change * @return {Promise<API.GrantInfo>} */ grantOrRevoke(remoteNodeName: string, change: API.GrantChange): Promise<API.GrantInfo>; /** * Revoke all administrative permissions granted to the node. * * @param {string} remoteNodeName - name of the node * @return {Promise<API.Result>} */ revokeAll(remoteNodeName: string): Promise<API.Result>; /** * 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. * * @param {string} url * @return {Promise<API.LinkPreviewInfo>} */ createLinkPreview(url: string): Promise<API.LinkPreviewInfo>; /** * Upload a new private media file. The content of the file is passed in the request body. Alternatively, the file * can be uploaded using Media upload API and its ID passed in the `upload` query parameter. The second alternative * is to pass the URL of the media in the `url` query parameter, the media will be downloaded to the node. * * @param {string | null} upload - ID of the media upload to be used instead of the request body * @param {string | null} url - URL of the media to be used instead of the request body * @param {boolean | null} downsize - `true` to scale the uploaded image down to the size recommended by the node, * if possible; the default is `false` * @param {Buffer | null} body - optional * @param {string | null} contentType - optional content-type of ``body`` * @return {Promise<API.PrivateMediaFileInfo>} */ uploadPrivateMedia(body?: Buffer | null, contentType?: string | null, upload?: string | null, url?: string | null, downsize?: boolean | null): Promise<API.PrivateMediaFileInfo>; /** * Get media file content (returned in the response body). * * @param {string} id - media file ID * @param {number | null} 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 * @param {boolean | null} download - if ``true``, the node will add ``Content-Disposition: attachment`` header to * the output * @param {string | null} grant - media grant allowing access to the media file * @param {boolean | null} ignoremalware - if ``true``, the node will ignore malware detection and return the media * file; only admin may use this option * @return {Promise<Blob>} */ getPrivateMedia(id: string, width?: number | null, download?: boolean | null, grant?: string | null, ignoremalware?: boolean | null): Promise<Blob>; /** * Get media file details. * * @param {string} id - media file ID * @param {string | null} grant - media grant allowing access to the media file * @return {Promise<API.PrivateMediaFileInfo>} */ getPrivateMediaInfo(id: string, grant?: string | null): Promise<API.PrivateMediaFileInfo>; /** * Update media file details. * * @param {string} id - media file ID * @param {API.PrivateMediaFileAttributes} attributes * @return {Promise<API.PrivateMediaFileInfo>} */ updatePrivateMediaInfo(id: string, attributes: API.PrivateMediaFileAttributes): Promise<API.PrivateMediaFileInfo>; /** * Upload a new media file. The content of the file is passed in the request body * * @param {Buffer} body * @param {string} contentType - content-type of ``body`` * @return {Promise<API.PublicMediaFileInfo>} */ uploadPublicMedia(body: Buffer, contentType: string): Promise<API.PublicMediaFileInfo>; /** * Get media file content (returned in the response body). * * @param {string} id - media file ID * @param {number | null} 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 * @param {boolean | null} download - if ``true``, the node will add ``Content-Disposition: attachment`` header to * the output * @return {Promise<Blob>} */ getPublicMedia(id: string, width?: number | null, download?: boolean | null): Promise<Blob>; /** * Get media file details. * * @param {string} id - media file ID * @return {Promise<API.PublicMediaFileInfo>} */ getPublicMediaInfo(id: string): Promise<API.PublicMediaFileInfo>; /** * Create a lease for a media file stored on the node. * * @param {API.MediaLeaseAttributes} attributes * @return {Promise<API.MediaLeaseInfo>} */ createMediaLease(attributes: API.MediaLeaseAttributes): Promise<API.MediaLeaseInfo>; /** * Delete the lease. * * @param {string} id - ID of the lease * @return {Promise<API.Result>} */ deleteMediaLease(id: string): Promise<API.Result>; /** * Create a new chunked upload of a private media source file. * * @param {API.MediaUploadAttributes} attributes * @return {Promise<API.MediaUploadInfo>} */ createMediaUpload(attributes: API.MediaUploadAttributes): Promise<API.MediaUploadInfo>; /** * Get chunked upload details. * * @param {string} id - upload ID * @return {Promise<API.MediaUploadInfo>} */ getMediaUpload(id: string): Promise<API.MediaUploadInfo>; /** * Upload one chunk of a private media source file. * * @param {string} id - upload ID * @param {number} chunk - zero-based chunk number * @param {Buffer} body * @param {string} contentType - content-type of ``body`` * @return {Promise<API.MediaUploadInfo>} */ uploadMediaChunk(id: string, chunk: number, body: Buffer, contentType: string): Promise<API.MediaUploadInfo>; /** * Delete a chunked media upload and the corresponding source file. * * @param {string} id - upload ID * @return {Promise<API.Result>} */ deleteMediaUpload(id: string): Promise<API.Result>; /** * Get the name of the node. Admin user receives the current status of the latest operation with the node name. * * @return {Promise<API.NodeNameInfo>} */ getNodeName(): Promise<API.NodeNameInfo>; /** * 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. * * @param {API.NameToRegister} nameToRegister * @return {Promise<API.RegisteredNameSecret>} */ createNodeName(nameToRegister: API.NameToRegister): Promise<API.RegisteredNameSecret>; /** * 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. * * @param {API.RegisteredNameSecret} secret * @return {Promise<API.Result>} */ updateNodeName(secret: API.RegisteredNameSecret): Promise<API.Result>; /** * 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. * * @return {Promise<API.Result>} */ deleteNodeName(): Promise<API.Result>; /** * Get the updating key mnemonic stored on the node. * * @return {Promise<API.KeyMnemonic>} */ getStoredMnemonic(): Promise<API.KeyMnemonic>; /** * Store the updating key mnemonic on the node. * * @param {API.KeyMnemonic} mnemonic * @return {Promise<API.Result>} */ storeMnemonic(mnemonic: API.KeyMnemonic): Promise<API.Result>; /** * Delete the updating key mnemonic stored on the node. * * @return {Promise<API.Result>} */ deleteStoredMnemonic(): Promise<API.Result>; /** * 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. * * @param {API.NotificationPacket} packet * @return {Promise<API.Result>} */ sendNotification(packet: API.NotificationPacket): Promise<API.Result>; /** * Get general information about other nodes. * * @return {Promise<API.PeopleGeneralInfo>} */ getPeopleGeneral(): Promise<API.PeopleGeneralInfo>; /** * 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. * * @param {API.PluginDescription} plugin * @return {Promise<API.PluginInfo>} */ registerPlugin(plugin: API.PluginDescription): Promise<API.PluginInfo>; /** * Get information about all plugins registered for the node and server. * * @return {Promise<API.PluginInfo[]>} */ getPlugins(): Promise<API.PluginInfo[]>; /** * Get information about the plugin. * * @param {string} pluginName - name of the plugin * @return {Promise<API.PluginInfo>} */ getPlugin(pluginName: string): Promise<API.PluginInfo>; /** * Unregister the plugin. * * @param {string} pluginName - name of the plugin * @return {Promise<API.Result>} */ unregisterPlugin(pluginName: string): Promise<API.Result>; /** * 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. * * @param {API.PostingText} posting * @return {Promise<API.PostingInfo>} */ createPosting(posting: API.PostingText): Promise<API.PostingInfo>; /** * Get all postings coming from the given external source. * * @param {string} external - URI of the external source of the posting * @return {Promise<API.PostingInfo[]>} */ getPostingsByExternalSource(external: string): Promise<API.PostingInfo[]>; /** * Update the posting, creating a new revision of it. The text is processed just like in the ``POST`` request. * * @param {string} id - ID of the posting * @param {API.PostingText} posting * @return {Promise<API.PostingInfo>} */ updatePosting(id: string, posting: API.PostingText): Promise<API.PostingInfo>; /** * Get an individual posting. * * @param {string} id - ID of the posting * @param {boolean} withSource - include source text of the posting * @return {Promise<API.PostingInfo>} */ getPosting(id: string, withSource?: boolean): Promise<API.PostingInfo>; /** * 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. * * @param {string} id - ID of the posting * @return {Promise<API.Result>} */ deletePosting(id: string): Promise<API.Result>; /** * Get all postings linked to media attached to the given posting. * * @param {string} id - ID of the posting * @return {Promise<API.PostingInfo[]>} */ getPostingsAttachedToPosting(id: string): Promise<API.PostingInfo[]>; /** * Get all revisions of the posting, but not more than ``limit``. The node may decide to return fewer revisions * than the given ``limit``. * * @param {string} postingId - ID of the posting * @param {number | null} limit - maximum number of revisions returned * @return {Promise<API.PostingRevisionInfo[]>} */ getPostingRevisions(postingId: string, limit?: number | null): Promise<API.PostingRevisionInfo[]>; /** * Get an individual revision of the posting. * * @param {string} postingId - ID of the posting * @param {string} id - ID of the revision * @return {Promise<API.PostingRevisionInfo>} */ getPostingRevision(postingId: string, id: string): Promise<API.PostingRevisionInfo>; /** * Restore a revision of the posting. A new revision is created with the same content as in the given revision. * * @param {string} postingId - ID of the posting * @param {string} id - ID of the revision * @return {Promise<API.PostingRevisionInfo>} */ restorePostingRevision(postingId: string, id: string): Promise<API.PostingRevisionInfo>; /** * 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). * * @param {string} postingId - ID of the posting * @param {API.ReactionDescription} reaction * @return {Promise<API.ReactionCreated>} */ createPostingReaction(postingId: string, reaction: API.ReactionDescription): Promise<API.ReactionCreated>; /** * 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. * * @param {string} postingId - ID of the posting * @param {boolean | null} negative - ``true``, to filter negative reactions, ``false``, to filter positive ones * @param {number | null} emoji - filter by reaction code, usually interpreted by clients as emoji code point * @param {number | null} before - filter reactions created at or before this moment * @param {number | null} limit - maximum number of reactions returned * @return {Promise<API.ReactionsSliceInfo>} */ getPostingReactionsSlice(postingId: string, negative?: boolean | null, emoji?: number | null, before?: number | null, limit?: number | null): Promise<API.ReactionsSliceInfo>; /** * Update the reaction's operations or set operations' overrides. * * @param {string} postingId - ID of the posting * @param {string} ownerName - reaction owner node name * @param {API.ReactionOverride} reaction * @return {Promise<API.ReactionInfo>} */ updatePostingReaction(postingId: string, ownerName: string, reaction: API.ReactionOverride): Promise<API.ReactionInfo>; /** * 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. * * @param {string} postingId - ID of the posting * @param {string} ownerName - reaction owner node name * @return {Promise<API.ReactionInfo>} */ getPostingReaction(postingId: string, ownerName: string): Promise<API.ReactionInfo>; /** * Delete all reactions to the given posting. * * @param {string} postingId - ID of the posting * @return {Promise<API.Result>} */ deleteAllPostingReactions(postingId: string): Promise<API.Result>; /** * Delete the reaction of the given owner to the given posting. * * @param {string} postingId - ID of the posting * @param {string} ownerName - reaction owner node name * @return {Promise<API.ReactionTotalsInfo>} */ deletePostingReaction(postingId: string, ownerName: string): Promise<API.ReactionTotalsInfo>; /** * 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. * * @param {API.ReactionsFilter} filter * @return {Promise<API.ReactionInfo[]>} */ searchPostingReactions(filter: API.ReactionsFilter): Promise<API.ReactionInfo[]>; /** * Get a summary of reactions to the posting given. * * @param {string} postingId - ID of the posting * @return {Promise<API.ReactionTotalsInfo>} */ getPostingReactionTotals(postingId: string): Promise<API.ReactionTotalsInfo>; /** * Search summaries of reactions by criteria provided. At least one posting ID should be provided to search, * otherwise an empty list is returned. * * @param {API.ReactionTotalsFilter} filter * @return {Promise<API.ReactionTotalsInfo[]>} */ searchPostingReactionTotals(filter: API.ReactionTotalsFilter): Promise<API.ReactionTotalsInfo[]>; /** * Get the profile. * * @param {boolean} withSource - include source text of the bio * @return {Promise<API.ProfileInfo>} */ getProfile(withSource?: boolean): Promise<API.ProfileInfo>; /** * 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. * * @param {API.ProfileAttributes} profile * @return {Promise<API.ProfileInfo>} */ updateProfile(profile: API.ProfileAttributes): Promise<API.ProfileInfo>; /** * Repeat verification process (resend the confirmation mail) for the current e-mail address set in the profile. * * @return {Promise<API.Result>} *