@amityco/ts-sdk 7.11.1-6441c7e7.0 → 7.11.1-8ca038e4.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.
@@ -21,24 +21,27 @@ declare global {
21
21
  type RawEvent = {
22
22
  eventId: string;
23
23
  userId: string;
24
+ userInternalId: string;
25
+ userPublicId: string;
24
26
  publicId: string;
27
+ coverImageFileId?: string;
25
28
  title: string;
26
29
  description: string;
27
30
  type: Amity.EventType;
28
31
  status: Amity.EventStatus;
29
- isInviteOnly: boolean;
30
32
  startTime: string;
31
33
  endTime?: string;
32
34
  coverImageUrl: string;
33
- originType: Amity.EventOriginType;
34
35
  originId: string;
35
- communityId?: string;
36
+ originType: Amity.EventOriginType;
37
+ discussionCommunityId?: string;
36
38
  livestreamId?: string;
37
39
  rsvpCount: number;
38
40
  interestedCount: number;
39
41
  isLocationVisible: boolean;
40
42
  location?: string;
41
43
  externalUrl?: string;
44
+ isOriginPublic: boolean;
42
45
  } & Amity.Taggable & Amity.Metadata & Amity.Timestamps & Amity.SoftDelete;
43
46
  type InternalEvent = RawEvent;
44
47
  type Event = Amity.InternalEvent & Amity.EventLinkObject;
@@ -47,9 +50,8 @@ declare global {
47
50
  liveStream?: Amity.Stream;
48
51
  creator?: Amity.User;
49
52
  };
50
- type EventCreateOptions = Pick<Amity.Event, 'title' | 'description' | 'type' | 'startTime' | 'endTime' | 'originType' | 'originId' | 'location' | 'externalUrl' | 'tags' | 'metadata'> & {
51
- coverImageFileId?: string;
52
- };
53
+ type EventCreateOptions = Pick<Amity.Event, 'coverImageFileId' | 'title' | 'description' | 'type' | 'startTime' | 'endTime' | 'originType' | 'originId' | 'location' | 'externalUrl' | 'tags' | 'metadata'>;
54
+ type EventUpdateOptions = Pick<Amity.Event, 'coverImageFileId' | 'title' | 'description' | 'type' | 'startTime' | 'endTime' | 'location' | 'externalUrl' | 'tags' | 'metadata'>;
53
55
  }
54
56
  }
55
57
  //# sourceMapping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ACT,YAAY,GACZ,UAAU,GACV,UAAU,GACV,aAAa,GACb,MAAM,GACN,UAAU,CACb,CAAC;QAEF,KAAK,kBAAkB,GAAG,IAAI,CAC5B,KAAK,CAAC,KAAK,EACT,kBAAkB,GAClB,OAAO,GACP,aAAa,GACb,MAAM,GACN,WAAW,GACX,SAAS,GACT,UAAU,GACV,aAAa,GACb,MAAM,GACN,UAAU,CACb,CAAC;KACH;CACF"}
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * ```js
3
- * import { createEvent } from '@amityco/ts-sdk'
4
- * const created = await createEvent(bundle)
3
+ * import { EventRepository } from '@amityco/ts-sdk'
4
+ * const response = await EventRepository.createEvent(bundle)
5
5
  * ```
6
6
  *
7
7
  * Creates an {@link Amity.Event}
@@ -1,2 +1,3 @@
1
1
  export * from './createEvent';
