@ph-cms/client-sdk 0.1.38 → 0.1.42

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/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # @ph-cms/client-sdk 0.1.38
1
+ # @ph-cms/client-sdk 0.1.42
2
2
 
3
3
  PH-CMS 클라이언트 SDK — 브라우저 및 React 애플리케이션을 위한 통합 클라이언트.
4
4
 
@@ -56,6 +56,12 @@ import type {
56
56
 
57
57
  // User
58
58
  UserDto,
59
+ BlockUserRequest,
60
+ BlockUserResponse,
61
+ BlockedUserDto,
62
+ PagedBlockedUserListResponse,
63
+ SuspendUserRequest,
64
+ SuspendUserResponse,
59
65
 
60
66
  // Channel
61
67
  ChannelDto,
@@ -72,6 +78,8 @@ import type {
72
78
  ListLikersQuery,
73
79
  ListLikedContentQuery,
74
80
  PagedContentListResponse,
81
+ ReportContentRequest,
82
+ ReportContentResponse,
75
83
 
76
84
  // Hierarchy / Policy
77
85
  HierarchySetDto,
@@ -1151,6 +1159,85 @@ const likedStats = await client.user.getLikedStats('user-uid');
1151
1159
  // => [{ type: 'post', count: 5 }, { type: 'place', count: 2 }]
1152
1160
  ```
1153
1161
 
1162
+ ## Content Report (콘텐츠 신고)
1163
+
1164
+ 부적절한 콘텐츠를 신고할 수 있습니다. (인증 필수)
1165
+
1166
+ ```ts
1167
+ // 모듈 직접 사용
1168
+ const result = await client.content.report('content-uid', {
1169
+ reason: 'SPAM',
1170
+ description: '이 콘텐츠는 스팸입니다.'
1171
+ });
1172
+ // => { message: 'Report submitted successfully' }
1173
+
1174
+ // React Hook 사용
1175
+ const { mutate: reportContent } = useReportContent();
1176
+
1177
+ reportContent({
1178
+ uid: 'content-uid',
1179
+ data: {
1180
+ reason: 'INAPPROPRIATE',
1181
+ description: '부적절한 내용이 포함되어 있습니다.'
1182
+ }
1183
+ });
1184
+ ```
1185
+
1186
+ ## User Block (사용자 차단)
1187
+
1188
+ 특정 사용자를 차단하거나 차단 해제할 수 있습니다. (인증 필수)
1189
+
1190
+ ```ts
1191
+ // 1. 사용자 차단
1192
+ const blockResult = await client.user.block('target-user-uid', {
1193
+ reason: '부적절한 언행'
1194
+ });
1195
+ // => { success: true, message: 'User blocked' }
1196
+
1197
+ // React Hook 사용
1198
+ const { mutate: blockUser } = useBlockUser();
1199
+ blockUser({ uid: 'target-user-uid', data: { reason: '사유' } });
1200
+
1201
+ // 2. 사용자 차단 해제
1202
+ const unblockResult = await client.user.unblock('target-user-uid');
1203
+ // => { success: true, message: 'User unblocked' }
1204
+
1205
+ // React Hook 사용
1206
+ const { mutate: unblockUser } = useUnblockUser();
1207
+ unblockUser('target-user-uid');
1208
+
1209
+ // 3. 차단한 사용자 목록 조회
1210
+ const blockedUsers = await client.user.getBlockedUsers('my-user-uid', { page: 1, limit: 10 });
1211
+ // => PagedBlockedUserListResponse
1212
+
1213
+ // React Hook 사용
1214
+ const { data: blockedList } = useBlockedUsers('my-user-uid', { page: 1 });
1215
+ ```
1216
+
1217
+ ## Global Ban (글로벌 밴 - 관리자 전용)
1218
+
1219
+ 특정 사용자의 활동을 전역적으로 정지시키거나 해제할 수 있습니다. (관리자 권한 필수)
1220
+
1221
+ ```ts
1222
+ // 1. 사용자 활동 정지 (Suspend)
1223
+ const suspendResult = await client.user.suspend('target-user-uid', {
1224
+ reason: '운영 정책 위반'
1225
+ });
1226
+ // => { success: true, message: 'User suspended' }
1227
+
1228
+ // React Hook 사용
1229
+ const { mutate: suspendUser } = useSuspendUser();
1230
+ suspendUser({ uid: 'target-user-uid', data: { reason: '사유' } });
1231
+
1232
+ // 2. 사용자 활동 정지 해제 (Unsuspend)
1233
+ const unsuspendResult = await client.user.unsuspend('target-user-uid');
1234
+ // => { success: true, message: 'User unsuspended' }
1235
+
1236
+ // React Hook 사용
1237
+ const { mutate: unsuspendUser } = useUnsuspendUser();
1238
+ unsuspendUser('target-user-uid');
1239
+ ```
1240
+
1154
1241
  ## Stamp Tour
1155
1242
 
1156
1243
  스탬프 투어 기능을 사용하여 특정 지점(Marker) 방문을 인증하고 진행 현황을 조회하거나, 새로운 투어를 생성할 수 있습니다.
@@ -1567,6 +1654,11 @@ const result = await content.list({ channelUid: 'my-channel' });
1567
1654
  | `updateProfile(uid: string, data: UpdateUserProfileRequest)` | 유저의 프로필 정보 업데이트 → `UserDto` |
1568
1655
  | `getLikedContents(uid: string, params?: Partial<ListLikedContentQuery>)` | 사용자가 좋아요 누른 콘텐츠 목록 조회 → `PagedContentListResponse` |
1569
1656
  | `getLikedStats(uid: string)` | 사용자가 좋아요 누른 콘텐츠 타입별 통계 조회 → `LikedStatsByTypeResponse` |
1657
+ | `block(uid: string, data?: BlockUserRequest)` | 특정 사용자 차단 → `BlockUserResponse` |
1658
+ | `unblock(uid: string)` | 특정 사용자 차단 해제 → `BlockUserResponse` |
1659
+ | `getBlockedUsers(uid: string, params?: { page?: number; limit?: number })` | 차단한 사용자 목록 조회 → `PagedBlockedUserListResponse` |
1660
+ | `suspend(uid: string, data?: SuspendUserRequest)` | 유저 활동 정지 (글로벌 밴) → `SuspendUserResponse` |
1661
+ | `unsuspend(uid: string)` | 유저 활동 정지 해제 → `SuspendUserResponse` |
1570
1662
 
1571
1663
  ### `AuthModule` (`client.auth`)
1572
1664
 
@@ -1599,6 +1691,7 @@ const result = await content.list({ channelUid: 'my-channel' });
1599
1691
  | `toggleLike(uid: string)` | 좋아요 토글 → `ToggleLikeResponse` |
1600
1692
  | `getLikeStatus(uid: string)` | 내 좋아요 여부 확인 → `LikeStatusResponse` |
1601
1693
  | `getLikers(uid: string, params?: Partial<ListLikersQuery>)` | 콘텐츠에 좋아요 누른 사용자 목록 조회 → `PagedResponse<UserProfileDto>` |
1694
+ | `report(uid: string, data: ReportContentRequest)` | 콘텐츠 신고 → `ReportContentResponse` |
1602
1695
 
1603
1696
  ### `ChannelModule` (`client.channel`)
1604
1697
 
@@ -17,7 +17,7 @@ export type RegisterInput = FirebaseRegisterInput | EmailRegisterInput;
17
17
  */
18
18
  export declare const useAuth: () => {
19
19
  user: {
20
- status: string;
20
+ status: "active" | "inactive" | "suspended" | "pending";
21
21
  uid: string;
22
22
  email: string;
23
23
  username: string | null;
@@ -53,7 +53,7 @@ export declare const useAuth: () => {
53
53
  login: import("@tanstack/react-query").UseMutateAsyncFunction<{
54
54
  refreshToken: string;
55
55
  user: {
56
- status: string;
56
+ status: "active" | "inactive" | "suspended" | "pending";
57
57
  uid: string;
58
58
  email: string;
59
59
  username: string | null;
@@ -92,7 +92,7 @@ export declare const useAuth: () => {
92
92
  loginWithFirebase: import("@tanstack/react-query").UseMutateAsyncFunction<{
93
93
  refreshToken: string;
94
94
  user: {
95
- status: string;
95
+ status: "active" | "inactive" | "suspended" | "pending";
96
96
  uid: string;
97
97
  email: string;
98
98
  username: string | null;
@@ -131,7 +131,7 @@ export declare const useAuth: () => {
131
131
  register: import("@tanstack/react-query").UseMutateAsyncFunction<{
132
132
  refreshToken: string;
133
133
  user: {
134
- status: string;
134
+ status: "active" | "inactive" | "suspended" | "pending";
135
135
  uid: string;
136
136
  email: string;
137
137
  username: string | null;
@@ -167,7 +167,7 @@ export declare const useAuth: () => {
167
167
  loginAnonymous: import("@tanstack/react-query").UseMutateAsyncFunction<{
168
168
  refreshToken: string;
169
169
  user: {
170
- status: string;
170
+ status: "active" | "inactive" | "suspended" | "pending";
171
171
  uid: string;
172
172
  email: string;
173
173
  username: string | null;
@@ -203,7 +203,7 @@ export declare const useAuth: () => {
203
203
  channelUid?: string;
204
204
  } | undefined, unknown>;
205
205
  upgradeAnonymous: import("@tanstack/react-query").UseMutateAsyncFunction<{
206
- status: string;
206
+ status: "active" | "inactive" | "suspended" | "pending";
207
207
  uid: string;
208
208
  email: string;
209
209
  username: string | null;
@@ -245,7 +245,7 @@ export declare const useAuth: () => {
245
245
  loginStatus: import("@tanstack/react-query").UseMutationResult<{
246
246
  refreshToken: string;
247
247
  user: {
248
- status: string;
248
+ status: "active" | "inactive" | "suspended" | "pending";
249
249
  uid: string;
250
250
  email: string;
251
251
  username: string | null;
@@ -284,7 +284,7 @@ export declare const useAuth: () => {
284
284
  loginWithFirebaseStatus: import("@tanstack/react-query").UseMutationResult<{
285
285
  refreshToken: string;
286
286
  user: {
287
- status: string;
287
+ status: "active" | "inactive" | "suspended" | "pending";
288
288
  uid: string;
289
289
  email: string;
290
290
  username: string | null;
@@ -323,7 +323,7 @@ export declare const useAuth: () => {
323
323
  registerStatus: import("@tanstack/react-query").UseMutationResult<{
324
324
  refreshToken: string;
325
325
  user: {
326
- status: string;
326
+ status: "active" | "inactive" | "suspended" | "pending";
327
327
  uid: string;
328
328
  email: string;
329
329
  username: string | null;
@@ -359,7 +359,7 @@ export declare const useAuth: () => {
359
359
  loginAnonymousStatus: import("@tanstack/react-query").UseMutationResult<{
360
360
  refreshToken: string;
361
361
  user: {
362
- status: string;
362
+ status: "active" | "inactive" | "suspended" | "pending";
363
363
  uid: string;
364
364
  email: string;
365
365
  username: string | null;
@@ -395,7 +395,7 @@ export declare const useAuth: () => {
395
395
  channelUid?: string;
396
396
  } | undefined, unknown>;
397
397
  upgradeAnonymousStatus: import("@tanstack/react-query").UseMutationResult<{
398
- status: string;
398
+ status: "active" | "inactive" | "suspended" | "pending";
399
399
  uid: string;
400
400
  email: string;
401
401
  username: string | null;
@@ -437,7 +437,7 @@ export declare const useAuth: () => {
437
437
  export declare const useLogin: () => import("@tanstack/react-query").UseMutationResult<{
438
438
  refreshToken: string;
439
439
  user: {
440
- status: string;
440
+ status: "active" | "inactive" | "suspended" | "pending";
441
441
  uid: string;
442
442
  email: string;
443
443
  username: string | null;
@@ -477,7 +477,7 @@ export declare const useLogout: () => import("@tanstack/react-query").UseMutatio
477
477
  export declare const useLoginAnonymous: () => import("@tanstack/react-query").UseMutationResult<{
478
478
  refreshToken: string;
479
479
  user: {
480
- status: string;
480
+ status: "active" | "inactive" | "suspended" | "pending";
481
481
  uid: string;
482
482
  email: string;
483
483
  username: string | null;
@@ -513,7 +513,7 @@ export declare const useLoginAnonymous: () => import("@tanstack/react-query").Us
513
513
  channelUid?: string;
514
514
  } | undefined, unknown>;
515
515
  export declare const useUpgradeAnonymous: () => import("@tanstack/react-query").UseMutationResult<{
516
- status: string;
516
+ status: "active" | "inactive" | "suspended" | "pending";
517
517
  uid: string;
518
518
  email: string;
519
519
  username: string | null;
@@ -1,4 +1,4 @@
1
- import { UpdateContentRequest, ListContentQuery, ContentDto } from '@ph-cms/api-contract';
1
+ import { UpdateContentRequest, ListContentQuery, ContentDto, ReportContentRequest } from '@ph-cms/api-contract';
2
2
  export declare const contentKeys: {
3
3
  all: readonly ["contents"];
4
4
  lists: () => readonly ["contents", "list"];
@@ -82,3 +82,9 @@ export declare const useUpdateContent: () => import("@tanstack/react-query").Use
82
82
  data: UpdateContentRequest;
83
83
  }, unknown>;
84
84
  export declare const useDeleteContent: () => import("@tanstack/react-query").UseMutationResult<void, Error, string, unknown>;
85
+ export declare const useReportContent: () => import("@tanstack/react-query").UseMutationResult<{
86
+ message: string;
87
+ }, Error, {
88
+ uid: string;
89
+ data: ReportContentRequest;
90
+ }, unknown>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useDeleteContent = exports.useUpdateContent = exports.useToggleLike = exports.useLikeStatus = exports.useCreateContent = exports.useIncrementView = exports.useContentDetail = exports.useContentList = exports.contentKeys = void 0;
3
+ exports.useReportContent = exports.useDeleteContent = exports.useUpdateContent = exports.useToggleLike = exports.useLikeStatus = exports.useCreateContent = exports.useIncrementView = exports.useContentDetail = exports.useContentList = exports.contentKeys = void 0;
4
4
  const react_query_1 = require("@tanstack/react-query");
5
5
  const context_1 = require("../context");
6
6
  exports.contentKeys = {
@@ -177,3 +177,10 @@ const useDeleteContent = () => {
177
177
  });
178
178
  };
179
179
  exports.useDeleteContent = useDeleteContent;
180
+ const useReportContent = () => {
181
+ const client = (0, context_1.usePHCMS)();
182
+ return (0, react_query_1.useMutation)({
183
+ mutationFn: ({ uid, data }) => client.content.report(uid, data),
184
+ });
185
+ };
186
+ exports.useReportContent = useReportContent;
@@ -1,4 +1,4 @@
1
- import { ListLikedContentQuery, UpdateUserProfileRequest } from '@ph-cms/api-contract';
1
+ import { ListLikedContentQuery, UpdateUserProfileRequest, BlockUserRequest, SuspendUserRequest } from '@ph-cms/api-contract';
2
2
  export declare const termsKeys: {
3
3
  all: readonly ["terms"];
4
4
  lists: () => readonly ["terms", "list"];
@@ -8,7 +8,7 @@ export declare const termsKeys: {
8
8
  */
9
9
  export declare const useUser: () => {
10
10
  data: {
11
- status: string;
11
+ status: "active" | "inactive" | "suspended" | "pending";
12
12
  uid: string;
13
13
  email: string;
14
14
  username: string | null;
@@ -58,7 +58,7 @@ export declare const useUserProfile: (uid: string) => import("@tanstack/react-qu
58
58
  * Typically used by a user to update their own profile.
59
59
  */
60
60
  export declare const useUpdateProfile: () => import("@tanstack/react-query").UseMutationResult<{
61
- status: string;
61
+ status: "active" | "inactive" | "suspended" | "pending";
62
62
  uid: string;
63
63
  email: string;
64
64
  username: string | null;
@@ -133,3 +133,59 @@ export declare const useAgreeTerms: () => import("@tanstack/react-query").UseMut
133
133
  termCodes: string[];
134
134
  channelUid?: string;
135
135
  }, unknown>;
136
+ /**
137
+ * Hook to block a user.
138
+ */
139
+ export declare const useBlockUser: () => import("@tanstack/react-query").UseMutationResult<{
140
+ message: string;
141
+ success: boolean;
142
+ }, Error, {
143
+ uid: string;
144
+ data?: BlockUserRequest;
145
+ }, unknown>;
146
+ /**
147
+ * Hook to unblock a user.
148
+ */
149
+ export declare const useUnblockUser: () => import("@tanstack/react-query").UseMutationResult<{
150
+ message: string;
151
+ success: boolean;
152
+ }, Error, string, unknown>;
153
+ /**
154
+ * Hook to fetch the list of blocked users.
155
+ */
156
+ export declare const useBlockedUsers: (uid: string, params?: {
157
+ page?: number;
158
+ limit?: number;
159
+ }) => import("@tanstack/react-query").UseQueryResult<{
160
+ items: {
161
+ uid: string;
162
+ username: string | null;
163
+ display_name: string;
164
+ avatar_url: string | null;
165
+ reason: string | null;
166
+ blocked_at: string;
167
+ }[];
168
+ total: number;
169
+ page: number;
170
+ limit: number;
171
+ totalPages: number;
172
+ }, Error>;
173
+ /**
174
+ * Hook to suspend a user (Global Ban).
175
+ * Admin only.
176
+ */
177
+ export declare const useSuspendUser: () => import("@tanstack/react-query").UseMutationResult<{
178
+ message: string;
179
+ success: boolean;
180
+ }, Error, {
181
+ uid: string;
182
+ data?: SuspendUserRequest;
183
+ }, unknown>;
184
+ /**
185
+ * Hook to unsuspend a user.
186
+ * Admin only.
187
+ */
188
+ export declare const useUnsuspendUser: () => import("@tanstack/react-query").UseMutationResult<{
189
+ message: string;
190
+ success: boolean;
191
+ }, Error, string, unknown>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useAgreeTerms = exports.useChannelTerms = exports.useLikedStats = exports.useLikedContents = exports.useUpdateProfile = exports.useUserProfile = exports.useUser = exports.termsKeys = void 0;
3
+ exports.useUnsuspendUser = exports.useSuspendUser = exports.useBlockedUsers = exports.useUnblockUser = exports.useBlockUser = exports.useAgreeTerms = exports.useChannelTerms = exports.useLikedStats = exports.useLikedContents = exports.useUpdateProfile = exports.useUserProfile = exports.useUser = exports.termsKeys = void 0;
4
4
  const react_query_1 = require("@tanstack/react-query");
5
5
  const context_1 = require("../context");
6
6
  exports.termsKeys = {
@@ -93,3 +93,57 @@ const useAgreeTerms = () => {
93
93
  });
94
94
  };
95
95
  exports.useAgreeTerms = useAgreeTerms;
96
+ /**
97
+ * Hook to block a user.
98
+ */
99
+ const useBlockUser = () => {
100
+ const client = (0, context_1.usePHCMS)();
101
+ return (0, react_query_1.useMutation)({
102
+ mutationFn: ({ uid, data }) => client.user.block(uid, data),
103
+ });
104
+ };
105
+ exports.useBlockUser = useBlockUser;
106
+ /**
107
+ * Hook to unblock a user.
108
+ */
109
+ const useUnblockUser = () => {
110
+ const client = (0, context_1.usePHCMS)();
111
+ return (0, react_query_1.useMutation)({
112
+ mutationFn: (uid) => client.user.unblock(uid),
113
+ });
114
+ };
115
+ exports.useUnblockUser = useUnblockUser;
116
+ /**
117
+ * Hook to fetch the list of blocked users.
118
+ */
119
+ const useBlockedUsers = (uid, params = {}) => {
120
+ const client = (0, context_1.usePHCMS)();
121
+ return (0, react_query_1.useQuery)({
122
+ queryKey: ['user-blocked-users', uid, params],
123
+ queryFn: () => client.user.getBlockedUsers(uid, params),
124
+ enabled: !!uid,
125
+ });
126
+ };
127
+ exports.useBlockedUsers = useBlockedUsers;
128
+ /**
129
+ * Hook to suspend a user (Global Ban).
130
+ * Admin only.
131
+ */
132
+ const useSuspendUser = () => {
133
+ const client = (0, context_1.usePHCMS)();
134
+ return (0, react_query_1.useMutation)({
135
+ mutationFn: ({ uid, data }) => client.user.suspend(uid, data),
136
+ });
137
+ };
138
+ exports.useSuspendUser = useSuspendUser;
139
+ /**
140
+ * Hook to unsuspend a user.
141
+ * Admin only.
142
+ */
143
+ const useUnsuspendUser = () => {
144
+ const client = (0, context_1.usePHCMS)();
145
+ return (0, react_query_1.useMutation)({
146
+ mutationFn: (uid) => client.user.unsuspend(uid),
147
+ });
148
+ };
149
+ exports.useUnsuspendUser = useUnsuspendUser;
@@ -1,4 +1,4 @@
1
- import { CollectStampRequest, ContentDto, CreateContentRequest, CreateStampTourRequest, LikeStatusResponse, ListContentQuery, ListLikersQuery, PagedContentListResponse, PagedResponse, StampStatusDto, ToggleLikeResponse, TourStatsDto, UpdateContentRequest, UpdateStampTourRequest, UserProfileDto } from "@ph-cms/api-contract";
1
+ import { CollectStampRequest, ContentDto, CreateContentRequest, CreateStampTourRequest, LikeStatusResponse, ListContentQuery, ListLikersQuery, PagedContentListResponse, PagedResponse, StampStatusDto, ToggleLikeResponse, TourStatsDto, UpdateContentRequest, UpdateStampTourRequest, UserProfileDto, ReportContentRequest, ReportContentResponse } from "@ph-cms/api-contract";
2
2
  import { AxiosInstance } from "axios";
3
3
  export declare class ContentModule {
4
4
  private client;
@@ -21,4 +21,5 @@ export declare class ContentModule {
21
21
  toggleLike(uid: string): Promise<ToggleLikeResponse>;
22
22
  getLikeStatus(uid: string): Promise<LikeStatusResponse>;
23
23
  getLikers(uid: string, params?: Partial<ListLikersQuery>): Promise<PagedResponse<UserProfileDto>>;
24
+ report(uid: string, data: ReportContentRequest): Promise<ReportContentResponse>;
24
25
  }
@@ -104,5 +104,14 @@ class ContentModule {
104
104
  }
105
105
  return this.client.get(`${this.prefix}/contents/${uid}/likers`, { params });
106
106
  }
107
+ async report(uid, data) {
108
+ if (!uid)
109
+ throw new errors_1.ValidationError("UID is required", []);
110
+ const validation = api_contract_1.ReportContentSchema.safeParse(data);
111
+ if (!validation.success) {
112
+ throw new errors_1.ValidationError("Invalid report content data", validation.error.errors);
113
+ }
114
+ return this.client.post(`${this.prefix}/contents/${uid}/report`, data);
115
+ }
107
116
  }
108
117
  exports.ContentModule = ContentModule;
@@ -1,4 +1,4 @@
1
- import { LikedStatsByTypeResponse, ListLikedContentQuery, PagedContentListResponse, UpdateUserProfileRequest, UserDto, UserProfileDto } from "@ph-cms/api-contract";
1
+ import { LikedStatsByTypeResponse, ListLikedContentQuery, PagedContentListResponse, UpdateUserProfileRequest, UserDto, UserProfileDto, BlockUserRequest, BlockUserResponse, PagedBlockedUserListResponse, SuspendUserRequest, SuspendUserResponse } from "@ph-cms/api-contract";
2
2
  import { AxiosInstance } from "axios";
3
3
  export declare class UserModule {
4
4
  private client;
@@ -34,4 +34,42 @@ export declare class UserModule {
34
34
  * @param uid - The UID of the user.
35
35
  */
36
36
  getLikedStats(uid: string): Promise<LikedStatsByTypeResponse>;
37
+ /**
38
+ * Blocks a user.
39
+ *
40
+ * @param uid - The UID of the user to block.
41
+ * @param data - The block reason (optional).
42
+ */
43
+ block(uid: string, data?: BlockUserRequest): Promise<BlockUserResponse>;
44
+ /**
45
+ * Unblocks a user.
46
+ *
47
+ * @param uid - The UID of the user to unblock.
48
+ */
49
+ unblock(uid: string): Promise<BlockUserResponse>;
50
+ /**
51
+ * Retrieves the list of blocked users.
52
+ *
53
+ * @param uid - The UID of the user (must be self or admin).
54
+ * @param params - Paging parameters.
55
+ */
56
+ getBlockedUsers(uid: string, params?: {
57
+ page?: number;
58
+ limit?: number;
59
+ }): Promise<PagedBlockedUserListResponse>;
60
+ /**
61
+ * Suspends a user (Global Ban).
62
+ * Admin only.
63
+ *
64
+ * @param uid - The UID of the user to suspend.
65
+ * @param data - Optional reason for suspension.
66
+ */
67
+ suspend(uid: string, data?: SuspendUserRequest): Promise<SuspendUserResponse>;
68
+ /**
69
+ * Unsuspends a user.
70
+ * Admin only.
71
+ *
72
+ * @param uid - The UID of the user to unsuspend.
73
+ */
74
+ unsuspend(uid: string): Promise<SuspendUserResponse>;
37
75
  }
@@ -54,5 +54,64 @@ class UserModule {
54
54
  throw new errors_1.ValidationError("UID is required", []);
55
55
  return this.client.get(`${this.prefix}/users/${uid}/liked-stats`);
56
56
  }
57
+ /**
58
+ * Blocks a user.
59
+ *
60
+ * @param uid - The UID of the user to block.
61
+ * @param data - The block reason (optional).
62
+ */
63
+ async block(uid, data = {}) {
64
+ if (!uid)
65
+ throw new errors_1.ValidationError("UID is required", []);
66
+ const validation = api_contract_1.BlockUserSchema.safeParse(data);
67
+ if (!validation.success) {
68
+ throw new errors_1.ValidationError("Invalid block user data", validation.error.errors);
69
+ }
70
+ return this.client.post(`${this.prefix}/users/${uid}/block`, data);
71
+ }
72
+ /**
73
+ * Unblocks a user.
74
+ *
75
+ * @param uid - The UID of the user to unblock.
76
+ */
77
+ async unblock(uid) {
78
+ if (!uid)
79
+ throw new errors_1.ValidationError("UID is required", []);
80
+ return this.client.delete(`${this.prefix}/users/${uid}/block`);
81
+ }
82
+ /**
83
+ * Retrieves the list of blocked users.
84
+ *
85
+ * @param uid - The UID of the user (must be self or admin).
86
+ * @param params - Paging parameters.
87
+ */
88
+ async getBlockedUsers(uid, params = {}) {
89
+ if (!uid)
90
+ throw new errors_1.ValidationError("UID is required", []);
91
+ return this.client.get(`${this.prefix}/users/${uid}/blocks`, { params });
92
+ }
93
+ /**
94
+ * Suspends a user (Global Ban).
95
+ * Admin only.
96
+ *
97
+ * @param uid - The UID of the user to suspend.
98
+ * @param data - Optional reason for suspension.
99
+ */
100
+ async suspend(uid, data = {}) {
101
+ if (!uid)
102
+ throw new errors_1.ValidationError("UID is required", []);
103
+ return this.client.post(`${this.prefix}/users/${uid}/suspend`, data);
104
+ }
105
+ /**
106
+ * Unsuspends a user.
107
+ * Admin only.
108
+ *
109
+ * @param uid - The UID of the user to unsuspend.
110
+ */
111
+ async unsuspend(uid) {
112
+ if (!uid)
113
+ throw new errors_1.ValidationError("UID is required", []);
114
+ return this.client.delete(`${this.prefix}/users/${uid}/suspend`);
115
+ }
57
116
  }
58
117
  exports.UserModule = UserModule;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ph-cms/client-sdk",
3
- "version": "0.1.38",
3
+ "version": "0.1.42",
4
4
  "description": "Unified PH-CMS Client SDK (React + Core)",
5
5
  "keywords": [],
6
6
  "license": "MIT",
@@ -30,7 +30,7 @@
30
30
  "LICENSE"
31
31
  ],
32
32
  "dependencies": {
33
- "@ph-cms/api-contract": "^0.1.15",
33
+ "@ph-cms/api-contract": "^0.1.19",
34
34
  "@tanstack/react-query": "^5.0.0",
35
35
  "axios": "^1.6.0",
36
36
  "zod": "^3.22.4"