@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.d.mts
CHANGED
|
@@ -990,7 +990,11 @@ interface LocationFilters {
|
|
|
990
990
|
interface FetchManyEntitiesProps extends SpaceReputationContextParams {
|
|
991
991
|
sourceId?: string;
|
|
992
992
|
spaceId?: string;
|
|
993
|
-
sortBy?: "
|
|
993
|
+
sortBy?: "createdAt" | "hot" | "top" | "controversial"
|
|
994
|
+
/** @deprecated Use "createdAt" instead. "new" is a directional alias removed
|
|
995
|
+
* in v8; the server still accepts it (identical behavior) but responds with
|
|
996
|
+
* deprecation headers. */
|
|
997
|
+
| "new" | (string & {});
|
|
994
998
|
sortDir?: "asc" | "desc";
|
|
995
999
|
sortType?: "auto" | "numeric" | "text" | "boolean" | "timestamp";
|
|
996
1000
|
sortByReaction?: "upvote" | "downvote" | "like" | "love" | "wow" | "sad" | "angry" | "funny";
|
|
@@ -1111,6 +1115,299 @@ declare namespace Entities {
|
|
|
1111
1115
|
export { addReaction$1 as addReaction, Entities_createEntity as createEntity, Entities_deleteEntity as deleteEntity, Entities_fetchDrafts as fetchDrafts, Entities_fetchEntity as fetchEntity, Entities_fetchEntityByForeignId as fetchEntityByForeignId, Entities_fetchEntityByShortId as fetchEntityByShortId, Entities_fetchManyEntities as fetchManyEntities, fetchReactions$1 as fetchReactions, Entities_fetchTopComment as fetchTopComment, getUserReaction$1 as getUserReaction, Entities_isEntitySaved as isEntitySaved, Entities_publishDraft as publishDraft, removeReaction$1 as removeReaction, Entities_updateEntity as updateEntity };
|
|
1112
1116
|
}
|
|
1113
1117
|
|
|
1118
|
+
type EventType = "online" | "physical" | "hybrid";
|
|
1119
|
+
type EventVisibility = "public" | "members" | "invite";
|
|
1120
|
+
type EventStatus = "active" | "cancelled";
|
|
1121
|
+
type RsvpStatus = "going" | "maybe" | "not_going";
|
|
1122
|
+
interface RsvpCounts {
|
|
1123
|
+
going: number;
|
|
1124
|
+
maybe: number;
|
|
1125
|
+
not_going: number;
|
|
1126
|
+
}
|
|
1127
|
+
interface Event {
|
|
1128
|
+
id: string;
|
|
1129
|
+
shortId: string;
|
|
1130
|
+
projectId: string;
|
|
1131
|
+
userId: string | null;
|
|
1132
|
+
user?: User | null;
|
|
1133
|
+
title: string;
|
|
1134
|
+
description: string | null;
|
|
1135
|
+
startTime: string;
|
|
1136
|
+
endTime: string | null;
|
|
1137
|
+
timezone: string | null;
|
|
1138
|
+
type: EventType;
|
|
1139
|
+
url: string | null;
|
|
1140
|
+
venueName: string | null;
|
|
1141
|
+
address: string | null;
|
|
1142
|
+
location: {
|
|
1143
|
+
type: "Point";
|
|
1144
|
+
coordinates: [number, number];
|
|
1145
|
+
} | null;
|
|
1146
|
+
spaceId: string | null;
|
|
1147
|
+
space?: Space | null;
|
|
1148
|
+
visibility: EventVisibility;
|
|
1149
|
+
status: EventStatus;
|
|
1150
|
+
allowMaybe: boolean;
|
|
1151
|
+
guestListVisible: boolean;
|
|
1152
|
+
capacity: number | null;
|
|
1153
|
+
hostIds: string[];
|
|
1154
|
+
coverImageId: string | null;
|
|
1155
|
+
files?: File$1[];
|
|
1156
|
+
rsvpCounts: RsvpCounts;
|
|
1157
|
+
userRsvp?: RsvpStatus | null;
|
|
1158
|
+
metadata: Record<string, any>;
|
|
1159
|
+
createdAt: string;
|
|
1160
|
+
updatedAt: string;
|
|
1161
|
+
deletedAt: string | null;
|
|
1162
|
+
}
|
|
1163
|
+
interface EventRsvp {
|
|
1164
|
+
id: string;
|
|
1165
|
+
eventId: string;
|
|
1166
|
+
userId: string;
|
|
1167
|
+
user?: User | null;
|
|
1168
|
+
status: RsvpStatus;
|
|
1169
|
+
createdAt: string;
|
|
1170
|
+
updatedAt: string;
|
|
1171
|
+
}
|
|
1172
|
+
interface EventInvite {
|
|
1173
|
+
id: string;
|
|
1174
|
+
eventId: string;
|
|
1175
|
+
userId: string;
|
|
1176
|
+
user?: User | null;
|
|
1177
|
+
invitedAt: string;
|
|
1178
|
+
createdAt: string;
|
|
1179
|
+
updatedAt: string;
|
|
1180
|
+
}
|
|
1181
|
+
|
|
1182
|
+
/** A single cover image plus its processing options (stored as Event.coverImageId). */
|
|
1183
|
+
interface EventCoverUpload {
|
|
1184
|
+
file: Blob | File;
|
|
1185
|
+
/** Image-processing config (must include `mode`) — see {@link ImageOptions}. */
|
|
1186
|
+
options: ImageOptions;
|
|
1187
|
+
}
|
|
1188
|
+
/** A gallery image set plus shared processing options (Files with eventId + position). */
|
|
1189
|
+
interface EventGalleryUpload {
|
|
1190
|
+
files: (Blob | File)[];
|
|
1191
|
+
/** Image-processing config applied to every gallery image — see {@link ImageOptions}. */
|
|
1192
|
+
options: ImageOptions;
|
|
1193
|
+
}
|
|
1194
|
+
interface CreateEventProps {
|
|
1195
|
+
title: string;
|
|
1196
|
+
description?: string;
|
|
1197
|
+
startTime: string;
|
|
1198
|
+
endTime?: string;
|
|
1199
|
+
timezone?: string;
|
|
1200
|
+
type: EventType;
|
|
1201
|
+
url?: string;
|
|
1202
|
+
venueName?: string;
|
|
1203
|
+
address?: string;
|
|
1204
|
+
location?: {
|
|
1205
|
+
latitude: number;
|
|
1206
|
+
longitude: number;
|
|
1207
|
+
};
|
|
1208
|
+
spaceId?: string;
|
|
1209
|
+
visibility?: EventVisibility;
|
|
1210
|
+
capacity?: number;
|
|
1211
|
+
allowMaybe?: boolean;
|
|
1212
|
+
guestListVisible?: boolean;
|
|
1213
|
+
/** Additional host user IDs (the logged-in user is auto-added as a host). */
|
|
1214
|
+
hostIds?: string[];
|
|
1215
|
+
metadata?: Record<string, any>;
|
|
1216
|
+
/**
|
|
1217
|
+
* Inline cover image (single). When present the request is sent as
|
|
1218
|
+
* `multipart/form-data`. Requires the `files-images` bundle.
|
|
1219
|
+
*/
|
|
1220
|
+
cover?: EventCoverUpload;
|
|
1221
|
+
/**
|
|
1222
|
+
* Inline gallery images (multi). When present the request is sent as
|
|
1223
|
+
* `multipart/form-data`. Requires the `files-images` bundle.
|
|
1224
|
+
*/
|
|
1225
|
+
gallery?: EventGalleryUpload;
|
|
1226
|
+
}
|
|
1227
|
+
declare function createEvent(client: SublayHttpClient, data: CreateEventProps): Promise<Event>;
|
|
1228
|
+
|
|
1229
|
+
interface FetchEventProps {
|
|
1230
|
+
eventId: string;
|
|
1231
|
+
/** Comma-separated associations to expand, e.g. "user,space,files,userRsvp". */
|
|
1232
|
+
include?: string;
|
|
1233
|
+
}
|
|
1234
|
+
declare function fetchEvent(client: SublayHttpClient, data: FetchEventProps): Promise<Event>;
|
|
1235
|
+
|
|
1236
|
+
interface EventTextFilters {
|
|
1237
|
+
hasTitle?: "true" | "false";
|
|
1238
|
+
includes?: string | string[];
|
|
1239
|
+
doesNotInclude?: string | string[];
|
|
1240
|
+
}
|
|
1241
|
+
interface EventDescriptionFilters {
|
|
1242
|
+
hasDescription?: "true" | "false";
|
|
1243
|
+
includes?: string | string[];
|
|
1244
|
+
doesNotInclude?: string | string[];
|
|
1245
|
+
}
|
|
1246
|
+
interface EventLocationFilters {
|
|
1247
|
+
latitude: string;
|
|
1248
|
+
longitude: string;
|
|
1249
|
+
radius: string;
|
|
1250
|
+
}
|
|
1251
|
+
interface FetchManyEventsProps {
|
|
1252
|
+
page?: number;
|
|
1253
|
+
limit?: number;
|
|
1254
|
+
sortBy?: "startTime" | "going";
|
|
1255
|
+
sortDir?: "asc" | "desc";
|
|
1256
|
+
timeWindow?: "upcoming" | "ongoing" | "past";
|
|
1257
|
+
startsAfter?: string;
|
|
1258
|
+
startsBefore?: string;
|
|
1259
|
+
spaceId?: string;
|
|
1260
|
+
hostId?: string;
|
|
1261
|
+
type?: EventType;
|
|
1262
|
+
status?: EventStatus;
|
|
1263
|
+
/**
|
|
1264
|
+
* Comma-separated RSVP statuses the logged-in user RSVP'd with, e.g.
|
|
1265
|
+
* "going,maybe". Filters to events the caller has that RSVP on.
|
|
1266
|
+
*/
|
|
1267
|
+
myRsvp?: string;
|
|
1268
|
+
locationFilters?: EventLocationFilters;
|
|
1269
|
+
titleFilters?: EventTextFilters;
|
|
1270
|
+
descriptionFilters?: EventDescriptionFilters;
|
|
1271
|
+
/** Comma-separated associations to expand, e.g. "user,space,files,userRsvp". */
|
|
1272
|
+
include?: string;
|
|
1273
|
+
}
|
|
1274
|
+
declare function fetchManyEvents(client: SublayHttpClient, data?: FetchManyEventsProps): Promise<PaginatedResponse<Event>>;
|
|
1275
|
+
|
|
1276
|
+
interface UpdateEventProps {
|
|
1277
|
+
eventId: string;
|
|
1278
|
+
title?: string;
|
|
1279
|
+
description?: string;
|
|
1280
|
+
startTime?: string;
|
|
1281
|
+
endTime?: string;
|
|
1282
|
+
timezone?: string;
|
|
1283
|
+
type?: EventType;
|
|
1284
|
+
url?: string;
|
|
1285
|
+
venueName?: string;
|
|
1286
|
+
address?: string;
|
|
1287
|
+
location?: {
|
|
1288
|
+
latitude: number;
|
|
1289
|
+
longitude: number;
|
|
1290
|
+
};
|
|
1291
|
+
visibility?: EventVisibility;
|
|
1292
|
+
capacity?: number;
|
|
1293
|
+
allowMaybe?: boolean;
|
|
1294
|
+
guestListVisible?: boolean;
|
|
1295
|
+
metadata?: Record<string, any>;
|
|
1296
|
+
/**
|
|
1297
|
+
* File IDs of existing event images to REMOVE (gallery photos and/or the
|
|
1298
|
+
* current cover). Combine with `gallery` (append) + `cover` (replace) to fully
|
|
1299
|
+
* curate the image set in one update. Sent in the JSON body, or — when an
|
|
1300
|
+
* image file is also attached — as a JSON-string field the server parses.
|
|
1301
|
+
*/
|
|
1302
|
+
removeImageIds?: string[];
|
|
1303
|
+
/**
|
|
1304
|
+
* New cover image (single) — REPLACES the existing cover. When present the
|
|
1305
|
+
* request is sent as `multipart/form-data`. Requires the `files-images` bundle.
|
|
1306
|
+
*/
|
|
1307
|
+
cover?: EventCoverUpload;
|
|
1308
|
+
/**
|
|
1309
|
+
* Gallery images (multi) — APPENDED to the event's existing images. When
|
|
1310
|
+
* present the request is sent as `multipart/form-data`. Requires the
|
|
1311
|
+
* `files-images` bundle.
|
|
1312
|
+
*/
|
|
1313
|
+
gallery?: EventGalleryUpload;
|
|
1314
|
+
}
|
|
1315
|
+
declare function updateEvent(client: SublayHttpClient, data: UpdateEventProps): Promise<Event>;
|
|
1316
|
+
|
|
1317
|
+
interface CancelEventProps {
|
|
1318
|
+
eventId: string;
|
|
1319
|
+
}
|
|
1320
|
+
declare function cancelEvent(client: SublayHttpClient, data: CancelEventProps): Promise<Event>;
|
|
1321
|
+
|
|
1322
|
+
interface DeleteEventProps {
|
|
1323
|
+
eventId: string;
|
|
1324
|
+
}
|
|
1325
|
+
declare function deleteEvent(client: SublayHttpClient, data: DeleteEventProps): Promise<void>;
|
|
1326
|
+
|
|
1327
|
+
interface SetRsvpProps {
|
|
1328
|
+
eventId: string;
|
|
1329
|
+
status: RsvpStatus;
|
|
1330
|
+
}
|
|
1331
|
+
declare function setRsvp(client: SublayHttpClient, data: SetRsvpProps): Promise<Event>;
|
|
1332
|
+
|
|
1333
|
+
interface WithdrawRsvpProps {
|
|
1334
|
+
eventId: string;
|
|
1335
|
+
}
|
|
1336
|
+
declare function withdrawRsvp(client: SublayHttpClient, data: WithdrawRsvpProps): Promise<Event>;
|
|
1337
|
+
|
|
1338
|
+
interface AddHostProps {
|
|
1339
|
+
eventId: string;
|
|
1340
|
+
/** The user to grant host on the event. */
|
|
1341
|
+
userId: string;
|
|
1342
|
+
}
|
|
1343
|
+
declare function addHost(client: SublayHttpClient, data: AddHostProps): Promise<Event>;
|
|
1344
|
+
|
|
1345
|
+
interface RemoveHostProps {
|
|
1346
|
+
eventId: string;
|
|
1347
|
+
/** The host to remove. Rejected if it would leave the event with no hosts. */
|
|
1348
|
+
userId: string;
|
|
1349
|
+
}
|
|
1350
|
+
declare function removeHost(client: SublayHttpClient, data: RemoveHostProps): Promise<Event>;
|
|
1351
|
+
|
|
1352
|
+
interface AddInviteProps {
|
|
1353
|
+
eventId: string;
|
|
1354
|
+
/** The user to invite (userId only — never a foreignId). Idempotent. */
|
|
1355
|
+
userId: string;
|
|
1356
|
+
}
|
|
1357
|
+
declare function addInvite(client: SublayHttpClient, data: AddInviteProps): Promise<Event>;
|
|
1358
|
+
|
|
1359
|
+
interface RemoveInviteProps {
|
|
1360
|
+
eventId: string;
|
|
1361
|
+
/** The invitee to remove. Also drops their RSVP and revokes access. */
|
|
1362
|
+
userId: string;
|
|
1363
|
+
}
|
|
1364
|
+
declare function removeInvite(client: SublayHttpClient, data: RemoveInviteProps): Promise<Event>;
|
|
1365
|
+
|
|
1366
|
+
interface FetchInviteesProps {
|
|
1367
|
+
eventId: string;
|
|
1368
|
+
page?: number;
|
|
1369
|
+
limit?: number;
|
|
1370
|
+
}
|
|
1371
|
+
/**
|
|
1372
|
+
* Host-only invitee (guest) list. Non-hosts get 403.
|
|
1373
|
+
*/
|
|
1374
|
+
declare function fetchInvitees(client: SublayHttpClient, data: FetchInviteesProps): Promise<PaginatedResponse<EventInvite>>;
|
|
1375
|
+
|
|
1376
|
+
interface FetchEventRsvpsProps {
|
|
1377
|
+
eventId: string;
|
|
1378
|
+
page?: number;
|
|
1379
|
+
limit?: number;
|
|
1380
|
+
/**
|
|
1381
|
+
* Comma-separated RSVP statuses to filter by, e.g. "going,maybe". When
|
|
1382
|
+
* omitted, all statuses are returned.
|
|
1383
|
+
*/
|
|
1384
|
+
status?: string;
|
|
1385
|
+
}
|
|
1386
|
+
/**
|
|
1387
|
+
* Named RSVP (guest) list. Visible to hosts always, or to any viewer when the
|
|
1388
|
+
* event's `guestListVisible` is true; otherwise 403. RSVP counts themselves are
|
|
1389
|
+
* public via the event's `rsvpCounts`.
|
|
1390
|
+
*/
|
|
1391
|
+
declare function fetchEventRsvps(client: SublayHttpClient, data: FetchEventRsvpsProps): Promise<PaginatedResponse<EventRsvp>>;
|
|
1392
|
+
|
|
1393
|
+
declare const Events_addHost: typeof addHost;
|
|
1394
|
+
declare const Events_addInvite: typeof addInvite;
|
|
1395
|
+
declare const Events_cancelEvent: typeof cancelEvent;
|
|
1396
|
+
declare const Events_createEvent: typeof createEvent;
|
|
1397
|
+
declare const Events_deleteEvent: typeof deleteEvent;
|
|
1398
|
+
declare const Events_fetchEvent: typeof fetchEvent;
|
|
1399
|
+
declare const Events_fetchEventRsvps: typeof fetchEventRsvps;
|
|
1400
|
+
declare const Events_fetchInvitees: typeof fetchInvitees;
|
|
1401
|
+
declare const Events_fetchManyEvents: typeof fetchManyEvents;
|
|
1402
|
+
declare const Events_removeHost: typeof removeHost;
|
|
1403
|
+
declare const Events_removeInvite: typeof removeInvite;
|
|
1404
|
+
declare const Events_setRsvp: typeof setRsvp;
|
|
1405
|
+
declare const Events_updateEvent: typeof updateEvent;
|
|
1406
|
+
declare const Events_withdrawRsvp: typeof withdrawRsvp;
|
|
1407
|
+
declare namespace Events {
|
|
1408
|
+
export { Events_addHost as addHost, Events_addInvite as addInvite, Events_cancelEvent as cancelEvent, Events_createEvent as createEvent, Events_deleteEvent as deleteEvent, Events_fetchEvent as fetchEvent, Events_fetchEventRsvps as fetchEventRsvps, Events_fetchInvitees as fetchInvitees, Events_fetchManyEvents as fetchManyEvents, Events_removeHost as removeHost, Events_removeInvite as removeInvite, Events_setRsvp as setRsvp, Events_updateEvent as updateEvent, Events_withdrawRsvp as withdrawRsvp };
|
|
1409
|
+
}
|
|
1410
|
+
|
|
1114
1411
|
interface GifData {
|
|
1115
1412
|
id: string;
|
|
1116
1413
|
url: string;
|
|
@@ -1192,7 +1489,17 @@ interface FetchManyCommentsProps extends SpaceReputationContextParams {
|
|
|
1192
1489
|
parentId?: string;
|
|
1193
1490
|
page?: number;
|
|
1194
1491
|
limit?: number;
|
|
1195
|
-
sortBy?: "
|
|
1492
|
+
sortBy?: "createdAt" | "top" | "controversial"
|
|
1493
|
+
/** @deprecated Use "createdAt" instead. "new" is a directional alias for
|
|
1494
|
+
* createdAt DESC, removed in v8; the server still accepts it (identical
|
|
1495
|
+
* behavior) but responds with deprecation headers. */
|
|
1496
|
+
| "new"
|
|
1497
|
+
/** @deprecated Use "createdAt" with sortDir:"asc" instead. "old" is a
|
|
1498
|
+
* directional alias for createdAt ASC, removed in v8; the server still
|
|
1499
|
+
* accepts it (identical behavior) but responds with deprecation headers. */
|
|
1500
|
+
| "old";
|
|
1501
|
+
/** Sort direction for `sortBy: "createdAt"`. Defaults to "desc". */
|
|
1502
|
+
sortDir?: "asc" | "desc";
|
|
1196
1503
|
include?: string;
|
|
1197
1504
|
sourceId?: string;
|
|
1198
1505
|
}
|
|
@@ -1244,6 +1551,12 @@ declare namespace Comments {
|
|
|
1244
1551
|
export { Comments_addReaction as addReaction, Comments_createComment as createComment, Comments_deleteComment as deleteComment, Comments_fetchComment as fetchComment, Comments_fetchCommentByForeignId as fetchCommentByForeignId, Comments_fetchManyComments as fetchManyComments, Comments_fetchReactions as fetchReactions, Comments_getUserReaction as getUserReaction, Comments_removeReaction as removeReaction, Comments_updateComment as updateComment };
|
|
1245
1552
|
}
|
|
1246
1553
|
|
|
1554
|
+
/** A file plus the image-processing options the server requires alongside it. */
|
|
1555
|
+
interface SpaceImageUpload {
|
|
1556
|
+
file: Blob | File;
|
|
1557
|
+
/** Image-processing config (must include `mode`) — see {@link ImageOptions}. */
|
|
1558
|
+
options: ImageOptions;
|
|
1559
|
+
}
|
|
1247
1560
|
interface CreateSpaceProps {
|
|
1248
1561
|
name: string;
|
|
1249
1562
|
slug?: string;
|
|
@@ -1253,6 +1566,13 @@ interface CreateSpaceProps {
|
|
|
1253
1566
|
requireJoinApproval?: boolean;
|
|
1254
1567
|
parentSpaceId?: string;
|
|
1255
1568
|
metadata?: Record<string, any>;
|
|
1569
|
+
/**
|
|
1570
|
+
* Avatar image. When present the request is sent as `multipart/form-data` and
|
|
1571
|
+
* the server processes the image per `options`.
|
|
1572
|
+
*/
|
|
1573
|
+
avatarFile?: SpaceImageUpload;
|
|
1574
|
+
/** Banner image; same contract as {@link CreateSpaceProps.avatarFile}. */
|
|
1575
|
+
bannerFile?: SpaceImageUpload;
|
|
1256
1576
|
}
|
|
1257
1577
|
declare function createSpace(client: SublayHttpClient, data: CreateSpaceProps): Promise<Space>;
|
|
1258
1578
|
|
|
@@ -1320,6 +1640,13 @@ interface UpdateSpaceProps {
|
|
|
1320
1640
|
readingPermission?: ReadingPermission;
|
|
1321
1641
|
postingPermission?: PostingPermission;
|
|
1322
1642
|
metadata?: Record<string, any>;
|
|
1643
|
+
/**
|
|
1644
|
+
* New avatar image. When present the request is sent as `multipart/form-data`
|
|
1645
|
+
* and the server processes the image per `options`, replacing the old avatar.
|
|
1646
|
+
*/
|
|
1647
|
+
avatarFile?: SpaceImageUpload;
|
|
1648
|
+
/** New banner image; same contract as {@link UpdateSpaceProps.avatarFile}. */
|
|
1649
|
+
bannerFile?: SpaceImageUpload;
|
|
1323
1650
|
}
|
|
1324
1651
|
declare function updateSpace(client: SublayHttpClient, data: UpdateSpaceProps): Promise<Space>;
|
|
1325
1652
|
|
|
@@ -2324,10 +2651,11 @@ interface UploadImageProps {
|
|
|
2324
2651
|
imageOptions: ImageOptions;
|
|
2325
2652
|
/** Storage path segments, e.g. ["spaces", spaceId, "banner"]. */
|
|
2326
2653
|
pathParts?: string[];
|
|
2327
|
-
/** Only one of entityId/commentId/spaceId may be set. */
|
|
2654
|
+
/** Only one of entityId/commentId/spaceId/eventId may be set. */
|
|
2328
2655
|
entityId?: string;
|
|
2329
2656
|
commentId?: string;
|
|
2330
2657
|
spaceId?: string;
|
|
2658
|
+
eventId?: string;
|
|
2331
2659
|
}
|
|
2332
2660
|
declare function uploadImage(client: SublayHttpClient, data: UploadImageProps): Promise<UploadImageResponse>;
|
|
2333
2661
|
|
|
@@ -2818,6 +3146,7 @@ declare class SublayClient {
|
|
|
2818
3146
|
auth: BoundModule<typeof Auth>;
|
|
2819
3147
|
users: BoundModule<typeof Users>;
|
|
2820
3148
|
entities: BoundModule<typeof Entities>;
|
|
3149
|
+
events: BoundModule<typeof Events>;
|
|
2821
3150
|
comments: BoundModule<typeof Comments>;
|
|
2822
3151
|
spaces: BoundModule<typeof Spaces>;
|
|
2823
3152
|
collections: BoundModule<typeof Collections>;
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { SublayHttpClient, ClientConfig, AuthTokens } from "./core/client";
|
|
|
2
2
|
import * as Auth from "./modules/auth";
|
|
3
3
|
import * as Users from "./modules/users";
|
|
4
4
|
import * as Entities from "./modules/entities";
|
|
5
|
+
import * as Events from "./modules/events";
|
|
5
6
|
import * as Comments from "./modules/comments";
|
|
6
7
|
import * as Spaces from "./modules/spaces";
|
|
7
8
|
import * as Collections from "./modules/collections";
|
|
@@ -22,6 +23,7 @@ export declare class SublayClient {
|
|
|
22
23
|
auth: BoundModule<typeof Auth>;
|
|
23
24
|
users: BoundModule<typeof Users>;
|
|
24
25
|
entities: BoundModule<typeof Entities>;
|
|
26
|
+
events: BoundModule<typeof Events>;
|
|
25
27
|
comments: BoundModule<typeof Comments>;
|
|
26
28
|
spaces: BoundModule<typeof Spaces>;
|
|
27
29
|
collections: BoundModule<typeof Collections>;
|
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
|
|
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
|
|
893
|
-
|
|
894
|
-
|
|
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
|
|
|
@@ -1990,6 +2197,7 @@ var SublayClient = class _SublayClient {
|
|
|
1990
2197
|
auth;
|
|
1991
2198
|
users;
|
|
1992
2199
|
entities;
|
|
2200
|
+
events;
|
|
1993
2201
|
comments;
|
|
1994
2202
|
spaces;
|
|
1995
2203
|
collections;
|
|
@@ -2006,6 +2214,7 @@ var SublayClient = class _SublayClient {
|
|
|
2006
2214
|
this.auth = bindModule(auth_exports, this.http);
|
|
2007
2215
|
this.users = bindModule(users_exports, this.http);
|
|
2008
2216
|
this.entities = bindModule(entities_exports, this.http);
|
|
2217
|
+
this.events = bindModule(events_exports, this.http);
|
|
2009
2218
|
this.comments = bindModule(comments_exports, this.http);
|
|
2010
2219
|
this.spaces = bindModule(spaces_exports, this.http);
|
|
2011
2220
|
this.collections = bindModule(collections_exports, this.http);
|