@ph-cms/client-sdk 0.1.32 → 0.1.35
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 +25 -4
- package/dist/hooks/useContent.d.ts +1 -1
- 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.35
|
|
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
|
|
|
@@ -664,6 +667,7 @@ function RegisterForm() {
|
|
|
664
667
|
email: 'user@example.com',
|
|
665
668
|
password: 'password123',
|
|
666
669
|
display_name: '홍길동',
|
|
670
|
+
phone_number: '010-1234-5678', // 선택 사항
|
|
667
671
|
termCodes: ['SERVICE_TERM', 'PRIVACY_TERM'], // 동의할 약관 코드 목록
|
|
668
672
|
// channelUid는 PHCMSProvider에 설정된 값이 자동 사용됨
|
|
669
673
|
// 명시적으로 지정하려면: channelUid: 'my-channel'
|
|
@@ -698,6 +702,7 @@ function FirebaseRegisterForm() {
|
|
|
698
702
|
email: 'user@example.com',
|
|
699
703
|
password: 'password123',
|
|
700
704
|
display_name: '홍길동',
|
|
705
|
+
phone_number: '010-1234-5678', // 선택 사항
|
|
701
706
|
termCodes: ['SERVICE_TERM', 'PRIVACY_TERM'],
|
|
702
707
|
// channelUid는 PHCMSProvider에 설정된 값이 자동 사용됨
|
|
703
708
|
});
|
|
@@ -1082,6 +1087,20 @@ const { data: status } = useLikeStatus('content-uid');
|
|
|
1082
1087
|
console.log(status?.liked); // true or false
|
|
1083
1088
|
```
|
|
1084
1089
|
|
|
1090
|
+
### 좋아요 관련 목록 조회 (Public)
|
|
1091
|
+
|
|
1092
|
+
특정 콘텐츠를 좋아하는 사용자 목록이나, 특정 사용자가 좋아하는 콘텐츠 목록을 조회할 수 있습니다.
|
|
1093
|
+
|
|
1094
|
+
```ts
|
|
1095
|
+
// 1. 특정 콘텐츠에 좋아요를 누른 사용자 목록
|
|
1096
|
+
const likers = await client.content.getLikers('content-uid', { page: 1, limit: 10 });
|
|
1097
|
+
// => PagedResponse<UserProfileDto>
|
|
1098
|
+
|
|
1099
|
+
// 2. 특정 사용자가 좋아요를 누른 콘텐츠 목록 (타입 필터링 지원)
|
|
1100
|
+
const likedContents = await client.user.getLikedContents('user-uid', { type: 'post', page: 1 });
|
|
1101
|
+
// => PagedContentListResponse
|
|
1102
|
+
```
|
|
1103
|
+
|
|
1085
1104
|
## Stamp Tour
|
|
1086
1105
|
|
|
1087
1106
|
스탬프 투어 기능을 사용하여 특정 지점(Marker) 방문을 인증하고 진행 현황을 조회하거나, 새로운 투어를 생성할 수 있습니다.
|
|
@@ -1495,7 +1514,8 @@ const result = await content.list({ channelUid: 'my-channel' });
|
|
|
1495
1514
|
| 메서드 | 설명 |
|
|
1496
1515
|
|---|---|
|
|
1497
1516
|
| `getProfile(uid: string)` | 유저의 공개 프로필 정보 조회 → `UserProfileDto` |
|
|
1498
|
-
| `updateProfile(uid: string, data: UpdateUserProfileRequest)` | 유저의 프로필 정보 업데이트
|
|
1517
|
+
| `updateProfile(uid: string, data: UpdateUserProfileRequest)` | 유저의 프로필 정보 업데이트 → `UserDto` |
|
|
1518
|
+
| `getLikedContents(uid: string, params?: Partial<ListLikedContentQuery>)` | 사용자가 좋아요 누른 콘텐츠 목록 조회 → `PagedContentListResponse` |
|
|
1499
1519
|
|
|
1500
1520
|
### `AuthModule` (`client.auth`)
|
|
1501
1521
|
|
|
@@ -1503,8 +1523,8 @@ const result = await content.list({ channelUid: 'my-channel' });
|
|
|
1503
1523
|
|---|---|
|
|
1504
1524
|
| `login(data: LoginRequest)` | 이메일/비밀번호 로그인 → `AuthResponse` |
|
|
1505
1525
|
| `loginWithFirebase(data: FirebaseExchangeRequest)` | Firebase ID 토큰 교환 → `AuthResponse` |
|
|
1506
|
-
| `register(data: RegisterRequest)` | 이메일 회원가입 → `AuthResponse` (`channelUid` \| `channelSlug`
|
|
1507
|
-
| `registerWithFirebase(data: FirebaseRegisterRequest)` | 서버 사이드 Firebase 회원가입 → `AuthResponse` (`channelUid` \| `channelSlug`
|
|
1526
|
+
| `register(data: RegisterRequest)` | 이메일 회원가입 → `AuthResponse` (`channelUid` \| `channelSlug` 필수, `phone_number` 지원) |
|
|
1527
|
+
| `registerWithFirebase(data: FirebaseRegisterRequest)` | 서버 사이드 Firebase 회원가입 → `AuthResponse` (`channelUid` \| `channelSlug` 필수, `phone_number` 지원) |
|
|
1508
1528
|
| `me(params?: { channelUid?: string })` | 현재 사용자 프로필 조회 → `UserDto` |
|
|
1509
1529
|
| `refresh(refreshToken: string)` | 토큰 갱신 → `{ accessToken, refreshToken }` |
|
|
1510
1530
|
| `logout()` | 로그아웃 (프로바이더 토큰 삭제 + 서버 세션 무효화) |
|
|
@@ -1525,6 +1545,7 @@ const result = await content.list({ channelUid: 'my-channel' });
|
|
|
1525
1545
|
| `getTourStats(tourUid: string)` | 투어 전체 통계 조회 → `TourStatsDto` |
|
|
1526
1546
|
| `toggleLike(uid: string)` | 좋아요 토글 → `ToggleLikeResponse` |
|
|
1527
1547
|
| `getLikeStatus(uid: string)` | 내 좋아요 여부 확인 → `LikeStatusResponse` |
|
|
1548
|
+
| `getLikers(uid: string, params?: Partial<ListLikersQuery>)` | 콘텐츠에 좋아요 누른 사용자 목록 조회 → `PagedResponse<UserProfileDto>` |
|
|
1528
1549
|
|
|
1529
1550
|
### `ChannelModule` (`client.channel`)
|
|
1530
1551
|
|
|
@@ -5,7 +5,7 @@ export declare const contentKeys: {
|
|
|
5
5
|
list: (params: ListContentQuery) => readonly ["contents", "list", {
|
|
6
6
|
page: number;
|
|
7
7
|
limit: number;
|
|
8
|
-
status?:
|
|
8
|
+
status?: "published" | "draft" | "private" | undefined;
|
|
9
9
|
type?: string | undefined;
|
|
10
10
|
channelUid?: string | undefined;
|
|
11
11
|
channelSlug?: string | undefined;
|
|
@@ -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.35",
|
|
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.14",
|
|
34
34
|
"@tanstack/react-query": "^5.0.0",
|
|
35
35
|
"axios": "^1.6.0",
|
|
36
36
|
"zod": "^3.22.4"
|