@sublay/js 7.1.1 → 7.3.0

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.
Files changed (49) hide show
  1. package/dist/index.d.mts +426 -27
  2. package/dist/index.d.ts +3 -0
  3. package/dist/index.js +251 -16
  4. package/dist/index.mjs +251 -16
  5. package/dist/interfaces/Event.d.ts +66 -0
  6. package/dist/interfaces/SpaceReputation.d.ts +62 -0
  7. package/dist/interfaces/User.d.ts +7 -0
  8. package/dist/modules/chat/getMessage.d.ts +2 -1
  9. package/dist/modules/chat/listMembers.d.ts +2 -1
  10. package/dist/modules/chat/listMessages.d.ts +2 -1
  11. package/dist/modules/chat/listReactions.d.ts +2 -1
  12. package/dist/modules/chat/sendMessage.d.ts +2 -1
  13. package/dist/modules/comments/fetchComment.d.ts +2 -1
  14. package/dist/modules/comments/fetchManyComments.d.ts +13 -2
  15. package/dist/modules/comments/fetchReactions.d.ts +2 -1
  16. package/dist/modules/entities/fetchEntity.d.ts +2 -1
  17. package/dist/modules/entities/fetchManyEntities.d.ts +7 -2
  18. package/dist/modules/entities/fetchReactions.d.ts +2 -1
  19. package/dist/modules/events/addHost.d.ts +8 -0
  20. package/dist/modules/events/addInvite.d.ts +8 -0
  21. package/dist/modules/events/cancelEvent.d.ts +6 -0
  22. package/dist/modules/events/createEvent.d.ts +49 -0
  23. package/dist/modules/events/deleteEvent.d.ts +5 -0
  24. package/dist/modules/events/fetchEvent.d.ts +8 -0
  25. package/dist/modules/events/fetchEventRsvps.d.ts +19 -0
  26. package/dist/modules/events/fetchInvitees.d.ts +12 -0
  27. package/dist/modules/events/fetchManyEvents.d.ts +42 -0
  28. package/dist/modules/events/index.d.ts +14 -0
  29. package/dist/modules/events/removeHost.d.ts +8 -0
  30. package/dist/modules/events/removeInvite.d.ts +8 -0
  31. package/dist/modules/events/setRsvp.d.ts +7 -0
  32. package/dist/modules/events/updateEvent.d.ts +43 -0
  33. package/dist/modules/events/withdrawRsvp.d.ts +6 -0
  34. package/dist/modules/reports/fetchModeratedReports.d.ts +2 -1
  35. package/dist/modules/search/askContent.d.ts +2 -1
  36. package/dist/modules/search/searchContent.d.ts +2 -1
  37. package/dist/modules/spaces/createSpace.d.ts +14 -0
  38. package/dist/modules/spaces/fetchSpaceMembers.d.ts +2 -1
  39. package/dist/modules/spaces/fetchSpaceTeam.d.ts +2 -1
  40. package/dist/modules/spaces/updateSpace.d.ts +8 -0
  41. package/dist/modules/storage/uploadImage.d.ts +2 -1
  42. package/dist/modules/users/fetchConnectionsByUserId.d.ts +2 -1
  43. package/dist/modules/users/fetchFollowersByUserId.d.ts +2 -1
  44. package/dist/modules/users/fetchFollowingByUserId.d.ts +2 -1
  45. package/dist/modules/users/fetchUserByForeignId.d.ts +2 -1
  46. package/dist/modules/users/fetchUserById.d.ts +2 -1
  47. package/dist/modules/users/fetchUserByUsername.d.ts +2 -1
  48. package/dist/modules/users/fetchUserSuggestions.d.ts +2 -1
  49. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -667,6 +667,183 @@ async function isEntitySaved(client, data) {
667
667
  return response.data;
668
668
  }
669
669
 
