@amityco/ts-sdk 7.6.1-bba8c29.0 → 7.6.1-fbc0a75.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/@types/domains/content.d.ts +8 -2
- package/dist/@types/domains/content.d.ts.map +1 -1
- package/dist/@types/domains/feed.d.ts +2 -1
- package/dist/@types/domains/feed.d.ts.map +1 -1
- package/dist/@types/domains/file.d.ts +3 -1
- package/dist/@types/domains/file.d.ts.map +1 -1
- package/dist/@types/domains/post.d.ts +3 -0
- package/dist/@types/domains/post.d.ts.map +1 -1
- package/dist/communityRepository/api/getCommunity.d.ts +1 -1
- package/dist/communityRepository/api/getCommunity.d.ts.map +1 -1
- package/dist/feedRepository/api/getCustomRankingGlobalFeed.d.ts +1 -1
- package/dist/feedRepository/api/getCustomRankingGlobalFeed.d.ts.map +1 -1
- package/dist/feedRepository/api/queryGlobalFeed.d.ts.map +1 -1
- package/dist/fileRepository/api/index.d.ts +1 -0
- package/dist/fileRepository/api/index.d.ts.map +1 -1
- package/dist/fileRepository/api/uploadClip.d.ts +17 -0
- package/dist/fileRepository/api/uploadClip.d.ts.map +1 -0
- package/dist/index.cjs.js +114 -11
- package/dist/index.esm.js +114 -11
- package/dist/index.umd.js +2 -2
- package/dist/messagePreview/utils/getSubChannelMessagePreviewWithUser.d.ts +1 -1
- package/dist/postRepository/api/createClipPost.d.ts +32 -0
- package/dist/postRepository/api/createClipPost.d.ts.map +1 -0
- package/dist/postRepository/api/index.d.ts +1 -0
- package/dist/postRepository/api/index.d.ts.map +1 -1
- package/dist/utils/linkedObject/postLinkedObject.d.ts.map +1 -1
- package/dist/utils/postTypePredicate.d.ts +1 -0
- package/dist/utils/postTypePredicate.d.ts.map +1 -1
- package/dist/utils/tests/dummy/comment.d.ts +1 -1
- package/package.json +1 -1
- package/src/@types/domains/content.ts +10 -0
- package/src/@types/domains/feed.ts +2 -1
- package/src/@types/domains/file.ts +5 -0
- package/src/@types/domains/post.ts +4 -0
- package/src/communityRepository/api/getCommunity.ts +0 -9
- package/src/feedRepository/api/getCustomRankingGlobalFeed.ts +1 -1
- package/src/feedRepository/api/queryGlobalFeed.ts +3 -1
- package/src/fileRepository/api/index.ts +1 -0
- package/src/fileRepository/api/uploadClip.ts +71 -0
- package/src/postRepository/api/createClipPost.ts +62 -0
- package/src/postRepository/api/index.ts +2 -0
- package/src/postRepository/api/queryPosts.ts +1 -1
- package/src/postRepository/observers/getPosts/PostPaginationController.ts +1 -1
- package/src/utils/linkedObject/postLinkedObject.ts +12 -1
- package/src/utils/postTypePredicate.ts +10 -0
|
@@ -19,7 +19,7 @@ export declare enum ContentFlagReasonEnum {
|
|
|
19
19
|
declare global {
|
|
20
20
|
namespace Amity {
|
|
21
21
|
type ContentFlagReason = Exclude<`${ContentFlagReasonEnum}`, `${ContentFlagReasonEnum.Others}`> | (string & {});
|
|
22
|
-
type ContentType = 'text' | 'image' | 'file' | 'video' | 'poll' | 'json' | 'liveStream' | string;
|
|
22
|
+
type ContentType = 'text' | 'image' | 'file' | 'video' | 'poll' | 'json' | 'liveStream' | 'clip' | string;
|
|
23
23
|
type ContentFeedType = ValueOf<typeof ContentFeedType>;
|
|
24
24
|
type ContentDataText = {
|
|
25
25
|
text: string;
|
|
@@ -42,13 +42,19 @@ declare global {
|
|
|
42
42
|
[K in Amity.VideoSize]?: Amity.File<'video'>['fileId'];
|
|
43
43
|
};
|
|
44
44
|
};
|
|
45
|
+
type ContentDataClip = {
|
|
46
|
+
thumbnailFileId: Amity.File<'image'>['fileId'];
|
|
47
|
+
fileId: Amity.File<'clip'>['fileId'];
|
|
48
|
+
isMuted?: boolean;
|
|
49
|
+
displayMode?: Amity.ClipDisplayMode;
|
|
50
|
+
};
|
|
45
51
|
type ContentDataPoll = {
|
|
46
52
|
pollId: Amity.Poll['pollId'];
|
|
47
53
|
};
|
|
48
54
|
type ContentDataStream = {
|
|
49
55
|
streamId: Amity.Stream['streamId'];
|
|
50
56
|
};
|
|
51
|
-
type ContentData<T extends ContentType> = T extends 'text' ? ContentDataText : T extends 'file' ? ContentDataFile : T extends 'image' ? ContentDataImage : T extends 'video' ? ContentDataVideo : T extends 'poll' ? ContentDataPoll : T extends 'liveStream' ? ContentDataStream : T extends 'json' ? Record<string, unknown> : T extends string ? string | Record<string, unknown> : never;
|
|
57
|
+
type ContentData<T extends ContentType> = T extends 'text' ? ContentDataText : T extends 'file' ? ContentDataFile : T extends 'image' ? ContentDataImage : T extends 'video' ? ContentDataVideo : T extends 'poll' ? ContentDataPoll : T extends 'liveStream' ? ContentDataStream : T extends 'clip' ? ContentDataClip : T extends 'json' ? Record<string, unknown> : T extends string ? string | Record<string, unknown> : never;
|
|
52
58
|
type Content<T extends ContentType> = {
|
|
53
59
|
dataType?: T;
|
|
54
60
|
dataTypes?: T[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content.d.ts","sourceRoot":"","sources":["../../../src/@types/domains/content.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe;;;;;;EAM1B,CAAC;AAEH,oBAAY,qBAAqB;IAC/B,mBAAmB,iCAAiC;IACpD,oBAAoB,2BAA2B;IAC/C,iBAAiB,yBAAyB;IAC1C,4BAA4B,oCAAoC;IAChE,sBAAsB,2CAA2C;IACjE,qBAAqB,6BAA6B;IAClD,WAAW,kBAAkB;IAC7B,gBAAgB,wCAAwC;IACxD,MAAM,WAAW;CAClB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,KAAK,CAAC;QACd,KAAK,iBAAiB,GAClB,OAAO,CAAC,GAAG,qBAAqB,EAAE,EAAE,GAAG,qBAAqB,CAAC,MAAM,EAAE,CAAC,GACtE,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;QAElB,KAAK,WAAW,GACZ,MAAM,GACN,OAAO,GACP,MAAM,GACN,OAAO,GACP,MAAM,GACN,MAAM,GACN,YAAY,GACZ,MAAM,CAAC;QAEX,KAAK,eAAe,GAAG,OAAO,CAAC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AmB,GAAG;YACzB,WAAW,EAAE,OAAO,CAAC;YACrB,OAAO,EAAE,OAAO,CAAC;YACjB,kBAAkB,EAAE,MAAM,CAAC;YAC3B,eAAe,EAAE;gBACf,aAAa,EAAE,KAAK,CAAC,eAAe,CAAC;gBACrC,aAAa,EAAE,KAAK,CAAC,eAAe,CAAC;aACtC,CAAC;SACH,CAAC;QAEF,KAAK,cAAc,CAAC,CAAC,SAAS,WAAW,GAAG,MAAM,GAAG,OAAO,IAAI,CAAC,SAAS,MAAM,GAC5E,kBAAkB,GAClB,CAAC,SAAS,OAAO,GACjB,mBAAmB,GACnB,KAAK,CAAC;KACX;CACF"}
|
|
@@ -9,8 +9,9 @@ declare global {
|
|
|
9
9
|
postCount: number;
|
|
10
10
|
} & Amity.Timestamps;
|
|
11
11
|
type QueryGlobalFeed = {
|
|
12
|
-
|
|
12
|
+
dataTypes?: ('video' | 'image' | 'file' | 'liveStream' | 'clip')[];
|
|
13
13
|
queryToken?: string;
|
|
14
|
+
resolveParent?: boolean;
|
|
14
15
|
};
|
|
15
16
|
}
|
|
16
17
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feed.d.ts","sourceRoot":"","sources":["../../../src/@types/domains/feed.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC;AAEV,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,KAAK,CAAC;QACd,KAAK,IAAI,GAAG;YACV,MAAM,EAAE,MAAM,CAAC;YACf,QAAQ,EAAE,WAAW,GAAG,WAAW,CAAC;YACpC,UAAU,EAAE,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAAC,CAAC;YACxD,QAAQ,EAAE,MAAM,CAAC;YACjB,SAAS,EAAE,MAAM,CAAC;SACnB,GAAG,KAAK,CAAC,UAAU,CAAC;QAErB,KAAK,eAAe,GAAG;YACrB,
|
|
1
|
+
{"version":3,"file":"feed.d.ts","sourceRoot":"","sources":["../../../src/@types/domains/feed.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC;AAEV,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,KAAK,CAAC;QACd,KAAK,IAAI,GAAG;YACV,MAAM,EAAE,MAAM,CAAC;YACf,QAAQ,EAAE,WAAW,GAAG,WAAW,CAAC;YACpC,UAAU,EAAE,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAAC,CAAC;YACxD,QAAQ,EAAE,MAAM,CAAC;YACjB,SAAS,EAAE,MAAM,CAAC;SACnB,GAAG,KAAK,CAAC,UAAU,CAAC;QAErB,KAAK,eAAe,GAAG;YACrB,SAAS,CAAC,EAAE,CAAC,OAAO,GAAG,OAAO,GAAG,MAAM,GAAG,YAAY,GAAG,MAAM,CAAC,EAAE,CAAC;YACnE,UAAU,CAAC,EAAE,MAAM,CAAC;YACpB,aAAa,CAAC,EAAE,OAAO,CAAC;SACzB,CAAC;KACH;CACF"}
|
|
@@ -2,6 +2,7 @@ export declare const FileType: Readonly<{
|
|
|
2
2
|
FILE: "file";
|
|
3
3
|
IMAGE: "image";
|
|
4
4
|
VIDEO: "video";
|
|
5
|
+
CLIP: "clip";
|
|
5
6
|
}>;
|
|
6
7
|
export declare const VideoResolution: Readonly<{
|
|
7
8
|
'1080P': "1080p";
|
|
@@ -42,7 +43,8 @@ declare global {
|
|
|
42
43
|
isFull: boolean;
|
|
43
44
|
};
|
|
44
45
|
type VideoMetadata = Record<string, never>;
|
|
45
|
-
type
|
|
46
|
+
type ClipMetadata = Record<string, never>;
|
|
47
|
+
type MetadataFor<T extends FileType> = T extends 'file' ? FileMetadata : T extends 'image' ? ImageMetadata : T extends 'video' ? VideoMetadata : T extends 'clip' ? ClipMetadata : never;
|
|
46
48
|
type File<T extends FileType = any> = Amity.FilePayload<T>;
|
|
47
49
|
}
|
|
48
50
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../../../src/@types/domains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AAM,GACnD,YAAY,GACZ,CAAC,SAAS,OAAO,GACjB,aAAa,GACb,CAAC,SAAS,OAAO,GACjB,aAAa,GACb,CAAC,SAAS,MAAM,GAChB,YAAY,GACZ,KAAK,CAAC;QAEV,KAAK,IAAI,CAAC,CAAC,SAAS,QAAQ,GAAG,GAAG,IAAI,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;KAC5D;CACF"}
|
|
@@ -5,6 +5,7 @@ export declare const PostContentType: Readonly<{
|
|
|
5
5
|
VIDEO: "video";
|
|
6
6
|
LIVESTREAM: "liveStream";
|
|
7
7
|
POLL: "poll";
|
|
8
|
+
CLIP: "clip";
|
|
8
9
|
}>;
|
|
9
10
|
declare global {
|
|
10
11
|
namespace Amity {
|
|
@@ -56,8 +57,10 @@ declare global {
|
|
|
56
57
|
getVideoInfo: () => Amity.File<'video'> | undefined;
|
|
57
58
|
getVideoThumbnailInfo: () => Amity.File<'image'> | undefined;
|
|
58
59
|
getFileInfo: () => Amity.File<'file'> | undefined;
|
|
60
|
+
getClipInfo: () => Amity.File<'clip'> | undefined;
|
|
59
61
|
};
|
|
60
62
|
type Post<T extends PostContentType = any> = Amity.InternalPost<T> & Amity.PostLinkObject;
|
|
63
|
+
type ClipDisplayMode = 'fill' | 'fit';
|
|
61
64
|
type QueryPosts = {
|
|
62
65
|
targetId: string;
|
|
63
66
|
targetType: Amity.InternalPost['targetType'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"post.d.ts","sourceRoot":"","sources":["../../../src/@types/domains/post.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe
|
|
1
|
+
{"version":3,"file":"post.d.ts","sourceRoot":"","sources":["../../../src/@types/domains/post.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe;;;;;;;;EAQ1B,CAAC;AAEH,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,KAAK,CAAC;QAEd,KAAK,cAAc,GAAG,KAAK,CAAC,IAAI,CAAC,YA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AC,EAAE,OAAO,CAAC;SAClC,CAAC;QAEF,KAAK,gCAAgC,GAAG,KAAK,CAAC,oBAAoB,CAChE,IAAI,CAAC,wBAAwB,EAAE,MAAM,CAAC,CACvC,CAAC;QAEF,KAAK,qCAAqC,GAAG,KAAK,CAAC,mBAAmB,CACpE,KAAK,CAAC,YAAY,CAAC,QAAQ,CAAC,EAAE,eAAe;QAC7C,wBAAwB,CACzB,CAAC;KACH;CACF"}
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* @async
|
|
14
14
|
*/
|
|
15
15
|
export declare const getCommunity: {
|
|
16
|
-
(communityId: Amity.Community['communityId']
|
|
16
|
+
(communityId: Amity.Community['communityId']): Promise<Amity.Cached<Amity.InternalCommunity>>;
|
|
17
17
|
/**
|
|
18
18
|
* ```js
|
|
19
19
|
* import { CommunityRepository } from '@amityco/ts-sdk'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getCommunity.d.ts","sourceRoot":"","sources":["../../../src/communityRepository/api/getCommunity.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getCommunity.d.ts","sourceRoot":"","sources":["../../../src/communityRepository/api/getCommunity.ts"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,YAAY;kBACV,MAAM,SAAS,CAAC,aAAa,CAAC,GAC1C,QAAQ,MAAM,MAAM,CAAC,MAAM,iBAAiB,CAAC,CAAC;IAyBjD;;;;;;;;;;;;OAYG;yBAEY,MAAM,SAAS,CAAC,aAAa,CAAC,GAC1C,MAAM,MAAM,CAAC,MAAM,iBAAiB,CAAC,GAAG,SAAS;CAjBnD,CAAC"}
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* */
|
|
15
15
|
export declare const getCustomRankingGlobalFeed: {
|
|
16
16
|
(query?: {
|
|
17
|
-
dataTypes?: ('video' | 'image' | 'file' | 'liveStream')[];
|
|
17
|
+
dataTypes?: ('video' | 'image' | 'file' | 'liveStream' | 'clip')[];
|
|
18
18
|
limit?: number;
|
|
19
19
|
queryToken?: string;
|
|
20
20
|
}): Promise<Omit<Amity.Cached<Amity.Paged<Amity.Post>> & Amity.Pagination, 'nextPage' | 'prevPage'>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getCustomRankingGlobalFeed.d.ts","sourceRoot":"","sources":["../../../src/feedRepository/api/getCustomRankingGlobalFeed.ts"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;KAaK;AACL,eAAO,MAAM,0BAA0B;aAAkB;QACvD,SAAS,CAAC,EAAE,CAAC,OAAO,GAAG,OAAO,GAAG,MAAM,GAAG,YAAY,CAAC,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"getCustomRankingGlobalFeed.d.ts","sourceRoot":"","sources":["../../../src/feedRepository/api/getCustomRankingGlobalFeed.ts"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;KAaK;AACL,eAAO,MAAM,0BAA0B;aAAkB;QACvD,SAAS,CAAC,EAAE,CAAC,OAAO,GAAG,OAAO,GAAG,MAAM,GAAG,YAAY,GAAG,MAAM,CAAC,EAAE,CAAC;QACnE,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,GAAG,QACF,KAAK,MAAM,MAAM,CAAC,MAAM,KAAK,CAAC,MAAM,IAAI,CAAC,CAAC,GAAG,MAAM,UAAU,EAAE,UAAU,GAAG,UAAU,CAAC,CACxF;IAyCD;;;;;;;;;;;;;SAaK;oBAEK,WAAW,iCAAiC,CAAC,CAAC,CAAC,CAAC,GAEtD,KAAK,MAAM,MAAM,CAAC,MAAM,KAAK,CAAC,MAAM,IAAI,CAAC,CAAC,GAAG,MAAM,UAAU,EAAE,UAAU,GAAG,UAAU,CAAC,GACvF,SAAS;CArBZ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queryGlobalFeed.d.ts","sourceRoot":"","sources":["../../../src/feedRepository/api/queryGlobalFeed.ts"],"names":[],"mappings":"AAYA;;;;;;;;;;;;;KAaK;AACL,eAAO,MAAM,eAAe;aAClB,MAAM,eAAe,GAC5B,QACD,KAAK,MAAM,MAAM,CAAC,MAAM,KAAK,CAAC,MAAM,IAAI,CAAC,GAAG,MAAM,UAAU,CAAC,EAAE,UAAU,GAAG,UAAU,CAAC,CACxF;
|
|
1
|
+
{"version":3,"file":"queryGlobalFeed.d.ts","sourceRoot":"","sources":["../../../src/feedRepository/api/queryGlobalFeed.ts"],"names":[],"mappings":"AAYA;;;;;;;;;;;;;KAaK;AACL,eAAO,MAAM,eAAe;aAClB,MAAM,eAAe,GAC5B,QACD,KAAK,MAAM,MAAM,CAAC,MAAM,KAAK,CAAC,MAAM,IAAI,CAAC,GAAG,MAAM,UAAU,CAAC,EAAE,UAAU,GAAG,UAAU,CAAC,CACxF;IAgDD;;;;;;;;;;;;;SAaK;oBAEK,WAAW,sBAAsB,CAAC,CAAC,CAAC,CAAC,GAE3C,KAAK,MAAM,MAAM,CAAC,MAAM,KAAK,CAAC,MAAM,IAAI,CAAC,GAAG,MAAM,UAAU,CAAC,EAAE,UAAU,GAAG,UAAU,CAAC,GACvF,SAAS;CArBZ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fileRepository/api/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fileRepository/api/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ```js
|
|
3
|
+
* import { FileRepository } from '@amityco/ts-sdk'
|
|
4
|
+
* const created = await FileRepository.uploadClip(formData)
|
|
5
|
+
* ```
|
|
6
|
+
*
|
|
7
|
+
* Creates an {@link Amity.File}
|
|
8
|
+
*
|
|
9
|
+
* @param formData The data necessary to create a new {@link Amity.File}
|
|
10
|
+
* @param onProgress The callback to track the upload progress
|
|
11
|
+
* @returns The newly created {@link Amity.File}
|
|
12
|
+
*
|
|
13
|
+
* @category File API
|
|
14
|
+
* @async
|
|
15
|
+
*/
|
|
16
|
+
export declare const uploadClip: (formData: FormData, feedType?: Amity.ContentFeedType, onProgress?: ((percent: number) => void) | undefined) => Promise<Amity.Cached<Amity.File<'clip'>[]>>;
|
|
17
|
+
//# sourceMappingURL=uploadClip.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uploadClip.d.ts","sourceRoot":"","sources":["../../../src/fileRepository/api/uploadClip.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,UAAU,aACX,QAAQ,aACP,MAAM,eAAe,0BACT,MAAM,KAAK,IAAI,kBACrC,QAAQ,MAAM,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC,CA2C5C,CAAC"}
|
package/dist/index.cjs.js
CHANGED
|
@@ -35,6 +35,7 @@ const FileType = Object.freeze({
|
|
|
35
35
|
FILE: 'file',
|
|
36
36
|
IMAGE: 'image',
|
|
37
37
|
VIDEO: 'video',
|
|
38
|
+
CLIP: 'clip',
|
|
38
39
|
});
|
|
39
40
|
const VideoResolution = Object.freeze({
|
|
40
41
|
'1080P': '1080p',
|
|
@@ -118,6 +119,7 @@ const PostContentType = Object.freeze({
|
|
|
118
119
|
VIDEO: 'video',
|
|
119
120
|
LIVESTREAM: 'liveStream',
|
|
120
121
|
POLL: 'poll',
|
|
122
|
+
CLIP: 'clip',
|
|
121
123
|
});
|
|
122
124
|
|
|
123
125
|
exports.InvitationTypeEnum = void 0;
|
|
@@ -6693,6 +6695,13 @@ function isAmityVideoPost(post) {
|
|
|
6693
6695
|
'videoFileId' in post.data &&
|
|
6694
6696
|
'thumbnailFileId' in post.data &&
|
|
6695
6697
|
post.dataType === 'video');
|
|
6698
|
+
}
|
|
6699
|
+
function isAmityClipPost(post) {
|
|
6700
|
+
return !!(post.data &&
|
|
6701
|
+
typeof post.data !== 'string' &&
|
|
6702
|
+
'fileId' in post.data &&
|
|
6703
|
+
'thumbnailFileId' in post.data &&
|
|
6704
|
+
post.dataType === 'clip');
|
|
6696
6705
|
}
|
|
6697
6706
|
|
|
6698
6707
|
const postLinkedObject = (post) => {
|
|
@@ -6747,6 +6756,12 @@ const postLinkedObject = (post) => {
|
|
|
6747
6756
|
return isAmityFilePost(post)
|
|
6748
6757
|
? (_b = pullFromCache(['file', 'get', (_a = post === null || post === void 0 ? void 0 : post.data) === null || _a === void 0 ? void 0 : _a.fileId])) === null || _b === void 0 ? void 0 : _b.data
|
|
6749
6758
|
: undefined;
|
|
6759
|
+
},
|
|
6760
|
+
getClipInfo() {
|
|
6761
|
+
var _a, _b;
|
|
6762
|
+
return isAmityClipPost(post)
|
|
6763
|
+
? (_b = pullFromCache(['file', 'get', (_a = post === null || post === void 0 ? void 0 : post.data) === null || _a === void 0 ? void 0 : _a.fileId])) === null || _b === void 0 ? void 0 : _b.data
|
|
6764
|
+
: undefined;
|
|
6750
6765
|
} });
|
|
6751
6766
|
};
|
|
6752
6767
|
|
|
@@ -13915,6 +13930,57 @@ const updateAltText = async (fileId, altText) => {
|
|
|
13915
13930
|
};
|
|
13916
13931
|
/* end_public_function */
|
|
13917
13932
|
|
|
13933
|
+
/* begin_public_function
|
|
13934
|
+
id: file.upload.clip
|
|
13935
|
+
*/
|
|
13936
|
+
/**
|
|
13937
|
+
* ```js
|
|
13938
|
+
* import { FileRepository } from '@amityco/ts-sdk'
|
|
13939
|
+
* const created = await FileRepository.uploadClip(formData)
|
|
13940
|
+
* ```
|
|
13941
|
+
*
|
|
13942
|
+
* Creates an {@link Amity.File}
|
|
13943
|
+
*
|
|
13944
|
+
* @param formData The data necessary to create a new {@link Amity.File}
|
|
13945
|
+
* @param onProgress The callback to track the upload progress
|
|
13946
|
+
* @returns The newly created {@link Amity.File}
|
|
13947
|
+
*
|
|
13948
|
+
* @category File API
|
|
13949
|
+
* @async
|
|
13950
|
+
*/
|
|
13951
|
+
const uploadClip = async (formData, feedType, onProgress) => {
|
|
13952
|
+
const client = getActiveClient();
|
|
13953
|
+
client.log('file/uploadClip', formData);
|
|
13954
|
+
const file = formData.get('files');
|
|
13955
|
+
if (!file)
|
|
13956
|
+
throw new Error('The formData object must have a `files` key.');
|
|
13957
|
+
const accessType = GlobalFileAccessType$1.getInstance().getFileAccessType();
|
|
13958
|
+
formData.append('accessType', accessType);
|
|
13959
|
+
formData.append('preferredFilename', file.name);
|
|
13960
|
+
if (feedType) {
|
|
13961
|
+
formData.append('feedType', feedType);
|
|
13962
|
+
}
|
|
13963
|
+
const headers = 'getHeaders' in formData
|
|
13964
|
+
? formData.getHeaders()
|
|
13965
|
+
: { 'content-type': 'multipart/form-data' };
|
|
13966
|
+
const { data } = await client.upload.post('/api/v4/clips', formData, {
|
|
13967
|
+
headers,
|
|
13968
|
+
onUploadProgress({ loaded, total = 100 }) {
|
|
13969
|
+
onProgress && onProgress(Math.round((loaded * 100) / total));
|
|
13970
|
+
},
|
|
13971
|
+
});
|
|
13972
|
+
// API-FIX: payload should be serialized properly
|
|
13973
|
+
// const { files } = data
|
|
13974
|
+
const cachedAt = client.cache && Date.now();
|
|
13975
|
+
if (client.cache)
|
|
13976
|
+
ingestInCache({ files: data }, { cachedAt });
|
|
13977
|
+
return {
|
|
13978
|
+
data,
|
|
13979
|
+
cachedAt,
|
|
13980
|
+
};
|
|
13981
|
+
};
|
|
13982
|
+
/* end_public_function */
|
|
13983
|
+
|
|
13918
13984
|
var index$k = /*#__PURE__*/Object.freeze({
|
|
13919
13985
|
__proto__: null,
|
|
13920
13986
|
getFile: getFile,
|
|
@@ -13923,7 +13989,8 @@ var index$k = /*#__PURE__*/Object.freeze({
|
|
|
13923
13989
|
fileUrlWithSize: fileUrlWithSize,
|
|
13924
13990
|
uploadVideo: uploadVideo,
|
|
13925
13991
|
uploadImage: uploadImage,
|
|
13926
|
-
updateAltText: updateAltText
|
|
13992
|
+
updateAltText: updateAltText,
|
|
13993
|
+
uploadClip: uploadClip
|
|
13927
13994
|
});
|
|
13928
13995
|
|
|
13929
13996
|
/**
|
|
@@ -19791,16 +19858,11 @@ const updateCommunity = async (communityId, patch) => {
|
|
|
19791
19858
|
* @category Community API
|
|
19792
19859
|
* @async
|
|
19793
19860
|
*/
|
|
19794
|
-
const getCommunity$1 = async (communityId
|
|
19861
|
+
const getCommunity$1 = async (communityId) => {
|
|
19795
19862
|
const client = getActiveClient();
|
|
19796
19863
|
client.log('community/getCommunity', communityId);
|
|
19797
19864
|
// API-FIX: endpoint should not be /list, parameters should be querystring.
|
|
19798
|
-
const { data: payload } = await client.http.get(`/api/v3/communities/${communityId}
|
|
19799
|
-
params: {
|
|
19800
|
-
type: 'communityJoinRequest',
|
|
19801
|
-
includeDiscoverablePrivateCommunity: includeDiscoverablePrivateCommunity !== null && includeDiscoverablePrivateCommunity !== void 0 ? includeDiscoverablePrivateCommunity : true,
|
|
19802
|
-
},
|
|
19803
|
-
});
|
|
19865
|
+
const { data: payload } = await client.http.get(`/api/v3/communities/${communityId}`);
|
|
19804
19866
|
const data = prepareCommunityPayload(payload);
|
|
19805
19867
|
const cachedAt = client.cache && Date.now();
|
|
19806
19868
|
if (client.cache) {
|
|
@@ -22524,14 +22586,14 @@ var index$a = /*#__PURE__*/Object.freeze({
|
|
|
22524
22586
|
const queryGlobalFeed = async (query) => {
|
|
22525
22587
|
const client = getActiveClient();
|
|
22526
22588
|
client.log('feed/queryGlobalFeed', query);
|
|
22527
|
-
const _a = query !== null && query !== void 0 ? query : {}, { queryToken } = _a, params = __rest(_a, ["queryToken"]);
|
|
22589
|
+
const _a = query !== null && query !== void 0 ? query : {}, { queryToken, dataTypes, resolveParent } = _a, params = __rest(_a, ["queryToken", "dataTypes", "resolveParent"]);
|
|
22528
22590
|
const options = (() => {
|
|
22529
22591
|
if (queryToken)
|
|
22530
22592
|
return { token: queryToken };
|
|
22531
22593
|
return undefined;
|
|
22532
22594
|
})();
|
|
22533
22595
|
const { data: queryPayload } = await client.http.get(`/api/v4/me/global-feeds`, {
|
|
22534
|
-
params: Object.assign(Object.assign({}, params), { options }),
|
|
22596
|
+
params: Object.assign(Object.assign({}, params), { dataTypes, resolveParent: resolveParent !== null && resolveParent !== void 0 ? resolveParent : true, options }),
|
|
22535
22597
|
});
|
|
22536
22598
|
const { paging } = queryPayload, payload = __rest(queryPayload, ["paging"]);
|
|
22537
22599
|
const data = prepareMembershipPayload(payload, 'communityUsers');
|
|
@@ -23117,6 +23179,46 @@ const isPostFlaggedByMe = async (postId) => {
|
|
|
23117
23179
|
};
|
|
23118
23180
|
/* end_public_function */
|
|
23119
23181
|
|
|
23182
|
+
/* begin_public_function
|
|
23183
|
+
id: post.create.clip_post
|
|
23184
|
+
*/
|
|
23185
|
+
/**
|
|
23186
|
+
* ```js
|
|
23187
|
+
* import { PostRepository } from '@amityco/ts-sdk'
|
|
23188
|
+
* const created = await PostRepository.createClipPost({
|
|
23189
|
+
* targetType: 'user',
|
|
23190
|
+
* targetId: 'foobar',
|
|
23191
|
+
* dataType: 'clip',
|
|
23192
|
+
* data: { text: 'hello world' },
|
|
23193
|
+
* attachments: [{ type: 'clip', fileId: 'fileId123', displayMode: 'fill', isMuted: false }]
|
|
23194
|
+
* }))
|
|
23195
|
+
* ```
|
|
23196
|
+
*
|
|
23197
|
+
* Creates an {@link Amity.Post}
|
|
23198
|
+
*
|
|
23199
|
+
* @param bundle The data necessary to create a new {@link Amity.Post}
|
|
23200
|
+
* @returns The newly created {@link Amity.Post}
|
|
23201
|
+
*
|
|
23202
|
+
* @category Post API
|
|
23203
|
+
* @async
|
|
23204
|
+
*/
|
|
23205
|
+
const createClipPost = async (bundle) => {
|
|
23206
|
+
const client = getActiveClient();
|
|
23207
|
+
client.log('post/createPost', bundle);
|
|
23208
|
+
const { data: payload } = await client.http.post('/api/v4/posts', bundle);
|
|
23209
|
+
fireEvent('post.created', payload);
|
|
23210
|
+
const data = prepareMembershipPayload(payload, 'communityUsers');
|
|
23211
|
+
const cachedAt = client.cache && Date.now();
|
|
23212
|
+
if (client.cache)
|
|
23213
|
+
ingestInCache(data, { cachedAt });
|
|
23214
|
+
const { posts } = data;
|
|
23215
|
+
return {
|
|
23216
|
+
data: LinkedObject.post(posts[0]),
|
|
23217
|
+
cachedAt,
|
|
23218
|
+
};
|
|
23219
|
+
};
|
|
23220
|
+
/* end_public_function */
|
|
23221
|
+
|
|
23120
23222
|
/* begin_public_function
|
|
23121
23223
|
id: comment.get_by_ids
|
|
23122
23224
|
*/
|
|
@@ -24205,7 +24307,7 @@ class PostPaginationController extends PaginationController {
|
|
|
24205
24307
|
type: params.sortBy || queryParams.limit ? 'pagination' : undefined,
|
|
24206
24308
|
};
|
|
24207
24309
|
const options = token ? Object.assign(Object.assign({}, baseOptions), { token }) : Object.assign(Object.assign({}, baseOptions), { limit });
|
|
24208
|
-
const { data: queryResponse } = await this.http.get(`/api/
|
|
24310
|
+
const { data: queryResponse } = await this.http.get(`/api/v5/posts`, {
|
|
24209
24311
|
params: Object.assign(Object.assign({}, params), { isDeleted: inferIsDeleted(includeDeleted),
|
|
24210
24312
|
/*
|
|
24211
24313
|
* when creating post like image, file, video BE will create 2 posts
|
|
@@ -25017,6 +25119,7 @@ var index$7 = /*#__PURE__*/Object.freeze({
|
|
|
25017
25119
|
flagPost: flagPost,
|
|
25018
25120
|
unflagPost: unflagPost,
|
|
25019
25121
|
isPostFlaggedByMe: isPostFlaggedByMe,
|
|
25122
|
+
createClipPost: createClipPost,
|
|
25020
25123
|
onPostCreated: onPostCreated,
|
|
25021
25124
|
onPostUpdated: onPostUpdated,
|
|
25022
25125
|
onPostDeleted: onPostDeleted,
|
package/dist/index.esm.js
CHANGED
|
@@ -19,6 +19,7 @@ const FileType = Object.freeze({
|
|
|
19
19
|
FILE: 'file',
|
|
20
20
|
IMAGE: 'image',
|
|
21
21
|
VIDEO: 'video',
|
|
22
|
+
CLIP: 'clip',
|
|
22
23
|
});
|
|
23
24
|
const VideoResolution = Object.freeze({
|
|
24
25
|
'1080P': '1080p',
|
|
@@ -102,6 +103,7 @@ const PostContentType = Object.freeze({
|
|
|
102
103
|
VIDEO: 'video',
|
|
103
104
|
LIVESTREAM: 'liveStream',
|
|
104
105
|
POLL: 'poll',
|
|
106
|
+
CLIP: 'clip',
|
|
105
107
|
});
|
|
106
108
|
|
|
107
109
|
var InvitationTypeEnum;
|
|
@@ -22784,6 +22786,13 @@ function isAmityVideoPost(post) {
|
|
|
22784
22786
|
'videoFileId' in post.data &&
|
|
22785
22787
|
'thumbnailFileId' in post.data &&
|
|
22786
22788
|
post.dataType === 'video');
|
|
22789
|
+
}
|
|
22790
|
+
function isAmityClipPost(post) {
|
|
22791
|
+
return !!(post.data &&
|
|
22792
|
+
typeof post.data !== 'string' &&
|
|
22793
|
+
'fileId' in post.data &&
|
|
22794
|
+
'thumbnailFileId' in post.data &&
|
|
22795
|
+
post.dataType === 'clip');
|
|
22787
22796
|
}
|
|
22788
22797
|
|
|
22789
22798
|
const postLinkedObject = (post) => {
|
|
@@ -22838,6 +22847,12 @@ const postLinkedObject = (post) => {
|
|
|
22838
22847
|
return isAmityFilePost(post)
|
|
22839
22848
|
? (_b = pullFromCache(['file', 'get', (_a = post === null || post === void 0 ? void 0 : post.data) === null || _a === void 0 ? void 0 : _a.fileId])) === null || _b === void 0 ? void 0 : _b.data
|
|
22840
22849
|
: undefined;
|
|
22850
|
+
},
|
|
22851
|
+
getClipInfo() {
|
|
22852
|
+
var _a, _b;
|
|
22853
|
+
return isAmityClipPost(post)
|
|
22854
|
+
? (_b = pullFromCache(['file', 'get', (_a = post === null || post === void 0 ? void 0 : post.data) === null || _a === void 0 ? void 0 : _a.fileId])) === null || _b === void 0 ? void 0 : _b.data
|
|
22855
|
+
: undefined;
|
|
22841
22856
|
} });
|
|
22842
22857
|
};
|
|
22843
22858
|
|
|
@@ -30006,6 +30021,57 @@ const updateAltText = async (fileId, altText) => {
|
|
|
30006
30021
|
};
|
|
30007
30022
|
/* end_public_function */
|
|
30008
30023
|
|
|
30024
|
+
/* begin_public_function
|
|
30025
|
+
id: file.upload.clip
|
|
30026
|
+
*/
|
|
30027
|
+
/**
|
|
30028
|
+
* ```js
|
|
30029
|
+
* import { FileRepository } from '@amityco/ts-sdk'
|
|
30030
|
+
* const created = await FileRepository.uploadClip(formData)
|
|
30031
|
+
* ```
|
|
30032
|
+
*
|
|
30033
|
+
* Creates an {@link Amity.File}
|
|
30034
|
+
*
|
|
30035
|
+
* @param formData The data necessary to create a new {@link Amity.File}
|
|
30036
|
+
* @param onProgress The callback to track the upload progress
|
|
30037
|
+
* @returns The newly created {@link Amity.File}
|
|
30038
|
+
*
|
|
30039
|
+
* @category File API
|
|
30040
|
+
* @async
|
|
30041
|
+
*/
|
|
30042
|
+
const uploadClip = async (formData, feedType, onProgress) => {
|
|
30043
|
+
const client = getActiveClient();
|
|
30044
|
+
client.log('file/uploadClip', formData);
|
|
30045
|
+
const file = formData.get('files');
|
|
30046
|
+
if (!file)
|
|
30047
|
+
throw new Error('The formData object must have a `files` key.');
|
|
30048
|
+
const accessType = GlobalFileAccessType$1.getInstance().getFileAccessType();
|
|
30049
|
+
formData.append('accessType', accessType);
|
|
30050
|
+
formData.append('preferredFilename', file.name);
|
|
30051
|
+
if (feedType) {
|
|
30052
|
+
formData.append('feedType', feedType);
|
|
30053
|
+
}
|
|
30054
|
+
const headers = 'getHeaders' in formData
|
|
30055
|
+
? formData.getHeaders()
|
|
30056
|
+
: { 'content-type': 'multipart/form-data' };
|
|
30057
|
+
const { data } = await client.upload.post('/api/v4/clips', formData, {
|
|
30058
|
+
headers,
|
|
30059
|
+
onUploadProgress({ loaded, total = 100 }) {
|
|
30060
|
+
onProgress && onProgress(Math.round((loaded * 100) / total));
|
|
30061
|
+
},
|
|
30062
|
+
});
|
|
30063
|
+
// API-FIX: payload should be serialized properly
|
|
30064
|
+
// const { files } = data
|
|
30065
|
+
const cachedAt = client.cache && Date.now();
|
|
30066
|
+
if (client.cache)
|
|
30067
|
+
ingestInCache({ files: data }, { cachedAt });
|
|
30068
|
+
return {
|
|
30069
|
+
data,
|
|
30070
|
+
cachedAt,
|
|
30071
|
+
};
|
|
30072
|
+
};
|
|
30073
|
+
/* end_public_function */
|
|
30074
|
+
|
|
30009
30075
|
var index$k = /*#__PURE__*/Object.freeze({
|
|
30010
30076
|
__proto__: null,
|
|
30011
30077
|
getFile: getFile,
|
|
@@ -30014,7 +30080,8 @@ var index$k = /*#__PURE__*/Object.freeze({
|
|
|
30014
30080
|
fileUrlWithSize: fileUrlWithSize,
|
|
30015
30081
|
uploadVideo: uploadVideo,
|
|
30016
30082
|
uploadImage: uploadImage,
|
|
30017
|
-
updateAltText: updateAltText
|
|
30083
|
+
updateAltText: updateAltText,
|
|
30084
|
+
uploadClip: uploadClip
|
|
30018
30085
|
});
|
|
30019
30086
|
|
|
30020
30087
|
/**
|
|
@@ -35882,16 +35949,11 @@ const updateCommunity = async (communityId, patch) => {
|
|
|
35882
35949
|
* @category Community API
|
|
35883
35950
|
* @async
|
|
35884
35951
|
*/
|
|
35885
|
-
const getCommunity$1 = async (communityId
|
|
35952
|
+
const getCommunity$1 = async (communityId) => {
|
|
35886
35953
|
const client = getActiveClient();
|
|
35887
35954
|
client.log('community/getCommunity', communityId);
|
|
35888
35955
|
// API-FIX: endpoint should not be /list, parameters should be querystring.
|
|
35889
|
-
const { data: payload } = await client.http.get(`/api/v3/communities/${communityId}
|
|
35890
|
-
params: {
|
|
35891
|
-
type: 'communityJoinRequest',
|
|
35892
|
-
includeDiscoverablePrivateCommunity: includeDiscoverablePrivateCommunity !== null && includeDiscoverablePrivateCommunity !== void 0 ? includeDiscoverablePrivateCommunity : true,
|
|
35893
|
-
},
|
|
35894
|
-
});
|
|
35956
|
+
const { data: payload } = await client.http.get(`/api/v3/communities/${communityId}`);
|
|
35895
35957
|
const data = prepareCommunityPayload(payload);
|
|
35896
35958
|
const cachedAt = client.cache && Date.now();
|
|
35897
35959
|
if (client.cache) {
|
|
@@ -38615,14 +38677,14 @@ var index$a = /*#__PURE__*/Object.freeze({
|
|
|
38615
38677
|
const queryGlobalFeed = async (query) => {
|
|
38616
38678
|
const client = getActiveClient();
|
|
38617
38679
|
client.log('feed/queryGlobalFeed', query);
|
|
38618
|
-
const _a = query !== null && query !== void 0 ? query : {}, { queryToken } = _a, params = __rest(_a, ["queryToken"]);
|
|
38680
|
+
const _a = query !== null && query !== void 0 ? query : {}, { queryToken, dataTypes, resolveParent } = _a, params = __rest(_a, ["queryToken", "dataTypes", "resolveParent"]);
|
|
38619
38681
|
const options = (() => {
|
|
38620
38682
|
if (queryToken)
|
|
38621
38683
|
return { token: queryToken };
|
|
38622
38684
|
return undefined;
|
|
38623
38685
|
})();
|
|
38624
38686
|
const { data: queryPayload } = await client.http.get(`/api/v4/me/global-feeds`, {
|
|
38625
|
-
params: Object.assign(Object.assign({}, params), { options }),
|
|
38687
|
+
params: Object.assign(Object.assign({}, params), { dataTypes, resolveParent: resolveParent !== null && resolveParent !== void 0 ? resolveParent : true, options }),
|
|
38626
38688
|
});
|
|
38627
38689
|
const { paging } = queryPayload, payload = __rest(queryPayload, ["paging"]);
|
|
38628
38690
|
const data = prepareMembershipPayload(payload, 'communityUsers');
|
|
@@ -39208,6 +39270,46 @@ const isPostFlaggedByMe = async (postId) => {
|
|
|
39208
39270
|
};
|
|
39209
39271
|
/* end_public_function */
|
|
39210
39272
|
|
|
39273
|
+
/* begin_public_function
|
|
39274
|
+
id: post.create.clip_post
|
|
39275
|
+
*/
|
|
39276
|
+
/**
|
|
39277
|
+
* ```js
|
|
39278
|
+
* import { PostRepository } from '@amityco/ts-sdk'
|
|
39279
|
+
* const created = await PostRepository.createClipPost({
|
|
39280
|
+
* targetType: 'user',
|
|
39281
|
+
* targetId: 'foobar',
|
|
39282
|
+
* dataType: 'clip',
|
|
39283
|
+
* data: { text: 'hello world' },
|
|
39284
|
+
* attachments: [{ type: 'clip', fileId: 'fileId123', displayMode: 'fill', isMuted: false }]
|
|
39285
|
+
* }))
|
|
39286
|
+
* ```
|
|
39287
|
+
*
|
|
39288
|
+
* Creates an {@link Amity.Post}
|
|
39289
|
+
*
|
|
39290
|
+
* @param bundle The data necessary to create a new {@link Amity.Post}
|
|
39291
|
+
* @returns The newly created {@link Amity.Post}
|
|
39292
|
+
*
|
|
39293
|
+
* @category Post API
|
|
39294
|
+
* @async
|
|
39295
|
+
*/
|
|
39296
|
+
const createClipPost = async (bundle) => {
|
|
39297
|
+
const client = getActiveClient();
|
|
39298
|
+
client.log('post/createPost', bundle);
|
|
39299
|
+
const { data: payload } = await client.http.post('/api/v4/posts', bundle);
|
|
39300
|
+
fireEvent('post.created', payload);
|
|
39301
|
+
const data = prepareMembershipPayload(payload, 'communityUsers');
|
|
39302
|
+
const cachedAt = client.cache && Date.now();
|
|
39303
|
+
if (client.cache)
|
|
39304
|
+
ingestInCache(data, { cachedAt });
|
|
39305
|
+
const { posts } = data;
|
|
39306
|
+
return {
|
|
39307
|
+
data: LinkedObject.post(posts[0]),
|
|
39308
|
+
cachedAt,
|
|
39309
|
+
};
|
|
39310
|
+
};
|
|
39311
|
+
/* end_public_function */
|
|
39312
|
+
|
|
39211
39313
|
/* begin_public_function
|
|
39212
39314
|
id: comment.get_by_ids
|
|
39213
39315
|
*/
|
|
@@ -40296,7 +40398,7 @@ class PostPaginationController extends PaginationController {
|
|
|
40296
40398
|
type: params.sortBy || queryParams.limit ? 'pagination' : undefined,
|
|
40297
40399
|
};
|
|
40298
40400
|
const options = token ? Object.assign(Object.assign({}, baseOptions), { token }) : Object.assign(Object.assign({}, baseOptions), { limit });
|
|
40299
|
-
const { data: queryResponse } = await this.http.get(`/api/
|
|
40401
|
+
const { data: queryResponse } = await this.http.get(`/api/v5/posts`, {
|
|
40300
40402
|
params: Object.assign(Object.assign({}, params), { isDeleted: inferIsDeleted(includeDeleted),
|
|
40301
40403
|
/*
|
|
40302
40404
|
* when creating post like image, file, video BE will create 2 posts
|
|
@@ -41108,6 +41210,7 @@ var index$7 = /*#__PURE__*/Object.freeze({
|
|
|
41108
41210
|
flagPost: flagPost,
|
|
41109
41211
|
unflagPost: unflagPost,
|
|
41110
41212
|
isPostFlaggedByMe: isPostFlaggedByMe,
|
|
41213
|
+
createClipPost: createClipPost,
|
|
41111
41214
|
onPostCreated: onPostCreated,
|
|
41112
41215
|
onPostUpdated: onPostUpdated,
|
|
41113
41216
|
onPostDeleted: onPostDeleted,
|