mezon-js 2.8.24 → 2.8.26
Sign up to get free protection for your applications and to get access to all the features.
- package/api.gen.ts +326 -81
- package/client.ts +28 -17
- package/dist/api.gen.d.ts +55 -29
- package/dist/client.d.ts +3 -2
- package/dist/mezon-js.cjs.js +234 -37
- package/dist/mezon-js.esm.mjs +234 -37
- package/dist/socket.d.ts +32 -0
- package/package.json +1 -1
- package/socket.ts +66 -0
package/dist/mezon-js.cjs.js
CHANGED
@@ -1619,6 +1619,208 @@ var MezonApi = class {
|
|
1619
1619
|
)
|
1620
1620
|
]);
|
1621
1621
|
}
|
1622
|
+
/** Add a new apps. */
|
1623
|
+
addApp(bearerToken, body, options = {}) {
|
1624
|
+
if (body === null || body === void 0) {
|
1625
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
1626
|
+
}
|
1627
|
+
const urlPath = "/v2/apps/add";
|
1628
|
+
const queryParams = /* @__PURE__ */ new Map();
|
1629
|
+
let bodyJson = "";
|
1630
|
+
bodyJson = JSON.stringify(body || {});
|
1631
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
1632
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
1633
|
+
if (bearerToken) {
|
1634
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
1635
|
+
}
|
1636
|
+
return Promise.race([
|
1637
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
1638
|
+
if (response.status == 204) {
|
1639
|
+
return response;
|
1640
|
+
} else if (response.status >= 200 && response.status < 300) {
|
1641
|
+
return response.json();
|
1642
|
+
} else {
|
1643
|
+
throw response;
|
1644
|
+
}
|
1645
|
+
}),
|
1646
|
+
new Promise(
|
1647
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
1648
|
+
)
|
1649
|
+
]);
|
1650
|
+
}
|
1651
|
+
/** List (and optionally filter) accounts. */
|
1652
|
+
listApps(bearerToken, filter, tombstones, cursor, options = {}) {
|
1653
|
+
const urlPath = "/v2/apps/app";
|
1654
|
+
const queryParams = /* @__PURE__ */ new Map();
|
1655
|
+
queryParams.set("filter", filter);
|
1656
|
+
queryParams.set("tombstones", tombstones);
|
1657
|
+
queryParams.set("cursor", cursor);
|
1658
|
+
let bodyJson = "";
|
1659
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
1660
|
+
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
1661
|
+
if (bearerToken) {
|
1662
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
1663
|
+
}
|
1664
|
+
return Promise.race([
|
1665
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
1666
|
+
if (response.status == 204) {
|
1667
|
+
return response;
|
1668
|
+
} else if (response.status >= 200 && response.status < 300) {
|
1669
|
+
return response.json();
|
1670
|
+
} else {
|
1671
|
+
throw response;
|
1672
|
+
}
|
1673
|
+
}),
|
1674
|
+
new Promise(
|
1675
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
1676
|
+
)
|
1677
|
+
]);
|
1678
|
+
}
|
1679
|
+
/** Delete all information stored for an app. */
|
1680
|
+
deleteApp(bearerToken, id, recordDeletion, options = {}) {
|
1681
|
+
if (id === null || id === void 0) {
|
1682
|
+
throw new Error("'id' is a required parameter but is null or undefined.");
|
1683
|
+
}
|
1684
|
+
const urlPath = "/v2/apps/app/{id}".replace("{id}", encodeURIComponent(String(id)));
|
1685
|
+
const queryParams = /* @__PURE__ */ new Map();
|
1686
|
+
queryParams.set("record_deletion", recordDeletion);
|
1687
|
+
let bodyJson = "";
|
1688
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
1689
|
+
const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
|
1690
|
+
if (bearerToken) {
|
1691
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
1692
|
+
}
|
1693
|
+
return Promise.race([
|
1694
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
1695
|
+
if (response.status == 204) {
|
1696
|
+
return response;
|
1697
|
+
} else if (response.status >= 200 && response.status < 300) {
|
1698
|
+
return response.json();
|
1699
|
+
} else {
|
1700
|
+
throw response;
|
1701
|
+
}
|
1702
|
+
}),
|
1703
|
+
new Promise(
|
1704
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
1705
|
+
)
|
1706
|
+
]);
|
1707
|
+
}
|
1708
|
+
/** Get detailed app information. */
|
1709
|
+
getApp(bearerToken, id, options = {}) {
|
1710
|
+
if (id === null || id === void 0) {
|
1711
|
+
throw new Error("'id' is a required parameter but is null or undefined.");
|
1712
|
+
}
|
1713
|
+
const urlPath = "/v2/apps/app/{id}".replace("{id}", encodeURIComponent(String(id)));
|
1714
|
+
const queryParams = /* @__PURE__ */ new Map();
|
1715
|
+
let bodyJson = "";
|
1716
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
1717
|
+
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
1718
|
+
if (bearerToken) {
|
1719
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
1720
|
+
}
|
1721
|
+
return Promise.race([
|
1722
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
1723
|
+
if (response.status == 204) {
|
1724
|
+
return response;
|
1725
|
+
} else if (response.status >= 200 && response.status < 300) {
|
1726
|
+
return response.json();
|
1727
|
+
} else {
|
1728
|
+
throw response;
|
1729
|
+
}
|
1730
|
+
}),
|
1731
|
+
new Promise(
|
1732
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
1733
|
+
)
|
1734
|
+
]);
|
1735
|
+
}
|
1736
|
+
/** Update one or more fields on a app. */
|
1737
|
+
updateApp(bearerToken, id, body, options = {}) {
|
1738
|
+
if (id === null || id === void 0) {
|
1739
|
+
throw new Error("'id' is a required parameter but is null or undefined.");
|
1740
|
+
}
|
1741
|
+
if (body === null || body === void 0) {
|
1742
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
1743
|
+
}
|
1744
|
+
const urlPath = "/v2/apps/app/{id}".replace("{id}", encodeURIComponent(String(id)));
|
1745
|
+
const queryParams = /* @__PURE__ */ new Map();
|
1746
|
+
let bodyJson = "";
|
1747
|
+
bodyJson = JSON.stringify(body || {});
|
1748
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
1749
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
1750
|
+
if (bearerToken) {
|
1751
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
1752
|
+
}
|
1753
|
+
return Promise.race([
|
1754
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
1755
|
+
if (response.status == 204) {
|
1756
|
+
return response;
|
1757
|
+
} else if (response.status >= 200 && response.status < 300) {
|
1758
|
+
return response.json();
|
1759
|
+
} else {
|
1760
|
+
throw response;
|
1761
|
+
}
|
1762
|
+
}),
|
1763
|
+
new Promise(
|
1764
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
1765
|
+
)
|
1766
|
+
]);
|
1767
|
+
}
|
1768
|
+
/** Ban a app. */
|
1769
|
+
banApp(bearerToken, id, options = {}) {
|
1770
|
+
if (id === null || id === void 0) {
|
1771
|
+
throw new Error("'id' is a required parameter but is null or undefined.");
|
1772
|
+
}
|
1773
|
+
const urlPath = "/v2/apps/app/{id}/ban".replace("{id}", encodeURIComponent(String(id)));
|
1774
|
+
const queryParams = /* @__PURE__ */ new Map();
|
1775
|
+
let bodyJson = "";
|
1776
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
1777
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
1778
|
+
if (bearerToken) {
|
1779
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
1780
|
+
}
|
1781
|
+
return Promise.race([
|
1782
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
1783
|
+
if (response.status == 204) {
|
1784
|
+
return response;
|
1785
|
+
} else if (response.status >= 200 && response.status < 300) {
|
1786
|
+
return response.json();
|
1787
|
+
} else {
|
1788
|
+
throw response;
|
1789
|
+
}
|
1790
|
+
}),
|
1791
|
+
new Promise(
|
1792
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
1793
|
+
)
|
1794
|
+
]);
|
1795
|
+
}
|
1796
|
+
/** Unban an app. */
|
1797
|
+
unbanApp(bearerToken, id, options = {}) {
|
1798
|
+
if (id === null || id === void 0) {
|
1799
|
+
throw new Error("'id' is a required parameter but is null or undefined.");
|
1800
|
+
}
|
1801
|
+
const urlPath = "/v2/apps/app/{id}/unban".replace("{id}", encodeURIComponent(String(id)));
|
1802
|
+
const queryParams = /* @__PURE__ */ new Map();
|
1803
|
+
let bodyJson = "";
|
1804
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
1805
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
1806
|
+
if (bearerToken) {
|
1807
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
1808
|
+
}
|
1809
|
+
return Promise.race([
|
1810
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
1811
|
+
if (response.status == 204) {
|
1812
|
+
return response;
|
1813
|
+
} else if (response.status >= 200 && response.status < 300) {
|
1814
|
+
return response.json();
|
1815
|
+
} else {
|
1816
|
+
throw response;
|
1817
|
+
}
|
1818
|
+
}),
|
1819
|
+
new Promise(
|
1820
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
1821
|
+
)
|
1822
|
+
]);
|
1823
|
+
}
|
1622
1824
|
/** */
|
1623
1825
|
listCategoryDescs(bearerToken, clanId, creatorId, categoryName, categoryId, options = {}) {
|
1624
1826
|
if (clanId === null || clanId === void 0) {
|
@@ -2878,33 +3080,6 @@ var MezonApi = class {
|
|
2878
3080
|
)
|
2879
3081
|
]);
|
2880
3082
|
}
|
2881
|
-
/** List channelvoices */
|
2882
|
-
hashtagDMVoiceList(bearerToken, userId, limit, options = {}) {
|
2883
|
-
const urlPath = "/v2/hashtagdmvoice";
|
2884
|
-
const queryParams = /* @__PURE__ */ new Map();
|
2885
|
-
queryParams.set("user_id", userId);
|
2886
|
-
queryParams.set("limit", limit);
|
2887
|
-
let bodyJson = "";
|
2888
|
-
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
2889
|
-
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
2890
|
-
if (bearerToken) {
|
2891
|
-
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
2892
|
-
}
|
2893
|
-
return Promise.race([
|
2894
|
-
fetch(fullUrl, fetchOptions).then((response) => {
|
2895
|
-
if (response.status == 204) {
|
2896
|
-
return response;
|
2897
|
-
} else if (response.status >= 200 && response.status < 300) {
|
2898
|
-
return response.json();
|
2899
|
-
} else {
|
2900
|
-
throw response;
|
2901
|
-
}
|
2902
|
-
}),
|
2903
|
-
new Promise(
|
2904
|
-
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
2905
|
-
)
|
2906
|
-
]);
|
2907
|
-
}
|
2908
3083
|
/** Add users to a channel. */
|
2909
3084
|
createLinkInviteUser(bearerToken, body, options = {}) {
|
2910
3085
|
if (body === null || body === void 0) {
|
@@ -5012,6 +5187,18 @@ var _DefaultSocket = class _DefaultSocket {
|
|
5012
5187
|
return response.emojis_listed_event;
|
5013
5188
|
});
|
5014
5189
|
}
|
5190
|
+
ListChannelByUserId() {
|
5191
|
+
return __async(this, null, function* () {
|
5192
|
+
const response = yield this.send({ channel_desc_list_event: {} });
|
5193
|
+
return response.channel_desc_list_event;
|
5194
|
+
});
|
5195
|
+
}
|
5196
|
+
hashtagDMList(user_id, limit) {
|
5197
|
+
return __async(this, null, function* () {
|
5198
|
+
const response = yield this.send({ hashtag_dm_list_event: { user_id, limit } });
|
5199
|
+
return response.hashtag_dm_list_event;
|
5200
|
+
});
|
5201
|
+
}
|
5015
5202
|
listClanStickersByClanId(clan_id) {
|
5016
5203
|
return __async(this, null, function* () {
|
5017
5204
|
const response = yield this.send({ sticker_listed_event: { clan_id } });
|
@@ -6556,16 +6743,6 @@ var Client = class {
|
|
6556
6743
|
});
|
6557
6744
|
});
|
6558
6745
|
}
|
6559
|
-
hashtagDmVoiceList(session, userId, limit) {
|
6560
|
-
return __async(this, null, function* () {
|
6561
|
-
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
6562
|
-
yield this.sessionRefresh(session);
|
6563
|
-
}
|
6564
|
-
return this.apiClient.hashtagDMVoiceList(session.token, userId, limit).then((response) => {
|
6565
|
-
return Promise.resolve(response);
|
6566
|
-
});
|
6567
|
-
});
|
6568
|
-
}
|
6569
6746
|
//** */
|
6570
6747
|
deletePinMessage(session, message_id) {
|
6571
6748
|
return __async(this, null, function* () {
|
@@ -6731,4 +6908,24 @@ var Client = class {
|
|
6731
6908
|
});
|
6732
6909
|
});
|
6733
6910
|
}
|
6911
|
+
addApp(session, request) {
|
6912
|
+
return __async(this, null, function* () {
|
6913
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
6914
|
+
yield this.sessionRefresh(session);
|
6915
|
+
}
|
6916
|
+
return this.apiClient.addApp(session.token, request).then((response) => {
|
6917
|
+
return response !== void 0;
|
6918
|
+
});
|
6919
|
+
});
|
6920
|
+
}
|
6921
|
+
ListApp(session) {
|
6922
|
+
return __async(this, null, function* () {
|
6923
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
6924
|
+
yield this.sessionRefresh(session);
|
6925
|
+
}
|
6926
|
+
return this.apiClient.listApps(session.token).then((response) => {
|
6927
|
+
return Promise.resolve(response);
|
6928
|
+
});
|
6929
|
+
});
|
6930
|
+
}
|
6734
6931
|
};
|
package/dist/mezon-js.esm.mjs
CHANGED
@@ -1590,6 +1590,208 @@ var MezonApi = class {
|
|
1590
1590
|
)
|
1591
1591
|
]);
|
1592
1592
|
}
|
1593
|
+
/** Add a new apps. */
|
1594
|
+
addApp(bearerToken, body, options = {}) {
|
1595
|
+
if (body === null || body === void 0) {
|
1596
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
1597
|
+
}
|
1598
|
+
const urlPath = "/v2/apps/add";
|
1599
|
+
const queryParams = /* @__PURE__ */ new Map();
|
1600
|
+
let bodyJson = "";
|
1601
|
+
bodyJson = JSON.stringify(body || {});
|
1602
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
1603
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
1604
|
+
if (bearerToken) {
|
1605
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
1606
|
+
}
|
1607
|
+
return Promise.race([
|
1608
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
1609
|
+
if (response.status == 204) {
|
1610
|
+
return response;
|
1611
|
+
} else if (response.status >= 200 && response.status < 300) {
|
1612
|
+
return response.json();
|
1613
|
+
} else {
|
1614
|
+
throw response;
|
1615
|
+
}
|
1616
|
+
}),
|
1617
|
+
new Promise(
|
1618
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
1619
|
+
)
|
1620
|
+
]);
|
1621
|
+
}
|
1622
|
+
/** List (and optionally filter) accounts. */
|
1623
|
+
listApps(bearerToken, filter, tombstones, cursor, options = {}) {
|
1624
|
+
const urlPath = "/v2/apps/app";
|
1625
|
+
const queryParams = /* @__PURE__ */ new Map();
|
1626
|
+
queryParams.set("filter", filter);
|
1627
|
+
queryParams.set("tombstones", tombstones);
|
1628
|
+
queryParams.set("cursor", cursor);
|
1629
|
+
let bodyJson = "";
|
1630
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
1631
|
+
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
1632
|
+
if (bearerToken) {
|
1633
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
1634
|
+
}
|
1635
|
+
return Promise.race([
|
1636
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
1637
|
+
if (response.status == 204) {
|
1638
|
+
return response;
|
1639
|
+
} else if (response.status >= 200 && response.status < 300) {
|
1640
|
+
return response.json();
|
1641
|
+
} else {
|
1642
|
+
throw response;
|
1643
|
+
}
|
1644
|
+
}),
|
1645
|
+
new Promise(
|
1646
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
1647
|
+
)
|
1648
|
+
]);
|
1649
|
+
}
|
1650
|
+
/** Delete all information stored for an app. */
|
1651
|
+
deleteApp(bearerToken, id, recordDeletion, options = {}) {
|
1652
|
+
if (id === null || id === void 0) {
|
1653
|
+
throw new Error("'id' is a required parameter but is null or undefined.");
|
1654
|
+
}
|
1655
|
+
const urlPath = "/v2/apps/app/{id}".replace("{id}", encodeURIComponent(String(id)));
|
1656
|
+
const queryParams = /* @__PURE__ */ new Map();
|
1657
|
+
queryParams.set("record_deletion", recordDeletion);
|
1658
|
+
let bodyJson = "";
|
1659
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
1660
|
+
const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
|
1661
|
+
if (bearerToken) {
|
1662
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
1663
|
+
}
|
1664
|
+
return Promise.race([
|
1665
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
1666
|
+
if (response.status == 204) {
|
1667
|
+
return response;
|
1668
|
+
} else if (response.status >= 200 && response.status < 300) {
|
1669
|
+
return response.json();
|
1670
|
+
} else {
|
1671
|
+
throw response;
|
1672
|
+
}
|
1673
|
+
}),
|
1674
|
+
new Promise(
|
1675
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
1676
|
+
)
|
1677
|
+
]);
|
1678
|
+
}
|
1679
|
+
/** Get detailed app information. */
|
1680
|
+
getApp(bearerToken, id, options = {}) {
|
1681
|
+
if (id === null || id === void 0) {
|
1682
|
+
throw new Error("'id' is a required parameter but is null or undefined.");
|
1683
|
+
}
|
1684
|
+
const urlPath = "/v2/apps/app/{id}".replace("{id}", encodeURIComponent(String(id)));
|
1685
|
+
const queryParams = /* @__PURE__ */ new Map();
|
1686
|
+
let bodyJson = "";
|
1687
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
1688
|
+
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
1689
|
+
if (bearerToken) {
|
1690
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
1691
|
+
}
|
1692
|
+
return Promise.race([
|
1693
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
1694
|
+
if (response.status == 204) {
|
1695
|
+
return response;
|
1696
|
+
} else if (response.status >= 200 && response.status < 300) {
|
1697
|
+
return response.json();
|
1698
|
+
} else {
|
1699
|
+
throw response;
|
1700
|
+
}
|
1701
|
+
}),
|
1702
|
+
new Promise(
|
1703
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
1704
|
+
)
|
1705
|
+
]);
|
1706
|
+
}
|
1707
|
+
/** Update one or more fields on a app. */
|
1708
|
+
updateApp(bearerToken, id, body, options = {}) {
|
1709
|
+
if (id === null || id === void 0) {
|
1710
|
+
throw new Error("'id' is a required parameter but is null or undefined.");
|
1711
|
+
}
|
1712
|
+
if (body === null || body === void 0) {
|
1713
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
1714
|
+
}
|
1715
|
+
const urlPath = "/v2/apps/app/{id}".replace("{id}", encodeURIComponent(String(id)));
|
1716
|
+
const queryParams = /* @__PURE__ */ new Map();
|
1717
|
+
let bodyJson = "";
|
1718
|
+
bodyJson = JSON.stringify(body || {});
|
1719
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
1720
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
1721
|
+
if (bearerToken) {
|
1722
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
1723
|
+
}
|
1724
|
+
return Promise.race([
|
1725
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
1726
|
+
if (response.status == 204) {
|
1727
|
+
return response;
|
1728
|
+
} else if (response.status >= 200 && response.status < 300) {
|
1729
|
+
return response.json();
|
1730
|
+
} else {
|
1731
|
+
throw response;
|
1732
|
+
}
|
1733
|
+
}),
|
1734
|
+
new Promise(
|
1735
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
1736
|
+
)
|
1737
|
+
]);
|
1738
|
+
}
|
1739
|
+
/** Ban a app. */
|
1740
|
+
banApp(bearerToken, id, options = {}) {
|
1741
|
+
if (id === null || id === void 0) {
|
1742
|
+
throw new Error("'id' is a required parameter but is null or undefined.");
|
1743
|
+
}
|
1744
|
+
const urlPath = "/v2/apps/app/{id}/ban".replace("{id}", encodeURIComponent(String(id)));
|
1745
|
+
const queryParams = /* @__PURE__ */ new Map();
|
1746
|
+
let bodyJson = "";
|
1747
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
1748
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
1749
|
+
if (bearerToken) {
|
1750
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
1751
|
+
}
|
1752
|
+
return Promise.race([
|
1753
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
1754
|
+
if (response.status == 204) {
|
1755
|
+
return response;
|
1756
|
+
} else if (response.status >= 200 && response.status < 300) {
|
1757
|
+
return response.json();
|
1758
|
+
} else {
|
1759
|
+
throw response;
|
1760
|
+
}
|
1761
|
+
}),
|
1762
|
+
new Promise(
|
1763
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
1764
|
+
)
|
1765
|
+
]);
|
1766
|
+
}
|
1767
|
+
/** Unban an app. */
|
1768
|
+
unbanApp(bearerToken, id, options = {}) {
|
1769
|
+
if (id === null || id === void 0) {
|
1770
|
+
throw new Error("'id' is a required parameter but is null or undefined.");
|
1771
|
+
}
|
1772
|
+
const urlPath = "/v2/apps/app/{id}/unban".replace("{id}", encodeURIComponent(String(id)));
|
1773
|
+
const queryParams = /* @__PURE__ */ new Map();
|
1774
|
+
let bodyJson = "";
|
1775
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
1776
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
1777
|
+
if (bearerToken) {
|
1778
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
1779
|
+
}
|
1780
|
+
return Promise.race([
|
1781
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
1782
|
+
if (response.status == 204) {
|
1783
|
+
return response;
|
1784
|
+
} else if (response.status >= 200 && response.status < 300) {
|
1785
|
+
return response.json();
|
1786
|
+
} else {
|
1787
|
+
throw response;
|
1788
|
+
}
|
1789
|
+
}),
|
1790
|
+
new Promise(
|
1791
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
1792
|
+
)
|
1793
|
+
]);
|
1794
|
+
}
|
1593
1795
|
/** */
|
1594
1796
|
listCategoryDescs(bearerToken, clanId, creatorId, categoryName, categoryId, options = {}) {
|
1595
1797
|
if (clanId === null || clanId === void 0) {
|
@@ -2849,33 +3051,6 @@ var MezonApi = class {
|
|
2849
3051
|
)
|
2850
3052
|
]);
|
2851
3053
|
}
|
2852
|
-
/** List channelvoices */
|
2853
|
-
hashtagDMVoiceList(bearerToken, userId, limit, options = {}) {
|
2854
|
-
const urlPath = "/v2/hashtagdmvoice";
|
2855
|
-
const queryParams = /* @__PURE__ */ new Map();
|
2856
|
-
queryParams.set("user_id", userId);
|
2857
|
-
queryParams.set("limit", limit);
|
2858
|
-
let bodyJson = "";
|
2859
|
-
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
2860
|
-
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
2861
|
-
if (bearerToken) {
|
2862
|
-
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
2863
|
-
}
|
2864
|
-
return Promise.race([
|
2865
|
-
fetch(fullUrl, fetchOptions).then((response) => {
|
2866
|
-
if (response.status == 204) {
|
2867
|
-
return response;
|
2868
|
-
} else if (response.status >= 200 && response.status < 300) {
|
2869
|
-
return response.json();
|
2870
|
-
} else {
|
2871
|
-
throw response;
|
2872
|
-
}
|
2873
|
-
}),
|
2874
|
-
new Promise(
|
2875
|
-
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
2876
|
-
)
|
2877
|
-
]);
|
2878
|
-
}
|
2879
3054
|
/** Add users to a channel. */
|
2880
3055
|
createLinkInviteUser(bearerToken, body, options = {}) {
|
2881
3056
|
if (body === null || body === void 0) {
|
@@ -4983,6 +5158,18 @@ var _DefaultSocket = class _DefaultSocket {
|
|
4983
5158
|
return response.emojis_listed_event;
|
4984
5159
|
});
|
4985
5160
|
}
|
5161
|
+
ListChannelByUserId() {
|
5162
|
+
return __async(this, null, function* () {
|
5163
|
+
const response = yield this.send({ channel_desc_list_event: {} });
|
5164
|
+
return response.channel_desc_list_event;
|
5165
|
+
});
|
5166
|
+
}
|
5167
|
+
hashtagDMList(user_id, limit) {
|
5168
|
+
return __async(this, null, function* () {
|
5169
|
+
const response = yield this.send({ hashtag_dm_list_event: { user_id, limit } });
|
5170
|
+
return response.hashtag_dm_list_event;
|
5171
|
+
});
|
5172
|
+
}
|
4986
5173
|
listClanStickersByClanId(clan_id) {
|
4987
5174
|
return __async(this, null, function* () {
|
4988
5175
|
const response = yield this.send({ sticker_listed_event: { clan_id } });
|
@@ -6527,16 +6714,6 @@ var Client = class {
|
|
6527
6714
|
});
|
6528
6715
|
});
|
6529
6716
|
}
|
6530
|
-
hashtagDmVoiceList(session, userId, limit) {
|
6531
|
-
return __async(this, null, function* () {
|
6532
|
-
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
6533
|
-
yield this.sessionRefresh(session);
|
6534
|
-
}
|
6535
|
-
return this.apiClient.hashtagDMVoiceList(session.token, userId, limit).then((response) => {
|
6536
|
-
return Promise.resolve(response);
|
6537
|
-
});
|
6538
|
-
});
|
6539
|
-
}
|
6540
6717
|
//** */
|
6541
6718
|
deletePinMessage(session, message_id) {
|
6542
6719
|
return __async(this, null, function* () {
|
@@ -6702,6 +6879,26 @@ var Client = class {
|
|
6702
6879
|
});
|
6703
6880
|
});
|
6704
6881
|
}
|
6882
|
+
addApp(session, request) {
|
6883
|
+
return __async(this, null, function* () {
|
6884
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
6885
|
+
yield this.sessionRefresh(session);
|
6886
|
+
}
|
6887
|
+
return this.apiClient.addApp(session.token, request).then((response) => {
|
6888
|
+
return response !== void 0;
|
6889
|
+
});
|
6890
|
+
});
|
6891
|
+
}
|
6892
|
+
ListApp(session) {
|
6893
|
+
return __async(this, null, function* () {
|
6894
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
6895
|
+
yield this.sessionRefresh(session);
|
6896
|
+
}
|
6897
|
+
return this.apiClient.listApps(session.token).then((response) => {
|
6898
|
+
return Promise.resolve(response);
|
6899
|
+
});
|
6900
|
+
});
|
6901
|
+
}
|
6705
6902
|
};
|
6706
6903
|
export {
|
6707
6904
|
ChannelStreamMode,
|
package/dist/socket.d.ts
CHANGED
@@ -471,6 +471,34 @@ export interface ClanEmoji {
|
|
471
471
|
shortname?: string;
|
472
472
|
src?: string;
|
473
473
|
}
|
474
|
+
/** */
|
475
|
+
export interface ChannelDescListEvent {
|
476
|
+
channeldesc?: Array<ChannelDescription>;
|
477
|
+
}
|
478
|
+
/** */
|
479
|
+
export interface ChannelDescription {
|
480
|
+
clan_id?: string;
|
481
|
+
channel_id?: string;
|
482
|
+
type?: number;
|
483
|
+
channel_label?: string;
|
484
|
+
channel_private?: number;
|
485
|
+
meeting_code?: string;
|
486
|
+
clan_name?: string;
|
487
|
+
}
|
488
|
+
export interface HashtagDmListEvent {
|
489
|
+
user_id?: Array<string>;
|
490
|
+
limit?: number;
|
491
|
+
hashtag_dm?: Array<HashtagDm>;
|
492
|
+
}
|
493
|
+
export interface HashtagDm {
|
494
|
+
channel_id?: string;
|
495
|
+
channel_label?: string;
|
496
|
+
clan_id?: string;
|
497
|
+
clan_name?: string;
|
498
|
+
meeting_code?: string;
|
499
|
+
type?: number;
|
500
|
+
channel_private?: number;
|
501
|
+
}
|
474
502
|
/** A socket connection to Mezon server. */
|
475
503
|
export interface Socket {
|
476
504
|
/** Connection is Open */
|
@@ -565,6 +593,8 @@ export interface Socket {
|
|
565
593
|
checkDuplicateClanName(clan_name: string): Promise<ClanNameExistedEvent>;
|
566
594
|
listClanEmojiByClanId(clan_id: string): Promise<EmojiListedEvent>;
|
567
595
|
listClanStickersByClanId(clan_id: string): Promise<StrickerListedEvent>;
|
596
|
+
ListChannelByUserId(): Promise<ChannelDescListEvent>;
|
597
|
+
hashtagDMList(user_id: Array<string>, limit: number): Promise<HashtagDmListEvent>;
|
568
598
|
}
|
569
599
|
/** Reports an error received from a socket message. */
|
570
600
|
export interface SocketError {
|
@@ -642,6 +672,8 @@ export declare class DefaultSocket implements Socket {
|
|
642
672
|
writeCustomStatus(clan_id: string, status: string): Promise<CustomStatusEvent>;
|
643
673
|
checkDuplicateClanName(clan_name: string): Promise<ClanNameExistedEvent>;
|
644
674
|
listClanEmojiByClanId(clan_id: string): Promise<EmojiListedEvent>;
|
675
|
+
ListChannelByUserId(): Promise<ChannelDescListEvent>;
|
676
|
+
hashtagDMList(user_id: Array<string>, limit: number): Promise<HashtagDmListEvent>;
|
645
677
|
listClanStickersByClanId(clan_id: string): Promise<StrickerListedEvent>;
|
646
678
|
private pingPong;
|
647
679
|
}
|