670
+ // src/modules/events/index.ts
671
+ var events_exports = {};
672
+ __export(events_exports, {
673
+ addHost: () => addHost,
674
+ addInvite: () => addInvite,
675
+ cancelEvent: () => cancelEvent,
676
+ createEvent: () => createEvent,
677
+ deleteEvent: () => deleteEvent,
678
+ fetchEvent: () => fetchEvent,
679
+ fetchEventRsvps: () => fetchEventRsvps,
680
+ fetchInvitees: () => fetchInvitees,
681
+ fetchManyEvents: () => fetchManyEvents,
682
+ removeHost: () => removeHost,
683
+ removeInvite: () => removeInvite,
684
+ setRsvp: () => setRsvp,
685
+ updateEvent: () => updateEvent,
686
+ withdrawRsvp: () => withdrawRsvp
687
+ });
688
+
689
+ // src/modules/events/createEvent.ts
690
+ async function createEvent(client, data) {
691
+ const { cover, gallery, ...body } = data;
692
+ const hasCover = !!cover;
693
+ const hasGallery = !!gallery && gallery.files.length > 0;
694
+ if (hasCover || hasGallery) {
695
+ const formData = new FormData();
696
+ if (cover) {
697
+ appendFile(formData, "cover", cover.file, { fallback: "cover" });
698
+ appendField(formData, "cover.options", cover.options);
699
+ }
700
+ if (hasGallery) {
701
+ gallery.files.forEach(
702
+ (file) => appendFile(formData, "gallery", file, { fallback: "gallery" })
703
+ );
704
+ appendField(formData, "gallery.options", gallery.options);
705
+ }
706
+ appendFields(formData, body);
707
+ const response2 = await client.projectInstance.post(
708
+ "/events",
709
+ formData
710
+ );
711
+ return response2.data;
712
+ }
713
+ const response = await client.projectInstance.post("/events", body);
714
+ return response.data;
715
+ }
716
+
717
+ // src/modules/events/fetchEvent.ts
718
+ async function fetchEvent(client, data) {
719
+ const { eventId, ...params } = data;
720
+ const response = await client.projectInstance.get(
721
+ `/events/${eventId}`,
722
+ { params }
723
+ );
724
+ return response.data;
725
+ }
726
+
727
+ // src/modules/events/fetchManyEvents.ts
728
+ async function fetchManyEvents(client, data = {}) {
729
+ const response = await client.projectInstance.get(
730
+ `/events`,
731
+ { params: data }
732
+ );
733
+ return response.data;
734
+ }
735
+
736
+ // src/modules/events/updateEvent.ts
737
+ async function updateEvent(client, data) {
738
+ const { eventId, cover, gallery, ...body } = data;
739
+ const path = `/events/${eventId}`;
740
+ const hasCover = !!cover;
741
+ const hasGallery = !!gallery && gallery.files.length > 0;
742
+ if (hasCover || hasGallery) {
743
+ const formData = new FormData();
744
+ if (cover) {
745
+ appendFile(formData, "cover", cover.file, { fallback: "cover" });
746
+ appendField(formData, "cover.options", cover.options);
747
+ }
748
+ if (hasGallery) {
749
+ gallery.files.forEach(
750
+ (file) => appendFile(formData, "gallery", file, { fallback: "gallery" })
751
+ );
752
+ appendField(formData, "gallery.options", gallery.options);
753
+ }
754
+ appendFields(formData, body);
755
+ const response2 = await client.projectInstance.patch(path, formData);
756
+ return response2.data;
757
+ }
758
+ const response = await client.projectInstance.patch(path, body);
759
+ return response.data;
760
+ }
761
+
762
+ // src/modules/events/cancelEvent.ts
763
+ async function cancelEvent(client, data) {
764
+ const response = await client.projectInstance.post(
765
+ `/events/${data.eventId}/cancel`
766
+ );
767
+ return response.data;
768
+ }
769
+
770
+ // src/modules/events/deleteEvent.ts
771
+ async function deleteEvent(client, data) {
772
+ await client.projectInstance.delete(`/events/${data.eventId}`);
773
+ }
774
+
775
+ // src/modules/events/setRsvp.ts
776
+ async function setRsvp(client, data) {
777
+ const { eventId, status } = data;
778
+ const response = await client.projectInstance.post(
779
+ `/events/${eventId}/rsvp`,
780
+ { status }
781
+ );
782
+ return response.data;
783
+ }
784
+
785
+ // src/modules/events/withdrawRsvp.ts
786
+ async function withdrawRsvp(client, data) {
787
+ const response = await client.projectInstance.delete(
788
+ `/events/${data.eventId}/rsvp`
789
+ );
790
+ return response.data;
791
+ }
792
+
793
+ // src/modules/events/addHost.ts
794
+ async function addHost(client, data) {
795
+ const { eventId, userId } = data;
796
+ const response = await client.projectInstance.post(
797
+ `/events/${eventId}/hosts`,
798
+ { userId }
799
+ );
800
+ return response.data;
801
+ }
802
+
803
+ // src/modules/events/removeHost.ts
804
+ async function removeHost(client, data) {
805
+ const { eventId, userId } = data;
806
+ const response = await client.projectInstance.delete(
807
+ `/events/${eventId}/hosts`,
808
+ { data: { userId } }
809
+ );
810
+ return response.data;
811
+ }
812
+
813
+ // src/modules/events/addInvite.ts
814
+ async function addInvite(client, data) {
815
+ const { eventId, userId } = data;
816
+ const response = await client.projectInstance.post(
817
+ `/events/${eventId}/invites`,
818
+ { userId }
819
+ );
820
+ return response.data;
821
+ }
822
+
823
+ // src/modules/events/removeInvite.ts
824
+ async function removeInvite(client, data) {
825
+ const { eventId, userId } = data;
826
+ const response = await client.projectInstance.delete(
827
+ `/events/${eventId}/invites`,
828
+ { data: { userId } }
829
+ );
830
+ return response.data;
831
+ }
832
+
833
+ // src/modules/events/fetchInvitees.ts
834
+ async function fetchInvitees(client, data) {
835
+ const { eventId, ...params } = data;
836
+ const response = await client.projectInstance.get(`/events/${eventId}/invites`, { params });
837
+ return response.data;
838
+ }
839
+
840
+ // src/modules/events/fetchEventRsvps.ts
841
+ async function fetchEventRsvps(client, data) {
842
+ const { eventId, ...params } = data;
843
+ const response = await client.projectInstance.get(`/events/${eventId}/rsvps`, { params });
844
+ return response.data;
845
+ }
846
+
670
847
  // src/modules/comments/index.ts
