@ph-cms/client-sdk 0.1.32 → 0.1.33
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 +21 -2
- package/dist/modules/content.d.ts +2 -1
- package/dist/modules/content.js +9 -0
- package/dist/modules/user.d.ts +8 -1
- package/dist/modules/user.js +17 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# @ph-cms/client-sdk 0.1.
|
|
1
|
+
# @ph-cms/client-sdk 0.1.33
|
|
2
2
|
|
|
3
3
|
PH-CMS 클라이언트 SDK — 브라우저 및 React 애플리케이션을 위한 통합 클라이언트.
|
|
4
4
|
|
|
@@ -69,6 +69,8 @@ import type {
|
|
|
69
69
|
CreateStampTourRequest,
|
|
70
70
|
UpdateStampTourRequest,
|
|
71
71
|
ListContentQuery,
|
|
72
|
+
ListLikersQuery,
|
|
73
|
+
ListLikedContentQuery,
|
|
72
74
|
PagedContentListResponse,
|
|
73
75
|
|
|
74
76
|
// Hierarchy / Policy
|
|
@@ -89,6 +91,7 @@ import type {
|
|
|
89
91
|
|
|
90
92
|
// Common
|
|
91
93
|
PagedResponse,
|
|
94
|
+
UserProfileDto,
|
|
92
95
|
} from '@ph-cms/client-sdk';
|
|
93
96
|
```
|
|
94
97
|
|
|
@@ -1082,6 +1085,20 @@ const { data: status } = useLikeStatus('content-uid');
|
|
|
1082
1085
|
console.log(status?.liked); // true or false
|
|
1083
1086
|
```
|
|
1084
1087
|
|
|
1088
|
+
### 좋아요 관련 목록 조회 (Public)
|
|
1089
|
+
|
|
1090
|
+
특정 콘텐츠를 좋아하는 사용자 목록이나, 특정 사용자가 좋아하는 콘텐츠 목록을 조회할 수 있습니다.
|
|
1091
|
+
|
|
1092
|
+
```ts
|
|
1093
|
+
// 1. 특정 콘텐츠에 좋아요를 누른 사용자 목록
|
|
1094
|
+
const likers = await client.content.getLikers('content-uid', { page: 1, limit: 10 });
|
|
1095
|
+
// => PagedResponse<UserProfileDto>
|
|
1096
|
+
|
|
1097
|
+
// 2. 특정 사용자가 좋아요를 누른 콘텐츠 목록 (타입 필터링 지원)
|
|
1098
|
+
const likedContents = await client.user.getLikedContents('user-uid', { type: 'post', page: 1 });
|
|
1099
|
+
// => PagedContentListResponse
|
|
1100
|
+
```
|
|
1101
|
+
|
|
1085
1102
|
## Stamp Tour
|
|
1086
1103
|
|
|
1087
1104
|
스탬프 투어 기능을 사용하여 특정 지점(Marker) 방문을 인증하고 진행 현황을 조회하거나, 새로운 투어를 생성할 수 있습니다.
|
|
@@ -1495,7 +1512,8 @@ const result = await content.list({ channelUid: 'my-channel' });
|
|
|
1495
1512
|
| 메서드 | 설명 |
|
|
1496
1513
|
|---|---|
|
|
1497
1514
|
| `getProfile(uid: string)` | 유저의 공개 프로필 정보 조회 → `UserProfileDto` |
|
|
1498
|
-
| `updateProfile(uid: string, data: UpdateUserProfileRequest)` | 유저의 프로필 정보 업데이트
|
|
1515
|
+
| `updateProfile(uid: string, data: UpdateUserProfileRequest)` | 유저의 프로필 정보 업데이트 → `UserDto` |
|
|
1516
|
+
| `getLikedContents(uid: string, params?: Partial<ListLikedContentQuery>)` | 사용자가 좋아요 누른 콘텐츠 목록 조회 → `PagedContentListResponse` |
|
|
1499
1517
|
|
|
1500
1518
|
### `AuthModule` (`client.auth`)
|
|
1501
1519
|
|
|
@@ -1525,6 +1543,7 @@ const result = await content.list({ channelUid: 'my-channel' });
|
|
|
1525
1543
|
| `getTourStats(tourUid: string)` | 투어 전체 통계 조회 → `TourStatsDto` |
|
|
1526
1544
|
| `toggleLike(uid: string)` | 좋아요 토글 → `ToggleLikeResponse` |
|
|
1527
1545
|
| `getLikeStatus(uid: string)` | 내 좋아요 여부 확인 → `LikeStatusResponse` |
|
|
1546
|
+
| `getLikers(uid: string, params?: Partial<ListLikersQuery>)` | 콘텐츠에 좋아요 누른 사용자 목록 조회 → `PagedResponse<UserProfileDto>` |
|
|
1528
1547
|
|
|
1529
1548
|
### `ChannelModule` (`client.channel`)
|
|
1530
1549
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CollectStampRequest, ContentDto, CreateContentRequest, CreateStampTourRequest, LikeStatusResponse, ListContentQuery, PagedContentListResponse, StampStatusDto, ToggleLikeResponse, TourStatsDto, UpdateContentRequest, UpdateStampTourRequest } from "@ph-cms/api-contract";
|
|
1
|
+
import { CollectStampRequest, ContentDto, CreateContentRequest, CreateStampTourRequest, LikeStatusResponse, ListContentQuery, ListLikersQuery, PagedContentListResponse, PagedResponse, StampStatusDto, ToggleLikeResponse, TourStatsDto, UpdateContentRequest, UpdateStampTourRequest, UserProfileDto } from "@ph-cms/api-contract";
|
|
2
2
|
import { AxiosInstance } from "axios";
|
|
3
3
|
export declare class ContentModule {
|
|
4
4
|
private client;
|
|
@@ -20,4 +20,5 @@ export declare class ContentModule {
|
|
|
20
20
|
getTourStats(tourUid: string): Promise<TourStatsDto>;
|
|
21
21
|
toggleLike(uid: string): Promise<ToggleLikeResponse>;
|
|
22
22
|
getLikeStatus(uid: string): Promise<LikeStatusResponse>;
|
|
23
|
+
getLikers(uid: string, params?: Partial<ListLikersQuery>): Promise<PagedResponse<UserProfileDto>>;
|
|
23
24
|
}
|
package/dist/modules/content.js
CHANGED
|
@@ -95,5 +95,14 @@ class ContentModule {
|
|
|
95
95
|
throw new errors_1.ValidationError("UID is required", []);
|
|
96
96
|
return this.client.get(`${this.prefix}/contents/${uid}/like`);
|
|
97
97
|
}
|
|
98
|
+
async getLikers(uid, params = {}) {
|
|
99
|
+
if (!uid)
|
|
100
|
+
throw new errors_1.ValidationError("UID is required", []);
|
|
101
|
+
const validation = api_contract_1.ListLikersQuerySchema.safeParse(params);
|
|
102
|
+
if (!validation.success) {
|
|
103
|
+
throw new errors_1.ValidationError("Invalid list likers params", validation.error.errors);
|
|
104
|
+
}
|
|
105
|
+
return this.client.get(`${this.prefix}/contents/${uid}/likers`, { params });
|
|
106
|
+
}
|
|
98
107
|
}
|
|
99
108
|
exports.ContentModule = ContentModule;
|
package/dist/modules/user.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { UpdateUserProfileRequest, UserDto, UserProfileDto } from "@ph-cms/api-contract";
|
|
1
|
+
import { ListLikedContentQuery, PagedContentListResponse, UpdateUserProfileRequest, UserDto, UserProfileDto } from "@ph-cms/api-contract";
|
|
2
2
|
import { AxiosInstance } from "axios";
|
|
3
3
|
export declare class UserModule {
|
|
4
4
|
private client;
|
|
@@ -21,4 +21,11 @@ export declare class UserModule {
|
|
|
21
21
|
* @param data - The update payload.
|
|
22
22
|
*/
|
|
23
23
|
updateProfile(uid: string, data: UpdateUserProfileRequest | Record<string, any>): Promise<UserDto>;
|
|
24
|
+
/**
|
|
25
|
+
* Retrieves contents liked by a specific user.
|
|
26
|
+
*
|
|
27
|
+
* @param uid - The UID of the user.
|
|
28
|
+
* @param params - Query parameters for filtering and pagination.
|
|
29
|
+
*/
|
|
30
|
+
getLikedContents(uid: string, params?: Partial<ListLikedContentQuery>): Promise<PagedContentListResponse>;
|
|
24
31
|
}
|
package/dist/modules/user.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.UserModule = void 0;
|
|
4
|
+
const api_contract_1 = require("@ph-cms/api-contract");
|
|
5
|
+
const errors_1 = require("../errors");
|
|
4
6
|
class UserModule {
|
|
5
7
|
constructor(client, prefix = '/api') {
|
|
6
8
|
this.client = client;
|
|
@@ -27,5 +29,20 @@ class UserModule {
|
|
|
27
29
|
async updateProfile(uid, data) {
|
|
28
30
|
return this.client.patch(`${this.prefix}/users/${uid}`, data);
|
|
29
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Retrieves contents liked by a specific user.
|
|
34
|
+
*
|
|
35
|
+
* @param uid - The UID of the user.
|
|
36
|
+
* @param params - Query parameters for filtering and pagination.
|
|
37
|
+
*/
|
|
38
|
+
async getLikedContents(uid, params = {}) {
|
|
39
|
+
if (!uid)
|
|
40
|
+
throw new errors_1.ValidationError("UID is required", []);
|
|
41
|
+
const validation = api_contract_1.ListLikedContentQuerySchema.safeParse(params);
|
|
42
|
+
if (!validation.success) {
|
|
43
|
+
throw new errors_1.ValidationError("Invalid list liked contents params", validation.error.errors);
|
|
44
|
+
}
|
|
45
|
+
return this.client.get(`${this.prefix}/users/${uid}/liked-contents`, { params });
|
|
46
|
+
}
|
|
30
47
|
}
|
|
31
48
|
exports.UserModule = UserModule;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ph-cms/client-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.33",
|
|
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.
|
|
33
|
+
"@ph-cms/api-contract": "^0.1.12",
|
|
34
34
|
"@tanstack/react-query": "^5.0.0",
|
|
35
35
|
"axios": "^1.6.0",
|
|
36
36
|
"zod": "^3.22.4"
|