@sublay/js 7.2.0 → 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.
- package/dist/index.d.mts +332 -3
- package/dist/index.d.ts +2 -0
- package/dist/index.js +215 -6
- package/dist/index.mjs +215 -6
- package/dist/interfaces/Event.d.ts +66 -0
- package/dist/modules/comments/fetchManyComments.d.ts +11 -1
- package/dist/modules/entities/fetchManyEntities.d.ts +5 -1
- package/dist/modules/events/addHost.d.ts +8 -0
- package/dist/modules/events/addInvite.d.ts +8 -0
- package/dist/modules/events/cancelEvent.d.ts +6 -0
- package/dist/modules/events/createEvent.d.ts +49 -0
- package/dist/modules/events/deleteEvent.d.ts +5 -0
- package/dist/modules/events/fetchEvent.d.ts +8 -0
- package/dist/modules/events/fetchEventRsvps.d.ts +19 -0
- package/dist/modules/events/fetchInvitees.d.ts +12 -0
- package/dist/modules/events/fetchManyEvents.d.ts +42 -0
- package/dist/modules/events/index.d.ts +14 -0
- package/dist/modules/events/removeHost.d.ts +8 -0
- package/dist/modules/events/removeInvite.d.ts +8 -0
- package/dist/modules/events/setRsvp.d.ts +7 -0
- package/dist/modules/events/updateEvent.d.ts +43 -0
- package/dist/modules/events/withdrawRsvp.d.ts +6 -0
- package/dist/modules/spaces/createSpace.d.ts +14 -0
- package/dist/modules/spaces/updateSpace.d.ts +8 -0
- package/dist/modules/storage/uploadImage.d.ts +2 -1
- package/package.json +3 -3
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
|
|
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
|
|
863
|
-
|
|
864
|
-
|
|
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
|
|
|
@@ -1960,6 +2167,7 @@ var SublayClient = class _SublayClient {
|
|
|
1960
2167
|
auth;
|
|
1961
2168
|
users;
|
|
1962
2169
|
entities;
|
|
2170
|
+
events;
|
|
1963
2171
|
comments;
|
|
1964
2172
|
spaces;
|
|
1965
2173
|
collections;
|
|
@@ -1976,6 +2184,7 @@ var SublayClient = class _SublayClient {
|
|
|
1976
2184
|
this.auth = bindModule(auth_exports, this.http);
|
|
1977
2185
|
this.users = bindModule(users_exports, this.http);
|
|
1978
2186
|
this.entities = bindModule(entities_exports, this.http);
|
|
2187
|
+
this.events = bindModule(events_exports, this.http);
|
|
1979
2188
|
this.comments = bindModule(comments_exports, this.http);
|
|
1980
2189
|
this.spaces = bindModule(spaces_exports, this.http);
|
|
1981
2190
|
this.collections = bindModule(collections_exports, this.http);
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { User } from "./User";
|
|
2
|
+
import { Space } from "./Space";
|
|
3
|
+
import { File } from "./File";
|
|
4
|
+
export type EventType = "online" | "physical" | "hybrid";
|
|
5
|
+
export type EventVisibility = "public" | "members" | "invite";
|
|
6
|
+
export type EventStatus = "active" | "cancelled";
|
|
7
|
+
export type RsvpStatus = "going" | "maybe" | "not_going";
|
|
8
|
+
export interface RsvpCounts {
|
|
9
|
+
going: number;
|
|
10
|
+
maybe: number;
|
|
11
|
+
not_going: number;
|
|
12
|
+
}
|
|
13
|
+
export interface Event {
|
|
14
|
+
id: string;
|
|
15
|
+
shortId: string;
|
|
16
|
+
projectId: string;
|
|
17
|
+
userId: string | null;
|
|
18
|
+
user?: User | null;
|
|
19
|
+
title: string;
|
|
20
|
+
description: string | null;
|
|
21
|
+
startTime: string;
|
|
22
|
+
endTime: string | null;
|
|
23
|
+
timezone: string | null;
|
|
24
|
+
type: EventType;
|
|
25
|
+
url: string | null;
|
|
26
|
+
venueName: string | null;
|
|
27
|
+
address: string | null;
|
|
28
|
+
location: {
|
|
29
|
+
type: "Point";
|
|
30
|
+
coordinates: [number, number];
|
|
31
|
+
} | null;
|
|
32
|
+
spaceId: string | null;
|
|
33
|
+
space?: Space | null;
|
|
34
|
+
visibility: EventVisibility;
|
|
35
|
+
status: EventStatus;
|
|
36
|
+
allowMaybe: boolean;
|
|
37
|
+
guestListVisible: boolean;
|
|
38
|
+
capacity: number | null;
|
|
39
|
+
hostIds: string[];
|
|
40
|
+
coverImageId: string | null;
|
|
41
|
+
files?: File[];
|
|
42
|
+
rsvpCounts: RsvpCounts;
|
|
43
|
+
userRsvp?: RsvpStatus | null;
|
|
44
|
+
metadata: Record<string, any>;
|
|
45
|
+
createdAt: string;
|
|
46
|
+
updatedAt: string;
|
|
47
|
+
deletedAt: string | null;
|
|
48
|
+
}
|
|
49
|
+
export interface EventRsvp {
|
|
50
|
+
id: string;
|
|
51
|
+
eventId: string;
|
|
52
|
+
userId: string;
|
|
53
|
+
user?: User | null;
|
|
54
|
+
status: RsvpStatus;
|
|
55
|
+
createdAt: string;
|
|
56
|
+
updatedAt: string;
|
|
57
|
+
}
|
|
58
|
+
export interface EventInvite {
|
|
59
|
+
id: string;
|
|
60
|
+
eventId: string;
|
|
61
|
+
userId: string;
|
|
62
|
+
user?: User | null;
|
|
63
|
+
invitedAt: string;
|
|
64
|
+
createdAt: string;
|
|
65
|
+
updatedAt: string;
|
|
66
|
+
}
|
|
@@ -8,7 +8,17 @@ export interface FetchManyCommentsProps extends SpaceReputationContextParams {
|
|
|
8
8
|
parentId?: string;
|
|
9
9
|
page?: number;
|
|
10
10
|
limit?: number;
|
|
11
|
-
sortBy?: "
|
|
11
|
+
sortBy?: "createdAt" | "top" | "controversial"
|
|
12
|
+
/** @deprecated Use "createdAt" instead. "new" is a directional alias for
|
|
13
|
+
* createdAt DESC, removed in v8; the server still accepts it (identical
|
|
14
|
+
* behavior) but responds with deprecation headers. */
|
|
15
|
+
| "new"
|
|
16
|
+
/** @deprecated Use "createdAt" with sortDir:"asc" instead. "old" is a
|
|
17
|
+
* directional alias for createdAt ASC, removed in v8; the server still
|
|
18
|
+
* accepts it (identical behavior) but responds with deprecation headers. */
|
|
19
|
+
| "old";
|
|
20
|
+
/** Sort direction for `sortBy: "createdAt"`. Defaults to "desc". */
|
|
21
|
+
sortDir?: "asc" | "desc";
|
|
12
22
|
include?: string;
|
|
13
23
|
sourceId?: string;
|
|
14
24
|
}
|
|
@@ -35,7 +35,11 @@ export interface LocationFilters {
|
|
|
35
35
|
export interface FetchManyEntitiesProps extends SpaceReputationContextParams {
|
|
36
36
|
sourceId?: string;
|
|
37
37
|
spaceId?: string;
|
|
38
|
-
sortBy?: "
|
|
38
|
+
sortBy?: "createdAt" | "hot" | "top" | "controversial"
|
|
39
|
+
/** @deprecated Use "createdAt" instead. "new" is a directional alias removed
|
|
40
|
+
* in v8; the server still accepts it (identical behavior) but responds with
|
|
41
|
+
* deprecation headers. */
|
|
42
|
+
| "new" | (string & {});
|
|
39
43
|
sortDir?: "asc" | "desc";
|
|
40
44
|
sortType?: "auto" | "numeric" | "text" | "boolean" | "timestamp";
|
|
41
45
|
sortByReaction?: "upvote" | "downvote" | "like" | "love" | "wow" | "sad" | "angry" | "funny";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { SublayHttpClient } from "../../core/client";
|
|
2
|
+
import { Event } from "../../interfaces/Event";
|
|
3
|
+
export interface AddHostProps {
|
|
4
|
+
eventId: string;
|
|
5
|
+
/** The user to grant host on the event. */
|
|
6
|
+
userId: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function addHost(client: SublayHttpClient, data: AddHostProps): Promise<Event>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { SublayHttpClient } from "../../core/client";
|
|
2
|
+
import { Event } from "../../interfaces/Event";
|
|
3
|
+
export interface AddInviteProps {
|
|
4
|
+
eventId: string;
|
|
5
|
+
/** The user to invite (userId only — never a foreignId). Idempotent. */
|
|
6
|
+
userId: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function addInvite(client: SublayHttpClient, data: AddInviteProps): Promise<Event>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { SublayHttpClient } from "../../core/client";
|
|
2
|
+
import { Event, EventType, EventVisibility } from "../../interfaces/Event";
|
|
3
|
+
import { ImageOptions } from "../../interfaces/ImageProcessing";
|
|
4
|
+
/** A single cover image plus its processing options (stored as Event.coverImageId). */
|
|
5
|
+
export interface EventCoverUpload {
|
|
6
|
+
file: Blob | File;
|
|
7
|
+
/** Image-processing config (must include `mode`) — see {@link ImageOptions}. */
|
|
8
|
+
options: ImageOptions;
|
|
9
|
+
}
|
|
10
|
+
/** A gallery image set plus shared processing options (Files with eventId + position). */
|
|
11
|
+
export interface EventGalleryUpload {
|
|
12
|
+
files: (Blob | File)[];
|
|
13
|
+
/** Image-processing config applied to every gallery image — see {@link ImageOptions}. */
|
|
14
|
+
options: ImageOptions;
|
|
15
|
+
}
|
|
16
|
+
export interface CreateEventProps {
|
|
17
|
+
title: string;
|
|
18
|
+
description?: string;
|
|
19
|
+
startTime: string;
|
|
20
|
+
endTime?: string;
|
|
21
|
+
timezone?: string;
|
|
22
|
+
type: EventType;
|
|
23
|
+
url?: string;
|
|
24
|
+
venueName?: string;
|
|
25
|
+
address?: string;
|
|
26
|
+
location?: {
|
|
27
|
+
latitude: number;
|
|
28
|
+
longitude: number;
|
|
29
|
+
};
|
|
30
|
+
spaceId?: string;
|
|
31
|
+
visibility?: EventVisibility;
|
|
32
|
+
capacity?: number;
|
|
33
|
+
allowMaybe?: boolean;
|
|
34
|
+
guestListVisible?: boolean;
|
|
35
|
+
/** Additional host user IDs (the logged-in user is auto-added as a host). */
|
|
36
|
+
hostIds?: string[];
|
|
37
|
+
metadata?: Record<string, any>;
|
|
38
|
+
/**
|
|
39
|
+
* Inline cover image (single). When present the request is sent as
|
|
40
|
+
* `multipart/form-data`. Requires the `files-images` bundle.
|
|
41
|
+
*/
|
|
42
|
+
cover?: EventCoverUpload;
|
|
43
|
+
/**
|
|
44
|
+
* Inline gallery images (multi). When present the request is sent as
|
|
45
|
+
* `multipart/form-data`. Requires the `files-images` bundle.
|
|
46
|
+
*/
|
|
47
|
+
gallery?: EventGalleryUpload;
|
|
48
|
+
}
|
|
49
|
+
export declare function createEvent(client: SublayHttpClient, data: CreateEventProps): Promise<Event>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { SublayHttpClient } from "../../core/client";
|
|
2
|
+
import { Event } from "../../interfaces/Event";
|
|
3
|
+
export interface FetchEventProps {
|
|
4
|
+
eventId: string;
|
|
5
|
+
/** Comma-separated associations to expand, e.g. "user,space,files,userRsvp". */
|
|
6
|
+
include?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function fetchEvent(client: SublayHttpClient, data: FetchEventProps): Promise<Event>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { SublayHttpClient } from "../../core/client";
|
|
2
|
+
import { EventRsvp } from "../../interfaces/Event";
|
|
3
|
+
import { PaginatedResponse } from "../../interfaces/IPaginatedResponse";
|
|
4
|
+
export interface FetchEventRsvpsProps {
|
|
5
|
+
eventId: string;
|
|
6
|
+
page?: number;
|
|
7
|
+
limit?: number;
|
|
8
|
+
/**
|
|
9
|
+
* Comma-separated RSVP statuses to filter by, e.g. "going,maybe". When
|
|
10
|
+
* omitted, all statuses are returned.
|
|
11
|
+
*/
|
|
12
|
+
status?: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Named RSVP (guest) list. Visible to hosts always, or to any viewer when the
|
|
16
|
+
* event's `guestListVisible` is true; otherwise 403. RSVP counts themselves are
|
|
17
|
+
* public via the event's `rsvpCounts`.
|
|
18
|
+
*/
|
|
19
|
+
export declare function fetchEventRsvps(client: SublayHttpClient, data: FetchEventRsvpsProps): Promise<PaginatedResponse<EventRsvp>>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { SublayHttpClient } from "../../core/client";
|
|
2
|
+
import { EventInvite } from "../../interfaces/Event";
|
|
3
|
+
import { PaginatedResponse } from "../../interfaces/IPaginatedResponse";
|
|
4
|
+
export interface FetchInviteesProps {
|
|
5
|
+
eventId: string;
|
|
6
|
+
page?: number;
|
|
7
|
+
limit?: number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Host-only invitee (guest) list. Non-hosts get 403.
|
|
11
|
+
*/
|
|
12
|
+
export declare function fetchInvitees(client: SublayHttpClient, data: FetchInviteesProps): Promise<PaginatedResponse<EventInvite>>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { SublayHttpClient } from "../../core/client";
|
|
2
|
+
import { Event, EventType, EventStatus } from "../../interfaces/Event";
|
|
3
|
+
import { PaginatedResponse } from "../../interfaces/IPaginatedResponse";
|
|
4
|
+
export interface EventTextFilters {
|
|
5
|
+
hasTitle?: "true" | "false";
|
|
6
|
+
includes?: string | string[];
|
|
7
|
+
doesNotInclude?: string | string[];
|
|
8
|
+
}
|
|
9
|
+
export interface EventDescriptionFilters {
|
|
10
|
+
hasDescription?: "true" | "false";
|
|
11
|
+
includes?: string | string[];
|
|
12
|
+
doesNotInclude?: string | string[];
|
|
13
|
+
}
|
|
14
|
+
export interface EventLocationFilters {
|
|
15
|
+
latitude: string;
|
|
16
|
+
longitude: string;
|
|
17
|
+
radius: string;
|
|
18
|
+
}
|
|
19
|
+
export interface FetchManyEventsProps {
|
|
20
|
+
page?: number;
|
|
21
|
+
limit?: number;
|
|
22
|
+
sortBy?: "startTime" | "going";
|
|
23
|
+
sortDir?: "asc" | "desc";
|
|
24
|
+
timeWindow?: "upcoming" | "ongoing" | "past";
|
|
25
|
+
startsAfter?: string;
|
|
26
|
+
startsBefore?: string;
|
|
27
|
+
spaceId?: string;
|
|
28
|
+
hostId?: string;
|
|
29
|
+
type?: EventType;
|
|
30
|
+
status?: EventStatus;
|
|
31
|
+
/**
|
|
32
|
+
* Comma-separated RSVP statuses the logged-in user RSVP'd with, e.g.
|
|
33
|
+
* "going,maybe". Filters to events the caller has that RSVP on.
|
|
34
|
+
*/
|
|
35
|
+
myRsvp?: string;
|
|
36
|
+
locationFilters?: EventLocationFilters;
|
|
37
|
+
titleFilters?: EventTextFilters;
|
|
38
|
+
descriptionFilters?: EventDescriptionFilters;
|
|
39
|
+
/** Comma-separated associations to expand, e.g. "user,space,files,userRsvp". */
|
|
40
|
+
include?: string;
|
|
41
|
+
}
|
|
42
|
+
export declare function fetchManyEvents(client: SublayHttpClient, data?: FetchManyEventsProps): Promise<PaginatedResponse<Event>>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export { createEvent } from "./createEvent";
|
|
2
|
+
export { fetchEvent } from "./fetchEvent";
|
|
3
|
+
export { fetchManyEvents } from "./fetchManyEvents";
|
|
4
|
+
export { updateEvent } from "./updateEvent";
|
|
5
|
+
export { cancelEvent } from "./cancelEvent";
|
|
6
|
+
export { deleteEvent } from "./deleteEvent";
|
|
7
|
+
export { setRsvp } from "./setRsvp";
|
|
8
|
+
export { withdrawRsvp } from "./withdrawRsvp";
|
|
9
|
+
export { addHost } from "./addHost";
|
|
10
|
+
export { removeHost } from "./removeHost";
|
|
11
|
+
export { addInvite } from "./addInvite";
|
|
12
|
+
export { removeInvite } from "./removeInvite";
|
|
13
|
+
export { fetchInvitees } from "./fetchInvitees";
|
|
14
|
+
export { fetchEventRsvps } from "./fetchEventRsvps";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { SublayHttpClient } from "../../core/client";
|
|
2
|
+
import { Event } from "../../interfaces/Event";
|
|
3
|
+
export interface RemoveHostProps {
|
|
4
|
+
eventId: string;
|
|
5
|
+
/** The host to remove. Rejected if it would leave the event with no hosts. */
|
|
6
|
+
userId: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function removeHost(client: SublayHttpClient, data: RemoveHostProps): Promise<Event>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { SublayHttpClient } from "../../core/client";
|
|
2
|
+
import { Event } from "../../interfaces/Event";
|
|
3
|
+
export interface RemoveInviteProps {
|
|
4
|
+
eventId: string;
|
|
5
|
+
/** The invitee to remove. Also drops their RSVP and revokes access. */
|
|
6
|
+
userId: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function removeInvite(client: SublayHttpClient, data: RemoveInviteProps): Promise<Event>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { SublayHttpClient } from "../../core/client";
|
|
2
|
+
import { Event, RsvpStatus } from "../../interfaces/Event";
|
|
3
|
+
export interface SetRsvpProps {
|
|
4
|
+
eventId: string;
|
|
5
|
+
status: RsvpStatus;
|
|
6
|
+
}
|
|
7
|
+
export declare function setRsvp(client: SublayHttpClient, data: SetRsvpProps): Promise<Event>;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { SublayHttpClient } from "../../core/client";
|
|
2
|
+
import { Event, EventType, EventVisibility } from "../../interfaces/Event";
|
|
3
|
+
import type { EventCoverUpload, EventGalleryUpload } from "./createEvent";
|
|
4
|
+
export interface UpdateEventProps {
|
|
5
|
+
eventId: string;
|
|
6
|
+
title?: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
startTime?: string;
|
|
9
|
+
endTime?: string;
|
|
10
|
+
timezone?: string;
|
|
11
|
+
type?: EventType;
|
|
12
|
+
url?: string;
|
|
13
|
+
venueName?: string;
|
|
14
|
+
address?: string;
|
|
15
|
+
location?: {
|
|
16
|
+
latitude: number;
|
|
17
|
+
longitude: number;
|
|
18
|
+
};
|
|
19
|
+
visibility?: EventVisibility;
|
|
20
|
+
capacity?: number;
|
|
21
|
+
allowMaybe?: boolean;
|
|
22
|
+
guestListVisible?: boolean;
|
|
23
|
+
metadata?: Record<string, any>;
|
|
24
|
+
/**
|
|
25
|
+
* File IDs of existing event images to REMOVE (gallery photos and/or the
|
|
26
|
+
* current cover). Combine with `gallery` (append) + `cover` (replace) to fully
|
|
27
|
+
* curate the image set in one update. Sent in the JSON body, or — when an
|
|
28
|
+
* image file is also attached — as a JSON-string field the server parses.
|
|
29
|
+
*/
|
|
30
|
+
removeImageIds?: string[];
|
|
31
|
+
/**
|
|
32
|
+
* New cover image (single) — REPLACES the existing cover. When present the
|
|
33
|
+
* request is sent as `multipart/form-data`. Requires the `files-images` bundle.
|
|
34
|
+
*/
|
|
35
|
+
cover?: EventCoverUpload;
|
|
36
|
+
/**
|
|
37
|
+
* Gallery images (multi) — APPENDED to the event's existing images. When
|
|
38
|
+
* present the request is sent as `multipart/form-data`. Requires the
|
|
39
|
+
* `files-images` bundle.
|
|
40
|
+
*/
|
|
41
|
+
gallery?: EventGalleryUpload;
|
|
42
|
+
}
|
|
43
|
+
export declare function updateEvent(client: SublayHttpClient, data: UpdateEventProps): Promise<Event>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { SublayHttpClient } from "../../core/client";
|
|
2
|
+
import { Event } from "../../interfaces/Event";
|
|
3
|
+
export interface WithdrawRsvpProps {
|
|
4
|
+
eventId: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function withdrawRsvp(client: SublayHttpClient, data: WithdrawRsvpProps): Promise<Event>;
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { SublayHttpClient } from "../../core/client";
|
|
2
2
|
import { Space, ReadingPermission, PostingPermission } from "../../interfaces/Space";
|
|
3
|
+
import { ImageOptions } from "../../interfaces/ImageProcessing";
|
|
4
|
+
/** A file plus the image-processing options the server requires alongside it. */
|
|
5
|
+
export interface SpaceImageUpload {
|
|
6
|
+
file: Blob | File;
|
|
7
|
+
/** Image-processing config (must include `mode`) — see {@link ImageOptions}. */
|
|
8
|
+
options: ImageOptions;
|
|
9
|
+
}
|
|
3
10
|
export interface CreateSpaceProps {
|
|
4
11
|
name: string;
|
|
5
12
|
slug?: string;
|
|
@@ -9,5 +16,12 @@ export interface CreateSpaceProps {
|
|
|
9
16
|
requireJoinApproval?: boolean;
|
|
10
17
|
parentSpaceId?: string;
|
|
11
18
|
metadata?: Record<string, any>;
|
|
19
|
+
/**
|
|
20
|
+
* Avatar image. When present the request is sent as `multipart/form-data` and
|
|
21
|
+
* the server processes the image per `options`.
|
|
22
|
+
*/
|
|
23
|
+
avatarFile?: SpaceImageUpload;
|
|
24
|
+
/** Banner image; same contract as {@link CreateSpaceProps.avatarFile}. */
|
|
25
|
+
bannerFile?: SpaceImageUpload;
|
|
12
26
|
}
|
|
13
27
|
export declare function createSpace(client: SublayHttpClient, data: CreateSpaceProps): Promise<Space>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { SublayHttpClient } from "../../core/client";
|
|
2
2
|
import { Space, ReadingPermission, PostingPermission } from "../../interfaces/Space";
|
|
3
|
+
import type { SpaceImageUpload } from "./createSpace";
|
|
3
4
|
export interface UpdateSpaceProps {
|
|
4
5
|
spaceId: string;
|
|
5
6
|
name?: string;
|
|
@@ -8,5 +9,12 @@ export interface UpdateSpaceProps {
|
|
|
8
9
|
readingPermission?: ReadingPermission;
|
|
9
10
|
postingPermission?: PostingPermission;
|
|
10
11
|
metadata?: Record<string, any>;
|
|
12
|
+
/**
|
|
13
|
+
* New avatar image. When present the request is sent as `multipart/form-data`
|
|
14
|
+
* and the server processes the image per `options`, replacing the old avatar.
|
|
15
|
+
*/
|
|
16
|
+
avatarFile?: SpaceImageUpload;
|
|
17
|
+
/** New banner image; same contract as {@link UpdateSpaceProps.avatarFile}. */
|
|
18
|
+
bannerFile?: SpaceImageUpload;
|
|
11
19
|
}
|
|
12
20
|
export declare function updateSpace(client: SublayHttpClient, data: UpdateSpaceProps): Promise<Space>;
|