2
+ export * from './updateEvent';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/eventRepository/api/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/eventRepository/api/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * ```js
3
+ * import { EventRepository } from '@amityco/ts-sdk'
4
+ * const response = await EventRepository.updateEvent(eventId, bundle)
5
+ * ```
6
+ *
7
+ * Updates an {@link Amity.Event}
8
+ *
9
+ * @param eventId The ID of the {@link Amity.Event} to edit
10
+ * @param bundle The data necessary to update an existing {@link Amity.Event}
11
+ * @returns the updated {@link Amity.Event}
12
+ *
13
+ * @category Event API
14
+ * @async
15
+ */
16
+ export declare const updateEvent: (eventId: string, bundle: Amity.EventUpdateOptions) => Promise<Amity.Cached<Amity.Event>>;
17
+ //# sourceMappingURL=updateEvent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"updateEvent.d.ts","sourceRoot":"","sources":["../../../src/eventRepository/api/updateEvent.ts"],"names":[],"mappings":"AASA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,WAAW,YACb,MAAM,UACP,MAAM,kBAAkB,KAC/B,QAAQ,MAAM,MAAM,CAAC,WAAW,CAAC,CAqBnC,CAAC"}
package/dist/index.cjs.js CHANGED
@@ -30346,8 +30346,8 @@ const prepareEventPayload = (rawPayload) => {
30346
30346
  */
30347
30347
  /**
30348
30348
  * ```js
30349
- * import { createEvent } from '@amityco/ts-sdk'
30350
- * const created = await createEvent(bundle)
30349
+ * import { EventRepository } from '@amityco/ts-sdk'
30350
+ * const response = await EventRepository.createEvent(bundle)
30351
30351
  * ```
30352
30352
  *
30353
30353
  * Creates an {@link Amity.Event}
@@ -30362,11 +30362,11 @@ const createEvent = async (bundle) => {
30362
30362
  const client = getActiveClient();
30363
30363
  client.log('event/createEvent', bundle);
30364
30364
  const { data: payload } = await client.http.post('/api/v1/events', bundle);
30365
+ fireEvent('event.created', payload);
30365
30366
  const preparedPayload = prepareEventPayload(payload);
30366
30367
  const cachedAt = client.cache && Date.now();
30367
30368
  if (client.cache)
30368
30369
  ingestInCache(preparedPayload, { cachedAt });
30369
- fireEvent('event.created', preparedPayload);
30370
30370
  return {
30371
30371
  data: eventLinkedObject(preparedPayload.events[0]),
30372
30372
  cachedAt,
@@ -30374,9 +30374,44 @@ const createEvent = async (bundle) => {
30374
30374
  };
30375
30375
  /* end_public_function */
30376
30376
 
30377
+ /* begin_public_function
30378
+ id: event.update
30379
+ */
30380
+ /**
30381
+ * ```js
30382
+ * import { EventRepository } from '@amityco/ts-sdk'
30383
+ * const response = await EventRepository.updateEvent(eventId, bundle)
30384
+ * ```
30385
+ *
30386
+ * Updates an {@link Amity.Event}
30387
+ *
30388
+ * @param eventId The ID of the {@link Amity.Event} to edit
30389
+ * @param bundle The data necessary to update an existing {@link Amity.Event}
30390
+ * @returns the updated {@link Amity.Event}
30391
+ *
30392
+ * @category Event API
30393
+ * @async
30394
+ */
30395
+ const updateEvent = async (eventId, bundle) => {
30396
+ const client = getActiveClient();
30397
+ client.log('event/updateEvent', eventId, bundle);
30398
+ const { data: payload } = await client.http.put(`/api/v1/events/${eventId}`, bundle);
30399
+ fireEvent('event.updated', payload);
30400
+ const preparedPayload = prepareEventPayload(payload);
30401
+ const cachedAt = client.cache && Date.now();
30402
+ if (client.cache)
30403
+ ingestInCache(preparedPayload, { cachedAt });
30404
+ return {
30405
+ data: eventLinkedObject(preparedPayload.events.find(event => event.eventId === eventId)),
30406
+ cachedAt,
30407
+ };
30408
+ };
30409
+ /* end_public_function */
30410
+
30377
30411
  var index = /*#__PURE__*/Object.freeze({
30378
30412
  __proto__: null,
30379
- createEvent: createEvent
30413
+ createEvent: createEvent,
30414
+ updateEvent: updateEvent
30380
30415
  });
30381
30416
 
30382
30417
  exports.API_REGIONS = API_REGIONS;
package/dist/index.esm.js CHANGED
@@ -46438,8 +46438,8 @@ const prepareEventPayload = (rawPayload) => {
46438
46438
  */
46439
46439
  /**
46440
46440
  * ```js
46441
- * import { createEvent } from '@amityco/ts-sdk'
46442
- * const created = await createEvent(bundle)
46441
+ * import { EventRepository } from '@amityco/ts-sdk'
46442
+ * const response = await EventRepository.createEvent(bundle)
46443
46443
  * ```
46444
46444
  *
46445
46445
  * Creates an {@link Amity.Event}
@@ -46454,11 +46454,11 @@ const createEvent = async (bundle) => {
46454
46454
  const client = getActiveClient();
46455
46455
  client.log('event/createEvent', bundle);
46456
46456
  const { data: payload } = await client.http.post('/api/v1/events', bundle);
46457
+ fireEvent('event.created', payload);
46457
46458
  const preparedPayload = prepareEventPayload(payload);
46458
46459
  const cachedAt = client.cache && Date.now();
46459
46460
  if (client.cache)
46460
46461
  ingestInCache(preparedPayload, { cachedAt });
46461
- fireEvent('event.created', preparedPayload);
46462
46462
  return {
46463
46463
  data: eventLinkedObject(preparedPayload.events[0]),
46464
46464
  cachedAt,
@@ -46466,9 +46466,44 @@ const createEvent = async (bundle) => {
46466
46466
  };
46467
46467
  /* end_public_function */
46468
46468
 
46469
+ /* begin_public_function
46470
+ id: event.update
46471
+ */
46472
+ /**
46473
+ * ```js
46474
+ * import { EventRepository } from '@amityco/ts-sdk'
46475
+ * const response = await EventRepository.updateEvent(eventId, bundle)
46476
+ * ```
46477
+ *
46478
+ * Updates an {@link Amity.Event}
46479
+ *
46480
+ * @param eventId The ID of the {@link Amity.Event} to edit
46481
+ * @param bundle The data necessary to update an existing {@link Amity.Event}
46482
+ * @returns the updated {@link Amity.Event}
46483
+ *
46484
+ * @category Event API
46485
+ * @async
46486
+ */
46487
+ const updateEvent = async (eventId, bundle) => {
46488
+ const client = getActiveClient();
46489
+ client.log('event/updateEvent', eventId, bundle);
46490
+ const { data: payload } = await client.http.put(`/api/v1/events/${eventId}`, bundle);
46491
+ fireEvent('event.updated', payload);
46492
+ const preparedPayload = prepareEventPayload(payload);
46493
+ const cachedAt = client.cache && Date.now();
46494
+ if (client.cache)
46495
+ ingestInCache(preparedPayload, { cachedAt });
46496
+ return {
46497
+ data: eventLinkedObject(preparedPayload.events.find(event => event.eventId === eventId)),
46498
+ cachedAt,
46499
+ };
46500
+ };
46501
+ /* end_public_function */
46502
+
46469
46503
  var index = /*#__PURE__*/Object.freeze({
46470
46504
  __proto__: null,
46471
- createEvent: createEvent
46505
+ createEvent: createEvent,
46506
+ updateEvent: updateEvent
46472
46507
  });
46473
46508
 
46474
46509
  export { API_REGIONS, index$4 as AdRepository, AmityEventOriginType, AmityEventStatus, AmityEventType, index$c as CategoryRepository, index$g as ChannelRepository, index$p as Client, index$b as CommentRepository, CommunityPostSettingMaps, CommunityPostSettings, index$d as CommunityRepository, ContentFeedType, ContentFlagReasonEnum, DefaultCommunityPostSetting, index as EventRepository, FeedDataTypeEnum, index$a as FeedRepository, FeedSortByEnum, FeedSourceEnum, FileAccessTypeEnum, index$m as FileRepository, FileType, GET_WATCHER_URLS, index$2 as InvitationRepository, InvitationSortByEnum, InvitationStatusEnum, InvitationTypeEnum, JoinRequestStatusEnum, JoinResultStatusEnum, index$1 as LiveReactionRepository, index$6 as LiveStreamPlayer, MembershipAcceptanceTypeEnum, MessageContentType, index$k as MessageRepository, index$7 as PollRepository, PostContentType, index$9 as PostRepository, PostStructureType, index$l as ReactionRepository, index$5 as StoryRepository, index$8 as StreamRepository, index$j as SubChannelRepository, SubscriptionLevels, index$n as UserRepository, UserTypeEnum, VERSION, VideoResolution, VideoSize, VideoTranscodingStatus, backupCache, createQuery, createReport, createUserToken, deleteReport, disableCache, dropFromCache, enableCache, filterByChannelMembership, filterByCommunityMembership, filterByFeedType, filterByPostDataTypes, filterByPropEquality, filterByPropInclusion, filterByPropIntersection, filterBySearchTerm, filterByStringComparePartially, getChannelTopic, getCommentTopic, getCommunityStoriesTopic, getCommunityTopic, getLiveReactionTopic, getLiveStreamTopic, getMarkedMessageTopic, getMarkerUserFeedTopic, getMessageTopic, getMyFollowersTopic, getMyFollowingsTopic, getNetworkTopic, getPostTopic, getRole, getSmartFeedChannelTopic, getSmartFeedMessageTopic, getSmartFeedSubChannelTopic, getStoryTopic, getSubChannelTopic, getUserTopic, isAfterBefore, isAfterBeforeRaw, isCachable, isFetcher, isFresh, isLocal, isMutator, isOffline, isPaged, isReportedByMe, isSkip, mergeInCache, index$3 as notificationTray, onChannelMarkerFetched, onFeedMarkerFetched, onFeedMarkerUpdated, onMessageMarked, onMessageMarkerFetched, onSubChannelMarkerFetched, onSubChannelMarkerUpdated, onUserMarkerFetched, onUserMarkerFetchedLegacy, pullFromCache, pushToCache, queryCache, queryOptions, queryRoles, restoreCache, runQuery, sortByChannelSegment, sortByDisplayName, sortByFirstCreated, sortByFirstUpdated, sortByLastActivity, sortByLastCreated, sortByLastUpdated, sortByLocalSortingDate, sortByName, sortBySegmentNumber, subscribeTopic, toPage, toPageRaw, toToken, upsertInCache, wipeCache };