moeralib 0.19.2 → 0.19.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/node/node.js CHANGED
@@ -1748,7 +1748,9 @@ class MoeraNode extends caller_1.Caller {
1748
1748
  });
1749
1749
  }
1750
1750
  /**
1751
- * Update the posting, creating a new revision of it. The text is processed just like in the ``POST`` request.
1751
+ * Update the posting, creating a new revision of it. The text is processed just like in the ``POST`` request. If
1752
+ * the posting is not original (a cached copy of a remote posting), only its permissions can be changed; all other
1753
+ * fields are ignored and no new revision is created.
1752
1754
  *
1753
1755
  * @param {string} id - ID of the posting
1754
1756
  * @param {API.PostingText} posting
@@ -1794,6 +1796,21 @@ class MoeraNode extends caller_1.Caller {
1794
1796
  });
1795
1797
  });
1796
1798
  }
1799
+ /**
1800
+ * Update the posting visibility if requested and publish it in the specified feeds.
1801
+ *
1802
+ * @param {string} id - ID of the posting
1803
+ * @param {API.PostingRepublishAttributes} attributes
1804
+ * @return {Promise<API.Result>}
1805
+ */
1806
+ republishPosting(id, attributes) {
1807
+ return __awaiter(this, void 0, void 0, function* () {
1808
+ const location = (0, util_1.ut) `/postings/${id}/republish`;
1809
+ return yield this.call("republishPosting", location, {
1810
+ method: "POST", body: attributes, schema: "Result"
1811
+ });
1812
+ });
1813
+ }
1797
1814
  /**
1798
1815
  * Get all postings linked to media attached to the given posting.
1799
1816
  *
@@ -2000,6 +2017,26 @@ class MoeraNode extends caller_1.Caller {
2000
2017
  });
2001
2018
  });
2002
2019
  }
2020
+ /**
2021
+ * Get a slice of the sharings of the posting, delimited by the ``before`` moment and the given ``limit``. If
2022
+ * ``before`` is not provided, the latest sharings are returned. The node may decide to return fewer sharings than
2023
+ * the given ``limit``. The sharings are always sorted by moment, descending. The list is empty when viewing
2024
+ * sharings is not permitted. The total is zero when viewing the sharing counter is not permitted.
2025
+ *
2026
+ * @param {string} postingId - ID of the posting
2027
+ * @param {number | null} before - filter sharings created at or before this moment
2028
+ * @param {number | null} limit - maximum number of sharings returned
2029
+ * @return {Promise<API.SharingsSliceInfo>}
2030
+ */
2031
+ getPostingSharings(postingId_1) {
2032
+ return __awaiter(this, arguments, void 0, function* (postingId, before = null, limit = null) {
2033
+ const location = (0, util_1.ut) `/postings/${postingId}/sharings`;
2034
+ const params = { before, limit };
2035
+ return yield this.call("getPostingSharings", location, {
2036
+ method: "GET", params, schema: "SharingsSliceInfo"
2037
+ });
2038
+ });
2039
+ }
2003
2040
  /**
2004
2041
  * Get the profile.
2005
2042
  *
@@ -2432,6 +2469,22 @@ class MoeraNode extends caller_1.Caller {
2432
2469
  });
2433
2470
  });
2434
2471
  }
2472
+ /**
2473
+ * Download the posting from the remote node and publish it in the specified feeds.
2474
+ *
2475
+ * @param {string} remoteNodeName - name of the remote node
2476
+ * @param {string} id - ID of the posting on the remote node
2477
+ * @param {API.RemotePostingRepublishAttributes} attributes
2478
+ * @return {Promise<API.Result>}
2479
+ */
2480
+ republishRemotePosting(remoteNodeName, id, attributes) {
2481
+ return __awaiter(this, void 0, void 0, function* () {
2482
+ const location = (0, util_1.ut) `/nodes/${remoteNodeName}/postings/${id}/republish`;
2483
+ return yield this.call("republishRemotePosting", location, {
2484
+ method: "POST", body: attributes, schema: "Result"
2485
+ });
2486
+ });
2487
+ }
2435
2488
  /**
2436
2489
  * Verify the signature of the given posting.
2437
2490
  *
@@ -2795,6 +2848,21 @@ class MoeraNode extends caller_1.Caller {
2795
2848
  });
2796
2849
  });
2797
2850
  }
2851
+ /**
2852
+ * Get all stories coming from the given external source.
2853
+ *
2854
+ * @param {string} external - URI of the external source of the story
2855
+ * @return {Promise<API.StoryInfo[]>}
2856
+ */
2857
+ getStoriesByExternalSource(external) {
2858
+ return __awaiter(this, void 0, void 0, function* () {
2859
+ const location = (0, util_1.ut) `/stories`;
2860
+ const params = { external };
2861
+ return yield this.call("getStoriesByExternalSource", location, {
2862
+ method: "GET", params, schema: "StoryInfoArray", bodies: true
2863
+ });
2864
+ });
2865
+ }
2798
2866
  /**
2799
2867
  * Get an individual story.
2800
2868
  *