671
848
  var comments_exports = {};
672
849
  __export(comments_exports, {
@@ -819,7 +996,25 @@ __export(spaces_exports, {
819
996
 
820
997
  // src/modules/spaces/createSpace.ts
821
998
  async function createSpace(client, data) {
822
- const response = await client.projectInstance.post("/spaces", data);
999
+ const { avatarFile, bannerFile, ...body } = data;
1000
+ if (avatarFile || bannerFile) {
1001
+ const formData = new FormData();
1002
+ if (avatarFile) {
1003
+ appendFile(formData, "avatarFile", avatarFile.file, { fallback: "avatar" });
1004
+ appendField(formData, "avatarFile.options", avatarFile.options);
1005
+ }
1006
+ if (bannerFile) {
1007
+ appendFile(formData, "bannerFile", bannerFile.file, { fallback: "banner" });
1008
+ appendField(formData, "bannerFile.options", bannerFile.options);
1009
+ }
1010
+ appendFields(formData, body);
1011
+ const response2 = await client.projectInstance.post(
1012
+ "/spaces",
1013
+ formData
1014
+ );
1015
+ return response2.data;
1016
+ }
1017
+ const response = await client.projectInstance.post("/spaces", body);
823
1018
  return response.data;
824
1019
  }
825
1020
 
@@ -888,11 +1083,23 @@ async function checkSlugAvailability(client, data) {
888
1083
 
889
1084
  // src/modules/spaces/updateSpace.ts
890
1085
  async function updateSpace(client, data) {
891
- const { spaceId, ...body } = data;
892
- const response = await client.projectInstance.patch(
893
- `/spaces/${spaceId}`,
894
- body
895
- );
1086
+ const { spaceId, avatarFile, bannerFile, ...body } = data;
1087
+ const path = `/spaces/${spaceId}`;
1088
+ if (avatarFile || bannerFile) {
1089
+ const formData = new FormData();
1090
+ if (avatarFile) {
1091
+ appendFile(formData, "avatarFile", avatarFile.file, { fallback: "avatar" });
1092
+ appendField(formData, "avatarFile.options", avatarFile.options);
1093
+ }
1094
+ if (bannerFile) {
1095
+ appendFile(formData, "bannerFile", bannerFile.file, { fallback: "banner" });
1096
+ appendField(formData, "bannerFile.options", bannerFile.options);
1097
+ }
1098
+ appendFields(formData, body);
1099
+ const response2 = await client.projectInstance.patch(path, formData);
1100
+ return response2.data;
1101
+ }
1102
+ const response = await client.projectInstance.patch(path, body);
896
1103
  return response.data;
897
1104
  }
898
1105
 
@@ -963,9 +1170,10 @@ async function fetchSpaceMembers(client, data) {
963
1170
 
964
1171
  // src/modules/spaces/fetchSpaceTeam.ts
965
1172
  async function fetchSpaceTeam(client, data) {
966
- const { spaceId } = data;
1173
+ const { spaceId, ...params } = data;
967
1174
  const response = await client.projectInstance.get(
968
- `/spaces/${spaceId}/team`
1175
+ `/spaces/${spaceId}/team`,
1176
+ { params }
969
1177
  );
970
1178
  return response.data;
971
1179
  }
@@ -1435,9 +1643,11 @@ __export(search_exports, {
1435
1643
 
1436
1644
  // src/modules/search/searchContent.ts
1437
1645
  async function searchContent(client, data) {
1646
+ const { spaceReputationId, spaceReputationDescendants, ...body } = data;
1438
1647
  const response = await client.projectInstance.post(
1439
1648
  "/search/content",
1440
- data
1649
+ body,
1650
+ { params: { spaceReputationId, spaceReputationDescendants } }
1441
1651
  );
1442
1652
  return response.data;
1443
1653
  }
@@ -1494,14 +1704,24 @@ function parseSseBlock(block) {
1494
1704
  }
1495
1705
  }
1496
1706
  async function* askContent(client, data) {
1497
- const { signal, ...body } = data;
1707
+ const { signal, spaceReputationId, spaceReputationDescendants, ...body } = data;
1498
1708
  const baseURL = client.projectInstance.defaults.baseURL ?? "";
1499
1709
  const authHeader = await client.getAuthHeader();
1500
1710
  const headers = {
1501
1711
  "Content-Type": "application/json"
1502
1712
  };
1503
1713
  if (authHeader) headers.Authorization = authHeader;
1504
- const response = await fetch(`${baseURL}/search/ask`, {
1714
+ const search = new URLSearchParams();
1715
+ if (spaceReputationId != null)
1716
+ search.set("spaceReputationId", spaceReputationId);
1717
+ if (spaceReputationDescendants != null)
1718
+ search.set(
1719
+ "spaceReputationDescendants",
1720
+ String(spaceReputationDescendants)
1721
+ );
1722
+ const queryString = search.toString();
1723
+ const url = `${baseURL}/search/ask${queryString ? `?${queryString}` : ""}`;
1724
+ const response = await fetch(url, {
1505
1725
  method: "POST",
1506
1726
  headers,
1507
1727
  body: JSON.stringify(body),
@@ -1783,8 +2003,17 @@ async function listMessages(client, data) {
1783
2003
 
1784
2004
  // src/modules/chat/sendMessage.ts
1785
2005
  async function sendMessage(client, data) {
1786
- const { conversationId, files, ...body } = data;
2006
+ const {
2007
+ conversationId,
2008
+ files,
2009
+ // The server reads these from `req.query`, not the body, so they are
2010
+ // forwarded as query params (in both the JSON and multipart branches).
2011
+ spaceReputationId,
2012
+ spaceReputationDescendants,
2013
+ ...body
2014
+ } = data;
1787
2015
  const path = `/chat/conversations/${conversationId}/messages`;
2016
+ const params = { spaceReputationId, spaceReputationDescendants };
1788
2017
  if (files && files.length > 0) {
1789
2018
  const formData = new FormData();
1790
2019
  for (const file of files) {
@@ -1793,19 +2022,23 @@ async function sendMessage(client, data) {
1793
2022
  appendFields(formData, body);
1794
2023
  const response2 = await client.projectInstance.post(
1795
2024
  path,
1796
- formData
2025
+ formData,
2026
+ { params }
1797
2027
  );
1798
2028
  return response2.data;
1799
2029
  }
1800
- const response = await client.projectInstance.post(path, body);
2030
+ const response = await client.projectInstance.post(path, body, {
2031
+ params
2032
+ });
1801
2033
  return response.data;
1802
2034
  }
1803
2035
 
1804
2036
  // src/modules/chat/getMessage.ts
1805
2037
  async function getMessage(client, data) {
1806
- const { conversationId, messageId } = data;
2038
+ const { conversationId, messageId, ...params } = data;
1807
2039
  const response = await client.projectInstance.get(
1808
- `/chat/conversations/${conversationId}/messages/${messageId}`
2040
+ `/chat/conversations/${conversationId}/messages/${messageId}`,
2041
+ { params }
1809
2042
  );
1810
2043
  return response.data;
1811
2044
  }
@@ -1964,6 +2197,7 @@ var SublayClient = class _SublayClient {
1964
2197
  auth;
1965
2198
  users;
1966
2199
  entities;
2200
+ events;
1967
2201
  comments;
1968
2202
  spaces;
1969
2203
  collections;
@@ -1980,6 +2214,7 @@ var SublayClient = class _SublayClient {
1980
2214
  this.auth = bindModule(auth_exports, this.http);
1981
2215
  this.users = bindModule(users_exports, this.http);
1982
2216
  this.entities = bindModule(entities_exports, this.http);
2217
+ this.events = bindModule(events_exports, this.http);
1983
2218
  this.comments = bindModule(comments_exports, this.http);
1984
2219
  this.spaces = bindModule(spaces_exports, this.http);
1985
2220
  this.collections = bindModule(collections_exports, this.http);
package/dist/index.mjs CHANGED
@@ -637,6 +637,183 @@ async function isEntitySaved(client, data) {
637
637
  return response.data;
638
638
  }
639
639
 
640
+ // src/modules/events/index.ts
641
+ var events_exports = {};
642
+ __export(events_exports, {
643
+ addHost: () => addHost,
644
+ addInvite: () => addInvite,
645
+ cancelEvent: () => cancelEvent,
646
+ createEvent: () => createEvent,
647
+ deleteEvent: () => deleteEvent,
648
+ fetchEvent: () => fetchEvent,
649
+ fetchEventRsvps: () => fetchEventRsvps,
650
+ fetchInvitees: () => fetchInvitees,
651
+ fetchManyEvents: () => fetchManyEvents,
652
+ removeHost: () => removeHost,
653
+ removeInvite: () => removeInvite,
654
+ setRsvp: () => setRsvp,
655
+ updateEvent: () => updateEvent,
656
+ withdrawRsvp: () => withdrawRsvp
657
+ });
658
+
659
+ // src/modules/events/createEvent.ts
660
+ async function createEvent(client, data) {
661
+ const { cover, gallery, ...body } = data;
662
+ const hasCover = !!cover;
663
+ const hasGallery = !!gallery && gallery.files.length > 0;
664
+ if (hasCover || hasGallery) {
665
+ const formData = new FormData();
666
+ if (cover) {
667
+ appendFile(formData, "cover", cover.file, { fallback: "cover" });
668
+ appendField(formData, "cover.options", cover.options);
669
+ }
670
+ if (hasGallery) {
671
+ gallery.files.forEach(
672
+ (file) => appendFile(formData, "gallery", file, { fallback: "gallery" })
673
+ );
674
+ appendField(formData, "gallery.options", gallery.options);
675
+ }
676
+ appendFields(formData, body);
677
+ const response2 = await client.projectInstance.post(
678
+ "/events",
679
+ formData
680
+ );
681
+ return response2.data;
682
+ }
683
+ const response = await client.projectInstance.post("/events", body);
684
+ return response.data;
685
+ }
686
+
687
+ // src/modules/events/fetchEvent.ts
688
+ async function fetchEvent(client, data) {
689
+ const { eventId, ...params } = data;
690
+ const response = await client.projectInstance.get(
691
+ `/events/${eventId}`,
692
+ { params }
693
+ );
694
+ return response.data;
695
+ }
696
+
697
+ // src/modules/events/fetchManyEvents.ts
698
+ async function fetchManyEvents(client, data = {}) {
699
+ const response = await client.projectInstance.get(
700
+ `/events`,
701
+ { params: data }
702
+ );
703
+ return response.data;
704
+ }
705
+
706
+ // src/modules/events/updateEvent.ts
707
+ async function updateEvent(client, data) {
708
+ const { eventId, cover, gallery, ...body } = data;
709
+ const path = `/events/${eventId}`;
710
+ const hasCover = !!cover;
711
+ const hasGallery = !!gallery && gallery.files.length > 0;
712
+ if (hasCover || hasGallery) {
713
+ const formData = new FormData();
714
+ if (cover) {
715
+ appendFile(formData, "cover", cover.file, { fallback: "cover" });
716
+ appendField(formData, "cover.options", cover.options);
717
+ }
718
+ if (hasGallery) {
719
+ gallery.files.forEach(
720
+ (file) => appendFile(formData, "gallery", file, { fallback: "gallery" })
721
+ );
722
+ appendField(formData, "gallery.options", gallery.options);
723
+ }
724
+ appendFields(formData, body);
725
+ const response2 = await client.projectInstance.patch(path, formData);
726
+ return response2.data;
727
+ }
728
+ const response = await client.projectInstance.patch(path, body);
729
+ return response.data;
730
+ }
731
+
732
+ // src/modules/events/cancelEvent.ts
733
+ async function cancelEvent(client, data) {
734
+ const response = await client.projectInstance.post(
735
+ `/events/${data.eventId}/cancel`
736
+ );
737
+ return response.data;
738
+ }
739
+
740
+ // src/modules/events/deleteEvent.ts
741
+ async function deleteEvent(client, data) {
742
+ await client.projectInstance.delete(`/events/${data.eventId}`);
743
+ }
744
+
745
+ // src/modules/events/setRsvp.ts
746
+ async function setRsvp(client, data) {
747
+ const { eventId, status } = data;
748
+ const response = await client.projectInstance.post(
749
+ `/events/${eventId}/rsvp`,
750
+ { status }
751
+ );
752
+ return response.data;
753
+ }
754
+
755
+ // src/modules/events/withdrawRsvp.ts
756
+ async function withdrawRsvp(client, data) {
757
+ const response = await client.projectInstance.delete(
758
+ `/events/${data.eventId}/rsvp`
759
+ );
760
+ return response.data;
761
+ }
762
+
763
+ // src/modules/events/addHost.ts
764
+ async function addHost(client, data) {
765
+ const { eventId, userId } = data;
766
+ const response = await client.projectInstance.post(
767
+ `/events/${eventId}/hosts`,
768
+ { userId }
769
+ );
770
+ return response.data;
771
+ }
772
+
773
+ // src/modules/events/removeHost.ts
774
+ async function removeHost(client, data) {
775
+ const { eventId, userId } = data;
776
+ const response = await client.projectInstance.delete(
777
+ `/events/${eventId}/hosts`,
778
+ { data: { userId } }
779
+ );
780
+ return response.data;
781
+ }
782
+
783
+ // src/modules/events/addInvite.ts
784
+ async function addInvite(client, data) {
785
+ const { eventId, userId } = data;
786
+ const response = await client.projectInstance.post(
787
+ `/events/${eventId}/invites`,
788
+ { userId }
789
+ );
790
+ return response.data;
791
+ }
792
+
793
+ // src/modules/events/removeInvite.ts
794
+ async function removeInvite(client, data) {
795
+ const { eventId, userId } = data;
796
+ const response = await client.projectInstance.delete(
797
+ `/events/${eventId}/invites`,
798
+ { data: { userId } }
799
+ );
800
+ return response.data;
801
+ }
802
+
803
+ // src/modules/events/fetchInvitees.ts
804
+ async function fetchInvitees(client, data) {
805
+ const { eventId, ...params } = data;
806
+ const response = await client.projectInstance.get(`/events/${eventId}/invites`, { params });
807
+ return response.data;
808
+ }
809
+
810
+ // src/modules/events/fetchEventRsvps.ts
811
+ async function fetchEventRsvps(client, data) {
812
+ const { eventId, ...params } = data;
813
+ const response = await client.projectInstance.get(`/events/${eventId}/rsvps`, { params });
814
+ return response.data;
815
+ }
816
+
640
817
  // src/modules/comments/index.ts
641
818
  var comments_exports = {};
642
819
  __export(comments_exports, {
@@ -789,7 +966,25 @@ __export(spaces_exports, {
789
966
 
790
967
  // src/modules/spaces/createSpace.ts
791
968
  async function createSpace(client, data) {
792
- const response = await client.projectInstance.post("/spaces", data);
969
+ const { avatarFile, bannerFile, ...body } = data;
970
+ if (avatarFile || bannerFile) {
971
+ const formData = new FormData();
972
+ if (avatarFile) {
973
+ appendFile(formData, "avatarFile", avatarFile.file, { fallback: "avatar" });
974
+ appendField(formData, "avatarFile.options", avatarFile.options);
975
+ }
976
+ if (bannerFile) {
977
+ appendFile(formData, "bannerFile", bannerFile.file, { fallback: "banner" });
978
+ appendField(formData, "bannerFile.options", bannerFile.options);
979
+ }
980
+ appendFields(formData, body);
981
+ const response2 = await client.projectInstance.post(
982
+ "/spaces",
983
+ formData
984
+ );
985
+ return response2.data;
986
+ }
987
+ const response = await client.projectInstance.post("/spaces", body);
793
988
  return response.data;
794
989
  }
795
990
 
@@ -858,11 +1053,23 @@ async function checkSlugAvailability(client, data) {
858
1053
 
859
1054
  // src/modules/spaces/updateSpace.ts
860
1055
  async function updateSpace(client, data) {
861
- const { spaceId, ...body } = data;
862
- const response = await client.projectInstance.patch(
863
- `/spaces/${spaceId}`,
864
- body
865
- );
1056
+ const { spaceId, avatarFile, bannerFile, ...body } = data;
1057
+ const path = `/spaces/${spaceId}`;
1058
+ if (avatarFile || bannerFile) {
1059
+ const formData = new FormData();
1060
+ if (avatarFile) {
1061
+ appendFile(formData, "avatarFile", avatarFile.file, { fallback: "avatar" });
1062
+ appendField(formData, "avatarFile.options", avatarFile.options);
1063
+ }
1064
+ if (bannerFile) {
1065
+ appendFile(formData, "bannerFile", bannerFile.file, { fallback: "banner" });
1066
+ appendField(formData, "bannerFile.options", bannerFile.options);
1067
+ }
1068
+ appendFields(formData, body);
1069
+ const response2 = await client.projectInstance.patch(path, formData);
1070
+ return response2.data;
1071
+ }
1072
+ const response = await client.projectInstance.patch(path, body);
866
1073
  return response.data;
867
1074
  }
868
1075
 
@@ -933,9 +1140,10 @@ async function fetchSpaceMembers(client, data) {
933
1140
 
934
1141
  // src/modules/spaces/fetchSpaceTeam.ts
935
1142
  async function fetchSpaceTeam(client, data) {
936
- const { spaceId } = data;
1143
+ const { spaceId, ...params } = data;
937
1144
  const response = await client.projectInstance.get(
938
- `/spaces/${spaceId}/team`
1145
+ `/spaces/${spaceId}/team`,
1146
+ { params }
939
1147
  );
940
1148
  return response.data;
941
1149
  }
@@ -1405,9 +1613,11 @@ __export(search_exports, {
1405
1613
 
1406
1614
  // src/modules/search/searchContent.ts
1407
1615
  async function searchContent(client, data) {
1616
+ const { spaceReputationId, spaceReputationDescendants, ...body } = data;
1408
1617
  const response = await client.projectInstance.post(
1409
1618
  "/search/content",
1410
- data
1619
+ body,
1620
+ { params: { spaceReputationId, spaceReputationDescendants } }
1411
1621
  );
1412
1622
  return response.data;
1413
1623
  }
@@ -1464,14 +1674,24 @@ function parseSseBlock(block) {
1464
1674
  }
1465
1675
  }
1466
1676
  async function* askContent(client, data) {
1467
- const { signal, ...body } = data;
1677
+ const { signal, spaceReputationId, spaceReputationDescendants, ...body } = data;
1468
1678
  const baseURL = client.projectInstance.defaults.baseURL ?? "";
1469
1679
  const authHeader = await client.getAuthHeader();
1470
1680
  const headers = {
1471
1681
  "Content-Type": "application/json"
1472
1682
  };
1473
1683
  if (authHeader) headers.Authorization = authHeader;
1474
- const response = await fetch(`${baseURL}/search/ask`, {
1684
+ const search = new URLSearchParams();
1685
+ if (spaceReputationId != null)
1686
+ search.set("spaceReputationId", spaceReputationId);
1687
+ if (spaceReputationDescendants != null)
1688
+ search.set(
1689
+ "spaceReputationDescendants",
1690
+ String(spaceReputationDescendants)
1691
+ );
1692
+ const queryString = search.toString();
1693
+ const url = `${baseURL}/search/ask${queryString ? `?${queryString}` : ""}`;
1694
+ const response = await fetch(url, {
1475
1695
  method: "POST",
1476
1696
  headers,
1477
1697
  body: JSON.stringify(body),
@@ -1753,8 +1973,17 @@ async function listMessages(client, data) {
1753
1973
 
1754
1974
  // src/modules/chat/sendMessage.ts
1755
1975
  async function sendMessage(client, data) {
1756
- const { conversationId, files, ...body } = data;
1976
+ const {
1977
+ conversationId,
1978
+ files,
1979
+ // The server reads these from `req.query`, not the body, so they are
1980
+ // forwarded as query params (in both the JSON and multipart branches).
1981
+ spaceReputationId,
1982
+ spaceReputationDescendants,
1983
+ ...body
1984
+ } = data;
1757
1985
  const path = `/chat/conversations/${conversationId}/messages`;
1986
+ const params = { spaceReputationId, spaceReputationDescendants };
1758
1987
  if (files && files.length > 0) {
1759
1988
  const formData = new FormData();
1760
1989
  for (const file of files) {
@@ -1763,19 +1992,23 @@ async function sendMessage(client, data) {
1763
1992
  appendFields(formData, body);
1764
1993
  const response2 = await client.projectInstance.post(
1765
1994
  path,
1766
- formData
1995
+ formData,
1996
+ { params }
1767
1997
  );
1768
1998
  return response2.data;
1769
1999
  }
1770
- const response = await client.projectInstance.post(path, body);
2000
+ const response = await client.projectInstance.post(path, body, {
2001
+ params
2002
+ });
1771
2003
  return response.data;
1772
2004
  }
1773
2005
 
1774
2006
  // src/modules/chat/getMessage.ts
1775
2007
  async function getMessage(client, data) {
1776
- const { conversationId, messageId } = data;
2008
+ const { conversationId, messageId, ...params } = data;
1777
2009
  const response = await client.projectInstance.get(
1778
- `/chat/conversations/${conversationId}/messages/${messageId}`
2010
+ `/chat/conversations/${conversationId}/messages/${messageId}`,
2011
+ { params }
1779
2012
  );
1780
2013
  return response.data;
1781
2014
  }
@@ -1934,6 +2167,7 @@ var SublayClient = class _SublayClient {
1934
2167
  auth;
1935
2168
  users;
1936
2169
  entities;
2170
+ events;
1937
2171
  comments;
1938
2172
  spaces;
1939
2173
  collections;
@@ -1950,6 +2184,7 @@ var SublayClient = class _SublayClient {
1950
2184
  this.auth = bindModule(auth_exports, this.http);
1951
2185
  this.users = bindModule(users_exports, this.http);
1952
2186
  this.entities = bindModule(entities_exports, this.http);
2187
+ this.events = bindModule(events_exports, this.http);
1953
2188
  this.comments = bindModule(comments_exports, this.http);
1954
2189
  this.spaces = bindModule(spaces_exports, this.http);
1955
2190
  this.collections = bindModule(collections_exports, this.http);