stellavend-sdk 1.0.1__tar.gz
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.
- stellavend_sdk-1.0.1/PKG-INFO +223 -0
- stellavend_sdk-1.0.1/README.md +203 -0
- stellavend_sdk-1.0.1/pyproject.toml +32 -0
- stellavend_sdk-1.0.1/setup.cfg +4 -0
- stellavend_sdk-1.0.1/stellavend_api/__init__.py +47 -0
- stellavend_sdk-1.0.1/stellavend_api/client.py +534 -0
- stellavend_sdk-1.0.1/stellavend_api/py.typed +0 -0
- stellavend_sdk-1.0.1/stellavend_api/types.py +380 -0
- stellavend_sdk-1.0.1/stellavend_sdk.egg-info/PKG-INFO +223 -0
- stellavend_sdk-1.0.1/stellavend_sdk.egg-info/SOURCES.txt +11 -0
- stellavend_sdk-1.0.1/stellavend_sdk.egg-info/dependency_links.txt +1 -0
- stellavend_sdk-1.0.1/stellavend_sdk.egg-info/requires.txt +1 -0
- stellavend_sdk-1.0.1/stellavend_sdk.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: stellavend-sdk
|
|
3
|
+
Version: 1.0.1
|
|
4
|
+
Summary: StellaVend Open API SDK for Python
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
Project-URL: Homepage, https://github.com/TeamStella/stellavend-sdk-python
|
|
7
|
+
Project-URL: Repository, https://github.com/TeamStella/stellavend-sdk-python
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Framework :: AsyncIO
|
|
16
|
+
Classifier: Typing :: Typed
|
|
17
|
+
Requires-Python: >=3.8
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
Requires-Dist: aiohttp>=3.8.0
|
|
20
|
+
|
|
21
|
+
# StellaVend Open API SDK for Python
|
|
22
|
+
|
|
23
|
+
StellaVend Open API를 사용하기 위한 Python SDK입니다.
|
|
24
|
+
|
|
25
|
+
> Discord 봇용 SDK는 `stellavend-bot-sdk`를 사용하세요.
|
|
26
|
+
|
|
27
|
+
## 설치
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
pip install stellavend-sdk
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## 사용법
|
|
34
|
+
|
|
35
|
+
### 초기화
|
|
36
|
+
|
|
37
|
+
```python
|
|
38
|
+
from stellavend_api import StellaVendClient
|
|
39
|
+
|
|
40
|
+
client = StellaVendClient(
|
|
41
|
+
api_base="https://stellavend.com/api/v1/mystore",
|
|
42
|
+
api_key="sk-sv-..." # Open API Key
|
|
43
|
+
)
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### 상점 정보
|
|
47
|
+
|
|
48
|
+
```python
|
|
49
|
+
store = await client.get_store()
|
|
50
|
+
print(store.name)
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### 상품 관리
|
|
54
|
+
|
|
55
|
+
```python
|
|
56
|
+
# 목록 조회
|
|
57
|
+
products = await client.get_products(limit=50)
|
|
58
|
+
|
|
59
|
+
# 상세 조회
|
|
60
|
+
product = await client.get_product("prod_xxx")
|
|
61
|
+
|
|
62
|
+
# 생성
|
|
63
|
+
new_product = await client.create_product(
|
|
64
|
+
name="새 상품",
|
|
65
|
+
price_krw=10000,
|
|
66
|
+
description="상품 설명"
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
# 수정
|
|
70
|
+
await client.update_product("prod_xxx", price_krw=15000, is_active=True)
|
|
71
|
+
|
|
72
|
+
# 삭제
|
|
73
|
+
await client.delete_product("prod_xxx")
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### 재고 관리
|
|
77
|
+
|
|
78
|
+
```python
|
|
79
|
+
# 재고 조회
|
|
80
|
+
stock = await client.get_stock("prod_xxx")
|
|
81
|
+
print(f"{stock.count}개 재고")
|
|
82
|
+
|
|
83
|
+
# 재고 추가
|
|
84
|
+
result = await client.add_stock("prod_xxx", ["item1", "item2", "item3"])
|
|
85
|
+
print(f"{result['added']}개 추가됨, 총 {result['total']}개")
|
|
86
|
+
|
|
87
|
+
# 재고 전체 삭제
|
|
88
|
+
await client.clear_stock("prod_xxx")
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### 카테고리 관리
|
|
92
|
+
|
|
93
|
+
```python
|
|
94
|
+
categories = await client.get_categories()
|
|
95
|
+
await client.create_category(name="새 카테고리", color="#ff0000")
|
|
96
|
+
await client.update_category("cat_xxx", name="수정된 이름")
|
|
97
|
+
await client.delete_category("cat_xxx")
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### 등급 관리
|
|
101
|
+
|
|
102
|
+
```python
|
|
103
|
+
grades = await client.get_grades()
|
|
104
|
+
await client.create_grade(
|
|
105
|
+
name="VIP",
|
|
106
|
+
min_spend_krw=100000,
|
|
107
|
+
discount_type="percent",
|
|
108
|
+
discount_value=10
|
|
109
|
+
)
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### 쿠폰 관리
|
|
113
|
+
|
|
114
|
+
```python
|
|
115
|
+
coupons = await client.get_coupons()
|
|
116
|
+
await client.create_coupon(
|
|
117
|
+
code="WELCOME10",
|
|
118
|
+
type="percent",
|
|
119
|
+
value=10,
|
|
120
|
+
max_uses=100,
|
|
121
|
+
expires_at="2024-12-31T23:59:59Z"
|
|
122
|
+
)
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### 회원 관리
|
|
126
|
+
|
|
127
|
+
```python
|
|
128
|
+
# 목록 조회
|
|
129
|
+
users = await client.get_users(limit=100)
|
|
130
|
+
|
|
131
|
+
# 상세 조회
|
|
132
|
+
user = await client.get_user("user_xxx")
|
|
133
|
+
|
|
134
|
+
# 잔액 조정
|
|
135
|
+
await client.adjust_balance("user_xxx", 5000, "이벤트 지급")
|
|
136
|
+
await client.adjust_balance("user_xxx", -1000, "패널티 차감")
|
|
137
|
+
|
|
138
|
+
# 등급 설정
|
|
139
|
+
await client.set_grade("user_xxx", "grade_vip")
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### 충전 요청 관리
|
|
143
|
+
|
|
144
|
+
```python
|
|
145
|
+
charges = await client.get_charges(status="pending")
|
|
146
|
+
await client.approve_charge("charge_xxx", approved_krw=10000)
|
|
147
|
+
await client.reject_charge("charge_xxx", reason="증빙 불충분")
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### 주문 조회
|
|
151
|
+
|
|
152
|
+
```python
|
|
153
|
+
orders = await client.get_orders(status="completed", limit=50)
|
|
154
|
+
order = await client.get_order("order_xxx")
|
|
155
|
+
print(order.delivered_items)
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### 후기 관리
|
|
159
|
+
|
|
160
|
+
```python
|
|
161
|
+
reviews = await client.get_reviews(product_id="prod_xxx")
|
|
162
|
+
await client.hide_review("review_xxx", True)
|
|
163
|
+
await client.delete_review("review_xxx")
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### 분석 데이터
|
|
167
|
+
|
|
168
|
+
```python
|
|
169
|
+
analytics = await client.get_analytics("7d")
|
|
170
|
+
print(f"매출: {analytics.sales_krw}원, 주문: {analytics.order_count}건")
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### 설정
|
|
174
|
+
|
|
175
|
+
```python
|
|
176
|
+
settings = await client.get_settings()
|
|
177
|
+
await client.update_settings(
|
|
178
|
+
announcement="새 공지사항",
|
|
179
|
+
bank_charge=True
|
|
180
|
+
)
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### 웹훅
|
|
184
|
+
|
|
185
|
+
```python
|
|
186
|
+
webhooks = await client.get_webhooks()
|
|
187
|
+
await client.create_webhook(
|
|
188
|
+
url="https://example.com/webhook",
|
|
189
|
+
events=["order.completed", "charge.approved"]
|
|
190
|
+
)
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### Context Manager 사용
|
|
194
|
+
|
|
195
|
+
```python
|
|
196
|
+
async with StellaVendClient(api_base, api_key) as client:
|
|
197
|
+
products = await client.get_products()
|
|
198
|
+
# 자동으로 세션 정리됨
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
### 에러 처리
|
|
202
|
+
|
|
203
|
+
```python
|
|
204
|
+
from stellavend_api import StellaVendClient, StellaVendError
|
|
205
|
+
|
|
206
|
+
try:
|
|
207
|
+
await client.get_product("invalid_id")
|
|
208
|
+
except StellaVendError as e:
|
|
209
|
+
print(f"API 오류 ({e.status}): {e}")
|
|
210
|
+
print(f"에러 코드: {e.code}")
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
## 타입
|
|
214
|
+
|
|
215
|
+
모든 응답은 dataclass로 정의되어 있습니다:
|
|
216
|
+
|
|
217
|
+
- `Store`, `Product`, `Category`, `Grade`, `Coupon`
|
|
218
|
+
- `User`, `ChargeRequest`, `Order`, `Review`
|
|
219
|
+
- `Analytics`, `Settings`, `Webhook`
|
|
220
|
+
|
|
221
|
+
## 라이선스
|
|
222
|
+
|
|
223
|
+
MIT
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
# StellaVend Open API SDK for Python
|
|
2
|
+
|
|
3
|
+
StellaVend Open API를 사용하기 위한 Python SDK입니다.
|
|
4
|
+
|
|
5
|
+
> Discord 봇용 SDK는 `stellavend-bot-sdk`를 사용하세요.
|
|
6
|
+
|
|
7
|
+
## 설치
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pip install stellavend-sdk
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## 사용법
|
|
14
|
+
|
|
15
|
+
### 초기화
|
|
16
|
+
|
|
17
|
+
```python
|
|
18
|
+
from stellavend_api import StellaVendClient
|
|
19
|
+
|
|
20
|
+
client = StellaVendClient(
|
|
21
|
+
api_base="https://stellavend.com/api/v1/mystore",
|
|
22
|
+
api_key="sk-sv-..." # Open API Key
|
|
23
|
+
)
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### 상점 정보
|
|
27
|
+
|
|
28
|
+
```python
|
|
29
|
+
store = await client.get_store()
|
|
30
|
+
print(store.name)
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### 상품 관리
|
|
34
|
+
|
|
35
|
+
```python
|
|
36
|
+
# 목록 조회
|
|
37
|
+
products = await client.get_products(limit=50)
|
|
38
|
+
|
|
39
|
+
# 상세 조회
|
|
40
|
+
product = await client.get_product("prod_xxx")
|
|
41
|
+
|
|
42
|
+
# 생성
|
|
43
|
+
new_product = await client.create_product(
|
|
44
|
+
name="새 상품",
|
|
45
|
+
price_krw=10000,
|
|
46
|
+
description="상품 설명"
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
# 수정
|
|
50
|
+
await client.update_product("prod_xxx", price_krw=15000, is_active=True)
|
|
51
|
+
|
|
52
|
+
# 삭제
|
|
53
|
+
await client.delete_product("prod_xxx")
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### 재고 관리
|
|
57
|
+
|
|
58
|
+
```python
|
|
59
|
+
# 재고 조회
|
|
60
|
+
stock = await client.get_stock("prod_xxx")
|
|
61
|
+
print(f"{stock.count}개 재고")
|
|
62
|
+
|
|
63
|
+
# 재고 추가
|
|
64
|
+
result = await client.add_stock("prod_xxx", ["item1", "item2", "item3"])
|
|
65
|
+
print(f"{result['added']}개 추가됨, 총 {result['total']}개")
|
|
66
|
+
|
|
67
|
+
# 재고 전체 삭제
|
|
68
|
+
await client.clear_stock("prod_xxx")
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### 카테고리 관리
|
|
72
|
+
|
|
73
|
+
```python
|
|
74
|
+
categories = await client.get_categories()
|
|
75
|
+
await client.create_category(name="새 카테고리", color="#ff0000")
|
|
76
|
+
await client.update_category("cat_xxx", name="수정된 이름")
|
|
77
|
+
await client.delete_category("cat_xxx")
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### 등급 관리
|
|
81
|
+
|
|
82
|
+
```python
|
|
83
|
+
grades = await client.get_grades()
|
|
84
|
+
await client.create_grade(
|
|
85
|
+
name="VIP",
|
|
86
|
+
min_spend_krw=100000,
|
|
87
|
+
discount_type="percent",
|
|
88
|
+
discount_value=10
|
|
89
|
+
)
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### 쿠폰 관리
|
|
93
|
+
|
|
94
|
+
```python
|
|
95
|
+
coupons = await client.get_coupons()
|
|
96
|
+
await client.create_coupon(
|
|
97
|
+
code="WELCOME10",
|
|
98
|
+
type="percent",
|
|
99
|
+
value=10,
|
|
100
|
+
max_uses=100,
|
|
101
|
+
expires_at="2024-12-31T23:59:59Z"
|
|
102
|
+
)
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### 회원 관리
|
|
106
|
+
|
|
107
|
+
```python
|
|
108
|
+
# 목록 조회
|
|
109
|
+
users = await client.get_users(limit=100)
|
|
110
|
+
|
|
111
|
+
# 상세 조회
|
|
112
|
+
user = await client.get_user("user_xxx")
|
|
113
|
+
|
|
114
|
+
# 잔액 조정
|
|
115
|
+
await client.adjust_balance("user_xxx", 5000, "이벤트 지급")
|
|
116
|
+
await client.adjust_balance("user_xxx", -1000, "패널티 차감")
|
|
117
|
+
|
|
118
|
+
# 등급 설정
|
|
119
|
+
await client.set_grade("user_xxx", "grade_vip")
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### 충전 요청 관리
|
|
123
|
+
|
|
124
|
+
```python
|
|
125
|
+
charges = await client.get_charges(status="pending")
|
|
126
|
+
await client.approve_charge("charge_xxx", approved_krw=10000)
|
|
127
|
+
await client.reject_charge("charge_xxx", reason="증빙 불충분")
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### 주문 조회
|
|
131
|
+
|
|
132
|
+
```python
|
|
133
|
+
orders = await client.get_orders(status="completed", limit=50)
|
|
134
|
+
order = await client.get_order("order_xxx")
|
|
135
|
+
print(order.delivered_items)
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### 후기 관리
|
|
139
|
+
|
|
140
|
+
```python
|
|
141
|
+
reviews = await client.get_reviews(product_id="prod_xxx")
|
|
142
|
+
await client.hide_review("review_xxx", True)
|
|
143
|
+
await client.delete_review("review_xxx")
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### 분석 데이터
|
|
147
|
+
|
|
148
|
+
```python
|
|
149
|
+
analytics = await client.get_analytics("7d")
|
|
150
|
+
print(f"매출: {analytics.sales_krw}원, 주문: {analytics.order_count}건")
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### 설정
|
|
154
|
+
|
|
155
|
+
```python
|
|
156
|
+
settings = await client.get_settings()
|
|
157
|
+
await client.update_settings(
|
|
158
|
+
announcement="새 공지사항",
|
|
159
|
+
bank_charge=True
|
|
160
|
+
)
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### 웹훅
|
|
164
|
+
|
|
165
|
+
```python
|
|
166
|
+
webhooks = await client.get_webhooks()
|
|
167
|
+
await client.create_webhook(
|
|
168
|
+
url="https://example.com/webhook",
|
|
169
|
+
events=["order.completed", "charge.approved"]
|
|
170
|
+
)
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### Context Manager 사용
|
|
174
|
+
|
|
175
|
+
```python
|
|
176
|
+
async with StellaVendClient(api_base, api_key) as client:
|
|
177
|
+
products = await client.get_products()
|
|
178
|
+
# 자동으로 세션 정리됨
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### 에러 처리
|
|
182
|
+
|
|
183
|
+
```python
|
|
184
|
+
from stellavend_api import StellaVendClient, StellaVendError
|
|
185
|
+
|
|
186
|
+
try:
|
|
187
|
+
await client.get_product("invalid_id")
|
|
188
|
+
except StellaVendError as e:
|
|
189
|
+
print(f"API 오류 ({e.status}): {e}")
|
|
190
|
+
print(f"에러 코드: {e.code}")
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
## 타입
|
|
194
|
+
|
|
195
|
+
모든 응답은 dataclass로 정의되어 있습니다:
|
|
196
|
+
|
|
197
|
+
- `Store`, `Product`, `Category`, `Grade`, `Coupon`
|
|
198
|
+
- `User`, `ChargeRequest`, `Order`, `Review`
|
|
199
|
+
- `Analytics`, `Settings`, `Webhook`
|
|
200
|
+
|
|
201
|
+
## 라이선스
|
|
202
|
+
|
|
203
|
+
MIT
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "stellavend-sdk"
|
|
7
|
+
version = "1.0.1"
|
|
8
|
+
description = "StellaVend Open API SDK for Python"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "MIT"
|
|
11
|
+
requires-python = ">=3.8"
|
|
12
|
+
classifiers = [
|
|
13
|
+
"Programming Language :: Python :: 3",
|
|
14
|
+
"Programming Language :: Python :: 3.8",
|
|
15
|
+
"Programming Language :: Python :: 3.9",
|
|
16
|
+
"Programming Language :: Python :: 3.10",
|
|
17
|
+
"Programming Language :: Python :: 3.11",
|
|
18
|
+
"Programming Language :: Python :: 3.12",
|
|
19
|
+
"Operating System :: OS Independent",
|
|
20
|
+
"Framework :: AsyncIO",
|
|
21
|
+
"Typing :: Typed",
|
|
22
|
+
]
|
|
23
|
+
dependencies = [
|
|
24
|
+
"aiohttp>=3.8.0",
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
[project.urls]
|
|
28
|
+
"Homepage" = "https://github.com/TeamStella/stellavend-sdk-python"
|
|
29
|
+
"Repository" = "https://github.com/TeamStella/stellavend-sdk-python"
|
|
30
|
+
|
|
31
|
+
[tool.setuptools.packages.find]
|
|
32
|
+
include = ["stellavend_api*"]
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"""
|
|
2
|
+
StellaVend Open API SDK for Python
|
|
3
|
+
|
|
4
|
+
Open API Key (sk-sv-...) 를 사용하는 일반 API SDK입니다.
|
|
5
|
+
Discord 봇용 SDK는 stellavend-bot-sdk를 사용하세요.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from .client import StellaVendClient, StellaVendError
|
|
9
|
+
from .types import (
|
|
10
|
+
Store,
|
|
11
|
+
Product,
|
|
12
|
+
BulkTier,
|
|
13
|
+
Category,
|
|
14
|
+
Grade,
|
|
15
|
+
Coupon,
|
|
16
|
+
User,
|
|
17
|
+
ChargeRequest,
|
|
18
|
+
Order,
|
|
19
|
+
Review,
|
|
20
|
+
Analytics,
|
|
21
|
+
Settings,
|
|
22
|
+
Webhook,
|
|
23
|
+
StockResult,
|
|
24
|
+
BalanceResult,
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
__all__ = [
|
|
28
|
+
"StellaVendClient",
|
|
29
|
+
"StellaVendError",
|
|
30
|
+
"Store",
|
|
31
|
+
"Product",
|
|
32
|
+
"BulkTier",
|
|
33
|
+
"Category",
|
|
34
|
+
"Grade",
|
|
35
|
+
"Coupon",
|
|
36
|
+
"User",
|
|
37
|
+
"ChargeRequest",
|
|
38
|
+
"Order",
|
|
39
|
+
"Review",
|
|
40
|
+
"Analytics",
|
|
41
|
+
"Settings",
|
|
42
|
+
"Webhook",
|
|
43
|
+
"StockResult",
|
|
44
|
+
"BalanceResult",
|
|
45
|
+
]
|
|
46
|
+
|
|
47
|
+
__version__ = "1.0.0"
|