@amityco/ts-sdk 7.29.0 → 7.29.1-cc0fba8.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/core/errors.d.ts +2 -0
- package/dist/@types/core/errors.d.ts.map +1 -1
- package/dist/@types/domains/content.d.ts +11 -0
- package/dist/@types/domains/content.d.ts.map +1 -1
- package/dist/@types/domains/user.d.ts +31 -0
- package/dist/@types/domains/user.d.ts.map +1 -1
- package/dist/commentRepository/api/flagComment.d.ts +72 -5
- package/dist/commentRepository/api/flagComment.d.ts.map +1 -1
- package/dist/commentRepository/internalApi/flagCommentWithOptions.d.ts +13 -0
- package/dist/commentRepository/internalApi/flagCommentWithOptions.d.ts.map +1 -0
- package/dist/commentRepository/internalApi/flagCommentWithReasonString.d.ts +17 -0
- package/dist/commentRepository/internalApi/flagCommentWithReasonString.d.ts.map +1 -0
- package/dist/commentRepository/internalApi/index.d.ts +2 -0
- package/dist/commentRepository/internalApi/index.d.ts.map +1 -1
- package/dist/commentRepository/internalApi/tests/integration/flagCommentWithOptions.integration.test.d.ts +2 -0
- package/dist/commentRepository/internalApi/tests/integration/flagCommentWithOptions.integration.test.d.ts.map +1 -0
- package/dist/commentRepository/internalApi/tests/integration/flagCommentWithReasonString.integration.test.d.ts +2 -0
- package/dist/commentRepository/internalApi/tests/integration/flagCommentWithReasonString.integration.test.d.ts.map +1 -0
- package/dist/core/transports/tests/integration/serverErrorCodes.integration.test.d.ts +2 -0
- package/dist/core/transports/tests/integration/serverErrorCodes.integration.test.d.ts.map +1 -0
- package/dist/index.cjs.js +445 -51
- package/dist/index.esm.js +446 -52
- package/dist/index.umd.js +2 -2
- package/dist/messageRepository/api/flagMessage.d.ts +73 -6
- package/dist/messageRepository/api/flagMessage.d.ts.map +1 -1
- package/dist/messageRepository/api/tests/integration/flagMessage.overloads.integration.test.d.ts +2 -0
- package/dist/messageRepository/api/tests/integration/flagMessage.overloads.integration.test.d.ts.map +1 -0
- package/dist/messageRepository/internalApi/flagMessageWithOptions.d.ts +13 -0
- package/dist/messageRepository/internalApi/flagMessageWithOptions.d.ts.map +1 -0
- package/dist/messageRepository/internalApi/flagMessageWithReasonString.d.ts +18 -0
- package/dist/messageRepository/internalApi/flagMessageWithReasonString.d.ts.map +1 -0
- package/dist/messageRepository/internalApi/tests/integration/flagMessageWithOptions.integration.test.d.ts +2 -0
- package/dist/messageRepository/internalApi/tests/integration/flagMessageWithOptions.integration.test.d.ts.map +1 -0
- package/dist/messageRepository/internalApi/tests/integration/flagMessageWithReasonString.integration.test.d.ts +2 -0
- package/dist/messageRepository/internalApi/tests/integration/flagMessageWithReasonString.integration.test.d.ts.map +1 -0
- package/dist/postRepository/api/flagPost.d.ts +73 -6
- package/dist/postRepository/api/flagPost.d.ts.map +1 -1
- package/dist/postRepository/api/tests/integration/flagPost.overloads.integration.test.d.ts +2 -0
- package/dist/postRepository/api/tests/integration/flagPost.overloads.integration.test.d.ts.map +1 -0
- package/dist/postRepository/internalApi/flagPostWithOptions.d.ts +13 -0
- package/dist/postRepository/internalApi/flagPostWithOptions.d.ts.map +1 -0
- package/dist/postRepository/internalApi/flagPostWithReasonString.d.ts +17 -0
- package/dist/postRepository/internalApi/flagPostWithReasonString.d.ts.map +1 -0
- package/dist/postRepository/internalApi/index.d.ts +2 -0
- package/dist/postRepository/internalApi/index.d.ts.map +1 -1
- package/dist/postRepository/internalApi/tests/integration/flagPostWithOptions.integration.test.d.ts +2 -0
- package/dist/postRepository/internalApi/tests/integration/flagPostWithOptions.integration.test.d.ts.map +1 -0
- package/dist/postRepository/internalApi/tests/integration/flagPostWithReasonString.integration.test.d.ts +2 -0
- package/dist/postRepository/internalApi/tests/integration/flagPostWithReasonString.integration.test.d.ts.map +1 -0
- package/dist/userRepository/api/flagUser.d.ts +50 -9
- package/dist/userRepository/api/flagUser.d.ts.map +1 -1
- package/dist/userRepository/api/flagUserBehavior.d.ts +29 -0
- package/dist/userRepository/api/flagUserBehavior.d.ts.map +1 -0
- package/dist/userRepository/api/flagUserProfile.d.ts +29 -0
- package/dist/userRepository/api/flagUserProfile.d.ts.map +1 -0
- package/dist/userRepository/api/index.d.ts +2 -0
- package/dist/userRepository/api/index.d.ts.map +1 -1
- package/dist/userRepository/api/tests/integration/flagUser.overloads.integration.test.d.ts +2 -0
- package/dist/userRepository/api/tests/integration/flagUser.overloads.integration.test.d.ts.map +1 -0
- package/dist/userRepository/api/tests/integration/flagUserBehavior.integration.test.d.ts +2 -0
- package/dist/userRepository/api/tests/integration/flagUserBehavior.integration.test.d.ts.map +1 -0
- package/dist/userRepository/api/tests/integration/flagUserProfile.integration.test.d.ts +2 -0
- package/dist/userRepository/api/tests/integration/flagUserProfile.integration.test.d.ts.map +1 -0
- package/dist/userRepository/utils/submitUserReport.d.ts +10 -0
- package/dist/userRepository/utils/submitUserReport.d.ts.map +1 -0
- package/dist/userRepository/utils/userReport.d.ts +35 -0
- package/dist/userRepository/utils/userReport.d.ts.map +1 -0
- package/dist/utils/contentFlag.d.ts +28 -0
- package/dist/utils/contentFlag.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -1,15 +1,82 @@
|
|
|
1
|
+
declare type FlagMessage = {
|
|
2
|
+
/**
|
|
3
|
+
* ```js
|
|
4
|
+
* import { MessageRepository } from '@amityco/ts-sdk'
|
|
5
|
+
* const flagged = await MessageRepository.flagMessage(messageId)
|
|
6
|
+
* ```
|
|
7
|
+
*
|
|
8
|
+
* Flags a message without a reason. The report is sent as `Others`; no detail is serialized.
|
|
9
|
+
*
|
|
10
|
+
* @param messageId The ID of the message to flag
|
|
11
|
+
* @returns `true` when the report was created
|
|
12
|
+
*/
|
|
13
|
+
(messageId: Amity.Message['messageId'], reason?: undefined): Promise<boolean>;
|
|
14
|
+
/**
|
|
15
|
+
* ```js
|
|
16
|
+
* import { MessageRepository, ContentFlagReasonEnum } from '@amityco/ts-sdk'
|
|
17
|
+
* const flagged = await MessageRepository.flagMessage(messageId, {
|
|
18
|
+
* reason: ContentFlagReasonEnum.SpamOrScams,
|
|
19
|
+
* detail: 'Repeated promotional links',
|
|
20
|
+
* })
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* Flags a message with a category and optional reporter context. Any category,
|
|
24
|
+
* including `Others`, may carry a `detail`. `detail` is sent unchanged and omitted
|
|
25
|
+
* when not supplied; the backend enforces its 300-character limit.
|
|
26
|
+
*
|
|
27
|
+
* @param messageId The ID of the message to flag
|
|
28
|
+
* @param options `reason` is a `ContentFlagReasonEnum` value; `detail` is optional free text
|
|
29
|
+
* @returns `true` when the report was created
|
|
30
|
+
* @throws {ASCInvalidParameterError} `INVALID_PARAMETERS` when `options` is malformed, before any request is made
|
|
31
|
+
*/
|
|
32
|
+
(messageId: Amity.Message['messageId'], options: Amity.ContentFlagOptions): Promise<boolean>;
|
|
33
|
+
/**
|
|
34
|
+
* ```js
|
|
35
|
+
* import { MessageRepository } from '@amityco/ts-sdk'
|
|
36
|
+
* const flagged = await MessageRepository.flagMessage(messageId, reason)
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
39
|
+
* @deprecated Pass an options object instead: `flagMessage(messageId, { reason, detail })`.
|
|
40
|
+
* A predefined string maps to `{ reason: <value>, detail: '' }`; a custom string maps to
|
|
41
|
+
* `{ reason: 'Others', detail: <string> }`. Migrate a custom string to
|
|
42
|
+
* `{ reason: ContentFlagReasonEnum.Others, detail: customString }`. This mapping is
|
|
43
|
+
* unchanged and stays available throughout the current major version.
|
|
44
|
+
*
|
|
45
|
+
* @param messageId The ID of the message to flag
|
|
46
|
+
* @param reason a predefined `ContentFlagReasonEnum` value or a custom string
|
|
47
|
+
* @returns `true` when the report was created
|
|
48
|
+
*/
|
|
49
|
+
(messageId: Amity.Message['messageId'], reason?: Amity.ContentFlagReason): Promise<boolean>;
|
|
50
|
+
};
|
|
1
51
|
/**
|
|
2
52
|
* ```js
|
|
3
|
-
* import { MessageRepository } from '@amityco/ts-sdk'
|
|
4
|
-
*
|
|
53
|
+
* import { MessageRepository, ContentFlagReasonEnum } from '@amityco/ts-sdk'
|
|
54
|
+
*
|
|
55
|
+
* // No reason.
|
|
56
|
+
* await MessageRepository.flagMessage(messageId)
|
|
57
|
+
*
|
|
58
|
+
* // Category plus optional reporter context (any category, including Others).
|
|
59
|
+
* await MessageRepository.flagMessage(messageId, {
|
|
60
|
+
* reason: ContentFlagReasonEnum.SpamOrScams,
|
|
61
|
+
* detail: 'Repeated promotional links',
|
|
62
|
+
* })
|
|
5
63
|
* ```
|
|
6
64
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
65
|
+
* Reports a message to moderation. Three call shapes are accepted (see the overloads):
|
|
66
|
+
* id-only, an options object, and the deprecated legacy reason string. The public
|
|
67
|
+
* name only dispatches on the input shape; the two implementations are kept separate
|
|
68
|
+
* so the legacy path is untouched by the new contract:
|
|
69
|
+
*
|
|
70
|
+
* - `undefined` or a string → `flagMessageWithReasonString` (unchanged legacy mapping)
|
|
71
|
+
* - anything else → `flagMessageWithOptions` (validated `{ reason, detail? }`)
|
|
72
|
+
*
|
|
73
|
+
* @param messageId The ID of the message to flag
|
|
74
|
+
* @param input an options object `{ reason, detail? }`, a legacy reason string, or nothing
|
|
75
|
+
* @returns `true` when the report was created
|
|
10
76
|
*
|
|
11
77
|
* @category Message API
|
|
12
78
|
* @async
|
|
13
79
|
* */
|
|
14
|
-
export declare const flagMessage:
|
|
80
|
+
export declare const flagMessage: FlagMessage;
|
|
81
|
+
export {};
|
|
15
82
|
//# sourceMappingURL=flagMessage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flagMessage.d.ts","sourceRoot":"","sources":["../../../src/messageRepository/api/flagMessage.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"flagMessage.d.ts","sourceRoot":"","sources":["../../../src/messageRepository/api/flagMessage.ts"],"names":[],"mappings":"AAIA,aAAK,WAAW,GAAG;IACjB;;;;;;;;;;OAUG;IACH,CAAC,SAAS,EAAE,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC9E;;;;;;;;;;;;;;;;;OAiBG;IACH,CAAC,SAAS,EAAE,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,kBAAkB,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC7F;;;;;;;;;;;;;;;OAeG;IACH,CAAC,SAAS,EAAE,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC,EAAE,KAAK,CAAC,iBAAiB,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAC7F,CAAC;AAKF;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA4BK;AACL,eAAO,MAAM,WAAW,EAAE,WAMoB,CAAC"}
|
package/dist/messageRepository/api/tests/integration/flagMessage.overloads.integration.test.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flagMessage.overloads.integration.test.d.ts","sourceRoot":"","sources":["../../../../../src/messageRepository/api/tests/integration/flagMessage.overloads.integration.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* New `flagMessage(messageId, { reason, detail? })` implementation. Any category,
|
|
3
|
+
* including `Others`, may carry a `detail`. `detail` is forwarded unchanged (empty and
|
|
4
|
+
* whitespace-only strings included) and omitted from the request body when `undefined`;
|
|
5
|
+
* the backend enforces the 300-character limit.
|
|
6
|
+
*
|
|
7
|
+
* Not exported from the public API. It is reached through the
|
|
8
|
+
* `MessageRepository.flagMessage(messageId, options)` overload; see `api/flagMessage.ts`.
|
|
9
|
+
*
|
|
10
|
+
* @throws {ASCInvalidParameterError} `INVALID_PARAMETERS` when `options` is malformed, before any request is made
|
|
11
|
+
*/
|
|
12
|
+
export declare const flagMessageWithOptions: (messageId: Amity.Message['messageId'], options: Amity.ContentFlagOptions) => Promise<boolean>;
|
|
13
|
+
//# sourceMappingURL=flagMessageWithOptions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flagMessageWithOptions.d.ts","sourceRoot":"","sources":["../../../src/messageRepository/internalApi/flagMessageWithOptions.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;GAUG;AACH,eAAO,MAAM,sBAAsB,cACtB,MAAM,OAAO,CAAC,WAAW,CAAC,WAC5B,MAAM,kBAAkB,KAChC,QAAQ,OAAO,CAqBjB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Legacy `flagMessage(messageId, reason?)` implementation, kept verbatim so existing
|
|
3
|
+
* callers keep the exact request body they had before the options contract existed:
|
|
4
|
+
*
|
|
5
|
+
* - predefined `ContentFlagReasonEnum` value → `{ reason: <value>, detail: '' }`
|
|
6
|
+
* - any other non-empty string (including the literal `'Others'`) → `{ reason: 'Others', detail: <string> }`
|
|
7
|
+
* - `undefined` or `''` → `{ reason: 'Others', detail: '' }`
|
|
8
|
+
* (for `undefined` the message body carries `detail: undefined`, which JSON serialization omits)
|
|
9
|
+
*
|
|
10
|
+
* Not exported from the public API. It is reached through the deprecated
|
|
11
|
+
* `MessageRepository.flagMessage(messageId, reason)` overload; see `api/flagMessage.ts`.
|
|
12
|
+
*
|
|
13
|
+
* Not itself deprecated: it implements the deprecated legacy-string overload of the public
|
|
14
|
+
* `flagMessage`, which carries the deprecation tag. New code should use `flagMessageWithOptions`
|
|
15
|
+
* (the `{ reason, detail? }` contract). This path stays available throughout the current major version.
|
|
16
|
+
*/
|
|
17
|
+
export declare const flagMessageWithReasonString: (messageId: Amity.Message['messageId'], reason?: Amity.ContentFlagReason) => Promise<boolean>;
|
|
18
|
+
//# sourceMappingURL=flagMessageWithReasonString.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flagMessageWithReasonString.d.ts","sourceRoot":"","sources":["../../../src/messageRepository/internalApi/flagMessageWithReasonString.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,2BAA2B,cAC3B,MAAM,OAAO,CAAC,WAAW,CAAC,WAC5B,MAAM,iBAAiB,KAC/B,QAAQ,OAAO,CA4BjB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flagMessageWithOptions.integration.test.d.ts","sourceRoot":"","sources":["../../../../../src/messageRepository/internalApi/tests/integration/flagMessageWithOptions.integration.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flagMessageWithReasonString.integration.test.d.ts","sourceRoot":"","sources":["../../../../../src/messageRepository/internalApi/tests/integration/flagMessageWithReasonString.integration.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,15 +1,82 @@
|
|
|
1
|
+
declare type FlagPost = {
|
|
2
|
+
/**
|
|
3
|
+
* ```js
|
|
4
|
+
* import { PostRepository } from '@amityco/ts-sdk'
|
|
5
|
+
* const flagged = await PostRepository.flagPost(postId)
|
|
6
|
+
* ```
|
|
7
|
+
*
|
|
8
|
+
* Flags a post without a reason. The report is sent as `Others` with an empty detail.
|
|
9
|
+
*
|
|
10
|
+
* @param postId The ID of the post to flag
|
|
11
|
+
* @returns `true` when the report was created
|
|
12
|
+
*/
|
|
13
|
+
(postId: Amity.Post['postId'], reason?: undefined): Promise<boolean>;
|
|
14
|
+
/**
|
|
15
|
+
* ```js
|
|
16
|
+
* import { PostRepository, ContentFlagReasonEnum } from '@amityco/ts-sdk'
|
|
17
|
+
* const flagged = await PostRepository.flagPost(postId, {
|
|
18
|
+
* reason: ContentFlagReasonEnum.SpamOrScams,
|
|
19
|
+
* detail: 'Repeated promotional links',
|
|
20
|
+
* })
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* Flags a post with a category and optional reporter context. Any category,
|
|
24
|
+
* including `Others`, may carry a `detail`. `detail` is sent unchanged and omitted
|
|
25
|
+
* when not supplied; the backend enforces its 300-character limit.
|
|
26
|
+
*
|
|
27
|
+
* @param postId The ID of the post to flag
|
|
28
|
+
* @param options `reason` is a `ContentFlagReasonEnum` value; `detail` is optional free text
|
|
29
|
+
* @returns `true` when the report was created
|
|
30
|
+
* @throws {ASCInvalidParameterError} `INVALID_PARAMETERS` when `options` is malformed, before any request is made
|
|
31
|
+
*/
|
|
32
|
+
(postId: Amity.Post['postId'], options: Amity.ContentFlagOptions): Promise<boolean>;
|
|
33
|
+
/**
|
|
34
|
+
* ```js
|
|
35
|
+
* import { PostRepository } from '@amityco/ts-sdk'
|
|
36
|
+
* const flagged = await PostRepository.flagPost(postId, reason)
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
39
|
+
* @deprecated Pass an options object instead: `flagPost(postId, { reason, detail })`.
|
|
40
|
+
* A predefined string maps to `{ reason: <value>, detail: '' }`; a custom string maps to
|
|
41
|
+
* `{ reason: 'Others', detail: <string> }`. Migrate a custom string to
|
|
42
|
+
* `{ reason: ContentFlagReasonEnum.Others, detail: customString }`. This mapping is
|
|
43
|
+
* unchanged and stays available throughout the current major version.
|
|
44
|
+
*
|
|
45
|
+
* @param postId The ID of the post to flag
|
|
46
|
+
* @param reason a predefined `ContentFlagReasonEnum` value or a custom string
|
|
47
|
+
* @returns `true` when the report was created
|
|
48
|
+
*/
|
|
49
|
+
(postId: Amity.Post['postId'], reason?: Amity.ContentFlagReason): Promise<boolean>;
|
|
50
|
+
};
|
|
1
51
|
/**
|
|
2
52
|
* ```js
|
|
3
|
-
* import { PostRepository } from '@amityco/ts-sdk'
|
|
4
|
-
*
|
|
53
|
+
* import { PostRepository, ContentFlagReasonEnum } from '@amityco/ts-sdk'
|
|
54
|
+
*
|
|
55
|
+
* // No reason.
|
|
56
|
+
* await PostRepository.flagPost(postId)
|
|
57
|
+
*
|
|
58
|
+
* // Category plus optional reporter context (any category, including Others).
|
|
59
|
+
* await PostRepository.flagPost(postId, {
|
|
60
|
+
* reason: ContentFlagReasonEnum.SpamOrScams,
|
|
61
|
+
* detail: 'Repeated promotional links',
|
|
62
|
+
* })
|
|
5
63
|
* ```
|
|
6
64
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
65
|
+
* Reports a post to moderation. Three call shapes are accepted (see the overloads):
|
|
66
|
+
* id-only, an options object, and the deprecated legacy reason string. The public
|
|
67
|
+
* name only dispatches on the input shape; the two implementations are kept separate
|
|
68
|
+
* so the legacy path is untouched by the new contract:
|
|
69
|
+
*
|
|
70
|
+
* - `undefined` or a string → `flagPostWithReasonString` (unchanged legacy mapping)
|
|
71
|
+
* - anything else → `flagPostWithOptions` (validated `{ reason, detail? }`)
|
|
72
|
+
*
|
|
73
|
+
* @param postId The ID of the post to flag
|
|
74
|
+
* @param input an options object `{ reason, detail? }`, a legacy reason string, or nothing
|
|
75
|
+
* @returns `true` when the report was created
|
|
10
76
|
*
|
|
11
77
|
* @category Post API
|
|
12
78
|
* @async
|
|
13
79
|
* */
|
|
14
|
-
export declare const flagPost:
|
|
80
|
+
export declare const flagPost: FlagPost;
|
|
81
|
+
export {};
|
|
15
82
|
//# sourceMappingURL=flagPost.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flagPost.d.ts","sourceRoot":"","sources":["../../../src/postRepository/api/flagPost.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"flagPost.d.ts","sourceRoot":"","sources":["../../../src/postRepository/api/flagPost.ts"],"names":[],"mappings":"AAIA,aAAK,QAAQ,GAAG;IACd;;;;;;;;;;OAUG;IACH,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACrE;;;;;;;;;;;;;;;;;OAiBG;IACH,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,kBAAkB,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACpF;;;;;;;;;;;;;;;OAeG;IACH,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,EAAE,KAAK,CAAC,iBAAiB,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACpF,CAAC;AAKF;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA4BK;AACL,eAAO,MAAM,QAAQ,EAAE,QAMiB,CAAC"}
|
package/dist/postRepository/api/tests/integration/flagPost.overloads.integration.test.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flagPost.overloads.integration.test.d.ts","sourceRoot":"","sources":["../../../../../src/postRepository/api/tests/integration/flagPost.overloads.integration.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* New `flagPost(postId, { reason, detail? })` implementation. Any category, including
|
|
3
|
+
* `Others`, may carry a `detail`. `detail` is forwarded unchanged (empty and
|
|
4
|
+
* whitespace-only strings included) and omitted from the request body when `undefined`;
|
|
5
|
+
* the backend enforces the 300-character limit.
|
|
6
|
+
*
|
|
7
|
+
* Not exported from the public API. It is reached through the
|
|
8
|
+
* `PostRepository.flagPost(postId, options)` overload; see `api/flagPost.ts`.
|
|
9
|
+
*
|
|
10
|
+
* @throws {ASCInvalidParameterError} `INVALID_PARAMETERS` when `options` is malformed, before any request is made
|
|
11
|
+
*/
|
|
12
|
+
export declare const flagPostWithOptions: (postId: Amity.Post['postId'], options: Amity.ContentFlagOptions) => Promise<boolean>;
|
|
13
|
+
//# sourceMappingURL=flagPostWithOptions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flagPostWithOptions.d.ts","sourceRoot":"","sources":["../../../src/postRepository/internalApi/flagPostWithOptions.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;GAUG;AACH,eAAO,MAAM,mBAAmB,WACtB,MAAM,IAAI,CAAC,QAAQ,CAAC,WACnB,MAAM,kBAAkB,KAChC,QAAQ,OAAO,CAoBjB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Legacy `flagPost(postId, reason?)` implementation, kept verbatim so existing
|
|
3
|
+
* callers keep the exact request body they had before the options contract existed:
|
|
4
|
+
*
|
|
5
|
+
* - predefined `ContentFlagReasonEnum` value → `{ reason: <value>, detail: '' }`
|
|
6
|
+
* - any other non-empty string (including the literal `'Others'`) → `{ reason: 'Others', detail: <string> }`
|
|
7
|
+
* - `undefined` or `''` → `{ reason: 'Others', detail: '' }`
|
|
8
|
+
*
|
|
9
|
+
* Not exported from the public API. It is reached through the deprecated
|
|
10
|
+
* `PostRepository.flagPost(postId, reason)` overload; see `api/flagPost.ts`.
|
|
11
|
+
*
|
|
12
|
+
* Not itself deprecated: it implements the deprecated legacy-string overload of the public
|
|
13
|
+
* `flagPost`, which carries the deprecation tag. New code should use `flagPostWithOptions`
|
|
14
|
+
* (the `{ reason, detail? }` contract). This path stays available throughout the current major version.
|
|
15
|
+
*/
|
|
16
|
+
export declare const flagPostWithReasonString: (postId: Amity.Post['postId'], reason?: Amity.ContentFlagReason) => Promise<boolean>;
|
|
17
|
+
//# sourceMappingURL=flagPostWithReasonString.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flagPostWithReasonString.d.ts","sourceRoot":"","sources":["../../../src/postRepository/internalApi/flagPostWithReasonString.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,wBAAwB,WAC3B,MAAM,IAAI,CAAC,QAAQ,CAAC,WACnB,MAAM,iBAAiB,KAC/B,QAAQ,OAAO,CA2BjB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/postRepository/internalApi/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/postRepository/internalApi/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAE1B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flagPostWithOptions.integration.test.d.ts","sourceRoot":"","sources":["../../../../../src/postRepository/internalApi/tests/integration/flagPostWithOptions.integration.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flagPostWithReasonString.integration.test.d.ts","sourceRoot":"","sources":["../../../../../src/postRepository/internalApi/tests/integration/flagPostWithReasonString.integration.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,22 +1,63 @@
|
|
|
1
|
+
declare type FlagUser = {
|
|
2
|
+
/**
|
|
3
|
+
* ```js
|
|
4
|
+
* import { UserRepository } from '@amityco/ts-sdk'
|
|
5
|
+
* const flagged = await UserRepository.flagUser('userId')
|
|
6
|
+
* ```
|
|
7
|
+
*
|
|
8
|
+
* Flags a user with a typeless report. No request body is sent.
|
|
9
|
+
*
|
|
10
|
+
* To report a specific profile field use `flagUserProfile(userId, { field, comment })`;
|
|
11
|
+
* to report behavior use `flagUserBehavior(userId, { reason, comment })`.
|
|
12
|
+
*
|
|
13
|
+
* @param userId The ID of the user to be flagged
|
|
14
|
+
* @returns the flagged {@link Amity.User}
|
|
15
|
+
*/
|
|
16
|
+
(userId: Amity.User['userId'], options?: undefined): Promise<Amity.User>;
|
|
17
|
+
/**
|
|
18
|
+
* ```js
|
|
19
|
+
* import { UserRepository } from '@amityco/ts-sdk'
|
|
20
|
+
* const flaggedBehavior = await UserRepository.flagUser('userId', {
|
|
21
|
+
* reportType: 'behavior',
|
|
22
|
+
* reason: 'Harassment or bullying',
|
|
23
|
+
* comment: 'optional free-text',
|
|
24
|
+
* })
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @deprecated Use `flagUserProfile(userId, { field, comment })` to report a profile
|
|
28
|
+
* field, or `flagUserBehavior(userId, { reason, comment })` to report behavior. For a
|
|
29
|
+
* custom `Others` reason, pass `reason: ContentFlagReasonEnum.Others` and put the text
|
|
30
|
+
* in `comment`. `flagUser(userId)` without options stays supported. This overload's
|
|
31
|
+
* request mapping is unchanged and stays available throughout the current major version.
|
|
32
|
+
*
|
|
33
|
+
* @param userId The ID of the user to be flagged
|
|
34
|
+
* @param options Optional report metadata forwarded to the server as the request
|
|
35
|
+
* body: `reportType`, `reason`, `comment`. Only non-undefined fields are included.
|
|
36
|
+
* All validation is server-side; a bodyless call produces a typeless report.
|
|
37
|
+
* @returns the flagged {@link Amity.User}
|
|
38
|
+
*/
|
|
39
|
+
(userId: Amity.User['userId'], options?: Amity.UserReportOptions): Promise<Amity.User>;
|
|
40
|
+
};
|
|
1
41
|
/**
|
|
2
42
|
* ```js
|
|
3
43
|
* import { UserRepository } from '@amityco/ts-sdk'
|
|
44
|
+
*
|
|
45
|
+
* // Typeless report (supported).
|
|
4
46
|
* const flagged = await UserRepository.flagUser('userId')
|
|
5
|
-
* const flaggedBehavior = await UserRepository.flagUser('userId', {
|
|
6
|
-
* reportType: 'behavior',
|
|
7
|
-
* reason: 'Harassment or bullying',
|
|
8
|
-
* comment: 'optional free-text',
|
|
9
|
-
* })
|
|
10
47
|
* ```
|
|
11
48
|
*
|
|
49
|
+
* Flags a user. Two call shapes are accepted (see the overloads): id-only, which
|
|
50
|
+
* sends no body and stays supported, and the deprecated structured options object,
|
|
51
|
+
* whose request mapping is unchanged. New code reporting a profile field or behavior
|
|
52
|
+
* should use `flagUserProfile` or `flagUserBehavior`.
|
|
53
|
+
*
|
|
12
54
|
* @param userId The ID of the user to be flagged
|
|
13
|
-
* @param options
|
|
14
|
-
* body: `reportType`, `reason`, `comment`. Only non-null fields are included.
|
|
15
|
-
* All validation is server-side; a bodyless call produces a typeless report.
|
|
55
|
+
* @param options Deprecated report metadata; omit for a typeless report
|
|
16
56
|
* @returns the flagged {@link Amity.User}
|
|
17
57
|
*
|
|
18
58
|
* @category User API
|
|
19
59
|
* @async
|
|
20
60
|
* */
|
|
21
|
-
export declare const flagUser:
|
|
61
|
+
export declare const flagUser: FlagUser;
|
|
62
|
+
export {};
|
|
22
63
|
//# sourceMappingURL=flagUser.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flagUser.d.ts","sourceRoot":"","sources":["../../../src/userRepository/api/flagUser.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"flagUser.d.ts","sourceRoot":"","sources":["../../../src/userRepository/api/flagUser.ts"],"names":[],"mappings":"AAiBA,aAAK,QAAQ,GAAG;IACd;;;;;;;;;;;;;OAaG;IACH,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACzE;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,EAAE,KAAK,CAAC,iBAAiB,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;CACxF,CAAC;AAKF;;;;;;;;;;;;;;;;;;;KAmBK;AACL,eAAO,MAAM,QAAQ,EAAE,QAuBtB,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ```js
|
|
3
|
+
* import { UserRepository, ContentFlagReasonEnum } from '@amityco/ts-sdk'
|
|
4
|
+
* const flagged = await UserRepository.flagUserBehavior('userId', {
|
|
5
|
+
* reason: ContentFlagReasonEnum.Others,
|
|
6
|
+
* comment: 'Impersonating our brand',
|
|
7
|
+
* })
|
|
8
|
+
* ```
|
|
9
|
+
*
|
|
10
|
+
* Reports a user's behavior. `reason` is required and is one of the nine
|
|
11
|
+
* `ContentFlagReasonEnum` values, sent as its canonical label. Reporter text, including
|
|
12
|
+
* the explanation for `Others`, always travels in `comment`; the reason never carries text.
|
|
13
|
+
*
|
|
14
|
+
* `comment` is trimmed; a blank comment is omitted from the request; a comment longer
|
|
15
|
+
* than 300 characters after trimming is rejected before any request. Otherwise the
|
|
16
|
+
* trimmed text is sent unchanged.
|
|
17
|
+
*
|
|
18
|
+
* Sends `POST /api/v4/me/flags/:userId` with `{ reportType: 'behavior', reason, comment? }`.
|
|
19
|
+
*
|
|
20
|
+
* @param userId The ID of the user to be reported
|
|
21
|
+
* @param options `reason` is a `ContentFlagReasonEnum` value; `comment` is optional free text
|
|
22
|
+
* @returns the flagged {@link Amity.User}
|
|
23
|
+
* @throws {ASCInvalidParameterError} `INVALID_PARAMETERS` when `options` is missing or malformed, `reason` is missing or unknown, or `comment` is over 300 characters, before any request is made
|
|
24
|
+
*
|
|
25
|
+
* @category User API
|
|
26
|
+
* @async
|
|
27
|
+
* */
|
|
28
|
+
export declare const flagUserBehavior: (userId: Amity.User['userId'], options: Amity.UserBehaviorReportOptions) => Promise<Amity.User>;
|
|
29
|
+
//# sourceMappingURL=flagUserBehavior.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flagUserBehavior.d.ts","sourceRoot":"","sources":["../../../src/userRepository/api/flagUserBehavior.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;;;;;;;;KA0BK;AACL,eAAO,MAAM,gBAAgB,WACnB,MAAM,IAAI,CAAC,QAAQ,CAAC,WACnB,MAAM,yBAAyB,KACvC,QAAQ,MAAM,IAAI,CAC4D,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ```js
|
|
3
|
+
* import { UserRepository, UserProfileFieldEnum } from '@amityco/ts-sdk'
|
|
4
|
+
* const flagged = await UserRepository.flagUserProfile('userId', {
|
|
5
|
+
* field: UserProfileFieldEnum.AVATAR,
|
|
6
|
+
* comment: 'Nudity in profile photo',
|
|
7
|
+
* })
|
|
8
|
+
* ```
|
|
9
|
+
*
|
|
10
|
+
* Reports one of a user's profile fields (display name, description or avatar). The
|
|
11
|
+
* call has no reason: profile reports never carry one, so the backend's reason rules
|
|
12
|
+
* cannot be violated from here. A `reason` key passed at runtime is ignored and never sent.
|
|
13
|
+
*
|
|
14
|
+
* `comment` is trimmed; a blank comment is omitted from the request; a comment longer
|
|
15
|
+
* than 300 characters after trimming is rejected before any request. Otherwise the
|
|
16
|
+
* trimmed text is sent unchanged.
|
|
17
|
+
*
|
|
18
|
+
* Sends `POST /api/v4/me/flags/:userId` with `{ reportType: <field>, comment? }`.
|
|
19
|
+
*
|
|
20
|
+
* @param userId The ID of the user to be reported
|
|
21
|
+
* @param options `field` is a `UserProfileFieldEnum` value; `comment` is optional free text
|
|
22
|
+
* @returns the flagged {@link Amity.User}
|
|
23
|
+
* @throws {ASCInvalidParameterError} `INVALID_PARAMETERS` when `options` is missing or malformed, or `comment` is over 300 characters, before any request is made
|
|
24
|
+
*
|
|
25
|
+
* @category User API
|
|
26
|
+
* @async
|
|
27
|
+
* */
|
|
28
|
+
export declare const flagUserProfile: (userId: Amity.User['userId'], options: Amity.UserProfileReportOptions) => Promise<Amity.User>;
|
|
29
|
+
//# sourceMappingURL=flagUserProfile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flagUserProfile.d.ts","sourceRoot":"","sources":["../../../src/userRepository/api/flagUserProfile.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;;;;;;;;KA0BK;AACL,eAAO,MAAM,eAAe,WAClB,MAAM,IAAI,CAAC,QAAQ,CAAC,WACnB,MAAM,wBAAwB,KACtC,QAAQ,MAAM,IAAI,CAC0D,CAAC"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export { getUserByIds } from './getUserByIds';
|
|
2
2
|
export { updateUser } from './updateUser';
|
|
3
3
|
export { flagUser } from './flagUser';
|
|
4
|
+
export { flagUserProfile } from './flagUserProfile';
|
|
5
|
+
export { flagUserBehavior } from './flagUserBehavior';
|
|
4
6
|
export { unflagUser } from './unflagUser';
|
|
5
7
|
export { isUserFlaggedByMe } from './isUserFlaggedByMe';
|
|
6
8
|
export { getAllBlockedUsers } from './getAllBlockedUsers';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/userRepository/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/userRepository/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC"}
|
package/dist/userRepository/api/tests/integration/flagUser.overloads.integration.test.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flagUser.overloads.integration.test.d.ts","sourceRoot":"","sources":["../../../../../src/userRepository/api/tests/integration/flagUser.overloads.integration.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flagUserBehavior.integration.test.d.ts","sourceRoot":"","sources":["../../../../../src/userRepository/api/tests/integration/flagUserBehavior.integration.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flagUserProfile.integration.test.d.ts","sourceRoot":"","sources":["../../../../../src/userRepository/api/tests/integration/flagUserProfile.integration.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { UserReportBody } from './userReport';
|
|
2
|
+
/**
|
|
3
|
+
* Sends a validated split user report (`flagUserProfile` / `flagUserBehavior`) to the
|
|
4
|
+
* same endpoint as `flagUser`, then persists the returned user and fires `user.flagged`
|
|
5
|
+
* exactly as `flagUser` does, so all three calls share return, cache and event behaviour.
|
|
6
|
+
*
|
|
7
|
+
* Not exported from the public API.
|
|
8
|
+
*/
|
|
9
|
+
export declare const submitUserReport: (apiName: 'flagUserProfile' | 'flagUserBehavior', userId: Amity.User['userId'], body: UserReportBody) => Promise<Amity.User>;
|
|
10
|
+
//# sourceMappingURL=submitUserReport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"submitUserReport.d.ts","sourceRoot":"","sources":["../../../src/userRepository/utils/submitUserReport.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,YAClB,iBAAiB,GAAG,kBAAkB,UACvC,MAAM,IAAI,CAAC,QAAQ,CAAC,QACtB,cAAc,KACnB,QAAQ,MAAM,IAAI,CAkBpB,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { UserProfileFieldEnum } from '~/@types';
|
|
2
|
+
/** Maximum `comment` length, in string length units, after trimming. */
|
|
3
|
+
export declare const USER_REPORT_COMMENT_MAX_LENGTH = 300;
|
|
4
|
+
/** Request body sent to `POST /api/v4/me/flags/:userId` by the split user-report calls. */
|
|
5
|
+
export declare type UserReportBody = {
|
|
6
|
+
reportType: `${UserProfileFieldEnum}` | 'behavior';
|
|
7
|
+
reason?: string;
|
|
8
|
+
comment?: string;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Normalizes an optional reporter `comment`: it must be a string when supplied (`null`
|
|
12
|
+
* is not a valid supplied comment); it is trimmed; a blank result is omitted (the
|
|
13
|
+
* backend rejects `""`); a result longer than 300 characters is rejected before any
|
|
14
|
+
* request. Otherwise the trimmed text is returned unchanged.
|
|
15
|
+
*
|
|
16
|
+
* @throws {ASCInvalidParameterError} `INVALID_PARAMETERS` for a non-string or over-length comment
|
|
17
|
+
*/
|
|
18
|
+
export declare const normalizeUserReportComment: (apiName: string, comment: unknown) => string | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* Validates `flagUserProfile` options and builds its request body. Untyped callers can
|
|
21
|
+
* pass anything at runtime, so nothing is trusted from the declared type. Any `reason`
|
|
22
|
+
* key is ignored and never sent.
|
|
23
|
+
*
|
|
24
|
+
* @throws {ASCInvalidParameterError} `INVALID_PARAMETERS` when the options are malformed
|
|
25
|
+
*/
|
|
26
|
+
export declare const toUserProfileReportBody: (options: unknown) => UserReportBody;
|
|
27
|
+
/**
|
|
28
|
+
* Validates `flagUserBehavior` options and builds its request body. `reason` must be one
|
|
29
|
+
* of the nine `ContentFlagReasonEnum` values and is sent as that canonical label;
|
|
30
|
+
* `reportType` is always `behavior`.
|
|
31
|
+
*
|
|
32
|
+
* @throws {ASCInvalidParameterError} `INVALID_PARAMETERS` when the options are malformed
|
|
33
|
+
*/
|
|
34
|
+
export declare const toUserBehaviorReportBody: (options: unknown) => UserReportBody;
|
|
35
|
+
//# sourceMappingURL=userReport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"userReport.d.ts","sourceRoot":"","sources":["../../../src/userRepository/utils/userReport.ts"],"names":[],"mappings":"AACA,OAAO,EAAyB,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAEvE,wEAAwE;AACxE,eAAO,MAAM,8BAA8B,MAAM,CAAC;AAElD,2FAA2F;AAC3F,oBAAY,cAAc,GAAG;IAC3B,UAAU,EAAE,GAAG,oBAAoB,EAAE,GAAG,UAAU,CAAC;IACnD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAiBF;;;;;;;GAOG;AACH,eAAO,MAAM,0BAA0B,YAC5B,MAAM,WACN,OAAO,KACf,MAAM,GAAG,SAkBX,CAAC;AAKF;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB,YAAa,OAAO,KAAG,cAc1D,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,YAAa,OAAO,KAAG,cAc3D,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** Request body shared by the post, comment and message flag endpoints. */
|
|
2
|
+
export declare type ContentFlagBody = {
|
|
3
|
+
reason: string;
|
|
4
|
+
detail?: string;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* True when a public `flagX(id, input)` argument is the legacy shape (a reason string
|
|
8
|
+
* or nothing). Anything else is routed to the `Amity.ContentFlagOptions` path, whose
|
|
9
|
+
* validation rejects malformed values before any request is made.
|
|
10
|
+
*/
|
|
11
|
+
export declare const isLegacyContentFlagReason: (input: unknown) => input is Amity.ContentFlagReason | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* Validates an `Amity.ContentFlagOptions` argument. Untyped (plain JS) callers can pass
|
|
14
|
+
* anything at runtime, so the checks do not trust the declared type: the value must be a
|
|
15
|
+
* plain object, `reason` must be one of the nine `ContentFlagReasonEnum` values and
|
|
16
|
+
* `detail`, when supplied, must be a string (`null` is not a valid supplied detail).
|
|
17
|
+
*
|
|
18
|
+
* @param apiName used in the error message, e.g. `flagPost`
|
|
19
|
+
* @throws {ASCInvalidParameterError} `INVALID_PARAMETERS` when the options are malformed
|
|
20
|
+
*/
|
|
21
|
+
export declare const validateContentFlagOptions: (apiName: string, options: unknown) => Amity.ContentFlagOptions;
|
|
22
|
+
/**
|
|
23
|
+
* Builds the request body for validated options. `detail` is forwarded unchanged (empty
|
|
24
|
+
* and whitespace-only strings included) and omitted from the body when `undefined`; the
|
|
25
|
+
* backend enforces the 300-character limit.
|
|
26
|
+
*/
|
|
27
|
+
export declare const toContentFlagBody: ({ reason, detail }: Amity.ContentFlagOptions) => ContentFlagBody;
|
|
28
|
+
//# sourceMappingURL=contentFlag.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contentFlag.d.ts","sourceRoot":"","sources":["../../src/utils/contentFlag.ts"],"names":[],"mappings":"AAGA,2EAA2E;AAC3E,oBAAY,eAAe,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAIlE;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,UAC7B,OAAO,iDACmF,CAAC;AAEpG;;;;;;;;GAQG;AACH,eAAO,MAAM,0BAA0B,YAC5B,MAAM,WACN,OAAO,KACf,MAAM,kBAoBR,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,uBAAwB,MAAM,kBAAkB,KAAG,eACzB,CAAC"}
|