From 8396bd62d197be2d264a99a5f3377b3dbbee4f9c Mon Sep 17 00:00:00 2001 From: prisadam Date: Mon, 20 Jul 2026 11:06:24 +0700 Subject: [PATCH 1/5] doc: generate report a user new update --- .../user-operations/flag-unflag-user.mdx | 100 +++++++++++++++++- 1 file changed, 96 insertions(+), 4 deletions(-) diff --git a/social-plus-sdk/core-concepts/user-management/user-operations/flag-unflag-user.mdx b/social-plus-sdk/core-concepts/user-management/user-operations/flag-unflag-user.mdx index 175af17b..05efbccc 100644 --- a/social-plus-sdk/core-concepts/user-management/user-operations/flag-unflag-user.mdx +++ b/social-plus-sdk/core-concepts/user-management/user-operations/flag-unflag-user.mdx @@ -5,15 +5,21 @@ description: "Flag users, remove your flag, and check user flag state with socia Use user flagging when a member reports another user for moderator review. Flagging does not block, ban, or delete the user; it records reporting state that moderation workflows can review. +You can send a simple flag (just the `userId`) or an optional **structured report** that describes *what* is being reported and *why* — see [Add a report type, reason, and comment](#add-a-report-type-reason-and-comment-optional). + Flutter exposes flag and unflag actions from an `AmityUser` object. TypeScript, iOS, and Android expose repository methods that take a `userId`. + +The structured report fields (`reportType`, `reason`, `comment`) are **optional** and **backward compatible**. A flag call with no report fields behaves exactly as before. These fields are recorded for moderators and are **not** returned in the API response. + + ## Parameters | Operation | Required inputs | Platforms | Result shape | | --- | --- | --- | --- | -| Flag user | `userId` | TypeScript, iOS, Android | TypeScript returns `Promise`; iOS async call throws on failure; Android returns `Completable`. | +| Flag user | `userId` (optional: `reportType`, `reason`, `comment`) | TypeScript, iOS, Android | TypeScript returns `Promise`; iOS async call throws on failure; Android returns `Completable`. | | Flag user | `AmityUser` object | Flutter | Returns `Future`. | | Unflag user | `userId` | TypeScript, iOS, Android | TypeScript returns `Promise`; iOS async call throws on failure; Android returns `Completable`. | | Unflag user | `AmityUser` object | Flutter | Returns `Future`. | @@ -27,9 +33,9 @@ Call the flag API when the current user reports another user. | Platform | Method | Required inputs | Result shape | | --- | --- | --- | --- | -| TypeScript | `UserRepository.flagUser(userId)` | `userId` | Returns `Promise`. | -| iOS | `userRepository.flagUser(withId:)` | `userId` | Async call that throws on failure. | -| Android | `userRepository.flagUser(userId)` | `userId` | Returns `Completable`. | +| TypeScript | `UserRepository.flagUser(userId, options?)` | `userId` (optional `reportType`, `reason`, `comment`) | Returns `Promise`. | +| iOS | `userRepository.flagUser(withId:reportType:reason:comment:)` | `userId` (optional `reportType`, `reason`, `comment`) | Async call that throws on failure. | +| Android | `userRepository.flagUser(userId, reportType?, reason?, comment?)` | `userId` (optional `reportType`, `reason`, `comment`) | Returns `Completable`. | | Flutter | `user.report().flag()` | `AmityUser` object | Returns `Future`. | @@ -78,6 +84,92 @@ Future flagUser(AmityUser user) async { ``` +## Add a report type, reason, and comment (optional) + +When you want moderators to know *what* part of a profile is being reported and *why*, attach one or more optional fields to the flag call. + +| Field | Answers | Description | +| --- | --- | --- | +| `reportType` | **What** | The aspect of the profile being reported. One of `displayName`, `description`, `avatarFileId`, or `behavior`. Omit it for a generic (typeless) report. | +| `reason` | **Why** | A predefined reason for a `behavior` report. **Required** when `reportType` is `behavior`, and not allowed with any other type. | +| `comment` | **Detail** | Free-text context from the reporter (max 300 characters). Allowed with any report type, including a typeless report. | + +### Report types + +`reportType` uses fixed values; your app decides the label to show the member. + +| Value | Suggested label | Reports the user's… | +| --- | --- | --- | +| `displayName` | Username | display name | +| `description` | Bio | bio / description | +| `avatarFileId` | Avatar | profile image | +| `behavior` | Behavior | conduct (requires a `reason`) | + +### Reasons + +For a `behavior` report, pass a `reason` from the shared content report-reason list (the same values used when flagging posts, comments, and messages): `communityGuidelines`, `harassmentOrBullying`, `selfHarmOrSuicide`, `violenceOrThreateningContent`, `sellingRestrictedItems`, `sexualContentOrNudity`, `spamOrScams`, `falseInformation`, or `others` with a custom string. + +### Rules + + +- `reason` is **required** when `reportType` is `behavior`, and **rejected** for every other type (and for typeless reports). +- `reason` and `comment` are each capped at **300 characters**. +- A member holds **one report per report type** on a target (up to four typed reports plus one typeless). Reporting the **same** type again updates that report; reporting a **different** type adds a new one. +- Unflagging removes **all** of your reports on that user at once — there is no per-type unflag. +- Breaking a rule returns a validation error (HTTP `422`) from the server. + + +### Examples + + +```typescript TypeScript +import { UserRepository } from '@amityco/ts-sdk'; + +// Report a user's behavior, with a reason and comment +await UserRepository.flagUser(userId, { + reportType: 'behavior', + reason: 'spamOrScams', + comment: 'Repeatedly posting promo links', +}); + +// Report a profile field (no reason) +await UserRepository.flagUser(userId, { reportType: 'avatarFileId' }); +``` + +```swift iOS +// Report a user's behavior, with a reason and comment +try await userRepository.flagUser( + withId: "", + reportType: .behavior, + reason: .spamOrScams, + comment: "Repeatedly posting promo links" +) + +// Report a profile field (no reason) +try await userRepository.flagUser(withId: "", reportType: .avatarFileId) +``` + +```kotlin Android +// Report a user's behavior, with a reason and comment +userRepository.flagUser( + userId = userId, + reportType = AmityUserReportType.BEHAVIOR, + reason = AmityContentFlagReason.SpamOrScams, + comment = "Repeatedly posting promo links" +).subscribe() + +// Report a profile field (no reason) +userRepository.flagUser( + userId = userId, + reportType = AmityUserReportType.AVATAR_FILE_ID +).subscribe() +``` + + + +To report more than one aspect of the same profile (for example the avatar **and** the behavior), send a separate flag call for each `reportType`. They are stored as distinct reports. + + ## Unflag a user Call the unflag API when the current user removes their report from another user. From 297312c33024f93e8ddf0f923d263ab3c37ebdd1 Mon Sep 17 00:00:00 2001 From: prisadam Date: Mon, 20 Jul 2026 11:16:13 +0700 Subject: [PATCH 2/5] fix doc failed --- .../user-management/user-operations/flag-unflag-user.mdx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/social-plus-sdk/core-concepts/user-management/user-operations/flag-unflag-user.mdx b/social-plus-sdk/core-concepts/user-management/user-operations/flag-unflag-user.mdx index 05efbccc..ff5f53e3 100644 --- a/social-plus-sdk/core-concepts/user-management/user-operations/flag-unflag-user.mdx +++ b/social-plus-sdk/core-concepts/user-management/user-operations/flag-unflag-user.mdx @@ -121,6 +121,8 @@ For a `behavior` report, pass a `reason` from the shared content report-reason l ### Examples +Pass the optional fields alongside the `userId`. Send `reason` only with a `behavior` report, and add a `comment` on any report type when the reporter provides extra detail. + ```typescript TypeScript import { UserRepository } from '@amityco/ts-sdk'; From aa3aaf4fac45b38bd211357b6a1b0a477f844a0f Mon Sep 17 00:00:00 2001 From: ChayanitBm Date: Mon, 20 Jul 2026 15:14:56 +0700 Subject: [PATCH 3/5] feat: update tssdk docs --- .../user-operations/flag-unflag-user.mdx | 147 ++++++++++-------- 1 file changed, 82 insertions(+), 65 deletions(-) diff --git a/social-plus-sdk/core-concepts/user-management/user-operations/flag-unflag-user.mdx b/social-plus-sdk/core-concepts/user-management/user-operations/flag-unflag-user.mdx index ff5f53e3..7286d786 100644 --- a/social-plus-sdk/core-concepts/user-management/user-operations/flag-unflag-user.mdx +++ b/social-plus-sdk/core-concepts/user-management/user-operations/flag-unflag-user.mdx @@ -5,25 +5,29 @@ description: "Flag users, remove your flag, and check user flag state with socia Use user flagging when a member reports another user for moderator review. Flagging does not block, ban, or delete the user; it records reporting state that moderation workflows can review. -You can send a simple flag (just the `userId`) or an optional **structured report** that describes *what* is being reported and *why* — see [Add a report type, reason, and comment](#add-a-report-type-reason-and-comment-optional). +You can send a simple flag (just the `userId`) or an optional **structured report** that describes _what_ is being reported and _why_ — see [Add a report type, reason, and comment](#add-a-report-type-reason-and-comment-optional). -Flutter exposes flag and unflag actions from an `AmityUser` object. TypeScript, iOS, and Android expose repository methods that take a `userId`. + Flutter exposes flag and unflag actions from an `AmityUser` object. + TypeScript, iOS, and Android expose repository methods that take a `userId`. -The structured report fields (`reportType`, `reason`, `comment`) are **optional** and **backward compatible**. A flag call with no report fields behaves exactly as before. These fields are recorded for moderators and are **not** returned in the API response. + The structured report fields (`reportType`, `reason`, `comment`) are + **optional** and **backward compatible**. A flag call with no report fields + behaves exactly as before. These fields are recorded for moderators and are + **not** returned in the API response. ## Parameters -| Operation | Required inputs | Platforms | Result shape | -| --- | --- | --- | --- | -| Flag user | `userId` (optional: `reportType`, `reason`, `comment`) | TypeScript, iOS, Android | TypeScript returns `Promise`; iOS async call throws on failure; Android returns `Completable`. | -| Flag user | `AmityUser` object | Flutter | Returns `Future`. | -| Unflag user | `userId` | TypeScript, iOS, Android | TypeScript returns `Promise`; iOS async call throws on failure; Android returns `Completable`. | -| Unflag user | `AmityUser` object | Flutter | Returns `Future`. | -| Check flag status | `userId` or `AmityUser` object | TypeScript, iOS, Android, Flutter | Boolean flag state where the platform exposes it. | +| Operation | Required inputs | Platforms | Result shape | +| ----------------- | ------------------------------------------------------ | --------------------------------- | ---------------------------------------------------------------------------------------------------------- | +| Flag user | `userId` (optional: `reportType`, `reason`, `comment`) | TypeScript, iOS, Android | TypeScript returns `Promise`; iOS async call throws on failure; Android returns `Completable`. | +| Flag user | `AmityUser` object | Flutter | Returns `Future`. | +| Unflag user | `userId` | TypeScript, iOS, Android | TypeScript returns `Promise`; iOS async call throws on failure; Android returns `Completable`. | +| Unflag user | `AmityUser` object | Flutter | Returns `Future`. | +| Check flag status | `userId` or `AmityUser` object | TypeScript, iOS, Android, Flutter | Boolean flag state where the platform exposes it. | ## Flag a user @@ -31,22 +35,23 @@ Call the flag API when the current user reports another user. ### Inputs -| Platform | Method | Required inputs | Result shape | -| --- | --- | --- | --- | -| TypeScript | `UserRepository.flagUser(userId, options?)` | `userId` (optional `reportType`, `reason`, `comment`) | Returns `Promise`. | -| iOS | `userRepository.flagUser(withId:reportType:reason:comment:)` | `userId` (optional `reportType`, `reason`, `comment`) | Async call that throws on failure. | -| Android | `userRepository.flagUser(userId, reportType?, reason?, comment?)` | `userId` (optional `reportType`, `reason`, `comment`) | Returns `Completable`. | -| Flutter | `user.report().flag()` | `AmityUser` object | Returns `Future`. | +| Platform | Method | Required inputs | Result shape | +| ---------- | ----------------------------------------------------------------- | ----------------------------------------------------- | ------------------------------------------------- | +| TypeScript | `UserRepository.flagUser(userId, options?)` | `userId` (optional `reportType`, `reason`, `comment`) | Returns `Promise` — the flagged user. | +| iOS | `userRepository.flagUser(withId:reportType:reason:comment:)` | `userId` (optional `reportType`, `reason`, `comment`) | Async call that throws on failure. | +| Android | `userRepository.flagUser(userId, reportType?, reason?, comment?)` | `userId` (optional `reportType`, `reason`, `comment`) | Returns `Completable`. | +| Flutter | `user.report().flag()` | `AmityUser` object | Returns `Future`. | ```typescript TypeScript import { UserRepository } from '@amityco/ts-sdk'; async function flagUser(userId: string) { - const flagged = await UserRepository.flagUser(userId); - console.log('Flagged:', flagged); +const flagged = await UserRepository.flagUser(userId); +console.log('Flagged:', flagged); } -``` + +```` ```swift iOS func flagUser() async { @@ -57,7 +62,7 @@ func flagUser() async { print("Flag failed: \(error)") } } -``` +```` ```kotlin Android fun flagUser(userRepository: AmityUserRepository, userId: String) { @@ -82,28 +87,29 @@ Future flagUser(AmityUser user) async { } } ``` + ## Add a report type, reason, and comment (optional) -When you want moderators to know *what* part of a profile is being reported and *why*, attach one or more optional fields to the flag call. +When you want moderators to know _what_ part of a profile is being reported and _why_, attach one or more optional fields to the flag call. -| Field | Answers | Description | -| --- | --- | --- | -| `reportType` | **What** | The aspect of the profile being reported. One of `displayName`, `description`, `avatarFileId`, or `behavior`. Omit it for a generic (typeless) report. | -| `reason` | **Why** | A predefined reason for a `behavior` report. **Required** when `reportType` is `behavior`, and not allowed with any other type. | -| `comment` | **Detail** | Free-text context from the reporter (max 300 characters). Allowed with any report type, including a typeless report. | +| Field | Answers | Description | +| ------------ | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `reportType` | **What** | The aspect of the profile being reported. One of `displayName`, `description`, `avatarFileId`, or `behavior`. Omit it for a generic (typeless) report. | +| `reason` | **Why** | A predefined reason for a `behavior` report. **Required** when `reportType` is `behavior`, and not allowed with any other type. | +| `comment` | **Detail** | Free-text context from the reporter (max 300 characters). Allowed with any report type, including a typeless report. | ### Report types `reportType` uses fixed values; your app decides the label to show the member. -| Value | Suggested label | Reports the user's… | -| --- | --- | --- | -| `displayName` | Username | display name | -| `description` | Bio | bio / description | -| `avatarFileId` | Avatar | profile image | -| `behavior` | Behavior | conduct (requires a `reason`) | +| Value | Suggested label | Reports the user's… | +| -------------- | --------------- | ----------------------------- | +| `displayName` | Username | display name | +| `description` | Bio | bio / description | +| `avatarFileId` | Avatar | profile image | +| `behavior` | Behavior | conduct (requires a `reason`) | ### Reasons @@ -112,11 +118,14 @@ For a `behavior` report, pass a `reason` from the shared content report-reason l ### Rules -- `reason` is **required** when `reportType` is `behavior`, and **rejected** for every other type (and for typeless reports). -- `reason` and `comment` are each capped at **300 characters**. -- A member holds **one report per report type** on a target (up to four typed reports plus one typeless). Reporting the **same** type again updates that report; reporting a **different** type adds a new one. -- Unflagging removes **all** of your reports on that user at once — there is no per-type unflag. -- Breaking a rule returns a validation error (HTTP `422`) from the server. + - `reason` is **required** when `reportType` is `behavior`, and **rejected** + for every other type (and for typeless reports). - `reason` and `comment` are + each capped at **300 characters**. - A member holds **one report per report + type** on a target (up to four typed reports plus one typeless). Reporting the + **same** type again updates that report; reporting a **different** type adds a + new one. - Unflagging removes **all** of your reports on that user at once — + there is no per-type unflag. - Breaking a rule returns a validation error + (HTTP `422`) from the server. ### Examples @@ -125,18 +134,19 @@ Pass the optional fields alongside the `userId`. Send `reason` only with a `beha ```typescript TypeScript -import { UserRepository } from '@amityco/ts-sdk'; +import { ContentFlagReasonEnum, UserReportTypeEnum, UserRepository } from '@amityco/ts-sdk'; // Report a user's behavior, with a reason and comment await UserRepository.flagUser(userId, { - reportType: 'behavior', - reason: 'spamOrScams', - comment: 'Repeatedly posting promo links', +reportType: UserReportTypeEnum.BEHAVIOR, +reason: ContentFlagReasonEnum.SpamOrScams, +comment: 'Repeatedly posting promo links', }); // Report a profile field (no reason) -await UserRepository.flagUser(userId, { reportType: 'avatarFileId' }); -``` +await UserRepository.flagUser(userId, { reportType: UserReportTypeEnum.AVATAR }); + +```` ```swift iOS // Report a user's behavior, with a reason and comment @@ -149,7 +159,7 @@ try await userRepository.flagUser( // Report a profile field (no reason) try await userRepository.flagUser(withId: "", reportType: .avatarFileId) -``` +```` ```kotlin Android // Report a user's behavior, with a reason and comment @@ -166,10 +176,13 @@ userRepository.flagUser( reportType = AmityUserReportType.AVATAR_FILE_ID ).subscribe() ``` + -To report more than one aspect of the same profile (for example the avatar **and** the behavior), send a separate flag call for each `reportType`. They are stored as distinct reports. + To report more than one aspect of the same profile (for example the avatar + **and** the behavior), send a separate flag call for each `reportType`. They + are stored as distinct reports. ## Unflag a user @@ -178,22 +191,23 @@ Call the unflag API when the current user removes their report from another user ### Inputs -| Platform | Method | Required inputs | Result shape | -| --- | --- | --- | --- | -| TypeScript | `UserRepository.unflagUser(userId)` | `userId` | Returns `Promise`. | -| iOS | `userRepository.unflagUser(withId:)` | `userId` | Async call that throws on failure. | -| Android | `userRepository.unflagUser(userId)` | `userId` | Returns `Completable`. | -| Flutter | `user.report().unflag()` | `AmityUser` object | Returns `Future`. | +| Platform | Method | Required inputs | Result shape | +| ---------- | ------------------------------------ | ------------------ | ---------------------------------- | +| TypeScript | `UserRepository.unflagUser(userId)` | `userId` | Returns `Promise`. | +| iOS | `userRepository.unflagUser(withId:)` | `userId` | Async call that throws on failure. | +| Android | `userRepository.unflagUser(userId)` | `userId` | Returns `Completable`. | +| Flutter | `user.report().unflag()` | `AmityUser` object | Returns `Future`. | ```typescript TypeScript import { UserRepository } from '@amityco/ts-sdk'; async function unflagUser(userId: string) { - const unflagged = await UserRepository.unflagUser(userId); - console.log('Unflagged:', unflagged); +const unflagged = await UserRepository.unflagUser(userId); +console.log('Unflagged:', unflagged); } -``` + +```` ```swift iOS func unflagUser() async { @@ -204,7 +218,7 @@ func unflagUser() async { print("Unflag failed: \(error)") } } -``` +```` ```kotlin Android fun unflagUser(userRepository: AmityUserRepository, userId: String) { @@ -229,6 +243,7 @@ Future unflagUser(AmityUser user) async { } } ``` + ## Check whether the current user flagged a user @@ -237,22 +252,23 @@ Use the flag-state API or property to decide whether to show a flag or unflag ac ### Inputs -| Platform | Method | Required inputs | Result shape | -| --- | --- | --- | --- | -| TypeScript | `UserRepository.isUserFlaggedByMe(userId)` | `userId` | Returns `Promise`. | -| iOS | `userRepository.isUserFlaggedByMe(withId:)` | `userId` | Returns `Bool` from an async call. | -| Android | `user.isFlaggedByMe()` | `AmityUser` object | Returns `Boolean` from the loaded user model. | -| Flutter | `user.isFlaggedByMe` | `AmityUser` object | Returns `bool` from the loaded user model. | +| Platform | Method | Required inputs | Result shape | +| ---------- | ------------------------------------------- | ------------------ | --------------------------------------------- | +| TypeScript | `UserRepository.isUserFlaggedByMe(userId)` | `userId` | Returns `Promise`. | +| iOS | `userRepository.isUserFlaggedByMe(withId:)` | `userId` | Returns `Bool` from an async call. | +| Android | `user.isFlaggedByMe()` | `AmityUser` object | Returns `Boolean` from the loaded user model. | +| Flutter | `user.isFlaggedByMe` | `AmityUser` object | Returns `bool` from the loaded user model. | ```typescript TypeScript import { UserRepository } from '@amityco/ts-sdk'; async function checkFlagState(userId: string) { - const isFlagged = await UserRepository.isUserFlaggedByMe(userId); - console.log('Flagged by me:', isFlagged); +const isFlagged = await UserRepository.isUserFlaggedByMe(userId); +console.log('Flagged by me:', isFlagged); } -``` + +```` ```swift iOS func checkFlagState() async { @@ -263,7 +279,7 @@ func checkFlagState() async { print("Flag-state check failed: \(error)") } } -``` +```` ```kotlin Android fun checkFlagState(user: AmityUser) { @@ -279,6 +295,7 @@ void checkFlagState(AmityUser user) { print('Flagged by me: $isFlaggedByMe'); } ``` + ## Platform notes From 6c56162648d161e1fda58fa7f6a49c778734ff8b Mon Sep 17 00:00:00 2001 From: Fidriyanto Rizkillah Date: Mon, 20 Jul 2026 15:17:12 +0700 Subject: [PATCH 4/5] fix: correct Android report type enum constant to AVATAR Match the Android SDK enum: the constant is AmityUserReportType.AVATAR (its wire value is "avatarFileId"), not AVATAR_FILE_ID. Co-Authored-By: Claude Opus 4.8 --- .../user-management/user-operations/flag-unflag-user.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/social-plus-sdk/core-concepts/user-management/user-operations/flag-unflag-user.mdx b/social-plus-sdk/core-concepts/user-management/user-operations/flag-unflag-user.mdx index 7286d786..91a8a3e8 100644 --- a/social-plus-sdk/core-concepts/user-management/user-operations/flag-unflag-user.mdx +++ b/social-plus-sdk/core-concepts/user-management/user-operations/flag-unflag-user.mdx @@ -173,7 +173,7 @@ userRepository.flagUser( // Report a profile field (no reason) userRepository.flagUser( userId = userId, - reportType = AmityUserReportType.AVATAR_FILE_ID + reportType = AmityUserReportType.AVATAR ).subscribe() ``` From 313478e29777634944fef8f2ef39b16496889399 Mon Sep 17 00:00:00 2001 From: prisadam Date: Mon, 20 Jul 2026 15:55:36 +0700 Subject: [PATCH 5/5] formatted code block , updated info --- .../user-operations/flag-unflag-user.mdx | 37 ++++++++----------- 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/social-plus-sdk/core-concepts/user-management/user-operations/flag-unflag-user.mdx b/social-plus-sdk/core-concepts/user-management/user-operations/flag-unflag-user.mdx index 91a8a3e8..ce519ff7 100644 --- a/social-plus-sdk/core-concepts/user-management/user-operations/flag-unflag-user.mdx +++ b/social-plus-sdk/core-concepts/user-management/user-operations/flag-unflag-user.mdx @@ -51,7 +51,7 @@ const flagged = await UserRepository.flagUser(userId); console.log('Flagged:', flagged); } -```` +``` ```swift iOS func flagUser() async { @@ -62,7 +62,7 @@ func flagUser() async { print("Flag failed: \(error)") } } -```` +``` ```kotlin Android fun flagUser(userRepository: AmityUserRepository, userId: String) { @@ -118,14 +118,11 @@ For a `behavior` report, pass a `reason` from the shared content report-reason l ### Rules - - `reason` is **required** when `reportType` is `behavior`, and **rejected** - for every other type (and for typeless reports). - `reason` and `comment` are - each capped at **300 characters**. - A member holds **one report per report - type** on a target (up to four typed reports plus one typeless). Reporting the - **same** type again updates that report; reporting a **different** type adds a - new one. - Unflagging removes **all** of your reports on that user at once — - there is no per-type unflag. - Breaking a rule returns a validation error - (HTTP `422`) from the server. + - `reason` is **required** when `reportType` is `behavior`, and **rejected** for every other type (and for typeless reports). + - `reason` and `comment` are each capped at **300 characters**. + - A member holds **one report per report type** on a target (up to four typed reports plus one typeless). Reporting the **same** type again updates that report; reporting a **different** type adds a new one. + - Unflagging removes **all** of your reports on that user at once — there is no per-type unflag. + - Breaking a rule returns a validation error (HTTP `422`) from the server. ### Examples @@ -138,15 +135,14 @@ import { ContentFlagReasonEnum, UserReportTypeEnum, UserRepository } from '@amit // Report a user's behavior, with a reason and comment await UserRepository.flagUser(userId, { -reportType: UserReportTypeEnum.BEHAVIOR, -reason: ContentFlagReasonEnum.SpamOrScams, -comment: 'Repeatedly posting promo links', + reportType: UserReportTypeEnum.BEHAVIOR, + reason: ContentFlagReasonEnum.SpamOrScams, + comment: 'Repeatedly posting promo links', }); // Report a profile field (no reason) await UserRepository.flagUser(userId, { reportType: UserReportTypeEnum.AVATAR }); - -```` +``` ```swift iOS // Report a user's behavior, with a reason and comment @@ -159,7 +155,7 @@ try await userRepository.flagUser( // Report a profile field (no reason) try await userRepository.flagUser(withId: "", reportType: .avatarFileId) -```` +``` ```kotlin Android // Report a user's behavior, with a reason and comment @@ -176,7 +172,6 @@ userRepository.flagUser( reportType = AmityUserReportType.AVATAR ).subscribe() ``` - @@ -207,7 +202,7 @@ const unflagged = await UserRepository.unflagUser(userId); console.log('Unflagged:', unflagged); } -```` +``` ```swift iOS func unflagUser() async { @@ -218,7 +213,7 @@ func unflagUser() async { print("Unflag failed: \(error)") } } -```` +``` ```kotlin Android fun unflagUser(userRepository: AmityUserRepository, userId: String) { @@ -268,7 +263,7 @@ const isFlagged = await UserRepository.isUserFlaggedByMe(userId); console.log('Flagged by me:', isFlagged); } -```` +``` ```swift iOS func checkFlagState() async { @@ -279,7 +274,7 @@ func checkFlagState() async { print("Flag-state check failed: \(error)") } } -```` +``` ```kotlin Android fun checkFlagState(user: AmityUser) {